PG Herveou
5a5b1df69b
Contracts Add deposit for dependencies ( #14079 )
...
* wip
* fixes
* rm comment
* join fns
* clippy
* Fix limits
* reduce diff
* fix
* fix
* fix typo
* refactor store to use self
* refactor run to take self by value
* pass tests
* rm comment
* fixes
* fix typo
* rm
* fix fmt
* clippy
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review, rm duplicate increment_refcount
* PR review
* Update frame/contracts/src/wasm/prepare.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Add test for failing storage_deposit
* fix lint
* wip
* Delegate update take 2
* update
* fix migration
* fix migration
* doc
* fix lint
* update migration
* fix warning
* reformat comment
* regenerate weightInfo trait
* fix merge
* PR review
https://github.com/paritytech/substrate/pull/14079#discussion_r1255904563
* PR review
https://github.com/paritytech/substrate/pull/14079/files#r1257521373
* PR review remove optimisation
https://github.com/paritytech/substrate/pull/14079/files#r1263312237
* PR review fix return type
https://github.com/paritytech/substrate/pull/14079/files#r1263315804
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* PR review pass CodeInfo and update docstring
https://github.com/paritytech/substrate/pull/14079/files#r1257522327
* PR review add code_info to the executable
https://github.com/paritytech/substrate/pull/14079/files#r1263309049
* rename info -> contract_info
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/fixtures/add_remove_delegate_dependency.wat
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/migration/v13.rs
* fix tests
* Fmt & fix tests
* Test Result<(), _> return type
* Update frame/contracts/src/migration.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Revert "Test Result<(), _> return type"
This reverts commit a876168f2054edf84d720c666387583ccbe78dcd.
* add / update doc comments
* fix backticks
* Revert "Revert "Test Result<(), _> return type""
This reverts commit 3cbb6161d1abd9520cd9f8519b4dfbf4f29a2998.
* fix bench
* fix bench
* fix
* Update frame/contracts/src/storage/meter.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* rm stale comments
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR suggestion
* Add missing doc
* fx lint
* ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts
* Update frame/contracts/src/lib.rs
Co-authored-by: Juan <juangirini@gmail.com >
---------
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Juan <juangirini@gmail.com >
2023-07-26 12:09:02 +00:00
gupnik
5e7b27e98c
Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber ( #14437 )
...
* Initial setup
* Adds node block
* Uses UncheckedExtrinsic and removes Where section
* Updates frame_system to use Block
* Adds deprecation warning
* Fixes pallet-timestamp
* Removes Header and BlockNumber
* Addresses review comments
* Addresses review comments
* Adds comment about compiler bug
* Removes where clause
* Refactors code
* Fixes errors in cargo check
* Fixes errors in cargo check
* Fixes warnings in cargo check
* Formatting
* Fixes construct_runtime tests
* Uses import instead of full path for BlockNumber
* Uses import instead of full path for Header
* Formatting
* Fixes construct_runtime tests
* Fixes imports in benchmarks
* Formatting
* Fixes construct_runtime tests
* Formatting
* Minor updates
* Fixes construct_runtime ui tests
* Fixes construct_runtime ui tests with 1.70
* Fixes docs
* Fixes docs
* Adds u128 mock block type
* Fixes split example
* fixes for cumulus
* ".git/.scripts/commands/fmt/fmt.sh"
* Updates new tests
* Fixes fully-qualified path in few places
* Formatting
* Update frame/examples/default-config/src/lib.rs
Co-authored-by: Juan <juangirini@gmail.com >
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Juan <juangirini@gmail.com >
* ".git/.scripts/commands/fmt/fmt.sh"
* Addresses some review comments
* Fixes build
* ".git/.scripts/commands/fmt/fmt.sh"
* Update frame/democracy/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/democracy/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Addresses review comments
* Updates trait bounds
* Minor fix
* ".git/.scripts/commands/fmt/fmt.sh"
* Removes unnecessary bound
* ".git/.scripts/commands/fmt/fmt.sh"
* Updates test
* Fixes build
* Adds a bound for header
* ".git/.scripts/commands/fmt/fmt.sh"
* Removes where block
* Minor fix
* Minor fix
* Fixes tests
* ".git/.scripts/commands/update-ui/update-ui.sh" 1.70
* Updates test
* Update primitives/runtime/src/traits.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* Update primitives/runtime/src/traits.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* Updates doc
* Updates doc
---------
Co-authored-by: command-bot <>
Co-authored-by: Juan <juangirini@gmail.com >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Bastian Köcher <git@kchr.de >
2023-07-13 12:01:34 +00:00
Qinxuan Chen
e8e2048b88
chore: update some deps to prune duplicated deps ( #14515 )
...
* chore: update some deps to prune duplicated deps
- array-bytes: 4.1.0 => 6.1.0
- cid: 0.8.6 => 0.9.0
* fix
2023-07-06 16:46:44 +02:00
Sasha Gryaznov
fda86dd501
contracts: switch to wasmi gas metering ( #14084 )
...
* upgrade to wasmi 0.29
* prepare cleanup
* sync ref_time w engine from the stack frame
* proc_macro: sync gas in host funcs
save: compiles, only gas pushing left to macro
WIP proc macro
proc macro: done
* clean benchmarks & schedule: w_base = w_i64const
* scale gas values btw engine and gas meter
* (re)instrumentation & code_cache removed
* remove gas() host fn, continue clean-up
save
* address review comments
* move from CodeStorage&PrefabWasmModule to PristineCode&WasmBlob
* refactor: no reftime_limit&schedule passes, no CodeStorage
* bugs fixing
* fix tests: expected deposit amount
* fix prepare::tests
* update tests and fix bugs
tests::run_out_of_gas_engine, need 2 more
save: 2 bugs with gas syncs: 1 of 2 tests done
gas_syncs_no_overcharge bug fixed, test passes!
cleaned out debug prints
second bug is not a bug
disabled_chain_extension test fix (err msg)
tests run_out_of_fuel_host, chain_extension pass
all tests pass
* update docs
* bump wasmi 0.30.0
* benchmarks updated, tests pass
* refactoring
* s/OwnerInfo/CodeInfo/g;
* migration: draft, compiles
* migration: draft, runs
* migration: draft, runs (fixing)
* deposits repaid non pro rata
* deposits repaid pro rata
* better try-runtime output
* even better try-runtime output
* benchmark migration
* fix merge leftover
* add forgotten fixtures, fix docs
* address review comments
* ci fixes
* cleanup
* benchmarks::prepare to return DispatchError
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* store memory limits to CodeInfo
* ci: roll back weights
* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
* drive-by: update Readme and pallet rustdoc
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* use wasmi 0.29
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* use wasmi 0.30 again
* query memory limits from wasmi
* better migration types
* ci: pull weights from master
* refactoring
* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
* addressing review comments
* refactor
* address review comments
* optimize migration
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* another review round comments addressed
* ci fix one
* clippy fix
* ci fix two
---------
Co-authored-by: command-bot <>
2023-07-03 11:04:10 +00:00
juangirini
5db4119f93
contracts: Make Origin information available ( #13708 )
...
* contracts: allow root calls
* contracts: update ContractOrigin
* contracts: test allow root calls
* contracts: rustfmt
* contracts: test root caller traps
* contracts: add Caller enum
* contracts: improve some comments
* contracts: improve some comments
* contracts: format code with +nightly
* contracts: fix failing tests
* contracts: improve charte instantiate call when root origin
* contract: refactor common, call and instantiate inputs
* contracts: fix some failing test
* contracts: trap caller when there is no account id
* Update frame/contracts/src/lib.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* Update frame/contracts/src/exec.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* contracts: make `into_deposit` return zero when the origin is root
* contracts: cargo fmt
* contracts: charging and terminating tests refactored
* contracts: improved errors
* contracts: refactor & merge ContractOrigin cand Caller enums
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* contracts: apply suggested pr changes
* contracts: rename Caller to Origin
* contracts: refactor run fn
* contracts: cr improvements
* contracts: allow root to use delegate call
* contracts: add caller_is_root weight
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add caller_is_root benchmarking
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add caller_is_root benchmarking
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add some minor improvements
* contracts: make caller_is_root runtime fn unstable
* contracts: fix failing wasm test
* contracts: update benchmarking for origin_is_root
* contracts: improve seal_caller_is_root benchmarking
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add small pr improvements
* contracts: fix broken tests after master merge
* contracts: acknowledge the default storage deposit limit
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: move origin to CommonInput
* contracts: add some extra tests
* contracts: move ensure origin logic inside invokable::run_guarded
* contracts: add minor improvements
* contracts: fix caller_is_root benchmarking
* contracts: improve function description
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* contracts: improve function description
---------
Co-authored-by: parity-processbot <>
Co-authored-by: PG Herveou <pgherveou@gmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-05-02 16:45:14 +00:00
Sasha Gryaznov
60310de7d6
[contracts] Port host functions to Weight V2 and storage deposit limit ( #13565 )
...
* 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 >
2023-04-26 11:27:13 +00:00
PG Herveou
c11cb1b274
contracts Add LOG_TARGET constant ( #14002 )
...
* contracts Add LOG_TARGET constant
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-04-25 11:46:20 +00:00
PG Herveou
03c99fe003
contracts: add sr25519_verify ( #13724 )
...
* wip
* fix
* wip
* fix lint
* rm fixture fix
* missing comment
* fix lint
* add comment to the wsm file
* fix comment
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* wip
* wip weights
* wip weights
* PR comment: test with return code
* wip
* PR review add mock test
* remove
* lint
* Update frame/contracts/fixtures/sr25519_verify.wat
* fix comments
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/fixtures/sr25519_verify.wat
* Update frame/contracts/src/benchmarking/mod.rs
* fix lint
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* PR: review use unstable + remove arbitrary index 4
* Add benchmark for calculating overhead of calling sr25519_verify
* fix message length encoding
* fix weights
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Apply suggestions from code review
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-04-12 14:49:10 +00:00
PG Herveou
1bd5d2f78d
[Contracts] Overflowing bounded DeletionQueue allows DoS against contract termination ( #13702 )
...
* [Contracts review] Overflowing bounded `DeletionQueue` allows DoS against contract termination
* wip
* wip
* wip
* wip
* wip
* fix doc
* wip
* PR review
* unbreak tests
* fixes
* update budget computation
* PR comment: use BlockWeights::get().max_block
* PR comment: Update queue_trie_for_deletion signature
* PR comment: update deletion budget docstring
* PR comment: impl Default with derive(DefaultNoBound)
* PR comment: Remove DeletedContract
* PR comment Add ring_buffer test
* remove missed comment
* misc comments
* contracts: add sr25519_recover
* Revert "contracts: add sr25519_recover"
This reverts commit d4600e00934b90e5882cf5288f36f98911b51722.
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* PR comments update print_schedule
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/storage.rs
* Update frame/contracts/src/storage.rs
* rm temporary fixes
* fix extra ;
* Update frame/contracts/src/storage.rs
Co-authored-by: juangirini <juangirini@gmail.com >
* Update frame/contracts/src/storage.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Support stable rust for compiling the runtime (#13580 )
* Support stable rust for compiling the runtime
This pull request brings support for compiling the runtime with stable Rust. This requires at least
rust 1.68.0 to work on stable. The code is written in a way that it is backwards compatible and
should automatically work when someone compiles with 1.68.0+ stable.
* We always support nightlies!
* 🤦
* Sort by version
* Review feedback
* Review feedback
* Fix version parsing
* Apply suggestions from code review
Co-authored-by: Koute <koute@users.noreply.github.com >
---------
Co-authored-by: Koute <koute@users.noreply.github.com >
* github PR commit fixes
* Revert "Support stable rust for compiling the runtime (#13580 )"
This reverts commit 0b985aa5ad114a42003519b712d25a6acc40b0ad.
* Restore DeletionQueueMap
* fix namings
* PR comment
* move comments
* Update frame/contracts/src/storage.rs
* Update frame/contracts/src/storage.rs
* fixes
---------
Co-authored-by: command-bot <>
Co-authored-by: juangirini <juangirini@gmail.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Bastian Köcher <git@kchr.de >
Co-authored-by: Koute <koute@users.noreply.github.com >
2023-03-31 11:03:56 +00:00
Alexander Theißen
82cb69922f
contracts: Upgrade to wasmi 0.28 ( #13312 )
...
* Upgrade to wasmi 0.28
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update stale comment
* Renamed variants of `Determinism`
* Compile fix
---------
Co-authored-by: command-bot <>
2023-03-20 23:09:22 +00:00
Gavin Wood
5d81f23f8f
Deprecate Currency; introduce holds and freezing into fungible traits ( #12951 )
...
* First reworking of fungibles API
* New API and docs
* More fungible::* API improvements
* New ref-counting logic for old API
* Missing files
* Fixes
* Use the new transfer logic
* Use fungibles for the dispatchables
* Use shelve/restore names
* Locking works with total balance.
* repotting and removal
* Separate Holds from Reserves
* Introduce freezes
* Missing files
* Tests for freezing
* Fix hold+freeze combo
* More tests
* Fee-free dispatchable for upgrading accounts
* Benchmarks and a few fixes
* Another test
* Docs and refactor to avoid blanket impls
* Repot
* Fit out ItemOf fully
* Add events to Balanced traits
* Introduced events into Hold traits
* Fix Assets pallet tests
* Assets benchmarks pass
* Missing files and fixes
* Fixes
* Fixes
* Benchmarks fixes
* Fix balance benchmarks
* Formatting
* Expose fungible sub modules
* Move NIS to fungible API
* Fix broken impl and add test
* Fix tests
* API for `transfer_and_hold`
* Use composite APIs
* Formatting
* Upgraded event
* Fixes
* Fixes
* Fixes
* Fixes
* Repot tests and some fixed
* Fix some bits
* Fix dust tests
* Rename `set_balance`
- `Balances::set_balance` becomes `Balances::force_set_balance`
- `Unbalanced::set_balance` becomes `Unbalances::write_balance`
* becomes
* Move dust handling to fungibles API
* Formatting
* Fixes and more refactoring
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Use reducible_balance for better correctness on fees
* Reducing hold to zero should remove entry.
* Add test
* Docs
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/regular.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Update frame/support/src/traits/tokens/fungible/regular.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Docs
* Docs
* Docs
* Fix NIS benchmarks
* Doc comment
* Remove post_mutation
* Fix some tests
* Fix some grumbles
* Enumify bool args to fungible(s) functions
* Fix up assets and balances
* Formatting
* Fix contracts
* Fix tests & benchmarks build
* Typify minted boolean arg
* Typify on_hold boolean arg; renames
* Fix numerous tests
* Fix dependency issue
* Privatize dangerous API mutate_account
* Fix contracts (@alext - please check this commit)
* Remove println
* Fix tests for contracts
* Fix broken rename
* Fix broken rename
* Fix broken rename
* Docs
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* remove from_ref_time
* Update frame/executive/src/lib.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/executive/src/lib.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Reenable test
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/currency.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/lottery/src/tests.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/mod.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/regular.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/freeze.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/regular.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Rename UnwantedRemoval to UnwantedAccountRemoval
* Docs
* Formatting
* Update frame/balances/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update primitives/runtime/src/lib.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* handle_raw_dust oes nothing
* Formatting
* Fixes
* Grumble
* Fixes
* Add test
* Add test
* Tests for reducible_balance
* Fixes
* Fix Salary
* Fixes
* Disable broken test
* Disable nicely
* Fixes
* Fixes
* Fixes
* Rename some events
* Fix nomination pools breakage
* Add compatibility stub for transfer tx
* Reinstate a safely compatible version of Balances set_balance
* Fixes
* Grumble
* Update frame/nis/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances
* disable flakey tests
* Update frame/balances/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Grumbles
* Grumble
---------
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: command-bot <>
2023-03-18 14:47:55 +00:00
PG Herveou
8fcd235e38
contracts: Refactor trait Ext::*_storage_transparent functions ( #13600 )
...
* Refactor _transparent methods
rewrote commits, stashed the typo changes to remove some diff noise
fixed my unverified email commit
* remove type alias
* Get rid of From<Fix/VarSizedKey> impl blocks
* Get rid of KeyType impl block
* remove unnecessary Key export
* Update frame/contracts/src/exec.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review comment
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-03-17 23:17:21 +01:00
PG Herveou
f5773795e9
Fix typos in pallet-contracts ( #13629 )
...
* Fix typos in pallet-contracts
2023-03-17 16:31:51 +01:00
Vivek Pandya
bc53b9a03a
Remove years from copyright notes. ( #13415 )
...
* 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
2023-02-21 18:46:41 +00:00
Alexander Theißen
330484bb19
contracts: Don't rely on reserved balances keeping an account alive ( #13369 )
...
* Move storage deposits to their own account
* Take ed for contract's account from origin
* Apply suggestions from code review
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update stale docs
* Use 16 bytes prefix for address derivation
* Update frame/contracts/src/address.rs
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com >
* Fix merge
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/primitives/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
---------
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
2023-02-16 15:58:28 +00:00
Sasha Gryaznov
53b7778599
[contracts] make debug_message execution outcome invariant to node debug logging setting ( #13197 )
...
* update benchmark for seal_debug_message
* add seal_debug_message_per_kb benchmark
* un-fallable debug buffer: silently drops excessive and wrong utf-8 encoded messages
* charge debug_message per byte of the message
* improved benchmark
* cap debug_message
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* fix applied buggy suggestion
* make sure i*1024 < MaxDebugBufferLen
* fix schedule for our non-batched benchmark
* Switch to a `wasmtime` fork with LTO linking failure workaround
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
---------
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Jan Bujak <jan@parity.io >
2023-02-14 18:28:34 +00:00
Dan Henton
ae8ef86ec0
Use non-binary pronouns in comments. ( #13209 )
...
* use non binary pronouns in comments
* cargo fmt
* fix the use of "it" with "they" when dealing about an opperations identity
2023-01-27 12:31:17 +01:00
Alexander Theißen
3b03862caf
contracts: Deprecate random interface ( #13204 )
...
* Deprecate random interface
* Revert change to runtime file
* Fix docs
* Fix tests
* Rename to not_deprecated
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Deprecate `set_rent_allowance`
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-01-25 13:48:40 +00:00
Sasha Gryaznov
549637d931
[contracts] Add integrity checks by pallet hook ( #12993 )
...
* 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 >
2023-01-18 16:03:52 +00:00
Sasha Gryaznov
628efddce1
[contracts] Add docs generator for the contracts API to the #[define_env] macro ( #13032 )
...
* macro to expand traits for host functions documentation
* other way: same Doc trait in seal modules
* added docs for macro, and remove `doc` attribute
* fmt
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* make docs to be generated into re-exported `api_doc` module; fix
unrelated elder docs;
* make it compile without `doc` attr passed to macro
* make alias functions indicated explicitly in docs
* tidy up docs
* refactored a bit
* macro to auto-add doc warning for unstable functions
* invoke macro with no doc generation by default
* addressed review comments
* hide api_doc module behind cfg(doc)
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-01-05 23:22:43 +00:00
Sasha Gryaznov
2691f6de2e
[contracts] Make debug buffer work like a FIFO pipe ( #12953 )
...
* make debug buffer work like a FIFO pipe
* remove unused Error type
* Remove panics
* Update frame/contracts/src/exec.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-12-27 14:24:49 +01:00
Alexander Theißen
4083b5358a
contracts: Improve contract address derivation ( #12883 )
...
* Add prefix to address derivation
* Extend benchmark
* Fix node test
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Adapt to new benchmark
* Update dispatchable benchmarks
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Use benchmark results
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Don't use T::AdressGenerator directly
* Rename constructor_args to input_data
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-12-22 14:52:48 +00:00
Sasha Gryaznov
962580c82e
[contracts] Add debug buffer limit + enforcement ( #12845 )
...
* Add debug buffer limit + enforcement
Add debug buffer limit + enforcement
* use BoundedVec for the debug buffer
* revert schedule (debug buf len limit not needed anymore)
* return DispatchError
* addressed review comments
2022-12-13 15:54:50 +00:00
Alexander Theißen
770afb9ee3
contracts: Add instantiation_nonce API ( #12800 )
...
* Add `instantiation_nonce` API
* Fixes for tests
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
2022-12-06 11:01:58 +00:00
Alexander Theißen
08657f14b7
contracts: Replace sp-sandbox and wasmi-validation by newest wasmi ( #12501 )
...
* Replace sp-sandbox and wasmi-validation by just wasmi
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Re-check original code on re-instrumentation
* Fix clippy
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Apply suggestions from code review
Co-authored-by: Robin Freyler <robin.freyler@gmail.com >
* Replace wasmi by ::wasmi
* Bump wasmi to 0.20
* Add explanation for `unreachable`
* Change proof
* Fixup master merge
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Fixup naming inconsistencies introduced by reentrancy PR
* Fix `scan_imports` docs
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Fixup suggestions
* Remove unnecessary &mut
* Fix test
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Fix benchmark merge fail
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Fix docs as suggested by code review
* Improve docs for `CodeRejected`
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Fix logic bug when setting `deterministic_only`
* Don't panic when module fails to compile
* Apply suggestions from code review
Co-authored-by: Robin Freyler <robin.freyler@gmail.com >
Co-authored-by: command-bot <>
Co-authored-by: Robin Freyler <robin.freyler@gmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-11-24 23:51:36 +01:00
Artemka374
103ea38f95
seal_reentrant_count returns contract reentrant count (#12695 )
...
* Add logic, test, broken benchmark
* account_entrance_count
* Addressing comments
* Address @agryaznov's comments
* Add test for account_entrance_count, fix ci
* Cargo fmt
* Fix tests
* Fix tests
* Remove delegated call from test, address comments
* Minor fixes and indentation in wat files
* Update test for account_entrance_count
* Update reentrant_count_call test
* Delegate call test
* Cargo +nightly fmt
* Address comments
* Update reentrant_count_works test
* Apply weights diff
* Add fixture descriptions
* Update comments as suggested
* Update reentrant_count_call test to use seal_address
* add missing code
* cargo fmt
* account_entrance_count -> account_reentrance_count
* fix tests
* fmt
* normalize signatures
Co-authored-by: yarikbratashchuk <yarik.bratashchuk@gmail.com >
2022-11-15 14:12:08 +01:00
Alexander Theißen
3ae4be8662
contracts: Allow indeterministic instructions off-chain ( #12469 )
...
* Allow indetermistic instructions off-chain
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* fmt
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-10-24 17:48:04 +00:00
Alexander Theißen
bb9d2fa75a
Remove contracts RPCs ( #12358 )
...
* Remove contracts RPCs
* Remove serde as RPC serialization is no longer needed
* Rename folder to match crate name
* Compile fix
* Remove Byte wrapper
2022-10-02 15:16:45 +00:00
Alexander Theißen
857c3bf37b
Make automatic storage deposits resistant against changing deposit prices ( #12083 )
...
* Require `FixedPointOperand` for Balances
* Delay deposit calculation
* Make refunds pro rata of consumed storage
* Add storage migration
* Fix clippy
* Add liquidity checks
* Fixe delayed deposit limit enforcement
* Defer charges
* Import Vec
* Add try-runtime hooks for migration
* Fix warning
* Adapt to new OnRuntimeUpgrade trait
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* fmt
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* More suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-09-21 17:31:22 +00:00
Xavier Lau
86198c5471
Use array-bytes for All Array/Bytes/Hex Operations ( #12190 )
...
* Use `array-bytes` for All Array/Bytes/Hex Operations
Signed-off-by: Xavier Lau <xavier@inv.cafe >
* Reorder
* Self Review
* Format
* Fix Tests
* Bump `array-bytes`
* Optimize large test res
Signed-off-by: Xavier Lau <xavier@inv.cafe >
Co-authored-by: parity-processbot <>
2022-09-21 06:12:20 +00:00
Sergej Sakac
e4b6f4a66d
BREAKING: Rename Origin ( #12258 )
...
* BREAKING: Rename Origin
* more renaming
* a bit more renaming
* fix
* more fixing
* fix in frame_support
* even more fixes
* fix
* small fix
* ...
* update .stderr
* docs
* update docs
* update docs
* docs
2022-09-20 22:13:09 +00:00
Sergej Sakac
6e8795afe6
BREAKING: Rename Call & Event ( #11981 )
...
* rename Event to RuntimeEvent
* rename Call
* rename in runtimes
* small fix
* rename Event
* small fix & rename RuntimeCall back to Call for now
* small fixes
* more renaming
* a bit more renaming
* fmt
* small fix
* commit
* prep for renaming associated types
* fix
* rename associated Event type
* rename to RuntimeEvent
* commit
* merge conflict fixes & fmt
* additional renaming
* fix.
* fix decl_event
* rename in tests
* remove warnings
* remove accidental rename
* .
* commit
* update .stderr
* fix in test
* update .stderr
* TRYBUILD=overwrite
* docs
* fmt
* small change in docs
* rename PalletEvent to Event
* rename Call to RuntimeCall
* renamed at wrong places :P
* rename Call
* rename
* rename associated type
* fix
* fix & fmt
* commit
* frame-support-test
* passing tests
* update docs
* rustdoc fix
* update .stderr
* wrong code in docs
* merge fix
* fix in error message
* update .stderr
* docs & error message
* .
* merge fix
* merge fix
* fmt
* fmt
* merge fix
* more fixing
* fmt
* remove unused
* fmt
* fix
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2022-09-12 22:03:31 +00:00
Boluwatife Bakre
3ec4d13e9f
Use parameter_types instead of thread_local for test-setup ( #12036 )
...
* Edit to Assets. parameter_types
* fixes
* Test Fixes. WIP
* Edits to pallet-aura
* Camel Case
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Implementation of mutate fn
* update to pallet-aura
* Update to frame-system. Fixes
* Update to frame-support-test. CamelCases
* Updates to frame- contracts, offences, staking, bounties, child bounties
* Edit to mutate fn. Changes to frame-contracts. CamelCase pallet-aura
* Edits to frame-contracts & executive
* cargo +nightly fmt
* unused import removed
* unused import removed
* cargo +nightly fmt
* minor adjustment
* updates
* updates
* cargo +nightly fmt
* cargo +nightly fmt
* take fn implemented
* update
* update
* Fixes to CallFilter
* cargo +nightly fmt
* final fixes
* Default changed to $value
* Update frame/support/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2022-09-08 10:46:25 +00:00
Alexander Theißen
09a52ef882
Emit events for inter contract calls ( #12136 )
...
* Add topics to contract events
* Add `Call` events
* Fix compilation for no_std
* Added docs
2022-09-03 08:03:36 +00:00
Shawn Tabrizi
30951822ba
Weight v1.5: Opaque Struct ( #12138 )
...
* initial idea
* update frame_support
* update a bunch more
* add ord
* adjust RuntimeDbWeight
* frame_system builds
* re-export
* frame_support tests pass
* frame_executive compile
* frame_executive builds
* frame_system tests passing
* pallet-utility tests pass
* fix a bunch of pallets
* more
* phragmen
* state-trie-migration
* scheduler and referenda
* pallet-election-provider-multi-phase
* aura
* staking
* more
* babe
* balances
* bunch more
* sudo
* transaction-payment
* asset-tx-payment
* last pallets
* fix alliance merge
* fix node template runtime
* fix pallet-contracts cc @athei
* fix node runtime
* fix compile on runtime-benchmarks feature
* comment
* fix frame-support-test
* fix more tests
* weight regex
* frame system works
* fix a bunch
* more
* more
* more
* more
* more
* more fixes
* update templates
* fix contracts benchmarks
* Update lib.rs
* Update lib.rs
* fix ui
* make scalar saturating mul const
* more const functions
* scalar div
* refactor using constant functions
* move impl
* fix overhead template
* use compactas
* Update lib.rs
2022-08-31 11:26:13 +00:00
Squirrel
a68a80fbae
declone and close the door ( #12035 )
...
* declone and close the door
* cargo fmt
* remove brackets
2022-08-15 19:38:36 +00:00
Sebastian Kunert
9f409dc0b8
Prepare for rust 1.62.1 ( #11903 )
...
* Update UI test output for rust 1.62.1
* switch ci to staging image to check that everything works
* fix artifacts node-bench-regression-guard
* Imeplement `scale_info::TypeInfo` manually to silence aggressive rust warning
* Fix more clippy lints
* Make clippy happy by relying on auto-deref were possible
* Add tracking issue to the comments
* pin ci image
Co-authored-by: alvicsam <alvicsam@gmail.com >
2022-07-26 14:37:05 +02:00
GreenBaneling | Supercolony
92920c6b0d
[contracts] Fixed the bug with transfer value for delegate call ( #11771 )
...
* Fixed the bug with transfer value.
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Moved check into `initial_transfer`
* Fmt
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-07-05 10:12:16 +00:00
Alexander Gryaznov
68ea2ab039
[contracts] Implement transparent hashing for contract storage ( #11501 )
...
* save
* builds and old tests pass
save: temporary value dropped while borrowed
save: finally builds
test updated but still fails
* type names enhanced
* VarSizedKey bounded to new Config param
* improved wasm runtime updated funcs
* unstable-interface tests fixed
* benchmarks fixed
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* fixes on feedback
* fixes on feedback applied + make it build
* benchmarks build but fail (old)
* "Original code too large"
* seal_clear_storage bench fixed (code size workaround hack removal tbd)
* bench_seal_clear_storage pass
* bench_seal_take_storage ... ok
* added new seal_set_storage + updated benchmarks
* added new seal_get_storage + updated benchmarks
* added new seal_contains_storage + updated benchmarks
* added tests for _transparent exec functions
* wasm test for clear_storage
* wasm test for take_storage
* wasm test for new set_storage
* wasm test for new get_storage
* wasm test for new contains_storage
* CI fix
* ci fix
* ci fix
* ci fix
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
* fixes according to the review feedback
* tests & benchmarks fixed
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
* refactoring
* fix to runtime api
* ci fix
* ctx.get_storage() factored out
* ctx.contains_storage() factored out
* number of batches reduced for transparent hashing storage benchmarks
* contracts RPC & pallet::get_storage to use transparent hashing
* node and rpc updated to use get_storage with VarSizedKey
* refactored (more concize)
* refactored contains_storage (DRYed)
* refactored contains_storage (DRYed)
* fix rpc
* fmt fix
* more fixes in rpc
* rollback `Pallet:get_storage` to Vec<u8> and rpc and node parts related to it
* added `KeyDecodingFailed` error
* Revert weird "fmt fix"
This reverts commit c582cfff4b5cb2c9929fd5e3b45519bb24aeb657.
* node-executor basic test update
* fix node-executor basic test
* benchmarks fix
* more benchmarks fix
* FixedSizedKey is hidden from pub, VarSizedKey is exported as StorageKey
* ci fix
* set_storage benchmark fix
* ci fix
* ci fix
* comments improved
* new error code to rpc: KEY_DECODING_FAILED
* Put `rusty-cachier` before PR merge into `master` for `cargo-check-benches` job
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
* minor optimization
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Parity Bot <admin@parity.io >
Co-authored-by: Vladimir Istyufeev <vladimir@parity.io >
Co-authored-by: command-bot <>
2022-06-23 12:10:35 +00:00
Falco Hirschenberger
b581604aa7
Apply some clippy lints ( #11154 )
...
* Apply some clippy hints
* Revert clippy ci changes
* Update client/cli/src/commands/generate.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/cli/src/commands/inspect_key.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/db/src/bench.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/db/src/bench.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/service/src/client/block_rules.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/service/src/client/block_rules.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/network/src/transactions.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/network/src/protocol.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Revert due to missing `or_default` function.
* Fix compilation and simplify code
* Undo change that corrupts benchmark.
* fix clippy
* Update client/service/test/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/state-db/src/noncanonical.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update client/state-db/src/noncanonical.rs
remove leftovers!
* Update client/tracing/src/logging/directives.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update utils/fork-tree/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* added needed ref
* Update frame/referenda/src/benchmarking.rs
* Simplify byte-vec creation
* let's just not overlap the ranges
* Correction
* cargo fmt
* Update utils/frame/benchmarking-cli/src/shared/stats.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update utils/frame/benchmarking-cli/src/pallet/command.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update utils/frame/benchmarking-cli/src/pallet/command.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Giles Cope <gilescope@gmail.com >
2022-04-30 21:28:27 +00:00
Alexander Gryaznov
9676ce6f36
Add frame_support::crypto::ecdsa::Public.to_eth_address() (k256-based) and use it in pallets ( #11087 )
...
* `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 >
2022-04-16 15:51:40 +03:00
Shawn Tabrizi
96ee61179a
Add Limit to Tranasctional Layers ( #10808 )
...
* introduce hard limit to transactional
* add single layer transactional
* remove single_transactional
* Update mod.rs
* add tests
* maybe fix contracts cc @athei
* fmt
* fix contract logic
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update exec.rs
* add unchecked and custom errors
* Update lib.rs
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Replace storage access by atomics
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-04-02 17:12:54 +00:00
Alexander Gryaznov
e4caf7388a
contracts: add seal_code_hash and seal_own_code_hash to API ( #10933 )
...
* `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 >
2022-03-29 15:14:49 +00:00
Alexander Theißen
bef9b79d7b
contracts: Add test to verify unique trie ids ( #10914 )
...
* Add test to verify unique trie ids
* Rename trie_seed to nonce
* Rename AccountCounter -> Nonce
* fmt
2022-03-10 11:28:00 +00:00
Alexander Theißen
b82cfbac4d
contracts: Fix seal_call weights ( #10796 )
...
* Fix call weights
* Fix instantiate benchmark
* 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
* Remove stale and superflous comments
* `decrement_refcount` should be infallible
* Don't hardcode increment_refcount, decrement_refcount
* Rename CopyIn/CopyOut
* Fix warning in tests
Co-authored-by: Parity Bot <admin@parity.io >
2022-02-15 08:56:22 +00:00
Yarik Bratashchuk
e70ffbf44d
Upgradable contracts using set_code function ( #10690 )
...
* poc logic
* set_code_hash impl, tests, benchmark
* Address @xgreenx's comments
* Move func defs closer to set_storage
* Check if code exists
- increment/decrement codehash refcount
* Document error for non-existing code hash
* Revert unrelated change
* Changes due to @athei's review
* Fix error handling
- comment errors: ReturnCodes
- update mock ext implementation
- return Error::CodeNotFound when no code for such hash
* Emit ContractCodeUpdated when setting new code_hash
* Address @athei's comments
* Move related defs to the bottom
* Minor comment update
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Improve docs
* Improve docs
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Refactor set_code_hash test
* Minor change to benchmark
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Minor change to benchmark
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Minor comment refactor
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Address @HCastano's comments
* Update seal_set_code_hash comment
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
* Move set_code_hash after delegate_call
* Move function to the bottom
* Moved and changed banchmark, added verify block
* Bring back previous benchmark
* Remove skip_meta for seal_set_code_hash
* Bring back skip_meta for seal_set_storage_per_new_kb
* Apply weights
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
2022-02-11 07:46:51 +00:00
Yarik Bratashchuk
d14e1c641e
seal_delegate_call api function (support for library contracts) (#10617 )
...
* 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
2022-02-08 11:43:32 +00:00
Alexander Gryaznov
d5c8593566
contracts: is_contract(address) and caller_is_origin() are added to API ( #10789 )
...
* is_contract() and caller_is_origin() added to Ext API
* is_contract() exposed in wasm runtime.rs
* + test for is_contract()
* + seal_is_contract benchmark
* caller_is_origin() exposed to wasm/runtime.rs and covered by a test
* + seal_caller_is_origin benchmark
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* identation fix for benchmark macroses; test cosmetic improvement
* benchmark fix
* + is_contract() wasm test
* + caller_is_origin() wasm test
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* is_contract() to borrow param instead of taking ownership
* phrasing improved
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
* fixed wasm tests according to @athei feedback
* dead code warnings suppressed by unstable-interface attributes
* 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
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
Co-authored-by: Parity Bot <admin@parity.io >
2022-02-04 19:13:00 +00:00
Alexander Theißen
dc45201a64
Pre-Charge max size when contracts access storage ( #10691 )
...
* Fix seal_get_storage
* Fix seal_take_storage
* Add more benchmarks
* 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
* Fix seal_set_storage
* Fix seal_contains_storage and seal_clear_storage
* Fix benchmarks
* 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
* Get rid of mem::size_of in benchmarks
* Fix up code loading
* Apply suggestions from code review
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
* Fix test to call same function twice
* Replaced u32::MAX by SENTINEL const
* Fix seal_contains_storage benchmark
* 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
Co-authored-by: Parity Bot <admin@parity.io >
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
2022-01-24 20:14:31 +00:00
Alexander Theißen
46e38e8288
Add additionally functionality to contracts storage interface ( #10497 )
...
* Add new versions for storage access host functions
* Improve docs
2022-01-08 12:19:23 +00:00