1. Mar 18, 2024
    • Squirrel's avatar
      sp-std removal from substrate/primitives (#3274) · 1b5f4243
      Squirrel authored
      
      
      This PR removes sp-std crate from substrate/primitives sub-directories.
      
      For now crates that have `pub use` of sp-std or export macros that would
      necessitate users of the macros to `extern crate alloc` have been
      excluded from this PR.
      
      There should be no breaking changes in this PR.
      
      ---------
      
      Co-authored-by: default avatarKoute <[email protected]>
      1b5f4243
  2. Feb 22, 2024
    • Adrian Catangiu's avatar
      sc-consensus-beefy: pump gossip engine while waiting for initialization conditions (#3435) · 31546c8d
      Adrian Catangiu authored
      As part of BEEFY worker/voter initialization the task waits for certain
      chain and backend conditions to be fulfilled:
      - BEEFY consensus enabled on-chain & GRANDPA best finalized higher than
      on-chain BEEFY genesis block,
      - backend has synced headers for BEEFY mandatory blocks between best
      BEEFY and best GRANDPA.
      
      During this waiting time, any messages gossiped on the BEEFY topic for
      current chain get enqueued in the gossip engine, leading to RAM bloating
      and output warning/error messages when the wait time is non-negligible
      (like during a clean sync).
      
      This PR adds logic to pump the gossip engine while waiting for other
      things to make sure gossiped messages get consumed (practically
      discarded until worker is fully initialized).
      
      Also raises the warning threshold for enqueued messages from 10k to
      100k. This is in line with the other gossip protocols on the node.
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/3390
      
      
      
      ---------
      
      Signed-off-by: default avatarAdrian Catangiu <[email protected]>
      31546c8d
  3. Feb 20, 2024
    • Oliver Tale-Yazdi's avatar
      Lift dependencies to the workspace (Part 2/x) (#3366) · e89d0fca
      Oliver Tale-Yazdi authored
      
      
      Lifting some more dependencies to the workspace. Just using the
      most-often updated ones for now.
      It can be reproduced locally.
      
      ```sh
      # First you can check if there would be semver incompatible bumps (looks good in this case):
      $ zepter transpose dependency lift-to-workspace --ignore-errors syn quote thiserror "regex:^serde.*"
      
      # Then apply the changes:
      $ zepter transpose dependency lift-to-workspace --version-resolver=highest syn quote thiserror "regex:^serde.*" --fix
      
      # And format the changes:
      $ taplo format --config .config/taplo.toml
      ```
      
      ---------
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      e89d0fca
  4. Feb 16, 2024
  5. Feb 08, 2024
  6. Feb 06, 2024
    • Koute's avatar
      Build more runtimes targeting PolkaVM (#3209) · 402b64ca
      Koute authored
      This PR improves compatibility with RISC-V and PolkaVM, allowing more
      runtimes to successfully compile.
      
      In particular, it makes the following changes:
      
      - The `sp-mmr-primitives` and `sp-consensus-beefy` crates
      unconditionally required an `std`-only dependency; now they only require
      those dependencies when the `std` feature is actually enabled. (Our
      RISC-V target is, unlike WASM, a true `no_std` target where you can't
      accidentally use stuff from `std` anymore.)
      - One of our dependencies (the `bitvec` trace) uses a crate called
      `radium` which doesn't compile under RISC-V due to incomplete
      autodetection logic in their `build.rs` file. The good news is that this
      is already fixed in the newest upstream version of `radium`, and the
      newest version of `bitvec` uses it. The bad news is that the newest
      version of `bitvec` is not currently released on crates.io, so we can't
      use it. I've [created an
      issue](https://github.com/ferrilab/ferrilab/issues/5) asking for a new
      release, but in the meantime I forked the currently used `radium` 0.7,
      [fixed the faulty
      logic](https://github.com/paritytech/radium-0.7-fork/commit/ed66c8a294b138c67f93499644051d97d4c7fbda)
      and used cargo's patching capabilities to use it for the RISC-V runtime
      builds. This might be a little hacky, but it is the least intrusive way
      to fix the problem, doesn't affect WASM builds at all, and we can
      trivially remove it once a new `bitvec` is released.
      - The new runtimes are added to the CI to make sure their compilation
      doesn't break.
      402b64ca
  7. Jan 26, 2024
  8. Jan 22, 2024
  9. Jan 07, 2024
  10. Jan 06, 2024
  11. Jan 04, 2024
  12. Dec 13, 2023
  13. Dec 01, 2023
  14. Nov 30, 2023
  15. Nov 23, 2023
  16. Nov 14, 2023
    • drskalman's avatar
      Fix `ecdsa_bls` verify in BEEFY primitives (#2066) · b371c357
      drskalman authored
      
      
      BEEFY ECDSA signatures are on keccak has of the messages. As such we can
      not simply call
      
      `EcdsaBlsPair::verify(signature.as_inner_ref(), msg,
      self.as_inner_ref())`
      
      because that invokes ecdsa default verification which perfoms blake2
      hash which we don't want.
      
      This bring up the second issue makes: This makes `sign` and `verify`
      function in `pair_crypto` useless, at least for BEEFY use case.
      Moreover, there is no obvious clean way to generate the signature given
      that pair_crypto does not exposes `sign_prehashed`. You could in theory
      query the keystore for the pair (could you?), invoke `to_raw` and
      re-generate each sub-pair and sign using each. But that sounds extremely
      anticlimactic and will be frow upon by auditors . So I appreciate any
      alternative suggestion.
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarRobert Hambrock <[email protected]>
      b371c357
  17. Oct 24, 2023
  18. Oct 20, 2023
    • Bastian Köcher's avatar
      `xcm`: Change `TypeInfo::path` to not include `staging` (#1948) · f3bf5c1a
      Bastian Köcher authored
      The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
      crates.io as someone as squatted `xcm`. The problem with this rename is
      that the `TypeInfo` includes the crate name which ultimately lands in
      the metadata. The metadata is consumed by downstream users like
      `polkadot-js` or people building on top of `polkadot-js`. These people
      are using the entire `path` to find the type in the type registry. Thus,
      their code would break as the type path would now be [`staging_xcm`,
      `VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
      fixes this by renaming the path segment `staging_xcm` to `xcm`.
      
      This requires: https://github.com/paritytech/scale-info/pull/197
      
      
      
      ---------
      
      Co-authored-by: default avatarFrancisco Aguirre <[email protected]>
      f3bf5c1a
  19. Aug 30, 2023
  20. Aug 29, 2023
  21. Aug 25, 2023
  22. Aug 23, 2023
  23. 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
  24. Aug 01, 2023
  25. Jul 06, 2023
  26. Jun 21, 2023
  27. May 31, 2023
  28. May 29, 2023
  29. May 17, 2023
    • Bigna Härdi's avatar
      Add `serde` feature flag to primitives (#13027) · 0e49ed72
      Bigna Härdi authored
      
      
      * add serde_full feature flag
      
      add serde_full to sp_runtime
      
      add space to toml
      
      add serde_full to application-crypto
      
      add serde_full to arithmetic
      
      fix arithmetic
      
      add serde full to beefy
      
      add serde full to consensus
      
      add serde_full to core
      
      add serdefull to finality grandpa
      
      add serde_full to several primitives crates
      
      make rpc no_std compatible
      
      add scale info to runtime
      
      make serializer no_std compatible
      
      add serde full to storage
      
      add full serde to version
      
      add serde full to weights
      
      add all serde_full features
      
      add . to comment
      
      add missing impl-serde
      
      fix no-std build
      
      fix build
      
      add full_crypto to serde_full
      
      serde_full also implements crypto
      
      full_serde does not work with full_crytpo. needs std
      
      no no_std serde impl possible
      
      also for crypto std is necessary
      
      no serde full for application crypto
      
      fix arithmetic
      
      fix tomls
      
      fix some things
      
      impl fmt for Signature
      
      add serialize to Public
      
      add impl_maybe_marker_serde_full
      
      fix sp-application-crypto toml
      
      add serde feature flag
      
      fix clippy
      
      fix toml grandpa
      
      fix grandpa
      
      rename if_std to if_serde
      
      keystore is not no_std compatible
      
      make keystore vrf no_std compatible
      
      fix nopos-elections
      
      fix rpc
      
      fix serializer
      
      fix test-primitives
      
      fix version
      
      add comment
      
      add serde full only import for format string
      
      remove all(serde_full and full_crypot) as serde_full enforces full_crypto
      
      make comment better readable
      
      even better comment
      
      clean up rpc toml
      
      clean up toml
      
      clean up serializer toml
      
      clean up storage toml
      
      fix std build
      
      update .lock
      
      fix sp-version
      
      move sp_std import
      
      test extern crate alloc
      
      replace sp_std with core
      
      add missing core
      
      sp_core: serde feature do not enforce full crypto
      
      application-crypto: serde feature do not enforce full crypto
      
      rename serde_full to serde
      
      add dep:serde and alloc to default feature
      
      add full_crypto and remove unnecessary debu/fmt impls for serde
      
      update comment
      
      remove obolsete change in display AccountId32
      
      remove extra changes
      
      minimize diff
      
      revert keystore changes
      
      remove std from keystore
      
      remove full-crypto feature
      
      fix serde import
      
      fix comment
      
      fix feature = serde
      
      * rename serde_full to serde
      
      * move #[doc(hidden)] back
      
      * remove feature = full crypto require frm MultiSigner
      
      * reorder serde and scale_info import
      
      * fix bs58 missing alloc import in serde feature
      
      * add `from_string` to serde feature and add unimplemented
      
      * remove serde feature from fixed_point display
      
      * Remove serde/alloc
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      
      * Update primitives/consensus/babe/Cargo.toml
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Update primitives/arithmetic/src/fixed_point.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * revert `from_string`fixed impl back to std only
      
      * remove duplicate runtime string impl
      
      * use sp_std::alloc
      
      * remove no_std compatible rpc
      
      * remove no_std compatibility from serializer
      
      * rename mpl_maybe_marker_serde to std_or_serde
      
      * update .lock
      
      * add sp-std to executor
      
      * fix sp-std import
      
      * fix sp_std::format import
      
      * use crate import
      
      * add serde feature
      
      * Update primitives/core/src/lib.rs
      
      ---------
      
      Co-authored-by: default avatarDavide Galassi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      0e49ed72
  30. Apr 12, 2023
  31. Apr 11, 2023
  32. Mar 20, 2023
    • Davide Galassi's avatar
      Keystore overhaul (iter 2) (#13634) · 480396fe
      Davide Galassi authored
      * Remove bloat about remote keystore
      
      * Update docs and remove unused 'KeystoreRef' trait
      
      * Use wherever possible, MemoryKeystore for testing
      
      * Remove unrequired fully qualified method syntax for Keystore
      480396fe
  33. Mar 17, 2023
    • Davide Galassi's avatar
      Keystore overhaul (#13615) · f110941b
      Davide Galassi authored
      * Remove 'supported_keys' 'sign_with_any' and 'sign_with_all' from keystore trait
      
      * Remove the aync keystore
      
      * Renaming:
      - SyncCryptoStore -> Keystore
      - SyncCryptoStorePtr -> KeystorePtr
      - KeyStore -> MemoryKeystore
      
      * Fix authority discovery worker and tests
      
      * Rename 'insert_unknown' to 'insert'
      
      * Remove leftover
      f110941b
  34. Mar 03, 2023
  35. Feb 28, 2023