Commit Graph

1224 Commits

Author SHA1 Message Date
Xiliang Chen cd3e3043b0 Add VoteLocking config (#9641)
* Add VoteLocking config

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
2021-09-02 19:53:57 +01:00
Guillaume Thiolliere 1309adf247 remove unused origin (#9679) 2021-09-02 15:14:41 +00:00
Keith Yeung 886825a5c0 Generate storage info for aura pallet (#9371)
* Generate storage info for aura pallet

* Add MaxAuthorities to node-template aura pallet config

* Fix compilation errors on node-template

* Use WeakBoundedVec instead of BoundedVec

* Improve comment on BoundedSlice's EncodeLike impl

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

* Bump MaxAuthorities count to 32 for node template

* cargo fmt

* cargo fmt

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-09-02 01:24:08 +00:00
Alexander Theißen 9da28d87c4 Fix compilation issue of pallet_contracts (#9652) 2021-08-31 04:11:50 +00:00
Georges ac2468c47b Generate storage info for pallet authority_discovery (#9428)
* Migrate Aura pallet to BoundedVec

Implementing issue #8629

* Fixed aura tests after BoundedVec change

* Moved Vec to BoundedVec in authority-discovery

* Merging into the main branch

* Added MaxEncodedLen to crypto

Need this without full_crypto to be able to add generate_store_info

* Add generate_store_info for aura

* Adding changes to Slot to add MaxEncodedLen

* Adding generate_store_info to authority discovery

* fmt

* removing panics in runtime if vec size too large

* authority-discovery: Remove panics in runtime
Can happen if vec size is too large, so truncate the vec in that case

* Adding logging when I truncate Vecs

* Got the sign the other way around

* Reverting pallet_aura changes
This is already being addressed by PR #9371

* Change BoundedVec to WeakBoundedVec

More robust implementation following @thiolliere recommendation.

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-08-30 06:11:59 +00:00
Joshy Orndorff bc47cfeefb remove crate visibility limitation (#9565) 2021-08-26 16:24:14 +00:00
Shawn Tabrizi 2c91f3a464 Make System Events Private from the Runtime (#9619)
* make events private

* "i know what i am doing"

* feedback
2021-08-26 13:55:41 +00:00
Guillaume Thiolliere 0f1896e7a2 improve doc of pallet macro (#9625)
* improve doc

* fmt
2021-08-26 01:14:09 +00:00
Shawn Tabrizi 7c3890c652 Expose storage_prefix logic, and remove duplicate code (#9621)
* expose storage prefix generation, remove duplicate code

* remove more duplicate code

* clean up import

* fix io test

* remove slicing

* Update frame/support/src/storage/mod.rs

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

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-08-25 19:16:47 +00:00
Alexander Theißen 531fd70e22 Remove dependency on sandboxing host functions (#9592)
* Embed wasmi into the runtime

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

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
2021-08-25 11:37:15 +00:00
Shaun Wang a7e714aeb1 pallet-proxy: emit events on proxy added. (#9546)
* pallet-proxy: emit events on proxy added.

* Apply review suggestions.
2021-08-25 10:27:56 +00:00
Gavin Wood 84452e8c60 Fix spelling (#9614) 2021-08-24 10:37:14 +02:00
Zeke Mostov ede36408a9 pallet-vesting: Support multiple, merge-able vesting schedules (#9202)
* Support multiple, mergable vesting schedules

* Update node runtime

* Remove some TODO design questions and put them as commennts

* Update frame/vesting/src/benchmarking.rs

* Syntax and comment clean up

* Create filter enum for removing schedules

* Dry vesting calls with do_vest

* Improve old benchmarks to account for max schedules

* Update WeightInfo trait and make dummy fns

* Add merge_schedule weights

* Explicitly test multiple vesting scheudles

* Make new vesting tests more more clear

* Apply suggestions from code review

* Update remove_vesting_schedule to error with no index

* Try reduce spacing diff

* Apply suggestions from code review

* Use get on vesting for bounds check; check origin first

* No filter tuple; various simplifications

* unwrap or default when getting user schedules

* spaces be gone

* ReadMe fixes

* Update frame/vesting/src/lib.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* address some comments for docs

* merge sched docs

* Apply suggestions from code review

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* log error when trying to push to vesting vec

* use let Some, not is_some

* remove_vesting_schedule u32, not optin

* new not try_new, create validate builder; VestingInfo

* Merge prep: break out tests and mock

* Add files forgot to include in merge

* revert some accidental changes to merged files

* Revert remaining accidental file changes

* More revert of accidental file change

* Try to reduce diff on tests

* namespace Vesting; check key when key should not exist;

* ending_block throws error on per_block of 0

* Try improve merge vesting info comment

* Update frame/vesting/src/lib.rs

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

* add validate + correct; handle duration > blocknumber

* Move vesting_info module to its own file

* Seperate Vesting/locks updates from writing

* Add can_add_vesting schedule

* Adjust min vested transfer to be greater than all ED

* Initial integrity test impl

* merge_finished_and_yet_to_be_started_schedules

* Make sure to assert storage items are cleaned up

* Migration initial impl (not tested)

* Correct try-runtime hooks

* Apply suggestions from code review

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* header

* WIP: improve benchmarks

* Benchmarking working

* benchmarking: step over max schedules

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

* Simplify APIs by accepting vec; convert to bounded on write

* Test:  build_genesis_has_storage_version_v1

* Test more error cases

* Hack to get polkadot weights to work; should revert later

* Improve benchmarking; works on polkadot

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

* WIP override storage

* Set storage not working example

* Remove unused tests

* VestingInfo: make public, derive MaxEndcodedLen

* Rename ending_block to ending_block_as_balance

* Superificial improvements

* Check for end block infinite, not just duration

* More superficial update

* Update tests

* Test vest with multi schedule

* Don't use half max balance in benchmarks

* Use debug_assert when locked is unexpected 0

* Implement exec_action

* Simplify per_block calc in vesting_info

* VestingInfo.validate in add_vesting_schedule & can_add_vesting_schedule

* Simplify post migrate check

* Remove merge event

* Minor benchmarking updates

* Remove VestingInfo.correct

* per_block accesor max with 1

* Improve comment

* Remoe debug

* Fix add schedule comment

* Apply suggestions from code review

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* no ref for should_remove param

* Remove unused vestingaction derive

* Asserts to show balance unlock in merge benchmark

* Remove unused imports

* trivial

* Fix benchmark asserts to handle non-multiple of 20 locked

* Add generate_storage_info

* migration :facepalm

* Remove per_block 0 logic

* Update frame/vesting/src/lib.rs

* Do not check for ending later than greatest block

* Apply suggestions from code review

* Benchmarks: simplify vesting schedule creation

* Add log back for migration

* Add note in ext docs explaining that all schedules will vest

* Make integrity test work

* Improve integrity test

* Remove unnescary type param from VestingInfo::new

* Remove unnescary resut for ending_block_as_balance

* Remove T param from ending_block_as_balance

* Reduce visibility of raw_per_block

* Remove unused type param for validate

* update old comment

* Make log a dep; log warn in migrate

* VestingInfo.validate returns Err(()), no T type param

* Try improve report_schedule_updates

* is_valid, not validate

* revert node runtime reorg;

* change schedule validity check to just warning

* Simplify merge_vesting_info return type

* Apply suggestions from code review

* Apply suggestions from code review

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

* Add warning for migration

* Fix indentation

* Delete duplicate warnings

* Reduce diff in node runtime

* Fix benchmark build

* Upgrade cargo.toml to use 4.0.0-dev

* Cleanup

* MaxVestingSchedulesGetter initial impl

* MinVestedTransfer getter inintial impl

* Test MaxVestingSchedules & MinVestedTransfer getters; use getters in benchmarks

* Run cargo fmt

* Revert MinVestedTransfer & MaxVestingSchedules getters; Add integrity test

* Make MAX_VESTING_SCHEDULES a const

* fmt

* WIP: benchmark improvements

* Finish benchmark update

* Add test for transfer to account with less than ed

* Rm min_new_account_transfer; move sp-io to dev-dep

* Reduce cargo.toml diff

* Explain MAX_VESTING_SCHEDULES choice

* Fix after merge

* Try fix CI complaints

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

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

* fmt

* trigger

* fmt

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
2021-08-24 00:15:27 +00:00
dependabot[bot] 13d2adc78e Bump bitflags from 1.2.1 to 1.3.2 (#9568)
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.2.1...1.3.2)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-19 18:13:05 +00:00
Wei Tang b5b2abc736 Do not implement () for Contains (#9582) 2021-08-19 17:57:59 +00:00
Shawn Tabrizi ccfe485b91 Custom Benchmark Errors and Override (#9517)
* initial idea

* update benchmark test to frame v2

* fix some errors

* fixes for elec phrag

* fix tests

* update extrinsic time and docs

* fix import

* undo extra changes

* helper function

* wrong way

* Update frame/benchmarking/src/utils.rs

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

* doesnt need encode/decode

* fix benchmark return

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-08-19 12:34:56 +00:00
Kian Paimani 7a32c3504d remove the uselsss weight return type from election provider API (#9569)
* remove the uselsss weight return type from election provider API

* fix everything, should be ready for final benchmark

* simplify on_init a bit furhter

* cargo run --quiet --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

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

* remove unwraps

* fmt

* Update lock file

* whitelist block weight

* cargo run --quiet --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

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

* fix warning

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
2021-08-19 07:45:54 +00:00
Squirrel 7e9b8d278e depend-o-pocalipse (#9450)
Remove unneeded dependencies and dev-dependencies.
Made self_destruct test not dependent on wasm bin size.  
Updated code related to deprecated warning on tracing-subscriber `scope()` 
( See https://github.com/tokio-rs/tracing/issues/1429 )
2021-08-13 15:18:37 +01:00
dependabot[bot] 76504e56d7 Bump env_logger from 0.8.3 to 0.9.0 (#9538)
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.8.3 to 0.9.0.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.3...v0.9.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-13 11:48:51 +00:00
Bastian Köcher c44aba89e6 Upgrade jsonrpc to 0.18.0 (#9547)
* Upgrade jsonrpc to 0.18.0

I think this says all :P

* 🤦

* Fmt etc

* Fix tests

* Fix tests again...

* Better impl

* Revert "Tell dependabot to ignore jsonrpc-* updates (#9518)"

This reverts commit 6e0cd5587d.
2021-08-13 06:46:07 +00:00
Alexander Theißen 199b2883af Stabilize seal_debug_message (#9550)
* Stableize `seal_debug_message`

* Update changelog

* Enable more tests

* Cargo fmt
2021-08-12 20:40:11 +00:00
Amar Singh c4446f62ae fix rust docs for remove storage prefix and take storage item (#9544) 2021-08-12 06:51:31 +02:00
Kian Paimani f7bcbdd261 Multi-Block Election part 0: preparation and some cleanup. (#9442)
* Partially applied

* Everything builds, need to implement compact encoding as well.

* Fix some tests, add a ui test as well.

* Fix everything and everything.

* small nits

* a bunch more rename

* more reorg

* more reorg

* last nit of self-review

* Seemingly fixed the build now

* Fix build

* make it work again

* Update primitives/npos-elections/solution-type/src/lib.rs

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

* Update primitives/npos-elections/solution-type/src/lib.rs

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

* nits

* factor out double type

* fix try-build

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-08-11 15:45:53 +00:00
Kian Paimani abd08e29ce Rewrap all comments to 100 line width (#9490)
* reformat everything again

* manual formatting

* last manual fix

* Fix build
2021-08-11 14:56:55 +00:00
Kian Paimani 8180c58700 mega cleanup of staking tests (#9516)
* general cleanup of staking tests

* fix fishy test

* fix one more fishy test

* some review comments
2021-08-11 13:34:03 +00:00
Ashley 1d27783738 Consistently use I::from(Self::get()) in parameter_types! (#9526) 2021-08-09 14:24:24 +00:00
Zeke Mostov 4dc8db2b80 Fix staking rebond weight refund (#9508)
* Fix staking `rebond` weight refund


Comment

* use safe arithmetic

* comment
2021-08-09 11:59:00 +00:00
Gavin Wood bdda3ed612 Remove Filter and use Contains instead (#9514)
* Remove Filter and use Contains instead

* Fixes

* Formatting

* Update docs/Upgrading-2.0-to-3.0.md

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

* Typo

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-08-07 19:26:40 +00:00
Shawn Tabrizi 0489c1768c FRAME Weights with Storage Metadata (#9471)
* weights with metadata

* fix

* fix contract test

* skip metadata tag

* special handling for `frame_system`

* cargo run --quiet --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

* add skip metadata to contracts

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

* fix contract test

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

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

* expose component information

* fix test generation

* refactor list benchmarks

* move component selection out of runtime

* add benchmark verification

* missing feature

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

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

* add internal repeats

* update weights with internal repeats

* fix warning

* return error with pov

* try without tracking

* Revert "return error with pov"

This reverts commit 44c36cbbd3c6818f36f377e3e291f1df156e40f7.

* Revert "try without tracking"

This reverts commit f401c44aebff2232389d8d307b20924891e5d77d.

* Revert "Revert "try without tracking""

This reverts commit 4b4e05929802ad3e8154e107359447634e5fb21b.

* state without tracking

* fix build

* temp test

* split db and timing benchmarks

* extend db results?

* default repeat is internal

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

* fix warning

* bump linked hash map

* use linked hash map for storage tracker

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

* remove conflicting short command

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

* missed one linked hashmap

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

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

* cargo run --quiet --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

* new weights with latest changes

* Update frame/benchmarking/src/utils.rs

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
2021-08-07 16:05:12 +00:00
Guillaume Thiolliere 38db14089b Improve call, and usage in pallet utility (#9418)
* WIP

* WIP

* WIP

* add some tests and limit

* remove wip test

* fmt

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

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

* fmt

* use primitives allocation limit

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-08-07 09:34:25 +00:00
Amar Singh 27d4177f93 fix private event enum error message (#9506) 2021-08-06 08:37:48 +00:00
Arkadiy Paronyan 52b0a4845f Storage chain fixes + guide (#9504)
* Transaction storage guide and fixes

* Apply suggestions from code review

Co-authored-by: Bruno Škvorc <bruno@skvorc.me>

* Update frame/transaction-storage/README.md

Co-authored-by: Bruno Škvorc <bruno@skvorc.me>

* Extended example

Co-authored-by: Bruno Škvorc <bruno@skvorc.me>
2021-08-05 12:07:23 +00:00
Amar Singh 43edf2d9ad done (#9494) 2021-08-05 10:55:18 +02:00
Amar Singh 9ced906450 remove unused events and errors in democracy (#9502) 2021-08-05 08:22:51 +00:00
Guillaume Thiolliere 8f388559a1 Fix benchmarking macro for pallet with instance and where clause (#9485)
* fix benchmarking instance with where clause

* fmt

* add tests

* remove unused import

* fix tests

* doc
2021-08-04 08:45:56 +00:00
Squirrel 6bd726bc6b crate missing dependency when compiled on its own with std (#9487)
* Everything else in frame compiles in std.

This doesn't on its own as it needs Debug and that's
in the extra-traits syn feature.

* Incorporating feedback
2021-08-03 18:57:03 +00:00
André Silva 0240efde58 aura, babe: don't allow disabled validators to build blocks (#9414)
* frame-support: add trait for checking disabled validators

* pallet-session: implement DisabledValidators trait

* pallet-babe: check for disabled validators

* pallet-babe: add test for disabled validators

* pallet-aura: check for disabled validators

* pallet-aura: add test for disabled validators

* runtime: fix missing DisableValidator

* test-runtime: add missing DisabledValidators

* frame-support: clean up doc

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

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-08-03 10:57:08 +00:00
Shawn Tabrizi fa8c6274ac Refactor Benchmarks for Less Wasm Memory Usage (#9373)
* extract repeat out of benchmark

* remove r

* unused

* cargo run --quiet --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

* cargo run --quiet --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

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

* use linked map to keep order

* cargo run --quiet --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

* Delete pallet_balances.rs

* Delete out

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

* steps and repeat to tuple (current_*, total_*)

* idea for list command

* fmt

* use benchmark list in cli

* handle steps in cli

* move log update to cli

* fmt

* remove old todo

* line width

* cargo run --quiet --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

* benchmark metadata function

* don't need this warm up

* cargo run --quiet --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 warnings

* fix node-template

* fix

* fmt

* line width

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

* improve docs

* improve cli

* fix format

* fix bug?

* Revert "fix bug?"

This reverts commit 8051bf1bf9bae862ff28dfff386e7045cd3f045e.

* skip frame-metadata

* extract repeat out of benchmark

* remove r

* cargo run --quiet --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

* cargo run --quiet --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

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

* use linked map to keep order

* cargo run --quiet --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

* Delete pallet_balances.rs

* Delete out

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

* steps and repeat to tuple (current_*, total_*)

* idea for list command

* fmt

* use benchmark list in cli

* handle steps in cli

* move log update to cli

* remove old todo

* line width

* cargo run --quiet --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

* benchmark metadata function

* don't need this warm up

* cargo run --quiet --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 warnings

* fix node-template

* fix

* fmt

* line width

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

* improve docs

* improve cli

* fix format

* fix bug?

* Revert "fix bug?"

This reverts commit 8051bf1bf9bae862ff28dfff386e7045cd3f045e.

* skip frame-metadata

* Update .gitlab-ci.yml

* fix import

* Update .gitlab-ci.yml

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
2021-08-01 18:13:58 +00:00
Squirrel df59596ec0 Move client consensus parts out of primitives and into client/consensus/api (#9319)
* moved client code out of primitives

* bump ci

* Fixup from merge.

* Removed unused deps thanks to review feedback

* Removing unneeded deps

* updating lock file

* note about rustfmt

* fixed typo to bump ci

* Move lonely CacheKeyId to parent

* cargo fmt

* updating import style

* Update docs/STYLE_GUIDE.md

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
2021-07-30 13:27:17 +00:00
Gavin Wood 8a44bec2dc Add some important events to batch & staking to ensure ease of analysis (#9462)
* Add some important events to batch & staking to ensure ease of analysis

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* Update lib.rs

* fix test

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-07-29 20:02:28 +00:00
Dan Forbes 76611ba6a3 Add nonfungibles::Create Trait & Implement for Uniques (#9438)
* Add nonfungibles::Create Trait & Implement for Uniques

Closes #9419

* Formatting

* Remove default implementation (`TokenError::Unsupported`) from `Create` trait

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

* Formatting

* Do not wrap parameters in Options

* Formatting

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-07-28 13:39:04 +00:00
Alex Pozhylenkov a8e5744985 Round robin on_idle execution (#9432)
* update on_idle tuple implemenration

* add test

* fix

* fix fmt

* update

* update

* fix fmt

* Update frame/support/src/traits/hooks.rs

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

* update

* update

* fix pallet_ui tests

* Update frame/support/src/traits/hooks.rs

* fix

* Update frame/support/src/traits/hooks.rs

* update

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-07-28 13:22:45 +02:00
dependabot[bot] 79052e281a Bump proc-macro2 from 1.0.26 to 1.0.28 (#9451)
Bumps [proc-macro2](https://github.com/alexcrichton/proc-macro2) from 1.0.26 to 1.0.28.
- [Release notes](https://github.com/alexcrichton/proc-macro2/releases)
- [Commits](https://github.com/alexcrichton/proc-macro2/compare/1.0.26...1.0.28)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-28 09:43:58 +00:00
Zeke Mostov c5be63ce6d pallet-staking: Reorg migration, pallet and pallet impls (#9410)
* Reorg migration and pallet and pallet impls

* Fix imports in untouched modules

* Add file headers

* Add header for migrations

* Improve comment

* Move OnOffenceHandler impl for Pallet to impl.rs

* fmt
2021-07-27 23:23:01 +00:00
Bastian Köcher 4fe55f0bcb Move PalletVersion away from the crate version (#9165)
* Move `PalletVersion` away from the crate version

Before this pr, `PalletVersion` was referring to the crate version that
hosted the pallet. This pr introduces a custom `package.metadata.frame`
section in the `Cargo.toml` that can contain a `pallet-version` key
value pair. While the value is expected to be a valid u16. If this
key/value pair isn't given, the version is set to 1.

It also changes the `PalletVersion` declaration. We now only have one
`u16` that represents the version. Not a major/minor/patch version. As
the old `PalletVersion` was starting with the `u16` major, decoding the
old values will work.

* Overhaul the entire implementation

- Drop PalletVersion
- Introduce StorageVersion
- StorageVersion needs to be set in the crate and set for the macros
- Added migration

* Fix migrations

* Review feedback

* Remove unneeded dep

* remove pub consts

* Brings back logging and implements `GetStorageVersion`

* Return weight from migration

* Fmt and remove unused import

* Update frame/support/src/dispatch.rs

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

* Update frame/support/src/traits/metadata.rs

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

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-07-27 21:21:27 +00:00
Guillaume Thiolliere 988c399983 fix codec (#9445) 2021-07-27 23:02:55 +02:00
wangjj9219 32fe61306b check can_dec_provider when transfer allow death (#9411) 2021-07-27 17:59:34 +01:00
Bastian Köcher 9c173724fa Update trybuild to get better normalization (#9444)
The old `trybuild` version didn't normalized cargo registry paths, but
this is now done :)
2021-07-27 11:01:28 +00:00
Keith Yeung 845e6a5ff1 Add methods to PrefixIterator to support iterating from a specific key (#9313)
* Add methods to PrefixIterator to support iterating from a specific key

* Expose the decode functions used in iterators for storage maps

* Use associated decode function in tests

* Revert "Expose the decode functions used in iterators for storage maps"

This reverts commit 34f57d92db89646d0c98ea1880df58d58e523b09.

* Fix documentation for next_key

* Add API for iterating from a specified key for all storage map types

* Enhance pagination test

* Add API methods to storage map types

* Rename next_key to last_key

* Rename last_key to last_raw_key

* Specify that iteration starts after starting_raw_key

* Update documentation on iteration ordering

* Rename next_key to previous_key

* Enhance pagination unit test

* Create unit tests for all kinds of iter_from methods

* Define iter_from in terms of iter rather than vice versa

* Cargo fmt
2021-07-27 00:43:15 +00:00
Squirrel 492523f1ae post rustfmt whitespace fixup (#9436)
Taking best bits of rustfmt's format_strings

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
2021-07-26 14:18:27 +01:00