Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- `Mapping`: Reflect all possible failure cases in comments ‒ [#2079](https://github.com/paritytech/ink/pull/2079)
- [E2E] Rename `.call` to `.call_builder` ‒ [#2078](https://github.com/paritytech/ink/pull/2078)

### Added
- Custom signature topic in Events - [#2031](https://github.com/paritytech/ink/pull/2031)
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub trait ContractsBackend<E: Environment> {
///
/// ```ignore
/// // Message method
/// let get = call.get();
/// let get = call_builder.get();
/// let get_res = client
/// .call(&ink_e2e::bob(), &get)
/// // Optional arguments
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e/src/contract_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub struct InstantiationResult<E: Environment, EventLog> {

impl<E: Environment, EventLog> InstantiationResult<E, EventLog> {
/// Returns the account id at which the contract was instantiated.
pub fn call<Contract>(&self) -> <Contract as ContractCallBuilder>::Type
pub fn call_builder<Contract>(&self) -> <Contract as ContractCallBuilder>::Type
where
Contract: ContractCallBuilder,
Contract::Type: FromAccountId<E>,
Expand Down
25 changes: 12 additions & 13 deletions integration-tests/call-builder-return-value/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ mod call_builder {

let expected_value = 42;
let mut constructor = CallBuilderReturnValueRef::new(expected_value);
let call_builder = client
let contract = client
.instantiate("call_builder_return_value", &origin, &mut constructor)
.submit()
.await
.expect("instantiate failed");
let mut call_builder_call = call_builder.call::<CallBuilderReturnValue>();
let mut call_builder = contract.call_builder::<CallBuilderReturnValue>();

let code_hash = client
.upload("incrementer", &origin)
Expand All @@ -147,7 +147,7 @@ mod call_builder {
.code_hash;

let selector = ink::selector_bytes!("get");
let call = call_builder_call.delegate_call(code_hash, selector);
let call = call_builder.delegate_call(code_hash, selector);
let call_result = client
.call(&origin, &call)
.submit()
Expand All @@ -174,12 +174,12 @@ mod call_builder {
.await;

let mut constructor = CallBuilderReturnValueRef::new(42);
let call_builder = client
let contract = client
.instantiate("call_builder_return_value", &origin, &mut constructor)
.submit()
.await
.expect("instantiate failed");
let mut call_builder_call = call_builder.call::<CallBuilderReturnValue>();
let mut call_builder = contract.call_builder::<CallBuilderReturnValue>();

let code_hash = client
.upload("incrementer", &origin)
Expand All @@ -189,8 +189,7 @@ mod call_builder {
.code_hash;

let selector = ink::selector_bytes!("get");
let call =
call_builder_call.delegate_call_short_return_type(code_hash, selector);
let call = call_builder.delegate_call_short_return_type(code_hash, selector);
let call_result: Result<i8, String> =
client.call(&origin, &call).dry_run().await?.return_value();

Expand Down Expand Up @@ -218,12 +217,12 @@ mod call_builder {
.await;

let mut constructor = CallBuilderReturnValueRef::new(0);
let call_builder = client
let contract = client
.instantiate("call_builder_return_value", &origin, &mut constructor)
.submit()
.await
.expect("instantiate failed");
let mut call_builder_call = call_builder.call::<CallBuilderReturnValue>();
let mut call_builder = contract.call_builder::<CallBuilderReturnValue>();

let expected_value = 42;
let mut incrementer_constructor = IncrementerRef::new(expected_value);
Expand All @@ -234,7 +233,7 @@ mod call_builder {
.expect("instantiate failed");

let selector = ink::selector_bytes!("get");
let call = call_builder_call.forward_call(incrementer.account_id, selector);
let call = call_builder.forward_call(incrementer.account_id, selector);
let call_result = client
.call(&origin, &call)
.submit()
Expand All @@ -261,12 +260,12 @@ mod call_builder {
.await;

let mut constructor = CallBuilderReturnValueRef::new(0);
let call_builder = client
let contract = client
.instantiate("call_builder_return_value", &origin, &mut constructor)
.submit()
.await
.expect("instantiate failed");
let mut call_builder_call = call_builder.call::<CallBuilderReturnValue>();
let mut call_builder = contract.call_builder::<CallBuilderReturnValue>();

let expected_value = 42;
let mut incrementer_constructor = IncrementerRef::new(expected_value);
Expand All @@ -277,7 +276,7 @@ mod call_builder {
.expect("instantiate failed");

let selector = ink::selector_bytes!("get");
let call = call_builder_call
let call = call_builder
.forward_call_short_return_type(incrementer.account_id, selector);
let call_result: Result<i8, String> =
client.call(&origin, &call).dry_run().await?.return_value();
Expand Down
14 changes: 7 additions & 7 deletions integration-tests/call-runtime/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ mod runtime_call {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<RuntimeCaller>();
let mut call_builder = contract.call_builder::<RuntimeCaller>();

let receiver: AccountId = default_accounts::<DefaultEnvironment>().bob;

Expand All @@ -180,7 +180,7 @@ mod runtime_call {

// when
let transfer_message =
call.transfer_through_runtime(receiver, TRANSFER_VALUE);
call_builder.transfer_through_runtime(receiver, TRANSFER_VALUE);

let call_res = client
.call(&ink_e2e::alice(), &transfer_message)
Expand Down Expand Up @@ -229,13 +229,13 @@ mod runtime_call {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<RuntimeCaller>();
let mut call_builder = contract.call_builder::<RuntimeCaller>();

let receiver: AccountId = default_accounts::<DefaultEnvironment>().bob;

// when
let transfer_message =
call.transfer_through_runtime(receiver, INSUFFICIENT_TRANSFER_VALUE);
let transfer_message = call_builder
.transfer_through_runtime(receiver, INSUFFICIENT_TRANSFER_VALUE);

let call_res = client
.call(&ink_e2e::alice(), &transfer_message)
Expand Down Expand Up @@ -265,10 +265,10 @@ mod runtime_call {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<RuntimeCaller>();
let mut call_builder = contract.call_builder::<RuntimeCaller>();

// when
let transfer_message = call.call_nonexistent_extrinsic();
let transfer_message = call_builder.call_nonexistent_extrinsic();

let call_res = client
.call(&ink_e2e::alice(), &transfer_message)
Expand Down
16 changes: 8 additions & 8 deletions integration-tests/contract-storage/e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ async fn get_contract_storage_consumes_entire_buffer<Client: E2EBackend>(
.submit()
.await
.expect("instantiate failed");
let call = contract.call::<ContractStorage>();
let call_builder = contract.call_builder::<ContractStorage>();

// when
let result = client
.call(
&ink_e2e::alice(),
&call.set_and_get_storage_all_data_consumed(),
&call_builder.set_and_get_storage_all_data_consumed(),
)
.submit()
.await
Expand All @@ -43,13 +43,13 @@ async fn get_contract_storage_fails_when_extra_data<Client: E2EBackend>(
.submit()
.await
.expect("instantiate failed");
let call = contract.call::<ContractStorage>();
let call_builder = contract.call_builder::<ContractStorage>();

// when
let result = client
.call(
&ink_e2e::alice(),
&call.set_and_get_storage_partial_data_consumed(),
&call_builder.set_and_get_storage_partial_data_consumed(),
)
.submit()
.await;
Expand All @@ -73,13 +73,13 @@ async fn take_contract_storage_consumes_entire_buffer<Client: E2EBackend>(
.submit()
.await
.expect("instantiate failed");
let call = contract.call::<ContractStorage>();
let call_builder = contract.call_builder::<ContractStorage>();

// when
let result = client
.call(
&ink_e2e::alice(),
&call.set_and_take_storage_all_data_consumed(),
&call_builder.set_and_take_storage_all_data_consumed(),
)
.submit()
.await
Expand All @@ -102,13 +102,13 @@ async fn take_contract_storage_fails_when_extra_data<Client: E2EBackend>(
.submit()
.await
.expect("instantiate failed");
let call = contract.call::<ContractStorage>();
let call_builder = contract.call_builder::<ContractStorage>();

// when
let result = client
.call(
&ink_e2e::alice(),
&call.set_and_take_storage_partial_data_consumed(),
&call_builder.set_and_take_storage_partial_data_consumed(),
)
.submit()
.await;
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/contract-terminate/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ pub mod just_terminates {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<JustTerminate>();
let mut call_builder = contract.call_builder::<JustTerminate>();

// when
let terminate_me = call.terminate_me();
let terminate_me = call_builder.terminate_me();
let call_res = client
.call(&ink_e2e::alice(), &terminate_me)
.submit()
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/contract-transfer/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ pub mod give_me {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<GiveMe>();
let mut call_builder = contract.call_builder::<GiveMe>();

// when
let transfer = call.give_me(120);
let transfer = call_builder.give_me(120);

let call_res = client
.call(&ink_e2e::bob(), &transfer)
Expand Down Expand Up @@ -233,15 +233,15 @@ pub mod give_me {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<GiveMe>();
let mut call_builder = contract.call_builder::<GiveMe>();

let balance_before: Balance = client
.free_balance(contract.account_id.clone())
.await
.expect("getting balance failed");

// when
let transfer = call.give_me(120);
let transfer = call_builder.give_me(120);

let call_res = client
.call(&ink_e2e::eve(), &transfer)
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/custom-allocator/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ mod custom_allocator {
.submit()
.await
.expect("instantiate failed");
let call = contract.call::<CustomAllocator>();
let call_builder = contract.call_builder::<CustomAllocator>();

// Then
let get = call.get();
let get = call_builder.get();
let get_result = client.call(&ink_e2e::alice(), &get).dry_run().await?;
assert!(matches!(get_result.return_value(), false));

Expand All @@ -145,22 +145,22 @@ mod custom_allocator {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<CustomAllocator>();
let mut call_builder = contract.call_builder::<CustomAllocator>();

let get = call.get();
let get = call_builder.get();
let get_result = client.call(&ink_e2e::bob(), &get).dry_run().await?;
assert!(matches!(get_result.return_value(), false));

// When
let flip = call.flip();
let flip = call_builder.flip();
let _flip_result = client
.call(&ink_e2e::bob(), &flip)
.submit()
.await
.expect("flip failed");

// Then
let get = call.get();
let get = call_builder.get();
let get_result = client.call(&ink_e2e::bob(), &get).dry_run().await?;
assert!(matches!(get_result.return_value(), true));

Expand Down
8 changes: 4 additions & 4 deletions integration-tests/custom-environment/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ mod runtime_call {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<Topics>();
let mut call_builder = contract.call_builder::<Topics>();

// when
let message = call.trigger();
let message = call_builder.trigger();

let call_res = client
.call(&ink_e2e::alice(), &message)
Expand Down Expand Up @@ -128,9 +128,9 @@ mod runtime_call {
.submit()
.await
.expect("instantiate failed");
let mut call = contract.call::<Topics>();
let mut call_builder = contract.call_builder::<Topics>();

let message = call.trigger();
let message = call_builder.trigger();

// when
let call_res = client.call(&ink_e2e::alice(), &message).dry_run().await;
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/e2e-call-runtime/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub mod e2e_call_runtime {
.submit()
.await
.expect("instantiate failed");
let call = contract.call::<Contract>();
let call_builder = contract.call_builder::<Contract>();

let transfer_amount = 100_000_000_000u128;

Expand All @@ -54,7 +54,7 @@ pub mod e2e_call_runtime {
Value::u128(transfer_amount),
];

let get_balance = call.get_contract_balance();
let get_balance = call_builder.get_contract_balance();
let pre_balance = client
.call(&ink_e2e::alice(), &get_balance)
.dry_run()
Expand All @@ -73,7 +73,7 @@ pub mod e2e_call_runtime {
.expect("runtime call failed");

// then
let get_balance = call.get_contract_balance();
let get_balance = call_builder.get_contract_balance();
let get_balance_res = client
.call(&ink_e2e::alice(), &get_balance)
.dry_run()
Expand Down
Loading