Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Salt in code generation during build_create #842

Merged
2 changes: 1 addition & 1 deletion crates/lang/codegen/src/generator/cross_calling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ impl CrossCalling<'_> {
fn #ident(
#( #input_bindings : #input_types ),*
) -> Self::#output_ident {
::ink_env::call::build_create::<Environment, Salt, Self>()
::ink_env::call::build_create::<Environment, Self>()
.exec_input(
::ink_env::call::ExecutionInput::new(
::ink_env::call::Selector::new([ #( #composed_selector ),* ])
Expand Down
35 changes: 32 additions & 3 deletions crates/lang/macro/tests/ui/pass/07-flipper-as-dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@ use ink_lang as ink;

#[ink::contract(compile_as_dependency = true)]
mod flipper {
#[ink_lang::trait_definition]
pub trait FlipperTrait {
#[ink(constructor)]
fn new() -> Self;

#[ink(message)]
fn flip(&mut self);

#[ink(message)]
fn get(&self) -> bool;
}

#[ink(storage)]
pub struct Flipper {
value: bool,
}

impl Flipper {
#[ink(constructor)]
pub fn new(init_value: bool) -> Self {
pub fn new2(init_value: bool) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this I would add a new UI test instead. This way we have the bug isolated

Self { value: init_value }
}

Expand All @@ -19,12 +31,29 @@ mod flipper {
}

#[ink(message)]
pub fn flip(&mut self) {
pub fn flip2(&mut self) {
self.value = !self.value;
}

#[ink(message)]
pub fn get2(&self) -> bool {
self.value
}
}

impl FlipperTrait for Flipper {
#[ink(constructor)]
fn new() -> Self {
Self::default()
}

#[ink(message)]
fn flip(&mut self) {
self.value = !self.value;
}

#[ink(message)]
pub fn get(&self) -> bool {
fn get(&self) -> bool {
self.value
}
}
Expand Down