Commit Graph

5596 Commits

Author SHA1 Message Date
Alexander Theißen e01ac8cea0 contracts: Allow contracts to dispatch calls into the runtime (#9276)
* contracts: Allow contracts to dispatch calls into the runtime

* Fix RPC tests

* Fix typo

* Replace () by AllowAllFilter and DenyAllFilter

* Add rust doc

* Fixup for `()` removal

* Fix lowest gas calculation

* Rename AllowAllFilter and DenyAllFilter

* Updated changelog
2021-07-12 20:40:27 +00:00
Seun Lanlege 2f31602896 Update test-runner api (#9302)
* better apis

* ....

* ...

* Genensis -> UnimportedGenesis

* adds rpc for runtime upgrades

* simplify test-runner

* clean up test-runner api

* remove unused imports

* fix doc-test

* fix line width

* correct Node::clean

* correct Node::clean

* add deny rules

* remove unused extern crates

* remove mutex from node

* Update test-utils/test-runner/Cargo.toml

Co-authored-by: Andronik Ordian <write@reusable.software>

* adds docs, removes Node::clean

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: Seun Lanlege <seun@parity.io>
2021-07-12 16:56:12 +01:00
Kian Paimani 47b7edde68 Store election snapshot in a more memory-friendly way. (#9275)
* Store election snapshot in a more memory-friendly way.

* fix

* re-order benchmarks

* Update frame/election-provider-multi-phase/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* manually fix the weights

* remove todo

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Parity Bot <admin@parity.io>
2021-07-12 14:35:57 +00:00
Guillaume Thiolliere 4856b6fcf4 Remove impl_outer_ macros (#9307)
* remove impl_outer_*

* continue to reexport some unsigned in order not to break users
2021-07-12 08:50:50 +00:00
Benjamin Kampmann c78c2892a4 Attempting to fix publishing (#9140)
* mark template and utils as non-publish

* switch to development version for testing

* activate unleash check

* maybe if I disable all rules...

* Fix isolated compilation of `max-encoded-len-derive` with `syn`

error[E0369]: binary operation `==` cannot be applied to type `syn::Path`
  --> src/lib.rs:88:29
   |
88 |             .filter(|attr| attr.path == parse_quote!(max_encoded_len_crate))
   |                            --------- ^^ ----------------------------------- _
   |                            |
   |                            syn::Path

error: aborting due to previous error

For more information about this error, try `rustc --explain E0369`.
Error: could not compile `max-encoded-len-derive`

* WIP: bump changes crates since v3 tag to next breaking

cargo unleash version bump-breaking --changed-since v3.0.0
cargo unleash version set-pre dev --changed-since v3.0.0

FIXME: Don't modify crates that are not yet released, e.g.
`max-encoded-len-derive`

* Update lockfile

* WIP: Bump sp-transaction-pool as well

* WIP: Bump sp-offchain as well

* WIP: Bump frame-system-rpc-runtime-api as well

* WIP: Bump sp-authority-discovery as well

* Manually deactivate dev-deps before `cargo unleash check`

Otherwise we run into `Cycle detected` error.

* Bump sp-consensus-slots

* Add missing Cargo.lock change

* Bump sp-consensus-vrf as well

* Bump sp-keyring as well

* Bump sp-consensus-pow as well

* Try to speed up the `unleash-check` job

Previously, the job took 106 minutes - let's see if explicitly
specifying a `CARGO_TARGET_DIR` will help

* fixup: Ensure the temp target dir exists for unleash check

* Bump pallet-transaction-payment-rpc-runtime-api as well

Needed for Polkadot

* Bump pallet-transaction-payment-rpc as well

Needed for Polkadot

* Try updating crates after patching in the Polkadot CI job

* Use another approach to update patched Substrate crates

* Try to update all sp-core versions in Polkadot CI job

* Simplify sp-core version checking

* Apply another shellcheck lint

* Just do the simplest thing I guess

* Welp don't do --offline then

* Clean up `unleash-check` job triggers

Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>

* Fix a note in unleash-check cache step

* Add a note about temporary optimization in cargo-unleash

* Pin a newer version of cargo-unleash

Co-authored-by: Igor Matuszewski <xanewok@gmail.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
2021-07-11 12:17:53 +00:00
Kian Paimani 3850a43323 Make election benchmarks more *memory-aware* (#9286)
* Make benchmarks a bit better with mem

* Make election benchmarks more *memory-aware*

* Fix a few errors

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Manually fix the weights

* Update lock file

* remove dupe

* Fix tests

* cargo update pwasm

Co-authored-by: Parity Bot <admin@parity.io>
2021-07-09 19:55:31 +00:00
Peter Goodspeed-Niklaus 9fc86cb55f make submit_unsigned into DispatchClass::Operational (#9309)
Closes #8511.
2021-07-08 17:04:38 +00:00
Seun Lanlege 2ae9d36758 sc-transcation-pool refactor (#9228)
* Use TransactionPool trait

* sc-transaction-pool-primitives

* sc-transaction-pool-api

* TP

* bye sc_transaction_graph

* fix line widths

* fix import errors

* fix import errors

* fix import errors 🤦🏾‍♂️

* fix import errors 🤦🏾‍♂️🤦🏾‍♂️🤦🏾‍♂️

* remove sp-keyring
2021-07-08 13:33:34 +00:00
Keith Yeung 721a3b9e9c Ensure data size of identity pallet is bounded (#9168)
* Ensure data size of identity pallet is bounded

* Fix unit tests for identity pallet

* Move identity pallet custom types into its own module

* Make use of NoBound family traits

* Fix identity pallet benchmarks

* Enumerate type imports

* Properly convert to BoundedVec in benchmarks

* Re-export types

* Use BoundedVec when storing sub identities

* Add generate_storage_info

* Manually implement MaxEncodedLen on select types

* Use ConstU32 instead of parameter_type

* Leverage DefaultNoBound and add some comments

* Use max_encoded_len() instead of hardcoded constant

* Use MaxEncodedLen in parity-scal-codec

* Add get_mut method for WeakBoundedVec

* Use expect on an infallible operation

* Rewrite as for loop
2021-07-08 02:57:26 +00:00
Shawn Tabrizi b42b8fc5fb Include StorageInfo in Benchmarking Pipeline (#9090)
* extend storageinfo

* extend_storage_info

* use vec

* add storage info to pipeline

* get read and written keys

* undo storageinfo move

* refactor keytracker

* return read / write count

* playing with key matching

* add basic `StorageInfo` constructor

* add whitelisted to returned info

* fix some test stuff

* pipe comments into benchmark data

* add_storage_comments

* add comments to template

* track only storage prefix

* Update frame/benchmarking/src/lib.rs

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix test

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* remove test logs

* add temp benchmark script

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* remove keytracker and use trackedstoragekey

* add comment for unknown keys

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/timestamp/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* remove duplicate comments with unknown keys

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/timestamp/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* refactor bench tracker, and fix results

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix child tries in new tracker

* extra newline

* fix unused warning

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/timestamp/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix master merge

* storage info usage refactor

* remove now unused

* fix refactor

* use a vec for prefix

* fix tests

* also update writer to use vec

* disable read and written keys for now

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/system/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Update frame/system/src/weights.rs

* fix test

* Delete weights.rs

* reset weights

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-07-07 22:06:06 +00:00
Benjamin Kampmann e0ad91ed95 Update stale.yml (#9305) 2021-07-07 23:42:33 +02:00
Benjamin Kampmann d154b477ef Activate stale bot (#9272) 2021-07-07 14:33:38 +02:00
Bastian Köcher 86ab838b17 Keep current block randomness in state (#9294)
* Keep current block randomness in state

Instead of killing it at the end of the block, it stays in the block for
inspection. This is required by parachains to get access to this
randomness of the relay chain.

* Fix tests
2021-07-07 11:44:05 +00:00
Bastian Köcher 7bbf949296 Clean up sc-allocator (#9295) 2021-07-07 13:11:31 +02:00
Sergei Shulepov f388b66ab5 PVF: NaN canonicalization & deteriministic stack (#9069)
* NaN canonicalization

* Introduce a simple stack depth metering

* Be explicit about the wasm features we enable

* Pull the latest latast fix for the pwasm-utils crate

* Disable `wasm_threads` as well.

* Factor out deterministic stack params

* Add more docs

* Remove redundant dep

* Refine comments

* Typo

Co-authored-by: Andronik Ordian <write@reusable.software>

Co-authored-by: Andronik Ordian <write@reusable.software>
2021-07-07 08:29:39 +00:00
cheme d80e1bc978 Paged keys rpc for child storage. (#9100)
* childstate_getKeysPaged rpc

* Rename `v` to `iter`.

* Update client/api/src/backend.rs

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>

* Update client/api/src/backend.rs

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
2021-07-07 07:22:13 +00:00
Xiliang Chen fc1199b6a1 move BlockNumberProvider (#9209)
* move BlockNumberProvider

* Update primitives/runtime/src/traits.rs

* Update primitives/runtime/src/traits.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-07-07 06:25:00 +00:00
Kian Paimani 9cd04f3559 Allow the allocator to track the heap changes. (#9291)
* Allow the allocator to track the heap changes.

* fix build

* review comments

* Update client/allocator/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/allocator/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-07-07 05:32:57 +00:00
Kian Paimani fb9baeb70b clean up staking docs, remove EraElectionStatus references (#9287) 2021-07-07 07:31:20 +02:00
Yang Zhou bdfb038dc6 add heiko, parallel to ss58 registry (#9254) 2021-07-06 20:21:45 +02:00
Squirrel 4f5d3b334e Docs only changes (#9258)
* Docs changes to improve clarity

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-07-06 18:05:10 +01:00
Guillaume Thiolliere d969da8aa5 fix link (#9289) 2021-07-06 14:14:30 +00:00
Shinsaku Ashizawa e581e6aff3 change reference module to pallet (#9281)
* change reference module to pallet

* fix inner doc

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
2021-07-06 13:56:37 +00:00
André Silva 0b4f87fbbe build: fix nix shell (#9288)
* build: fix deprecated stdenv.lib in nix shell

* build: fix libclang_path in nix shell

* build: update rust toolchain in nix shell
2021-07-06 11:06:11 +00:00
Bastian Köcher f781dcaf2c Add function for embedding the runtime version in a wasm blob (#9277)
* Add function for embedding the runtime version in a wasm blob

This function can be used to add the custom section to a wasm blob with
the runtime version in it.

* Review nitpick
2021-07-06 10:41:27 +00:00
Leonardo Custodio 279ff4b6e6 Removed score and compute from set_emergency_election_result (#9271)
* Removed score and compute from set_emergency_election_result

* Supports type incorrectly set to A

* Typo
2021-07-06 12:04:40 +02:00
Arkadiy Paronyan e755577c3f Remove debug assertion (#9283) 2021-07-06 09:51:20 +00:00
Shawn Tabrizi 201a41be34 fix staking version in genesis (#9280) 2021-07-06 06:08:31 +00:00
Guillaume Thiolliere 3127eac4d7 fix storage info for decl_storage (#9274) 2021-07-06 01:58:24 +00:00
ferrell-code db8dc5420b Authority_discovery: expose assimilate_storage with GenesisBuild (#9279)
* use genesis build

* format
2021-07-05 23:40:45 +02:00
Nikolay Volf c56bf5060d Update CODEOWNERS (#9278) 2021-07-05 21:25:40 +00:00
Igor Matuszewski eb6d651f9c Remove in-tree max-encoded-len and use the new SCALE codec crate instead (#9163)
* Update impl-codec to use new upstream MaxEncodedLen trait

* Adapt crates to use the updated codec crate for `MaxEncodedLen`

* Remove max-encoded-len crate altogether

* Fix test compilation in `pallet-proxy`

* reorganize import (#9186)

* Fix remaining `MaxEncodedLen` imports

* Fix remaining old usages of max-encoded-len crate

* Fix UI test

* Manually depend on new impl-codec to fix Polkadot companion build

* Use newly released primitive-types v0.9.1 that has new codec impls

* Make sure codec deps are up-to-date in crates that use them

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-07-05 20:37:24 +00:00
Andronik Ordian b61dd3e8c5 bump a bunch of deps in parity-common (#9263)
* bump a bunch of deps in parity-common

* primitive-types 0.10.0

* update Cargo.lock

* downgrade a few more

* this is unlikely to help

* try something

* Checkmate, Atheists!
2021-07-05 18:37:19 +00:00
Trevor Arjeski e7e55475f2 Bump linregress due to security vulnerability (#9262)
https://rustsec.org/advisories/RUSTSEC-2021-0070
2021-07-05 13:47:18 +02:00
Guillaume Thiolliere f96c5df754 pallet macro: always generate storage info on pallet struct (#9246)
* always implement storage info on Pallet

* fix UI test

* Fold span computation into trait and method computation

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
2021-07-05 11:23:43 +00:00
Squirrel f93074d086 Less duplication in test code (#9270)
* Less duplication

* Const

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* less comments

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-07-05 12:59:39 +02:00
Zeke Mostov c1ac36aa69 Add Chilled event to staking chill extrinsics (#9250)
* Add `Chilled` event to staking chill extrinsics

* Update do_remove_{nom, val} doc comments

* Not working: trying to match on event

* Account for chilled event in offences benchmarking

* trigger ci

* correct
2021-07-05 04:39:49 +00:00
George Angelopoulos 3c701ae1ea fix prometheus log message terminology (#9256)
A prometheus "server" typically refers to the prometheus process running
on a central server which connects to various prometheus "exporters" and
collects metrics. What is implemented here in substrate is a prometheus
exporter.

This patch fixes the associated log message to avoid confusion for new
users.
2021-07-02 15:31:02 +02:00
radupopa2010 113ffcae52 add simnet tests (#9222)
* add simnet tests

* add link to bracap presentation of simnet

* add link to bracap presentation of simnet

* rm not needed file
2021-07-02 12:48:14 +02:00
Alexander Popiak c30ece2bd8 Implement InspectEnumerable for Uniques (#9117)
* implement InspectEnumerable in pallet_uniques

* use `iter_keys` and `iter_key_prefix`

* return an iterator instead of constructing a vec

* update comments

* additional warning about storage reads

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-07-01 21:34:17 +00:00
Keith Yeung ae3c3045df Implement iter_keys function for all types of storage maps (#9238)
* Implement `iter_keys` function for all types of storage maps

* Remove draining iterator API

* Rename associated key iterator types

* Simplify iteration code

* add test for `iter_keys().drain()`

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-07-01 17:20:15 +00:00
Bastian Köcher d489bd70b5 Do not call initialize_block before any runtime api (#8953)
* Do not call `initialize_block` before any runtime api

Before this change we always called `initialize_block` before calling
into the runtime. There was already support with `skip_initialize` to skip
the initialization. Almost no runtime_api requires that
`initialize_block` is called before. Actually this only leads to higher
execution times most of the time, because all runtime modules are
initialized and this is especially expensive when the block contained a
runtime upgrade.

TLDR: Do not call `initialize_block` before calling a runtime api.

* Change `validate_transaction` interface

* Fix rpc test

* Fixes and comments

* Some docs
2021-07-01 15:50:42 +00:00
Kian Paimani 73a6e3effc Display Reward amount (#9245)
* name reward amount

* Fix
2021-07-01 11:50:24 +02:00
Liu-Cheng Xu ff4b9c0d72 Enable colored help in CLI (#9244)
Since it's already there, why not give it a chance :P
2021-07-01 07:12:07 +00:00
Kian Paimani 54ace9cff8 Make a few things for staking miner (#9241) 2021-06-30 20:46:28 +00:00
Zeke Mostov e0df101b44 pallet-vesting: Move tests module and create mock module (#9234)
* pallet-vesting: Move `tests` module to seperate file

* Move mock to own file

* add copyright header appache-2.0

* fix mock import paths in benchmark test macro
2021-06-30 13:02:09 +00:00
Squirrel d7804c0929 Move client only primitives to another dir (#9220)
* Move alloc primitive (not used in /pallets)

* Move to alternative location as not shared

* moved crates to different dir

* ren sp_chain_spec to sc_chain_spec_primatives

* merged sc-chain-spec and moved allocation up one.

* no no_std

* nudge

* Bump CI
2021-06-30 12:06:39 +02:00
Miguel Hervas b707a48737 Prep for Altair - Add ss58 prefix (#9123)
* Prep for Altair - Add ss58 prefix

* fix indent

* fix indent
2021-06-30 10:00:14 +00:00
Ashley 361d02f92d Remove txpool as an export of sc_transaction_pool, exporting the used components instead. (#9217)
* Remove `txpool` as an export of `sc_transaction_pool`, exporting the used components instead.

* Fix tests
2021-06-29 08:23:39 +00:00
Shinsaku Ashizawa 8ebe99c8f5 change reference trait to config (#9224) 2021-06-29 09:26:27 +02:00