1. Apr 26, 2024
  2. Mar 18, 2024
    • Alexandru Gheorghe's avatar
      Fix kusama validators getting 0 backing rewards the first session they enter the active set (#3722) · 8d0cd4ff
      Alexandru Gheorghe authored
      There is a problem in the way we update `authorithy-discovery` next keys
      and because of that nodes that enter the active set would be noticed at
      the start of the session they become active, instead of the start of the
      previous session as it was intended. This is problematic because:
      
      1. The node itself advertises its addresses on the DHT only when it
      notices it should become active on around ~10m loop, so in this case it
      would notice after it becomes active.
      2. The other nodes won't be able to detect the new nodes addresses at
      the beginning of the session, so it won't added them to the reserved
      set.
      
      With 1 + 2, we end-up in a situation where the the new node won't be
      able to properly connect to its peers because it won't be in its peers
      reserved set. Now, the nodes accept by default`MIN_GOSSIP_PEERS: usize =
      25` connections to nodes that are not in the reserved set, but given
      Kusama size(> 1000 nodes) you could easily have more than`25` new nodes
      entering the active set or simply the nodes don't have slots anymore
      because, they already have connections to peers not in the active set.
      
      In the end what the node would notice is 0 backing rewards because it
      wasn't directly connected to the peers in its backing group.
      
      ## Root-cause
      
      The flow is like this:
      1. At BAD_SESSION - 1, in `rotate_session` new nodes are added to
      QueuedKeys
      https://github.com/paritytech/polkadot-sdk/blob/02e1a7f476d7d7c67153e975ab9a1bdc02ffea12/substrate/frame/session/src/lib.rs#L609
      ```
       <QueuedKeys<T>>::put(queued_amalgamated.clone());
      <QueuedChanged<T>>::put(next_changed);
      ```
      2. AuthorityDiscovery::on_new_session is called with `changed` being the
      value of `<QueuedChanged<T>>:` at BAD_SESSION - **2** because it was
      saved before being updated
      https://github.com/paritytech/polkadot-sdk/blob/02e1a7f476d7d7c67153e975ab9a1bdc02ffea12/substrate/frame/session/src/lib.rs#L613
      3. At BAD_SESSION - 1, `AuthorityDiscovery::on_new_session` doesn't
      updated its next_keys because `changed` was false.
      4. For the entire durations of `BAD_SESSION - 1` everyone calling
      runtime api `authorities`(should return past, present and future
      authorities) won't discover the nodes that should become active .
      5. At the beginning of BAD_SESSION, all nodes discover the new nodes are
      authorities, but it is already too late because reserved_nodes are
      updated only at the beginning of the session by the `gossip-support`.
      See above why this bad.
      
      ## Fix
      Update next keys with the queued_validators at every session, not matter
      the value of `changed` this is the same way babe pallet correctly does
      it.
      https://github.com/paritytech/polkadot-sdk/blob/02e1a7f476d7d7c67153e975ab9a1bdc02ffea12/substrate/frame/babe/src/lib.rs#L655
      
      
      
      ## Notes
      
      - The issue doesn't reproduce with proof-authorities changes like
      `versi` because `changed` would always be true and `AuthorityDiscovery`
      correctly updates its next_keys every time.
      - Confirmed at session `37651` on kusama that this is exactly what it
      happens by looking at blocks with polkadot.js.
      
      ## TODO
      - [ ] Move versi on proof of stake and properly test before and after
      fix to confirm there is no other issue.
      
      ---------
      
      Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      8d0cd4ff
  3. Feb 28, 2024
  4. Feb 22, 2024
  5. Jan 18, 2024
  6. Aug 31, 2023
  7. Aug 23, 2023
    • juangirini's avatar
      Restructure `frame_support` macro related exports (#14745) · 878c562c
      juangirini authored
      
      
      * make reexports private
      
      * make reexports private 2
      
      * make reexports private for runtime-benchmarking
      
      * make reexports private for try-runtime
      
      * fix for try-runtime
      
      * make reexports private for tests
      
      * fmt
      
      * make reexports private for tests
      
      * make reexports private for experimental
      
      * fix beefy
      
      * fix ui test
      
      * fix ui test
      
      * fix benches
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * fix contracts use
      
      * wip
      
      * wip
      
      * do not reexport sp_api::metadata_ir
      
      * fix CI checks
      
      * fix support tests
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Update frame/support/src/lib.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * import codec directly
      
      * fmt
      
      * fix node-cli tests
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      878c562c
  8. Jul 13, 2023
    • gupnik's avatar
      Moves `Block` to `frame_system` instead of `construct_runtime` and removes... · 5e7b27e9
      gupnik authored
      
      Moves `Block` to `frame_system` instead of `construct_runtime` and removes `Header` and `BlockNumber` (#14437)
      
      * Initial setup
      
      * Adds node block
      
      * Uses UncheckedExtrinsic and removes Where section
      
      * Updates frame_system to use Block
      
      * Adds deprecation warning
      
      * Fixes pallet-timestamp
      
      * Removes Header and BlockNumber
      
      * Addresses review comments
      
      * Addresses review comments
      
      * Adds comment about compiler bug
      
      * Removes where clause
      
      * Refactors code
      
      * Fixes errors in cargo check
      
      * Fixes errors in cargo check
      
      * Fixes warnings in cargo check
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Uses import instead of full path for BlockNumber
      
      * Uses import instead of full path for Header
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Fixes imports in benchmarks
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Formatting
      
      * Minor updates
      
      * Fixes construct_runtime ui tests
      
      * Fixes construct_runtime ui tests with 1.70
      
      * Fixes docs
      
      * Fixes docs
      
      * Adds u128 mock block type
      
      * Fixes split example
      
      * fixes for cumulus
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Updates new tests
      
      * Fixes fully-qualified path in few places
      
      * Formatting
      
      * Update frame/examples/default-config/src/lib.rs
      
      Co-authored-by: default avatarJuan <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarJuan <[email protected]>
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Addresses some review comments
      
      * Fixes build
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Update frame/democracy/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/democracy/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Addresses review comments
      
      * Updates trait bounds
      
      * Minor fix
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Removes unnecessary bound
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Updates test
      
      * Fixes build
      
      * Adds a bound for header
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Removes where block
      
      * Minor fix
      
      * Minor fix
      
      * Fixes tests
      
      * ".git/.scripts/commands/update-ui/update-ui.sh" 1.70
      
      * Updates test
      
      * Update primitives/runtime/src/traits.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Update primitives/runtime/src/traits.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Updates doc
      
      * Updates doc
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarJuan <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      5e7b27e9
  9. Jul 12, 2023
    • Michal Kucharczyk's avatar
      `GenesisBuild<T,I>` deprecated. `BuildGenesisConfig` added. (#14306) · 87d41d0a
      Michal Kucharczyk authored
      
      
      * frame::support: GenesisConfig types for Runtime enabled
      
      * frame::support: macro generating GenesisBuild::build for RuntimeGenesisConfig
      
      * frame: ambiguity BuildStorage vs GenesisBuild fixed
      
      * fix
      
      * RuntimeGenesisBuild added
      
      * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"
      
      This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293.
      
      * Revert "fix"
      
      This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b.
      
      * Revert "RuntimeGenesisBuild added"
      
      This reverts commit 3c131b618138ced29c01ab8d15d8c6410c9e128b.
      
      * Revert "Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed""
      
      This reverts commit 2b1ecd467231eddec69f8d328039ba48a380da3d.
      
      * Revert "Revert "fix""
      
      This reverts commit fd7fa629adf579d83e30e6ae9fd162637fc45e30.
      
      * Code review suggestions
      
      * frame: BuildGenesisConfig added, BuildGenesis deprecated
      
      * frame: some pallets updated with BuildGenesisConfig
      
      * constuct_runtime: support for BuildGenesisConfig
      
      * frame::support: genesis_build macro supports BuildGenesisConfig
      
      * frame: BuildGenesisConfig added, BuildGenesis deprecated
      
      * Cargo.lock update
      
      * test-runtime: fixes
      
      * Revert "fix"
      
      This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b.
      
      * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"
      
      This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293.
      
      * self review
      
      * doc fixed
      
      * ui tests fixed
      
      * fmt
      
      * tests fixed
      
      * genesis_build macrto fixed for non-generic GenesisConfig
      
      * BuildGenesisConfig constraints added
      
      * warning fixed
      
      * some duplication removed
      
      * fmt
      
      * fix
      
      * doc tests fix
      
      * doc fix
      
      * cleanup: remove BuildModuleGenesisStorage
      
      * self review comments
      
      * fix
      
      * Update frame/treasury/src/tests.rs
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      
      * Update frame/support/src/traits/hooks.rs
      
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      
      * doc fix: GenesisBuild exposed
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * frame: more serde(skip) + cleanup
      
      * Update frame/support/src/traits/hooks.rs
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * frame: phantom fields moved to the end of structs
      
      * chain-spec: Default::default cleanup
      
      * test-runtime: phantom at the end
      
      * merge master fixes
      
      * fix
      
      * fix
      
      * fix
      
      * fix
      
      * fix (facepalm)
      
      * Update frame/support/procedural/src/pallet/expand/genesis_build.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * fmt
      
      * fix
      
      * fix
      
      ---------
      
      Co-authored-by: parity-processbot <>
      Co-authored-by: default avatarSebastian Kunert <[email protected]>
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      87d41d0a
  10. May 20, 2023
    • Michal Kucharczyk's avatar
      frame: Enable GenesisConfig in no_std (#14108) · 613420a0
      Michal Kucharczyk authored
      * frame: Default for GenesisConfig in no_std
      
      `Default` for `GenesisConfig` will be required for no_std in no native
      runtime world. It must be possible to instantiate default GenesisConfig
      for pallets and runtime.
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * hash69 in no_std reverted
      
      * derive(DefaultNoBound) for GenesisConfig used when possible
      
      * treasury: derive(Default)
      
      * Cargo.lock update
      
      * genesis_config: compiler error improved
      
      When std feature is not enabled for pallet, the GenesisConfig will be
      defined, but serde::{Serialize,Deserialize} traits will not be
      implemented.
      
      The compiler error indicates the reason of latter errors.
      
      This is temporary and serde traits will be enabled with together with
      `serde` support in frame.
      
      ---------
      
      Co-authored-by: command-bot <>
      613420a0
  11. Apr 11, 2023
  12. Mar 13, 2023
    • Vivek Pandya's avatar
      Remove use of trait Store from all pallets and deprecate it. (#13535) · 2009821c
      Vivek Pandya authored
      * Remove use of trait Store from staking pallet
      
      * Remove use of trait Store from bounties pallet
      
      * Remove use of trait Store from collective pallet
      
      * Remove use of trait Store from babe pallet
      
      * Remove use of trait Store from assets pallet
      
      * Remove use of trait Store from grandpa pallet
      
      * Remove use of trait Store from balances pallet
      
      * Remove use of trait Store from authorship pallet
      
      * Remove use of trait Store from authority-discovery pallet
      
      * Remove use of trait Store from atomic-swap pallet
      
      * Remove use of trait Store from sudo pallet
      
      * Remove use of trait Store from scheduler pallet
      
      * Remove use of trait Store from scored-pool pallet
      
      * Remove use of trait Store from society pallet
      
      * Remove use of trait Store from lottery pallet
      
      * Remove use of trait Store from executive pallet
      
      * Remove use of trait Store from democracy pallet
      
      * Remove use of trait Store from elections-phragmen pallet
      
      * Remove use of trait Store from indices pallet
      
      * Remove use of trait Store from identity pallet
      
      * Remove use of trait Store from multisig pallet
      
      * Remove use of trait Store from merkle-mountain-range pallet
      
      * Remove use of trait Store from im-online pallet
      
      * Remove use of trait Store from membership pallet
      
      * Remove use of trait Store from nicks pallet
      
      * Remove use of trait Store from session pallet
      
      * Remove use of trait Store from transaction-payment pallet
      
      * Remove use of trait Store from utility pallet
      
      * Remove use of trait Store from child-bounties pallet
      
      * Remove use of trait Store from nis pallet
      
      * Remove use of trait Store from nfts pallet
      
      * Remove use of trait Store from conviction-voting pallet
      
      * Remove use of trait Store from treasury pallet
      
      * Remove use of trait Store from vesting pallet
      
      * Remove use of trait Store from preimage pallet
      
      * Remove use of trait Store from uniques pallet
      
      * Remove use of trait Store from ranked-collective pallet
      
      * Remove use of trait Store from beefy-mmr pallet
      
      * Remove use of trait Store from referenda pallet
      
      * Remove use of trait Store from whitelist pallet
      
      * Remove use of trait Store from alliance pallet
      
      * Remove use of trait Store from nomination-pools pallet
      
      * Remove use of trait Store from state-trie-migration pallet
      
      * Remove use of trait Store from message-queue pallet
      
      * Remove use of trait Store from root-offences pallet
      
      * Remove use of trait Store from root-testing pallet
      
      * Remove use of trait Store from timestamps pallet
      
      * Remove use of trait Store from system pallet
      
      * Remove use of trait Store from offences pallet
      
      * Remove use of trait Store from recovery pallet
      
      * Remove use of trait Store from node-authorization pallet
      
      * Remove use of trait Store from proxy pallet
      
      * Remove use of trait Store from benchmarking pallet
      
      * Remove use of trait Store from bags-list pallet
      
      * Add deprecated warning in store_trait
      
      * Change warning message
      
      * Run cargo fmt
      
      * Fix warning and update tests
      
      * Remove unnecessary allow deprecated
      
      * Remove use of trait Store
      
      * Fix mismatch in expected output
      
      * Minor update to warning message for deprecation of generate_store with Store trait attribute
      
      * Fixes as per review comments
      
      * Fixes as per review suggestions
      
      * Remove use of Store trait from core-fellowship pallet
      
      * Fix type in store_trait.rs
      
      * Fixes as pre review comment
      2009821c
  13. Feb 21, 2023
    • Vivek Pandya's avatar
      Remove years from copyright notes. (#13415) · bc53b9a0
      Vivek Pandya authored
      * Change copyright year to 2023 from 2022
      
      * Fix incorrect update of copyright year
      
      * Remove years from copy right header
      
      * Fix remaining files
      
      * Fix typo in a header and remove update-copyright.sh
      bc53b9a0
  14. Feb 14, 2023
  15. Dec 12, 2022
  16. Sep 12, 2022
    • Sergej Sakac's avatar
      BREAKING: Rename Call & Event (#11981) · 6e8795af
      Sergej Sakac authored
      
      
      * rename Event to RuntimeEvent
      
      * rename Call
      
      * rename in runtimes
      
      * small fix
      
      * rename Event
      
      * small fix & rename RuntimeCall back to Call for now
      
      * small fixes
      
      * more renaming
      
      * a bit more renaming
      
      * fmt
      
      * small fix
      
      * commit
      
      * prep for renaming associated types
      
      * fix
      
      * rename associated Event type
      
      * rename to RuntimeEvent
      
      * commit
      
      * merge conflict fixes & fmt
      
      * additional renaming
      
      * fix.
      
      * fix decl_event
      
      * rename in tests
      
      * remove warnings
      
      * remove accidental rename
      
      * .
      
      * commit
      
      * update .stderr
      
      * fix in test
      
      * update .stderr
      
      * TRYBUILD=overwrite
      
      * docs
      
      * fmt
      
      * small change in docs
      
      * rename PalletEvent to Event
      
      * rename Call to RuntimeCall
      
      * renamed at wrong places :P
      
      * rename Call
      
      * rename
      
      * rename associated type
      
      * fix
      
      * fix & fmt
      
      * commit
      
      * frame-support-test
      
      * passing tests
      
      * update docs
      
      * rustdoc fix
      
      * update .stderr
      
      * wrong code in docs
      
      * merge fix
      
      * fix in error message
      
      * update .stderr
      
      * docs & error message
      
      * .
      
      * merge fix
      
      * merge fix
      
      * fmt
      
      * fmt
      
      * merge fix
      
      * more fixing
      
      * fmt
      
      * remove unused
      
      * fmt
      
      * fix
      
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      6e8795af
  17. Aug 31, 2022
    • Shawn Tabrizi's avatar
      Weight v1.5: Opaque Struct (#12138) · 30951822
      Shawn Tabrizi authored
      * initial idea
      
      * update frame_support
      
      * update a bunch more
      
      * add ord
      
      * adjust RuntimeDbWeight
      
      * frame_system builds
      
      * re-export
      
      * frame_support tests pass
      
      * frame_executive compile
      
      * frame_executive builds
      
      * frame_system tests passing
      
      * pallet-utility tests pass
      
      * fix a bunch of pallets
      
      * more
      
      * phragmen
      
      * state-trie-migration
      
      * scheduler and referenda
      
      * pallet-election-provider-multi-phase
      
      * aura
      
      * staking
      
      * more
      
      * babe
      
      * balances
      
      * bunch more
      
      * sudo
      
      * transaction-payment
      
      * asset-tx-payment
      
      * last pallets
      
      * fix alliance merge
      
      * fix node template runtime
      
      * fix pallet-contracts cc @athei
      
      * fix node runtime
      
      * fix compile on runtime-benchmarks feature
      
      * comment
      
      * fix frame-support-test
      
      * fix more tests
      
      * weight regex
      
      * frame system works
      
      * fix a bunch
      
      * more
      
      * more
      
      * more
      
      * more
      
      * more
      
      * more fixes
      
      * update templates
      
      * fix contracts benchmarks
      
      * Update lib.rs
      
      * Update lib.rs
      
      * fix ui
      
      * make scalar saturating mul const
      
      * more const functions
      
      * scalar div
      
      * refactor using constant functions
      
      * move impl
      
      * fix overhead template
      
      * use compactas
      
      * Update lib.rs
      30951822
  18. May 17, 2022
  19. Apr 30, 2022
  20. Apr 29, 2022
  21. Jan 20, 2022
  22. Jan 05, 2022
  23. Jan 03, 2022
  24. Dec 15, 2021
  25. Dec 13, 2021
  26. Nov 20, 2021
    • Doordashcon's avatar
      tuple to struct event variants (#10257) · 09d351dd
      Doordashcon authored
      * AFNPEV recovery
      
      * AFNPEV session
      
      * cargo +nightly fmt && cargo fmt
      
      * removed redundant comments
      
      * update
      
      * update & cargo +nightly fmt
      
      * update & cargo +nightly fmt
      
      * update recovery/src/lib.rs
      
      * update session/src/lib.rs
      09d351dd
  27. Nov 17, 2021
  28. Nov 07, 2021
  29. Oct 14, 2021
  30. Oct 06, 2021
  31. Sep 28, 2021
  32. Sep 20, 2021
    • Georges's avatar
      Generate storage info for pallet im_online (#9654) · cddafd52
      Georges authored
      * Integrating WrapperOpaque from PR #9738
      
      * Adding storage_info to pallet im-online
      Changing some `Vec` to `WeakBoundedVec`
      Adding the following bounds:
      * `MaxKeys
      * `MaxPeerInHeartbeats`
      * `MaxPeerDataEncodingSize`
      to limit the size of `WeakBoundedVec`
      
      * Fix syntax
      
      * Need to clone keys
      
      * Changes in formatting
      cddafd52
  33. Aug 11, 2021
  34. Aug 03, 2021
  35. Jul 21, 2021
    • Bastian Köcher's avatar
      Run cargo fmt on the whole code base (#9394) · 7b56ab15
      Bastian Köcher authored
      * Run cargo fmt on the whole code base
      
      * Second run
      
      * Add CI check
      
      * Fix compilation
      
      * More unnecessary braces
      
      * Handle weights
      
      * Use --all
      
      * Use correct attributes...
      
      * Fix UI tests
      
      * AHHHHHHHHH
      
      * 🤦
      
      * Docs
      
      * Fix compilation
      
      * 🤷
      
      * Please stop
      
      * 🤦
      
       x 2
      
      * More
      
      * make rustfmt.toml consistent with polkadot
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      7b56ab15
  36. Jul 16, 2021
  37. Jun 14, 2021
  38. Jun 12, 2021
  39. May 29, 2021
  40. Apr 06, 2021