1. Jan 22, 2024
  2. Jan 19, 2024
    • Robin Freyler's avatar
      Update Wasm benchmarks (#2957) · e02c5204
      Robin Freyler authored
      In https://github.com/paritytech/polkadot-sdk/pull/2941 we found out
      that the new Wasmi (register) is very effective at optimizing away
      certain benchmark bytecode constructs in a way that created an unfair
      advantage over Wasmi (stack) which yielded our former benchmarks to be
      ineffective at properly measuring the performance impact.
      
      This PR adjusts both affected benchmarks to fix the stated problems.
      Affected are
      - `instr_i64const` -> `instr_i64add`: Renamed since it now measures the
      performance impact of the Wasm `i64.add` instruction with locals as
      inputs and outputs. This makes it impossible for Wasmi (register) to
      aggressively optimize away the entire function body (as it previously
      did) but still provides a way for Wasmi (register) to shine with its
      register based execution model.
      - `call_with_code_per_byte`: Now uses `local.get` instead of `i32.const`
      for the `if` condition which prevents Wasmi (register) to aggressively
      optimizing away whole parts of the `if` creating an unfair advantage.
      
      cc @athei
      
      
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      Co-authored-by: default avatarIgnacio Palacios <[email protected]>
      e02c5204
    • Oliver Tale-Yazdi's avatar
      Contract fixtures tests: fixe nightly version (#3000) · 2e9b4405
      Oliver Tale-Yazdi authored
      
      
      Using just `nightly` is too generic and can fail on different systems.  
      Now its fixed to the nightly version of the CI.
      
      Another way would be to use a toolchain file, since this already assumes
      `rustup`.
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      2e9b4405
  3. Jan 18, 2024
  4. Jan 17, 2024
  5. Jan 16, 2024
    • Francisco Aguirre's avatar
      XCMv4 (#1230) · 8428f678
      Francisco Aguirre authored
      
      
      # Note for reviewer
      
      Most changes are just syntax changes necessary for the new version.
      Most important files should be the ones under the `xcm` folder.
      
      # Description 
      
      Added XCMv4.
      
      ## Removed `Multi` prefix
      The following types have been renamed:
      - MultiLocation -> Location
      - MultiAsset -> Asset
      - MultiAssets -> Assets
      - InteriorMultiLocation -> InteriorLocation
      - MultiAssetFilter -> AssetFilter
      - VersionedMultiAsset -> VersionedAsset
      - WildMultiAsset -> WildAsset
      - VersionedMultiLocation -> VersionedLocation
      
      In order to fix a name conflict, the `Assets` in `xcm-executor` were
      renamed to `HoldingAssets`, as they represent assets in holding.
      
      ## Removed `Abstract` asset id
      
      It was not being used anywhere and this simplifies the code.
      
      Now assets are just constructed as follows:
      
      ```rust
      let asset: Asset = (AssetId(Location::new(1, Here)), 100u128).into();
      ```
      
      No need for specifying `Concrete` anymore.
      
      ## Outcome is now a named fields struct
      
      Instead of
      
      ```rust
      pub enum Outcome {
        Complete(Weight),
        Incomplete(Weight, Error),
        Error(Error),
      }
      ```
      
      we now have
      
      ```rust
      pub enum Outcome {
        Complete { used: Weight },
        Incomplete { used: Weight, error: Error },
        Error { error: Error },
      }
      ```
      
      ## Added Reanchorable trait
      
      Now both locations and assets implement this trait, making it easier to
      reanchor both.
      
      ## New syntax for building locations and junctions
      
      Now junctions are built using the following methods:
      
      ```rust
      let location = Location {
          parents: 1,
          interior: [Parachain(1000), PalletInstance(50), GeneralIndex(1984)].into()
      };
      ```
      
      or
      
      ```rust
      let location = Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]);
      ```
      
      And they are matched like so:
      
      ```rust
      match location.unpack() {
        (1, [Parachain(id)]) => ...
        (0, Here) => ...,
        (1, [_]) => ...,
      }
      ```
      
      This syntax is mandatory in v4, and has been also implemented for v2 and
      v3 for easier migration.
      
      This was needed to make all sizes smaller.
      
      # TODO
      - [x] Scaffold v4
      - [x] Port github.com/paritytech/polkadot/pull/7236
      - [x] Remove `Multi` prefix
      - [x] Remove `Abstract` asset id
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      8428f678
    • Bastian Köcher's avatar
      Some random fixes (#2936) · 1c2db174
      Bastian Köcher authored
      - Do not disable `std` feature in the integration tests
      - `contracts-fixtures` test should only check for `riscv` build when the
      feature is enabled
      1c2db174
  6. Jan 15, 2024
  7. Jan 12, 2024
  8. Jan 09, 2024
  9. Jan 08, 2024
  10. Jan 07, 2024
  11. Jan 04, 2024
  12. Dec 28, 2023
  13. Dec 20, 2023
    • Dónal Murray's avatar
      Fix clippy lints behind feature gates and add new CI step all features (#2569) · d68868f6
      Dónal Murray authored
      
      
      Many clippy lints usually enforced by `-Dcomplexity` and `-Dcorrectness`
      are not caught by CI as they are gated by `features`, like
      `runtime-benchmarks`, while the clippy CI job runs with only the default
      features for all targets.
      
      This PR also adds a CI step to run clippy with `--all-features` to
      ensure the code quality is maintained behind feature gates from now on.
      
      To improve local development, clippy lints are downgraded to warnings,
      but they still will result in an error at CI due to the `-Dwarnings`
      rustflag.
      
      ---------
      
      Co-authored-by: default avatarLiam Aharon <[email protected]>
      d68868f6
  14. Dec 18, 2023
  15. Dec 14, 2023
  16. Dec 13, 2023
  17. Dec 12, 2023
  18. Dec 11, 2023
  19. Dec 08, 2023
  20. Dec 04, 2023
  21. Dec 01, 2023
  22. Nov 29, 2023
    • PG Herveou's avatar
      Contracts: use compiled rust tests (#2347) · 2135fa87
      PG Herveou authored
      see #2189
      
      This PR does the following:
      - Bring the user api functions into a new pallet-contracts-uapi (They
      are currently defined in ink!
      [here])(https://github.com/paritytech/ink/blob/master/crates/env/src/engine/on_chain/ext.rs
      
      )
      - Add older api versions and unstable to the user api trait.
      - Remove pallet-contracts-primitives and bring the types it defined in
      uapi / pallet-contracts
      - Add the infrastructure to build fixtures from Rust files and test it
      works by replacing `dummy.wat` and `call.wat`
      - Move all the doc from wasm/runtime.rs to pallet-contracts-uapi.
      
      This will be done in a follow up:
      - convert the rest of the test from .wat to rust
      - bring risc-v uapi up to date with wasm
      - finalize the uapi host fns, making sure everything is codegen from the
      source host fns in pallet-contracts
      
      ---------
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      2135fa87
  23. Nov 28, 2023
  24. Nov 23, 2023
  25. Nov 14, 2023
  26. Nov 10, 2023
  27. Nov 02, 2023
    • Piotr Mikołajczyk's avatar
      Make `ExecResult` encodable (#1809) · 10857d0b
      Piotr Mikołajczyk authored
      # Description
      We derive few useful traits on `ErrorOrigin` and `ExecError`, including
      `codec::Encode` and `codec::Decode`, so that `ExecResult` is
      en/decodable as well. This is required for a contract mocking feature
      (already prepared in drink:
      https://github.com/Cardinal-Cryptography/drink/pull/61). In more detail:
      `ExecResult` must be passed from runtime extension, through runtime
      interface, back to the pallet, which requires that it is serializable to
      bytes in some form (or implements some rare, auxiliary traits).
      
      **Impact on runtime size**: Since most of these traits is used directly
      in the pallet now, compiler should be able to throw it out (and thus we
      bring no new overhead). However, they are very useful in secondary tools
      like drink or other testing libraries.
      
      # Checklist
      
      - [x] My PR includes a detailed description as outlined in the
      "Description" section above
      - [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process)
      of this project (at minimum one label for `T`
        required)
      - [x] I have made corresponding changes to the documentation (if
      applicable)
      - [x] I have added tests that prove my fix is effective or that my
      feature works (if applicable)
      10857d0b
  28. Oct 31, 2023