1. Feb 27, 2023
  2. Feb 21, 2023
  3. Feb 20, 2023
    • Michal Kucharczyk's avatar
      `BlockId` removal: `runtime-api` refactor (#13255) · 7a101541
      Michal Kucharczyk authored
      
      
      * BlockId removal: refactor of runtime API
      
      It changes the arguments of:
      - `ApiExt` methods:  `has_api`, `has_api_with`, `api_version`
      - `CallApiAt` method: `runtime_version_at`
      from: `BlockId<Block>` to: `Block::Hash`
      
      It also changes the first argument of all generated runtime API calls from: `BlockId<Block>` to: `Block::Hash`
      
      This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
      
      * BlockId removal: refactor of runtime API - tests
      
      - tests adjusted to new runtime API,
      - some tests migrated from block number to block hash
      
      * benchmarking-cli: BlockId(0) migrated to info().genesis_hash
      
      `runtime_api.call()` now requires the block hash instead of BlockId::Number.
      To access the genesis hash widely used in benchmarking engine the Client
      was constrained to satisfy `sp_blockchain::HeaderBackend<Block>` trait
      which provides `info().genesis_hash`.
      
      * trivial: api.call(BlockId) -> api.call(Hash)
      
      - Migrated all `runtime_api.calls` to use Hash
      - Noteworthy (?):
      -- `validate_transaction_blocking` in transaction pool,
      
      * CallApiAtParams::at changed to Block::Hash
      
      * missed doc updated
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * BlockId removal: Benchmark::consumed_weight
      
      Little refactor around `Benchmark::consumed_weight`: `BlockId` removed.
      
      * at_hash renamed
      
      * wrong merge fixed
      
      * beefy worker: merged with master
      
      * beefy: tests: missing block problem fixed
      
      * Apply review suggestion
      
      * fix
      
      ---------
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      Co-authored-by: command-bot <>
      7a101541
    • Adrian Catangiu's avatar
      client/beefy: drop justification on import if pallet not enabled (#13422) · bd8cb7ba
      Adrian Catangiu authored
      
      
      BEEFY pallet allows setting on-chain BEEFY genesis to some future
      block. Disregard any BEEFY justifications attached to imported blocks
      that predate configured BEEFY genesis.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      bd8cb7ba
  4. Feb 17, 2023
    • Adrian Catangiu's avatar
      BEEFY: implement equivocations detection, reporting and slashing (#13121) · c21f292a
      Adrian Catangiu authored
      
      
      * client/beefy: simplify self_vote logic
      
      * client/beefy: migrate to new state version
      
      * client/beefy: detect equivocated votes
      
      * fix typos
      
      * sp-beefy: add equivocation primitives
      
      * client/beefy: refactor vote processing
      
      * fix version migration for new rounds struct
      
      * client/beefy: track equivocations and create proofs
      
      * client/beefy: adjust tests for new voting logic
      
      * sp-beefy: fix commitment ordering and equality
      
      * client/beefy: simplify handle_vote() a bit
      
      * client/beefy: add simple equivocation test
      
      * client/beefy: submit equivocation proof - WIP
      
      * frame/beefy: add equivocation report runtime api - part 1
      
      * frame/beefy: report equivocation logic - part 2
      
      * frame/beefy: add pluggable Equivocation handler - part 3
      
      * frame/beefy: impl ValidateUnsigned for equivocations reporting
      
      * client/beefy: submit report equivocation unsigned extrinsic
      
      * primitives/beefy: fix tests
      
      * frame/beefy: add default weights
      
      * frame/beefy: fix tests
      
      * client/beefy: fix tests
      
      * frame/beefy-mmr: fix tests
      
      * frame/beefy: cross-check session index with equivocation report
      
      * sp-beefy: make test Keyring useable in pallet
      
      * frame/beefy: add basic equivocation test
      
      * frame/beefy: test verify equivocation results in slashing
      
      * frame/beefy: test report_equivocation_old_set
      
      * frame/beefy: add more equivocation tests
      
      * sp-beefy: fix docs
      
      * beefy: simplify equivocations and fix tests
      
      * client/beefy: address review comments
      
      * frame/beefy: add ValidateUnsigned to test/mock runtime
      
      * client/beefy: fixes after merge master
      
      * fix missed merge damage
      
      * client/beefy: add test for reporting equivocations
      
      Also validated there's no unexpected equivocations reported in the
      other tests.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      
      * sp-beefy: move test utils to their own file
      
      * client/beefy: add negative test for equivocation reports
      
      * sp-beefy: move back MmrRootProvider - used in polkadot-service
      
      * impl review suggestions
      
      * client/beefy: add equivocation metrics
      
      ---------
      
      Signed-off-by: default avataracatangiu <[email protected]>
      Co-authored-by: parity-processbot <>
      c21f292a
  5. Feb 16, 2023
    • dharjeezy's avatar
      client/beefy: add more metrics for production visibility (#12910) · 292e5ee4
      dharjeezy authored
      
      
      * few beefy metrics
      
      * more beefy metrics
      
      * some beefy metrics
      
      * some beefy metrics
      
      * more metrics
      
      * other metrics
      
      * fix tests
      
      * merge changes
      
      * Apply suggestions from code review
      
      * client/beefy: fix metrics
      
      * client/beefy: separate metrics per component, avoid double registering
      
      * client/beefy: deduplicate metrics registration code
      
      * remove unused metric
      
      * impl review suggestions
      
      ---------
      
      Co-authored-by: default avatarAdrian Catangiu <[email protected]>
      292e5ee4
  6. Feb 13, 2023
    • Adrian Catangiu's avatar
      client/beefy: request justifs from peers further in consensus (#13343) · d01e675f
      Adrian Catangiu authored
      
      
      For on-demand justifications, peer selection is based on witnessed
      gossip votes. This commit changes the condition for selecting a peer
      to request justification for `block` from
      "last voted on >= `block`" to "peer last voted on strict > `block`".
      
      When allowing `>=` we see nodes continuously spamming unsuccessful
      on-demand requests to nodes which are still voting on a block without
      having a justification available.
      
      One way to fix the spam would be to add some rate-limiting or backoff
      period when requesting justifications.
      
      The other solution (present in this commit) is to simply request
      justifications from peers that are voting on future blocks so we know
      they're _guaranteed_ to have the wanted mandatory justification
      available to send back.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      d01e675f
  7. Feb 06, 2023
  8. Feb 03, 2023
    • Adrian Catangiu's avatar
      BEEFY: define on-chain beefy-genesis and use it to coordinate voter initialization (#13215) · 981ffb29
      Adrian Catangiu authored
      * beefy: add support to configure BEEFY genesis
      
      * client/beefy: more flexible test runtime api
      
      * client/beefy: add tests for custom BEEFY genesis
      
      * client/beefy: ignore old state that didn't account for pallet genesis
      
      * client/beefy: fix clippy
      
      * frame/beefy: default BEEFY-genesis is block One::one()
      
      * frame/beefy: add extra doc comments
      
      ---------
      
      Co-authored-by: parity-processbot <>
      981ffb29
  9. Jan 27, 2023
  10. Jan 24, 2023
  11. Jan 19, 2023
  12. Jan 13, 2023
  13. Jan 12, 2023
  14. Dec 23, 2022
  15. Dec 20, 2022
    • Michal Kucharczyk's avatar
      `BlockId` removal: refactor: `HeaderBackend::header` (#12874) · 548955a7
      Michal Kucharczyk authored
      * BlockId removal: refactor: HeaderBackend::header
      
      It changes the arguments of:
      - `HeaderBackend::header`,
      - `Client::header`,
      - `PeersClient::header`
      - `ChainApi::block_header`
      
      methods from: `BlockId<Block>` to: `Block::Hash`
      
      This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
      
      * non-trivial usages of haeder(block_id) refactored
      
      This may required introduction of dedicated function:
      header_for_block_num
      
      * fmt
      
      * fix
      
      * doc fixed
      
      * ".git/.scripts/fmt.sh"
      
      * BlockId removal: refactor: HeaderBackend::expect_header
      
      It changes the arguments of `HeaderBackend::expect_header` method from: `BlockId<Block>` to: `Block::Hash`
      
      * ".git/.scripts/fmt.sh"
      
      * readme updated
      
      * ".git/.scripts/fmt.sh"
      
      * fix
      
      Co-authored-by: parity-processbot <>
      548955a7
  16. Dec 19, 2022
    • Michal Kucharczyk's avatar
      sc-network-test::Peer: block push methods return hashes vec (#12944) · 1be51ccb
      Michal Kucharczyk authored
      
      
      * sc-network-test::Peer: block push methods return hashes vec
      
      This commit reworks the block generation/push methods in
      sc-network-test::Peer.
      
      Now methods are providing the vector of hashes that were built.
      
      This allows to get rid of redundant `block_hash_from_id` call, as all
      hashes are known just after being built.
      
      Similar approach was taken in BeefyTestNet::generate_blocks_and_sync
      method.
      
      This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
      
      * fix
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      1be51ccb
    • Qinxuan Chen's avatar
      *: update `rand` to v0.8.5 (#12962) · 40c04cf1
      Qinxuan Chen authored
      * *: update rand to v0.8.5
      
      * *: remove useless deps from Cargo.toml
      
      * fix pallet-session-benchmarking
      
      * fix pallet-election-provider-support test
      
      * remove useless rand from dev-dependencies
      40c04cf1
  17. Dec 16, 2022
  18. Dec 15, 2022
  19. Dec 12, 2022
    • Niklas Adolfsson's avatar
      rpc server with HTTP/WS on the same socket (#12663) · 84303ca7
      Niklas Adolfsson authored
      * jsonrpsee v0.16
      
      add backwards compatibility
      
      run old http server on http only
      
      * cargo fmt
      
      * update jsonrpsee 0.16.1
      
      * less verbose cors log
      
      * fix nit in log: WS -> HTTP
      
      * revert needless changes in Cargo.lock
      
      * remove unused features in tower
      
      * fix nits; add client-core feature
      
      * jsonrpsee v0.16.2
      84303ca7
  20. Dec 06, 2022
  21. Dec 05, 2022
    • dharjeezy's avatar
      client/beefy: add some bounds on enqueued votes (#12562) · 91e6de05
      dharjeezy authored
      
      
      Introduce bounds on the justifications and votes queues, so they do not grow forever if voter cannot make progress and consume from them. When bounds are hit, new votes or justifications get dropped.
      
      * use a BTreeMap and check for bounds
      
      * cargo fmt
      
      * use usize
      
      Co-authored-by: default avatarAdrian Catangiu <[email protected]>
      91e6de05
    • Dmitry Markin's avatar
      Upgrade tokio to 1.22.0 and replace async-std with tokio (#12646) · 5eb84f9c
      Dmitry Markin authored
      * Replace deprecated libp2p feature specs with correct ones
      
      * Bump tokio to 1.21.2
      
      * Replace async-std libp2p primitives with tokio ones
      
      * minor: rustfmt
      
      * Fix TestNet to run initialization in the tokio context
      
      * Convert telemetry test from async-std to tokio
      
      * Convert notifications tests from async-std to tokio
      
      * Convert chain sync tests from async-std to tokio
      
      * Ditch async-std completely
      
      * Make executor mandatory
      
      * Bump tokio to 1.22.0
      
      * minor: rustfmt
      
      * Explicitly use tokio runtime in tests
      
      * Move more tests to explicit tokio runtime
      
      * Explicitly set multithreaded runtime in tokio test
      
      * minor: rustfmt
      
      * minor: fix comment
      
      * Replace async-std with tokio in MMR tests
      5eb84f9c
  22. Nov 28, 2022
  23. Nov 23, 2022
  24. Nov 21, 2022
    • Adrian Catangiu's avatar
      client/beefy: persist voter state (#12712) · 3e7a2778
      Adrian Catangiu authored
      
      
      * client/beefy: prepare worker for persisting state
      
      * client/beefy: persist voter state
      
      * client/beefy: initialize persistent state
      
      * client/beefy: try to vote from the very beginning
      
      Now that voter is initialized from persistent state, it makes
      sense that it can attempt voting right away. This also helps
      the genesis case when we consider block `One` as mandatory.
      
      * client/beefy: add tests for voter state db
      * client/beefy: persist voter state as soon as initialized
      * client/beefy: make sure min-block-delta is at least 1
      * client/beefy: persist state after voting
      
      Persist state after handling self vote to avoid double voting in case
      of voter restarts.
      
      * client/beefy: persist state after handling mandatory block vote
      
      For mandatory blocks we want to make sure we're not losing votes
      in case of crashes or restarts, since voter will not make further
      progress without finalizing them.
      
      * frame/beefy: use GENESIS_AUTHORITY_SET_ID on pallet genesis
      
      * client/beefy: initialize voter at either genesis or last finalized
      To guarantee unbroken chain of mandatory blocks justifications, voter
      will always resume from either last BEEFY-justified block or
      `pallet-beefy` genesis, whichever is more recent.
      
      Initialization walks back the chain from latest GRANDPA finalized
      block looking for one of the above. Along the way, it also records
      and enqueues for processing any BEEFY mandatory blocks that have
      been already GRANDPA finalized but not BEEFY finalized.
      
      * client/beefy: decouple voter init from aux db state load
      * client/beefy: fix voter init tests
      * remove debug prints
      * gadget future must be type ()
      * fix init from last justification
      
      Signed-off-by: default avatarAdrian Catangiu <[email protected]>
      3e7a2778
  25. Nov 16, 2022
  26. Nov 15, 2022
  27. Nov 09, 2022
    • Robert Hambrock's avatar
      Consolidate and deduplicate MMR API methods (#12530) · 53f97350
      Robert Hambrock authored
      
      
      * histor. batch proof: make best block arg optional
      
      * correct testing range
      
      * make generate_batch_proof stub for historical
      
      * merge generate_{historical_}batch_proof functions
      
      * merge generate_{batch_}proof functions
      
      * merge verify_{batch_}proof functions
      
      * merge verify_{batch_}proof_stateless functions
      
      * remove {Leaf}Proof
      
      Not utilized by API anymore, so superfluous.
      Removal consistent with prior changes to just use "batch" proof API.
      
      * rename BatchProof->Proof
      
      no need to qualify if only one universal proof type.
      
      * cleanup
      
      * expose verify_proof rpc api
      
      * document verify_proof
      
      * expose verify_proof_stateless rpc api
      
      * add optional BlockHash to mmr_root rpc api
      
      * fixup! expose verify_proof rpc api
      
      * fix documentation phrasing
      
      Co-authored-by: default avatarAdrian Catangiu <[email protected]>
      
      * documentation grammar
      
      Co-authored-by: default avatarAdrian Catangiu <[email protected]>
      
      * define mmr error msgs together with error enum
      
      Co-authored-by: default avatarSerban Iorga <[email protected]>
      
      * fixup! define mmr error msgs together with error enum
      
      * map decoding errors to CallError::InvalidParams
      
      Co-authored-by: default avatarSerban Iorga <[email protected]>
      
      * fixup! map decoding errors to CallError::InvalidParams
      
      Co-authored-by: default avatarAdrian Catangiu <[email protected]>
      Co-authored-by: parity-processbot <>
      Co-authored-by: default avatarSerban Iorga <[email protected]>
      53f97350
  28. Nov 07, 2022
  29. Nov 02, 2022
  30. Oct 31, 2022
  31. Oct 30, 2022
  32. Oct 24, 2022
  33. Oct 20, 2022
    • Michal Kucharczyk's avatar
      BlockId removal: refactor: BlockImportOperation+Bknd::finalize_block (#12535) · 42215038
      Michal Kucharczyk authored
      * BlockId removal: refactor: BlockImportOperation+Bknd::finalize_block
      
      It changes the arguments of methods of `BlockImportOperation` trait
      from: block: `BlockId<Block>` to: hash: `&Block::Hash`
      `Backend::finalize_block` was also changed.
      
      This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
      
      * Review suggestion applied
      
      thx to @davxy
      
      * trigger CI job
      42215038
    • Michal Kucharczyk's avatar
      BlockId removal: refactor: Finalizer (#12528) · 749bcd19
      Michal Kucharczyk authored
      * BlockId removal: refactor: Finalizer
      
      It changes the arguments of methods of `Finalizer` trait from:
      block: `BlockId<Block>` to: hash: `&Block::Hash`
      
      This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
      
      * minor corrections
      
      * failing test corrected
      
      * minor rework
      749bcd19
  34. Oct 17, 2022
  35. Oct 13, 2022