Commit Graph

8072 Commits

Author SHA1 Message Date
Liam Aharon cfe5e8a8df run tests with --experimental flag (#14502) 2023-07-06 21:35:55 +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
Liam Aharon 9c3ca04781 emit warn log on bad state (#14513) 2023-07-05 14:44:56 +00:00
Jegor Sidorenko 032aa05221 Use set_balance() instead of write_balance() in benchmark (#14497)
* Use set_balance instead of write_balance in benchmark

* Another approach

* Use BalanceOf::<T>::max_value() / 1000

* use a regular div instead of a checked one
2023-07-05 10:04:31 +00:00
Jegor Sidorenko f5776f6897 Improve NFT locking (#14510)
* Update docs

* Prevent locking of the same NFT twice

* Validate item is not locked on burn

* Cover with tests

* chore
2023-07-05 09:17:08 +00:00
Bastian Köcher 1bf2504ebf sc-cli: Remove SubstrateCli::native_runtime_version function (#14511)
The native runtime will be removed in the near future and thus this function will not be required
anymore.

\# Code changes

Downstream users just need to remove `native_runtime_version` from their implementation of the
`SubstrateCli` trait.
2023-07-05 07:38:06 +00:00
Sasha Gryaznov f83fdeab53 contracts: switch from parity-wasm-based to wasmi-based module validation (#14449)
* 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

* save: scan_exports ported, compiles

* save (wip, not compiles)

* 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

* scan_imports ported

* scan_export ported, other checks removed

* tests fixed

tests fixed

* drop wasmparser and parity-wasm dependencies

* typo fix

* 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

* allow stored modules to have no memory imports

* rollback: allow stored modules to have no memory imports

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts

* address review comments

---------

Co-authored-by: command-bot <>
2023-07-04 21:38:47 +00:00
Bastian Köcher 79f600db70 Revert k256 removal (#14499)
* Revert "Remove k256 crate from frame-support dependencies (#14452)"

This reverts commit 4d426214af.

* Keep the test
2023-07-03 23:38:51 +02:00
Ross Bulat fc36e04dfa Nomination pools: disallow setting above global max commission (#14496)
* add CommissionExceedsGlobalMaximum

* rename test

* amend set_commission_max_works_with_error_tests

* fmt
2023-07-03 21:22:12 +00:00
Hugo Trentesaux 7a2a1b93cb Fix typo (#14479) (#14480) 2023-07-03 17:09:29 +00: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
gupnik e42768ea34 Removes pallet::call_index from dev_mode example (#14492)
* Removes call_index

* Adds UI test and updates doc

* Update frame/examples/dev-mode/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/examples/dev-mode/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-07-03 10:00:44 +00:00
Bastian Köcher 42243fb346 wasm-builder: Make hash and date optional (#14490)
* wasm-builder: Make `hash` and `date` optional

Apparently there are installations where the `hash` and `date` is optional.

Closes: https://github.com/paritytech/substrate/issues/14335

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: command-bot <>
2023-07-03 09:58:42 +00:00
Bastian Köcher 698a6d1aa8 sp-api: Put frame-metadata behind some feature (#14398)
* sp-api: Put `frame-metadata` behind some feature

Closes: https://github.com/paritytech/substrate/issues/14296

* ".git/.scripts/commands/fmt/fmt.sh"

* Review feedback

---------

Co-authored-by: command-bot <>
2023-07-03 11:54:28 +02:00
Bastian Köcher d124c90734 sc-tracing: Only print events for whitelisted targets (#14487)
* sc-tracing: Only print events for whitelisted targets

We should only print events for whitelisted targets, otherwise we may run into some stack overflow
while printing the event.

* Update client/tracing/src/lib.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Fix

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
2023-07-03 09:47:42 +00:00
Cyrill Leutwiler 6005d19905 stabilize instantiation_nonce (#14493)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2023-07-03 09:25:17 +00:00
Oliver Tale-Yazdi 234ceca1cc Whitelist 'intrablock_entropy' (#14489)
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-07-02 14:18:10 +00:00
Liam Aharon 4137aa687d migrations: VersionedRuntimeUpgrade (#14311)
* VersionedRuntimeUpgrade

* only require one version and add a pre-upgrade check

* add docs

* improve warning log

* improve comments

* fix log

* use associated constants

* allow passing from and to versions

* test versioned_runtime_upgrade

* fix typo

* improve docs

* docs

* docs

* remove event from dummy pallet

* remove pre_upgrade current storage version check

* derive_impl

* skip pre/post checks if the actual migration will not run

* improve variable naming

* docs

* fix post_upgrade 'should run' logic

* fix comments

* pre and post hook tests

* feature gate try-runtime stuff

* remove deprecated macro

* Update frame/support/src/migrations.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* decode_all

* make experimental

* use rust generics

* add info log when running

* simplify tests

* improve log

* improve log

* cleaner pre_upgrade encoding

* Update frame/support/src/migrations.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/support/src/migrations.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/support/src/migrations.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/support/src/migrations.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/support/src/migrations.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* VersionedPostUpgradeData enum

* move versioned runtime upgrade tests to test/tests

* fix rust doc

* clarify comment

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>
2023-07-02 08:36:14 +00:00
Muharem Ismailov 2f98b56393 Pallets: Assets destroy_accounts releases the deposit (#14443)
* assset accounts destroy releases the deposit

* enumerate

* Update frame/assets/src/functions.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* import defensive from frame_support

---------

Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: parity-processbot <>
2023-07-01 15:48:53 +00:00
Alexandru Vasile de52e76d52 Stabilize V15 Metadata (#14481)
* Update frame-metadata to latest branch

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Stabilize V15

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update frame-metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Use frame-metadata from crates.io

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust testing

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* test: Adjust frame-support metadata docs

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update primitives/metadata-ir/src/lib.rs

Co-authored-by: James Wilson <james@jsdw.me>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: parity-processbot <>
2023-06-30 12:33:35 +03:00
Bastian Köcher 448989f5ec sp-api: Support nested transactions (#14447)
* sp-api: Support nested transactions

Adds support for nested transactions in `sp-api` by using `execute_in_transaction`. This was working
until a recent refactor, but this was actually not intended. However, supporting nested transactions
is a worthwhile feature to have. So, this pr "brings it back" and adds a test to ensure it will not break.

* Make clippy happy

* Assert that the runtime api type is not unwind safe

* Count number of transactions
2023-06-29 18:01:45 +02:00
Bastian Köcher 83caca85b6 frame-benchmarking-cli: Remove native dispatch requirement (#14474)
* frame-benchmarking-cli: Remove native dispatch requirement

No need for this, we can just use the `WasmExecutor` directly.

* Fixes

* Pass benchmarking host functions

* Ensure we can pass custom host functions
2023-06-29 17:56:25 +02:00
Aaro Altonen 0e58bd91b6 Inject FromSwarm::NewListenAddr to mDNS (#14478) 2023-06-29 17:28:32 +02:00
Nazar Mokrynskyi ff7e8b6b17 Unify SyncMode data structures under one (#14465) 2023-06-29 17:25:41 +02:00
Oliver Tale-Yazdi f1c16d05e7 Update Reference Hardware Specs (#13317)
* Remove Polkadot Wiki

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update requirements for new ref hardware

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add test

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: parity-processbot <>
2023-06-28 21:16:55 +00:00
Liam Aharon a7d82e1eb1 fix on-runtime-upgrade checks docs (#14467) 2023-06-28 15:53:33 +00:00
Sebastian Kunert 30a7e6788c Make triecache generic and work for no-std environments (#14403)
* Remove `AsLocalTrieCache` trait

* Introduce new trait AsTrieDbCache

* Use AsTrieDbCache trait

* Make it compile

* Docs

* Improve naming of associated type, implement cache usage for no-std

* Improve naming

* Improve docs

* Allow construction with optional cache

* FMT

* Remove unused variable

* Revert unwanted change

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* More comment adjustments

* Docs

* Trigger CI

* ".git/.scripts/commands/fmt/fmt.sh"

* Apply suggestions from code review

Co-authored-by: Koute <koute@users.noreply.github.com>

* Review comments

* Review comments

* Apply suggestions from code review

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* fmt

* Bump trie-db again

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
2023-06-28 12:57:41 +00:00
Alexandru Vasile 943697fa69 Metadata V15: Enrich extrinsic type info for decoding (#14123)
* metadata-ir: Add extrinsic type info to decode address, call, sig

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame-metadata: Point to unreleased branch

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-ir: Include addrees, call, signature in V15 conversion

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-ir: Include extra ty

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* construct_runtime: Extract address,call,sig,extra ty from tx type

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/tests: Check metadata populates xt types correctly

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-ir/tests: Add extra fields on ExtrinsicMetadataIR

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* primitives/traits: Expand the `Extrinsic::SignaturePayload`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* primitives: Adjust to new `Extrinsic` associated types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/metadata: Simplify metadata generation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/example: Adjust to new interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/tests: Adjust `extrinsic_metadata_ir_types`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert the additional Extrinsic' associated types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* primitives: Add `SignaturePayload` marker trait

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* primitives: Implement SignaturePayload for empty tuple

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust to new SignaturePayload trait

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Adjust `extrinsic_metadata_ir_types` to new interface

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Adjust pallet test

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Add Extrinsic length prefix to the metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* primitives: Populate `ExtrinsicMetadataIR` with `len_ty`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update primitives/runtime/src/traits.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Apply cargo fmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* v15: Remove len type of the extrinsic

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Update frame-metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
2023-06-28 12:44:20 +00:00
Bastian Köcher b4e863c472 sc-network: Improve invalid boot node reporting (#14455)
This improves the reporting of invalid boot nodes. First, it will only report each boot node once
as invalid and not every time we try to connect to the node. Second, the node will only report for
addresses that we added as startup and not for addresses of the boot node that the node learned from
other nodes.

Closes: https://github.com/paritytech/substrate/issues/13584
Closes: https://github.com/paritytech/polkadot/issues/7385
2023-06-28 13:21:05 +02:00
Alexandru Vasile 73a368c2e4 Metadata V15: Expose types for the overarching Call, Event, Error enums (#14143)
* frame-metadata: Point to unreleased branch

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Generalize outer enum generation for events and errors

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Remove individual generation of outer enum events

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* primitives/traits: Add marker trait for outer runtime enums

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Derive Clone, PartialEq, Eq for RuntimeEvents only

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/pallet: Include `#[pallet::error]` enum into pallet parts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* metadata-ir: Include call, event, error types

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/metadata: Include outer enum types in V15 metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/tests: Ensure `RuntimeError` includes `#[pallet::error]` parts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Document the reserved name for `RuntimeError`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Use self-generated `RuntimeEvent` for `GetRuntimeOuterEnumTypes`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/ui: Fix UI tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Remove unused system path

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/ui: Unexpected field and reintroduce frame_system::Config for RuntimeCall

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Remove `GetRuntimeOuterEnumTypes` marker trait

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Remove `;` from macro

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update frame-metadata to point to unreleased branch

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Rename error_enum_ty to module_error_enum_ty

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update module_error_ty documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Implement from_dispatch_error

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/support: Adjust test to ModuleErrorType

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Improve documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame/tests: Check `from_dispatch_error` impl

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update frame-metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove the module_error_ty

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Apply fmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert unneeded parts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert "Revert unneeded parts"

This reverts commit b94bbd16078a025775a48da1095edec1705e6a4d.

Revert "Apply fmt"

This reverts commit 9b1c3e7b4ef27d32e10b35054a99916067e0397b.

Revert "Remove the module_error_ty"

This reverts commit 98de5b24653f9f9ec6ee842b749401b18a01758a.

* Update frame-metadata to origin/master

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add outerEnums to the metadata

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Add tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Keep backwards compatibility for explicit pallet parts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Rename tt_error_part to be more generic

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Increase recursion_limit to 1k

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Rename `fully_expanded` to `expanded`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Improve documentation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust UI tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update UI tests

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update undefined_validate_unsigned_part.stderr UI test

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust yet again

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Optimise macro expansions

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Use latest frame-metadata and rename `moduleErrorType` to `RuntimeError`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Fix comment

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Apply fmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update frame/support/procedural/src/construct_runtime/parse.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/support/procedural/src/construct_runtime/parse.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame-metadata PR

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove `expanded` from error messages and fix typo

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Move docs to the function

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* ui: Use the intermed syntax for pallet parts

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update frame-metadata with latest release

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* frame: Address feedback for `from_dispatch_error`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
2023-06-28 09:44:05 +00:00
Oliver Tale-Yazdi 4249643df2 pallet-message-queue: add queue pausing (#14318)
* pallet-message-queue: add queue pausing

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix build

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove check

Otherwise it would not start servicing queues that started paused
and became unpaused afterwards.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-06-28 08:58:31 +00:00
Liam Aharon 2119c80225 fix(test-externalities): include memory db reference counts in snapshots (#14411)
* persist memory db reference counts in snapshots

* update proxy_test snapshot

* clippy

* comment

* comment

* add snapshot versioning

* update proxy_test

* compact snapshot version

* kick ci

* kick ci

* check snapshot version without extra struct
2023-06-27 14:26:27 +00:00
Sebastian Kunert ede49c7ae6 Remove unused dependencies (#14464) 2023-06-27 13:33:42 +00:00
gupnik 5d8774016c [FRAME Core] Adds ability to split a pallet across multiple files (#13950)
* Initial setup

* Updates macro_magic version and refactors accordingly

* Removes unwrap from macro

* Splits into multiple sections

* Uses call_site to fix macro hygiene issue

* Initial setup

* Removes unnecessary changes

* Moves template palet back

* Updates cargo.lock

* Moves BagsList inside mod

* Comments access to internal functions for now

* Updates tests

* Uncomments code

* Fixes test

* Moves bags-list to separate crate

* Initial setup

* Removes bags-list changes

* Fix structure

* Minor update

* Addresses review comment

* Adds a couple of UI tests. More to be added

* Adds err files

* Adds test for no pallet

* Adds doc

* Updates versions

* Adds benchmarking

* Updates doc link

* ".git/.scripts/commands/fmt/fmt.sh"

* Minor update

* Adds missing changes

* ".git/.scripts/commands/fmt/fmt.sh"

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Sam Johnson <sam@durosoft.com>

* Addresses review comments

* Addresses review comments

* ".git/.scripts/commands/fmt/fmt.sh"

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Sam Johnson <sam@durosoft.com>

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Sam Johnson <sam@durosoft.com>

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Sam Johnson <sam@durosoft.com>

* Adds UI test for disambiguation

* ".git/.scripts/commands/fmt/fmt.sh"

* Makes clippy happy

* ".git/.scripts/commands/fmt/fmt.sh"

* Fixes frame support test

* Fixes frame support test

* Split items other than storage

* Updates versions

* Fixes some review comments

* Addresses review comments

* ".git/.scripts/commands/fmt/fmt.sh"

* Updates docs

* Adds experimental disclaimer

* ".git/.scripts/commands/fmt/fmt.sh"

* Update frame/support/test/tests/split_ui/no_section_found.rs

Co-authored-by: Sam Johnson <sam@durosoft.com>

* Addresses review comments

* Fixes test

---------

Co-authored-by: command-bot <>
Co-authored-by: command-bot <ci@gitlab.parity.io>
Co-authored-by: Sam Johnson <sam@durosoft.com>
2023-06-27 12:12:03 +00:00
Davide Galassi 13cb7ccc57 Added missing BLS feature (#14461) 2023-06-26 19:10:16 +02:00
Michal Kucharczyk 9a5d9a586e GenesisBuilder runtime API (#14131)
* GenesisConfigBuilder: preliminary API proposal

* fmt

* comment removed

* build_default_config removed

* Update client/genesis-builder/src/lib.rs

* config -> gensis_config

* GenesisConfigBuilder: helper added

* moved to primitives

* licesne changed to apache-2.0

* Cargo.toml: name/path to genesis-builder updated

* helper removed

* sp-sd version bumped

* sp-std bump

* naming + new function

* fix

* build_from_patch_json -> build_with_patch

* fix

* Cargo.lock updated

* readme: license updated

* Update primitives/genesis-builder/src/lib.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update primitives/genesis-builder/src/lib.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update primitives/genesis-builder/Cargo.toml

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Cargo.lock updated

* removed redundant function

* GenesisConfigBuilder API: no_defaults function added

* Cargo.lock updated

* GenesisConfigBuilder API: patching fn removed

* trigger CI job

---------

Co-authored-by: parity-processbot <>
Co-authored-by: Davide Galassi <davxy@datawok.net>
2023-06-26 11:56:15 +00:00
Jeeyong Um 4d426214af Remove k256 crate from frame-support dependencies (#14452)
* Add test for to_eth_address

* Replace k256 with secp256k1

* Bump Cargo.lock

* Reformat
2023-06-25 21:40:03 +02:00
Sergej Sakac 15bd9e6fa7 try-runtime-cli: execute-block & create-snapshot tests (#14343)
* execute-block test

* test create-snapshot

* oops

* Update utils/frame/try-runtime/cli/tests/create_snapshot.rs

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>

* Update utils/frame/try-runtime/cli/tests/create_snapshot.rs

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>

* Update utils/frame/try-runtime/cli/tests/create_snapshot.rs

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>

* remove snapshot

* execute block: new log

* use prefix & make tempfile a dev dependencie

* Update utils/frame/try-runtime/cli/tests/execute_block.rs

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>

* Update utils/frame/try-runtime/cli/tests/create_snapshot.rs

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>

* ".git/.scripts/commands/fmt/fmt.sh"

* --at option in execute-block test

* fixes & use --at option in create-snapshot test

* hmm

* fmt

* remove nonsense

* Update utils/frame/try-runtime/cli/tests/create_snapshot.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update utils/frame/try-runtime/cli/tests/execute_block.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unnecessary test modules

* try to load snapshot file

* fix

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: command-bot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-06-24 09:36:15 +00:00
Squirrel 0750b03300 once_cell in std from 1.70 (#14402)
* once_cell now stable

* cargo fmt

---------

Co-authored-by: parity-processbot <>
2023-06-24 06:45:28 +00:00
Jegor Sidorenko be7c654c42 Pay tx fee with assets by using the asset conversion pallet (#14340)
* Pay tx by swapping the assets

* Change liquidity structure

* Uncomment the event

* Update frame/transaction-payment/asset-tx-payment/src/payment.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* New approach

* Fix bounds

* Clearer version

* Change IsType with Into and From

* Enable event

* Check ED + fix the logic

* Add temp comments

* Rework the refund

* Clean up

* Improve readability

* Getting closer

* fix

* Use fungible instead of Currency

* Test account without ed

* Final push

* Fixed

* Rename to pallet-asset-conversion-tx-payment

* Bring back the old pallet

* Update versions

* Update docs

* Update readme

* Wrong readme updated

* Revert back doc change

* Fix import

* Fix kitchensink

* Fix

* One more time..

* Wait pls

* Update frame/asset-conversion/src/lib.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* Update frame/support/src/traits/tokens/fungibles/regular.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update docs/comments

* Docs improvement

* Update frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Update frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Payed -> paid

* Docs

* Update frame/transaction-payment/asset-conversion-tx-payment/README.md

Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>

* Rewrite docs

* Try to clean the deps

* Add debug assert

* Return back frame-benchmarking

* Update cargo

* Update frame/transaction-payment/asset-conversion-tx-payment/src/mock.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Rename

* clearer error message

* Docs for Pay by Swap (#14445)

* docs

* better error name

* more comments

* more docs on swap trait

* Fix compile errors

* Another fix

* Refactoring

* Update frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Emit an error if we fail to swap the refund back

* Add integrity_test

* Update frame/asset-conversion/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fmt

* Use defensive_ok_or

* child PR: Tidy swap event (#14441)

* Dedup raising swap event

* use expect rather than unwrap

* Additional checks for future defence.

* cargo fmt

* Update frame/asset-conversion/src/lib.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

---------

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

---------

Co-authored-by: Squirrel <gilescope@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2023-06-23 19:17:52 +00:00
Branislav Kontur 3e2c73dfad Adds ability to prepare/initialize before running set_code benchmark (#14435)
* Adds ability to prepare/initialize before running `set_code` benchmark

* Fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev frame-system

* Replaced BenchmarkHelper with function

* Fix

* Introduced `set_code_data` for benchmark with default value

* ".git/.scripts/commands/bench/bench.sh" pallet dev frame-system

* (Hope) Final adjustment (because system parachains generates ValidationFunctionStored instead of CodeUpdated)

* ".git/.scripts/commands/bench/bench.sh" pallet dev frame-system

* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev frame-system

---------

Co-authored-by: command-bot <>
2023-06-23 12:02:13 +00:00
Dmitry Markin 7d4fd6a442 [minor] Extend logging with SetId in ProtocolController where missing (#14433) 2023-06-22 15:23:21 +03:00
Stefan 4abb6025e3 inspect role for nonfungibles_v2 (#14341)
* inspect role

* Update frame/nfts/src/impl_nonfungibles.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update frame/support/src/traits/tokens/nonfungibles_v2.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update as suggested

* Update frame/nfts/src/impl_nonfungibles.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update frame/nfts/src/impl_nonfungibles.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update frame/nfts/src/impl_nonfungibles.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

---------

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
2023-06-22 12:07:23 +00:00
klbrvik 1d2f16ab1f expose setting kademlia replication factor through node CLI (#14391)
* expose kademlia replication factor through node CLI

* set default CLI flag value for kademlia_replication_factor

Co-authored-by: Bastian Köcher <git@kchr.de>

* wrap CLI value as Option

* make kademlia replication factor non-optional

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
2023-06-22 00:21:54 +02:00
Sam Johnson e783d98437 suppress unused warning in kitchensink example (#14417)
* suppress unused warning in kitchensink example

* Adds test

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: Nikhil Gupta <17176722+gupnik@users.noreply.github.com>
Co-authored-by: command-bot <>
2023-06-22 00:13:50 +02:00
Liam Aharon 38cc4ad6aa fix(remote-externalities): child trie not loaded (#14365)
* fix remote-ext chlid keys

* sanity check test that child trie is loaded
2023-06-21 14:16:33 +00:00
Bastian Köcher 321a52bb27 Remove clippy workaround (#14424) 2023-06-21 12:06:09 +00:00
Koute 9d1741eb3c Bump parity-scale-codec to 3.6.1 (#14428) 2023-06-21 11:37:11 +00:00
Mira Ressel 13eaab00db ci: move back to paritytech/ci-linux:production image (#14422) 2023-06-20 16:43:36 +02:00
PG Herveou 6ac8537436 Update contract multi-block migration (#14313)
* move migrate sequence to config

* remove commented out code

* Update frame/contracts/src/lib.rs

Co-authored-by: PG Herveou <pgherveou@gmail.com>

* remove Migrations generic

* make runtime use noop migrations

* restrict is_upgrade_supported

* Update contract multi-block migration

Ensure that we do as many steps as possible given the weight limit passed to on_idle

* undo is_upgrade_supported change

* Update bin/node/runtime/src/lib.rs

Co-authored-by: PG Herveou <pgherveou@gmail.com>

* wip

* fix comment (#14316)

* fix test

* fix

* Update frame/contracts/src/migration.rs

Co-authored-by: Juan <juangirini@gmail.com>

* fix test doc

* Apply suggestions from code review

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* Fix compilation with feature runtime-benchmarks

* fix example

* fix  cargo doc --document-private-items

* private links

* Remove dup comment

* add doc for MigrationInProgress

* PR review remove duplicate asserts

* simplify upper bound

* fix link

* typo

* typo

* no unwrap()

* correct log message

* missing

* fix typo

* PR comment

* Add example with single element tuple

* Improve migration message

* Update frame/contracts/src/benchmarking/mod.rs

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* Update frame/contracts/src/migration.rs

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* Update frame/contracts/src/migration.rs

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* use saturating_accrue instead of +=

* add more doc

* Contracts: Better migration types (#14418)

* Add explicit error, if try-runtime runs a noop migration

* use mut remaining_weight

---------

Co-authored-by: Juan Girini <juangirini@gmail.com>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
2023-06-20 13:16:28 +00:00