Commit Graph

6576 Commits

Author SHA1 Message Date
Jun Jiang f9e4e87efa Add force_batch to utility pallet (#11148)
* Add batch_try to utility pallet

* lint

* rename utility.batch_try -> utility.force_batch

* Remove un-needed index field for utility.ItemFailed event

* Remove indexes of utility,BatchCompletedWithErrors

* Apply suggestions from code review

Co-authored-by: Louis Merlin <hello@louismerl.in>

Co-authored-by: Louis Merlin <hello@louismerl.in>
Co-authored-by: Bastian Köcher <info@kchr.de>
2022-05-05 10:44:13 +00:00
dependabot[bot] b24d1a2c23 Bump git2 from 0.13.25 to 0.14.2 (#11341)
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.25 to 0.14.2.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.13.25...0.14.2)

---
updated-dependencies:
- dependency-name: git2
  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>
2022-05-05 12:38:53 +02:00
Alexander Samusev 52c4871897 [ci] fix cargo-check-nixos for nightly pipeline (#11358) 2022-05-05 11:50:14 +02:00
André Silva d6d4068ccc babe: only process vrf on module finalization (#11113)
* babe: only process vrf on block execution finalization

* babe: rename CurrentBlockRandomness to PreviousBlockRandomness

* babe: add test for initialization ordering

* babe: rename PreviousBlockRandomness to ParentBlockRandomness

* babe: re-add CurrentBlockRandomness with deprecation notice

* babe: export CurrentBlockRandomness

* babe: silence deprecation warning when exporting CurrentBlockRandomness

* babe: suggestion from code review

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

* babe: flatten nested option

* babe: rustfmt

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-05-04 16:14:58 +00:00
João Paulo Silva de Souza 2dbdafb437 customize check-dependent-* for release engineering (#11311) 2022-05-04 16:45:23 +02:00
Shawn Tabrizi 7d5202341b Basic TOML Lint (#11348)
* basic lint

* lint ordering
2022-05-04 13:38:54 +00:00
Kian Paimani 19a9e56444 fix a few things with nomination pools (#11343)
* fix a few things with nomination pools

* fix typo

* fix build

* add missing try-runtime feat
2022-05-04 13:17:24 +00:00
Web3 Smith fd45676d11 Update MMR Runtime API with functionality to generate MMR proof for a series of leaf indices (#10635)
* updated mmr rpc api with functions for batch generation of proof

* update code comments

* fix build errors

* added tests to mmr-rpc

* add tests to pallet-mmr

* update comments

* minor comment fix

* remove unused variables

* fix rust doc errors

* refactor mmr runtime api

* fix tests

* minor fix

* minor fix

* fix node-runtime

* revert to initial api

* impl from proof fot batchproof

* minor fix

* minor fix

* use explicit functions to convert btw batch proof and single proof

* minor fix

* add new variant to mmr error

* fmt

* update conversion to single leaf proof

* fix style nit

Co-authored-by: Adrian Catangiu <adrian@parity.io>
2022-05-04 10:40:11 +00:00
Bastian Köcher 82adb65f1b sc-network: Do not return error on peer id only reserved nodes (#11346)
When passing reserved nodes only with a peer id it was failing with the `DuplicateBootnode` error.
Besides that there are some clean ups. We for example added the bootnodes twice to the `known_addresses`.
2022-05-04 12:15:11 +02:00
Adrian Catangiu 1e2424ec4b BEEFY voter bugfixes (#11335)
* beefy: gadget should always use current validator set

The gadget/client-voter was using previous' session validator set
to sign the 1st block in the new session (to have chained validator
set handoffs).

This is not necessary because:
1. BEEFY piggy-backs on GRANDPA and only works on canonical chain,
   so it need not concern itself with the validity of the block header
   (which contains digest with the new session's validator set). It
   can safely assume header is valid and simply use new validator set.
2. The BEEFY payload itself already contains a merkle root for the
   next validator set keys. So at the BEEFY-payload layer we already
   have a validated/trusted hand-off of authority.

Signed-off-by: acatangiu <adrian@parity.io>

* beefy: buffer votes for not yet finalized blocks

Signed-off-by: acatangiu <adrian@parity.io>

* beefy: add buffered votes regression test
2022-05-04 09:36:52 +00:00
Alexander Gryaznov 9fd4df9ccf [contracts] stabilize seal_code_hash, seal_set_code_hash and seal_own_code_hash (#11337)
* stabilize seal_code_hash, seal_set_code_hash, seal_own_code_hash

* fix missed place found by CI

* Fixed missed __unstable__

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
2022-05-04 10:35:30 +03:00
Shawn Tabrizi e8c688e301 Update docs (#11313)
* Update docs

* Update primitives/runtime/src/traits.rs

* Update primitives/runtime/src/traits.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-05-04 00:54:08 +00:00
Shawn Tabrizi 6d6f1e173b Update Pallet Bags List to use ListError (#11342)
* extract list error changes from kiz-revamp-sorted-list-providers-2-approval-stake

* some fixes

* weight -> score

* Update tests.rs

* Update tests.rs

* more fixes

* remove score updated event

* Update frame/bags-list/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
2022-05-03 23:13:58 +01:00
Nazar Mokrynskyi e397e0b634 Network sync refactoring (part 2) (#11322)
* Move `api.v1.proto` schema into new crate `sc-network-sync`

* Move `sc_network::protocol::sync::state` module into `sc_network_sync::state`

* Move `sc_network::protocol::sync::blocks` module into `sc_network_sync::blocks` and some data structures from `sc_network::protocol::message` module into `sc_network_sync::message`

* Move some data structures from `sc_network::config` and `sc_network::request_responses` into new `sc-network-common` crate

* Move `sc_network::protocol::sync::warm` and `sc_network::warp_request_handler` modules into `sc_network_sync`

* Move `client/network/sync/src/lib.rs` to `client/network/sync/src/lib_old.rs` to preserve history of changes of the file in the next commit

* Move `client/network/src/protocol/sync.rs` on top of `client/network/sync/src/lib.rs` to preserve history of changes

* Move `sc_network::protocol::sync` to `sc_network_sync` with submodules, move message data structures around accordingly

* Move `sc_network::block_request_handler` to `sc_network_sync::block_request_handler`

* Move `sc_network::state_request_handler` to `sc_network_sync::state_request_handler`

* Add re-exports for compatibility reasons

* Apply suggestions from code review

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

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-05-03 15:55:26 +02:00
dependabot[bot] 23c30b2b2a Bump parity-db from 0.3.9 to 0.3.12 (#11340)
Bumps [parity-db](https://github.com/paritytech/parity-db) from 0.3.9 to 0.3.12.
- [Release notes](https://github.com/paritytech/parity-db/releases)
- [Commits](https://github.com/paritytech/parity-db/commits/v0.3.12)

---
updated-dependencies:
- dependency-name: parity-db
  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>
2022-05-03 13:05:45 +02:00
Qinxuan Chen 7ff70c6477 sc-network: update cid v0.6.0 => v0.8.4 (#11325)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2022-05-03 12:23:37 +02:00
Roy Yang 084e0f37a4 Added RuntimeDebug derive to enums in frame_support::tokens::misc (#11211)
Co-authored-by: Roy Yang <roy@laminar.one>
2022-05-03 00:17:14 +02:00
Ikko Ashimine b61cfe8be9 Uniques: fix typo in README.md (#11329)
existance -> existence
2022-05-02 10:23:53 +00:00
Shawn Tabrizi e1e4894154 add missing features to node-template-runtime (#11326) 2022-04-30 23:49:57 +02:00
Falco Hirschenberger b581604aa7 Apply some clippy lints (#11154)
* Apply some clippy hints

* Revert clippy ci changes

* Update client/cli/src/commands/generate.rs

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

* Update client/cli/src/commands/inspect_key.rs

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

* Update client/db/src/bench.rs

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

* Update client/db/src/bench.rs

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

* Update client/service/src/client/block_rules.rs

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

* Update client/service/src/client/block_rules.rs

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

* Update client/network/src/transactions.rs

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

* Update client/network/src/protocol.rs

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

* Revert due to missing `or_default` function.

* Fix compilation and simplify code

* Undo change that corrupts benchmark.

* fix clippy

* Update client/service/test/src/lib.rs

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

* Update client/state-db/src/noncanonical.rs

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

* Update client/state-db/src/noncanonical.rs

remove leftovers!

* Update client/tracing/src/logging/directives.rs

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

* Update utils/fork-tree/src/lib.rs

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

* added needed ref

* Update frame/referenda/src/benchmarking.rs

* Simplify byte-vec creation

* let's just not overlap the ranges

* Correction

* cargo fmt

* Update utils/frame/benchmarking-cli/src/shared/stats.rs

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

* Update utils/frame/benchmarking-cli/src/pallet/command.rs

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

* Update utils/frame/benchmarking-cli/src/pallet/command.rs

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

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Giles Cope <gilescope@gmail.com>
2022-04-30 21:28:27 +00:00
yjh a990473cf9 import Vec when run on no_std for wasmi (#11319)
* import Vec when run on no_std for wasmi

* cargo fmt
2022-04-30 06:11:15 +00:00
Nazar Mokrynskyi af6773aba9 Network sync refactoring (part 1) (#11303)
* Remove unnecessary imports, move one internal re-export into where it is actually used, make one import explicit

* Move a few data structures down into modules

* Use generic parameters in `sc-network` instead of `chain::Client` trait

* Remove unnecessary bound
2022-04-29 16:02:03 +02:00
Roman 887acda7d0 Upgrade to libp2p 0.44.0 (#11009)
* Update libp2p to 0.43.0, lru to 0.7.3

* Fix websoket Incoming::Data

* Rename ProtocolsHandler -> ConnectionHandler, remove inject_dis/connected, minor fixes

* Fix args for inject_connection* callbacks

* Fix DialPeer/DialAddress

* Fix debug fmt

* Add Endpoint to NetworkState

* Fix Kad::get_record by key

* Fix Sha2_256::digest

* Fix IntoConnectionHandler

* Fix borrowchk

* Fix DialError::WrongPeerId

* Remove NodeHandlerWrapperError

* Fix KademliaEvent variants

* Fix impl Add for String

* Fix tabs in network_state

* Apply cargo fmt

* Fix a typo in req/resp

* Fix tests

* Fix peer_info:entry.info_expire

* Fix PeerInfoBehaviour inject_address_change and inject_connection_closed

* Patch libp2p to 0.44.0#6cc3b4e

* Fix inject_connection_closed kad, req/resp

* Apply cargo fmt

* Use libp2p from crates.io

* Fix review notes
2022-04-29 10:49:05 +02:00
Qinxuan Chen 51915ebe4a Remove deprecated RawEvent types from some pallets (#11316)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2022-04-29 08:28:17 +00:00
Bisola Olasehinde aaf693f05a Replace simple parameter_types (#11254)
* update bin/node-template/runtime/src/lib.rs

* update frame/contracts/src/tests.rs

* update frame/executive/src/lib.rs

* update frame/grandpa/src/mock.rs

* update frame/im-online/src/mock.rs

* update frame/offences/benchmarking/src/mock.rs

* update frame/recovery/src/mock.rs

* update frame/referenda/src/mock.rs

* update frame/session/benchmarking/src/mock.rs

* update frame/staking/src/mock.rs

* update frame/state-trie-migration/src/lib.rs

* update frame/support/test/compile_pass/src/lib.rs

* frame/treasury/src/tests.rs

* update frame/whitelist/src/mock.rs

* update frame/vesting/src/mock.rs

* update test-utils/runtime/src/lib.rs

* update bin/node-template/runtime/src/lib.rs

* Update frame/grandpa/src/mock.rs

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

* resolve failed checks 1518659 & 1518669

* resolve format check

* backtrack to resolve compile error

* check --all --tests 

* cargo +nightly fmt 

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
2022-04-29 02:25:50 +00:00
dependabot[bot] b0bfbbbc04 Bump ss58-registry from 1.15.0 to 1.17.0 (#11265)
Bumps [ss58-registry](https://github.com/paritytech/ss58-registry) from 1.15.0 to 1.17.0.
- [Release notes](https://github.com/paritytech/ss58-registry/releases)
- [Changelog](https://github.com/paritytech/ss58-registry/blob/main/CHANGELOG.md)
- [Commits](https://github.com/paritytech/ss58-registry/compare/v1.15.0...v1.17.0)

---
updated-dependencies:
- dependency-name: ss58-registry
  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>
Co-authored-by: Giles Cope <gilescope@gmail.com>
2022-04-28 17:57:02 +02:00
yjh e1185c317f make sp-wasm-interface some wasmi impls works in no_std (#11310) 2022-04-28 16:12:56 +02:00
Adrian Catangiu 0d73371bb8 pallet-beefy: ensure mandatory block once per session (#11269)
* pallet-beefy: ensure mandatory block once per session

Signed-off-by: acatangiu <adrian@parity.io>

* pallet-beefy: fix tests with auth changes every session

Signed-off-by: acatangiu <adrian@parity.io>

* Apply suggestions from code review

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

* beefy: fix incorrect skip session metric on node restart

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
2022-04-28 11:19:32 +00:00
Joshua W 21341f35e2 Dependency Injection Trait Locker for Uniques Pallet (#11025)
* Create a dependency injection trait named Locker that can be implemented downstream to enable locking of an asset. Use case defined in RMRK substrate pallet PR76

* Formatting

* Change impl Locker function name to is_locked

* Remove unused import

* Add docstring header

* Remove impl_locker file and add Locker trait to frame_support::traits

* Expose Locker from frame_support::traits::misc

* Formatting

* Move to tokens folder

* Move to tokens folder

* Format and remove Locker from misc traits

* Punctuation

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

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Giles Cope <gilescope@gmail.com>
2022-04-28 11:05:18 +00:00
Squirrel 3ecb5306eb Updating shell.nix nightly (#11266)
* The 2022-02-10 nightly can't build some deps

There's a sig that returns `impl IntoIterator<Item = (&'static str, OsString)>` and an Option is being retured but it's incorrectly not allowing a `?` in the method.

* removing duplicate test

* [ci] add job cargo-check-nixos

* add dummy variables nix check

* fix check-dependent jobs

* fix check-dependent-project template

Co-authored-by: alvicsam <alvicsam@gmail.com>
2022-04-27 17:19:07 +00:00
Zeke Mostov 247f33dc0b Nomination Pools (#10694)
* Update frame/nomination-pools/src/lib.rs

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

* Add admin roles and make some calls permissionless

* Destroy pool in withdraw unbonded

* Add docs on pool admin

* Fixup tests

* Test unbond_other permissionless scenarios

* Test withdraw unbonded permissionless

* Test only can join open pools

* Move unsafe set state to mock

* Test: nominate_works

* Add bounds: MinJoinBond, MinCreateBond, MaxPools

* Test MinCreateBond, MinJoinBond, MaxPools

* Add post checks to tests

* Remove some TODOs

* Setup weight infrastructure

* Benchmark claim_payout

* Benchmark create

* Benchmark nominate

* Benchmark join

* Benchmark unbond_other

* Refactor join benchmark to use scenario setup

* Clean up and address warnings

* Basic withdraw unbonded benchmarks

* Refactor nominate benchmark

* Refactor claim payout

* Add feature sp-staking/runtime-benchmarks

* Get node runtime to compile

* Get node to run

* Make claim_payout bench work with node

* Make pool_withdraw_unbonded bench work with node

* Make withdraw_unbonded_other work with node runtime'

* Make create benchmark work with node

* Make nominate benchmark work with node runtime

* WiP new benchmark crate

* Implement initial mock for benchmarks

* Establish benchmark setup logic

* Get claim payout and nominate benchmarks working

* Remove pool bench utils; make struct fields pub insteaad

* Get more benchmarks to work; trim interface trait

* Some more top level docs

* Finish tranistion benchmarks to crate

* Hook up benchmark pallet to node runtime

* Get benches to work with node runtime

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

* Benchmark withdraw_unbonded_other_kill

* Delete old benchmarking files

* Refunds for withdraw_unbonded

* Remove some TODOs

* 'Don't return an option for the current_era'

* Streamline extrinsic docs

* small docs tweaks

* Refactor ledger::slash

* Add on_slash impl for nomination pools

* slash refactor wip

* WIP slash working

* DRY Ledger::stash

* Fix slash saturation

* Remove unused param from slash

* Docs and warnings

* Test ledger::slash

* save progress

* Introduce counter for delegators

* Add tests for max delegator errors

* Reproducible account ids

* Adapt tests to new account id format

* Simplify create_accounts api

* Fix staking tests

* Save PerBill slash impl before removing

* Rever ledger slash test

* Get node runtime to work

* Organize sub pools by unbond era, not curren era

* staking: Proportional ledger slashing

* Some comment cleanup

* Add more test post checks

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

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

* Tests: account for storing unbond era

* Improve docs for staking interface

* Add events Created, Destroyed

* withdraw_unbonded: Remove useless withdraw dust check

* Test: withdraw_unbonded_other_handles_faulty_sub_pool_accounting

* Add extrinsics: set_state_other, set_metadata

* Test: set_state_other_works

* Test: set_metadata_works

* Add benchmarks for set_state_other, set_metadata

* Fix benchmarks

* Add weight info for new extrinsics

* Some feedback

* duo feedback

* Incorporate some more feedback

* integrate more kian feedback

* integrate more kian feedback

* More improvements

* Add destroying_mul

* Make do_reward_payout take refs

* Remove some TODOs

* Add test for saturating

* feedback

* Fix join test

* use `inner` for nested types in nomination pools (#11030)

* Use nested inner type for pool

* make tests and benchmarks work

* remove feat

* all tests work now

* fix node-runtime

* nomination-pools: update benches for new account format (#11033)

* Update benches to new account format

* More sensible seeds

* bring back rward account sanity check

* Comment

* Add extrinsic set_configs (#11038)

* Better sanity checks for nomination pools  (#11042)

* new sanity checks, few other changes

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* nomination-pools: Fix state event regression + benches (#11045)

* new sanity checks, few other changes

* Fix benches, improve sanity check

* Remove useless clear storage in benchmarking

* Set state

* Save

* Doc

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: kianenigma <kian@parity.io>

* FMT

* Try fill in all staking configs

* Fix build

* More changes to nomination pools (#11050)

* new sanity checks, few other changes

* some last touches as a whole

* Apply suggestions from code review

* Remove redundant event

* Improve unbond_other error handling

* Remove comment

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

* Remove sanity module and some TODOs

* round of feedback and imp from kian

* Add TODO for ED QoL at reward pool creation

* Make sure reward pool never gets dusted

* Improve error type

* demonstrate per_thing usage

* Update sanity check & fix create_works

* Improve test ext pool creation & fix some more tests

* Try revert

* Revert "Try revert"

This reverts commit c044c94730e1a370eecd8f5b2c4f632835913063.

* Revert "Improve test ext pool creation & fix some more tests"

This reverts commit 1e862a64a7423479260c6e5ad1bd4c8c95651f3a.

* Revert "Update sanity check & fix create_works"

This reverts commit 568a7b727687e4d585e2796afc638df97b83c632.

Roll back reward account funding

* Revert "Improve error type"

This reverts commit 4b993ee601a037e7a44e4a49bbfd60cf45b38b78.

* Revert "Make sure reward pool never gets dusted"

This reverts commit e7a3eb45bdfd156d3f6d94d194e988032ebbc593.

revert

* Update some tests

* FMT

* Test that era offset works correctly

* Update mocks

* Remove unnescary docs

* Doc updates

* Update calculate_delegator_payout_works_with_a_pool_of_1

* Fix test: claim_payout_works

* do_reward_payout_correctly_sets_pool_state_to_destroying

* Remove test do_reward_payout_errors_correctly

* Fix test: do_reward_payout_works

* Fix test: create_errors_correctly

* Fix test: create works

* Fix test: unbond_other_of_3_works

* Ensure that ED is transferred into reward pool upon creation

* WIP pool lifecycle test

* Fix benchmarks

* Add sanity check for ED + reward pools

* `bond_extra` for nomination pools (#11100)

* bond_extra for nomination pools

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* add benchmarks

* remove the min logic of bond_extra

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* FMT

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* make it compile end to end

* Update some type viz

* Update kick terminology

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

* Cache bonded account when creating pool

* Add bond extra weight stuff

* Update frame/nomination-pools/src/lib.rs

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

* Update docs for pool withdraw unbonded

* Update docs for unbond

* Improve Doc

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/Cargo.toml

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

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* Improve Docs

* Some docs improvements

* fmt

* Remove unlock_era

* Fix accidental frame-support regression

* Fix issue with transactions in tests

* Fix doc links

* Make sure result in test is used

* Update frame/nomination-pools/src/lib.rs

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

* Fix can toggle state

* Account for new_funds in ok to be open

* Update docs: ok_to_withdraw_unbonded_other_with

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* Remove some staking comments

* Rename SubPoolsWithEra to UnbondingPoolsWithEra

* Use validators length for benchmarks

* Use metadata length for benchmarks

* Remove debug assert eq

* docs

* Fix test: withdraw_unbonded_other_errors_correctly

* Fix check for having enough balance to create the pool

* Bond event for pool creation

* Ok to be open

* FMT

* Remove _other postfix

* Update frame/staking/src/lib.rs

* Adjust tests to account for only remove when < ED

* Remove stale TODOs

* Remove dupe test

* Fix build

* Make sure to convert to u256 so we don't saturate

* Refund depositor with reward pool fee

* FMT

* Remove reachable defensive

* Use compact encoding for relevant extrinsics

* Remove unnescary make_free_be for cleaning reward account

* Add not to maintainers for reward account accounting

* Remove note to maintainers from public doc

* Make sure all configs have currency balance

* Avoid saturation in balance_to_unbond

* Partial Unbonding for Nomination Pools (#11212)

* first draft of partial unbonding for pools

* remove option

* Add some more tests and fix issues

* Fix all tests

* simplify some tests

* Update frame/nomination-pools/src/mock.rs

* remove clone

* rename to delegator_unbonding_eras

* Update frame/nomination-pools/src/tests.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update frame/nomination-pools/src/tests.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update frame/nomination-pools/src/tests.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* remove pub

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* undo

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* leftovers

* fix invariant

* Fix the depositor assumption

* round of self-review

* little bit more cleanup

* Update frame/nomination-pools/src/mock.rs

* Apply suggestions from code review

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Fix interpretation of MinCreateBond

* controvesial refactor

* rename

* make everything build

* add TODO about killing the reward account

* Update frame/nomination-pools/src/lib.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update frame/nomination-pools/src/lib.rs

* last self-review

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update Cargo.lock

* Rename Delegator to PoolMember

* fmt

* Get runtime to build with runtime-benchmarks feature

* Update Cargo.lock

* Fix asserts to work in more scenarios

* gte not gt

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

* Update frame/staking/src/mock.rs

* Update frame/nomination-pools/src/lib.rs

* Update frame/staking/src/slashing.rs

* Apply suggestions from code review

* fmt

* Fix some tests

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2022-04-27 10:46:47 +00:00
Chigozie Joshua bdf55aab19 Adds remove_approval feature to treasury pallet (#11243)
* added remove_approval feature to treasury pallet

* Update frame/treasury/src/lib.rs

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>

* treasury pallet refactoring: removed proposalId check in remove_approval call and trailing new line in tests file

* fmt

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

* Update frame/treasury/src/lib.rs

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

* remove_approval extrinsic in treasury pallet:added extra checks in test and extra documentation

* refactored error logging on remove_approval extrinsic in treasury pallet

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
2022-04-27 09:23:46 +00:00
Koute 3890fd4cb2 Make wildcard storage change subscriptions RPC-unsafe (#11259)
* When an RPC is rejected because it's RPC-unsafe say why in the error message

* Make wildcard storage change subscriptions RPC-unsafe

* Apply suggestions from code review

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

* Fix typo

* Fix tests

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-04-27 05:35:52 +00:00
joe petrowski dcc8387dfa typo in from_rational rounding example (#11301) 2022-04-26 21:15:00 +02:00
yjh 130880754f chore: remove unused scoped-tls (#11286)
* chore: remove unused scoped-tls

* rm irrelevant files

* rm sp-core
2022-04-26 20:21:30 +02:00
João Paulo Silva de Souza d6a66fd831 use options for check_dependent_project (#11284)
Co-authored-by: TriplEight <denis.pisarev@parity.io>
2022-04-26 16:59:13 +02:00
Oliver Tale-Yazdi 9980d314b1 Follow ups for benchmark machine (#11270)
* Follow ups for the MachineCmd

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

* Fix CI

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

* Review fixes

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

* Add to node-template

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

* Fix test with feature flag

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

* Review fixes

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

* Lower disk requirements

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

* Add ExecutionLimit to the disk benchmarks

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

* fmt

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

* Add doc

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

* Review fixes

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

* Rename DISK_WRITE_LIMIT -> DEFAULT_DISK_EXECUTION_LIMIT

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

* Rename POLKADOT_REFERENCE_HARDWARE -> SUBSTRATE_REFERENCE_HARDWARE

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

* Fix build profile + add license

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

* Remove deps

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

* Set tolerance to 10%

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

* Fix tests

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

* Ignore test

I cannot reproduce the CI error, even with the full command:
cargo test --workspace --locked --release --verbose --features runtime-benchmarks --manifest-path ./bin/node/cli/Cargo.toml

I will put an 'ignore' on that test for now, since it works for me and is worth having.

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

* Remove test

Still cannot reproduce the error and it fails in the CI.
Removing it now.

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

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2022-04-26 14:31:26 +00:00
João Paulo Silva de Souza 9a3201ef3d Skip pr-custom-review if pull request is in Draft (#11248)
* skip pr-custom-review if pull request is in Draft

* ready_for_review

* document steps[*].if

* fix

* converted_to_draft

* fix

Co-authored-by: Giles Cope <gilescope@gmail.com>
2022-04-26 12:14:21 +00:00
Ayevbeosa Iyamu 8a9961b48e Recovery Pallet benchmarking (#11176)
* Created benchmarks

* Added recovery benchmarks

* benchmark for `create_recovery`

* benchmark for `initiate_recovery`

* benchmark for `vouch_recovery`

* benchmark for `claim_recovery`

* benchmark for `close_recovery`

* benchmark for `remove_recovery`

* benchmark for `cancel_recovered`

* benchmark for `as_recovered`

* Some refactoring

* Some refactoring

* Fix create_recovery benchmark

* fix close_recovery benchmark test

* fixed issues with failing tests

* Update frame/recovery/src/benchmarking.rs

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

* removed repetitive code

* create weights file

* Used weights to annotate extrinsics

* Added WeightInfo implementation to mock

* Beauty fixes

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

* Update frame/recovery/src/benchmarking.rs

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

* Update frame/recovery/src/benchmarking.rs

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

* Set vec to be mut

* set delay_period to use non-zero amount

* set delay default

* Add weights

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

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2022-04-26 11:57:55 +00:00
Sergejs Kostjucenko 9cdde52cac Change ci vars to use group one's (#11281) 2022-04-26 12:28:18 +03:00
Qinxuan Chen e9b69bc1b0 sp-sandbox: move the sandbox module of sp-core into sp-sandbox (#11027)
* sp-sandbox: move the sandbox module of sp-core into sp-sandbox

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2022-04-26 11:25:41 +02:00
Koute 94dac682b4 Turn on logger's interest cache (#11264) 2022-04-26 08:05:51 +00:00
tgmichel 5eb2e3292d Add chain-info Subcommand (#11250)
* Add `blockchain-info` Subcommand

* Update comment

* Cleanup

* Cleanup

* Use `sync_run`

* Use `sc_client_db` utility fns instead service backend

* Use service `Backend` builder

* Impl `From<sp_blockchain::Info>`

* Rename to `chain-info`

* fmt

* Copyright year

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

* Expose `DatabaseParams`

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-04-25 21:07:26 +02:00
Bastian Köcher 2541efdbcc pallet-asset: Fix transfer of a large amount of an asset (#11241)
* pallet-asset: Fix transfer of a large amount of an asset

Before this pr transferring a large amount of an asset would check that transferring the asset would
not overflow the supply of the asset. However, it doesn't make sense to check for asset supply
overflow when we just transfer from one account to another account and don't increase the supply in
any way. It also required to extend the `can_deposit` method of `fungible` and `fungibles` with a
`mint` parameter. If this parameter is set to `true`, it means we want to mint the amount of an
asset before transferring it into an account. For `can_withdraw` we don't need to add an extra
parameter, because withdrawing should never be able to underflow the supply. If that would happen,
it would mean that somewhere the supply wasn't increased while increasing the balance of an account.

* Update frame/assets/src/functions.rs

* Update frame/assets/src/functions.rs

* Update frame/assets/src/functions.rs

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

* FMT

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2022-04-25 20:12:06 +02:00
Bastian Köcher 914db49d04 cumulus-companion: Fix CI when there is no Polkadot companion (#11280)
This tries to fix the CI if there is no polkadot companion. Currently we don't update Polkadot
master in Cumulus, which means we may use some old commit that isn't compiling with the latest
Substrate master anymore. This can happen if there was a pr that had a companion in Polkadot, but no
companion was required for Cumulus. Then Cumulus will still point to some old Polkadot commit that
isn't compiling anymore with the latest Substrate commit. So, we need to tell the script to use the
latest master of Polkadot. If there is a companion for Polkadot, it would simply override the extra
dependency patch later on.
2022-04-25 17:07:09 +02:00
Nazar Mokrynskyi 539946911e More efficient identity and multiplier weight to fee (#11226) 2022-04-25 04:16:38 +00:00
Bastian Köcher 53575a959c BABE: Fix aux data cleaning (#11263)
With the latest optimizations of the `FinalityNotification` generation, the aux data pruning started
to print a warning. The problem here was that we printed a warning and stopped the adding of blocks
to prune when we hit the `heigh_limit`. This is now wrong, as we could for example have two 512 long
forks and then we start finalizing one of them. The second fork head would be part of the stale
heads at some point (in the current implementation when we finalize second fork head number + 1),
but then we would actually need to go back into the past than `heigh_limit` (which was actually
last_finalized - 1). We now go back until we reach the canonical chain.

Also fixed some wrong comment that was added by be about the content of the `finalized` blocks in
the `FinalityNotification`.
2022-04-22 16:58:53 +02:00
dependabot[bot] 02c7433baa Bump tracing-core from 0.1.21 to 0.1.26 (#11258)
Bumps [tracing-core](https://github.com/tokio-rs/tracing) from 0.1.21 to 0.1.26.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-core-0.1.21...tracing-core-0.1.26)

---
updated-dependencies:
- dependency-name: tracing-core
  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>
2022-04-22 10:39:33 +02:00
Zeke Mostov e0bf4f36bf staking: Proportional ledger slashing (#10982)
* staking: Proportional ledger slashing

* Some comment cleanup

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

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

* Fix benchmarks

* FMT

* Try fill in all staking configs

* round of feedback and imp from kian

* demonstrate per_thing usage

* Update some tests

* FMT

* Test that era offset works correctly

* Update mocks

* Remove unnescary docs

* Remove unlock_era

* Update frame/staking/src/lib.rs

* Adjust tests to account for only remove when < ED

* Remove stale TODOs

* Remove dupe test

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: kianenigma <kian@parity.io>
2022-04-21 22:53:54 +00:00
Adrian Catangiu 7416c8c5de adjust BEEFY client logging (#11261)
Move gossip filter logging to level=trace because it's very spammy.
Move some debug-relevant logs from trace to debug.

Signed-off-by: acatangiu <adrian@parity.io>
2022-04-21 17:58:03 +00:00