1. Jan 12, 2024
  2. 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
  3. Nov 14, 2023
  4. Sep 04, 2023
  5. Aug 31, 2023
  6. Aug 23, 2023
    • juangirini's avatar
      Restructure `frame_support` macro related exports (#14745) · 878c562c
      juangirini authored
      
      
      * make reexports private
      
      * make reexports private 2
      
      * make reexports private for runtime-benchmarking
      
      * make reexports private for try-runtime
      
      * fix for try-runtime
      
      * make reexports private for tests
      
      * fmt
      
      * make reexports private for tests
      
      * make reexports private for experimental
      
      * fix beefy
      
      * fix ui test
      
      * fix ui test
      
      * fix benches
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * fix contracts use
      
      * wip
      
      * wip
      
      * do not reexport sp_api::metadata_ir
      
      * fix CI checks
      
      * fix support tests
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Update frame/support/src/lib.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * import codec directly
      
      * fmt
      
      * fix node-cli tests
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      878c562c
  7. Jul 26, 2023
  8. Jul 13, 2023
    • gupnik's avatar
      Moves `Block` to `frame_system` instead of `construct_runtime` and removes... · 5e7b27e9
      gupnik authored
      
      Moves `Block` to `frame_system` instead of `construct_runtime` and removes `Header` and `BlockNumber` (#14437)
      
      * Initial setup
      
      * Adds node block
      
      * Uses UncheckedExtrinsic and removes Where section
      
      * Updates frame_system to use Block
      
      * Adds deprecation warning
      
      * Fixes pallet-timestamp
      
      * Removes Header and BlockNumber
      
      * Addresses review comments
      
      * Addresses review comments
      
      * Adds comment about compiler bug
      
      * Removes where clause
      
      * Refactors code
      
      * Fixes errors in cargo check
      
      * Fixes errors in cargo check
      
      * Fixes warnings in cargo check
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Uses import instead of full path for BlockNumber
      
      * Uses import instead of full path for Header
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Fixes imports in benchmarks
      
      * Formatting
      
      * Fixes construct_runtime tests
      
      * Formatting
      
      * Minor updates
      
      * Fixes construct_runtime ui tests
      
      * Fixes construct_runtime ui tests with 1.70
      
      * Fixes docs
      
      * Fixes docs
      
      * Adds u128 mock block type
      
      * Fixes split example
      
      * fixes for cumulus
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Updates new tests
      
      * Fixes fully-qualified path in few places
      
      * Formatting
      
      * Update frame/examples/default-config/src/lib.rs
      
      Co-authored-by: default avatarJuan <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarJuan <[email protected]>
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Addresses some review comments
      
      * Fixes build
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Update frame/democracy/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/democracy/src/lib.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Update frame/support/procedural/src/construct_runtime/mod.rs
      
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Addresses review comments
      
      * Updates trait bounds
      
      * Minor fix
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Removes unnecessary bound
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Updates test
      
      * Fixes build
      
      * Adds a bound for header
      
      * ".git/.scripts/commands/fmt/fmt.sh"
      
      * Removes where block
      
      * Minor fix
      
      * Minor fix
      
      * Fixes tests
      
      * ".git/.scripts/commands/update-ui/update-ui.sh" 1.70
      
      * Updates test
      
      * Update primitives/runtime/src/traits.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Update primitives/runtime/src/traits.rs
      
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      
      * Updates doc
      
      * Updates doc
      
      ---------
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarJuan <[email protected]>
      Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
      Co-authored-by: default avatarBastian Köcher <[email protected]>
      5e7b27e9
  9. Jul 03, 2023
    • Sasha Gryaznov's avatar
      contracts: switch to wasmi gas metering (#14084) · fda86dd5
      Sasha Gryaznov authored
      * upgrade to wasmi 0.29
      
      * prepare cleanup
      
      * sync ref_time w engine from the stack frame
      
      * proc_macro: sync gas in host funcs
      
      save: compiles, only gas pushing left to macro
      
      WIP proc macro
      
      proc macro: done
      
      * clean benchmarks & schedule: w_base = w_i64const
      
      * scale gas values btw engine and gas meter
      
      * (re)instrumentation & code_cache removed
      
      * remove gas() host fn, continue clean-up
      
      save
      
      * address review comments
      
      * move from CodeStorage&PrefabWasmModule to PristineCode&WasmBlob
      
      * refactor: no reftime_limit&schedule passes, no CodeStorage
      
      * bugs fixing
      
      * fix tests: expected deposit amount
      
      * fix prepare::tests
      
      * update tests and fix bugs
      
      tests::run_out_of_gas_engine, need 2 more
      
      save: 2 bugs with gas syncs: 1 of 2 tests done
      
      gas_syncs_no_overcharge bug fixed, test passes!
      
      cleaned out debug prints
      
      second bug is not a bug
      
      disabled_chain_extension test fix (err msg)
      
      tests run_out_of_fuel_host, chain_extension pass
      
      all tests pass
      
      * update docs
      
      * bump wasmi 0.30.0
      
      * benchmarks updated, tests pass
      
      * refactoring
      
      * s/OwnerInfo/CodeInfo/g;
      
      * migration: draft, compiles
      
      * migration: draft, runs
      
      * migration: draft, runs (fixing)
      
      * deposits repaid non pro rata
      
      * deposits repaid pro rata
      
      * better try-runtime output
      
      * even better try-runtime output
      
      * benchmark migration
      
      * fix merge leftover
      
      * add forgotten fixtures, fix docs
      
      * address review comments
      
      * ci fixes
      
      * cleanup
      
      * benchmarks::prepare to return DispatchError
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * store memory limits to CodeInfo
      
      * ci: roll back weights
      
      * ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
      
      * drive-by: update Readme and pallet rustdoc
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * use wasmi 0.29
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * use wasmi 0.30 again
      
      * query memory limits from wasmi
      
      * better migration types
      
      * ci: pull weights from master
      
      * refactoring
      
      * ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
      
      * addressing review comments
      
      * refactor
      
      * address review comments
      
      * optimize migration
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * another review round comments addressed
      
      * ci fix one
      
      * clippy fix
      
      * ci fix two
      
      ---------
      
      Co-authored-by: command-bot <>
      fda86dd5
    • Cyrill Leutwiler's avatar
      6005d199
  10. May 05, 2023
  11. May 02, 2023
    • juangirini's avatar
      contracts: Make Origin information available (#13708) · 5db4119f
      juangirini authored
      
      
      * contracts: allow root calls
      
      * contracts: update ContractOrigin
      
      * contracts: test allow root calls
      
      * contracts: rustfmt
      
      * contracts: test root caller traps
      
      * contracts: add Caller enum
      
      * contracts: improve some comments
      
      * contracts: improve some comments
      
      * contracts: format code with +nightly
      
      * contracts: fix failing tests
      
      * contracts: improve charte instantiate call when root origin
      
      * contract: refactor common, call and instantiate inputs
      
      * contracts: fix some failing test
      
      * contracts: trap caller when there is no account id
      
      * Update frame/contracts/src/lib.rs
      
      Co-authored-by: default avatarPG Herveou <[email protected]>
      
      * Update frame/contracts/src/exec.rs
      
      Co-authored-by: default avatarPG Herveou <[email protected]>
      
      * contracts: make `into_deposit` return zero when the origin is root
      
      * contracts: cargo fmt
      
      * contracts: charging and terminating tests refactored
      
      * contracts: improved errors
      
      * contracts: refactor & merge ContractOrigin cand Caller enums
      
      * Update frame/contracts/src/lib.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * contracts: apply suggested pr changes
      
      * contracts: rename Caller to Origin
      
      * contracts: refactor run fn
      
      * contracts: cr improvements
      
      * contracts: allow root to use delegate call
      
      * contracts: add caller_is_root weight
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * contracts: add caller_is_root benchmarking
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * contracts: add caller_is_root benchmarking
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * contracts: add some minor improvements
      
      * contracts: make caller_is_root runtime fn unstable
      
      * contracts: fix failing wasm test
      
      * contracts: update benchmarking for origin_is_root
      
      * contracts: improve seal_caller_is_root benchmarking
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * contracts: add small pr improvements
      
      * contracts: fix broken tests after master merge
      
      * contracts: acknowledge the default storage deposit limit
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * contracts: move origin to CommonInput
      
      * contracts: add some extra tests
      
      * contracts: move ensure origin logic inside invokable::run_guarded
      
      * contracts: add minor improvements
      
      * contracts: fix caller_is_root benchmarking
      
      * contracts: improve function description
      
      * Update frame/contracts/src/lib.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * Update frame/contracts/src/lib.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * contracts: improve function description
      
      ---------
      
      Co-authored-by: parity-processbot <>
      Co-authored-by: default avatarPG Herveou <[email protected]>
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      5db4119f
  12. Apr 26, 2023
    • Sasha Gryaznov's avatar
      [contracts] Port host functions to Weight V2 and storage deposit limit (#13565) · 60310de7
      Sasha Gryaznov authored
      
      
      * added [unstable][seal2] call()
      
      * updated test to cover new seal_call proof_limit
      
      * docs updated
      
      * add [seal2][unstable] instantiate() and test
      
      * add [seal2][unstable] weight_to_fee() + docs and test
      
      * add [seal2][unstable] gas_left() + docs and test
      
      * update benchmarks
      
      * add DefaultDepositLimit to pallet Config
      
      * specify deposit limit for nested call
      
      add test for nested call deposit limit
      
      save: separate deposit limit for nested calls
      
      * specify deposit limit for nested instantiate
      
      save: works with test
      
      cleaned up debugging outputs
      
      * update benchmarks
      
      * added missing fixtures
      
      * fix benches
      
      * pass explicit deposit limit to storage bench
      
      * explicit deposit limit for another set_storage bench
      
      * add more deposit limit for storage benches
      
      * moving to simplified benchmarks
      
      * moved to simplified benchmarks
      
      * fix seal_weight_to_fee bench
      
      * fix seal_instantiate benchmark
      
      * doc typo fix
      
      * default dl for benchmarking
      
      more dl for tests
      
      dl for tests to max
      
      deposit_limit fix in instantiate bench
      
      fix instantiate bench
      
      fix instantiate benchmark
      
      fix instantiate bench again
      
      remove dbg
      
      fix seal bench again
      
      fixing it still
      
      seal_instantiate zero deposit
      
      less runs to check if deposit enough
      
      try
      
      try 2
      
      try 3
      
      try 4
      
      * max_runtime_mem to Schedule limits
      
      * add default deposit limit fallback check to test
      
      * weight params renaming
      
      * fmt
      
      * Update frame/contracts/src/benchmarking/mod.rs
      
      Co-authored-by: default avatarPG Herveou <[email protected]>
      
      * prettify inputs in tests
      
      * typestate param refactored
      
      ---------
      
      Co-authored-by: default avatarPG Herveou <[email protected]>
      60310de7
  13. Apr 13, 2023
  14. Apr 12, 2023
    • PG Herveou's avatar
      contracts: add sr25519_verify (#13724) · 03c99fe0
      PG Herveou authored
      
      
      * wip
      
      * fix
      
      * wip
      
      * fix lint
      
      * rm fixture fix
      
      * missing comment
      
      * fix lint
      
      * add comment to the wsm file
      
      * fix comment
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * wip
      
      * wip weights
      
      * wip weights
      
      * PR comment: test with return code
      
      * wip
      
      * PR review add mock test
      
      * remove
      
      * lint
      
      * Update frame/contracts/fixtures/sr25519_verify.wat
      
      * fix comments
      
      * Update frame/contracts/src/benchmarking/mod.rs
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      * Update frame/contracts/fixtures/sr25519_verify.wat
      
      * Update frame/contracts/src/benchmarking/mod.rs
      
      * fix lint
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * PR: review use unstable + remove arbitrary index 4
      
      * Add benchmark for calculating overhead of calling sr25519_verify
      
      * fix message length encoding
      
      * fix weights
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * Apply suggestions from code review
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      * Update frame/contracts/src/benchmarking/mod.rs
      
      * Update frame/contracts/src/benchmarking/mod.rs
      
      * Update frame/contracts/src/schedule.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * Update frame/contracts/src/schedule.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      * Update frame/contracts/src/wasm/runtime.rs
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * PR review
      
      ---------
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      03c99fe0
  15. Mar 27, 2023
  16. Mar 20, 2023
    • Alexander Theißen's avatar
      contracts: Upgrade to wasmi 0.28 (#13312) · 82cb6992
      Alexander Theißen authored
      * Upgrade to wasmi 0.28
      
      * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
      
      * Update stale comment
      
      * Renamed variants of `Determinism`
      
      * Compile fix
      
      ---------
      
      Co-authored-by: command-bot <>
      82cb6992
  17. Mar 17, 2023
  18. Mar 02, 2023
  19. 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
  20. Feb 20, 2023
  21. Feb 14, 2023
  22. Jan 25, 2023
  23. Jan 18, 2023
  24. Jan 11, 2023
  25. Jan 05, 2023
  26. Dec 27, 2022
  27. Dec 22, 2022
  28. Dec 13, 2022
  29. Dec 06, 2022
  30. Nov 30, 2022
  31. Nov 24, 2022
    • Alexander Theißen's avatar
      contracts: Replace `sp-sandbox` and `wasmi-validation` by newest wasmi (#12501) · 08657f14
      Alexander Theißen authored
      
      
      * Replace sp-sandbox and wasmi-validation by just wasmi
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
      
      * Re-check original code on re-instrumentation
      
      * Fix clippy
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarRobin Freyler <[email protected]>
      
      * Replace wasmi by ::wasmi
      
      * Bump wasmi to 0.20
      
      * Add explanation for `unreachable`
      
      * Change proof
      
      * Fixup master merge
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
      
      * Fixup naming inconsistencies introduced by reentrancy PR
      
      * Fix `scan_imports` docs
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * Fixup suggestions
      
      * Remove unnecessary &mut
      
      * Fix test
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
      
      * Fix benchmark merge fail
      
      * ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
      
      * Fix docs as suggested by code review
      
      * Improve docs for `CodeRejected`
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      
      * Fix logic bug when setting `deterministic_only`
      
      * Don't panic when module fails to compile
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarRobin Freyler <[email protected]>
      
      Co-authored-by: command-bot <>
      Co-authored-by: default avatarRobin Freyler <[email protected]>
      Co-authored-by: default avatarSasha Gryaznov <[email protected]>
      08657f14
  32. Nov 15, 2022
    • Artemka374's avatar
      `seal_reentrant_count` returns contract reentrant count (#12695) · 103ea38f
      Artemka374 authored
      * Add logic, test, broken benchmark
      
      * account_entrance_count
      
      * Addressing comments
      
      * Address @agryaznov
      
      's comments
      
      * Add test for account_entrance_count, fix ci
      
      * Cargo fmt
      
      * Fix tests
      
      * Fix tests
      
      * Remove delegated call from test, address comments
      
      * Minor fixes and indentation in wat files
      
      * Update test for account_entrance_count
      
      * Update reentrant_count_call test
      
      * Delegate call test
      
      * Cargo +nightly fmt
      
      * Address comments
      
      * Update reentrant_count_works test
      
      * Apply weights diff
      
      * Add fixture descriptions
      
      * Update comments as suggested
      
      * Update reentrant_count_call test to use seal_address
      
      * add missing code
      
      * cargo fmt
      
      * account_entrance_count -> account_reentrance_count
      
      * fix tests
      
      * fmt
      
      * normalize signatures
      
      Co-authored-by: default avataryarikbratashchuk <[email protected]>
      103ea38f
  33. Nov 03, 2022
  34. Oct 24, 2022
  35. Oct 11, 2022
  36. Oct 02, 2022
    • Alexander Theißen's avatar
      Remove contracts RPCs (#12358) · bb9d2fa7
      Alexander Theißen authored
      * Remove contracts RPCs
      
      * Remove serde as RPC serialization is no longer needed
      
      * Rename folder to match crate name
      
      * Compile fix
      
      * Remove Byte wrapper
      bb9d2fa7
  37. Sep 15, 2022