Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
536b500
Return `ConstructorResult` in `deploy()`
HCastano Nov 16, 2022
1ab55d9
Wrap return type with `Result` in metadata
HCastano Nov 16, 2022
79dff48
Check that constructor's return Results in tests
HCastano Nov 16, 2022
228604c
Add test showing that `Result`s are decoded correctly
HCastano Nov 16, 2022
bb4c1a2
Correctly generate metadata for constructors
HCastano Nov 17, 2022
15439a4
Merge branch 'master' into hc-impl-lang-error-for-constructors
HCastano Nov 17, 2022
27b6b97
Fix some nitpicks from Andrew's PR
HCastano Nov 17, 2022
eb10da6
Wrap dispatch return types with `Ok`
HCastano Nov 17, 2022
8b1aa66
Manually wrap metadata return with `ConstructorResult`
HCastano Nov 17, 2022
36556e7
Fix existing constructor integration tests
HCastano Nov 17, 2022
e61576e
Remove constructor related test from `integration-flipper`
HCastano Nov 17, 2022
a3e0b24
Fix compile tests
HCastano Nov 17, 2022
fb8d293
Add `ident` to dictionary
HCastano Nov 17, 2022
394ffca
Simplify code
athei Nov 18, 2022
2f026a2
Driveby: Also simplify call dispatch
athei Nov 18, 2022
c501d84
Small fixes to type paths
HCastano Nov 18, 2022
c307516
Check that actual instantiate call fails
HCastano Nov 18, 2022
aaebac4
Add some tests using the `CreateBuilder`
HCastano Nov 18, 2022
b63ef91
Clean up the `create_builder` tests
HCastano Nov 19, 2022
0c37262
Merge branch 'master' into hc-impl-lang-error-for-constructors
HCastano Nov 21, 2022
ec6253d
Remove unused method
HCastano Nov 21, 2022
d56b728
Format code for generating constructor return type
HCastano Nov 21, 2022
053f570
Add `constructors-return-value` to CI
HCastano Nov 21, 2022
7305887
Move shared imports out of messages
HCastano Nov 21, 2022
0ef75f9
Appease Clippy
HCastano Nov 21, 2022
4607a67
Appease Clippy
HCastano Nov 21, 2022
f791bfb
Try flipping order of tests
HCastano Nov 21, 2022
5d0f164
Change message name
HCastano Nov 21, 2022
e8b4e75
Revert last two changes
HCastano Nov 21, 2022
cab6c98
Try moving message related test to different module
HCastano Nov 21, 2022
4dc9973
Revert "Try moving message related test to different module"
HCastano Nov 21, 2022
ad1cab7
Try different type for account ID
HCastano Nov 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Try flipping order of tests
  • Loading branch information
HCastano committed Nov 21, 2022
commit f791bfb983de8276f6c7d0f877af864051a1ec4e
100 changes: 51 additions & 49 deletions examples/lang-err-integration-tests/call-builder/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,57 @@ mod call_builder {
mod e2e_tests {
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;

#[ink_e2e::test(
additional_contracts = "../integration-flipper/Cargo.toml ../constructors-return-value/Cargo.toml"
)]
async fn e2e_create_builder_fails_with_invalid_selector(
mut client: ink_e2e::Client<C, E>,
) -> E2EResult<()> {
let constructor = call_builder::constructors::new();
let contract_acc_id = client
.instantiate(&mut ink_e2e::eve(), constructor, 0, None)
.await
.expect("instantiate failed")
.account_id;

let code_hash = client
.upload(
&mut ink_e2e::eve(),
constructors_return_value::CONTRACT_PATH,
None,
)
.await
.expect("upload `constructors_return_value` failed")
.code_hash;

let invalid_selector = [0x00, 0x00, 0x00, 0x00];
let call_result = client
.call(
&mut ink_e2e::eve(),
contract_acc_id.clone(),
call_builder::messages::call_instantiate(
ink_e2e::utils::runtime_hash_to_ink_hash::<
ink::env::DefaultEnvironment,
>(&code_hash),
invalid_selector,
true,
),
0,
None,
)
.await
.expect("Client failed to call `call_builder::call_instantiate`.")
.value
.expect("Dispatching `call_builder::call_instantiate` failed.");

assert!(
call_result.is_none(),
"Call using invalid selector succeeded, when it should've failed."
);

Ok(())
}

#[ink_e2e::test(
additional_contracts = "../integration-flipper/Cargo.toml ../constructors-return-value/Cargo.toml"
)]
Expand Down Expand Up @@ -214,54 +265,5 @@ mod call_builder {

Ok(())
}

#[ink_e2e::test(additional_contracts = "../constructors-return-value/Cargo.toml")]
async fn e2e_create_builder_fails_with_invalid_selector(
mut client: ink_e2e::Client<C, E>,
) -> E2EResult<()> {
let constructor = call_builder::constructors::new();
let contract_acc_id = client
.instantiate(&mut ink_e2e::eve(), constructor, 0, None)
.await
.expect("instantiate failed")
.account_id;

let code_hash = client
.upload(
&mut ink_e2e::eve(),
constructors_return_value::CONTRACT_PATH,
None,
)
.await
.expect("upload `constructors_return_value` failed")
.code_hash;

let invalid_selector = [0x00, 0x00, 0x00, 0x00];
let call_result = client
.call(
&mut ink_e2e::eve(),
contract_acc_id.clone(),
call_builder::messages::call_instantiate(
ink_e2e::utils::runtime_hash_to_ink_hash::<
ink::env::DefaultEnvironment,
>(&code_hash),
invalid_selector,
true,
),
0,
None,
)
.await
.expect("Client failed to call `call_builder::call_instantiate`.")
.value
.expect("Dispatching `call_builder::call_instantiate` failed.");

assert!(
call_result.is_none(),
"Call using invalid selector succeeded, when it should've failed."
);

Ok(())
}
}
}