1. Mar 18, 2021
    • Shaun Wang's avatar
      Replace 'Module' with 'Pallet' in construct_runtime macro (#8372) · 2e552244
      Shaun Wang authored
      * Use 'Pallet' struct in construct_runtime.
      
      * Fix genesis and metadata macro.
      
      * Fix 'Pallet' type alias.
      
      * Replace 'Module' with 'Pallet' for all construct_runtime use cases.
      
      * Replace more deprecated 'Module' struct.
      
      * Bring back AllModules and AllPalletsWithSystem type, but deprecate them.
      
      * Replace deprecated 'Module' struct from merge master.
      
      * Minor fix.
      
      * Fix UI tests.
      
      * Revert UI override in derive_no_bound.
      
      * Fix more deprecated 'Module' use from master branch.
      
      * Fix more deprecated 'Module' use from master branch.
      2e552244
    • Peter Goodspeed-Niklaus's avatar
      Fast CompactAssignment search (#8385) · 05f24931
      Peter Goodspeed-Niklaus authored
      
      
      * use more efficient search through candidates in offchain-election
      
      * mark linear accessors as test-only in election-provider-multi-phase
      
      This prevents production code which uses them from compiling.
      
      Also write an efficient helper for getting the target index.
      
      * doc grammar
      
      * use faster target_index_fn in benchmarks
      
      * unbox helper functions
      
      * remove unnecessary import
      
      * write lifetime after primary trait
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      05f24931
  2. Mar 17, 2021
    • Bastian Köcher's avatar
      Aura and Slots refactoring (#8386) · 15e15e7d
      Bastian Köcher authored
      * Make slot duration being exposed as `Duration` to the outside
      
      * Some slot info love
      
      * Add `build_aura_worker` utility function
      
      * Copy copy copy
      15e15e7d
    • Jon Häggblad's avatar
      Storing multiple Justifications per block (#7640) · 0d6884b9
      Jon Häggblad authored
      
      
      * primitives/runtime: initial changes on supporting multiple Justifications
      
      * primitives/runtime: make Justifications strongly typed
      
      * Encode/decode Justifications
      
      * primitives/runtime: add Justification type
      
      * backend: apply_finality and finalize_block takes a single Justification
      
      * manual-seal: create engine id and let rpc take encoded justification
      
      * backend: skeleton functions for appending justifications
      
      * backend: initial implementation append_justification
      
      Initial implementation of append_justification on the Backend trait, and also remove unused skeleton
      functions for append_justificaton on Finaziler trait.
      k
      
      * backend: guard against duplicate consensus engine id
      
      * client/db: add check for block finality
      
      * client/api: add append_justification to in_mem db
      
      * client/light: add no-op append_justification
      
      * network: fix decode call for Justification
      
      * network: only send a single Justification in BlockData
      
      * network: minor comment update
      
      * protocol: update field names to distinguish single justification
      
      * client: further field renames to plural
      
      * client: update function names to plural justifications
      
      * client/db: upgrade existing database for new format
      
      * network: remove dependency on grandpa crate
      
      * db: fix check for finalized block
      
      * grandpa: check for multiple grandpa justifications hwne importing
      
      * backend: update Finalizer trait to take multiple Justifications
      
      * db: remove debugging statements in migration code
      
      * manual-seal: update note about engine id
      
      * db: fix check for finalized block
      
      * client: update variable name to reflect it is now plural
      
      * grandpa: fix incorrect empty Justications in test
      
      * primitives: make Justifications opaque to avoid being empty
      
      * network: fix detecting empty Justification
      
      * runtime: doc strings for Justifications functions
      
      * runtime: add into_justifications
      
      * primitives: check for duplicates in when adding to Justifications
      
      * network/test: use real grandpa engine id in test
      
      * client: fix reviewer comments
      
      * primitives: rename Justifications::push to append
      
      * backend: revert changes to Finalizer trait
      
      * backend: revert mark_finalized
      
      * backend: revert changes to finalize_block
      
      * backend: revert finalized_blocks
      
      * db: add a quick early return for performance
      
      * client: minor reviewer comments
      
      * service/test: use local ConsensusEngineId
      
      * network: add link to issue for sending multiple Justifications
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarPierre Krieger <[email protected]>
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarPierre Krieger <[email protected]>
      
      * network: tweaks to review suggestions
      
      * network: revert change to BlockData for backwards compatibility
      
      * Apply suggestion from code review
      
      Co-authored-by: default avatarPierre Krieger <[email protected]>
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      
      * primitives: update doc comment for Justifications
      
      * client/db/upgrade: avoid grandpa crate dependency
      
      * consensus: revert to single Justification for import_justification
      
      * primitives: improve justifications docs
      
      * style cleanups
      
      * use and_then
      
      * client: rename JUSTIFICATIONS db column
      
      * network: revert to using FRNK in network-test
      
      Co-authored-by: default avatarPierre Krieger <[email protected]>
      Co-authored-by: default avatarAndré Silva <[email protected]>
      Co-authored-by: default avatarAndré Silva <[email protected]>
      0d6884b9
    • Shaun Wang's avatar
      Migrate pallet-babe to pallet attribute macro. (#8310) · c7d32ba9
      Shaun Wang authored
      
      
      * Migrate pallet-babe to pallet attribute macro.
      
      * Remove unnecessary bound in pallet storage.
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      c7d32ba9
    • Martin Pugh's avatar
      add D1-trivial label (#8388) · da6bf01a
      Martin Pugh authored
      da6bf01a
    • Martin Pugh's avatar
      fix check-labels.yml (#8387) · bb2da340
      Martin Pugh authored
      bb2da340
    • kaichao's avatar
      1d206f65
    • Zeke Mostov's avatar
      Migrate pallet-proxy to pallet attribute macro (#8365) · 62abc784
      Zeke Mostov authored
      * Migrate pallet-proxy to pallet attribute macro
      
      Part of #7882.
      
      Converts the `Proxy` pallet to the new pallet attribute macro introduced in #6877.
      
      [Upgrade guidelines used](https://substrate.dev/rustdocs/v3.0.0/frame_support/attr.pallet.html#upgrade-guidelines).
      
      ## ️ Breaking Change  ️ 
      
      From [checking upgrade guidelines](https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines)
      
      > storages now use PalletInfo for module_prefix instead of the one given to `decl_storage`: use of this pallet in `construct_runtime!` needs careful updating of the name in order to not break storage or to upgrade storage (moreover for instantiable pallet). If pallet is published, make sure to warn about this breaking change.
      
      So users of the `Assets` pallet must be careful about the name they used in `construct_runtime!`. Hence the `runtime-migration` label, which might not be needed depending on the configuration of the `Assets` pallet.
      
      ### Notes
      
      There are some changes to the docs in metadata for the constants. The docs in the metadata for constants are now more complete.
      62abc784
    • Peter Goodspeed-Niklaus's avatar
      Improve complexity of CompactAssignments::unique_targets (#8314) · 23b32e75
      Peter Goodspeed-Niklaus authored
      * Improve complexity of CompactAssignments::unique_targets
      
      Original implementation was O(n**2). Current impl is O(n log n).
      
      Avoided the original proposed mitigation because it does not retain
      the de-duplicating property present in the original implementation.
      This implementation does a little more work, but retains that property.
      
      * Explicitly choose sp_std Vec and BTreeSet
      
      Ensures that the macro still works if someone uses it in a context
      in which sp_std is not imported or is renamed.
      
      * explicitly use sp_std vectors throughout compact macro
      23b32e75
  3. Mar 16, 2021
    • Denis_P's avatar
      CI: run cargo deny nightly (#8376) · 2586d557
      Denis_P authored
      
      
      * CI: run cargo deny only nightly before it's fixed
      
      * Release missing 3.0 crates: pallet-node-authorization sc-finality-grandpa-warp-sync (#8360)
      
      * bump pallet-node-authorization
      
      * prepping sc-finality-grandpa-warp-sync for release
      
      * bump Cargo.lock
      
      * Update ss58-registry.json (#8351)
      
      Added Plasm Network description
      
      * [CI] Require D*-audit labels for any runtime changes (#8345)
      
      * add check for audit labels if runtime change
      
      * fix shellcheck nits
      
      * include lib.sh in check_runtime.sh
      
      * fix check_labels.sh
      
      * fix check_labels.sh
      
      * oops, this is github actions...
      
      * why wont this work
      
      * fetch all refs
      
      * Update check-labels.yml
      
      * print env - wtf is happening
      
      * checkout the PR...
      
      * ffs
      
      * fix
      
      * REVERT ME: test runtime check
      
      * Revert "REVERT ME: test runtime check"
      
      This reverts commit 0fd2b04abeeac12dd8ede4c0708cb796f9e3e722.
      
      * Fix CI benchmark check (#8380)
      
      * CI: run cargo deny only nightly before it's fixed
      
      Co-authored-by: default avatarBenjamin Kampmann <[email protected]>
      Co-authored-by: default avatarAleksandr Krupenkin <[email protected]>
      Co-authored-by: default avatarMartin Pugh <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      2586d557
    • Bastian Köcher's avatar
      Fix CI benchmark check (#8380) · 413acc5d
      Bastian Köcher authored
      413acc5d
    • Martin Pugh's avatar
      [CI] Require D*-audit labels for any runtime changes (#8345) · d6bc59df
      Martin Pugh authored
      * add check for audit labels if runtime change
      
      * fix shellcheck nits
      
      * include lib.sh in check_runtime.sh
      
      * fix check_labels.sh
      
      * fix check_labels.sh
      
      * oops, this is github actions...
      
      * why wont this work
      
      * fetch all refs
      
      * Update check-labels.yml
      
      * print env - wtf is happening
      
      * checkout the PR...
      
      * ffs
      
      * fix
      
      * REVERT ME: test runtime check
      
      * Revert "REVERT ME: test runtime check"
      
      This reverts commit 0fd2b04abeeac12dd8ede4c0708cb796f9e3e722.
      d6bc59df
    • Aleksandr Krupenkin's avatar
      Update ss58-registry.json (#8351) · 4042dd67
      Aleksandr Krupenkin authored
      Added Plasm Network description
      4042dd67
    • Benjamin Kampmann's avatar
      Release missing 3.0 crates: pallet-node-authorization sc-finality-grandpa-warp-sync (#8360) · e64e4b24
      Benjamin Kampmann authored
      * bump pallet-node-authorization
      
      * prepping sc-finality-grandpa-warp-sync for release
      
      * bump Cargo.lock
      e64e4b24
    • Bastian Köcher's avatar
      Update diener to enable polkadot companions that use new crates (#8371) · 2cc9329b
      Bastian Köcher authored
      
      
      * Update diener to enable polkadot companions that use new crates
      
      Diener will be updated in the CI image to make it possible to have
      companions that add new crates from Substrate.
      
      Besides that the wasm-bindgen is updated, because `0.2.70` is not
      available anymore on crates.io.
      
      * update lock
      
      Co-authored-by: default avatarkianenigma <[email protected]>
      2cc9329b
    • Gavin Wood's avatar
      Document a pub item (#8374) · cf108722
      Gavin Wood authored
      cf108722
    • gabriel klawitter's avatar
    • Gavin Wood's avatar
      staking: Flexible generation of reward curve and associated tweaks (#8327) · 363db4f0
      Gavin Wood authored
      
      
      * Initial abstraction
      
      * Alter rest of APIs
      
      * Fixes
      
      * Some extra getters in Gilt pallet.
      
      * Refactor Gilt to avoid u128 conversions
      
      * Simplify and improve pow in per_things
      
      * Add scalar division to per_things
      
      * Renaming from_fraction -> from_float, drop _approximation
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Make stuff build
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      * Update .gitignore
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Update frame/gilt/src/lib.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Update frame/gilt/src/mock.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Fixes
      
      * Fixes
      
      * Fixes
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      363db4f0
    • Kian Paimani's avatar
      Audit fixes for election/staking decoupling part 2 (#8167) · b6c62639
      Kian Paimani authored
      
      
      * Base features and traits.
      
      * pallet and unsigned phase
      
      * Undo bad formattings.
      
      * some formatting cleanup.
      
      * Small self-cleanup.
      
      * Make it all build
      
      * self-review
      
      * Some doc tests.
      
      * Some changes from other PR
      
      * Fix session test
      
      * Update Cargo.lock
      
      * Update frame/election-provider-multi-phase/src/lib.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Some review comments
      
      * Rename + make encode/decode
      
      * Do an assert as well, just in case.
      
      * Fix build
      
      * Update frame/election-provider-multi-phase/src/unsigned.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Las comment
      
      * fix staking fuzzer.
      
      * 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
      
      * Add one last layer of feasibility check as well.
      
      * Last fixes to benchmarks
      
      * Some more docs.
      
      * 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
      
      * 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
      
      * Some nits
      
      * cargo run --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 doc
      
      * Mkae ci green
      
      * Audit fixes for election-provider: part 2 signed phase.
      
      * Fix weight
      
      * Some grumbles.
      
      * Try and weigh to get_npos_voters
      
      * Fix build
      
      * Fix line width
      
      * cargo run --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 tests.
      
      * Fix build
      
      * Reorg some stuff
      
      * More reorg.
      
      * Reorg done.
      
      * Fix build
      
      * Another rename
      
      * Fix build
      
      * Update frame/election-provider-multi-phase/src/mock.rs
      
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      
      * nit
      
      * better doc
      
      * Line width
      
      * Fix build
      
      * Self-review
      
      * Self-review
      
      * Fix wan
      
      * 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
      
      * cargo run --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 build and review comments.
      
      * Update frame/election-provider-multi-phase/src/lib.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * add comment
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      Co-authored-by: default avatarPeter Goodspeed-Niklaus <[email protected]>
      b6c62639
    • Peter Goodspeed-Niklaus's avatar
      NPoS Challenge Mode (#8236) · 49be0579
      Peter Goodspeed-Niklaus authored
      
      
      * Add PJR challenge functions
      
      - Updates the PJR check to return a counterexample if one exists
      - Adds functions to cheaply check counterexamples
      
      This is in support of off-chain PJR challenges: if a miner discovers
      that an accepted election solution does not satisfy PJR, it will be
      eligible for substantial rewards. This helps ensure that validator
      elections have an absolute quality floor, so even if someone manages
      to censor well-behaved solutions to give themselves unfair representation,
      we can catch them in the act and penalize them.
      
      * counterexample -> counter_example
      
      * reorganize: high -> low abstraction
      
      * reorganize challenges high -> low abstraction
      
      * add note justifying linear search
      
      * Simplify max_pre_score validation
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * add minor test of pjr challenge validation
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      49be0579
    • Shaun Wang's avatar
      Support pallet::storage conditional compilation (#8324) · 844e2552
      Shaun Wang authored
      
      
      * Support pallet::storage conditional compilation.
      
      * Add docs for cfg attributes.
      
      * Keep strong types for get cfg attrs return.
      
      * Update frame/support/procedural/src/pallet/parse/helper.rs
      
      * Update frame/support/procedural/src/pallet/parse/storage.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      844e2552
  4. Mar 15, 2021
  5. Mar 12, 2021
    • Robert Klotzner's avatar
      def7b4dc
    • Kian Paimani's avatar
      remove whitespaces. (#8341) · f7259758
      Kian Paimani authored
      f7259758
    • André Silva's avatar
      im-online: use EstimateNextSessionRotation to get better estimates of session progress (#8242) · 51822097
      André Silva authored
      * frame-support: add method to estimate current session progress
      
      * im-online: use EstimateNextSessionRotation trait to delay heartbeats
      
      * node: fix im-online pallet instantiation
      
      * frame-support: fix docs
      
      * frame: fix tests
      
      * pallet-session: last block of periodic session means 100% session progress
      
      * pallet-session: add test for periodic session progress
      
      * pallet-babe: fix epoch progress and add test
      
      * frame-support: return weight with session estimates
      
      * pallet-im-online: add test for session progress logic
      51822097
    • Alexander Theißen's avatar
      contracts: Expose rent parameter to contracts (#8231) · a4e88758
      Alexander Theißen authored
      
      
      * contracts: Expose rent parameter to contracts
      
      * cargo run --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 typos
      
      * Improve comments
      
      * Add rent parameter weights
      
      * Allow deploying a new schedule with the same version
      
      * Add storage migration for new schedule
      
      * Only decode the schedule version in storage migration
      
      * Remove confusing docs
      
      * Replace original_code_len() by aggregate_code_len()
      
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      a4e88758
    • Bastian Köcher's avatar
      Do not ban peers for sending multiple valid requests (#8325) · 3743cec9
      Bastian Köcher authored
      We introduced banning of peers who spam us with the same request (more
      than 2 times). However, we missed that it is completely legal to send
      the same request multiple times as long as we did not provide any
      answer. An example for that is the justification request. This request
      is send multiple times until we could fetch the justification from one
      of our peers. So, the solution to this problem is to tag requests as
      fulfilled and to start counting these fulfilled requests. If the number
      is higher than what we allow, the peer should be banned.
      3743cec9
  6. Mar 11, 2021
    • Bastian Köcher's avatar
      Convert timestamp to unit type wrapper (#8333) · 5d73e960
      Bastian Köcher authored
      The timestamp inherent type was up to now just a simple `u64`. This
      worked, but doesn't give you that much guarantees at compile time about
      the type. This pr changes that by converting this type to a unit type
      wrapper, similar to what we have done for `Slot`.
      
      This is required for some future pr that touches quite a lot of the
      inherents stuff :)
      
      Besides this unit wrapper type, this pr also moves the `OnTimestampSet`
      trait to `frame_support::traits`.
      5d73e960
    • Pierre Krieger's avatar
      Fix #8306 (#8330) · 39f3b77f
      Pierre Krieger authored
      39f3b77f
    • JesseAbram's avatar
      Add on_idle hook (#8209) · c06e5569
      JesseAbram authored
      
      
      * add in idle hook
      
      * remaining weight passed through to on_idle
      
      * added weight return
      
      * remove TODO
      
      * weight adjustment fix
      
      * added adjusted weight into tuple
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * compile errors for on_idle in dispatch
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * on idle tuple clean up
      
      * register reduced weight
      
      * collect and add reduced wait from on idle call
      
      * better demo example
      
      * Update frame/support/procedural/src/pallet/expand/hooks.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * added tests to dispatch.rs
      
      * idle test on executive
      
      * skip on idle if remaining weight is 0
      
      * Update frame/executive/src/lib.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Update frame/support/src/dispatch.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * abstract common logic out to functions
      
      * docs
      
      * remove demo example
      
      * remove debug
      
      * spacing
      
      * docs
      
      * revert template pallet to master
      
      * change reduced weight to used weight
      
      * remove empty line
      
      * lint
      
      * spacing
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      * documentation
      
      * Update frame/support/procedural/src/pallet/expand/hooks.rs
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * docs
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * docs
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Update frame/support/src/traits.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      c06e5569
    • Wei Tang's avatar
    • Pierre Krieger's avatar
      Remove legacy network protocol (#8296) · 5f004b44
      Pierre Krieger authored
      5f004b44
    • dependabot[bot]'s avatar
    • Cecile Tonglet's avatar
      Rework telemetry to replace the use of tracing with an object we pass around (#8143) · 8031b6ea
      Cecile Tonglet authored
      polkadot companion: paritytech/polkadot#2535
      8031b6ea
    • Andreas Doerr's avatar
      Fix doc build (#8322) · 7aaba0c1
      Andreas Doerr authored
      7aaba0c1
    • Peter Goodspeed-Niklaus's avatar
      Implement PJR checker (#8160) · 781f9087
      Peter Goodspeed-Niklaus authored
      
      
      * Apply.
      
      * get rid of glob import
      
      * use meaningful generic type name
      
      * pjr_check operates on `Supports` struct used elsewhere
      
      * improve algorithmic complexity of `prepare_pjr_input`
      
      * fix rustdoc warnings
      
      * improve module docs
      
      * typo
      
      * simplify debug assertion
      
      * add test finding the phase-change threshold value for a constructed scenario
      
      * add more threshold scenarios to disambiguate plausible interpretations
      
      * add link to npos paper reference
      
      * docs: staked_assignment -> supports
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * add utility method for generating npos inputs
      
      * add a fuzzer which asserts that all unbalanced seq_phragmen are PJR
      
      Note that this currently fails. I hope that this can be rectified
      by calculating the threshold instead of choosing some arbitrary number.
      
      * assert in all cases, not just debug
      
      * leverage a native solution to choose candidates
      
      * use existing helper methods
      
      * add pjr-check and incorporate into the fuzzer
      
      We should probably have one of the W3F people look at this to ensure
      we're not misconstruing any definitions, but this seems like a
      fairly straightforward implementation.
      
      * fix compilation errors
      
      * Enable manually setting iteration parameters in single run.
      
      This gives us the ability to reproducably extract cases where
      honggfuzz has discovered a panic. For example:
      
      $ cargo run --release --bin phragmen_pjr -- --candidates 569 --voters 100
      Tue 23 Feb 2021 11:23:39 AM CET
         Compiling bitflags v1.2.1
         Compiling unicode-width v0.1.8
         Compiling unicode-segmentation v1.7.1
         Compiling ansi_term v0.11.0
         Compiling strsim v0.8.0
         Compiling vec_map v0.8.2
         Compiling proc-macro-error-attr v1.0.4
         Compiling proc-macro-error v1.0.4
         Compiling textwrap v0.11.0
         Compiling atty v0.2.14
         Compiling heck v0.3.2
         Compiling clap v2.33.3
         Compiling structopt-derive v0.4.14
         Compiling structopt v0.3.21
         Compiling sp-npos-elections-fuzzer v2.0.0-alpha.5 (/home/coriolinus/Documents/Projects/paritytech/substrate/primitives/npos-elections/fuzzer)
          Finished release [optimized] target(s) in 6.15s
           Running `/home/coriolinus/Documents/Projects/paritytech/substrate/target/release/phragmen_pjr -c 569 -v 100`
      thread 'main' panicked at 'unbalanced sequential phragmen must satisfy PJR', primitives/npos-elections/fuzzer/src/phragmen_pjr.rs:133:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      
      This is still not adequate proof that seq_phragmen is broken; it could
      very well be that our PJR checker is doing the wrong thing, or we've
      somehow missed a parameter of interest. Still, it's concerning.
      
      * update comment verbiage for accuracy
      
      * it is valid in PJR for an elected candidate to have 0 support
      
      * Fix phragmen_pjr fuzzer
      
      It turns out that the fundamental problem causing previous implementations
      of the fuzzer to fail wasn't in `seq_phragmen` _or_ in `pjr_check`: it was
      in the rounding errors introduced in the various conversions between the
      internal data representation and the external one.
      
      Fixing the fuzzer is then simply an issue of using the internal representation
      and staying in that representation. However, that leaves the issue that
      `seq_phragmen` occasionally produces an output which is technically not
      PJR due to rounding errors. In the future we will need to add some kind of
      "close-enough" threshold. However, that is explicitly out of scope of
      this PR.
      
      * restart ci; it appears to be stalled
      
      * use necessary import for no-std
      
      * use a more realistic distribution of voters and candidates
      
      This isn't ideal; more realistic numbers would be about twice these.
      However, either case generation or voting has nonlinear execution
      time, and doubling these values brings iteration time from ~20s to
      ~180s. Fuzzing 6x as fast should make up for fuzzing cases half the size.
      
      * identify specifically which PJR check may fail
      
      * move candidate collection comment into correct place
      
      * standard_threshold: use a calculation method which cannot overflow
      
      * Apply suggestions from code review (update comments)
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * clarify the effectiveness bounds for t-pjr check
      
      * how to spell "committee"
      
      * reorganize: high -> low abstraction
      
      * ensure standard threshold calc cannot panic
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      
      Co-authored-by: default avatarkianenigma <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      781f9087