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
Davide Galassi
f110941b7f
Keystore overhaul ( #13615 )
...
* Remove 'supported_keys' 'sign_with_any' and 'sign_with_all' from keystore trait
* Remove the aync keystore
* Renaming:
- SyncCryptoStore -> Keystore
- SyncCryptoStorePtr -> KeystorePtr
- KeyStore -> MemoryKeystore
* Fix authority discovery worker and tests
* Rename 'insert_unknown' to 'insert'
* Remove leftover
2023-03-17 11:24:14 +00:00
Sasha Gryaznov
f85d6dc6dd
[contracts] Forbid calling back to contracts after switching to runtime ( #13443 )
...
* save: compiles and tests pass
* save: added global
* done + test
* cleanup
* changelog update
* cleanup
* address feedback, step 1
* address feedback, step 2
* address feedback, step 3
* returned updated gas_estimation_call_runtime test
* clippy fix
* address feedback, step 4
* address feedback, step 5
* move data from context to inputs
* docs fix
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* address feedback, step 6
---------
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-03-06 08:40:03 +00:00
Oliver Tale-Yazdi
9e56e1acdd
Deprecate Weight::from_{ref_time, proof_size} ( #13475 )
...
* Deprecate Weight::from_{ref_time, proof_size}
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update templates
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Use from_parts
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Use from_parts
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Dont revert comment 🤦
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances
* Update weight files
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* More fixes
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Adapt to Master changes
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: command-bot <>
2023-03-02 21:28:17 +00: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
Alexander Theißen
1c04ab0f6f
contracts: Use proof_size from benchmarks ( #13268 )
...
* 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 >
2023-02-15 22:56:50 +01: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
Oliver Tale-Yazdi
fc2fda8d19
Rename pallet-random-collective-flip to Insecure... ( #13301 )
...
* Rename pallet-random-collective-flip to Insecure...
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* fmt
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2023-02-06 18:12:06 +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
05b846d63b
[contracts] Adapt storage reading host functions to Weights V2 ( #12976 )
...
* update RuntimeCosts to Weights V2, update tests
* improve docs
* clearer naming and docs to compat_weight helper
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* save before master merge
* HostFnWeights to Weight
* added to_weight! macro
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* RuntimeCosts::ChainExtension to weight_v2
* chain extension to weight v2
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-01-18 10:36:09 +00:00
Sasha Gryaznov
29f8f037b7
[contracts] Remove stack height limiter wasm instrumentation ( #12957 )
...
* Remove stack height limiter from uploaded wasm
* fix benchmarks
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-12-22 18:22:57 +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
Anthony Alaribe
96902eae48
Revert "Move LockableCurrency trait to fungibles::Lockable and deprecate LockableCurrency ( #12798 )" ( #12882 )
...
This reverts commit 9a014d1ecd .
2022-12-09 09:40:59 +00:00
Keith Yeung
51db8c77a7
Introduce sensible weight constants ( #12868 )
...
* Introduce sensible weight constants
* cargo fmt
* Remove unused import
* Add missing import
* ".git/.scripts/bench-bot.sh" pallet dev pallet_lottery
Co-authored-by: command-bot <>
2022-12-09 01:18:51 +09:00
Anthony Alaribe
9a014d1ecd
Move LockableCurrency trait to fungibles::Lockable and deprecate LockableCurrency ( #12798 )
...
* WIP move LockableCurrency to fungibles
* rename Lockable and LockIdentifier to funginbles::*
* fix imports further
* change Lockable from fungible to fungibles
* reintroduce LockableCurrency but marked as deprecated
* fix imports
* fix imports
* cargo fmt
* add allow deprecated warnings
* remove unused benchmark import
* fix some of the docs
* fix failing doctest check
* reexport LockIdentifier and LockableCurrency from support/traits
* reexport LockIdentifier and LockableCurrency from support/traits
* allow using deprecated re-export
* replace LockableCurrency and LockIdentifier with a module alias
* Update frame/support/src/traits/tokens/fungibles/lockable.rs
* Update frame/staking/src/pallet/mod.rs
Co-authored-by: Squirrel <gilescope@gmail.com >
* Update frame/support/src/traits.rs
Co-authored-by: Squirrel <gilescope@gmail.com >
* REVERT removing fungibles::Lockable import
Co-authored-by: parity-processbot <>
Co-authored-by: Squirrel <gilescope@gmail.com >
2022-12-08 12:47:13 +00:00
Alexander Theißen
edce3ead3b
contracts: Replace cargo feature unstable-interface with config ( #12787 )
...
* Replace cargo feature with config
* Update frame/contracts/proc-macro/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-11-30 14:19:14 +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
b135a0fae4
Adapt pallet-contracts to WeightV2 ( #12421 )
...
* Replace contract access weight by proper PoV component
* Return the whole weight struct from dry-runs
* Fixup `seal_call` and `seal_instantiate`
* Fix duplicate extrinsics
* Remove ContractAccessWeight from runtime
* Fix doc link
* Remove leftover debugging output
2022-10-05 11:10:20 +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
Keith Yeung
a4fb1d7096
Properly set the max proof size weight on defaults and tests ( #12383 )
...
* Properly set the max proof size weight on defaults and tests
* cargo fmt
* Set proper max proof size for contracts pallet tests
* Properly set max proof size for node
* Properly set max proof size for frame system mock
* Update test expectations
* Update test expectations
* Properly set max proof size for balances mock
* Update test expectations
* Update test expectations
* Properly set max proof size for democracy mock
* Properly set max proof size for scheduler mock
* Properly set max proof size for fast unstake mock
* Properly set max proof size for tx payment mock
* Properly set max proof size for elections phragmen mock
* Properly set max proof size for node template
2022-09-29 15:48:10 +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
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
Alexander Theißen
0d2adf1fa1
contracts: Use WeakBoundedVec for instrumented code ( #12186 )
...
* Use WeakBoundedVec for instrumented code
* Remove `RelaxedMaxCodeLen` from kitchensink
2022-09-19 10:56:46 +00:00
Keith Yeung
30e7b1e8cd
Create sp-weights crate to store weight primitives ( #12219 )
...
* Create sp-weights crate to store weight primitives
* Fix templates
* Fix templates
* Fixes
* Fixes
* cargo fmt
* Fixes
* Fixes
* Use deprecated type alias instead of deprecated unit types
* Use deprecated subtraits instead of deprecated hollow new traits
* Fixes
* Allow deprecation in macro expansion
* Add missing where clause during call macro expansion
* cargo fmt
* Fixes
* cargo fmt
* Fixes
* Fixes
* Fixes
* Fixes
* Move FRAME-specific weight files back to frame_support
* Fixes
* Update frame/support/src/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Add missing header
* Rewrite module docs
* Fixes
* Fixes
* Fixes
* Fixes
* cargo fmt
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2022-09-13 13:23:44 +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
1df4561676
Weight v1.5 Follow Ups ( #12155 )
...
* 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
* Update frame/support/src/weights/weight_v2.rs
* not needed
* fix weight file
2022-09-01 17:48:03 +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
Kevin Wang
266fa8516a
Fix 16bit func_id ( #11985 )
2022-08-08 09:46:57 +00:00
Alexander Theißen
c470e9d11d
contracts: Allow ChainExtension::call() to access &mut self ( #11874 )
...
* Give chain extensions the ability to store some temporary values
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
* Rename func_id -> id
* Replace `id` param by two functions on `env`
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
2022-07-25 15:48:01 +00:00
Alexander Theißen
8dbfcd3928
contracts: Composable ChainExtension ( #11816 )
...
* Add `RegisteredChainExtension`
* Add tests
* Update frame/contracts/src/chain_extension.rs
Co-authored-by: Michael Müller <michi@parity.io >
* Add more docs
* Remove debugging leftover
* Make ChainExtension-registry lowercase
* Apply suggestions from code review
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
* Improve clarity of test inputs
Co-authored-by: Michael Müller <michi@parity.io >
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com >
2022-07-14 18:14:28 +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
Achim Schneider
f744a1a01b
Contracts pallet: removal on idle ( #11202 )
...
* on_initialize -> on_idle
* use remaining_weight info
* no weight_limit for on_idle
* call on_idle in tests
* attempt to fix tests
* run on_initiaize when queue full
* add on_idle to weight info
* add on_idle weight info to on_idle hook
* add basic test for on_initialize with full queue
* disbale check for all keys gone in full queue, full block test
* queue_deth as usize, add comment
* comment was removed by accident
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* cargo +nightly fmt
* update lazy_removal_does_no_run_on_full_queue_and_full_block
* remove changes in weights.rs
* weights on_idle -> on_process_deletion_queue_batch
* use block number for on_idle
* use BlockNumber for on_initialize
* 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
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* remove outcommented code
* add check that queue still full for test
* cargo fmt
* cargo +nightly fmt
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: Alexander Gryaznov <hi@agryaznov.com >
* fix weights.rs
* add lazy_removal_does_no_run_on_low_remaining_weight test
* Apply suggestions from code review
Co-authored-by: Alexander Gryaznov <hi@agryaznov.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Parity Bot <admin@parity.io >
Co-authored-by: Alexander Gryaznov <hi@agryaznov.com >
2022-05-24 14:17:23 +00:00
Alexander Gryaznov
c0fb033206
Stabilize ecdsa_ functions ( #11486 )
2022-05-20 11:20:41 +00:00
Alexander Theißen
b3b7b4ddc7
contracts: Add set_code root dispatchable ( #11451 )
...
* Add `set_code` dispatchable
* 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
Co-authored-by: Parity Bot <admin@parity.io >
2022-05-18 23:50:22 +00:00
Alexander Theißen
ef46d84aed
contracts: Get rid of #[pallet::without_storage_info] ( #11414 )
...
* Implement `MaxEncodeLen` for pallet-contracts storage
* Remove redundant debug println
* Move code len check to PrefabWasmModule::from_code
2022-05-18 07:40:53 +00:00
Alexander Theißen
4b64c9085a
contracts: Prevent PoV attack vector with minimal viable solution ( #11372 )
...
* Add ContractAccessWeight
* Apply suggestions from code review
Co-authored-by: Michael Müller <michi@parity.io >
Co-authored-by: Michael Müller <michi@parity.io >
2022-05-09 09:25:14 +00:00
Alexander Gryaznov
9fd4df9ccf
[contracts] stabilize seal_code_hash, seal_set_code_hash and seal_own_code_hash ( #11337 )
...
* stabilize seal_code_hash, seal_set_code_hash, seal_own_code_hash
* fix missed place found by CI
* Fixed missed __unstable__
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-05-04 10:35:30 +03:00
Bisola Olasehinde
aaf693f05a
Replace simple parameter_types ( #11254 )
...
* update bin/node-template/runtime/src/lib.rs
* update frame/contracts/src/tests.rs
* update frame/executive/src/lib.rs
* update frame/grandpa/src/mock.rs
* update frame/im-online/src/mock.rs
* update frame/offences/benchmarking/src/mock.rs
* update frame/recovery/src/mock.rs
* update frame/referenda/src/mock.rs
* update frame/session/benchmarking/src/mock.rs
* update frame/staking/src/mock.rs
* update frame/state-trie-migration/src/lib.rs
* update frame/support/test/compile_pass/src/lib.rs
* frame/treasury/src/tests.rs
* update frame/whitelist/src/mock.rs
* update frame/vesting/src/mock.rs
* update test-utils/runtime/src/lib.rs
* update bin/node-template/runtime/src/lib.rs
* Update frame/grandpa/src/mock.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* resolve failed checks 1518659 & 1518669
* resolve format check
* backtrack to resolve compile error
* check --all --tests ✅
* cargo +nightly fmt ✅
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
2022-04-29 02:25:50 +00:00
Qinxuan Chen
41c84b0b41
Remove useless imports ( #11136 )
...
Because `TryInto`/`TryFrom` are in prelude by default from edition 2021
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
2022-04-03 21:44:29 +02:00
Alexander Theißen
1317147589
Stabilize seal_delegate_call ( #11037 )
2022-03-15 15:26:59 +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
Davide Galassi
a2b80edf12
Replace libsecp256k1 with k256 in FRAME related code ( #10883 )
...
* Replace libsecp256k1 with k256 in beefy-mmr
* Port of FRAME `contracts` benchmarking from `libsecp256k1` to `k256`
* Newtype to allow `Pcg32` rng usage with `k256` in contracts benchmarks
* Use `sp-io::crypto` to generate dummy keys in `contracts` bechmarks
* More compact code
* Cargo fmt
* Build `sp-keystore` only for dev profile
* Move public key generation back to the `map`
2022-02-23 10:17:47 +01:00