This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Upgradable contracts using set_code function
#10690
Merged
paritytech-processbot
merged 33 commits into
paritytech:master
from
Supercolony-net:set_code
Feb 11, 2022
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
b1dd3d7
poc logic
yarikbratashchuk 3d525a2
set_code_hash impl, tests, benchmark
yarikbratashchuk 4eb26af
Address @xgreenx's comments
yarikbratashchuk 0120c35
Move func defs closer to set_storage
yarikbratashchuk 0a8b745
Check if code exists
yarikbratashchuk 49250c5
Document error for non-existing code hash
yarikbratashchuk a4c479c
Revert unrelated change
yarikbratashchuk e36d5e5
Changes due to @athei's review
yarikbratashchuk a5a3ec8
Fix error handling
yarikbratashchuk 01987ea
Emit ContractCodeUpdated when setting new code_hash
yarikbratashchuk a6f3f44
Address @athei's comments
yarikbratashchuk 516d29a
Move related defs to the bottom
yarikbratashchuk 759dcc1
Minor comment update
yarikbratashchuk d6a1445
Merge branch 'master' into set_code
yarikbratashchuk f8f708c
Improve docs
yarikbratashchuk 12c91d8
Improve docs
yarikbratashchuk 15e3901
Update frame/contracts/src/wasm/runtime.rs
yarikbratashchuk 08f67ea
Refactor set_code_hash test
yarikbratashchuk 3bc8008
Merge branch 'master' into set_code
yarikbratashchuk c6f1645
Minor change to benchmark
yarikbratashchuk 9d190a5
Minor change to benchmark
yarikbratashchuk 3e2a1a4
Minor comment refactor
yarikbratashchuk ae5b1a4
Merge branch 'master' into set_code
yarikbratashchuk 168dc95
Address @HCastano's comments
yarikbratashchuk 5e79310
Merge branch 'set_code' of github.com:Supercolony-net/substrate into …
yarikbratashchuk e96341e
Update seal_set_code_hash comment
yarikbratashchuk 6f925a9
Move set_code_hash after delegate_call
yarikbratashchuk 7a64c0c
Move function to the bottom
yarikbratashchuk b8e5314
Moved and changed banchmark, added verify block
yarikbratashchuk 33e7075
Bring back previous benchmark
yarikbratashchuk b5d25a0
Remove skip_meta for seal_set_code_hash
yarikbratashchuk b32e4ec
Bring back skip_meta for seal_set_storage_per_new_kb
yarikbratashchuk 769a3f1
Apply weights
yarikbratashchuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| (module | ||
| (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) | ||
| (import "env" "memory" (memory 1 1)) | ||
|
|
||
| ;; [0, 32) return value | ||
| (data (i32.const 0) "\02") | ||
|
|
||
| (func (export "deploy")) | ||
|
|
||
| (func (export "call") | ||
| (call $seal_return (i32.const 0) (i32.const 0) (i32.const 4)) | ||
| ) | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| (module | ||
| (import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
| (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) | ||
| (import "__unstable__" "seal_set_code_hash" (func $seal_set_code_hash (param i32) (result i32))) | ||
|
|
||
| (import "env" "memory" (memory 1 1)) | ||
|
|
||
| ;; [0, 32) here we store input | ||
|
|
||
| ;; [32, 36) input size | ||
| (data (i32.const 32) "\20") | ||
|
|
||
| ;; [36, 40) return value | ||
| (data (i32.const 36) "\01") | ||
|
|
||
| (func $assert (param i32) | ||
| (block $ok | ||
| (br_if $ok | ||
| (get_local 0) | ||
| ) | ||
| (unreachable) | ||
| ) | ||
| ) | ||
|
|
||
| (func (export "call") | ||
| (local $exit_code i32) | ||
|
|
||
| (call $seal_input (i32.const 0) (i32.const 32)) | ||
|
|
||
| (set_local $exit_code | ||
| (call $seal_set_code_hash (i32.const 0)) ;; Pointer to the input data. | ||
| ) | ||
| (call $assert | ||
| (i32.eq (get_local $exit_code) (i32.const 0)) ;; ReturnCode::Success | ||
| ) | ||
|
|
||
| ;; we return 1 after setting new code_hash | ||
| ;; next `call` will NOT return this value, because contract code has been changed | ||
| (call $seal_return (i32.const 0) (i32.const 36) (i32.const 4)) | ||
| ) | ||
|
|
||
| (func (export "deploy")) | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.