From 9ceaa82d640d468f32984438ed7395fe5a76fa66 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 6 Jul 2023 15:03:12 +0200 Subject: [PATCH 01/15] add code_len to v12 --- frame/contracts/src/migration/v12.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frame/contracts/src/migration/v12.rs b/frame/contracts/src/migration/v12.rs index c7987075f54b4..dff8da6edecee 100644 --- a/frame/contracts/src/migration/v12.rs +++ b/frame/contracts/src/migration/v12.rs @@ -80,6 +80,7 @@ pub struct CodeInfo { #[codec(compact)] refcount: u64, determinism: Determinism, + code_len: u32, } #[storage_alias] @@ -177,6 +178,7 @@ impl MigrationStep for Migration { owner: old_info.owner, deposit, refcount: old_info.refcount, + code_len: code_len as u32, }; let amount = old_info.deposit.saturating_sub(info.deposit); From 094922d67dc4a6d62baa4785ddd97d5d30d4cb47 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 6 Jul 2023 15:11:29 +0200 Subject: [PATCH 02/15] fix --- frame/contracts/src/wasm/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index fa05de3f33ac0..5bb26c93322fe 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -268,10 +268,9 @@ impl WasmBlob { fn load_code( code_hash: CodeHash, gas_meter: &mut GasMeter, - ) -> Result, DispatchError> { - let max_code_len = T::MaxCodeLen::get(); - let charged = gas_meter.charge(CodeLoadToken(max_code_len))?; - + ) -> Result<(CodeVec, CodeInfo), DispatchError> { + gas_meter.charge(CodeLoadToken(code_info.code_len))?; + let code_info = >::get(code_hash).ok_or(Error::::CodeNotFound)?; let code = >::get(code_hash).ok_or(Error::::CodeNotFound)?; let code_len = code.len() as u32; gas_meter.adjust_gas(charged, CodeLoadToken(code_len)); From c17ebcd580314570832c550343608b5bcade1838 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Thu, 6 Jul 2023 15:11:51 +0200 Subject: [PATCH 03/15] Update frame/contracts/src/wasm/mod.rs --- frame/contracts/src/wasm/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 5bb26c93322fe..075a20b51a1b9 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -92,6 +92,8 @@ pub struct CodeInfo { /// to be run on-chain. Specifically, such a code can never be instantiated into a contract /// and can just be used through a delegate call. determinism: Determinism, + /// length of the code in bytes. + code_len: u32, } /// Defines the required determinism level of a wasm blob when either running or uploading code. From 0d0bcc4855a78d44160b37014d527afc2d556cd0 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 6 Jul 2023 15:12:27 +0200 Subject: [PATCH 04/15] fix --- frame/contracts/src/wasm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 075a20b51a1b9..93f7a06f06ad0 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -271,8 +271,8 @@ impl WasmBlob { code_hash: CodeHash, gas_meter: &mut GasMeter, ) -> Result<(CodeVec, CodeInfo), DispatchError> { - gas_meter.charge(CodeLoadToken(code_info.code_len))?; let code_info = >::get(code_hash).ok_or(Error::::CodeNotFound)?; + gas_meter.charge(CodeLoadToken(code_info.code_len))?; let code = >::get(code_hash).ok_or(Error::::CodeNotFound)?; let code_len = code.len() as u32; gas_meter.adjust_gas(charged, CodeLoadToken(code_len)); From 97a2745ce849893680e14946f1fa3ead41969f21 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 11:50:38 +0200 Subject: [PATCH 05/15] fixes --- frame/contracts/src/wasm/mod.rs | 13 ++----------- frame/contracts/src/wasm/prepare.rs | 6 ++++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index 93f7a06f06ad0..076905567a98f 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -274,10 +274,7 @@ impl WasmBlob { let code_info = >::get(code_hash).ok_or(Error::::CodeNotFound)?; gas_meter.charge(CodeLoadToken(code_info.code_len))?; let code = >::get(code_hash).ok_or(Error::::CodeNotFound)?; - let code_len = code.len() as u32; - gas_meter.adjust_gas(charged, CodeLoadToken(code_len)); - - Ok(code) + Ok((code, code_info)) } /// Create the module without checking the passed code. @@ -310,13 +307,7 @@ impl Executable for WasmBlob { code_hash: CodeHash, gas_meter: &mut GasMeter, ) -> Result { - let code = Self::load_code(code_hash, gas_meter)?; - // We store `code_info` at the same time as contract code, - // therefore this query shouldn't really fail. - // We consider its failure equal to `CodeNotFound`, as contract code without - // `code_info` is unusable in this pallet. - let code_info = >::get(code_hash).ok_or(Error::::CodeNotFound)?; - + let (code, code_info) = Self::load_code(code_hash, gas_meter)?; Ok(Self { code, code_info, code_hash }) } diff --git a/frame/contracts/src/wasm/prepare.rs b/frame/contracts/src/wasm/prepare.rs index ee89aae642b4a..7deccdde7a069 100644 --- a/frame/contracts/src/wasm/prepare.rs +++ b/frame/contracts/src/wasm/prepare.rs @@ -286,11 +286,12 @@ where validate::(code.as_ref(), schedule, determinism)?; // Calculate deposit for storing contract code and `code_info` in two different storage items. - let bytes_added = code.len().saturating_add(>::max_encoded_len()) as u32; + let code_len = code.len() as u32; + let bytes_added = code_len.saturating_add(>::max_encoded_len() as u32); let deposit = Diff { bytes_added, items_added: 2, ..Default::default() } .update_contract::(None) .charge_or_zero(); - let code_info = CodeInfo { owner, deposit, determinism, refcount: 0 }; + let code_info = CodeInfo { owner, deposit, determinism, refcount: 0, code_len }; let code_hash = T::Hashing::hash(&code); Ok(WasmBlob { code, code_info, code_hash }) @@ -320,6 +321,7 @@ pub mod benchmarking { // this is a helper function for benchmarking which skips deposit collection deposit: Default::default(), refcount: 0, + code_len: code.len() as u32, determinism, }; let code_hash = T::Hashing::hash(&code); From 6cb2c10b9e64191b6652a9ae34a6dc57d4f536f8 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 13:39:58 +0200 Subject: [PATCH 06/15] rm test --- frame/contracts/src/tests.rs | 80 ------------------------------------ 1 file changed, 80 deletions(-) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index f67be602695d6..19d9851f15ddc 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -2979,86 +2979,6 @@ fn gas_estimation_nested_call_fixed_limit() { }); } -#[test] -fn gas_estimation_call_runtime() { - use codec::Decode; - let (caller_code, _caller_hash) = compile_module::("call_runtime").unwrap(); - let (callee_code, _callee_hash) = compile_module::("dummy").unwrap(); - ExtBuilder::default().existential_deposit(50).build().execute_with(|| { - let min_balance = ::Currency::minimum_balance(); - let _ = Balances::deposit_creating(&ALICE, 1000 * min_balance); - let _ = Balances::deposit_creating(&CHARLIE, 1000 * min_balance); - - let addr_caller = Contracts::bare_instantiate( - ALICE, - min_balance * 100, - GAS_LIMIT, - None, - Code::Upload(caller_code), - vec![], - vec![0], - DebugInfo::Skip, - CollectEvents::Skip, - ) - .result - .unwrap() - .account_id; - - let addr_callee = Contracts::bare_instantiate( - ALICE, - min_balance * 100, - GAS_LIMIT, - None, - Code::Upload(callee_code), - vec![], - vec![1], - DebugInfo::Skip, - CollectEvents::Skip, - ) - .result - .unwrap() - .account_id; - - // Call something trivial with a huge gas limit so that we can observe the effects - // of pre-charging. This should create a difference between consumed and required. - let call = RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { - dest: addr_callee, - value: min_balance * 10, - }); - let result = Contracts::bare_call( - ALICE, - addr_caller.clone(), - 0, - GAS_LIMIT, - None, - call.encode(), - DebugInfo::Skip, - CollectEvents::Skip, - Determinism::Enforced, - ); - // contract encodes the result of the dispatch runtime - let outcome = u32::decode(&mut result.result.unwrap().data.as_ref()).unwrap(); - assert_eq!(outcome, 0); - assert!(result.gas_required.ref_time() > result.gas_consumed.ref_time()); - - // Make the same call using the required gas. Should succeed. - assert_ok!( - Contracts::bare_call( - ALICE, - addr_caller, - 0, - result.gas_required, - None, - call.encode(), - DebugInfo::Skip, - CollectEvents::Skip, - Determinism::Enforced, - ) - .result - ); - }); -} - #[test] fn call_runtime_reentrancy_guarded() { let (caller_code, _caller_hash) = compile_module::("call_runtime").unwrap(); From bed614fbd5c06ce35ff3c4282b647ca6afc171ff Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 13:42:05 +0200 Subject: [PATCH 07/15] add test back --- frame/contracts/src/tests.rs | 88 ++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 19d9851f15ddc..cd142422e6e4c 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -2979,6 +2979,94 @@ fn gas_estimation_nested_call_fixed_limit() { }); } +#[test] +fn gas_estimation_call_runtime() { + use codec::Decode; + let (caller_code, _caller_hash) = compile_module::("call_runtime").unwrap(); + let (callee_code, _callee_hash) = compile_module::("dummy").unwrap(); + ExtBuilder::default().existential_deposit(50).build().execute_with(|| { + let min_balance = ::Currency::minimum_balance(); + let _ = Balances::deposit_creating(&ALICE, 1000 * min_balance); + let _ = Balances::deposit_creating(&CHARLIE, 1000 * min_balance); + + let addr_caller = Contracts::bare_instantiate( + ALICE, + min_balance * 100, + GAS_LIMIT, + None, + Code::Upload(caller_code), + vec![], + vec![0], + DebugInfo::Skip, + CollectEvents::Skip, + ) + .result + .unwrap() + .account_id; + + let addr_callee = Contracts::bare_instantiate( + ALICE, + min_balance * 100, + GAS_LIMIT, + None, + Code::Upload(callee_code), + vec![], + vec![1], + DebugInfo::Skip, + CollectEvents::Skip, + ) + .result + .unwrap() + .account_id; + + // Call something trivial with a huge gas limit so that we can observe the effects + // of pre-charging. This should create a difference between consumed and required. + let call = RuntimeCall::Contracts(crate::Call::call { + dest: addr_callee, + value: 0, + gas_limit: GAS_LIMIT / 3, + storage_deposit_limit: None, + data: vec![], + }); + + let call = RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { + dest: addr_callee, + value: min_balance * 10, + }); + let result = Contracts::bare_call( + ALICE, + addr_caller.clone(), + 0, + GAS_LIMIT, + None, + call.encode(), + DebugInfo::Skip, + CollectEvents::Skip, + Determinism::Enforced, + ); + // contract encodes the result of the dispatch runtime + let outcome = u32::decode(&mut result.result.unwrap().data.as_ref()).unwrap(); + assert_eq!(outcome, 0); + assert!(result.gas_required.ref_time() > result.gas_consumed.ref_time()); + + // Make the same call using the required gas. Should succeed. + assert_ok!( + Contracts::bare_call( + ALICE, + addr_caller, + 0, + result.gas_required, + None, + call.encode(), + DebugInfo::Skip, + CollectEvents::Skip, + Determinism::Enforced, + ) + .result + ); + }); +} + #[test] fn call_runtime_reentrancy_guarded() { let (caller_code, _caller_hash) = compile_module::("call_runtime").unwrap(); From 138397bc786d08c0b13d2f9ec78ac600401904c3 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 14:58:37 +0200 Subject: [PATCH 08/15] fix --- frame/contracts/src/tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index cd142422e6e4c..31f1634b9e616 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -3029,10 +3029,10 @@ fn gas_estimation_call_runtime() { data: vec![], }); - let call = RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { - dest: addr_callee, - value: min_balance * 10, - }); + // let call = RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { + // dest: addr_callee, + // value: min_balance * 10, + // }); let result = Contracts::bare_call( ALICE, addr_caller.clone(), From 5775961e80eb713894e1bcc27ba6cdbba44a1c9f Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 16:30:25 +0200 Subject: [PATCH 09/15] update test --- frame/contracts/src/dummy_pallet.rs | 22 +++++++++++++ .../contracts/src/{tests.rs => tests/mod.rs} | 19 ++++------- frame/contracts/src/tests/pallet_dummy.rs | 32 +++++++++++++++++++ 3 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 frame/contracts/src/dummy_pallet.rs rename frame/contracts/src/{tests.rs => tests/mod.rs} (99%) create mode 100644 frame/contracts/src/tests/pallet_dummy.rs diff --git a/frame/contracts/src/dummy_pallet.rs b/frame/contracts/src/dummy_pallet.rs new file mode 100644 index 0000000000000..70a5ab4903364 --- /dev/null +++ b/frame/contracts/src/dummy_pallet.rs @@ -0,0 +1,22 @@ +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config; + + #[pallet::error] + pub enum Error { + InvalidCommand, + XcmVersionNotSupported, + PreparationMissing, + ExecutionFailed, + SendFailed, + CannotWeigh, + } + + impl Pallet {} +} diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests/mod.rs similarity index 99% rename from frame/contracts/src/tests.rs rename to frame/contracts/src/tests/mod.rs index 31f1634b9e616..f664bdc29edde 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests/mod.rs @@ -1,4 +1,5 @@ // This file is part of Substrate. +mod pallet_dummy; // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 @@ -72,6 +73,7 @@ frame_support::construct_runtime!( Utility: pallet_utility::{Pallet, Call, Storage, Event}, Contracts: pallet_contracts::{Pallet, Call, Storage, Event}, Proxy: pallet_proxy::{Pallet, Call, Storage, Event}, + Dummy: pallet_dummy } ); @@ -378,6 +380,8 @@ impl pallet_proxy::Config for Test { type AnnouncementDepositFactor = ConstU64<1>; } +impl pallet_dummy::Config for Test {} + parameter_types! { pub MySchedule: Schedule = { let schedule = >::default(); @@ -3004,7 +3008,7 @@ fn gas_estimation_call_runtime() { .unwrap() .account_id; - let addr_callee = Contracts::bare_instantiate( + Contracts::bare_instantiate( ALICE, min_balance * 100, GAS_LIMIT, @@ -3021,18 +3025,7 @@ fn gas_estimation_call_runtime() { // Call something trivial with a huge gas limit so that we can observe the effects // of pre-charging. This should create a difference between consumed and required. - let call = RuntimeCall::Contracts(crate::Call::call { - dest: addr_callee, - value: 0, - gas_limit: GAS_LIMIT / 3, - storage_deposit_limit: None, - data: vec![], - }); - - // let call = RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { - // dest: addr_callee, - // value: min_balance * 10, - // }); + let call = RuntimeCall::Dummy(pallet_dummy::Call::over_estimate_pre_charge {}); let result = Contracts::bare_call( ALICE, addr_caller.clone(), diff --git a/frame/contracts/src/tests/pallet_dummy.rs b/frame/contracts/src/tests/pallet_dummy.rs new file mode 100644 index 0000000000000..3bf98bc6b99bb --- /dev/null +++ b/frame/contracts/src/tests/pallet_dummy.rs @@ -0,0 +1,32 @@ +pub use pallet::*; + +#[frame_support::pallet(dev_mode)] +pub mod pallet { + use frame_support::{ + dispatch::{Pays, PostDispatchInfo}, + pallet_prelude::DispatchResultWithPostInfo, + weights::Weight, + }; + use frame_system::pallet_prelude::*; + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::call] + impl Pallet { + /// Dummy call that over charge the predispatch weight, so we can test correct values of + /// [`ContractResult::gas_consumed`] and [`ContractResult::gas_required`] in tests. + #[pallet::call_index(1)] + #[pallet::weight(Weight::from_parts(10_000_000, 0))] + pub fn over_estimate_pre_charge(origin: OriginFor) -> DispatchResultWithPostInfo { + ensure_signed(origin)?; + Ok(PostDispatchInfo { + actual_weight: Some(Weight::from_parts(100, 0)), + pays_fee: Pays::Yes, + }) + } + } +} From 0080d7ab271133d5fc06bf94945ac5cba6e02501 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 16:36:29 +0200 Subject: [PATCH 10/15] Fix comments --- frame/contracts/src/tests/mod.rs | 2 +- frame/contracts/src/tests/pallet_dummy.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/tests/mod.rs b/frame/contracts/src/tests/mod.rs index f664bdc29edde..eec85e9f0af38 100644 --- a/frame/contracts/src/tests/mod.rs +++ b/frame/contracts/src/tests/mod.rs @@ -3025,7 +3025,7 @@ fn gas_estimation_call_runtime() { // Call something trivial with a huge gas limit so that we can observe the effects // of pre-charging. This should create a difference between consumed and required. - let call = RuntimeCall::Dummy(pallet_dummy::Call::over_estimate_pre_charge {}); + let call = RuntimeCall::Dummy(pallet_dummy::Call::overestimate_pre_charge {}); let result = Contracts::bare_call( ALICE, addr_caller.clone(), diff --git a/frame/contracts/src/tests/pallet_dummy.rs b/frame/contracts/src/tests/pallet_dummy.rs index 3bf98bc6b99bb..d84e34de06c8d 100644 --- a/frame/contracts/src/tests/pallet_dummy.rs +++ b/frame/contracts/src/tests/pallet_dummy.rs @@ -17,11 +17,12 @@ pub mod pallet { #[pallet::call] impl Pallet { - /// Dummy call that over charge the predispatch weight, so we can test correct values of - /// [`ContractResult::gas_consumed`] and [`ContractResult::gas_required`] in tests. + /// Dummy function that overcharges the predispatch weight, allowing us to test the correct + /// values of [`ContractResult::gas_consumed`] and [`ContractResult::gas_required`] in + /// tests. #[pallet::call_index(1)] #[pallet::weight(Weight::from_parts(10_000_000, 0))] - pub fn over_estimate_pre_charge(origin: OriginFor) -> DispatchResultWithPostInfo { + pub fn overestimate_pre_charge(origin: OriginFor) -> DispatchResultWithPostInfo { ensure_signed(origin)?; Ok(PostDispatchInfo { actual_weight: Some(Weight::from_parts(100, 0)), From 3964a044703862d32bfee6dec9df01b8cc7c5664 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 16:48:18 +0200 Subject: [PATCH 11/15] fix build --- frame/contracts/src/migration/v12.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/frame/contracts/src/migration/v12.rs b/frame/contracts/src/migration/v12.rs index dff8da6edecee..b586a35725e5e 100644 --- a/frame/contracts/src/migration/v12.rs +++ b/frame/contracts/src/migration/v12.rs @@ -223,6 +223,7 @@ impl MigrationStep for Migration { deposit: v.deposit, refcount: v.refcount, owner: v.owner, + code_len: module.code.len(), }; (k, info) }) From dee9351d3be05a5f7efe71dc994982229615c44d Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 16:52:52 +0200 Subject: [PATCH 12/15] del --- frame/contracts/src/dummy_pallet.rs | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 frame/contracts/src/dummy_pallet.rs diff --git a/frame/contracts/src/dummy_pallet.rs b/frame/contracts/src/dummy_pallet.rs deleted file mode 100644 index 70a5ab4903364..0000000000000 --- a/frame/contracts/src/dummy_pallet.rs +++ /dev/null @@ -1,22 +0,0 @@ -#[frame_support::pallet] -pub mod pallet { - use super::*; - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::config] - pub trait Config: frame_system::Config; - - #[pallet::error] - pub enum Error { - InvalidCommand, - XcmVersionNotSupported, - PreparationMissing, - ExecutionFailed, - SendFailed, - CannotWeigh, - } - - impl Pallet {} -} From 8646e65421faaa009abb339bc0e5e732e6b43300 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 17:05:23 +0200 Subject: [PATCH 13/15] fix clippy --- frame/contracts/src/tests/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frame/contracts/src/tests/mod.rs b/frame/contracts/src/tests/mod.rs index eec85e9f0af38..d5c7cc6f5a04a 100644 --- a/frame/contracts/src/tests/mod.rs +++ b/frame/contracts/src/tests/mod.rs @@ -3020,8 +3020,7 @@ fn gas_estimation_call_runtime() { CollectEvents::Skip, ) .result - .unwrap() - .account_id; + .unwrap(); // Call something trivial with a huge gas limit so that we can observe the effects // of pre-charging. This should create a difference between consumed and required. From 5ea7fd77bdfc5da14581cd518ad8dae3c4f1dddd Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 10 Jul 2023 17:17:18 +0200 Subject: [PATCH 14/15] fix --- frame/contracts/src/migration/v12.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/contracts/src/migration/v12.rs b/frame/contracts/src/migration/v12.rs index b586a35725e5e..4fb7ca76fea92 100644 --- a/frame/contracts/src/migration/v12.rs +++ b/frame/contracts/src/migration/v12.rs @@ -223,7 +223,7 @@ impl MigrationStep for Migration { deposit: v.deposit, refcount: v.refcount, owner: v.owner, - code_len: module.code.len(), + code_len: module.code.len() as u32, }; (k, info) }) From 0fe17b2ca0a5e08c849e473f9410c9ac27f0f2af Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 14 Jul 2023 13:32:01 +0200 Subject: [PATCH 15/15] re-rename --- frame/contracts/src/{tests/mod.rs => tests.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename frame/contracts/src/{tests/mod.rs => tests.rs} (100%) diff --git a/frame/contracts/src/tests/mod.rs b/frame/contracts/src/tests.rs similarity index 100% rename from frame/contracts/src/tests/mod.rs rename to frame/contracts/src/tests.rs