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
seal: Add automated weights for contract API calls #7017
Merged
Merged
Changes from 12 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
407920b
seal: Add capability to put uninstrumented code (for benchmarks)
athei 343f0fb
seal: Cap the the data length for deposited events
athei 1235f26
seal: Fix error reporting in the case out of bound sandbox access
athei ec69d05
seal: Refactor existing benchmarks
athei b1a1133
seal: Convert benchmark file to tabs
athei dfa6076
seal: Add benchmarks for functions called by contracts
athei 2cbe472
seal: Create a default schedule from benchmark generated WeightInfo
athei 1e065cf
seal: Make use of WeightInfo in extrinsic weight annotations
athei c680745
seal: Replace the old schedule by the benchmark generated one
athei 0132ede
Merge branch 'master' into at-seal-api-benchmarks
athei ca7742d
Review: Fix copy paste typo in schedule construction
athei cdec9ae
Review: Fix stale docs
athei 0a2bd2a
Fix whitespace errors
athei 771bf8a
Review: Use checked_div in order to be more defensive
athei a326fac
Merge branch 'master' into at-seal-api-benchmarks
athei d76bcde
Review: Rename no_charge to already_charged
athei b3aa6ac
Review: Whitelist caller of extrinsics
athei 678f155
Review: Remove trailing whitespace
athei 190144e
Review: Remove confusing "self::" syntax
athei dd2edeb
Review: Add docs for the benchmark prepration submodule
athei 4e65609
Review: Move code generation functions to own module
athei 687c2a5
Review: Refactor and document benchmark helper functions
athei b42e400
Remove additional empty line
athei 56b8d31
Added missing comment on caller_funding
athei a7d3da1
Update frame/contracts/src/benchmarking/code.rs
athei 09766bb
Fix missing sp_std::prelude import in code.rs
athei c54fa98
Merge branch 'master' into at-seal-api-benchmarks
athei 9d1c66b
Merge remote-tracking branch 'origin/master' into at-seal-api-benchmarks
shawntabrizi e565433
cargo run --release --features runtime-benchmarks --manifest-path bin…
shawntabrizi 036a8ba
Use weights from the benchmark machine for the substrate node
athei 2c154dd
Remove prefixes from Schedule members
athei 6f2f333
Data lengths in the WeightInfo Trait are specified in kilobytes
athei 51a8c38
Rename ApiWeights to HostFunctionWeights
athei 94a08b5
Merge branch 'master' into at-seal-api-benchmarks
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
| (module | ||
| (import "seal0" "seal_deposit_event" (func $seal_deposit_event (param i32 i32 i32 i32))) | ||
| (import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
| (import "env" "memory" (memory 16 16)) | ||
|
|
||
| ;; [0, 4) size of the input buffer | ||
| (data (i32.const 0) "\04") | ||
|
|
||
| (func $assert (param i32) | ||
| (block $ok | ||
| (br_if $ok | ||
| (get_local 0) | ||
| ) | ||
| (unreachable) | ||
| ) | ||
| ) | ||
|
|
||
| (func (export "call") | ||
| (call $seal_input (i32.const 4) (i32.const 0)) | ||
|
|
||
| ;; assert input size == 4 | ||
| (call $assert | ||
| (i32.eq | ||
| (i32.load (i32.const 0)) | ||
| (i32.const 4) | ||
| ) | ||
| ) | ||
|
|
||
| ;; place a garbage value in storage, the size of which is specified by the call input. | ||
| (call $seal_deposit_event | ||
| (i32.const 0) ;; topics_ptr | ||
| (i32.const 0) ;; topics_len | ||
| (i32.const 0) ;; data_ptr | ||
| (i32.load (i32.const 4)) ;; data_len | ||
| ) | ||
| ) | ||
|
|
||
| (func (export "deploy")) | ||
| ) | ||
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.