**Update:** Pushed additional changes based on the review comments.
**This pull request fixes various spelling mistakes in this
repository.**
Most of the changes are contained in the first **3** commits:
- `Fix spelling mistakes in comments and docs`
- `Fix spelling mistakes in test names`
- `Fix spelling mistakes in error messages, panic messages, logs and
tracing`
Other source code spelling mistakes are separated into individual
commits for easier reviewing:
- `Fix the spelling of 'authority'`
- `Fix the spelling of 'REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY'`
- `Fix the spelling of 'prev_enqueud_messages'`
- `Fix the spelling of 'endpoint'`
- `Fix the spelling of 'children'`
- `Fix the spelling of 'PenpalSiblingSovereignAccount'`
- `Fix the spelling of 'PenpalSudoAccount'`
- `Fix the spelling of 'insufficient'`
- `Fix the spelling of 'PalletXcmExtrinsicsBenchmark'`
- `Fix the spelling of 'subtracted'`
- `Fix the spelling of 'CandidatePendingAvailability'`
- `Fix the spelling of 'exclusive'`
- `Fix the spelling of 'until'`
- `Fix the spelling of 'discriminator'`
- `Fix the spelling of 'nonexistent'`
- `Fix the spelling of 'subsystem'`
- `Fix the spelling of 'indices'`
- `Fix the spelling of 'committed'`
- `Fix the spelling of 'topology'`
- `Fix the spelling of 'response'`
- `Fix the spelling of 'beneficiary'`
- `Fix the spelling of 'formatted'`
- `Fix the spelling of 'UNKNOWN_PROOF_REQUEST'`
- `Fix the spelling of 'succeeded'`
- `Fix the spelling of 'reopened'`
- `Fix the spelling of 'proposer'`
- `Fix the spelling of 'InstantiationNonce'`
- `Fix the spelling of 'depositor'`
- `Fix the spelling of 'expiration'`
- `Fix the spelling of 'phantom'`
- `Fix the spelling of 'AggregatedKeyValue'`
- `Fix the spelling of 'randomness'`
- `Fix the spelling of 'defendant'`
- `Fix the spelling of 'AquaticMammal'`
- `Fix the spelling of 'transactions'`
- `Fix the spelling of 'PassingTracingSubscriber'`
- `Fix the spelling of 'TxSignaturePayload'`
- `Fix the spelling of 'versioning'`
- `Fix the spelling of 'descendant'`
- `Fix the spelling of 'overridden'`
- `Fix the spelling of 'network'`
Let me know if this structure is adequate.
**Note:** The usage of the words `Merkle`, `Merkelize`, `Merklization`,
`Merkelization`, `Merkleization`, is somewhat inconsistent but I left it
as it is.
~~**Note:** In some places the term `Receival` is used to refer to
message reception, IMO `Reception` is the correct word here, but I left
it as it is.~~
~~**Note:** In some places the term `Overlayed` is used instead of the
more acceptable version `Overlaid` but I also left it as it is.~~
~~**Note:** In some places the term `Applyable` is used instead of the
correct version `Applicable` but I also left it as it is.~~
**Note:** Some usage of British vs American english e.g. `judgement` vs
`judgment`, `initialise` vs `initialize`, `optimise` vs `optimize` etc.
are both present in different places, but I suppose that's
understandable given the number of contributors.
~~**Note:** There is a spelling mistake in `.github/CODEOWNERS` but it
triggers errors in CI when I make changes to it, so I left it as it
is.~~
When switching from the instrumented gas metering to the wasmi gas
metering we also removed all imposed limits regarding Wasm module
internals. All those things do not interact with the host and have to be
handled by wasmi. For example, Wasmi charges additional gas for
parameters to each function because as they incur some overhead.
Back then we took the opportunity to remove the dependency on the
deprecated `parity-wasm` which was used to enforce those limits.
This PR merely removes them from the `Schedule` they aren't enforced for
a while.
First in a series of PRs that reduces our use of sp-std with a view to
deprecating it.
This is just looking at /substrate and moving some of the references
from `sp-std` to `core`.
These particular changes should be uncontroversial.
Where macros are used `::core` should be used to remove any ambiguity.
part of https://github.com/paritytech/polkadot-sdk/issues/2101
In https://github.com/paritytech/polkadot-sdk/pull/2941 we found out
that the new Wasmi (register) is very effective at optimizing away
certain benchmark bytecode constructs in a way that created an unfair
advantage over Wasmi (stack) which yielded our former benchmarks to be
ineffective at properly measuring the performance impact.
This PR adjusts both affected benchmarks to fix the stated problems.
Affected are
- `instr_i64const` -> `instr_i64add`: Renamed since it now measures the
performance impact of the Wasm `i64.add` instruction with locals as
inputs and outputs. This makes it impossible for Wasmi (register) to
aggressively optimize away the entire function body (as it previously
did) but still provides a way for Wasmi (register) to shine with its
register based execution model.
- `call_with_code_per_byte`: Now uses `local.get` instead of `i32.const`
for the `if` condition which prevents Wasmi (register) to aggressively
optimizing away whole parts of the `if` creating an unfair advantage.
cc @athei
---------
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Ignacio Palacios <ignacio.palacios.santos@gmail.com>
* frame-benchmarking-cli: Remove native dispatch requirement
No need for this, we can just use the `WasmExecutor` directly.
* Fixes
* Pass benchmarking host functions
* Ensure we can pass custom host functions
* added [unstable][seal2] call()
* updated test to cover new seal_call proof_limit
* docs updated
* add [seal2][unstable] instantiate() and test
* add [seal2][unstable] weight_to_fee() + docs and test
* add [seal2][unstable] gas_left() + docs and test
* update benchmarks
* add DefaultDepositLimit to pallet Config
* specify deposit limit for nested call
add test for nested call deposit limit
save: separate deposit limit for nested calls
* specify deposit limit for nested instantiate
save: works with test
cleaned up debugging outputs
* update benchmarks
* added missing fixtures
* fix benches
* pass explicit deposit limit to storage bench
* explicit deposit limit for another set_storage bench
* add more deposit limit for storage benches
* moving to simplified benchmarks
* moved to simplified benchmarks
* fix seal_weight_to_fee bench
* fix seal_instantiate benchmark
* doc typo fix
* default dl for benchmarking
more dl for tests
dl for tests to max
deposit_limit fix in instantiate bench
fix instantiate bench
fix instantiate benchmark
fix instantiate bench again
remove dbg
fix seal bench again
fixing it still
seal_instantiate zero deposit
less runs to check if deposit enough
try
try 2
try 3
try 4
* max_runtime_mem to Schedule limits
* add default deposit limit fallback check to test
* weight params renaming
* fmt
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com>
* prettify inputs in tests
* typestate param refactored
---------
Co-authored-by: PG Herveou <pgherveou@gmail.com>
* Change copyright year to 2023 from 2022
* Fix incorrect update of copyright year
* Remove years from copy right header
* Fix remaining files
* Fix typo in a header and remove update-copyright.sh
* Avoid reading contract code when it is supplied in the extrinsic
* Remove custom proof size injection from schedule
* Set benchmarks pov_mode to Measure
* Reduce overestimation of code size on re-instrument
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Do not override proof size from benchmark
* Do not charge proof size for basic block
* Incrase gas limit for tests
* Fix deletion queue to also use `proof_size`
* Fix tests
* Update frame/contracts/src/schedule.rs
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
* Fix wrong schedule macro invocations
* Remove stale docs
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Handle zero components
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Fix instruction weight
---------
Co-authored-by: command-bot <>
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
* integrity test for MaxCodeLen and CallStack::len()
* integrity test for MaxDebugBufferLen
* addressed review comments
* fix append_debug_buffer()
* ci fix
* updated code_len_limit formula after further discussion
* enlarged mem safe margin after discussion
* +doc to Config trait associated types
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* more lil fixes from code review feedback
* lowered max call depth to satisfy mem limits
* fix node runtime pallet params to satisfy integrity check
* fix max call depth value calc
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* Add per local weight for function call
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* apply suggestions from code review
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* tune the benchmark
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* fix benches
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* update api
* update
* remove unused
* remove `one` api
* fix unused
* fmt
* add saturating accrue
* remove `Weight::new()`
* use some macros
* div makes no sense
* Update weight_v2.rs
* missed some
* more patch
* fixes
* more fixes
* more fix
* more fix
* remove RefTimeWeight
* Update frame/contracts/src/storage.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* not needed
* Fixes
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* `ecdsa::Public::to_eth_address` + test, beefy-mmr `convert()` to use it, contracts Ext interface
* `seal_ecdsa_to_eth_address` all but benchmark done
* `seal_ecdsa_to_eth_address` + wasm test
* `seal_ecdsa_to_eth_address` + benchmark
* fixed dependencies
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* fixes from review #1
* ecdsa::Public(*pk).to_eth_address() moved to frame_support and contracts to use it
* beefy-mmr to use newly added frame_support function for convertion
* a doc fix
* import fix
* benchmark fix-1 (still fails)
* benchmark fixed
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* fixes on Alex T feedback
* to_eth_address() put into extension trait for sp-core::ecdsa::Public
* Update frame/support/src/crypto/ecdsa.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* fixes on issues pointed out in review
* benchmark errors fixed
* fmt fix
* EcdsaRecoverFailed err docs updated
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* make applied suggestions compile
* get rid of unwrap() in runtime
* Remove expect
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
* `seal_origin` + tests added
* `seal_origin` benchmark added
* `seal_code_hash` + tests added
* `seal_code_hash` benchmark added
* `seal_own_code_hash` + tests added
* `seal_own_code_hash` benchmark added
* fmt lil fix
* akward accident bug fix
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* benchmark fix
* `WasmModule::getter()` to take `module_name` arg
* test enhanced
* fixes based on review feedback
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* Hash left as const to return a ref to it from mock
* HASH test val to local const in mock
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* fixes to benchmarks according to review feedback
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* removed `seal_origin` from API
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Parity Bot <admin@parity.io>
* seal_call_code implementation
- tests
- benchmark
* Addressing @xgreenx's comments
* Fix test-linux-stable-int
* Rename seal_call_code to seal_delegate_call
* Pass value unchanged into lib contract
* Address @athei's comments
- whitespace .wat issues
- wrong/missing .wat comments
- redundant .wat calls/declarations
- change order of functions (seal_delegate_call right after seal_call)
in decls, tests, benchmark
- fix comments, move doc comments to enum variants
- remove unnecessary empty lines
- rename runtime cost DelegateCall to DelegateCallBase
- do not set CallFlags::ALLOW_REENTRY for delegate_call
* Do not pass CallFlags::ALLOWS_REENTRY for delegate_call
* Update comment for seal_delegate_call and CallFlags
* Addressing @athei's comments (minor)
* Allow reentry for a new frame after delegate_call (revert)
* Same seal_caller and seal_value_transferred for lib contract
- test
- refactor frame args due to review
- logic for seal_caller (please review)
* Put caller on frame for delegate_call, minor fixes
* Update comment for delegate_call
* Addressing @athei's comments
* Update weights generated by benchmark
* Improve comments
* Address @HCastano's comments
* Update weights, thanks @joao-paulo-parity
* Improve InvalidCallFlags error comment
* Frame no longer needs to be mutable (refactoring artifact)
* Remove Contract/Tombstone deposit
* Add StorageMeter
* cargo fmt
* Fix weight annotation
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Simplify keep check for contract accounts
- Make sure that the "base deposit" for each contract >= ed
- Remove now obsolete checks when sneding away free balance
* Remove unused imports and functions
* Rename storage_limit to storage_deposit_limit
* cargo fmt
* Fix typo
Co-authored-by: Michael Müller <michi@parity.io>
* Finish up rename of storage_limit
* Fix rpc tests
* Make use of `StorageDepositLimitTooHigh`
* Add tests and fix bugs discovered by tests
* Add storage migration
* Don't use u128 in RPC
* Fix weight of migration
* Rename `endowment` to `value`
* Fix bug where contract couldn't get funded by a storage deposit
- Make sure that contract gets funded from deposits before value is transferred
- Don't reserve value at origin because otherwise funding isn't possible
- Just transfer free balance and reserve it after the transfer
- When refunding make sure that this refund can't dust the contract
- Can only happen after a runtime upgrade where costs where upped
- Add more tests
* Apply suggestions from code review
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Remove unused `fn storage_meter`
* Fix copy pasta doc error
* Import `MaxEncodeLen` from codec
* Beautify RPC trait bounds
* Add re-instrument behaviour to dispatchable doc
* Make sure a account won't be destroyed a refund after a slash
* Apply suggestions from code review
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Update `Storage::write` docs
* Improve doc
* Remove superflous conditional
* Typos
* Remove superflous clone (refactoring artifact)
* Apply suggestions from code review
Co-authored-by: Andrew Jones <ascjones@gmail.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Michael Müller <michi@parity.io>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Implemented `seal_ecdsa_recovery` function in the contract pallet.
Added benchmark and unit test.
* Run `cargo fmt`
* Skip fmt for slices
* Changes according comments in pull request.
* Fix build without `unstable-interface` feature
* Applied suggestion from the review
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
* Changed RecoveryFailed to EcdsaRecoverFailed
* Manually updated weights.rs
* Apply suggestions from code review
Co-authored-by: Michael Müller <mich@elmueller.net>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Michael Müller <mich@elmueller.net>
* Run cargo fmt on the whole code base
* Second run
* Add CI check
* Fix compilation
* More unnecessary braces
* Handle weights
* Use --all
* Use correct attributes...
* Fix UI tests
* AHHHHHHHHH
* 🤦
* Docs
* Fix compilation
* 🤷
* Please stop
* 🤦 x 2
* More
* make rustfmt.toml consistent with polkadot
Co-authored-by: André Silva <andrerfosilva@gmail.com>
* Remove pre-charging for code size
* Remove pre charging when reading values of fixed size
* Add new versions of API functions that leave out parameters
* Update CHANGELOG.md
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Add v1 for seal_set_rent_allowance
* Remove unneeded trait bound
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>