From 8a4b8c1ac69f4e02faa48200e1da331542af2432 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 18 May 2023 13:05:51 +0100 Subject: [PATCH 1/4] `[ink_e2e]` update `Determinism` enum to match Substrate definition --- crates/e2e/src/xts.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/e2e/src/xts.rs b/crates/e2e/src/xts.rs index ffccdb344c1..26280ed2002 100644 --- a/crates/e2e/src/xts.rs +++ b/crates/e2e/src/xts.rs @@ -124,12 +124,11 @@ pub struct Transfer { )] #[encode_as_type(crate_path = "subxt::ext::scale_encode")] pub enum Determinism { - /// The execution should be deterministic and hence no indeterministic instructions - /// are allowed. + /// The execution should be deterministic and hence no indeterministic instructions are + /// allowed. /// - /// Dispatchables always use this mode in order to make on-chain execution - /// deterministic. - Deterministic, + /// Dispatchables always use this mode in order to make on-chain execution deterministic. + Enforced, /// Allow calling or uploading an indeterministic code. /// /// This is only possible when calling into `pallet-contracts` directly via @@ -138,7 +137,7 @@ pub enum Determinism { /// # Note /// /// **Never** use this mode for on-chain execution. - AllowIndeterminism, + Relaxed, } /// A raw call to `pallet-contracts`'s `upload`. @@ -372,7 +371,7 @@ where origin: subxt::tx::Signer::account_id(signer).clone(), code, storage_deposit_limit, - determinism: Determinism::Deterministic, + determinism: Determinism::Enforced, }; let func = "ContractsApi_upload_code"; let params = rpc_params![func, Bytes(scale::Encode::encode(&call_request))]; @@ -404,7 +403,7 @@ where UploadCode:: { code, storage_deposit_limit, - determinism: Determinism::Deterministic, + determinism: Determinism::Enforced, }, ) .unvalidated(); From 7f9b11039f56dce3bff3b49b44b15cd37b9afbff Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 18 May 2023 13:09:53 +0100 Subject: [PATCH 2/4] fmt --- crates/e2e/src/xts.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/e2e/src/xts.rs b/crates/e2e/src/xts.rs index 26280ed2002..aaef07cbab7 100644 --- a/crates/e2e/src/xts.rs +++ b/crates/e2e/src/xts.rs @@ -124,10 +124,11 @@ pub struct Transfer { )] #[encode_as_type(crate_path = "subxt::ext::scale_encode")] pub enum Determinism { - /// The execution should be deterministic and hence no indeterministic instructions are - /// allowed. + /// The execution should be deterministic and hence no indeterministic instructions + /// are allowed. /// - /// Dispatchables always use this mode in order to make on-chain execution deterministic. + /// Dispatchables always use this mode in order to make on-chain execution + /// deterministic. Enforced, /// Allow calling or uploading an indeterministic code. /// From bed9ce73472ec8e1c7c245eae72f77303fe3d49c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 18 May 2023 14:26:54 +0100 Subject: [PATCH 3/4] Fix multi_contract_caller example for new deposit behaviour --- integration-tests/multi-contract-caller/accumulator/lib.rs | 2 +- integration-tests/multi-contract-caller/adder/lib.rs | 2 +- integration-tests/multi-contract-caller/lib.rs | 4 ++-- integration-tests/multi-contract-caller/subber/lib.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/integration-tests/multi-contract-caller/accumulator/lib.rs b/integration-tests/multi-contract-caller/accumulator/lib.rs index 9986f4dc139..5f76910081c 100644 --- a/integration-tests/multi-contract-caller/accumulator/lib.rs +++ b/integration-tests/multi-contract-caller/accumulator/lib.rs @@ -15,7 +15,7 @@ pub mod accumulator { impl Accumulator { /// Initializes the value to the initial value. - #[ink(constructor)] + #[ink(constructor, payable)] pub fn new(init_value: i32) -> Self { Self { value: init_value } } diff --git a/integration-tests/multi-contract-caller/adder/lib.rs b/integration-tests/multi-contract-caller/adder/lib.rs index 72529d7dadb..366693122d2 100644 --- a/integration-tests/multi-contract-caller/adder/lib.rs +++ b/integration-tests/multi-contract-caller/adder/lib.rs @@ -18,7 +18,7 @@ mod adder { impl Adder { /// Creates a new `adder` from the given `accumulator`. - #[ink(constructor)] + #[ink(constructor, payable)] pub fn new(accumulator: AccumulatorRef) -> Self { Self { accumulator } } diff --git a/integration-tests/multi-contract-caller/lib.rs b/integration-tests/multi-contract-caller/lib.rs index be4318f8f97..44fa79a541b 100644 --- a/integration-tests/multi-contract-caller/lib.rs +++ b/integration-tests/multi-contract-caller/lib.rs @@ -50,7 +50,7 @@ mod multi_contract_caller { impl MultiContractCaller { /// Instantiate a `multi_contract_caller` contract with the given sub-contract /// codes. - #[ink(constructor)] + #[ink(constructor, payable)] pub fn new( init_value: i32, version: u32, @@ -155,7 +155,7 @@ mod multi_contract_caller { "multi_contract_caller", &ink_e2e::alice(), constructor, - 0, + 10_000_000_000_000, None, ) .await diff --git a/integration-tests/multi-contract-caller/subber/lib.rs b/integration-tests/multi-contract-caller/subber/lib.rs index aee051bfc90..541f290d320 100644 --- a/integration-tests/multi-contract-caller/subber/lib.rs +++ b/integration-tests/multi-contract-caller/subber/lib.rs @@ -18,7 +18,7 @@ mod subber { impl Subber { /// Creates a new `subber` from the given `accumulator`. - #[ink(constructor)] + #[ink(constructor, payable)] pub fn new(accumulator: AccumulatorRef) -> Self { Self { accumulator } } From 2b7096fc98a3d2ffc5be3d195e1e0170867665cf Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 18 May 2023 16:29:33 +0100 Subject: [PATCH 4/4] Reenable examples-test step --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71ba5d3db98..73e16d2c055 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -365,7 +365,7 @@ codecov: #### stage: examples -.examples-test: +examples-test: stage: examples <<: *docker-env <<: *test-refs