mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 13:21:01 +00:00
contracts: Add salt argument to contract instantiation (#7482)
* pallet-contracts: Fix seal_restore_to to output proper module errors Those errors where part of the decl_error for some time but where never actually returned. This allows proper debugging of failed restorations. Previously, any error did return the misleading `ContractTrapped`. * Bind UncheckedFrom<T::Hash> + AsRef<[u8]> everywhere This allows us to make assumptions about the AccoutId that are necessary for testing and in order to benchmark the module properly. This also groups free standing functions into inherent functions in order to minimize the places where the new bounds need to be specified. * Rework contract address determination * Do not allow override by runtime author * Instantiate gained a new parameter "salt" This change is done now in expecation of the upcoming code rent which needs to change the instantiation dispatchable and host function anyways. The situation in where we have only something that is like CREATE2 makes it impossible for UIs to help the user to create an arbitrary amount of instantiations from the same code. With this change we have the same functionality as ethereum with a CREATE and CREATE2 instantation semantic. * Remove TrieIdGenerator The new trait bounds allows us to remove this workaround from the configuration trait. * Remove default parameters for config trait It should be solely the responsiblity to determine proper values for these parameter. As a matter of fact most runtime weren't using these values anyways. * Fix tests for new account id type Because of the new bounds on the trait tests can't get away by using u64 as accound id. Replacing the 8 byte value by a 32 byte value creates out quite a bit of code churn. * Fix benchmarks The benchmarks need adaption to the new instantiate semantics. * Fix compile errors caused by adding new trait bounds * Fix compile errors caused by renaming storage and rent functions * Adapt host functions and dispatchables to the new salt * Add tests for instantiate host functions (was not possible before) * Add benchmark results * Adapt to the new WeightInfo The new benchmarks add a new parameter for salt "s" to the instantiate weights that needs to be applied. * Fix deploying_wasm_contract_should_work integration test This test is adapted to use the new instantiate signature. * Break overlong line * Break more long lines Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
committed by
GitHub
parent
26830a20df
commit
c3ca78fae3
@@ -26,7 +26,7 @@
|
||||
(func $call_2
|
||||
(call $assert
|
||||
(i32.eq
|
||||
(call $seal_transfer (i32.const 68) (i32.const 8) (i32.const 76) (i32.const 8))
|
||||
(call $seal_transfer (i32.const 136) (i32.const 32) (i32.const 100) (i32.const 8))
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@@ -47,10 +47,11 @@
|
||||
;; Dispatch the call according to input size
|
||||
(func (export "call")
|
||||
(local $input_size i32)
|
||||
(i32.store (i32.const 64) (i32.const 64))
|
||||
(call $seal_input (i32.const 1024) (i32.const 64))
|
||||
;; 4 byte i32 for br_table followed by 32 byte destination for transfer
|
||||
(i32.store (i32.const 128) (i32.const 36))
|
||||
(call $seal_input (i32.const 132) (i32.const 128))
|
||||
(set_local $input_size
|
||||
(i32.load (i32.const 64))
|
||||
(i32.load (i32.const 132))
|
||||
)
|
||||
(block $IF_ELSE
|
||||
(block $IF_2
|
||||
@@ -81,25 +82,24 @@
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
)
|
||||
(i32.store (i32.const 128) (i32.const 64))
|
||||
(call $seal_input
|
||||
(i32.const 0)
|
||||
(i32.const 64)
|
||||
(i32.const 104)
|
||||
(i32.const 100)
|
||||
)
|
||||
(call $seal_set_rent_allowance
|
||||
(i32.const 0)
|
||||
(i32.load (i32.const 64))
|
||||
(i32.const 104)
|
||||
(i32.load (i32.const 128))
|
||||
)
|
||||
)
|
||||
|
||||
;; Encoding of 10 in balance
|
||||
(data (i32.const 0) "\28")
|
||||
|
||||
;; Size of the buffer at address 0
|
||||
(data (i32.const 64) "\40")
|
||||
|
||||
;; encoding of Charlies's account id
|
||||
(data (i32.const 68) "\03")
|
||||
|
||||
;; encoding of 50 balance
|
||||
(data (i32.const 76) "\32")
|
||||
(data (i32.const 100) "\32")
|
||||
|
||||
;; [128, 132) size of seal input buffer
|
||||
|
||||
;; [132, inf) output buffer for seal input
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user