1. Oct 24, 2023
  2. Aug 02, 2023
    • drskalman's avatar
      Support for multiple signature scheme for BEEFY primitves (#14373) · 3fef703e
      drskalman authored
      
      
      * Merged BEEFY primitives with generic signature and keyset commitment support from old pull to current code
      
      * - Add bls-experimental feature to application-crypto and beefy primitives
      - Fix remaining crypto -> ecdsa_crypto
      - code build but not tests
      
      * Make beefy primitive tests compile
      
      * move bls related beefy primitives code and test behind bls-experimental flag
      
      * Make BEEFY clients complies with BEEFY API depending on AuthorityId
      
      * - Rename `BeefyAuthoritySet.root` → `BeefyAuthoritySet.keyset_commitment`.
      - Remove apk proof keyset_commitment from `BeefyAuthoritySet`.
      - Fix failing signed commitment and signature to witness test.
      - Make client compatible with BeefyAPI generic on AuthorityId.
      - `crypto` → `ecdsa_crypto` in BEEFY client and frame.
      
      * Commit Cargo lock remove ark-serialize from BEEFY primitives
      
      * Use Codec instead of Encode + Decode in primitives/consensus/beefy/src/lib.rs
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * - Make `BeefyApi` generic over Signature type.
      - Make new `BeeyApi` functinos also generic over AuthorityId and Signature
      
      * Unmake BeefyAPI generic over Signature. Recover Signature type from AuthId.
      
      * - dont use hex or hex-literal use array-bytes instead in beefy primitives and bls crypto.
      - CamelCase ECDSA and BLS everywhere.
      
      * Move the definition of BEEFY key type from `primitives/beefy` to `crypto.rs` according to new convention.
      
      * - Add bls377_generate_new to `sp-io` and `application_crypto::bls`.
      - Add `bls-experimental` to `sp-io`
      
      Does not compile because PassByCodec can not derive PassBy using customly implemented PassByIner.
      
      * Implement PassBy for `bls::Public` manually
      
      * fix Beefy `KEY_TYPE` in `frame/beefy` tests to come from `sp-core::key_types` enum
      
      * specify both generic for `hex2array_unchecked` in `sp-core/bls.rs`
      
      * Rename `crypto`→`ecdsa_crypto` in `primitives/consensus/beefy/src/test_utils.rs` docs
      
      * remove commented-out code in `primitives/consensus/beefy/src/commitment.rs`
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * Fix inconsistency in panic message in  `primitives/io/src/lib.rs`
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * Remove redundant feature activation in `primitives/io/Cargo.toml`
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * - make `w3f-bls` a dev-dependancy only for beefy primitives.
      
      - clean up comments.
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * export BEEFY KEY_TYPE from primitives/consensus/beefy
      make `frame/consensus/beefy` in dependent of sp_crypto_app
      use consistent naming in the beefy primitive tests.
      
      * - implement `BeefyAuthorityId` for `bls_crypto::AuthorityId`.
      - implement `bls_verify_works` test for BEEFY `bls_crypto`.
      
      * Remove BEEFY `ecdsa_n_bls_crypto` for now for later re-introduction
      
      * Make commitment and witness BEEFY tests not use Keystore.
      
      * put `bls_beefy_verify_works` test under `bls-experimental` flag.
      
      * bump up Runtime `BeefyAPI` to version 3 due to introducing generic AuthorityId.
      
      * reuse code and encapsulate w3f-bls backend in sp-core as most as possible
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * Make comments in primities BEEFY `commitment.rs` and `witness.rs``tests convention conforming
      
      * Use master dep versions
      
      * Trivial change. Mostly to trigger CI
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      
      * Fix Cargo.toml
      
      * Trigger CI with cumulus companion
      
      * Trigger CI after polkadot companion change
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarAndré Silva <[email protected]>
      3fef703e
  3. May 31, 2023
    • Adrian Catangiu's avatar
      pallet-beefy-mmr: fix when using custom hashing (#14273) · b43a1b0b
      Adrian Catangiu authored
      
      
      `Hash` is no longer part of `pallet_mmr::Config`, but this code
      would still build because it assumes we're referring to underlying
      `<pallet_mmr::Config as frame_system::Config>::Hash` which is not
      what we want when using different hashing between `frame_system`
      and `pallet_mmr`.
      
      Disambiguate by using correct `pallet_mmr::Config::Hashing` type.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      b43a1b0b
  4. Apr 11, 2023
  5. Mar 03, 2023
  6. Feb 28, 2023
  7. 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
  8. 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
  9. Feb 06, 2023
  10. 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
  11. Jan 13, 2023
  12. 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
  13. Oct 07, 2022
  14. Oct 06, 2022
    • Adrian Catangiu's avatar
      Add pluggable BEEFY payload constructors (#12428) · b91d2dfd
      Adrian Catangiu authored
      * primitives/beefy: move Payload to its own file
      
      * primitives/beefy: add Payload tests
      
      * primitives/beefy: add MmrRootProvider as custom BEEFY payload provider
      
      * client/beefy: use generic BEEFY 'PayloadProvider'
      
      * primitives/beefy: rename Payload::new to Payload::from_single_entry for clarity
      
      * fix visibility
      
      * fix cargo doc
      b91d2dfd
  15. Jun 22, 2022
    • Adrian Catangiu's avatar
      pallet-beefy-mmr: add API for BEEFY Authority Sets (#11406) · 3018051c
      Adrian Catangiu authored
      
      
      * pallet-beefy: add Config::OnNewValidatorSet type
      
      Add a hook to pallet-beefy for doing specific work when
      BEEFY validator set changes.
      
      For example, this can be used by pallet-beefy-mmr to cache
      a lightweight MMR root over validators and make it available
      to light clients.
      
      * pallet-beefy-mmr: implement OnNewValidatorSet
      
      Implement pallet-beefy::OnNewValidatorSet to be notified of BEEFY
      validator set changes. Use the notifications to compute and cache
      a light weight 'BEEFY authority set' which is an MMR root over
      BEEFY validator set plus some extra info.
      
      Previously, pallet-beefy-mmr was interogating pallet-beefy about
      validator set id on every block to find out when it needs to recompute
      the authority set.
      By using the event-driven approach in this commit, we also save one
      extra state interogation per block.
      
      * pallet-beefy-mmr: add new authority_set() API
      
      Expose current and next BEEFY authority sets through runtime API.
      These can be directly used by light clients to avoid having them
      compute them themselves based on BEEFY validator sets.
      
      Signed-off-by: default avataracatangiu <[email protected]>
      
      * rename BeefyMmr exposed runtime api
      3018051c
  16. Jan 03, 2022
  17. Dec 21, 2021
  18. Dec 20, 2021
  19. Dec 01, 2021
  20. Sep 23, 2021