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
Contracts Add deposit for dependencies #14079
Merged
Merged
Changes from 68 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
304d84b
wip
pgherveou 4e80ea6
fixes
pgherveou dc744af
rm comment
pgherveou 5f9a226
join fns
pgherveou b6def6d
clippy
pgherveou 76c43c2
Fix limits
pgherveou 83e5f37
reduce diff
pgherveou e3c51ec
fix
pgherveou 8c15372
fix
pgherveou c97708b
fix typo
pgherveou 0180777
refactor store to use self
pgherveou 89accc8
refactor run to take self by value
pgherveou 0e61306
pass tests
pgherveou 49c174e
rm comment
pgherveou 9f53e36
fixes
pgherveou 5036e88
fix typo
pgherveou 09a9971
rm
pgherveou 6248a64
fix fmt
pgherveou e137f0e
clippy
pgherveou 672e92e
Merge branch 'master' of https://github.com/paritytech/substrate into…
68ba74d
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
e8ceb0d
Update frame/contracts/src/lib.rs
pgherveou 9eb7833
Update frame/contracts/src/wasm/mod.rs
pgherveou 96e3dcf
Update frame/contracts/src/wasm/mod.rs
pgherveou a9df0cc
PR review, rm duplicate increment_refcount
pgherveou b291902
PR review
pgherveou bc2057d
Update frame/contracts/src/wasm/prepare.rs
pgherveou bbf2c5b
Add test for failing storage_deposit
pgherveou dff4758
fix lint
pgherveou 5873b6f
wip
pgherveou 679bb88
Delegate update take 2
pgherveou 9664297
update
pgherveou ddaba76
fix migration
pgherveou d45c793
fix migration
pgherveou 33a9d79
doc
pgherveou b5f35fc
fix lint
pgherveou f941e2a
update migration
pgherveou 4ccb853
fix warning
pgherveou 16744ba
Merge branch 'master' into pg/delegate_deposit
pgherveou 30f5472
reformat comment
pgherveou 649011d
regenerate weightInfo trait
pgherveou 3d126ac
fix merge
pgherveou d9d85a2
Merge remote-tracking branch 'origin/master' into pg/delegate_deposit
4354a7f
Merge remote-tracking branch 'origin/master' into pg/delegate_deposit
7e811b2
Merge remote-tracking branch 'origin/master' into pg/delegate_deposit
81d674f
PR review
pgherveou 16cab18
PR review
pgherveou f18194b
PR review remove optimisation
pgherveou 0ddaacd
PR review fix return type
pgherveou b12319c
Apply suggestions from code review
pgherveou 0b761d6
PR review pass CodeInfo and update docstring
pgherveou 59af50e
Merge branch 'master' into pg/delegate_deposit
pgherveou c6ce4ba
PR review add code_info to the executable
pgherveou fe05151
rename info -> contract_info
pgherveou bdd7889
Update frame/contracts/src/exec.rs
pgherveou 46a9617
Update frame/contracts/fixtures/add_remove_delegate_dependency.wat
pgherveou b224362
Update frame/contracts/src/migration/v13.rs
pgherveou f7d6b99
fix tests
pgherveou fdd4613
Fmt & fix tests
pgherveou a876168
Test Result<(), _> return type
pgherveou c81d6a0
Update frame/contracts/src/migration.rs
pgherveou 3cbb616
Revert "Test Result<(), _> return type"
pgherveou de00196
add / update doc comments
pgherveou 2ff6425
fix backticks
pgherveou 564169b
Revert "Revert "Test Result<(), _> return type""
pgherveou a1da123
fix bench
pgherveou a8e8fa4
fix bench
pgherveou 2cbe99f
fix
pgherveou 59755eb
Update frame/contracts/src/storage/meter.rs
pgherveou 6316417
rm stale comments
pgherveou 0248734
Apply suggestions from code review
pgherveou e7862f0
PR suggestion
pgherveou 25be4b0
Add missing doc
pgherveou 9627c4c
fx lint
pgherveou ebb49fe
Merge branch 'master' of https://github.com/paritytech/substrate into…
e0fe397
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
9a888e5
Update frame/contracts/src/lib.rs
pgherveou 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
112 changes: 112 additions & 0 deletions
112
frame/contracts/fixtures/add_remove_delegate_dependency.wat
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,112 @@ | ||
| ;; This contract tests the behavior of adding / removing delegate_dependencies when delegate calling into a contract. | ||
| (module | ||
| (import "seal0" "add_delegate_dependency" (func $add_delegate_dependency (param i32))) | ||
| (import "seal0" "remove_delegate_dependency" (func $remove_delegate_dependency (param i32))) | ||
| (import "seal0" "input" (func $input (param i32 i32))) | ||
| (import "seal0" "terminate" (func $terminate (param i32 i32))) | ||
| (import "seal0" "delegate_call" (func $delegate_call (param i32 i32 i32 i32 i32 i32) (result i32))) | ||
| (import "env" "memory" (memory 1 1)) | ||
|
|
||
| ;; [100, 132) Address of Alice | ||
| (data (i32.const 100) | ||
| "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" | ||
| "\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01" | ||
| ) | ||
|
|
||
| (func $assert (param i32) | ||
| (block $ok | ||
| (br_if $ok | ||
| (get_local 0) | ||
| ) | ||
| (unreachable) | ||
| ) | ||
| ) | ||
|
|
||
| ;; This function loads input data and performs the action specified. | ||
| ;; The first 4 bytes of the input specify the action to perform. | ||
| ;; The next 32 bytes specify the code hash to use when calling add_delegate_dependency or remove_delegate_dependency. | ||
| ;; Actions are: | ||
| ;; 1: call add_delegate_dependency | ||
| ;; 2: call remove_delegate_dependency. | ||
| ;; 3: call terminate. | ||
| ;; Any other value is a no-op. | ||
| (func $load_input | ||
| (local $action i32) | ||
| (local $code_hash_ptr i32) | ||
|
|
||
| ;; Store available input size at offset 0. | ||
| (i32.store (i32.const 0) (i32.const 512)) | ||
|
|
||
| ;; Read input data. | ||
| (call $input (i32.const 4) (i32.const 0)) | ||
|
|
||
| ;; Input data layout. | ||
| ;; [0..4) - size of the call | ||
| ;; [4..8) - action to perform | ||
| ;; [8..42) - code hash of the callee | ||
| (set_local $action (i32.load (i32.const 4))) | ||
| (set_local $code_hash_ptr (i32.const 8)) | ||
|
|
||
| ;; Assert input size == 36 (4 for action + 32 for code_hash). | ||
| (call $assert | ||
| (i32.eq | ||
| (i32.load (i32.const 0)) | ||
| (i32.const 36) | ||
| ) | ||
| ) | ||
|
|
||
| ;; Call add_delegate_dependency when action == 1. | ||
| (if (i32.eq (get_local $action) (i32.const 1)) | ||
| (then | ||
| (call $add_delegate_dependency (get_local $code_hash_ptr)) | ||
| ) | ||
| (else) | ||
| ) | ||
|
|
||
| ;; Call remove_delegate_dependency when action == 2. | ||
| (if (i32.eq (get_local $action) (i32.const 2)) | ||
| (then | ||
| (call $remove_delegate_dependency | ||
| (get_local $code_hash_ptr) | ||
| ) | ||
| ) | ||
| (else) | ||
| ) | ||
|
|
||
| ;; Call terminate when action == 3. | ||
| (if (i32.eq (get_local $action) (i32.const 3)) | ||
| (then | ||
| (call $terminate | ||
| (i32.const 100) ;; Pointer to beneficiary address | ||
| (i32.const 32) ;; Length of beneficiary address | ||
| ) | ||
| (unreachable) ;; terminate never returns | ||
| ) | ||
| (else) | ||
| ) | ||
| ) | ||
|
|
||
| (func (export "deploy") | ||
| (call $load_input) | ||
| ) | ||
|
|
||
| (func (export "call") | ||
| (call $load_input) | ||
|
|
||
| ;; Delegate call into passed code hash. | ||
| (call $assert | ||
| (i32.eq | ||
| (call $delegate_call | ||
| (i32.const 0) ;; Set no call flags. | ||
| (i32.const 8) ;; Pointer to "callee" code_hash. | ||
| (i32.const 0) ;; Input is ignored. | ||
| (i32.const 0) ;; Length of the input. | ||
| (i32.const 4294967295) ;; u32 max sentinel value: do not copy output. | ||
| (i32.const 0) ;; Length is ignored in this case. | ||
| ) | ||
| (i32.const 0) | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| ) | ||
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.