Skip to content
Snippets Groups Projects
  1. Mar 06, 2025
  2. Mar 05, 2025
  3. Mar 04, 2025
  4. Mar 03, 2025
    • polka.dom's avatar
      Add Serialize & Deserialize to umbrella crate derive module (#7764) · 9d9ae348
      polka.dom authored
      
      When working with storage types that are to be set in the genesis block,
      deriving serde::Serialize & serde::Deserialize is necessary (to my
      knowledge). This PR introduces Serialize and Deserialize into the
      umbrella crate derive (and indirectly prelude) module, allowing for
      similar access as the other storage value derives.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
    • clangenb's avatar
      [kitchensink] migrate to use genesis presets (#7741) · f9707b72
      clangenb authored
      
      Last subtask from
      https://github.com/paritytech/polkadot-sdk/issues/5704.
      
      Closes #5704.
      
      The substrate-node is not 100% free of the native runtime yet, but the
      code has become less convoluted and better documented. The final cleanup
      needs https://github.com/paritytech/polkadot-sdk/issues/7748.
      
      ---------
      
      Co-authored-by: default avatarMichal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
    • Andrei Eres's avatar
      Fix unspecified Hash in NodeBlock (#7756) · df99fb94
      Andrei Eres authored
      # Description
      
      Working with https://github.com/paritytech/polkadot-sdk/pull/7556 I
      encountered an internal compiler error on polkadot-omni-node-lib: see
      bellow or [in
      CI](https://github.com/paritytech/polkadot-sdk/actions/runs/13521547633/job/37781894640).
      
      ```
      error: internal compiler error: compiler/rustc_traits/src/codegen.rs:45:13: Encountered error `SignatureMismatch(SignatureMismatchData { found_trait_ref: <{closure@sp_state_machine::trie_backend_essence::TrieBackendEssence<sc_service::Arc<dyn sp_state_machine::trie_backend_essence::Storage<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>, <<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing, sp_trie::cache::LocalTrieCache<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>, sp_trie::recorder::Recorder<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>::storage::{closure#1}} as std::ops::FnOnce<(std::option::Option<&mut dyn trie_db::TrieRecorder<sp_core::H256>>, std::option::Option<&mut dyn trie_db::TrieCache<sp_trie::node_codec::NodeCodec<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>>)>>, expected_trait_ref: <{closure@sp_state_machine::trie_backend_essence::TrieBackendEssence<sc_service::Arc<dyn sp_state_machine::trie_backend_essence::Storage<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>, <<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing, sp_trie::cache::LocalTrieCache<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>, sp_trie::recorder::Recorder<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>::storage::{closure#1}} as std::ops::FnOnce<(std::option::Option<&mut dyn trie_db::TrieRecorder<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hash>>, std::option::Option<&mut dyn trie_db::TrieCache<sp_trie::node_codec::NodeCodec<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>>)>>, terr: Sorts(ExpectedFound { expected: Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [NodeSpec/#0], def_id: DefId(0:410 ~ polkadot_omni_node_lib[7cce]::common::spec::BaseNodeSpec::Block), .. })], def_id: DefId(0:507 ~ polkadot_omni_node_lib[7cce]::common::NodeBlock::BoundedHeader), .. })], def_id: DefId(229:1706 ~ sp_runtime[5da1]::traits::Header::Hash), .. }), found: sp_core::H256 }) })` selecting `<{closure@sp_state_machine::trie_backend_essence::TrieBackendEssence<sc_service::Arc<dyn sp_state_machine::trie_backend_essence::Storage<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>, <<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing, sp_trie::cache::LocalTrieCache<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>, sp_trie::recorder::Recorder<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>::storage::{closure#1}} as std::ops::FnOnce<(std::option::Option<&mut dyn trie_db::TrieRecorder<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hash>>, std::option::Option<&mut dyn trie_db::TrieCache<sp_trie::node_codec::NodeCodec<<<<NodeSpec as common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader as sp_runtime::traits::Header>::Hashing>>>)>>` during codegen
      ```
      
      Trying to parse the error I found that TrieRecorder was not supposed to
      work with H256:
      - Expected: `&mut dyn TrieRecorder<<<<NodeSpec as
      common::spec::BaseNodeSpec>::Block as common::NodeBlock>::BoundedHeader
      as Header>::Hash>>`
      - Found: `&mut dyn TrieRecorder<sp_core::H256>>`
      
      The error happened because I added to
      `new_full_parts_with_genesis_builder` interaction with Trie Cache which
      eventually uses `TrieRecorder<H256>`. Here is the path:
      - In polkadot-omni-node-lib trait BaseNodeSpec defined with Block as
      `NodeBlock: BlockT<Hash = DbHash>`, where DbHash is H256.
      - BaseNodeSpec calls [new_full_parts_record_import::<Self::Block, …
      >](https://github.com/paritytech/polkadot-sdk/blob/75726c65/cumulus/polkadot-omni-node/lib/src/common/spec.rs#L184-L189)
      and eventually it goes to
      [new_full_parts_with_genesis_builder](https://github.com/paritytech/polkadot-sdk/blob/08b30246
      
      /substrate/client/service/src/builder.rs#L195).
      - In `new_full_parts_with_genesis_builder` we accessed storage,
      initiating TrieRecorder with H256 what never happened before.
      
      I believe the compiler found a mismatch checking types for TrieRecorder:
      NodeBlock inherits from the trait `Block<Hash = DbHash>`, but it uses
      BoundedHeader, which inherits from the trait Header with the default
      Hash.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Alexander Theißen's avatar
      revive: Rework the instruction benchmark (#7721) · 4b39ff00
      Alexander Theißen authored
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/6157
      
      This fixes the last remaining benchmark that was not correct since it
      was too low level to be written in Rust. Instead, we opted.
      
      This PR changes the benchmark that determines the scaling from
      `ref_time` to PolkaVM `Gas` by benchmarking the absolute worst case of
      an instruction: One that causes two cache misses by touching two cache
      lines.
      
      The Contract itself is designed to be as simple as possible. It does
      random unaligned reads in a loop until the `r` (repetition) number is
      reached. The randomness is fully generated by the host and written to
      the guests memory before the benchmark is run. This allows the benchmark
      to determine the influence of one loop iteration via linear regression.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
      Co-authored-by: default avatarxermicus <cyrill@parity.io>
      Co-authored-by: default avatarPG Herveou <pgherveou@gmail.com>
    • Matteo Muraca's avatar
      Remove `pallet::getter` usage from `pallet-nft-fractionalization` (#7124) · 3798ff7f
      Matteo Muraca authored
      
      Description
      Part of #3326
      As per title, `pallet::getter` usage has been removed from
      `pallet-nft-fractionalization`.
      
      ---------
      
      Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  5. Feb 28, 2025
    • Alexandru Vasile's avatar
      notifications/libp2p: Terminate the outbound notification substream on `std::io::Errors` (#7724) · 1bc6ca60
      Alexandru Vasile authored
      
      This PR handles a case where we called the `poll_next` on an outbound
      substream notification to check if the stream is closed. It is entirely
      possible that the `poll_next` would return an `io::error`, for example
      end of file.
      
      This PR ensures that we make the distinction between unexpected incoming
      data, and error originated from `poll_next`.
      
      While at it, the bulk of the PR change propagates the PeerID from the
      network behavior, through the notification handler, to the notification
      outbound stream for logging purposes.
      
      cc @paritytech/networking 
      
      Part of: https://github.com/paritytech/polkadot-sdk/issues/7722
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
    • Sebastian Kunert's avatar
      Remove leftovers of leftovers of contracts-rococo (#7750) · 9adb8d28
      Sebastian Kunert authored
      Follow-up of https://github.com/paritytech/polkadot-sdk/pull/7638, which
      attempted to remove contracts-rococo.
      
      But there were some leftover weight files still chilling in the repo.
    • Alexander Theißen's avatar
      pallet_revive: Change address derivation to use hashing (#7662) · 4087e2d9
      Alexander Theißen authored
      
      Fixes https://github.com/paritytech/polkadot-sdk/issues/6723
      
      ## Motivation
      
      Internal auditors recommended to not truncate Polkadot Addresses when
      deriving Ethereum addresses from it. Reasoning is that they are raw
      public keys where truncating could lead to collisions when weaknesses in
      those curves are discovered in the future. Additionally, some pallets
      generate account addresses in a way where only the suffix we were
      truncating contains any entropy. The changes in this PR act as a safe
      guard against those two points.
      
      ## Changes made
      
      We change the `to_address` function to first hash the AccountId32 and
      then use trailing 20 bytes as `AccountId20`. If the `AccountId32` ends
      with 12x 0xEE we keep our current behaviour of just truncating those
      trailing bytes.
      
      ## Security Discussion
      
      This will allow us to still recover the original `AccountId20` because
      those are constructed by just adding those 12 bytes. Please note that
      generating an ed25519 key pair where the trailing 12 bytes are 0xEE is
      theoretically possible as 96bits is not a huge search space. However,
      this cannot be used as an attack vector. It will merely allow this
      address to interact with `pallet_revive` without registering as the
      fallback account is the same as the actual address. The ultimate vanity
      address. In practice, this is not relevant since the 0xEE addresses are
      not valid public keys for sr25519 which is used almost everywhere.
      
      tl:dr: We keep truncating in case of an Ethereum address derived account
      id. This is safe as those are already derived via keccak. In every other
      case where we have to assume that the account id might be a public key.
      Therefore we first hash and then take the trailing bytes.
      
      ## Do we need a Migration for Westend
      
      No. We changed the name of the mapping. This means the runtime will not
      try to read the old data. Ethereum keys are unaffected by this change.
      We just advise people to re-register their AccountId32 in case they need
      to use it as it is a very small circle of users (just 3 addresses
      registered). This will not cause disturbance on Westend.
      
      ---------
      
      Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    • Egor_P's avatar
      [Release|CI/CD] Update pgpgkms to the latest version (#7745) · 95be69ce
      Egor_P authored
      This PR updates `pgpgkms`, tool to sign releases, to the latest version
      to fix the issue wiht the `debian` publishing form the pipeline.
      Address: https://github.com/paritytech/release-engineering/issues/248
    • Serban Iorga's avatar
      Derive `DecodeWithMemTracking` for `Block` (#7655) · c11b1f85
      Serban Iorga authored
      Related to https://github.com/paritytech/polkadot-sdk/issues/7360
      
      This PR adds `DecodeWithMemTracking` as a trait bound for `Header`,
      `Block` and `TransactionExtension` and
      derives it for all the types that implement these traits in
      `polkadot-sdk`.
  6. Feb 27, 2025
  7. Feb 26, 2025