d38f6e6728
Update benchmarking macros ( #3934 )
...
Current benchmarking macro returns a closure with the captured
benchmarked code.
This can cause issues when the benchmarked code has complex lifetime
requirements.
This PR updates the existing macro by injecting the recording parameter
and invoking the start / stop method around the benchmarked block
instead of returning a closure
One other added benefit is that you can write this kind of code now as
well:
```rust
let v;
#[block]
{ v = func.call(); }
dbg!(v); // or assert something on v
```
[Weights compare
link](https://weights.tasty.limo/compare?unit=weight&ignore_errors=true&threshold=10&method=asymptotic&repo=polkadot-sdk&old=pg/fix-weights&new=pg/bench_update&path_pattern=substrate/frame/**/src/weights.rs,polkadot/runtime/*/src/weights/**/*.rs,polkadot/bridges/modules/*/src/weights.rs,cumulus/**/weights/*.rs,cumulus/**/weights/xcm/*.rs,cumulus/**/src/weights.rs )
---------
Co-authored-by: command-bot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-04-10 06:44:46 +00:00
PG Herveou
2d927b0772
Contracts: Fix legacy uapi ( #3994 )
...
Fix some broken legacy definitions of pallet_contracts_uapi storage host
functions
2024-04-10 05:05:21 +00:00
PG Herveou and Alexander Theißen
b6231c79ca
Contracts: Refactor API to use WeightMeter ( #2943 )
...
Update the Contracts API to use `WeightMeter`, as it simplifies the code
and makes it easier to reason about, rather than taking a mutable weight
or returning a tuple with the weight consumed
---------
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-04-09 10:22:54 +00:00
PG Herveou
78b1cab9e8
Contracts: add test builders ( #3796 )
...
Cleanup tests (-2.7k lines !) using some builder patterns to build
pallet_contracts api calls
2024-03-28 10:40:06 +00:00
PG Herveou
2f59e9efa8
XCM remove extra QueryId types from traits ( #3763 )
...
We do not need to make these traits generic over QueryId type, we can
just use the QueryId alias everywhere
2024-03-22 18:45:26 +00:00
PG Herveou and command-bot
e659c4b3f7
Contracts: Test benchmarking v2 ( #3585 )
...
Co-authored-by: command-bot <>
2024-03-19 19:13:51 +00:00
PG Herveou
e8b51f60cc
Contracts use polkavm workspace deps ( #3715 )
2024-03-15 17:24:38 +00:00
1fe3c5f23b
Contracts: Fix terminate benchmark ( #3558 )
...
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: command-bot <>
2024-03-08 18:13:31 +00:00
a0c9a3d65a
benchmark: allow range trailing comma in RangeArgs ( #3598 )
...
Rustfmt will add a trailing comma for longer expression, this change
will make sure that the Range parameters can still be parsed.
---------
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-03-08 16:36:09 +00:00
PG Herveou
f977c21157
Contracts Bump ApiVersion and add test ( #3619 )
...
ApiVersion should have been bumped with
https://github.com/paritytech/polkadot-sdk/pull/3606
this does that and add a test so we don't forget to do that everytime
2024-03-08 09:48:55 +00:00
PG Herveou
de9411aa4c
Contracts: Remove unstable on lock/unlock_delegate_dependency host fns ( #3606 )
...
Oversight from PR https://github.com/paritytech/polkadot-sdk/pull/3384 .
These 2 functions should have been tagged as stable
2024-03-07 12:39:39 +00:00
PG Herveou
c89b3997df
Contracts: Remove changelog ( #3605 )
...
This is not maintained, and we should be able to get information
from the release changelog
2024-03-07 11:47:30 +00:00
9952786e1b
Contracts upload with Determinism::Enforced when possible ( #3540 )
...
Co-authored-by: Cyrill Leutwiler <cyrill@parity.io >
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-03-06 16:35:55 +00:00
PG Herveou and Alexander Theißen
475e7a1476
Contracts: Charge min amount when processing deletion queue ( #2934 )
...
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-03-06 06:47:33 +00:00
PG Herveou
0eda0b3f17
Contracts call extract_from_slice in macro ( #3566 )
2024-03-05 09:47:42 +00:00
PG Herveou
0708cf382d
Contracts: Fix typo ( #3563 )
2024-03-04 20:32:03 +00:00
PG Herveou
f2645eec12
Contracts Add new version for marking new stable API ( #3415 )
...
Add a `ApiVersion` constant to the pallet-contracts Config to
communicate with developers the current state of the host functions
exposed by the pallet
2024-02-23 13:10:06 +00:00
PG Herveou
d250a6e427
Contracts: Stabilize APIs ( #3384 )
...
Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations:
- call_v2: https://github.com/paritytech/ink/pull/2077
- instantiate_v2: <TODO>
- lock/unlock dependency: https://github.com/paritytech/ink/pull/2076
2024-02-20 14:28:05 +00:00
PG Herveou and command-bot
ca382f3203
Contracts: xcm host fn fixes ( #3086 )
...
## Xcm changes:
- Fix `pallet_xcm::execute`, move the logic into The `ExecuteController`
so it can be shared with anything that implement that trait.
- Make `ExecuteController::execute` retursn `DispatchErrorWithPostInfo`
instead of `DispatchError`, so that we don't charge the full
`max_weight` provided if the execution is incomplete (useful for
force_batch or contracts calls)
- Fix docstring for `pallet_xcm::execute`, to reflect the changes from
#2405
- Update the signature for `ExecuteController::execute`, we don't need
to return the `Outcome` anymore since we only care about
`Outcome::Complete`
## Contracts changes:
- Update host fn `xcm_exexute`, we don't need to write the `Outcome` to
the sandbox memory anymore. This was also not charged as well before so
it if fixes this too.
- One of the issue was that the dry_run of a contract that call
`xcm_execute` would exhaust the `gas_limit`.
This is because `XcmExecuteController::execute` takes a `max_weight`
argument, and since we don't want the user to specify it manually we
were passing everything left by pre-charghing
`ctx.ext.gas_meter().gas_left()`
- To fix it I added a `fn influence_lowest_limit` on the `Token` trait
and make it return false for `RuntimeCost::XcmExecute`.
- Got rid of the `RuntimeToken` indirection, we can just use
`RuntimeCost` directly.
---------
Co-authored-by: command-bot <>
2024-02-19 15:29:47 +00:00
PG Herveou and Alexander Theißen
bc5a758c0c
Contracts update doc.rs metadata ( #3241 )
...
Adding Rust metadata for doc
see https://docs.rs/about/metadata
---------
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-02-08 16:04:55 +00:00
PG Herveou
2dfd7b92d9
Fix markdown lint error ( #3104 )
2024-01-29 10:06:51 +00:00
PG Herveou
f2336d32f2
better debugging for accountid32 in debug build ( #2990 )
2024-01-19 20:54:39 +00:00
PG Herveou
f2fbba3be1
Contracts: stabilize sr25519 ( #2920 )
...
Integration tests in ink!:
https://github.com/paritytech/ink/tree/master/integration-tests/sr25519-verification
2024-01-15 16:21:31 +00:00
bd80dcf685
Contracts: Translate .wat fixtures to rust ( #2654 )
...
- Translate all pallet-contracts fixtures from `wat` to Rust files.
- Fix read_sandbox_memory_as to not use MaxEncodedLen as this could
break if used with types with a non-fixed encoded len.
---------
Co-authored-by: alvicsam <alvicsam@gmail.com >
Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: command-bot <>
2024-01-12 20:10:54 +00:00
PG Herveou
06fa111f58
Contracts: Bump polkavm ( #2884 )
...
bump polkavm-x deps to 0.4.0
2024-01-09 12:43:53 +01:00
PG Herveou and Bastian Köcher
5daef5d086
Contracts rename riscv-experimental and enable ci tests ( #2879 )
...
- Keep feature name short s/riscv-experimental/riscv
- Add to feature to CI build
---------
Co-authored-by: Bastian Köcher <git@kchr.de >
2024-01-08 14:11:31 +01:00
f82c297728
Contracts build risc-v fixtures ( #2554 )
...
Follow up from #2347 this time to verify that fixtures build to RISC-V
---------
Co-authored-by: alvicsam <alvicsam@gmail.com >
Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2024-01-04 15:49:42 +01:00
PG Herveou and Alexander Theißen
2135fa872b
Contracts: use compiled rust tests ( #2347 )
...
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: Alexander Theißen <alex.theissen@me.com >
2023-11-29 22:12:19 +01:00
f517900a48
Contracts expose pallet-xcm ( #1248 )
...
This PR introduces:
- XCM host functions `xcm_send`, `xcm_execute`
- An Xcm trait into the config. that proxy these functions to to
`pallet_xcm`, or disable their usage by using `()`.
- A mock_network and xcm_test files to test the newly added xcm-related
functions.
---------
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-11-14 22:32:14 +02:00
PG Herveou
1cd38c2cd1
Contracts: Bump contracts rococo ( #2286 )
2023-11-14 19:24:45 +02:00
6b7be115fd
Contracts: Add XCM traits to interface with contracts ( #2086 )
...
We are introducing a new set of `XcmController` traits (final name yet
to be determined).
These traits are implemented by `pallet-xcm` and allows other pallets,
such as `pallet_contracts`, to rely on these traits instead of tight
coupling them to `pallet-xcm`.
Using only the existing Xcm traits would mean duplicating the logic from
`pallet-xcm` in these other pallets, which we aim to avoid. Our
objective is to ensure that when these APIs are called from
`pallet-contracts`, they produce the exact same outcomes as if called
directly from `pallet-xcm`.
The other benefits is that we can also expose return values to
`pallet-contracts` instead of just calling `pallet-xcm` dispatchable and
getting a `DispatchResult` back.
See traits integration in this PR
https://github.com/paritytech/polkadot-sdk/pull/1248 , where the traits
are used as follow to define and implement `pallet-contracts` Config.
```rs
// Contracts config:
pub trait Config: frame_system::Config {
// ...
/// A type that exposes XCM APIs, allowing contracts to interact with other parachains, and
/// execute XCM programs.
type Xcm: xcm_executor::traits::Controller<
OriginFor<Self>,
<Self as frame_system::Config>::RuntimeCall,
BlockNumberFor<Self>,
>;
}
// implementation
impl pallet_contracts::Config for Runtime {
// ...
type Xcm = pallet_xcm::Pallet<Self>;
}
```
---------
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: command-bot <>
2023-11-10 17:38:24 +02:00
PG Herveou
64effd0e6f
Contracts move fixtures to new crate ( #2246 )
...
Small PR that introduce a new crate that will host RISC-V & wasm
fixtures for testing pallet-contracts
2023-11-10 13:22:47 +02:00
PG Herveou
18ad449015
Contracts migration update ( #2091 )
...
Restore fix from #2077
2023-10-31 12:08:32 +01:00
PG Herveou
9643a3adf8
Enable "cargo run --bin substrate-node" ( #1927 )
2023-10-27 15:58:55 +02:00
PG Herveou
3148063a6f
Contracts: Add benchmarks to include files ( #2022 )
...
Project that includes pallet-contracts via crates.io will fail to run
```bash
cargo check --features=runtime-benchmarks
```
without the currently not included benchmarks files
2023-10-25 09:47:54 +02:00
PG Herveou
076529ea55
Contracts: Update read_sandbox ( #1390 )
...
* Update runtime.rs
* Fix
* Revert "Update runtime.rs"
This reverts commit 808f026a835b1f2707f640799454a50fd3a8be7b.
* nit mono-repo fixes
2023-09-04 21:33:20 +02:00
PG Herveou and parity-processbot
8abf7c5ee1
Contracts: Update Config::Debug ( #3035 )
...
* Add TraceableCallSpan to contracts
* rename
* Update parachains/runtimes/contracts/contracts-rococo/src/contracts.rs
* update lockfile for {"substrate", "polkadot"}
---------
Co-authored-by: parity-processbot <>
2023-08-24 08:35:52 +00:00
PG Herveou
cd464f9cfd
Contracts: Update Config::Debug ( #14789 )
...
* Update Debug trait
* Rename
* tweak
* fmt
* Better namings
* rm unsafe-debug
* rework doc
* nit
* fix comment
* clippy
* update naming
* Rename file
* fmt fixes
* rename
* Move tracing behind umbrella Debugging trait
* fix
* fix comment
* reorder imports
* comment
* update doc
* add missing doc
* add missing doc
* Update Debugging -> Debugger
* Update bin/node/runtime/Cargo.toml
2023-08-24 07:56:28 +00:00
PG Herveou
91d2ac11b3
Contracts: expose charge_storage to chain_extension ( #14712 )
...
* Contracts: expose charge_storage to chain_extension
* fix typo
* export Diff
2023-08-17 13:37:53 +00:00
PG Herveou and Bastian Köcher
ed7a0b87eb
Remove xcm on_runtime_upgrade pallet hook ( #7235 )
...
* move migration stuffs
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de >
* Fix test
* fix
* lint
* fix lint
* rm extra space
* fix lint
* PR review
* fixes
* use saturating_accrue in fn
* fix test
---------
Co-authored-by: Bastian Köcher <git@kchr.de >
2023-08-05 16:09:21 +00:00
PG Herveou and parity-processbot
49816ff4d9
Contracts: Ensure latest migration match pallet_version ( #14676 )
...
* Add version check
* fix format
* simplify
* restructure imports
* add version check
* Fix benchmarking
* Rename migrations -> BenchMigrations
* doc
* add more docs
* fix format string
* Update frame/contracts/build.rs
* fix
* add cargo:rerun-if-changed
---------
Co-authored-by: parity-processbot <>
2023-07-31 14:48:53 +00:00
PG Herveou
d2411a2639
Contracts Rollback StorageMap hashing migration ( #14661 )
...
* Contracts Rollback StorageMap hashing migration
* misc v13
2023-07-28 10:08:26 +00:00
PG Herveou and parity-processbot
4233427717
Companion PR for contracts delegate deposit PR ( #2913 )
...
* Companion PR for https://github.com/paritytech/substrate/pull/14079
* update lockfile for {"substrate", "polkadot"}
---------
Co-authored-by: parity-processbot <>
2023-07-26 12:41:48 +00:00
5a5b1df69b
Contracts Add deposit for dependencies ( #14079 )
...
* wip
* fixes
* rm comment
* join fns
* clippy
* Fix limits
* reduce diff
* fix
* fix
* fix typo
* refactor store to use self
* refactor run to take self by value
* pass tests
* rm comment
* fixes
* fix typo
* rm
* fix fmt
* clippy
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review, rm duplicate increment_refcount
* PR review
* Update frame/contracts/src/wasm/prepare.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Add test for failing storage_deposit
* fix lint
* wip
* Delegate update take 2
* update
* fix migration
* fix migration
* doc
* fix lint
* update migration
* fix warning
* reformat comment
* regenerate weightInfo trait
* fix merge
* PR review
https://github.com/paritytech/substrate/pull/14079#discussion_r1255904563
* PR review
https://github.com/paritytech/substrate/pull/14079/files#r1257521373
* PR review remove optimisation
https://github.com/paritytech/substrate/pull/14079/files#r1263312237
* PR review fix return type
https://github.com/paritytech/substrate/pull/14079/files#r1263315804
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* PR review pass CodeInfo and update docstring
https://github.com/paritytech/substrate/pull/14079/files#r1257522327
* PR review add code_info to the executable
https://github.com/paritytech/substrate/pull/14079/files#r1263309049
* rename info -> contract_info
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/fixtures/add_remove_delegate_dependency.wat
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/migration/v13.rs
* fix tests
* Fmt & fix tests
* Test Result<(), _> return type
* Update frame/contracts/src/migration.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Revert "Test Result<(), _> return type"
This reverts commit a876168f2054edf84d720c666387583ccbe78dcd.
* add / update doc comments
* fix backticks
* Revert "Revert "Test Result<(), _> return type""
This reverts commit 3cbb6161d1abd9520cd9f8519b4dfbf4f29a2998.
* fix bench
* fix bench
* fix
* Update frame/contracts/src/storage/meter.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* rm stale comments
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR suggestion
* Add missing doc
* fx lint
* ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_contracts
* Update frame/contracts/src/lib.rs
Co-authored-by: Juan <juangirini@gmail.com >
---------
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Juan <juangirini@gmail.com >
2023-07-26 12:09:02 +00:00
PG Herveou and Sasha Gryaznov
e71cca3c0d
Contracts: Enabled signed extension ( #14565 )
...
* Contracts enable signed extension
* Add test
* fix
* xx
* Update frame/contracts/fixtures/sign_extension.wat
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* move tests
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-07-21 11:39:40 +00:00
PG Herveou
99ad485101
Contracts: Tweak test ( #14579 )
2023-07-20 16:43:35 +00:00
PG Herveou
e8a9559696
Contracts add code_len to ContractsInfo ( #14523 )
...
* add code_len to v12
* fix
* Update frame/contracts/src/wasm/mod.rs
* fix
* fixes
* rm test
* add test back
* fix
* update test
* Fix comments
* fix build
* del
* fix clippy
* fix
* re-rename
2023-07-14 12:49:47 +00:00
PG Herveou
49150ee583
quick updates ( #14557 )
2023-07-12 08:59:01 +00:00
PG Herveou
1818bb130e
Contracts rename v9 to v09 ( #14533 )
2023-07-12 08:33:22 +00:00
d3ef2badcb
contracts: Refactor instantiate with code ( #14503 )
...
* wip
* fixes
* rm comment
* join fns
* clippy
* Fix limits
* reduce diff
* fix
* fix
* fix typo
* refactor store to use self
* refactor run to take self by value
* pass tests
* rm comment
* fixes
* fix typo
* rm
* fix fmt
* clippy
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review, rm duplicate increment_refcount
* PR review
* Update frame/contracts/src/wasm/prepare.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Add test for failing storage_deposit
* fix lint
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
---------
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-07-07 13:46:16 +00:00
PG Herveou
073dad97ad
Contracts-rococo: Update migration ( #2763 )
2023-06-22 17:50:32 +00:00
6ac8537436
Update contract multi-block migration ( #14313 )
...
* move migrate sequence to config
* remove commented out code
* Update frame/contracts/src/lib.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* remove Migrations generic
* make runtime use noop migrations
* restrict is_upgrade_supported
* Update contract multi-block migration
Ensure that we do as many steps as possible given the weight limit passed to on_idle
* undo is_upgrade_supported change
* Update bin/node/runtime/src/lib.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* wip
* fix comment (#14316 )
* fix test
* fix
* Update frame/contracts/src/migration.rs
Co-authored-by: Juan <juangirini@gmail.com >
* fix test doc
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Fix compilation with feature runtime-benchmarks
* fix example
* fix cargo doc --document-private-items
* private links
* Remove dup comment
* add doc for MigrationInProgress
* PR review remove duplicate asserts
* simplify upper bound
* fix link
* typo
* typo
* no unwrap()
* correct log message
* missing
* fix typo
* PR comment
* Add example with single element tuple
* Improve migration message
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/migration.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/migration.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* use saturating_accrue instead of +=
* add more doc
* Contracts: Better migration types (#14418 )
* Add explicit error, if try-runtime runs a noop migration
* use mut remaining_weight
---------
Co-authored-by: Juan Girini <juangirini@gmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-06-20 13:16:28 +00:00
PG Herveou and Bastian Köcher
005b9d0989
Contracts: Use RuntimeUpgrade hooks instead of Hooks::on_runtime_upgrade ( #2570 )
...
* Fixes
* Remove on_runtime_upgrade hook
* remove upgrade_fn / add doc to Migration struct
* Add cumulus_pallet_*::migration to Migrations type
* add docstring
* fix
* Update parachain-template/runtime/src/lib.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* Update parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
* Update pallets/parachain-system/src/migration.rs
---------
Co-authored-by: Bastian Köcher <git@kchr.de >
2023-06-05 11:56:55 +00:00
PG Herveou
9dedddafad
frame-support Add translate_next ( #14043 )
...
* Frame Add translate_next
This works similarly to to `translate` but only translate a single entry.
This function will be useful in the context of multi-block migration.
* Add test
* add None return case
* fixes
* PR comment use `?`
2023-06-02 14:11:11 +00:00
c7c5fc709c
contracts: Multi block migrations ( #14045 )
...
* Frame Add translate_next
This works similarly to to `translate` but only translate a single entry.
This function will be useful in the context of multi-block migration.
* Move to lazy migration
* Updates
* simplify MockMigration
* wip
* wip
* add bench
* add bench
* fmt
* fix bench
* add .
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Scalfold v10 / v11 fix tests
* PR comment
* tweak pub use
* wip
* wip
* wip
* misc merge master
* misc merge master
* wip
* rm tmp stuff
* wip
* wip
* wip
* wip
* wip
* fixes
* add state
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* fix
* fixed compilation
* clean up logs
* wip
* Revert "Frame Add translate_next"
This reverts commit 10318fc95c42b1f7f25efeb35e6d947ea02bed88.
* Fix v10 logic
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* wip
* fixes
* exercise del_queue
* bump sample size
* fmt
* wip
* blank line
* fix lint
* fix rustdoc job lint
* PR comment do not use dangerous into()
* Ad macros for updating mod visibility
* Add doc
* Add max_weight to integrity_test
* fix compilation
* Add no migration tests
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* fix clippy
* PR review
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Fix master merge
* fix merge 2
* fix tryruntime
* fix lint
---------
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-05-31 14:19:31 +00:00
PG Herveou
74ba3b29f7
Add non_camel_case_types for storage_alias ( #14104 )
2023-05-09 15:24:41 +00:00
4df004d0d4
Contracts: runtime_call and storage_deposit ( #13990 )
...
* wip
* add comments
* fix comment
* comments
* comments
* PR comment
* field orders
* Update frame/contracts/src/tests.rs
* Update frame/contracts/fixtures/call_runtime_and_call.wat
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/tests.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Validate fees of failed call
* Update frame/contracts/src/tests.rs
* Update frame/contracts/src/tests.rs
* Update frame/contracts/src/tests.rs
* bubble up refund error
* rename fixture file
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: parity-processbot <>
2023-04-29 16:07:55 +00:00
PG Herveou
ac6e43e628
contracts Fix store-call test path ( #14028 )
2023-04-27 10:01:12 +00:00
PG Herveou
34780b1b2b
contracts Add storage_deposit test ( #14003 )
...
* contracts Add storage_deposit test
* fix comments
* PR comments
2023-04-27 08:23:01 +02:00
PG Herveou and Sasha Gryaznov
c11cb1b274
contracts Add LOG_TARGET constant ( #14002 )
...
* contracts Add LOG_TARGET constant
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-04-25 11:46:20 +00:00
PG Herveou
0824b060b4
Update macro use and optimize storage collection ( #13970 )
2023-04-21 17:24:12 +02:00
03c99fe003
contracts: add sr25519_verify ( #13724 )
...
* 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: Sasha Gryaznov <hi@agryaznov.com >
* 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: Alexander Theißen <alex.theissen@me.com >
* 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: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-04-12 14:49:10 +00:00
PG Herveou
8d802eece0
contracts: make test work with debugger ( #13776 )
...
* contracts: make test work with debugger
* fix path
* PR review
* Add comment
* space
* Update frame/contracts/src/tests.rs
* lint
* spelling
2023-03-31 19:44:29 +02:00
PG Herveou and parity-processbot
9d9b346f09
Companion PR for contract deletion updates ( #2409 )
...
* Companion PR for contract deletion updates
see https://github.com/paritytech/substrate/pull/13702
* Revert "Companion PR for contract deletion updates"
This reverts commit 4fb2ca53a1bdfbd7dc0d35be52525da99547c76c.
* fix lint
* update lockfile for {"polkadot", "substrate"}
---------
Co-authored-by: parity-processbot <>
2023-03-31 11:29:44 +00:00
1bd5d2f78d
[Contracts] Overflowing bounded DeletionQueue allows DoS against contract termination ( #13702 )
...
* [Contracts review] Overflowing bounded `DeletionQueue` allows DoS against contract termination
* wip
* wip
* wip
* wip
* wip
* fix doc
* wip
* PR review
* unbreak tests
* fixes
* update budget computation
* PR comment: use BlockWeights::get().max_block
* PR comment: Update queue_trie_for_deletion signature
* PR comment: update deletion budget docstring
* PR comment: impl Default with derive(DefaultNoBound)
* PR comment: Remove DeletedContract
* PR comment Add ring_buffer test
* remove missed comment
* misc comments
* contracts: add sr25519_recover
* Revert "contracts: add sr25519_recover"
This reverts commit d4600e00934b90e5882cf5288f36f98911b51722.
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* PR comments update print_schedule
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/storage.rs
* Update frame/contracts/src/storage.rs
* rm temporary fixes
* fix extra ;
* Update frame/contracts/src/storage.rs
Co-authored-by: juangirini <juangirini@gmail.com >
* Update frame/contracts/src/storage.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* Support stable rust for compiling the runtime (#13580 )
* Support stable rust for compiling the runtime
This pull request brings support for compiling the runtime with stable Rust. This requires at least
rust 1.68.0 to work on stable. The code is written in a way that it is backwards compatible and
should automatically work when someone compiles with 1.68.0+ stable.
* We always support nightlies!
* 🤦
* Sort by version
* Review feedback
* Review feedback
* Fix version parsing
* Apply suggestions from code review
Co-authored-by: Koute <koute@users.noreply.github.com >
---------
Co-authored-by: Koute <koute@users.noreply.github.com >
* github PR commit fixes
* Revert "Support stable rust for compiling the runtime (#13580 )"
This reverts commit 0b985aa5ad114a42003519b712d25a6acc40b0ad.
* Restore DeletionQueueMap
* fix namings
* PR comment
* move comments
* Update frame/contracts/src/storage.rs
* Update frame/contracts/src/storage.rs
* fixes
---------
Co-authored-by: command-bot <>
Co-authored-by: juangirini <juangirini@gmail.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Bastian Köcher <git@kchr.de >
Co-authored-by: Koute <koute@users.noreply.github.com >
2023-03-31 11:03:56 +00:00
PG Herveou
836f544c86
contracts: Add host function tracing ( #13648 )
2023-03-27 19:33:59 +02:00
PG Herveou
c699876ab8
Add linguist-generated to gitattributes ( #13628 )
2023-03-18 08:44:46 +01:00
PG Herveou and Sasha Gryaznov
8fcd235e38
contracts: Refactor trait Ext::*_storage_transparent functions ( #13600 )
...
* Refactor _transparent methods
rewrote commits, stashed the typo changes to remove some diff noise
fixed my unverified email commit
* remove type alias
* Get rid of From<Fix/VarSizedKey> impl blocks
* Get rid of KeyType impl block
* remove unnecessary Key export
* Update frame/contracts/src/exec.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review comment
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-03-17 23:17:21 +01:00
PG Herveou
f5773795e9
Fix typos in pallet-contracts ( #13629 )
...
* Fix typos in pallet-contracts
2023-03-17 16:31:51 +01:00