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.6k
Make automatic storage deposits resistant against changing deposit prices #12083
Merged
Merged
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
82e28de
Require `FixedPointOperand` for Balances
athei c032da9
Delay deposit calculation
athei d2b17fb
Make refunds pro rata of consumed storage
athei 1c32403
Add storage migration
athei 6806bb0
Fix clippy
athei 085e816
Merge branch 'master' into at/deposit
athei b5c0889
Merge branch 'master' into at/deposit
athei 603ae61
Merge branch 'master' into at/deposit
athei 69e8cd7
Add liquidity checks
athei 47a2863
Fixe delayed deposit limit enforcement
athei eba7469
Merge branch 'master' into at/deposit
athei 60be270
Defer charges
athei ed13977
Merge branch 'master' into at/deposit
athei 2a7da17
Import Vec
athei d37fe70
Merge branch 'master' into at/deposit
athei 5c247a5
Add try-runtime hooks for migration
athei a320b10
Merge branch 'master' into at/deposit
athei 35532be
Fix warning
athei fe3b9cd
Adapt to new OnRuntimeUpgrade trait
athei 0ca9c55
Apply suggestions from code review
athei 80fd5c0
Merge branch 'master' into at/deposit
athei 9da4a69
fmt
athei 69d8b18
Apply suggestions from code review
athei 35145e9
Merge remote-tracking branch 'origin/master' into at/deposit
athei 74ceb92
More suggestions from code review
athei 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| ;; This calls another contract as passed as its account id. It also creates some storage. | ||
| (module | ||
| (import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
| (import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32))) | ||
| (import "seal1" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32) (result i32))) | ||
| (import "env" "memory" (memory 1 1)) | ||
|
|
||
| (func $assert (param i32) | ||
| (block $ok | ||
| (br_if $ok | ||
| (get_local 0) | ||
| ) | ||
| (unreachable) | ||
| ) | ||
| ) | ||
|
|
||
| (func (export "deploy")) | ||
|
|
||
| (func (export "call") | ||
| ;; store length of input buffer | ||
| (i32.store (i32.const 0) (i32.const 512)) | ||
|
|
||
| ;; copy input at address 4 | ||
| (call $seal_input (i32.const 4) (i32.const 0)) | ||
|
|
||
| ;; create 4 byte of storage before calling | ||
| (call $seal_set_storage | ||
| (i32.const 0) ;; Pointer to storage key | ||
| (i32.const 0) ;; Pointer to value | ||
| (i32.const 4) ;; Size of value | ||
| ) | ||
|
|
||
| ;; call passed contract | ||
| (call $assert (i32.eqz | ||
| (call $seal_call | ||
| (i32.const 0) ;; No flags | ||
| (i32.const 8) ;; Pointer to "callee" address. | ||
| (i64.const 0) ;; How much gas to devote for the execution. 0 = all. | ||
| (i32.const 512) ;; Pointer to the buffer with value to transfer | ||
| (i32.const 4) ;; Pointer to input data buffer address | ||
| (i32.const 4) ;; Length of input data buffer | ||
| (i32.const 4294967295) ;; u32 max value is the sentinel value: do not copy output | ||
| (i32.const 0) ;; Length is ignored in this case | ||
| ) | ||
| )) | ||
|
|
||
| ;; create 8 byte of storage after calling | ||
| ;; item of 12 bytes because we override 4 bytes | ||
| (call $seal_set_storage | ||
| (i32.const 0) ;; Pointer to storage key | ||
| (i32.const 0) ;; Pointer to value | ||
| (i32.const 12) ;; Size of value | ||
| ) | ||
| ) | ||
| ) |
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.