Skip to content
Snippets Groups Projects
  1. Dec 18, 2024
  2. Dec 17, 2024
  3. Dec 13, 2024
  4. Dec 12, 2024
  5. Dec 11, 2024
    • Alexander Theißen's avatar
      pallet-revive: Statically verify imports on code deployment (#6759) · f0b5c3e6
      Alexander Theißen authored
      
      Previously, we failed at runtime if an unknown or unstable host function
      was called. This requires us to keep track of when a host function was
      added and when a code was deployed. We used the `api_version` to track
      at which API version each code was deployed. This made sure that when a
      new host function was added that old code won't have access to it. This
      is necessary as otherwise the behavior of a contract that made calls to
      this previously non existent host function would change from "trap" to
      "do something".
      
      In this PR we remove the API version. Instead, we statically verify on
      upload that no non-existent host function is ever used in the code. This
      will allow us to add new host function later without needing to keep
      track when they were added.
      
      This simplifies the code and also gives an immediate feedback if unknown
      host functions are used.
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
    • PG Herveou's avatar
      [pallet-revive] eth-rpc add missing tests (#6728) · 99be9b1e
      PG Herveou authored
      Add tests for #6608 
      
      fix https://github.com/paritytech/contract-issues/issues/12
      
      ---------
      
      Co-authored-by: command-bot <>
  6. Dec 10, 2024
  7. Dec 09, 2024
  8. Dec 05, 2024
    • Alexander Theißen's avatar
      pallet-revive: Adjust error handling of sub calls (#6741) · 0d3d4502
      Alexander Theißen authored
      
      We were trapping the host context in case a sub call was exhausting the
      storage deposit limit set for this sub call. This prevents the caller
      from handling this error. In this PR we added a new error code that is
      returned when either gas or storage deposit limit is exhausted by the
      sub call.
      
      We also remove the longer used `NotCallable` error. No longer used
      because this is no longer an error: It will just be a balance transfer.
      
      We also make `set_code_hash` infallible to be consistent with other host
      functions which just trap on any error condition.
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
  9. Dec 04, 2024
  10. Dec 03, 2024
  11. Dec 02, 2024
  12. Dec 01, 2024
    • PG Herveou's avatar
      [pallet-revive] eth-prc fix geth diff (#6608) · d1fafa85
      PG Herveou authored
      
      * Add a bunch of differential tests to ensure that responses from
      eth-rpc matches the one from `geth`
      - These
      [tests](https://github.com/paritytech/polkadot-sdk/blob/pg/fix-geth-diff/substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts)
      are not run in CI for now but can be run locally with
      ```bash
      cd revive/rpc/examples/js
      bun test
      ```
      
      * EVM RPC server will not fail gas_estimation if no gas is specified, I
      updated pallet-revive to add an extra `skip_transfer` boolean check to
      replicate this behavior in our pallet
      
      * `eth_transact` and `bare_eth_transact` api have been updated to use
      `GenericTransaction` directly as this is what is used by
      `eth_estimateGas` and `eth_call`
      
      ## TODO
      
      - [ ]  Add tests the new `skip_transfer` flag
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
      Co-authored-by: default avatarAlexander Theißen <alex.theissen@me.com>
  13. Nov 29, 2024
    • Bastian Köcher's avatar
      Fix runtime api impl detection by construct runtime (#6665) · 1e89a311
      Bastian Köcher authored
      
      Construct runtime uses autoref-based specialization to fetch the
      metadata about the implemented runtime apis. This is done to not fail to
      compile when there are no runtime apis implemented. However, there was
      an issue with detecting runtime apis when they were implemented in a
      different file. The problem is solved by moving the trait implemented by
      `impl_runtime_apis!` to the metadata ir crate.
      
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/6659
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
    • Alexander Theißen's avatar
      pallet_revive: Switch to 64bit RISC-V (#6565) · 447902ef
      Alexander Theißen authored
      
      This PR updates pallet_revive to the newest PolkaVM version and adapts
      the test fixtures and syscall interface to work under 64bit.
      
      Please note that after this PR no 32bit contracts can be deployed (they
      will be rejected at deploy time). Pre-deployed 32bit contracts are now
      considered defunct since we changes how parameters are passed for
      functions with more than 6 arguments.
      
      ## Fixtures
      
      The fixtures are now built for the 64bit target. I also removed the
      temporary directory mechanism that triggered a full rebuild every time.
      It also makes it easier to find the compiled fixtures since they are now
      always in `target/pallet-revive-fixtures`.
      
      ## Syscall interface
      
      ### Passing pointer
      
      Registers and pointers are now 64bit wide. This allows us to pass u64
      arguments in a single register. Before we needed two registers to pass
      them. This means that just as before we need one register per pointer we
      pass. We keep pointers as `u32` argument by truncating the register.
      This is done since the memory space of PolkaVM is 32bit.
      
      ### Functions with more than 6 arguments
      
      We only have 6 registers to pass arguments. This is why we pass a
      pointer to a struct when we need more than 6. Before this PR we expected
      a packed struct and interpreted it as SCALE encoded tuple. However, this
      was buggy because the `MaxEncodedLen` returned something that was larger
      than the packed size of the structure. This wasn't a problem before. But
      now the memory space changed in a way that things were placed at the
      edges of the memory space and those extra bytes lead to an out of bound
      access.
      
      This is why this PR drops SCALE and expects the arguments to be passed
      as a pointer to a `C` aligned struct. This avoids unaligned accesses.
      However, revive needs to adapt its codegen to properly align the
      structure fields.
      
      ## TODO
      - [ ] Add multi block migration that wipes all existing contracts as we
      made breaking changes to the syscall interface
      
      ---------
      
      Co-authored-by: default avatarGitHub Action <action@github.com>
    • Xavier Lau's avatar
      Migrate pallet-preimage to benchmark v2 (#6277) · b3ab3127
      Xavier Lau authored
      
      Part of:
      
      - #6202.
      
      ---------
      
      Co-authored-by: default avatarGiuseppe Re <giuseppe.re@parity.io>
      Co-authored-by: command-bot <>
  14. Nov 28, 2024
  15. Nov 27, 2024
    • Alexandru Vasile's avatar
      v16: Expose the unstable metadata v16 (#5732) · 5b1b34db
      Alexandru Vasile authored
      
      This PR exposes the *unstable* metadata V16. The metadata is exposed
      under the unstable u32::MAX number.
      
      Developers can start experimenting with the new features of the metadata
      v16. *Please note that this metadata is under development and expect
      breaking changes until stabilization.*
      
      The `ExtrinsicMetadata` trait receives a breaking change. Its associated
      type `VERSION` is rename to `VERSIONS` and now supports a constant
      static list of metadata versions.
      The versions implemented for `UncheckedExtrinsic` are v4 (legacy
      version) and v5 (new version).
      
      For metadata collection, it is assumed that all `TransactionExtensions`
      are under version 0.
      
      Builds on top of: https://github.com/paritytech/polkadot-sdk/pull/5274
      
      Closes: https://github.com/paritytech/polkadot-sdk/issues/5980
      Closes: https://github.com/paritytech/polkadot-sdk/issues/5347
      Closes: https://github.com/paritytech/polkadot-sdk/issues/5285
      
      cc @paritytech/subxt-team
      
      ---------
      
      Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
      Co-authored-by: default avatarNiklas Adolfsson <niklasadolfsson1@gmail.com>
      Co-authored-by: default avatarBastian Köcher <git@kchr.de>
      Co-authored-by: default avatarJames Wilson <james@jsdw.me>
      Co-authored-by: default avatarGitHub Action <action@github.com>
  16. Nov 26, 2024
  17. Nov 25, 2024
  18. Nov 22, 2024
    • gupnik's avatar
      Adds `BlockNumberProvider` in multisig, proxy and nft pallets (#5723) · 7c5224cb
      gupnik authored
      
      Step in https://github.com/paritytech/polkadot-sdk/issues/3268
      
      This PR adds the ability for these pallets to specify their source of
      the block number. This is useful when these pallets are migrated from
      the relay chain to a parachain and vice versa.
      
      This change is backwards compatible:
      1. If the `BlockNumberProvider` continues to use the system pallet's
      block number
      2. When a pallet deployed on the relay chain is moved to a parachain,
      but still uses the relay chain's block number
      
      However, we would need migrations if the deployed pallets are upgraded
      on an existing parachain, and the `BlockNumberProvider` uses the relay
      chain block number.
      
      ---------
      
      Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
  19. Nov 21, 2024
    • PG Herveou's avatar
      [pallet-revive] Support all eth tx types (#6461) · d8ce5502
      PG Herveou authored
      
      Add support for all eth tx types
      Note that js libs will continue to use the Legacy type since we don't
      include base_fee_per_gas yet in the block.
      We can think about setting these values after we revisit how we encode
      the gas into weight & deposit_limit in a follow up PR
      
      ---------
      
      Co-authored-by: default avatarAlexander Theißen <alex.theissen@me.com>
      Co-authored-by: default avatarGitHub Action <action@github.com>
    • Ankan's avatar
      [Fix|NominationPools] Only allow apply slash to be executed if the slash... · bf20a9ee
      Ankan authored
      [Fix|NominationPools] Only allow apply slash to be executed if the slash amount is atleast ED (#6540)
      
      This change prevents `pools::apply_slash` from being executed when the
      pending slash amount of the member is lower than the ED.
      
      The issue came to light with the failing [benchmark
      test](https://github.com/polkadot-fellows/runtimes/actions/runs/11879471717/job/33101445269?pr=490#step:11:765)
      in Kusama. The problem arises from the inexact conversion between points
      and balance. Specifically, when points are converted to balance and then
      back to points, rounding can introduce a small discrepancy between the
      input and the resulting value. This issue surfaced in Kusama due to its
      ED being different from Westend and Polkadot (1 UNIT/300), making the
      rounding issue noticeable.
      
      This fix is also significant because applying a slash is feeless and
      permissionless. Allowing super small slash amounts to be applied without
      a fee is undesirable. With this change, such small slashes will still be
      applied but only when member funds are withdrawn.
      
      ---------
      
      Co-authored-by: default avatarDónal Murray <donal.murray@parity.io>
    • Alexander Theißen's avatar
      revive: Bump connect timeout to fix flaky tests (#6567) · b290f27c
      Alexander Theißen authored
      
      The eth RPC tests fail sometimes because they run into a connect timeout
      because the node takes a long time to start. This bumps the connect
      timeout from 30 to 120 seconds. Locally they take around 40s for me.
      
      As a drive by I also remove a apparently duplicated nextest config.
      
      ---------
      
      Co-authored-by: default avatarordian <write@reusable.software>
    • gupnik's avatar
      Removes constraint in `BlockNumberProvider` from treasury (#6522) · a8722784
      gupnik authored
      https://github.com/paritytech/polkadot-sdk/pull/3970 updated the
      treasury pallet to support relay chain block number provider. However,
      it added a constraint to the BlockNumberProvider to have the same block
      number type as frame_system:
      
      ```rust
      type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
      ```
      
      This PR removes that constraint as suggested by @gui1117
  20. Nov 20, 2024
  21. Nov 19, 2024
  22. Nov 18, 2024