mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 21:11:01 +00:00
Upgradable contracts using set_code function (#10690)
* poc logic * set_code_hash impl, tests, benchmark * Address @xgreenx's comments * Move func defs closer to set_storage * Check if code exists - increment/decrement codehash refcount * Document error for non-existing code hash * Revert unrelated change * Changes due to @athei's review * Fix error handling - comment errors: ReturnCodes - update mock ext implementation - return Error::CodeNotFound when no code for such hash * Emit ContractCodeUpdated when setting new code_hash * Address @athei's comments * Move related defs to the bottom * Minor comment update Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Improve docs * Improve docs * Update frame/contracts/src/wasm/runtime.rs Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Refactor set_code_hash test * Minor change to benchmark Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Minor change to benchmark Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Minor comment refactor Co-authored-by: Alexander Theißen <alex.theissen@me.com> * Address @HCastano's comments * Update seal_set_code_hash comment Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com> * Move set_code_hash after delegate_call * Move function to the bottom * Moved and changed banchmark, added verify block * Bring back previous benchmark * Remove skip_meta for seal_set_code_hash * Bring back skip_meta for seal_set_storage_per_new_kb * Apply weights Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
83eed8018b
commit
e70ffbf44d
@@ -328,6 +328,9 @@ pub struct HostFnWeights<T: Config> {
|
||||
/// Weight per overwritten byte of an item stored with `seal_set_storage`.
|
||||
pub set_storage_per_old_byte: Weight,
|
||||
|
||||
/// Weight of calling `seal_set_code_hash`.
|
||||
pub set_code_hash: Weight,
|
||||
|
||||
/// Weight of calling `seal_clear_storage`.
|
||||
pub clear_storage: Weight,
|
||||
|
||||
@@ -606,6 +609,7 @@ impl<T: Config> Default for HostFnWeights<T> {
|
||||
),
|
||||
debug_message: cost_batched!(seal_debug_message),
|
||||
set_storage: cost_batched!(seal_set_storage),
|
||||
set_code_hash: cost_batched!(seal_set_code_hash),
|
||||
set_storage_per_new_byte: cost_byte_batched!(seal_set_storage_per_new_kb),
|
||||
set_storage_per_old_byte: cost_byte_batched!(seal_set_storage_per_old_kb),
|
||||
clear_storage: cost_batched!(seal_clear_storage),
|
||||
|
||||
Reference in New Issue
Block a user