From bbbfea6bfbc8a34d9cc617063fa168b4d4fc3369 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 00:36:27 +0200 Subject: [PATCH 01/27] test flipper with the runner Signed-off-by: xermicus --- Cargo.lock | 557 +++------ Cargo.toml | 11 +- crates/integration/Cargo.toml | 2 + crates/integration/codesize.json | 6 +- crates/integration/contracts/Baseline.sol | 15 + crates/integration/contracts/flipper.sol | 42 + crates/integration/src/cases.rs | 20 - crates/integration/src/lib.rs | 38 - crates/integration/src/mock_runtime.rs | 1018 ----------------- crates/integration/src/tests.rs | 29 +- .../llvm-context/src/polkavm/context/mod.rs | 10 +- crates/runner/Cargo.toml | 3 +- crates/runner/src/lib.rs | 276 +++-- crates/runner/src/specs.rs | 132 +++ 14 files changed, 492 insertions(+), 1667 deletions(-) delete mode 100644 crates/integration/src/mock_runtime.rs create mode 100644 crates/runner/src/specs.rs diff --git a/Cargo.lock b/Cargo.lock index 5bc6b659..2caa70cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -679,7 +679,6 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "asset-test-utils" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -708,7 +707,6 @@ dependencies = [ [[package]] name = "assets-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -818,7 +816,6 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "binary-merkle-tree" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "hash-db", "log", @@ -942,7 +939,6 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-runtime", "finality-grandpa", @@ -953,13 +949,12 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-messages" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-runtime", @@ -968,13 +963,12 @@ dependencies = [ "scale-info", "serde", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-parachains" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -985,26 +979,24 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-polkadot" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", "frame-support", "sp-api", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-polkadot-core" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-messages", "bp-runtime", @@ -1016,13 +1008,12 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-relayers" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-messages", "bp-runtime", @@ -1030,13 +1021,12 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-runtime" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -1051,7 +1041,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-trie", "trie-db", ] @@ -1059,7 +1049,6 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-parachains", @@ -1072,22 +1061,20 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-trie", ] [[package]] name = "bp-xcm-bridge-hub" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "bp-xcm-bridge-hub-router" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -1098,7 +1085,6 @@ dependencies = [ [[package]] name = "bridge-hub-common" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1114,7 +1100,6 @@ dependencies = [ [[package]] name = "bridge-hub-test-utils" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "asset-test-utils", "bp-header-chain", @@ -1144,7 +1129,7 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -1153,7 +1138,6 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-messages", @@ -1176,7 +1160,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-trie", "staging-xcm", "staging-xcm-builder", @@ -1727,7 +1711,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -1744,7 +1727,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1761,7 +1743,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1781,12 +1762,12 @@ dependencies = [ "polkadot-runtime-parachains", "scale-info", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "sp-inherents", "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-trie", "sp-version", "staging-xcm", @@ -1797,7 +1778,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1808,7 +1788,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -1821,7 +1800,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-solo-to-para" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -1836,7 +1814,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1851,7 +1828,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bounded-collections", "bp-xcm-bridge-hub-router", @@ -1876,7 +1852,6 @@ dependencies = [ [[package]] name = "cumulus-ping" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-pallet-xcm", "cumulus-primitives-core", @@ -1891,7 +1866,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-aura" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "sp-api", "sp-consensus-aura", @@ -1900,7 +1874,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1916,7 +1889,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1930,17 +1902,15 @@ dependencies = [ [[package]] name = "cumulus-primitives-proof-size-hostfunction" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", + "sp-runtime-interface 24.0.0", "sp-trie", ] [[package]] name = "cumulus-primitives-storage-weight-reclaim" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-proof-size-hostfunction", @@ -1956,7 +1926,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "sp-inherents", @@ -1966,7 +1935,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1983,7 +1951,6 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2600,7 +2567,6 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-support-procedural", @@ -2616,15 +2582,14 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", + "sp-storage 19.0.0", "static_assertions", ] [[package]] name = "frame-benchmarking-pallet-pov" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -2638,7 +2603,6 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2649,7 +2613,6 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2665,7 +2628,6 @@ dependencies = [ [[package]] name = "frame-executive" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "aquamarine", "frame-support", @@ -2677,7 +2639,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", ] [[package]] @@ -2695,7 +2657,6 @@ dependencies = [ [[package]] name = "frame-metadata-hash-extension" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "array-bytes", "docify", @@ -2710,7 +2671,6 @@ dependencies = [ [[package]] name = "frame-support" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "aquamarine", "array-bytes", @@ -2733,7 +2693,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-debug-derive 14.0.0", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -2741,8 +2701,8 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", + "sp-tracing 16.0.0", "sp-weights", "static_assertions", "tt-call", @@ -2751,7 +2711,6 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "Inflector", "cfg-expr", @@ -2771,7 +2730,6 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2783,7 +2741,6 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro2", "quote", @@ -2793,7 +2750,6 @@ dependencies = [ [[package]] name = "frame-system" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cfg-if", "docify", @@ -2805,7 +2761,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-version", "sp-weights", ] @@ -2813,7 +2769,6 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -2827,7 +2782,6 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "parity-scale-codec", @@ -2837,7 +2791,6 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "parity-scale-codec", @@ -3127,6 +3080,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hex-conservative" @@ -3980,7 +3936,6 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pallet-alliance" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -3999,7 +3954,6 @@ dependencies = [ [[package]] name = "pallet-asset-conversion" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4017,7 +3971,6 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-ops" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4035,7 +3988,6 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-tx-payment" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4049,7 +4001,6 @@ dependencies = [ [[package]] name = "pallet-asset-rate" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4063,7 +4014,6 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4080,7 +4030,6 @@ dependencies = [ [[package]] name = "pallet-assets" version = "29.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4096,7 +4045,6 @@ dependencies = [ [[package]] name = "pallet-assets-freezer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4111,7 +4059,6 @@ dependencies = [ [[package]] name = "pallet-atomic-swap" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4125,7 +4072,6 @@ dependencies = [ [[package]] name = "pallet-aura" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4141,7 +4087,6 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4156,7 +4101,6 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4169,7 +4113,6 @@ dependencies = [ [[package]] name = "pallet-babe" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4192,7 +4135,6 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "aquamarine", "docify", @@ -4207,13 +4149,12 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", ] [[package]] name = "pallet-balances" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -4228,7 +4169,6 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4247,7 +4187,6 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -4272,7 +4211,6 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4289,7 +4227,6 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-runtime", @@ -4302,13 +4239,12 @@ dependencies = [ "scale-info", "sp-consensus-grandpa", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "pallet-bridge-messages" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-messages", @@ -4320,14 +4256,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-trie", ] [[package]] name = "pallet-bridge-parachains" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-header-chain", "bp-parachains", @@ -4341,13 +4276,12 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "pallet-bridge-relayers" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-messages", "bp-relayers", @@ -4361,13 +4295,12 @@ dependencies = [ "scale-info", "sp-arithmetic", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "pallet-broker" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitvec", "frame-benchmarking", @@ -4385,7 +4318,6 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4403,7 +4335,6 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4422,7 +4353,6 @@ dependencies = [ [[package]] name = "pallet-collective" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4438,7 +4368,6 @@ dependencies = [ [[package]] name = "pallet-collective-content" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4452,7 +4381,6 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitflags 1.3.2", "environmental", @@ -4474,7 +4402,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "wasm-instrument", @@ -4484,7 +4412,6 @@ dependencies = [ [[package]] name = "pallet-contracts-mock-network" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4509,7 +4436,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -4519,7 +4446,6 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro2", "quote", @@ -4537,7 +4463,6 @@ dependencies = [ [[package]] name = "pallet-contracts-uapi" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", @@ -4549,7 +4474,6 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "assert_matches", "frame-benchmarking", @@ -4565,7 +4489,6 @@ dependencies = [ [[package]] name = "pallet-core-fellowship" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4583,7 +4506,6 @@ dependencies = [ [[package]] name = "pallet-delegated-staking" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4598,7 +4520,6 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4615,7 +4536,6 @@ dependencies = [ [[package]] name = "pallet-dev-mode" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4630,7 +4550,6 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4652,7 +4571,6 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4665,7 +4583,6 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4683,7 +4600,6 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -4701,7 +4617,6 @@ dependencies = [ [[package]] name = "pallet-glutton" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "blake2", "frame-benchmarking", @@ -4719,7 +4634,6 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4741,7 +4655,6 @@ dependencies = [ [[package]] name = "pallet-identity" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4757,7 +4670,6 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4776,7 +4688,6 @@ dependencies = [ [[package]] name = "pallet-indices" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4792,7 +4703,6 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4805,7 +4715,6 @@ dependencies = [ [[package]] name = "pallet-lottery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4818,7 +4727,6 @@ dependencies = [ [[package]] name = "pallet-membership" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4834,7 +4742,6 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "environmental", "frame-benchmarking", @@ -4853,7 +4760,6 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -4870,7 +4776,6 @@ dependencies = [ [[package]] name = "pallet-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4889,7 +4794,6 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4906,7 +4810,6 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4921,7 +4824,6 @@ dependencies = [ [[package]] name = "pallet-nft-fractionalization" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4937,7 +4839,6 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4954,7 +4855,6 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "pallet-nfts", "parity-scale-codec", @@ -4964,7 +4864,6 @@ dependencies = [ [[package]] name = "pallet-nis" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -4979,7 +4878,6 @@ dependencies = [ [[package]] name = "pallet-node-authorization" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -4994,7 +4892,6 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5006,13 +4903,12 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", ] [[package]] name = "pallet-nomination-pools-benchmarking" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5025,14 +4921,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", "sp-staking", ] [[package]] name = "pallet-nomination-pools-runtime-api" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -5042,7 +4937,6 @@ dependencies = [ [[package]] name = "pallet-offences" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5058,7 +4952,6 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5081,7 +4974,6 @@ dependencies = [ [[package]] name = "pallet-paged-list" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5098,7 +4990,6 @@ dependencies = [ [[package]] name = "pallet-parameters" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5115,7 +5006,6 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5131,7 +5021,6 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5145,7 +5034,6 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5163,7 +5051,6 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5177,7 +5064,6 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5194,7 +5080,6 @@ dependencies = [ [[package]] name = "pallet-remark" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5210,7 +5095,6 @@ dependencies = [ [[package]] name = "pallet-revive" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitflags 1.3.2", "environmental", @@ -5225,14 +5109,14 @@ dependencies = [ "pallet-revive-uapi", "parity-scale-codec", "paste", - "polkavm 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "polkavm 0.10.0", "scale-info", "serde", "sp-api", "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", ] @@ -5240,12 +5124,11 @@ dependencies = [ [[package]] name = "pallet-revive-fixtures" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "anyhow", "frame-system", "parity-wasm", - "polkavm-linker 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "polkavm-linker 0.10.0", "sp-runtime", "tempfile", "toml 0.8.19", @@ -5254,7 +5137,6 @@ dependencies = [ [[package]] name = "pallet-revive-mock-network" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5278,7 +5160,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -5288,7 +5170,6 @@ dependencies = [ [[package]] name = "pallet-revive-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro2", "quote", @@ -5298,7 +5179,6 @@ dependencies = [ [[package]] name = "pallet-revive-uapi" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", @@ -5310,7 +5190,6 @@ dependencies = [ [[package]] name = "pallet-root-offences" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5325,7 +5204,6 @@ dependencies = [ [[package]] name = "pallet-root-testing" version = "4.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5339,7 +5217,6 @@ dependencies = [ [[package]] name = "pallet-safe-mode" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5357,7 +5234,6 @@ dependencies = [ [[package]] name = "pallet-salary" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5375,7 +5251,6 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5392,7 +5267,6 @@ dependencies = [ [[package]] name = "pallet-scored-pool" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5405,7 +5279,6 @@ dependencies = [ [[package]] name = "pallet-session" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5426,7 +5299,6 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5442,7 +5314,6 @@ dependencies = [ [[package]] name = "pallet-skip-feeless-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5454,7 +5325,6 @@ dependencies = [ [[package]] name = "pallet-society" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5471,7 +5341,6 @@ dependencies = [ [[package]] name = "pallet-staking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5492,7 +5361,6 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5503,7 +5371,6 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "log", "sp-arithmetic", @@ -5512,7 +5379,6 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "sp-api", @@ -5522,7 +5388,6 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5538,7 +5403,6 @@ dependencies = [ [[package]] name = "pallet-statement" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5555,7 +5419,6 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5570,7 +5433,6 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5582,14 +5444,13 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-storage 19.0.0", "sp-timestamp", ] [[package]] name = "pallet-tips" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5607,7 +5468,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -5622,7 +5482,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5634,7 +5493,6 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5653,7 +5511,6 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5671,7 +5528,6 @@ dependencies = [ [[package]] name = "pallet-tx-pause" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -5688,7 +5544,6 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5702,7 +5557,6 @@ dependencies = [ [[package]] name = "pallet-utility" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5717,7 +5571,6 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5731,7 +5584,6 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5745,7 +5597,6 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -5768,7 +5619,6 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -5786,7 +5636,6 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-messages", "bp-runtime", @@ -5800,7 +5649,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -5809,7 +5658,6 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub-router" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", @@ -5820,7 +5668,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", ] @@ -5828,7 +5676,6 @@ dependencies = [ [[package]] name = "parachains-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", @@ -5858,7 +5705,6 @@ dependencies = [ [[package]] name = "parachains-runtimes-test-utils" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -5878,7 +5724,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", "staging-parachain-info", "staging-xcm", "staging-xcm-executor", @@ -6108,7 +5954,6 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -6119,7 +5964,6 @@ dependencies = [ [[package]] name = "polkadot-parachain-primitives" version = "6.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bounded-collections", "derive_more", @@ -6135,7 +5979,6 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitvec", "hex-literal", @@ -6161,7 +6004,6 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitvec", "frame-benchmarking", @@ -6210,19 +6052,17 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bs58", "frame-benchmarking", "parity-scale-codec", "polkadot-primitives", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", ] [[package]] name = "polkadot-runtime-parachains" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bitflags 1.3.2", "bitvec", @@ -6262,7 +6102,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -6270,7 +6110,6 @@ dependencies = [ [[package]] name = "polkadot-sdk" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "asset-test-utils", "assets-common", @@ -6468,11 +6307,11 @@ dependencies = [ "sp-consensus-slots", "sp-core", "sp-core-hashing", - "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-crypto-ec-utils 0.10.0", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-debug-derive 14.0.0", + "sp-externalities 0.25.0", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -6484,22 +6323,22 @@ dependencies = [ "sp-npos-elections", "sp-offchain", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", + "sp-runtime-interface-proc-macro 17.0.0", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", + "sp-storage 19.0.0", "sp-timestamp", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-wasm-interface 20.0.0", "sp-weights", "staging-parachain-info", "staging-xcm", @@ -6515,7 +6354,6 @@ dependencies = [ [[package]] name = "polkadot-sdk-frame" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "frame-benchmarking", @@ -6539,7 +6377,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", ] @@ -6565,21 +6403,9 @@ checksum = "b7ec0c5935f2eff23cfc4653002f4f8d12b37f87a720e0631282d188c32089d6" dependencies = [ "libc", "log", - "polkavm-assembler 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "polkavm-common 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "polkavm-linux-raw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "polkavm" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" -dependencies = [ - "libc", - "log", - "polkavm-assembler 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", - "polkavm-common 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", - "polkavm-linux-raw 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm-assembler 0.10.0", + "polkavm-common 0.10.0", + "polkavm-linux-raw 0.10.0", ] [[package]] @@ -6600,14 +6426,6 @@ dependencies = [ "log", ] -[[package]] -name = "polkavm-assembler" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" -dependencies = [ - "log", -] - [[package]] name = "polkavm-common" version = "0.9.0" @@ -6624,15 +6442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0097b48bc0bedf9f3f537ce8f37e8f1202d8d83f9b621bdb21ff2c59b9097c50" dependencies = [ "log", - "polkavm-assembler 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "polkavm-common" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" -dependencies = [ - "log", + "polkavm-assembler 0.10.0", ] [[package]] @@ -6671,7 +6481,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7855353a5a783dd5d09e3b915474bddf66575f5a3cf45dec8d1c5e051ba320dc" dependencies = [ - "polkavm-common 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "polkavm-common 0.10.0", "proc-macro2", "quote", "syn 2.0.76", @@ -6700,13 +6510,14 @@ dependencies = [ [[package]] name = "polkavm-disassembler" version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c75c1204f837bdd2d945384b73658a8228064e5c163040f367a3acdca9088c9" dependencies = [ "clap", "iced-x86", - "polkavm 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", - "polkavm-common 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", - "polkavm-linker 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm 0.10.0", + "polkavm-common 0.10.0", + "polkavm-linker 0.10.0", ] [[package]] @@ -6734,21 +6545,7 @@ dependencies = [ "hashbrown 0.14.5", "log", "object 0.36.3", - "polkavm-common 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regalloc2 0.9.3", - "rustc-demangle", -] - -[[package]] -name = "polkavm-linker" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" -dependencies = [ - "gimli 0.28.1", - "hashbrown 0.14.5", - "log", - "object 0.32.2", - "polkavm-common 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm-common 0.10.0", "regalloc2 0.9.3", "rustc-demangle", ] @@ -6765,11 +6562,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26e45fa59c7e1bb12ef5289080601e9ec9b31435f6e32800a5c90c132453d126" -[[package]] -name = "polkavm-linux-raw" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" - [[package]] name = "polyval" version = "0.6.2" @@ -6799,9 +6591,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.20" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", "syn 2.0.76", @@ -7111,7 +6903,7 @@ dependencies = [ "alloy-primitives 0.6.4", "criterion", "hex", - "polkavm 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm 0.10.0", "revive-differential", "revive-integration", ] @@ -7148,11 +6940,12 @@ dependencies = [ "env_logger", "hex", "log", - "polkavm 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm 0.10.0", "rayon", "revive-common", "revive-differential", "revive-llvm-context", + "revive-runner", "revive-solidity", "serde", "serde_json", @@ -7167,8 +6960,8 @@ dependencies = [ "inkwell", "libc", "lld-sys", - "polkavm-common 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", - "polkavm-linker 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm-common 0.10.0", + "polkavm-linker 0.10.0", "revive-builtins", "tempfile", ] @@ -7185,7 +6978,7 @@ dependencies = [ "num", "once_cell", "pallet-contracts-pvm-llapi", - "polkavm-common 0.10.0 (git+https://github.com/koute/polkavm.git?rev=360029e)", + "polkavm-common 0.10.0", "polkavm-disassembler", "regex", "revive-builtins", @@ -7202,6 +6995,7 @@ dependencies = [ name = "revive-runner" version = "0.1.0" dependencies = [ + "hex", "parity-scale-codec", "polkadot-sdk", "revive-solidity", @@ -7284,7 +7078,6 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "polkadot-primitives", @@ -7453,18 +7246,16 @@ dependencies = [ [[package]] name = "sc-allocator" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "log", "sp-core", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-wasm-interface 20.0.0", "thiserror", ] [[package]] name = "sc-chain-spec-derive" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7475,7 +7266,6 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "parking_lot", @@ -7485,25 +7275,24 @@ dependencies = [ "schnellru", "sp-api", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "sp-io", "sp-panic-handler", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", "sp-trie", "sp-version", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-wasm-interface 20.0.0", "tracing", ] [[package]] name = "sc-executor-common" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "polkavm 0.9.3", "sc-allocator", "sp-maybe-compressed-blob", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-wasm-interface 20.0.0", "thiserror", "wasm-instrument", ] @@ -7511,18 +7300,16 @@ dependencies = [ [[package]] name = "sc-executor-polkavm" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "log", "polkavm 0.9.3", "sc-executor-common", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-wasm-interface 20.0.0", ] [[package]] name = "sc-executor-wasmtime" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "anyhow", "cfg-if", @@ -7532,15 +7319,14 @@ dependencies = [ "rustix 0.36.17", "sc-allocator", "sc-executor-common", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", + "sp-wasm-interface 20.0.0", "wasmtime", ] [[package]] name = "sc-tracing-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7905,7 +7691,6 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "enumn", "parity-scale-codec", @@ -7932,7 +7717,6 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "byte-slice-cast", "frame-support", @@ -7946,7 +7730,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "ssz_rs", "ssz_rs_derive", ] @@ -7954,7 +7738,6 @@ dependencies = [ [[package]] name = "snowbridge-core" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "ethabi-decode", "frame-support", @@ -7969,7 +7752,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", ] @@ -7977,7 +7760,6 @@ dependencies = [ [[package]] name = "snowbridge-ethereum" version = "0.3.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "ethabi-decode", "ethbloom", @@ -7991,7 +7773,7 @@ dependencies = [ "serde-big-array", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] @@ -8012,7 +7794,6 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-merkle-tree" version = "0.3.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8023,20 +7804,18 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-runtime-api" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "parity-scale-codec", "snowbridge-core", "snowbridge-outbound-queue-merkle-tree", "sp-api", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-ethereum-client" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -8053,26 +7832,24 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "static_assertions", ] [[package]] name = "snowbridge-pallet-ethereum-client-fixtures" version = "0.9.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-inbound-queue" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "alloy-primitives 0.4.2", "alloy-sol-types 0.4.2", @@ -8091,7 +7868,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -8099,19 +7876,17 @@ dependencies = [ [[package]] name = "snowbridge-pallet-inbound-queue-fixtures" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bridge-hub-common", "ethabi-decode", @@ -8127,13 +7902,12 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-system" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-benchmarking", "frame-support", @@ -8145,7 +7919,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -8153,7 +7927,6 @@ dependencies = [ [[package]] name = "snowbridge-router-primitives" version = "0.9.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "hex-literal", @@ -8164,7 +7937,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -8172,14 +7945,13 @@ dependencies = [ [[package]] name = "snowbridge-runtime-common" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "log", "parity-scale-codec", "snowbridge-core", "sp-arithmetic", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -8188,7 +7960,6 @@ dependencies = [ [[package]] name = "snowbridge-runtime-test-common" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -8219,19 +7990,17 @@ dependencies = [ [[package]] name = "snowbridge-system-runtime-api" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "snowbridge-core", "sp-api", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", ] [[package]] name = "sp-api" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "hash-db", @@ -8240,10 +8009,10 @@ dependencies = [ "scale-info", "sp-api-proc-macro", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "sp-metadata-ir", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", "sp-state-machine", "sp-trie", "sp-version", @@ -8253,7 +8022,6 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "Inflector", "blake2", @@ -8267,7 +8035,6 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8279,7 +8046,6 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "integer-sqrt", @@ -8311,7 +8077,6 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8323,7 +8088,6 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "sp-api", "sp-inherents", @@ -8333,7 +8097,6 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "async-trait", "parity-scale-codec", @@ -8349,7 +8112,6 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "async-trait", "parity-scale-codec", @@ -8367,7 +8129,6 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "lazy_static", "parity-scale-codec", @@ -8388,7 +8149,6 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "finality-grandpa", "log", @@ -8405,7 +8165,6 @@ dependencies = [ [[package]] name = "sp-consensus-pow" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "sp-api", @@ -8416,7 +8175,6 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8427,7 +8185,6 @@ dependencies = [ [[package]] name = "sp-core" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "array-bytes", "bandersnatch_vrfs", @@ -8458,11 +8215,11 @@ dependencies = [ "secrecy", "serde", "sp-crypto-hashing", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-debug-derive 14.0.0", + "sp-externalities 0.25.0", + "sp-runtime-interface 24.0.0", + "sp-std 14.0.0", + "sp-storage 19.0.0", "ss58-registry", "substrate-bip39", "thiserror", @@ -8474,7 +8231,6 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "sp-crypto-hashing", ] @@ -8482,7 +8238,6 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -8496,13 +8251,13 @@ dependencies = [ "ark-ed-on-bls12-381-bandersnatch", "ark-ed-on-bls12-381-bandersnatch-ext", "ark-scale", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", ] [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -8522,7 +8277,6 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "blake2b_simd", "byteorder", @@ -8535,7 +8289,6 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "quote", "sp-crypto-hashing", @@ -8545,7 +8298,6 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "proc-macro2", "quote", @@ -8555,7 +8307,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "proc-macro2", "quote", @@ -8565,17 +8317,16 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "environmental", "parity-scale-codec", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-storage 19.0.0", ] [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "environmental", "parity-scale-codec", @@ -8585,7 +8336,6 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8597,7 +8347,6 @@ dependencies = [ [[package]] name = "sp-inherents" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8610,7 +8359,6 @@ dependencies = [ [[package]] name = "sp-io" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bytes", "docify", @@ -8623,11 +8371,11 @@ dependencies = [ "secp256k1", "sp-core", "sp-crypto-hashing", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "sp-keystore", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", "sp-state-machine", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-tracing 16.0.0", "sp-trie", "tracing", "tracing-core", @@ -8636,7 +8384,6 @@ dependencies = [ [[package]] name = "sp-keyring" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "sp-core", "sp-runtime", @@ -8646,18 +8393,16 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "parking_lot", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", ] [[package]] name = "sp-maybe-compressed-blob" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "thiserror", "zstd 0.12.4", @@ -8666,7 +8411,6 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -8676,7 +8420,6 @@ dependencies = [ [[package]] name = "sp-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8687,7 +8430,6 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "log", "parity-scale-codec", @@ -8696,7 +8438,7 @@ dependencies = [ "serde", "sp-api", "sp-core", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-debug-derive 14.0.0", "sp-runtime", "thiserror", ] @@ -8704,7 +8446,6 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8717,7 +8458,6 @@ dependencies = [ [[package]] name = "sp-offchain" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "sp-api", "sp-core", @@ -8727,7 +8467,6 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "backtrace", "lazy_static", @@ -8737,7 +8476,6 @@ dependencies = [ [[package]] name = "sp-runtime" version = "31.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "docify", "either", @@ -8755,7 +8493,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-io", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-weights", "tracing", ] @@ -8763,26 +8501,25 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "polkavm-derive 0.9.1", "primitive-types", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", + "sp-runtime-interface-proc-macro 17.0.0", + "sp-std 14.0.0", + "sp-storage 19.0.0", + "sp-tracing 16.0.0", + "sp-wasm-interface 20.0.0", "static_assertions", ] [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8801,7 +8538,6 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "Inflector", "expander", @@ -8814,7 +8550,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "Inflector", "expander", @@ -8827,7 +8563,6 @@ dependencies = [ [[package]] name = "sp-session" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "scale-info", @@ -8841,7 +8576,6 @@ dependencies = [ [[package]] name = "sp-staking" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8854,7 +8588,6 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "hash-db", "log", @@ -8863,7 +8596,7 @@ dependencies = [ "rand", "smallvec", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "sp-panic-handler", "sp-trie", "thiserror", @@ -8874,7 +8607,6 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "aes-gcm", "curve25519-dalek", @@ -8888,9 +8620,9 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-crypto-hashing", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-runtime-interface 24.0.0", "thiserror", "x25519-dalek", ] @@ -8898,29 +8630,27 @@ dependencies = [ [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-debug-derive 14.0.0", ] [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8932,7 +8662,6 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "async-trait", "parity-scale-codec", @@ -8944,7 +8673,6 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "tracing", @@ -8955,7 +8683,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "parity-scale-codec", "tracing", @@ -8966,7 +8694,6 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "sp-api", "sp-runtime", @@ -8975,7 +8702,6 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "async-trait", "parity-scale-codec", @@ -8989,7 +8715,6 @@ dependencies = [ [[package]] name = "sp-trie" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "ahash 0.8.11", "hash-db", @@ -9002,7 +8727,7 @@ dependencies = [ "scale-info", "schnellru", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-externalities 0.25.0", "thiserror", "tracing", "trie-db", @@ -9012,7 +8737,6 @@ dependencies = [ [[package]] name = "sp-version" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9021,7 +8745,7 @@ dependencies = [ "serde", "sp-crypto-hashing-proc-macro", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "sp-version-proc-macro", "thiserror", ] @@ -9029,7 +8753,6 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -9040,7 +8763,6 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -9052,7 +8774,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" +source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" dependencies = [ "impl-trait-for-tuples", "log", @@ -9062,7 +8784,6 @@ dependencies = [ [[package]] name = "sp-weights" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "bounded-collections", "parity-scale-codec", @@ -9070,7 +8791,7 @@ dependencies = [ "serde", "smallvec", "sp-arithmetic", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-debug-derive 14.0.0", ] [[package]] @@ -9149,7 +8870,6 @@ dependencies = [ [[package]] name = "staging-parachain-info" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -9162,7 +8882,6 @@ dependencies = [ [[package]] name = "staging-xcm" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "array-bytes", "bounded-collections", @@ -9181,7 +8900,6 @@ dependencies = [ [[package]] name = "staging-xcm-builder" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -9203,7 +8921,6 @@ dependencies = [ [[package]] name = "staging-xcm-executor" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "environmental", "frame-benchmarking", @@ -9287,7 +9004,6 @@ dependencies = [ [[package]] name = "substrate-bip39" version = "0.4.7" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -9299,7 +9015,6 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "build-helper", "cargo_metadata", @@ -9417,7 +9132,6 @@ dependencies = [ [[package]] name = "testnet-parachains-constants" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -9614,7 +9328,6 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "expander", "proc-macro-crate", @@ -10220,7 +9933,6 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "polkadot-primitives", @@ -10586,7 +10298,6 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "Inflector", "proc-macro2", @@ -10597,7 +10308,6 @@ dependencies = [ [[package]] name = "xcm-runtime-apis" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "parity-scale-codec", @@ -10611,7 +10321,6 @@ dependencies = [ [[package]] name = "xcm-simulator" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da#559fa1db0594a81d5dbf343613ba2f3fc16708da" dependencies = [ "frame-support", "frame-system", @@ -10624,7 +10333,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=559fa1db0594a81d5dbf343613ba2f3fc16708da)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", diff --git a/Cargo.toml b/Cargo.toml index 0c885831..455c3e4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,10 +50,10 @@ path-slash = "0.2" rayon = "1.8" clap = { version = "4", default-features = false, features = ["derive"] } rand = "0.8" -polkavm-common = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -polkavm-linker = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -polkavm-disassembler = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -polkavm = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } +polkavm-common = "0.10" +polkavm-linker = "0.10" +polkavm-disassembler = "0.10" +polkavm = "0.10" alloy-primitives = "0.6" alloy-sol-types = "0.6" env_logger = { version = "0.10.0", default-features = false } @@ -62,7 +62,8 @@ criterion = { version = "0.5", features = ["html_reports"] } log = { version = "0.4" } codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" } scale-info = { version = "2.11.1", default-features = false } -polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "559fa1db0594a81d5dbf343613ba2f3fc16708da" } +#polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "559fa1db0594a81d5dbf343613ba2f3fc16708da" } +polkadot-sdk = { path = "../polkadot-sdk/umbrella" } # Benchmarking against EVM primitive-types = { version = "0.12", features = ["codec"] } diff --git a/crates/integration/Cargo.toml b/crates/integration/Cargo.toml index 4294f98d..886bd9d0 100644 --- a/crates/integration/Cargo.toml +++ b/crates/integration/Cargo.toml @@ -14,11 +14,13 @@ alloy-sol-types = { workspace = true } hex = { workspace = true } env_logger = { workspace = true } log = { workspace = true } +serde_json = { workspace = true } revive-solidity = { workspace = true } revive-differential = { workspace = true } revive-llvm-context = { workspace = true } revive-common = { workspace = true } +revive-runner = { workspace = true } [dev-dependencies] sha1 = { workspace = true } diff --git a/crates/integration/codesize.json b/crates/integration/codesize.json index 9cedb4ee..26b0d3ea 100644 --- a/crates/integration/codesize.json +++ b/crates/integration/codesize.json @@ -2,9 +2,9 @@ "Baseline": 934, "Computation": 4360, "DivisionArithmetics": 39824, - "ERC20": 46471, + "ERC20": 47040, "Events": 1749, "FibonacciIterative": 2973, - "Flipper": 3563, - "SHA1": 32543 + "Flipper": 3626, + "SHA1": 32541 } \ No newline at end of file diff --git a/crates/integration/contracts/Baseline.sol b/crates/integration/contracts/Baseline.sol index 4fd35604..3db46abf 100644 --- a/crates/integration/contracts/Baseline.sol +++ b/crates/integration/contracts/Baseline.sol @@ -1,5 +1,20 @@ // SPDX-License-Identifier: MIT +/* runner.json + +{ + "actions": [ + { + "Instantiate": { + "origin": "Alice", + "value": 0 + } + } + ] +} + +*/ + pragma solidity ^0.8; contract Baseline { diff --git a/crates/integration/contracts/flipper.sol b/crates/integration/contracts/flipper.sol index 08c48c38..e6fd7626 100644 --- a/crates/integration/contracts/flipper.sol +++ b/crates/integration/contracts/flipper.sol @@ -12,3 +12,45 @@ contract Flipper { coin = !coin; } } + +/* runner.json + +{ + "actions": [ + { + "Instantiate": { + "value": 0, + "data": "0000000000000000000000000000000000000000000000000000000000000001" + } + }, + { + "VerifyStorage": { + "contract": { + "Instantiated": 0 + }, + "key": "0000000000000000000000000000000000000000000000000000000000000000", + "expected": "0100000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "value": 0, + "data": "cde4efa9" + } + }, + { + "VerifyStorage": { + "contract": { + "Instantiated": 0 + }, + "key": "0000000000000000000000000000000000000000000000000000000000000000", + "expected": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + ] +} + +*/ diff --git a/crates/integration/src/cases.rs b/crates/integration/src/cases.rs index 5794ff25..64383c5a 100644 --- a/crates/integration/src/cases.rs +++ b/crates/integration/src/cases.rs @@ -3,8 +3,6 @@ use alloy_sol_types::{sol, SolCall, SolConstructor}; use revive_solidity::test_utils::*; -use crate::mock_runtime::{CallOutput, State}; - #[derive(Clone)] pub struct Contract { pub name: &'static str, @@ -230,24 +228,6 @@ sol!( case!("Storage.sol", Storage, transientCall, storage_transient, value: U256); impl Contract { - /// Execute the contract. - /// - /// Useful helper if the contract state can be ignored, - /// as it spares the deploy transaciton. - /// - /// - Inserts an account with given `code` into a new state. - /// - Callee and caller account will be `Transaction::default_address()`. - /// - Sets the calldata. - /// - Doesn't execute the constructor or deploy code. - /// - Calls the "call" export on a default backend config. - pub fn execute(&self) -> (State, CallOutput) { - State::default() - .transaction() - .with_default_account(&self.pvm_runtime) - .calldata(self.calldata.clone()) - .call() - } - fn build(calldata: Vec, name: &'static str, code: &str) -> Self { Self { name, diff --git a/crates/integration/src/lib.rs b/crates/integration/src/lib.rs index 581a8edb..3b9902c3 100644 --- a/crates/integration/src/lib.rs +++ b/crates/integration/src/lib.rs @@ -1,42 +1,4 @@ -use alloy_primitives::{Address, U256}; -use cases::Contract; -use mock_runtime::{CallOutput, State}; - -use crate::mock_runtime::{Event, ReturnFlags}; - pub mod cases; -pub mod mock_runtime; #[cfg(test)] mod tests; - -pub fn assert_success(contract: &Contract, differential: bool) -> (State, CallOutput) { - let (state, output) = contract.execute(); - assert_eq!(output.flags, ReturnFlags::Success); - - if differential { - let evm = - revive_differential::prepare(contract.evm_runtime.clone(), contract.calldata.clone()); - let (evm_output, evm_log) = revive_differential::execute(evm); - - assert_eq!(output.data.clone(), evm_output); - assert_eq!(output.events.len(), evm_log.len()); - assert_eq!( - output.events, - evm_log - .iter() - .map(|log| Event { - address: Address::from_slice(log.address.as_bytes()), - data: log.data.clone(), - topics: log - .topics - .iter() - .map(|topic| U256::from_be_bytes(topic.0)) - .collect(), - }) - .collect::>() - ); - } - - (state, output) -} diff --git a/crates/integration/src/mock_runtime.rs b/crates/integration/src/mock_runtime.rs deleted file mode 100644 index e89bdb51..00000000 --- a/crates/integration/src/mock_runtime.rs +++ /dev/null @@ -1,1018 +0,0 @@ -//! Mock environment used for integration tests. -use std::collections::HashMap; - -use alloy_primitives::{keccak256, Address, Keccak256, B256, U256}; -use polkavm::{ - Caller, Config, Engine, ExportIndex, GasMeteringKind, Instance, Linker, Module, ModuleConfig, - ProgramBlob, Trap, -}; -use revive_llvm_context::polkavm_const::runtime_api; - -/// The mocked blockchain account. -#[derive(Debug, Default, Clone)] -pub struct Account { - pub value: U256, - pub contract: Option, - pub storage: HashMap, -} - -/// Emitted event data. -#[derive(Debug, Default, Clone, PartialEq)] -pub struct Event { - pub address: Address, - pub data: Vec, - pub topics: Vec, -} - -/// The result of the contract call. -#[derive(Debug, Default, Clone)] -pub struct CallOutput { - /// The return flags. - pub flags: ReturnFlags, - /// The contract call output. - pub data: Vec, - /// The emitted events. - pub events: Vec, -} - -/// The contract blob export to be called. -#[derive(Clone, Debug, Default)] -enum Export { - #[default] - Call, - Deploy(B256), -} - -/// Possible contract call return flags. -#[derive(Debug, Default, Clone, PartialEq)] -#[repr(u32)] -pub enum ReturnFlags { - /// The contract execution returned normally. - Success = 0, - /// The contract execution returned normally but state changes should be reverted. - Revert = 1, - /// The contract trapped unexpectedly during execution. - #[default] - Trap = u32::MAX, -} - -impl From for ReturnFlags { - fn from(value: u32) -> Self { - match value { - 0 => Self::Success, - 1 => Self::Revert, - u32::MAX => Self::Trap, - _ => panic!("invalid return flag: {value}"), - } - } -} - -/// The local context inside the call stack. -#[derive(Debug, Clone)] -struct Frame { - /// The account that is being executed. - callee: Address, - /// The caller account. - caller: Address, - /// The value transferred with this transaction. - callvalue: U256, - /// The calldata for the contract execution. - input: Vec, - // The contract call output. - output: CallOutput, - /// The export to call. - export: Export, - /// The returndata from the last contract call. - returndata: Vec, -} - -impl Default for Frame { - fn default() -> Self { - Self { - callee: Transaction::default_address(), - caller: Transaction::default_address(), - callvalue: Default::default(), - input: Default::default(), - output: Default::default(), - export: Default::default(), - returndata: Default::default(), - } - } -} - -/// The transaction can modify the state by calling contracts. -/// -/// Use the [TransactionBuilder] to create new transactions. -#[derive(Default, Clone, Debug)] -pub struct Transaction { - state: State, - transient_state: State, - stack: Vec, -} - -impl Transaction { - pub const CALL_STACK_SIZE: usize = 1024; - - pub fn default_address() -> Address { - Address::default().create2(B256::default(), keccak256([]).0) - } - - fn top_frame(&self) -> &Frame { - self.stack.last().expect("transactions should have a frame") - } - - fn top_frame_mut(&mut self) -> &mut Frame { - self.stack - .last_mut() - .expect("transactions should have a frame") - } - - fn top_account_mut(&mut self) -> &mut Account { - let account = self.top_frame_mut().callee; - self.state - .accounts - .get_mut(&account) - .unwrap_or_else(|| panic!("callee has no associated account: {account}")) - } - - fn create2(&self, salt: B256, blob_hash: B256) -> Address { - self.top_frame().callee.create2(salt, blob_hash) - } - - fn transient_account_mut(&mut self) -> &mut Account { - let address = self.top_frame().callee; - let account = self - .transient_state - .accounts_mut() - .entry(address) - .or_default(); - account - } -} - -/// Helper to create valid transactions. -#[derive(Default, Clone, Debug)] -pub struct TransactionBuilder { - context: Transaction, - state_before: State, -} - -impl TransactionBuilder { - /// Set the caller account. - pub fn caller(mut self, account: Address) -> Self { - self.context.top_frame_mut().caller = account; - self - } - - /// Set the callee account. - pub fn callee(mut self, account: Address) -> Self { - self.context.top_frame_mut().callee = account; - self - } - - /// Set the transferred callvalue. - pub fn callvalue(mut self, amount: U256) -> Self { - self.context.top_frame_mut().callvalue = amount; - self - } - - /// Set the calldata. - pub fn calldata(mut self, data: Vec) -> Self { - self.context.top_frame_mut().input = data; - self - } - - /// Helper to setup the transaction for deploy code. - /// - Simulate an upload of the `code` - /// - Set the export to `deploy` - /// - Derive address based on the caller and `salt` value - /// - Set the callee to the derived address - /// - Create a new default account at the derived address - pub fn deploy(mut self, code: &[u8], salt: Option) -> Self { - let blob_hash = self.context.state.upload_code(code); - let address = self - .context - .top_frame() - .caller - .create2(salt.unwrap_or_default(), blob_hash); - - self.context.top_frame_mut().export = Export::Deploy(blob_hash); - self.context.top_frame_mut().callee = address; - self.context - .state - .create_account(address, Default::default(), blob_hash); - - self - } - - /// Set the account at [Transaction::default_address] to the given `code`. - /// - /// Useful helper to spare the deploy transaction. - pub fn with_default_account(mut self, code: &[u8]) -> Self { - self.context.state.upload_code(code); - self.context.state.create_account( - Transaction::default_address(), - Default::default(), - keccak256(code), - ); - self - } - - /// Execute the transaction with a default config backend. - /// - /// Reverts any state changes if the contract reverts or the exuection traps. - pub fn call(mut self) -> (State, CallOutput) { - let blob_hash = match self.context.top_frame().export { - Export::Call => self - .context - .top_account_mut() - .contract - .expect("balance transfer"), - Export::Deploy(blob_hash) => blob_hash, - }; - let code = self - .context - .state - .blobs - .get(&blob_hash) - .unwrap_or_else(|| panic!("contract code not found: {blob_hash}")); - let (mut instance, _) = prepare(code, None); - let export = match self.context.top_frame().export { - Export::Call => runtime_api::exports::CALL, - Export::Deploy(_) => runtime_api::exports::DEPLOY, - }; - let export = instance.module().lookup_export(export).unwrap(); - self.call_on(&mut instance, export) - } - - /// Execute the transaction on a given instance and export. - /// The `instance` and `export` are expected to match that of the `Transaction`. - - /// Reverts any state changes if the contract reverts or the exuection traps. - pub fn call_on( - mut self, - instance: &mut Instance, - export: ExportIndex, - ) -> (State, CallOutput) { - let mut state_args = polkavm::StateArgs::default(); - state_args.set_gas(polkavm::Gas::MAX); - - let callvalue = self.context.top_frame().callvalue; - self.context.top_account_mut().value += callvalue; - - let call_args = polkavm::CallArgs::new(&mut self.context, export); - - init_logs(); - - match instance.call(state_args, call_args) { - Err(polkavm::ExecutionError::Trap(_)) => self.finalize(), - Err(other) => panic!("unexpected error: {other}"), - Ok(_) => panic!("unexpected return"), - } - } - - /// Commits or reverts the state changes based on the call flags. - fn finalize(mut self) -> (State, CallOutput) { - let state = match self.context.top_frame().output.flags { - ReturnFlags::Success => self.context.state, - _ => self.state_before, - }; - let output = self.context.stack.pop().unwrap().output; - (state, output) - } -} - -impl From for TransactionBuilder { - fn from(state: State) -> Self { - TransactionBuilder { - state_before: state.clone(), - context: Transaction { - state, - transient_state: Default::default(), - stack: Default::default(), - }, - } - } -} - -/// The mocked blockchain state. -#[derive(Default, Clone, Debug)] -pub struct State { - blobs: HashMap>, - accounts: HashMap, -} - -impl State { - pub const BLOCK_NUMBER: u64 = 123; - pub const BLOCK_TIMESTAMP: u64 = 456; - - pub fn new_deployed(contract: crate::Contract) -> (Self, Address) { - let (state, output) = State::default() - .transaction() - .deploy(&contract.pvm_runtime, None) - .calldata(contract.calldata) - .call(); - assert_eq!(output.flags, ReturnFlags::Success); - - let address = *state.accounts().keys().next().unwrap(); - - (state, address) - } - - pub fn transaction(self) -> TransactionBuilder { - TransactionBuilder { - state_before: self.clone(), - context: Transaction { - state: self, - transient_state: Default::default(), - stack: vec![Default::default()], - }, - } - } - - pub fn upload_code(&mut self, code: &[u8]) -> B256 { - let blob_hash = keccak256(code); - self.blobs.insert(blob_hash, code.to_vec()); - blob_hash - } - - pub fn assert_storage_key(&self, account: Address, key: U256, expected: U256) { - assert_eq!( - self.accounts - .get(&account) - .unwrap_or_else(|| panic!("unknown account: {account}")) - .storage - .get(&key) - .copied() - .unwrap_or_default(), - expected - ); - } - - pub fn create_account(&mut self, address: Address, value: U256, blob_hash: B256) { - self.accounts.insert( - address, - Account { - value, - contract: Some(blob_hash), - storage: HashMap::new(), - }, - ); - } - - pub fn accounts(&self) -> &HashMap { - &self.accounts - } - - pub fn accounts_mut(&mut self) -> &mut HashMap { - &mut self.accounts - } -} - -fn link_host_functions(engine: &Engine) -> Linker { - let mut linker = Linker::new(engine); - - linker - .func_wrap( - runtime_api::imports::INPUT, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let input = &transaction.top_frame().input; - assert!(input.len() <= caller.read_u32(out_len_ptr).unwrap() as usize); - - caller.write_memory(out_ptr, input)?; - caller.write_memory(out_len_ptr, &(input.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::RETURN, - |caller: Caller, - flags: u32, - data_ptr: u32, - data_len: u32| - -> Result<(), Trap> { - let (caller, transaction) = caller.split(); - - let frame = transaction.top_frame_mut(); - frame.output.flags = flags.into(); - frame.output.data = caller.read_memory_into_vec(data_ptr, data_len)?; - - Err(Default::default()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::VALUE_TRANSFERRED, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_VALUE, - "spurious output buffer size: {out_len}" - ); - - let value = transaction.top_frame().callvalue.as_le_bytes(); - caller.write_memory(out_ptr, &value)?; - caller.write_memory(out_len_ptr, &(value.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - "debug_message", - |caller: Caller, str_ptr: u32, str_len: u32| -> Result { - let (caller, _) = caller.split(); - - let data = caller.read_memory_into_vec(str_ptr, str_len)?; - print!("debug_message: {}", String::from_utf8(data).unwrap()); - - Ok(0) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::SET_STORAGE, - |caller: Caller, - transient: u32, - key_ptr: u32, - key_len: u32, - value_ptr: u32, - value_len: u32| - -> Result { - let (caller, transaction) = caller.split(); - - assert_eq!( - key_len as usize, - revive_common::BYTE_LENGTH_WORD, - "storage key must be 32 bytes" - ); - assert_eq!( - value_len as usize, - revive_common::BYTE_LENGTH_WORD, - "storage value must be 32 bytes" - ); - - let key = caller.read_memory_into_vec(key_ptr, key_len)?; - let value = caller.read_memory_into_vec(value_ptr, value_len)?; - - let key = U256::from_le_bytes::<32>(key.try_into().unwrap()); - let value = U256::from_le_bytes::<32>(value.try_into().unwrap()); - - log::info!("set storage {key} = {value}"); - - let storage = if transient == 0 { - &mut transaction.top_account_mut().storage - } else { - &mut transaction.transient_account_mut().storage - }; - storage.insert(key, value); - - Ok(0) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::GET_STORAGE, - |caller: Caller, - transient: u32, - key_ptr: u32, - key_len: u32, - out_ptr: u32, - out_len_ptr: u32| - -> Result { - let (mut caller, transaction) = caller.split(); - - let key = caller.read_memory_into_vec(key_ptr, key_len)?; - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_WORD, - "spurious output buffer size: {out_len}" - ); - - let key = U256::from_le_bytes::<32>(key.try_into().unwrap()); - - let storage = if transient == 0 { - &transaction.top_account_mut().storage - } else { - &transaction.transient_account_mut().storage - }; - let value = storage.get(&key).cloned().unwrap_or_default(); - - log::info!("get storage {key} = {value}"); - - caller.write_memory(out_ptr, &value.to_le_bytes::<32>())?; - caller.write_memory(out_len_ptr, &32u32.to_le_bytes())?; - - Ok(0) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::HASH_KECCAK_256, - |caller: Caller, - input_ptr: u32, - input_len: u32, - out_ptr: u32| - -> Result<(), Trap> { - let (mut caller, _) = caller.split(); - - let pre = caller.read_memory_into_vec(input_ptr, input_len)?; - - let mut hasher = Keccak256::new(); - hasher.update(&pre); - caller.write_memory(out_ptr, &hasher.finalize()[..])?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::NOW, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, _) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_BLOCK_TIMESTAMP, - "spurious output buffer size: {out_len}" - ); - - caller.write_memory(out_ptr, &State::BLOCK_TIMESTAMP.to_le_bytes())?; - caller.write_memory(out_len_ptr, &64u32.to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::BLOCK_NUMBER, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, _) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_BLOCK_NUMBER, - "spurious output buffer size: {out_len}" - ); - - caller.write_memory(out_ptr, &State::BLOCK_NUMBER.to_le_bytes())?; - caller.write_memory(out_len_ptr, &64u32.to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::ADDRESS, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, transaction) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_ETH_ADDRESS, - "spurious output buffer size: {out_len}" - ); - - let address = transaction.top_frame().callee.as_slice(); - caller.write_memory(out_ptr, address)?; - caller.write_memory(out_len_ptr, &(address.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::CALLER, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, transaction) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_ETH_ADDRESS, - "spurious output buffer size: {out_len}" - ); - - let address = transaction.top_frame().caller.as_slice(); - caller.write_memory(out_ptr, address)?; - caller.write_memory(out_len_ptr, &(address.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::DEPOSIT_EVENT, - |caller: Caller, - topics_ptr: u32, - topics_len: u32, - data_ptr: u32, - data_len: u32| { - let (caller, transaction) = caller.split(); - - let address = transaction.top_frame().callee; - let data = if data_len != 0 { - caller.read_memory_into_vec(data_ptr, data_len)? - } else { - Default::default() - }; - let topics = if topics_len != 0 { - caller - .read_memory_into_vec(topics_ptr, topics_len)? - .chunks(32) - .map(|chunk| U256::from_be_slice(chunk)) - .collect() - } else { - Default::default() - }; - - transaction.top_frame_mut().output.events.push(Event { - address, - data, - topics, - }); - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::INSTANTIATE, - |caller: Caller, argument_ptr: u32| { - let (mut caller, transaction) = caller.split(); - - #[derive(Debug)] - #[repr(packed)] - struct Arguments { - code_hash_ptr: u32, - ref_time_limit: u64, - proof_size_limit: u64, - deposit_ptr: u32, - value_ptr: u32, - input_data_ptr: u32, - input_data_len: u32, - address_ptr: u32, - address_len_ptr: u32, - output_ptr: u32, - output_len_ptr: u32, - salt_ptr: u32, - salt_len: u32, - } - let mut buffer = [0; std::mem::size_of::()]; - caller.read_memory_into_slice(argument_ptr, &mut buffer)?; - let arguments: Arguments = unsafe { std::mem::transmute(buffer) }; - - assert_eq!({ arguments.ref_time_limit }, 0); - assert_eq!({ arguments.proof_size_limit }, 0); - assert_eq!({ arguments.deposit_ptr }, u32::MAX); - assert_eq!({ arguments.output_ptr }, u32::MAX); - assert_eq!({ arguments.output_len_ptr }, u32::MAX); - assert_eq!({ arguments.salt_len }, 32); - - if transaction.stack.len() >= Transaction::CALL_STACK_SIZE { - log::info!("deployment faild: maximum stack depth reached"); - caller.write_memory(arguments.address_ptr, &Address::ZERO.0 .0)?; - return Ok(()); - } - - let blob_hash = caller.read_memory_into_vec(arguments.code_hash_ptr, 32)?; - let blob_hash = B256::from_slice(&blob_hash); - let value = caller.read_memory_into_vec(arguments.value_ptr, 20)?; - let input_data = caller - .read_memory_into_vec(arguments.input_data_ptr, arguments.input_data_len)?; - - let address_len = caller.read_u32(arguments.address_len_ptr)?; - assert_eq!(address_len, 20); - - let salt = caller.read_memory_into_vec(arguments.salt_ptr, arguments.salt_len)?; - let salt = B256::from_slice(&salt); - let address = transaction.create2(salt, blob_hash); - if transaction.state.accounts.contains_key(&address) { - log::info!("deployment failed: address {address} already exists"); - caller.write_memory(arguments.address_ptr, &Address::ZERO.0 .0)?; - return Ok(()); - } - - let amount = U256::from_le_slice(&value); - match transaction.top_account_mut().value.checked_sub(amount) { - Some(deducted) => transaction.top_account_mut().value = deducted, - None => { - log::info!("deployment failed: insufficient balance {amount}"); - caller.write_memory(arguments.address_ptr, &Address::ZERO.0 .0)?; - return Ok(()); - } - } - - let (state, output) = transaction - .state - .clone() - .transaction() - .callee(address) - .deploy(transaction.state.blobs.get(&blob_hash).unwrap(), Some(salt)) - .callvalue(amount) - .calldata(input_data) - .call(); - - let result = if output.flags == ReturnFlags::Success { - log::info!("deployment succeeded"); - transaction.state = state; - address - } else { - log::info!("deployment failed: callee reverted {:?}", output.flags); - Address::ZERO - }; - caller.write_memory(arguments.address_ptr, &result.0 .0)?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::CALL, - |caller: Caller, argument_ptr: u32| -> Result { - let (mut caller, transaction) = caller.split(); - - #[derive(Debug)] - #[repr(packed)] - struct Arguments { - _flags: u32, - address_ptr: u32, - _ref_time_limit: u64, - proof_size_limit: u64, - deposit_ptr: u32, - value_ptr: u32, - input_data_ptr: u32, - input_data_len: u32, - output_ptr: u32, - output_len_ptr: u32, - } - let mut buffer = [0; std::mem::size_of::()]; - caller.read_memory_into_slice(argument_ptr, &mut buffer)?; - let arguments: Arguments = unsafe { std::mem::transmute(buffer) }; - - assert_eq!({ arguments.proof_size_limit }, 0); - assert_eq!({ arguments.deposit_ptr }, u32::MAX); - - let amount = if arguments.value_ptr != u32::MAX { - let value = caller.read_memory_into_vec(arguments.value_ptr, 32)?; - U256::from_le_slice(&value) - } else { - U256::ZERO - }; - - match transaction.top_account_mut().value.checked_sub(amount) { - Some(deducted) => transaction.top_account_mut().value = deducted, - None => { - log::info!("call failed: insufficient balance {amount}"); - return Ok(1); - } - } - - let bytes = caller.read_memory_into_vec(arguments.address_ptr, 32)?; - let word = U256::from_le_slice(&bytes); - let address = Address::from_word(word.into()); - log::info!("call {address}"); - - if !transaction.state.accounts.contains_key(&address) { - log::info!( - "balance transfer {amount} from {} to {address}", - transaction.top_frame().callee - ); - - transaction - .state - .accounts - .entry(address) - .or_insert_with(|| Account { - value: amount, - contract: None, - storage: Default::default(), - }); - - return Ok(0); - } - - if transaction.stack.len() >= Transaction::CALL_STACK_SIZE { - log::info!("deployment faild: maximum stack depth reached"); - return Ok(1); - } - - let calldata = caller - .read_memory_into_vec(arguments.input_data_ptr, arguments.input_data_len)?; - - let (state, output) = transaction - .state - .clone() - .transaction() - .callee(address) - .callvalue(amount) - .calldata(calldata) - .call(); - - let bytes_to_copy = caller.read_u32(arguments.output_len_ptr)? as usize; - let output_size = output.data.len(); - assert!( - bytes_to_copy <= output_size, - "output buffer of {bytes_to_copy}b too small for {output_size}b" - ); - - transaction.top_frame_mut().returndata = output.data.to_vec(); - caller.write_memory( - arguments.output_ptr, - &transaction.top_frame().returndata[..bytes_to_copy], - )?; - caller.write_memory(arguments.output_len_ptr, &output.data.len().to_le_bytes())?; - assert_eq!( - transaction.top_frame().returndata.len(), - caller.read_u32(arguments.output_len_ptr)? as usize - ); - - let success = if output.flags == ReturnFlags::Success { - log::info!("call succeeded"); - transaction.state = state; - 0 - } else { - log::info!("call failed: callee reverted {:?}", output.flags); - 1 - }; - - Ok(success) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::CODE_SIZE, - |caller: Caller, address_ptr: u32| { - let (caller, transaction) = caller.split(); - - let address = if address_ptr == u32::MAX { - transaction.top_frame().callee - } else { - let bytes = caller.read_memory_into_vec(address_ptr, 32)?; - let word = U256::from_le_slice(&bytes); - Address::from_word(word.into()) - }; - - let code_size = transaction - .state - .accounts - .get(&address) - .and_then(|account| account.contract) - .and_then(|blob_hash| transaction.state.blobs.get(&blob_hash)) - .map(|code| code.len()) - .unwrap_or_default() as u32; - - log::info!("code size of {address} = {code_size}"); - - Ok(code_size) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::RETURNDATACOPY, - |caller: Caller, - destination_ptr: u32, - offset: u32, - size: u32| - -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let offset = offset as usize; - let slice_end = offset - .checked_add(size as usize) - .expect("offset + size overflows"); - - assert!( - slice_end <= transaction.top_frame().returndata.len(), - "offset + size is larger than RETURNDATASIZE" - ); - - caller.write_memory( - destination_ptr, - &transaction.top_frame().returndata[offset..slice_end], - )?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::BALANCE, - |caller: Caller, address_ptr: u32, balance_ptr: u32| -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let bytes = caller.read_memory_into_vec(address_ptr, 32)?; - let word = U256::from_le_slice(&bytes); - let address = Address::from_word(word.into()); - let balance = transaction - .state - .accounts() - .get(&address) - .map(|account| account.value) - .unwrap_or(U256::default()); - - caller.write_memory(balance_ptr, &balance.to_le_bytes::<32>())?; - - log::info!("account {address} balance {balance}"); - - Ok(()) - }, - ) - .unwrap(); - - linker -} - -pub fn setup(config: Option) -> Engine { - Engine::new(&config.unwrap_or_default()).unwrap() -} - -pub fn recompile_code(code: &[u8], engine: &Engine) -> Module { - let mut module_config = ModuleConfig::new(); - module_config.set_gas_metering(Some(GasMeteringKind::Sync)); - - Module::new(engine, &module_config, code.into()).unwrap() -} - -pub fn instantiate_module( - module: &Module, - engine: &Engine, -) -> (Instance, ExportIndex) { - let export = module.lookup_export(runtime_api::imports::CALL).unwrap(); - let func = link_host_functions(engine).instantiate_pre(module).unwrap(); - let instance = func.instantiate().unwrap(); - - (instance, export) -} - -pub fn prepare(code: &[u8], config: Option) -> (Instance, ExportIndex) { - let blob = ProgramBlob::parse(code.into()) - .unwrap_or_else(|err| panic!("{err}\n{}", hex::encode(code))); - - let engine = Engine::new(&config.unwrap_or_default()).unwrap(); - - let mut module_config = ModuleConfig::new(); - module_config.set_gas_metering(Some(GasMeteringKind::Sync)); - - let module = Module::from_blob(&engine, &module_config, blob).unwrap(); - let export = module.lookup_export(runtime_api::exports::CALL).unwrap(); - let func = link_host_functions(&engine) - .instantiate_pre(&module) - .unwrap(); - let instance = func.instantiate().unwrap(); - - (instance, export) -} - -fn init_logs() { - if std::env::var("RUST_LOG").is_ok() { - #[cfg(test)] - let test = true; - #[cfg(not(test))] - let test = false; - let _ = env_logger::builder().is_test(test).try_init(); - } -} diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index ca08bff0..19b402a1 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,18 +1,20 @@ -use std::str::FromStr; - -use alloy_primitives::{keccak256, Address, FixedBytes, B256, I256, U256}; -use alloy_sol_types::{sol, SolCall, SolValue}; -use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; -use sha1::Digest; - -use revive_solidity::test_utils::*; +use revive_runner::*; + +macro_rules! test_spec { + ($test_name:ident, $contract_name:literal, $source_file:literal) => { + #[test] + fn $test_name() { + let solidity = include_str!(concat!("../contracts/", $source_file)); + let mut specs = specs_from_comment($contract_name, solidity); + run_test(specs.remove(0)); + } + }; +} -use crate::{ - assert_success, - cases::Contract, - mock_runtime::{self, ReturnFlags, State, Transaction}, -}; +test_spec!(baseline, "Baseline", "Baseline.sol"); +test_spec!(flipper, "Flipper", "flipper.sol"); +/* #[test] fn fibonacci() { let parameter = 6; @@ -638,3 +640,4 @@ fn transient_storage() { .values() .all(|account| account.storage.is_empty())); } +*/ diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 931f9da8..4e98ec62 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -688,8 +688,14 @@ where self.builder() .build_store(storage_key_pointer.value, storage_key_value)?; - let (storage_value_pointer, storage_value_length_pointer) = self - .build_stack_parameter(revive_common::BIT_LENGTH_WORD, "storage_value_pointer"); + let storage_value_pointer = + self.build_alloca(self.word_type(), "storage_value_pointer"); + let storage_value_length_pointer = + self.build_alloca(self.xlen_type(), "storage_value_length_pointer"); + self.build_store( + storage_value_length_pointer, + self.word_const(revive_common::BIT_LENGTH_WORD as u64), + )?; let transient = pointer.address_space == AddressSpace::TransientStorage; diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index 21d85984..4a500012 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -10,8 +10,9 @@ descritption = "Execute revive contracts in a simulated blockchain runtime" [dependencies] serde = { workspace = true } serde_json = { workspace = true } +hex = { workspace = true, features = ["serde"] } codec = { workspace = true, default-features = false } scale-info = { workspace = true, default-features = false } polkadot-sdk = { workspace = true, features = ["experimental", "runtime"] } -revive-solidity = { workspace = true } \ No newline at end of file +revive-solidity = { workspace = true } diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index c47a428f..6f41ccf3 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -6,11 +6,11 @@ //! ## Example //! ```rust //! use revive_runner::*; -//! use SpecsAction::*; +//! use specs::SpecsAction::*; //! run_test(Specs { //! balances: vec![(ALICE, 1_000_000_000)], //! actions: vec![Instantiate { -//! origin: ALICE, +//! origin: TestAccountId::Alice, //! value: 0, //! gas_limit: Some(GAS_LIMIT), //! storage_deposit_limit: Some(DEPOSIT_LIMIT), @@ -18,7 +18,7 @@ //! data: vec![], //! salt: vec![], //! }], -//! }) +//! }); //! ``` use polkadot_sdk::*; @@ -27,16 +27,21 @@ use polkadot_sdk::{ polkadot_runtime_common::BuildStorage, polkadot_sdk_frame::testing_prelude::*, sp_keystore::{testing::MemoryKeystore, KeystoreExt}, - sp_runtime::AccountId32, }; use serde::{Deserialize, Serialize}; mod runtime; +mod specs; + use crate::runtime::*; +pub use crate::specs::*; + +pub const ALICE: AccountId = AccountId::new([1u8; 32]); +pub const BOB: AccountId = AccountId::new([2u8; 32]); +pub const CHARLIE: AccountId = AccountId::new([3u8; 32]); -pub const ALICE: AccountId32 = AccountId32::new([1u8; 32]); -pub const BOB: AccountId32 = AccountId32::new([2u8; 32]); -pub const CHARLIE: AccountId32 = AccountId32::new([3u8; 32]); +const SPEC_MARKER_BEGIN: &str = "/* runner.json"; +const SPEC_MARKER_END: &str = "*/"; /// Externalities builder #[derive(Default)] @@ -81,18 +86,19 @@ pub const DEPOSIT_LIMIT: Balance = 10_000_000; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VerifyCallExpectation { /// When provided, the expected gas consumed - gas_consumed: Option, + pub gas_consumed: Option, /// When provided, the expected output - output: Option>, + #[serde(default, with = "hex::serde")] + pub output: Vec, ///Expected call result - success: bool, + pub success: bool, } impl Default for VerifyCallExpectation { fn default() -> Self { Self { gas_consumed: None, - output: None, + output: vec![], success: true, } } @@ -100,21 +106,22 @@ impl Default for VerifyCallExpectation { impl VerifyCallExpectation { /// Verify that the expectations are met - fn verify(self, result: CallResult) { - dbg!(&result); - assert_eq!(self.success, result.is_ok()); + fn verify(self, result: &CallResult) { + assert_eq!( + self.success, + result.is_ok(), + "contract execution reverted: {result:?}" + ); if let Some(gas_consumed) = self.gas_consumed { assert_eq!(gas_consumed, result.gas_consumed()); } - if let Some(output) = self.output { - assert_eq!(output, result.output()); - } + assert_eq!(self.output, result.output()); } } /// Result of a call -#[derive(Debug)] -enum CallResult { +#[derive(Clone, Debug)] +pub enum CallResult { Exec(ContractExecResult), Instantiate(ContractInstantiateResult), } @@ -166,6 +173,12 @@ pub enum Code { Hash(Hash), } +impl Default for Code { + fn default() -> Self { + Self::Bytes(vec![]) + } +} + impl From for pallet_revive::Code { fn from(val: Code) -> Self { match val { @@ -182,99 +195,38 @@ impl From for pallet_revive::Code { } } -/// An action to perform in a contract test -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum SpecsAction { - /// Instantiate a contract - Instantiate { - origin: AccountId, - #[serde(default)] - value: Balance, - #[serde(default)] - gas_limit: Option, - #[serde(default)] - storage_deposit_limit: Option, - code: Code, - #[serde(default)] - data: Vec, - #[serde(default)] - salt: Vec, - }, - /// Call a contract - Call { - origin: AccountId, - dest: AccountId, - #[serde(default)] - value: Balance, - #[serde(default)] - gas_limit: Option, - #[serde(default)] - storage_deposit_limit: Option, - #[serde(default)] - data: Vec, - }, - /// Verify the result of the last call, omitting this will simply ensure the last call was successful - VerifyCall(VerifyCallExpectation), - - /// Verify the balance of an account - VerifyBalance { - origin: AccountId, - expected: Balance, - }, - /// Verify the storage of a contract - VerifyStorage { - contract: AccountId, - key: Vec, - expected: Option>, - }, -} - -/// Specs for a contract test -#[derive(Default, Debug, Serialize, Deserialize)] -#[serde(default)] -pub struct Specs { - /// List of endowments at genesis - pub balances: Vec<(AccountId, Balance)>, - /// List of actions to perform - pub actions: Vec, -} - -impl Specs { - /// Get the list of actions to perform - /// A default [`SpecAction::VerifyCall`] is injected after each Instantiate or Call action when - /// missing - fn actions(&self) -> Vec { - self.actions - .iter() - .enumerate() - .flat_map(|(index, item)| { - let next_item = self.actions.get(index + 1); - if matches!( - item, - SpecsAction::Instantiate { .. } | SpecsAction::Call { .. } - ) && !matches!(next_item, Some(SpecsAction::VerifyCall(_))) - { - return vec![ - item.clone(), - SpecsAction::VerifyCall(VerifyCallExpectation::default()), - ]; - } - vec![item.clone()] - }) - .collect() - } -} - /// Run a contract test /// The test takes a [`Specs`] and executes the actions in order -pub fn run_test(specs: Specs) { +pub fn run_test(specs: Specs) -> Vec { + let mut results = vec![]; + + let translate_account = |id: &TestAccountId, results: &[CallResult]| -> AccountId { + match id { + TestAccountId::Alice => ALICE, + TestAccountId::Bob => BOB, + TestAccountId::Charlie => CHARLIE, + TestAccountId::AccountId(account_id) => account_id.clone(), + TestAccountId::Instantiated(n) => match results + .get(*n as usize) + .expect("should provide valid index into call results") + { + CallResult::Exec(_) => panic!("call #{n} should be an instantiation"), + CallResult::Instantiate(res) => res + .result + .as_ref() + .expect("call #{n} reverted") + .account_id + .clone(), + }, + } + }; + ExtBuilder::default() .balance_genesis_config(specs.balances.clone()) .build() .execute_with(|| { - use SpecsAction::*; + use specs::SpecsAction::*; - let mut res: Option = None; let actions = specs.actions(); for action in actions { @@ -287,19 +239,17 @@ pub fn run_test(specs: Specs) { code, data, salt, - } => { - res = Some(CallResult::Instantiate(Contracts::bare_instantiate( - RuntimeOrigin::signed(origin), - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - code.into(), - data, - salt, - DebugInfo::Skip, - CollectEvents::Skip, - ))); - } + } => results.push(CallResult::Instantiate(Contracts::bare_instantiate( + RuntimeOrigin::signed(translate_account(&origin, &results)), + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + code.into(), + data, + salt, + DebugInfo::Skip, + CollectEvents::Skip, + ))), Call { origin, dest, @@ -307,54 +257,62 @@ pub fn run_test(specs: Specs) { gas_limit, storage_deposit_limit, data, - } => { - res = Some(CallResult::Exec(Contracts::bare_call( - RuntimeOrigin::signed(origin), - dest, - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - data, - DebugInfo::Skip, - CollectEvents::Skip, - ))); - } + } => results.push(CallResult::Exec(Contracts::bare_call( + RuntimeOrigin::signed(translate_account(&origin, &results)), + translate_account(&dest, &results), + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + data, + DebugInfo::Skip, + CollectEvents::Skip, + ))), VerifyCall(expectation) => { - if let Some(res) = res.take() { - expectation.verify(res); - } else { - panic!("No call to verify"); - } + expectation.verify(results.last().expect("No call to verify")); } VerifyBalance { origin, expected } => { - assert_eq!(Balances::free_balance(&origin), expected); + let balance = Balances::free_balance(&translate_account(&origin, &results)); + assert_eq!(balance, expected); } VerifyStorage { contract, key, expected, } => { - let Ok(storage) = Contracts::get_storage(contract, key) else { + let Ok(storage) = Contracts::get_storage( + translate_account(&contract, &results), + key.clone(), + ) else { panic!("Error reading storage"); }; - assert_eq!(storage, expected); + let Some(value) = storage else { + panic!("No value for storage key 0x{}", hex::encode(key)); + }; + assert_eq!(value, expected); } } } }); + + match &results[0] { + CallResult::Instantiate(res) => res.result.as_ref().unwrap().account_id.clone(), + _ => todo!(), + }; + + results } #[cfg(test)] mod tests { - use super::*; + use crate::*; #[test] fn instantiate_works() { - use SpecsAction::*; + use specs::SpecsAction::*; run_test(Specs { balances: vec![(ALICE, 1_000_000_000)], actions: vec![Instantiate { - origin: ALICE, + origin: TestAccountId::Alice, value: 0, gas_limit: Some(GAS_LIMIT), storage_deposit_limit: Some(DEPOSIT_LIMIT), @@ -362,7 +320,7 @@ mod tests { data: vec![], salt: vec![], }], - }) + }); } #[test] @@ -376,7 +334,7 @@ mod tests { "actions": [ { "Instantiate": { - "origin": "5C62Ck4UrFPiBtoCmeSrgF7x9yv9mn38446dhCpsi2mLHiFT", + "origin": "Alice", "value": 0, "code": { "Path": "fixtures/Baseline.pvm" @@ -391,3 +349,35 @@ mod tests { run_test(specs); } } + +pub fn specs_from_comment(contract_name: &str, solidity: &str) -> Vec { + let mut json_string = String::with_capacity(solidity.len()); + let mut is_reading = false; + let mut specs = Vec::new(); + + for line in solidity.lines() { + if line.starts_with(SPEC_MARKER_BEGIN) { + is_reading = true; + continue; + } + if line.starts_with(SPEC_MARKER_END) { + match serde_json::from_str::(&json_string) { + Ok(mut spec) => { + spec.replace_empty_code(contract_name, solidity); + specs.push(spec); + } + Err(e) => panic!("invalid spec JSON: {e}"), + } + is_reading = false; + json_string.clear(); + continue; + } + if is_reading { + json_string.push_str(line) + } + } + + assert!(!specs.is_empty(), "source does not contain any test spec"); + + specs +} diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs new file mode 100644 index 00000000..4725f6fc --- /dev/null +++ b/crates/runner/src/specs.rs @@ -0,0 +1,132 @@ +use serde::{Deserialize, Serialize}; + +use crate::*; +use revive_solidity::test_utils::*; + +/// An action to perform in a contract test +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum SpecsAction { + /// Instantiate a contract + Instantiate { + #[serde(default)] + origin: TestAccountId, + #[serde(default)] + value: Balance, + #[serde(default)] + gas_limit: Option, + #[serde(default)] + storage_deposit_limit: Option, + #[serde(default)] + code: Code, + #[serde(default, with = "hex::serde")] + data: Vec, + #[serde(default, with = "hex::serde")] + salt: Vec, + }, + /// Call a contract + Call { + #[serde(default)] + origin: TestAccountId, + dest: TestAccountId, + #[serde(default)] + value: Balance, + #[serde(default)] + gas_limit: Option, + #[serde(default)] + storage_deposit_limit: Option, + #[serde(default, with = "hex::serde")] + data: Vec, + }, + /// Verify the result of the last call, omitting this will simply ensure the last call was successful + VerifyCall(VerifyCallExpectation), + + /// Verify the balance of an account + VerifyBalance { + origin: TestAccountId, + expected: Balance, + }, + /// Verify the storage of a contract + VerifyStorage { + contract: TestAccountId, + #[serde(with = "hex::serde")] + key: Vec, + #[serde(default, with = "hex::serde")] + expected: Vec, + }, +} + +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub enum TestAccountId { + /// The ALICE account + #[default] + Alice, + /// The BOB account + Bob, + /// The CHARLIE account + Charlie, + /// AccountID that was created during the nth call in this run. + Instantiated(u32), + /// Arbitrary AccountID + AccountId(AccountId), +} + +/// Specs for a contract test +#[derive(Debug, Serialize, Deserialize)] +#[serde(default)] +pub struct Specs { + /// List of endowments at genesis + pub balances: Vec<(AccountId, Balance)>, + /// List of actions to perform + pub actions: Vec, +} + +impl Default for Specs { + fn default() -> Self { + Self { + balances: vec![(ALICE, 1_000_000_000)], + actions: Default::default(), + } + } +} + +impl Specs { + /// Get the list of actions to perform + /// A default [`SpecAction::VerifyCall`] is injected after each Instantiate or Call action when + /// missing + pub fn actions(&self) -> Vec { + self.actions + .iter() + .enumerate() + .flat_map(|(index, item)| { + let next_item = self.actions.get(index + 1); + if matches!( + item, + SpecsAction::Instantiate { .. } | SpecsAction::Call { .. } + ) && !matches!(next_item, Some(SpecsAction::VerifyCall(_))) + { + return vec![ + item.clone(), + SpecsAction::VerifyCall(VerifyCallExpectation::default()), + ]; + } + vec![item.clone()] + }) + .collect() + } + + pub fn replace_empty_code(&mut self, contract_name: &str, contract_source: &str) { + for action in self.actions.iter_mut() { + let SpecsAction::Instantiate { + code: Code::Bytes(bytes), + .. + } = action + else { + continue; + }; + + if bytes.is_empty() { + *bytes = compile_blob(contract_name, contract_source); + } + } + } +} From a84bc72b42fecd7f8d19719544451d118eb45935 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 12:36:35 +0200 Subject: [PATCH 02/27] fibonacci Signed-off-by: xermicus --- crates/integration/contracts/Fibonacci.sol | 26 ++++++++ crates/integration/contracts/flipper.sol | 26 ++++---- crates/integration/src/tests.rs | 41 ++---------- crates/runner/src/lib.rs | 76 ++++++++++++---------- 4 files changed, 83 insertions(+), 86 deletions(-) diff --git a/crates/integration/contracts/Fibonacci.sol b/crates/integration/contracts/Fibonacci.sol index d8fbc983..760778ec 100644 --- a/crates/integration/contracts/Fibonacci.sol +++ b/crates/integration/contracts/Fibonacci.sol @@ -4,6 +4,32 @@ pragma solidity ^0.8; // https://medium.com/coinmonks/fibonacci-in-solidity-8477d907e22a +/* runner.json + +{ + "actions": [ + { + "Instantiate": {} + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "6b83dd2e0000000000000000000000000000000000000000000000000000000000000006" + } + }, + { + "VerifyCall": { + "success": true, + "output": "0000000000000000000000000000000000000000000000000000000000000008" + } + } + ] +} + +*/ + contract FibonacciRecursive { function f(uint n) internal pure returns (uint) { if (n <= 1) { diff --git a/crates/integration/contracts/flipper.sol b/crates/integration/contracts/flipper.sol index e6fd7626..cdc4bb4f 100644 --- a/crates/integration/contracts/flipper.sol +++ b/crates/integration/contracts/flipper.sol @@ -1,25 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8; -contract Flipper { - bool coin; - - constructor(bool _coin) { - coin = _coin; - } - - function flip() public { - coin = !coin; - } -} - /* runner.json { "actions": [ { "Instantiate": { - "value": 0, "data": "0000000000000000000000000000000000000000000000000000000000000001" } }, @@ -37,7 +24,6 @@ contract Flipper { "dest": { "Instantiated": 0 }, - "value": 0, "data": "cde4efa9" } }, @@ -54,3 +40,15 @@ contract Flipper { } */ + +contract Flipper { + bool coin; + + constructor(bool _coin) { + coin = _coin; + } + + function flip() public { + coin = !coin; + } +} diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 19b402a1..b9b0f358 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,3 +1,4 @@ +use alloy_sol_types::SolValue; use revive_runner::*; macro_rules! test_spec { @@ -13,45 +14,11 @@ macro_rules! test_spec { test_spec!(baseline, "Baseline", "Baseline.sol"); test_spec!(flipper, "Flipper", "flipper.sol"); +test_spec!(fibonacci_recursive, "FibonacciRecursive", "Fibonacci.sol"); +test_spec!(fibonacci_iterative, "FibonacciIterative", "Fibonacci.sol"); +test_spec!(fibonacci_binet, "FibonacciBinet", "Fibonacci.sol"); /* -#[test] -fn fibonacci() { - let parameter = 6; - - for contract in [ - Contract::fib_recursive(U256::from(parameter)), - Contract::fib_iterative(U256::from(parameter)), - Contract::fib_binet(U256::from(parameter)), - ] { - let (_, output) = assert_success(&contract, true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::from(8); - assert_eq!(received, expected); - } -} - -#[test] -fn flipper() { - let (state, address) = State::new_deployed(Contract::flipper_constructor(true)); - - let contract = Contract::flipper(); - let (state, output) = state - .transaction() - .calldata(contract.calldata.clone()) - .callee(address) - .call(); - assert_eq!(output.flags, ReturnFlags::Success); - state.assert_storage_key(address, U256::ZERO, U256::ZERO); - - let (state, output) = state - .transaction() - .calldata(contract.calldata) - .callee(address) - .call(); - assert_eq!(output.flags, ReturnFlags::Success); - state.assert_storage_key(address, U256::ZERO, U256::from(1)); -} #[test] fn hash_keccak_256() { diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 6f41ccf3..90275b25 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -162,7 +162,7 @@ impl CallResult { pub enum Code { /// Compile a single solidity source and use the blob of `contract` Solidity { - path: std::path::PathBuf, + path: Option, contract: String, }, /// Read the contract blob from disk @@ -183,9 +183,15 @@ impl From for pallet_revive::Code { fn from(val: Code) -> Self { match val { Code::Solidity { path, contract } => { + let Some(path) = path else { + panic!("Solidity source of contract '{contract}' missing path"); + }; + let Ok(source_code) = std::fs::read_to_string(&path) else { + panic!("Failed to reead source code from {}", path.display()); + }; pallet_revive::Code::Upload(revive_solidity::test_utils::compile_blob( - contract.as_str(), - std::fs::read_to_string(path).unwrap().as_str(), + &contract, + &source_code, )) } Code::Path(path) => pallet_revive::Code::Upload(std::fs::read(path).unwrap()), @@ -302,6 +308,38 @@ pub fn run_test(specs: Specs) -> Vec { results } +pub fn specs_from_comment(contract_name: &str, solidity: &str) -> Vec { + let mut json_string = String::with_capacity(solidity.len()); + let mut is_reading = false; + let mut specs = Vec::new(); + + for line in solidity.lines() { + if line.starts_with(SPEC_MARKER_BEGIN) { + is_reading = true; + continue; + } + if line.starts_with(SPEC_MARKER_END) { + match serde_json::from_str::(&json_string) { + Ok(mut spec) => { + spec.replace_empty_code(contract_name, solidity); + specs.push(spec); + } + Err(e) => panic!("invalid spec JSON: {e}"), + } + is_reading = false; + json_string.clear(); + continue; + } + if is_reading { + json_string.push_str(line) + } + } + + assert!(!specs.is_empty(), "source does not contain any test spec"); + + specs +} + #[cfg(test)] mod tests { use crate::*; @@ -349,35 +387,3 @@ mod tests { run_test(specs); } } - -pub fn specs_from_comment(contract_name: &str, solidity: &str) -> Vec { - let mut json_string = String::with_capacity(solidity.len()); - let mut is_reading = false; - let mut specs = Vec::new(); - - for line in solidity.lines() { - if line.starts_with(SPEC_MARKER_BEGIN) { - is_reading = true; - continue; - } - if line.starts_with(SPEC_MARKER_END) { - match serde_json::from_str::(&json_string) { - Ok(mut spec) => { - spec.replace_empty_code(contract_name, solidity); - specs.push(spec); - } - Err(e) => panic!("invalid spec JSON: {e}"), - } - is_reading = false; - json_string.clear(); - continue; - } - if is_reading { - json_string.push_str(line) - } - } - - assert!(!specs.is_empty(), "source does not contain any test spec"); - - specs -} From b1a147bd78991b0d2227dad0b4ba9af802732f9f Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 13:00:16 +0200 Subject: [PATCH 03/27] keccak256 Signed-off-by: xermicus --- crates/integration/contracts/Crypto.sol | 33 +++++++++++++++++++ crates/integration/contracts/Fibonacci.sol | 2 -- crates/integration/contracts/flipper.sol | 2 -- crates/integration/src/tests.rs | 38 ++-------------------- 4 files changed, 36 insertions(+), 39 deletions(-) create mode 100644 crates/integration/contracts/Crypto.sol diff --git a/crates/integration/contracts/Crypto.sol b/crates/integration/contracts/Crypto.sol new file mode 100644 index 00000000..818a3d11 --- /dev/null +++ b/crates/integration/contracts/Crypto.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.24; + +/* runner.json +{ + "actions": [ + { + "Instantiate": {} + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f9fbd5540000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c68656c6c6f20776f726c64210000000000000000000000000000000000000000" + } + }, + { + "VerifyCall": { + "success": true, + "output": "57caa176af1ac0433c5df30e8dabcd2ec1af1e92a26eced5f719b88458777cd6" + } + } + ] +} +*/ + +contract TestSha3 { + function test(string memory _pre) external payable returns (bytes32 hash) { + hash = keccak256(bytes(_pre)); + } +} diff --git a/crates/integration/contracts/Fibonacci.sol b/crates/integration/contracts/Fibonacci.sol index 760778ec..06f53856 100644 --- a/crates/integration/contracts/Fibonacci.sol +++ b/crates/integration/contracts/Fibonacci.sol @@ -5,7 +5,6 @@ pragma solidity ^0.8; // https://medium.com/coinmonks/fibonacci-in-solidity-8477d907e22a /* runner.json - { "actions": [ { @@ -27,7 +26,6 @@ pragma solidity ^0.8; } ] } - */ contract FibonacciRecursive { diff --git a/crates/integration/contracts/flipper.sol b/crates/integration/contracts/flipper.sol index cdc4bb4f..0c2ef619 100644 --- a/crates/integration/contracts/flipper.sol +++ b/crates/integration/contracts/flipper.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8; /* runner.json - { "actions": [ { @@ -38,7 +37,6 @@ pragma solidity ^0.8; } ] } - */ contract Flipper { diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index b9b0f358..a9cb3ef2 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,4 +1,3 @@ -use alloy_sol_types::SolValue; use revive_runner::*; macro_rules! test_spec { @@ -17,45 +16,14 @@ test_spec!(flipper, "Flipper", "flipper.sol"); test_spec!(fibonacci_recursive, "FibonacciRecursive", "Fibonacci.sol"); test_spec!(fibonacci_iterative, "FibonacciIterative", "Fibonacci.sol"); test_spec!(fibonacci_binet, "FibonacciBinet", "Fibonacci.sol"); - -/* - -#[test] -fn hash_keccak_256() { - sol!( - #[derive(Debug, PartialEq, Eq)] - contract TestSha3 { - function test(string memory _pre) external payable returns (bytes32); - } - ); - let source = r#"contract TestSha3 { - function test(string memory _pre) external payable returns (bytes32 hash) { - hash = keccak256(bytes(_pre)); - } - }"#; - let code = compile_blob("TestSha3", source); - - let param = "hello"; - let input = TestSha3::testCall::new((param.to_string(),)).abi_encode(); - - let (_, output) = State::default() - .transaction() - .with_default_account(&code) - .calldata(input) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - let expected = keccak256(param.as_bytes()); - let received = FixedBytes::<32>::from_slice(&output.data); - assert_eq!(received, expected); -} +test_spec!(hash_keccak_256, "TestSha3", "Crypto.sol"); #[test] fn erc20() { - let _ = compile_blob("ERC20", include_str!("../contracts/ERC20.sol")); + revive_solidity::test_utils::compile_blob("ERC20", include_str!("../contracts/ERC20.sol")); } +/* #[test] fn triangle_number() { let (_, output) = assert_success(&Contract::triangle_number(13), true); From 429439585b3fb7022ababe06039798a7616af0b7 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 13:48:25 +0200 Subject: [PATCH 04/27] erc20 instantiation Signed-off-by: xermicus --- crates/integration/contracts/ERC20.sol | 10 ++++++++++ crates/integration/src/tests.rs | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/integration/contracts/ERC20.sol b/crates/integration/contracts/ERC20.sol index 5b4dea3b..430c2aef 100644 --- a/crates/integration/contracts/ERC20.sol +++ b/crates/integration/contracts/ERC20.sol @@ -2,6 +2,16 @@ pragma solidity ^0.8; +/* runner.json +{ + "actions": [ + { + "Instantiate": {} + }, + ] +} +*/ + // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol interface IERC20 { function totalSupply() external view returns (uint); diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index a9cb3ef2..57e94e1c 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -17,11 +17,7 @@ test_spec!(fibonacci_recursive, "FibonacciRecursive", "Fibonacci.sol"); test_spec!(fibonacci_iterative, "FibonacciIterative", "Fibonacci.sol"); test_spec!(fibonacci_binet, "FibonacciBinet", "Fibonacci.sol"); test_spec!(hash_keccak_256, "TestSha3", "Crypto.sol"); - -#[test] -fn erc20() { - revive_solidity::test_utils::compile_blob("ERC20", include_str!("../contracts/ERC20.sol")); -} +test_spec!(erc20, "ERC20", "ERC20.sol"); /* #[test] From 592b3542f73979f7a05b6e6acc91eedd14c05114 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 13:49:05 +0200 Subject: [PATCH 05/27] typo Signed-off-by: xermicus --- crates/integration/contracts/ERC20.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/integration/contracts/ERC20.sol b/crates/integration/contracts/ERC20.sol index 430c2aef..49426f7f 100644 --- a/crates/integration/contracts/ERC20.sol +++ b/crates/integration/contracts/ERC20.sol @@ -7,7 +7,7 @@ pragma solidity ^0.8; "actions": [ { "Instantiate": {} - }, + } ] } */ From 7ec34e6d8a6cf3449c31b1c7ceb9458a66dbacd4 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 15:53:10 +0200 Subject: [PATCH 06/27] computation Signed-off-by: xermicus --- crates/integration/contracts/Computation.sol | 38 ++++++++++++++++++++ crates/integration/contracts/Fibonacci.sol | 3 +- crates/integration/src/tests.rs | 18 ++-------- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/crates/integration/contracts/Computation.sol b/crates/integration/contracts/Computation.sol index 3ba4dcd0..2f402152 100644 --- a/crates/integration/contracts/Computation.sol +++ b/crates/integration/contracts/Computation.sol @@ -2,6 +2,44 @@ pragma solidity ^0.8; +/* runner.json +{ + "actions": [ + { + "Instantiate": {} + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "0f760610000000000000000000000000000000000000000000000000000000000000000d" + } + }, + { + "VerifyCall": { + "success": true, + "output": "000000000000000000000000000000000000000000000000000000000000005b" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "00261b660000000000000000000000000000000000000000000000000000000000000005" + } + }, + { + "VerifyCall": { + "success": true, + "output": "00000000000000000000000000000000000000000000000000000000000003b1" + } + } + ] +} +*/ + contract Computation { function triangle_number(int64 n) public pure returns (int64 sum) { unchecked { diff --git a/crates/integration/contracts/Fibonacci.sol b/crates/integration/contracts/Fibonacci.sol index 06f53856..c7253ec5 100644 --- a/crates/integration/contracts/Fibonacci.sol +++ b/crates/integration/contracts/Fibonacci.sol @@ -2,8 +2,6 @@ pragma solidity ^0.8; -// https://medium.com/coinmonks/fibonacci-in-solidity-8477d907e22a - /* runner.json { "actions": [ @@ -60,6 +58,7 @@ contract FibonacciIterative { } } +// https://medium.com/coinmonks/fibonacci-in-solidity-8477d907e22a contract FibonacciBinet { function fib3(uint n) external pure returns (uint a) { if (n == 0) { diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 57e94e1c..83b9cb66 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,3 +1,4 @@ +use alloy_sol_types::SolValue; use revive_runner::*; macro_rules! test_spec { @@ -18,24 +19,9 @@ test_spec!(fibonacci_iterative, "FibonacciIterative", "Fibonacci.sol"); test_spec!(fibonacci_binet, "FibonacciBinet", "Fibonacci.sol"); test_spec!(hash_keccak_256, "TestSha3", "Crypto.sol"); test_spec!(erc20, "ERC20", "ERC20.sol"); +test_spec!(computation, "Computation", "Computation.sol"); /* -#[test] -fn triangle_number() { - let (_, output) = assert_success(&Contract::triangle_number(13), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::try_from(91).unwrap(); - assert_eq!(received, expected); -} - -#[test] -fn odd_product() { - let (_, output) = assert_success(&Contract::odd_product(5), true); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = I256::try_from(945i64).unwrap(); - assert_eq!(received, expected); -} - #[test] fn msize_plain() { sol!( From 3b554fa8ae87c8a48639dfcb7620358a7bbec6ae Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 17:29:10 +0200 Subject: [PATCH 07/27] solc options in specs Signed-off-by: xermicus --- crates/runner/src/lib.rs | 13 +++++++++++-- crates/runner/src/specs.rs | 26 +++++++++++++++++++------- crates/solidity/src/solc/pipeline.rs | 4 +++- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 90275b25..bcf8e539 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -163,6 +163,8 @@ pub enum Code { /// Compile a single solidity source and use the blob of `contract` Solidity { path: Option, + solc_optimizer: Option, + pipeline: Option, contract: String, }, /// Read the contract blob from disk @@ -182,16 +184,23 @@ impl Default for Code { impl From for pallet_revive::Code { fn from(val: Code) -> Self { match val { - Code::Solidity { path, contract } => { + Code::Solidity { + path, + contract, + solc_optimizer, + pipeline, + } => { let Some(path) = path else { panic!("Solidity source of contract '{contract}' missing path"); }; let Ok(source_code) = std::fs::read_to_string(&path) else { panic!("Failed to reead source code from {}", path.display()); }; - pallet_revive::Code::Upload(revive_solidity::test_utils::compile_blob( + pallet_revive::Code::Upload(revive_solidity::test_utils::compile_blob_with_options( &contract, &source_code, + solc_optimizer.unwrap_or(true), + pipeline.unwrap_or(revive_solidity::SolcPipeline::Yul), )) } Code::Path(path) => pallet_revive::Code::Upload(std::fs::read(path).unwrap()), diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index 4725f6fc..c5cce520 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -116,16 +116,28 @@ impl Specs { pub fn replace_empty_code(&mut self, contract_name: &str, contract_source: &str) { for action in self.actions.iter_mut() { - let SpecsAction::Instantiate { - code: Code::Bytes(bytes), - .. - } = action - else { + let SpecsAction::Instantiate { code, .. } = action else { continue; }; - if bytes.is_empty() { - *bytes = compile_blob(contract_name, contract_source); + match code { + Code::Bytes(bytes) if bytes.is_empty() => { + *bytes = compile_blob(contract_name, contract_source) + } + Code::Solidity { + path, + solc_optimizer, + pipeline, + contract, + } if path.is_none() => { + *code = Code::Bytes(compile_blob_with_options( + contract.as_str(), + contract_source, + solc_optimizer.unwrap_or(true), + pipeline.unwrap_or(revive_solidity::SolcPipeline::Yul), + )); + } + _ => continue, } } } diff --git a/crates/solidity/src/solc/pipeline.rs b/crates/solidity/src/solc/pipeline.rs index 83dcef35..fc09ba43 100644 --- a/crates/solidity/src/solc/pipeline.rs +++ b/crates/solidity/src/solc/pipeline.rs @@ -1,10 +1,12 @@ //! The Solidity compiler pipeline type. +use serde::{Deserialize, Serialize}; + use crate::solc::version::Version as SolcVersion; use crate::solc::Compiler as SolcCompiler; /// The Solidity compiler pipeline type. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[allow(non_camel_case_types)] #[allow(clippy::upper_case_acronyms)] pub enum Pipeline { From 2a3e62abb4fa1c6db05c27b829082631344c84e2 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 27 Aug 2024 17:29:24 +0200 Subject: [PATCH 08/27] msize Signed-off-by: xermicus --- crates/integration/contracts/MSize.sol | 45 ++++++++++++++++++ crates/integration/src/tests.rs | 65 +------------------------- 2 files changed, 47 insertions(+), 63 deletions(-) diff --git a/crates/integration/contracts/MSize.sol b/crates/integration/contracts/MSize.sol index 3500f4b3..c2153682 100644 --- a/crates/integration/contracts/MSize.sol +++ b/crates/integration/contracts/MSize.sol @@ -2,6 +2,51 @@ pragma solidity ^0.8; +/* runner.json +{ + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "MSize", + "solc_optimizer": false + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f016832c" + } + }, + { + "VerifyCall": { + "success": true, + "output": "0000000000000000000000000000000000000000000000000000000000000060" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f4a63aa5" + } + }, + { + "VerifyCall": { + "success": true, + "output": "0000000000000000000000000000000000000000000000000000000000000084" + } + } + ] +} +*/ + contract MSize { uint[] public data; diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 83b9cb66..1e8aa79d 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,4 +1,4 @@ -use alloy_sol_types::SolValue; +use alloy_sol_types::{SolCall, SolValue}; use revive_runner::*; macro_rules! test_spec { @@ -20,38 +20,9 @@ test_spec!(fibonacci_binet, "FibonacciBinet", "Fibonacci.sol"); test_spec!(hash_keccak_256, "TestSha3", "Crypto.sol"); test_spec!(erc20, "ERC20", "ERC20.sol"); test_spec!(computation, "Computation", "Computation.sol"); +test_spec!(msize, "MSize", "MSize.sol"); /* -#[test] -fn msize_plain() { - sol!( - #[derive(Debug, PartialEq, Eq)] - contract MSize { - function mSize() public pure returns (uint); - } - ); - let code = compile_blob_with_options( - "MSize", - include_str!("../contracts/MSize.sol"), - false, - revive_solidity::SolcPipeline::EVMLA, - ); - - let input = MSize::mSizeCall::new(()).abi_encode(); - let (_, output) = State::default() - .transaction() - .calldata(input) - .with_default_account(&code) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - // Solidity always stores the "free memory pointer" (32 byte int) at offset 64. - let expected = U256::try_from(64 + 32).unwrap(); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - assert_eq!(received, expected); -} - #[test] fn transferred_value() { sol!( @@ -75,38 +46,6 @@ fn transferred_value() { assert_eq!(received, expected); } -#[test] -fn msize_non_word_sized_access() { - sol!( - #[derive(Debug, PartialEq, Eq)] - contract MSize { - function mStore100() public pure returns (uint); - } - ); - let code = compile_blob_with_options( - "MSize", - include_str!("../contracts/MSize.sol"), - false, - revive_solidity::SolcPipeline::Yul, - ); - - let input = MSize::mStore100Call::new(()).abi_encode(); - let (_, output) = State::default() - .transaction() - .with_default_account(&code) - .calldata(input) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - // https://docs.zksync.io/build/developer-reference/differences-with-ethereum.html#mstore-mload - // "Unlike EVM, where the memory growth is in words, on zkEVM the memory growth is counted in bytes." - // "For example, if you write mstore(100, 0) the msize on zkEVM will be 132, but on the EVM it will be 160." - let expected = U256::try_from(132).unwrap(); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - assert_eq!(received, expected); -} - #[test] fn mstore8() { for (received, expected) in [ From cb4fbac7d62ae40d7cd865888d58bd911ae7492b Mon Sep 17 00:00:00 2001 From: xermicus Date: Wed, 28 Aug 2024 19:19:29 +0200 Subject: [PATCH 09/27] wip geth Signed-off-by: xermicus --- crates/differential/Cargo.toml | 9 +- crates/differential/genesis.json | 30 ++ crates/differential/src/lib.rs | 266 +++++++++--------- crates/integration/contracts/Value.sol | 32 ++- crates/integration/src/cases.rs | 16 +- crates/integration/src/tests.rs | 20 +- crates/runner/Cargo.toml | 1 + crates/runner/src/lib.rs | 131 ++------- crates/runner/src/specs.rs | 212 ++++++++++++-- crates/solidity/src/solc/mod.rs | 1 - .../src/solc/standard_json/output/mod.rs | 13 - crates/solidity/src/test_utils.rs | 72 +++-- 12 files changed, 473 insertions(+), 330 deletions(-) create mode 100644 crates/differential/genesis.json diff --git a/crates/differential/Cargo.toml b/crates/differential/Cargo.toml index 8647f90e..543d8eb7 100644 --- a/crates/differential/Cargo.toml +++ b/crates/differential/Cargo.toml @@ -7,6 +7,9 @@ authors.workspace = true repository.workspace = true [dependencies] -evm-interpreter = { workspace = true } -primitive-types = { workspace = true } -alloy-primitives = { workspace = true } \ No newline at end of file +hex = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +alloy-primitives = { workspace = true, features = ["serde"] } +alloy-genesis = { workspace = true } +alloy-serde = { workspace = true } \ No newline at end of file diff --git a/crates/differential/genesis.json b/crates/differential/genesis.json new file mode 100644 index 00000000..3088ca17 --- /dev/null +++ b/crates/differential/genesis.json @@ -0,0 +1,30 @@ +{ + "config": { + "chainId": 1, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowGlacierBlock": 0, + "grayGlacierBlock": 0, + "shanghaiTime": 0, + "cancunTime": 0, + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true + }, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x20000", + "extraData": "", + "gasLimit": "0x2fefd8", + "nonce": "0x0000000000000042", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x00", + "alloc": {} +} \ No newline at end of file diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index fbe9190e..52504096 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -1,159 +1,159 @@ -use alloy_primitives::{keccak256, Address, B256}; -use evm_interpreter::{ - interpreter::{EtableInterpreter, RunInterpreter}, - trap::CallCreateTrap, - Context, Etable, ExitError, Log, Machine, RuntimeBackend, RuntimeBaseBackend, - RuntimeEnvironment, RuntimeState, TransactionContext, Valids, -}; -use primitive_types::{H160, H256, U256}; - -static RUNTIME_ETABLE: Etable = - Etable::runtime(); - -#[derive(Default)] -pub struct UnimplementedHandler { - logs: Vec, +use std::collections::BTreeMap; + +use alloy_genesis::{Genesis, GenesisAccount}; +use alloy_primitives::{Address, Bytes, B256, U256}; +use alloy_serde::storage::deserialize_storage_map; +use serde::{Deserialize, Serialize}; +use serde_json::{Deserializer, Value}; + +pub const GENESIS_JSON: &str = include_str!("../genesis.json"); + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct StateDump { + pub root: Bytes, + pub accounts: BTreeMap, } -impl RuntimeEnvironment for UnimplementedHandler { - fn block_hash(&self, _number: U256) -> H256 { - unimplemented!() - } - fn block_number(&self) -> U256 { - U256::from(123) - } - fn block_coinbase(&self) -> H160 { - unimplemented!() - } - fn block_timestamp(&self) -> U256 { - U256::from(456) - } - fn block_difficulty(&self) -> U256 { - unimplemented!() - } - fn block_randomness(&self) -> Option { - unimplemented!() - } - fn block_gas_limit(&self) -> U256 { - unimplemented!() - } - fn block_base_fee_per_gas(&self) -> U256 { - unimplemented!() - } - fn chain_id(&self) -> U256 { - unimplemented!() +impl Into for StateDump { + fn into(self) -> Genesis { + let mut genesis: Genesis = serde_json::from_str(GENESIS_JSON).unwrap(); + genesis.alloc = self + .accounts + .iter() + .map(|(address, account)| (*address, account.clone().into())) + .collect(); + genesis } } -impl RuntimeBaseBackend for UnimplementedHandler { - fn balance(&self, _address: H160) -> U256 { - unimplemented!() - } - fn code_size(&self, _address: H160) -> U256 { - unimplemented!() - } - fn code_hash(&self, _address: H160) -> H256 { - unimplemented!() - } - fn code(&self, _address: H160) -> Vec { - unimplemented!() - } - fn storage(&self, _address: H160, _index: H256) -> H256 { - unimplemented!() - } +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Account { + pub balance: U256, + pub nonce: u64, + pub code: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deserialize_storage_map" + )] + pub storage: Option>, + pub key: Option, +} - fn exists(&self, _address: H160) -> bool { - unimplemented!() +impl Into for Account { + fn into(self) -> GenesisAccount { + GenesisAccount { + balance: self.balance, + nonce: Some(self.nonce), + code: self.code, + storage: self.storage, + private_key: self.key, + } } +} - fn nonce(&self, _address: H160) -> U256 { - unimplemented!() - } +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct EvmOutput { + output: Bytes, + #[serde(rename = "gasUsed")] + gas_used: U256, + error: Option, } -impl RuntimeBackend for UnimplementedHandler { - fn original_storage(&self, _address: H160, _index: H256) -> H256 { - unimplemented!() - } +#[derive(Clone, Debug)] +pub struct EvmLog { + pub output: EvmOutput, + pub state_dump: StateDump, +} - fn deleted(&self, _address: H160) -> bool { - unimplemented!() - } - fn is_cold(&self, _address: H160, _index: Option) -> bool { - unimplemented!() - } +impl From<&str> for EvmLog { + fn from(value: &str) -> Self { + let mut output = None; + let mut state_dump = None; + + let stream = Deserializer::from_str(value).into_iter::(); + for value in stream { + let Ok(value) = value else { continue }; + if let Ok(value @ EvmOutput { .. }) = serde_json::from_value(value.clone()) { + output = Some(value); + continue; + } + if let Ok(value @ StateDump { .. }) = serde_json::from_value(value) { + state_dump = Some(value); + } + } - fn mark_hot(&mut self, _address: H160, _index: Option) { - unimplemented!() + Self { + output: output.expect("the EVM log should contain the output"), + state_dump: state_dump.expect("the EVM log should contain the state dump"), + } } +} - fn set_storage(&mut self, _address: H160, _index: H256, _value: H256) -> Result<(), ExitError> { - unimplemented!() - } - fn log(&mut self, log: Log) -> Result<(), ExitError> { - self.logs.push(log); - Ok(()) - } - fn mark_delete(&mut self, _address: H160) { - unimplemented!() +#[cfg(test)] +mod tests { + use alloy_genesis::Genesis; + use alloy_primitives::{B256, U256}; + + use crate::{EvmLog, EvmOutput, StateDump}; + + const OUTPUT_OK: &str = r#"{"output":"0000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x11d"}"#; + const OUTPUT_REVERTED: &str = r#"{"output":"","gasUsed":"0x2d","error":"execution reverted"}"#; + const STATE_DUMP: &str = r#" +{ + "root": "eb5d51177cb9049b848ea92f87f9a3f00abfb683d0866c2eddecc5692ad27f86", + "accounts": { + "0x1f2a98889594024BFfdA3311CbE69728d392C06D": { + "balance": "0", + "nonce": 1, + "root": "0x63cfcda8d81a8b1840b1b9722c37f929a4037e53ad1ce6abdef31c0c8bac1f61", + "codeHash": "0xa6e0062c5ba829446695f179b97702a75f7d354e33445d2e928ed00e1a39e88f", + "code": "0x608060405260043610610028575f3560e01c80633fa4f2451461002c578063b144adfb1461004a575b5f80fd5b610034610086565b60405161004191906100c5565b60405180910390f35b348015610055575f80fd5b50610070600480360381019061006b919061013c565b61008d565b60405161007d91906100c5565b60405180910390f35b5f34905090565b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f819050919050565b6100bf816100ad565b82525050565b5f6020820190506100d85f8301846100b6565b92915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010b826100e2565b9050919050565b61011b81610101565b8114610125575f80fd5b50565b5f8135905061013681610112565b92915050565b5f60208284031215610151576101506100de565b5b5f61015e84828501610128565b9150509291505056fea2646970667358221220a2109c2f05a629fff4640e9f0cf12a698bbea9b0858a4029901e88bf5d1c926964736f6c63430008190033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "02" + }, + "address": "0x1f2a98889594024bffda3311cbe69728d392c06d", + "key": "0xcbeeb4463624bc2f332dcfe2b479eddb1c380ec862ee63d9f31b31b854fb7c61" + } } +}"#; - fn reset_storage(&mut self, _address: H160) { - unimplemented!() + #[test] + fn parse_evm_output_ok() { + serde_json::from_str::(OUTPUT_OK).unwrap(); } - fn set_code(&mut self, _address: H160, _code: Vec) -> Result<(), ExitError> { - unimplemented!() - } - fn reset_balance(&mut self, _address: H160) { - unimplemented!() + #[test] + fn parse_evm_output_revert() { + serde_json::from_str::(OUTPUT_REVERTED).unwrap(); } - fn deposit(&mut self, _address: H160, _value: U256) { - unimplemented!() - } - fn withdrawal(&mut self, _address: H160, _value: U256) -> Result<(), ExitError> { - unimplemented!() + #[test] + fn parse_state_dump() { + serde_json::from_str::(STATE_DUMP).unwrap(); } - fn inc_nonce(&mut self, _address: H160) -> Result<(), ExitError> { - unimplemented!() + #[test] + fn evm_log_from_str() { + let log = format!("{OUTPUT_OK}\n{STATE_DUMP}"); + let _ = EvmLog::from(log.as_str()); } -} - -#[derive(Clone)] -pub struct PreparedEvm { - pub valids: Valids, - pub vm: Machine, -} -pub fn prepare(code: Vec, data: Vec) -> PreparedEvm { - let address = Address::default().create2(B256::default(), keccak256([]).0); - let caller = Address::default().create2(B256::default(), keccak256([]).0); - - let state = RuntimeState { - context: Context { - address: H160::from(address.0 .0), - caller: H160::from(caller.0 .0), - apparent_value: U256::default(), - }, - transaction_context: TransactionContext { - gas_price: U256::default(), - origin: H160::default(), - } - .into(), - retbuf: Vec::new(), - }; - - PreparedEvm { - valids: Valids::new(&code[..]), - vm: evm_interpreter::Machine::new(code.into(), data.to_vec().into(), 1024, 0xFFFF, state), + #[test] + fn generate_genesis() { + let log = format!("{OUTPUT_OK}\n{STATE_DUMP}"); + let log = EvmLog::from(log.as_str()); + let mut genesis: Genesis = log.state_dump.into(); + let storage = genesis + .alloc + .pop_first() + .expect("should have one account in genesis") + .1 + .storage + .expect("genesis account should have storage"); + let storage_value = storage + .get(&B256::ZERO) + .expect("genesis account should have key 0 occupied"); + assert_eq!(*storage_value, B256::from(U256::from(2))); } } - -pub fn execute(pre: PreparedEvm) -> (Vec, Vec) { - let mut vm = EtableInterpreter::new_valid(pre.vm, &RUNTIME_ETABLE, pre.valids); - let mut handler = UnimplementedHandler::default(); - vm.run(&mut handler).exit().unwrap().unwrap(); - (vm.retval.clone(), handler.logs) -} diff --git a/crates/integration/contracts/Value.sol b/crates/integration/contracts/Value.sol index 5fa6bd81..57c2ec34 100644 --- a/crates/integration/contracts/Value.sol +++ b/crates/integration/contracts/Value.sol @@ -1,8 +1,38 @@ // SPDX-License-Identifier: MIT - pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Value" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "3fa4f245" + } + } + ] +} +*/ + contract Value { + uint foo; + + constructor() { + foo = 2; + } + function value() public payable returns (uint ret) { ret = msg.value; } diff --git a/crates/integration/src/cases.rs b/crates/integration/src/cases.rs index 64383c5a..03e8920f 100644 --- a/crates/integration/src/cases.rs +++ b/crates/integration/src/cases.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{Address, I256, U256}; +use alloy_primitives::{Address, Bytes, I256, U256}; use alloy_sol_types::{sol, SolCall, SolConstructor}; use revive_solidity::test_utils::*; @@ -44,8 +44,8 @@ macro_rules! case { }; } -case!("Create.sol", "CreateA", vec![0; 4], create_a); -case!("Create.sol", "CreateB", vec![0; 4], create_b); +case!("Create.sol", "CreateA", vec![0; 4].into(), create_a); +case!("Create.sol", "CreateB", vec![0; 4].into(), create_b); sol!(contract Baseline { function baseline() public payable; }); case!("Baseline.sol", Baseline, baselineCall, baseline,); @@ -91,7 +91,7 @@ sol!( function sha1(bytes memory data) public pure returns (bytes20 ret); } ); -case!("SHA1.sol", SHA1, sha1Call, sha1, pre: Vec); +case!("SHA1.sol", SHA1, sha1Call, sha1, pre: Bytes); sol!( contract ERC20 { @@ -188,7 +188,7 @@ sol!( function memcpy(bytes memory payload) public pure returns (bytes memory); } ); -case!("MCopy.sol", MCopy, memcpyCall, memcpy, payload: Vec); +case!("MCopy.sol", MCopy, memcpyCall, memcpy, payload: Bytes); sol!( contract Call { @@ -203,7 +203,7 @@ sol!( } ); case!("Call.sol", Call, value_transferCall, call_value_transfer, destination: Address); -case!("Call.sol", Call, callCall, call_call, destination: Address, payload: Vec); +case!("Call.sol", Call, callCall, call_call, destination: Address, payload: Bytes); case!("Call.sol", "Call", vec![], call_constructor); sol!( @@ -240,7 +240,7 @@ impl Contract { #[cfg(test)] mod tests { - use alloy_primitives::U256; + use alloy_primitives::{Bytes, U256}; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use serde::{de::Deserialize, Serialize}; use std::{collections::BTreeMap, fs::File}; @@ -285,7 +285,7 @@ mod tests { (|| Contract::odd_product(0)) as fn() -> Contract, (|| Contract::fib_iterative(U256::ZERO)) as fn() -> Contract, Contract::erc20 as fn() -> Contract, - (|| Contract::sha1(Vec::new())) as fn() -> Contract, + (|| Contract::sha1(Bytes::new())) as fn() -> Contract, (|| Contract::division_arithmetics_div(U256::ZERO, U256::ZERO)) as fn() -> Contract, (|| Contract::event(U256::ZERO)) as fn() -> Contract, ] diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 1e8aa79d..1e58d322 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -5,9 +5,9 @@ macro_rules! test_spec { ($test_name:ident, $contract_name:literal, $source_file:literal) => { #[test] fn $test_name() { - let solidity = include_str!(concat!("../contracts/", $source_file)); - let mut specs = specs_from_comment($contract_name, solidity); - run_test(specs.remove(0)); + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("should always exist"); + let path = format!("{manifest_dir}/../integration/contracts/{}", $source_file); + specs_from_comment($contract_name, &path).remove(0).run(); } }; } @@ -21,6 +21,20 @@ test_spec!(hash_keccak_256, "TestSha3", "Crypto.sol"); test_spec!(erc20, "ERC20", "ERC20.sol"); test_spec!(computation, "Computation", "Computation.sol"); test_spec!(msize, "MSize", "MSize.sol"); +test_spec!(transferred_value, "Value", "Value.sol"); + +#[test] +fn foo() { + alloy_sol_types::sol!( + contract Value { + function value() public payable returns (uint); + } + ); + + dbg!(hex::encode(&crate::cases::Contract::baseline().calldata)); + dbg!(hex::encode(&Value::valueCall::new(()).abi_encode())); + dbg!(hex::encode(&alloy_primitives::U256::from(123).abi_encode())); +} /* #[test] diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index 4a500012..69d408e1 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -16,3 +16,4 @@ scale-info = { workspace = true, default-features = false } polkadot-sdk = { workspace = true, features = ["experimental", "runtime"] } revive-solidity = { workspace = true } +revive-differential = { workspace = true } diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index bcf8e539..fde21f49 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -7,7 +7,8 @@ //! ```rust //! use revive_runner::*; //! use specs::SpecsAction::*; -//! run_test(Specs { +//! Specs { +//! differential: true, //! balances: vec![(ALICE, 1_000_000_000)], //! actions: vec![Instantiate { //! origin: TestAccountId::Alice, @@ -18,7 +19,8 @@ //! data: vec![], //! salt: vec![], //! }], -//! }); +//! } +//! .run(); //! ``` use polkadot_sdk::*; @@ -210,114 +212,11 @@ impl From for pallet_revive::Code { } } -/// Run a contract test -/// The test takes a [`Specs`] and executes the actions in order -pub fn run_test(specs: Specs) -> Vec { - let mut results = vec![]; - - let translate_account = |id: &TestAccountId, results: &[CallResult]| -> AccountId { - match id { - TestAccountId::Alice => ALICE, - TestAccountId::Bob => BOB, - TestAccountId::Charlie => CHARLIE, - TestAccountId::AccountId(account_id) => account_id.clone(), - TestAccountId::Instantiated(n) => match results - .get(*n as usize) - .expect("should provide valid index into call results") - { - CallResult::Exec(_) => panic!("call #{n} should be an instantiation"), - CallResult::Instantiate(res) => res - .result - .as_ref() - .expect("call #{n} reverted") - .account_id - .clone(), - }, - } +pub fn specs_from_comment(contract_name: &str, path: &str) -> Vec { + let solidity = match std::fs::read_to_string(path) { + Err(err) => panic!("unable to read {path}: {err}"), + Ok(solidity) => solidity, }; - - ExtBuilder::default() - .balance_genesis_config(specs.balances.clone()) - .build() - .execute_with(|| { - use specs::SpecsAction::*; - - let actions = specs.actions(); - - for action in actions { - match action { - Instantiate { - origin, - value, - gas_limit, - storage_deposit_limit, - code, - data, - salt, - } => results.push(CallResult::Instantiate(Contracts::bare_instantiate( - RuntimeOrigin::signed(translate_account(&origin, &results)), - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - code.into(), - data, - salt, - DebugInfo::Skip, - CollectEvents::Skip, - ))), - Call { - origin, - dest, - value, - gas_limit, - storage_deposit_limit, - data, - } => results.push(CallResult::Exec(Contracts::bare_call( - RuntimeOrigin::signed(translate_account(&origin, &results)), - translate_account(&dest, &results), - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - data, - DebugInfo::Skip, - CollectEvents::Skip, - ))), - VerifyCall(expectation) => { - expectation.verify(results.last().expect("No call to verify")); - } - VerifyBalance { origin, expected } => { - let balance = Balances::free_balance(&translate_account(&origin, &results)); - assert_eq!(balance, expected); - } - VerifyStorage { - contract, - key, - expected, - } => { - let Ok(storage) = Contracts::get_storage( - translate_account(&contract, &results), - key.clone(), - ) else { - panic!("Error reading storage"); - }; - let Some(value) = storage else { - panic!("No value for storage key 0x{}", hex::encode(key)); - }; - assert_eq!(value, expected); - } - } - } - }); - - match &results[0] { - CallResult::Instantiate(res) => res.result.as_ref().unwrap().account_id.clone(), - _ => todo!(), - }; - - results -} - -pub fn specs_from_comment(contract_name: &str, solidity: &str) -> Vec { let mut json_string = String::with_capacity(solidity.len()); let mut is_reading = false; let mut specs = Vec::new(); @@ -330,7 +229,7 @@ pub fn specs_from_comment(contract_name: &str, solidity: &str) -> Vec { if line.starts_with(SPEC_MARKER_END) { match serde_json::from_str::(&json_string) { Ok(mut spec) => { - spec.replace_empty_code(contract_name, solidity); + spec.replace_empty_code(contract_name, path); specs.push(spec); } Err(e) => panic!("invalid spec JSON: {e}"), @@ -356,7 +255,8 @@ mod tests { #[test] fn instantiate_works() { use specs::SpecsAction::*; - run_test(Specs { + let specs = Specs { + differential: false, balances: vec![(ALICE, 1_000_000_000)], actions: vec![Instantiate { origin: TestAccountId::Alice, @@ -367,12 +267,13 @@ mod tests { data: vec![], salt: vec![], }], - }); + }; + specs.run(); } #[test] fn instantiate_with_json() { - let specs = serde_json::from_str::( + serde_json::from_str::( r#" { "balances": [ @@ -392,7 +293,7 @@ mod tests { } "#, ) - .unwrap(); - run_test(specs); + .unwrap() + .run(); } } diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index c5cce520..46c021db 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -70,10 +70,36 @@ pub enum TestAccountId { AccountId(AccountId), } +impl TestAccountId { + fn to_account_id(&self, results: &[CallResult]) -> AccountId { + match self { + TestAccountId::Alice => ALICE, + TestAccountId::Bob => BOB, + TestAccountId::Charlie => CHARLIE, + TestAccountId::AccountId(account_id) => account_id.clone(), + TestAccountId::Instantiated(n) => match results + .get(*n as usize) + .expect("should provide valid index into call results") + { + CallResult::Exec(_) => panic!("call #{n} should be an instantiation"), + CallResult::Instantiate(res) => res + .result + .as_ref() + .expect("call #{n} reverted") + .account_id + .clone(), + }, + } + } +} + /// Specs for a contract test -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)] pub struct Specs { + /// Interpret EVM bytecode and assert output, storage and events + #[serde(default)] + pub differential: bool, /// List of endowments at genesis pub balances: Vec<(AccountId, Balance)>, /// List of actions to perform @@ -83,6 +109,7 @@ pub struct Specs { impl Default for Specs { fn default() -> Self { Self { + differential: false, balances: vec![(ALICE, 1_000_000_000)], actions: Default::default(), } @@ -114,7 +141,10 @@ impl Specs { .collect() } - pub fn replace_empty_code(&mut self, contract_name: &str, contract_source: &str) { + /// Helper to allow not specifying the code bytes or path directly in the runner.json + /// - Replace `Code::Bytes(bytes)` if `bytes` are empty: read `contract_file` + /// - Replace `Code::Solidity{ path, ..}` if `path` is not provided: replace `path` with `contract_file` + pub fn replace_empty_code(&mut self, contract_name: &str, contract_path: &str) { for action in self.actions.iter_mut() { let SpecsAction::Instantiate { code, .. } = action else { continue; @@ -122,23 +152,173 @@ impl Specs { match code { Code::Bytes(bytes) if bytes.is_empty() => { - *bytes = compile_blob(contract_name, contract_source) - } - Code::Solidity { - path, - solc_optimizer, - pipeline, - contract, - } if path.is_none() => { - *code = Code::Bytes(compile_blob_with_options( - contract.as_str(), - contract_source, - solc_optimizer.unwrap_or(true), - pipeline.unwrap_or(revive_solidity::SolcPipeline::Yul), - )); + let contract_source = match std::fs::read_to_string(contract_path) { + Err(err) => panic!("unable to read {contract_path}: {err}"), + Ok(solidity) => solidity, + }; + *bytes = compile_blob(contract_name, &contract_source) } + Code::Solidity { path, .. } if path.is_none() => *path = Some(contract_path.into()), _ => continue, } } } + + /// Run a contract test + /// The test takes a [`Specs`] and executes the actions in order + pub fn run(self) -> Vec { + if self.differential { + self.run_on_evm() + } else { + self + } + .run_on_pallet() + } + + fn run_on_evm(self) -> Self { + let mut specs = Self { + actions: vec![], + ..self + }; + + for action in self.actions { + specs.actions.push(action.clone()); + + use specs::SpecsAction::*; + match action { + Instantiate { + origin, + value, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + } => { + let Code::Solidity { + path: Some(path), + solc_optimizer, + pipeline, + contract, + } = code + else { + panic!("the differential runner requires Code::Solidity source"); + }; + assert!(storage_deposit_limit.is_none(), "storage deposit limit is not supported in differential mode"); + assert!(salt.is_empty(), "salt is not supported in differential mode"); + let deploy_code = match std::fs::read_to_string(&path) { + Ok(solidity_source) => compile_evm_deploy_code(&contract, &solidity_source), + Err(err) => panic!( + "failed to read solidity source\n . path: '{}'\n . error: {:?}", + path.display(), + err + ), + }; + } + Call { + origin, + dest, + value, + gas_limit, + storage_deposit_limit, + data, + } => { + //let TestAccountId::Instantiated(n) = dest else { + // panic!("the differential runner requires TestAccountId::Instantiated(n) as dest"); + //}; + } + _ => panic!("only instantiate and call action allowed in differential mode, got: {action:?}"), + } + } + + specs + } + + fn run_on_pallet(self) -> Vec { + let mut results = vec![]; + + ExtBuilder::default() + .balance_genesis_config(self.balances.clone()) + .build() + .execute_with(|| { + use specs::SpecsAction::*; + + let actions = self.actions(); + + for action in self.actions() { + match action { + Instantiate { + origin, + value, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + } => results.push(CallResult::Instantiate(Contracts::bare_instantiate( + RuntimeOrigin::signed(origin.to_account_id(&results)), + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + code.into(), + data, + salt, + DebugInfo::Skip, + CollectEvents::Skip, + ))), + Call { + origin, + dest, + value, + gas_limit, + storage_deposit_limit, + data, + } => results.push(CallResult::Exec(Contracts::bare_call( + RuntimeOrigin::signed(origin.to_account_id(&results)), + dest.to_account_id(&results), + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + data, + DebugInfo::Skip, + CollectEvents::Skip, + ))), + VerifyCall(expectation) => { + expectation.verify(results.last().expect("No call to verify")); + } + VerifyBalance { origin, expected } => { + let balance = Balances::free_balance(origin.to_account_id(&results)); + assert_eq!(balance, expected); + } + VerifyStorage { + contract, + key, + expected, + } => { + let Ok(storage) = Contracts::get_storage( + contract.to_account_id(&results), + key.clone(), + ) else { + panic!("Error reading storage"); + }; + let Some(value) = storage else { + panic!("No value for storage key 0x{}", hex::encode(key)); + }; + assert_eq!(value, expected); + } + } + } + }); + + match &results[0] { + CallResult::Instantiate(res) => res.result.as_ref().unwrap().account_id.clone(), + _ => todo!(), + }; + + results + } +} + +pub trait SpecsRunner { + fn run_action(&mut self, spec: &mut Specs) -> Vec; } diff --git a/crates/solidity/src/solc/mod.rs b/crates/solidity/src/solc/mod.rs index 6985ab81..1763c2ef 100644 --- a/crates/solidity/src/solc/mod.rs +++ b/crates/solidity/src/solc/mod.rs @@ -129,7 +129,6 @@ impl Compiler { ) })?; output.preprocess_ast(&version, pipeline, suppressed_warnings.as_slice())?; - output.remove_evm(); Ok(output) } diff --git a/crates/solidity/src/solc/standard_json/output/mod.rs b/crates/solidity/src/solc/standard_json/output/mod.rs index 027a1227..f78ab226 100644 --- a/crates/solidity/src/solc/standard_json/output/mod.rs +++ b/crates/solidity/src/solc/standard_json/output/mod.rs @@ -138,19 +138,6 @@ impl Output { )) } - /// Removes EVM artifacts to prevent their accidental usage. - pub fn remove_evm(&mut self) { - if let Some(files) = self.contracts.as_mut() { - for (_, file) in files.iter_mut() { - for (_, contract) in file.iter_mut() { - if let Some(evm) = contract.evm.as_mut() { - evm.bytecode = None; - } - } - } - } - } - /// Traverses the AST and returns the list of additional errors and warnings. pub fn preprocess_ast( &mut self, diff --git a/crates/solidity/src/test_utils.rs b/crates/solidity/src/test_utils.rs index 55a1bdb3..b2b2833c 100644 --- a/crates/solidity/src/test_utils.rs +++ b/crates/solidity/src/test_utils.rs @@ -13,6 +13,7 @@ use crate::solc::pipeline::Pipeline as SolcPipeline; use crate::solc::standard_json::input::settings::optimizer::Optimizer as SolcStandardJsonInputSettingsOptimizer; use crate::solc::standard_json::input::settings::selection::Selection as SolcStandardJsonInputSettingsSelection; use crate::solc::standard_json::input::Input as SolcStandardJsonInput; +use crate::solc::standard_json::output::contract::evm::bytecode::Bytecode; use crate::solc::standard_json::output::contract::evm::bytecode::DeployedBytecode; use crate::solc::standard_json::output::Output as SolcStandardJsonOutput; use crate::solc::Compiler as SolcCompiler; @@ -113,51 +114,36 @@ pub fn build_solidity_with_options( Ok(output) } -/// Build a Solidity contract and get the EVM bin-runtime. +/// Build a Solidity contract and get the EVM code pub fn build_solidity_with_options_evm( sources: BTreeMap, libraries: BTreeMap>, remappings: Option>, pipeline: SolcPipeline, + optimzer_settings: revive_llvm_context::OptimizerSettings, solc_optimizer_enabled: bool, -) -> anyhow::Result> { - check_dependencies(); - - inkwell::support::enable_llvm_pretty_stack_trace(); - revive_llvm_context::initialize_target(revive_llvm_context::Target::PVM); - let _ = crate::process::EXECUTABLE.set(PathBuf::from(crate::r#const::DEFAULT_EXECUTABLE_NAME)); - - let mut solc = SolcCompiler::new(SolcCompiler::DEFAULT_EXECUTABLE_NAME.to_owned())?; - let solc_version = solc.version()?; - - let input = SolcStandardJsonInput::try_from_sources( - None, +) -> anyhow::Result> { + let mut build_unoptimized = build_solidity_with_options( sources.clone(), - libraries.clone(), + libraries, remappings, - SolcStandardJsonInputSettingsSelection::new_required(pipeline), - SolcStandardJsonInputSettingsOptimizer::new( - solc_optimizer_enabled, - None, - &solc_version.default, - false, - false, - ), - None, - pipeline == SolcPipeline::Yul, - None, - )?; - - let mut output = solc.standard_json(input, pipeline, None, vec![], None)?; + pipeline, + optimzer_settings, + solc_optimizer_enabled, + ) + .expect("Build failure"); let mut contracts = BTreeMap::new(); - if let Some(files) = output.contracts.as_mut() { + if let Some(files) = build_unoptimized.contracts.as_mut() { for (_, file) in files.iter_mut() { for (name, contract) in file.iter_mut() { if let Some(evm) = contract.evm.as_mut() { - if let Some(deployed_bytecode) = evm.deployed_bytecode.as_ref() { - contracts.insert(name.clone(), deployed_bytecode.clone()); - } + let (Some(bytecode), Some(deployed_bytecode)) = + (evm.bytecode.as_ref(), evm.deployed_bytecode.as_ref()) + else { + continue; + }; + contracts.insert(name.clone(), (bytecode.clone(), deployed_bytecode.clone())); } } } @@ -284,6 +270,14 @@ pub fn compile_blob(contract_name: &str, source_code: &str) -> Vec { /// Compile the EVM bin-runtime of `contract_name` found in given `source_code`. /// The `solc` optimizer will be enabled pub fn compile_evm_bin_runtime(contract_name: &str, source_code: &str) -> Vec { + compile_evm(contract_name, source_code, true) +} + +pub fn compile_evm_deploy_code(contract_name: &str, source_code: &str) -> Vec { + compile_evm(contract_name, source_code, false) +} + +fn compile_evm(contract_name: &str, source_code: &str, runtime: bool) -> Vec { let pipeline = SolcPipeline::Yul; let solc_optimizer_enabled = true; let id = CachedBlob { @@ -302,15 +296,19 @@ pub fn compile_evm_bin_runtime(contract_name: &str, source_code: &str) -> Vec Date: Wed, 28 Aug 2024 23:43:03 +0200 Subject: [PATCH 10/27] execute geth evm Signed-off-by: xermicus --- Cargo.lock | 629 +++++++++++++++++++++++---------- Cargo.toml | 13 +- crates/differential/Cargo.toml | 1 + crates/differential/src/lib.rs | 152 +++++++- crates/runner/Cargo.toml | 10 +- 5 files changed, 606 insertions(+), 199 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2caa70cd..02216930 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,6 +110,29 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy-genesis" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "210f4b358d724f85df8adaec753c583defb58169ad3cad3d48c80d1a25a6ff0e" +dependencies = [ + "alloy-primitives 0.8.0", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "299d2a937b6c60968df3dad2a988b0f0e03277b344639a4f7a31bd68e6285e59" +dependencies = [ + "alloy-primitives 0.8.0", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + [[package]] name = "alloy-primitives" version = "0.4.2" @@ -132,9 +155,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.6.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d34d8de81e23b6d909c094e23b3d357e01ca36b78a8c5424c501eedbe86f0" +checksum = "a767e59c86900dd7c3ce3ecef04f3ace5ac9631ee150beb8b7d22f7fa3bbb2d7" dependencies = [ "alloy-rlp", "bytes", @@ -162,6 +185,17 @@ dependencies = [ "bytes", ] +[[package]] +name = "alloy-serde" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd260ede54f0b53761fdd04133acc10ae70427f66a69aa9590529bbd066cd58" +dependencies = [ + "alloy-primitives 0.8.0", + "serde", + "serde_json", +] + [[package]] name = "alloy-sol-macro" version = "0.4.2" @@ -181,22 +215,61 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.6.4" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183bcfc0f3291d9c41a3774172ee582fb2ce6eb6569085471d8f225de7bb86fc" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.76", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86ec0a47740b20bc5613b8712d0d321d031c4efc58e9645af96085d5cccfc27" +checksum = "71c4d842beb7a6686d04125603bc57614d5ed78bf95e4753274db3db4ba95214" dependencies = [ + "alloy-sol-macro-input", "const-hex", - "dunce", - "heck 0.4.1", + "heck 0.5.0", "indexmap 2.4.0", "proc-macro-error", "proc-macro2", "quote", "syn 2.0.76", - "syn-solidity 0.6.4", + "syn-solidity 0.8.0", "tiny-keccak", ] +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1306e8d3c9e6e6ecf7a39ffaf7291e73a5f655a2defd366ee92c2efebcdf7fee" +dependencies = [ + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.76", + "syn-solidity 0.8.0", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4691da83dce9c9b4c775dd701c87759f173bd3021cbf2e60cde00c5fe6d7241" +dependencies = [ + "serde", + "winnow 0.6.18", +] + [[package]] name = "alloy-sol-types" version = "0.4.2" @@ -211,12 +284,13 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.6.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad09ec5853fa700d12d778ad224dcdec636af424d29fad84fb9a2f16a5b0ef09" +checksum = "577e262966e92112edbd15b1b2c0947cc434d6e8311df96d3329793fe8047da9" dependencies = [ - "alloy-primitives 0.6.4", - "alloy-sol-macro 0.6.4", + "alloy-json-abi", + "alloy-primitives 0.8.0", + "alloy-sol-macro 0.8.0", "const-hex", "serde", ] @@ -679,6 +753,7 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "asset-test-utils" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -707,6 +782,7 @@ dependencies = [ [[package]] name = "assets-common" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -816,6 +892,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "binary-merkle-tree" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "hash-db", "log", @@ -939,6 +1016,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-runtime", "finality-grandpa", @@ -949,12 +1027,13 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-messages" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-runtime", @@ -963,12 +1042,13 @@ dependencies = [ "scale-info", "serde", "sp-core", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-parachains" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -979,24 +1059,26 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-polkadot" version = "0.5.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", "frame-support", "sp-api", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-polkadot-core" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-messages", "bp-runtime", @@ -1008,12 +1090,13 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-relayers" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-messages", "bp-runtime", @@ -1021,12 +1104,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-runtime" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -1041,7 +1125,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", "trie-db", ] @@ -1049,6 +1133,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-parachains", @@ -1061,20 +1146,22 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", ] [[package]] name = "bp-xcm-bridge-hub" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "bp-xcm-bridge-hub-router" version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -1085,6 +1172,7 @@ dependencies = [ [[package]] name = "bridge-hub-common" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1100,6 +1188,7 @@ dependencies = [ [[package]] name = "bridge-hub-test-utils" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "asset-test-utils", "bp-header-chain", @@ -1129,7 +1218,7 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -1138,6 +1227,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-messages", @@ -1160,7 +1250,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", "staging-xcm", "staging-xcm-builder", @@ -1214,6 +1304,9 @@ name = "bytes" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +dependencies = [ + "serde", +] [[package]] name = "camino" @@ -1711,6 +1804,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -1727,6 +1821,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1743,6 +1838,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1762,12 +1858,12 @@ dependencies = [ "polkadot-runtime-parachains", "scale-info", "sp-core", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-inherents", "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", "sp-version", "staging-xcm", @@ -1778,6 +1874,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1788,6 +1885,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -1800,6 +1898,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-solo-to-para" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -1814,6 +1913,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1828,6 +1928,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bounded-collections", "bp-xcm-bridge-hub-router", @@ -1852,6 +1953,7 @@ dependencies = [ [[package]] name = "cumulus-ping" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-pallet-xcm", "cumulus-primitives-core", @@ -1866,6 +1968,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-aura" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "sp-api", "sp-consensus-aura", @@ -1874,6 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1889,6 +1993,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1902,15 +2007,17 @@ dependencies = [ [[package]] name = "cumulus-primitives-proof-size-hostfunction" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ - "sp-externalities 0.25.0", - "sp-runtime-interface 24.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", ] [[package]] name = "cumulus-primitives-storage-weight-reclaim" version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-proof-size-hostfunction", @@ -1926,6 +2033,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "sp-inherents", @@ -1935,6 +2043,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1951,6 +2060,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2402,20 +2512,6 @@ dependencies = [ "uint", ] -[[package]] -name = "evm-interpreter" -version = "1.0.0-dev" -source = "git+https://github.com/xermicus/evm.git?branch=separate-compilation#596447a3391f42fb4f99def5280c076a15e44d18" -dependencies = [ - "auto_impl", - "parity-scale-codec", - "primitive-types", - "rlp", - "scale-info", - "serde", - "sha3", -] - [[package]] name = "expander" version = "2.2.1" @@ -2567,6 +2663,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-support-procedural", @@ -2582,14 +2679,15 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-runtime-interface 24.0.0", - "sp-storage 19.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "static_assertions", ] [[package]] name = "frame-benchmarking-pallet-pov" version = "18.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -2603,6 +2701,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2613,6 +2712,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2628,6 +2728,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "aquamarine", "frame-support", @@ -2639,7 +2740,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] @@ -2657,6 +2758,7 @@ dependencies = [ [[package]] name = "frame-metadata-hash-extension" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "array-bytes", "docify", @@ -2671,6 +2773,7 @@ dependencies = [ [[package]] name = "frame-support" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "aquamarine", "array-bytes", @@ -2693,7 +2796,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -2701,8 +2804,8 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 14.0.0", - "sp-tracing 16.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-weights", "static_assertions", "tt-call", @@ -2711,6 +2814,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "Inflector", "cfg-expr", @@ -2730,6 +2834,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2741,6 +2846,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "proc-macro2", "quote", @@ -2750,6 +2856,7 @@ dependencies = [ [[package]] name = "frame-system" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cfg-if", "docify", @@ -2761,7 +2868,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-version", "sp-weights", ] @@ -2769,6 +2876,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -2782,6 +2890,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "parity-scale-codec", @@ -2791,6 +2900,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "parity-scale-codec", @@ -3388,7 +3498,6 @@ dependencies = [ "once_cell", "serdect", "sha2 0.10.8", - "signature", ] [[package]] @@ -3936,6 +4045,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pallet-alliance" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -3954,6 +4064,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -3971,6 +4082,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-ops" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -3988,6 +4100,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-tx-payment" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4001,6 +4114,7 @@ dependencies = [ [[package]] name = "pallet-asset-rate" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4014,6 +4128,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4030,6 +4145,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "29.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4045,6 +4161,7 @@ dependencies = [ [[package]] name = "pallet-assets-freezer" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4059,6 +4176,7 @@ dependencies = [ [[package]] name = "pallet-atomic-swap" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4072,6 +4190,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4087,6 +4206,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4101,6 +4221,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4113,6 +4234,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4135,6 +4257,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "aquamarine", "docify", @@ -4149,12 +4272,13 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "pallet-balances" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -4169,6 +4293,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4187,6 +4312,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -4211,6 +4337,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4227,6 +4354,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-runtime", @@ -4239,12 +4367,13 @@ dependencies = [ "scale-info", "sp-consensus-grandpa", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "pallet-bridge-messages" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-messages", @@ -4256,13 +4385,14 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", ] [[package]] name = "pallet-bridge-parachains" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-header-chain", "bp-parachains", @@ -4276,12 +4406,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "pallet-bridge-relayers" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-messages", "bp-relayers", @@ -4295,12 +4426,13 @@ dependencies = [ "scale-info", "sp-arithmetic", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "pallet-broker" version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitvec", "frame-benchmarking", @@ -4318,6 +4450,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4335,6 +4468,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4353,6 +4487,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4368,6 +4503,7 @@ dependencies = [ [[package]] name = "pallet-collective-content" version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4381,6 +4517,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitflags 1.3.2", "environmental", @@ -4402,7 +4539,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "wasm-instrument", @@ -4412,6 +4549,7 @@ dependencies = [ [[package]] name = "pallet-contracts-mock-network" version = "3.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4436,7 +4574,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -4446,6 +4584,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "18.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "proc-macro2", "quote", @@ -4463,6 +4602,7 @@ dependencies = [ [[package]] name = "pallet-contracts-uapi" version = "5.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", @@ -4474,6 +4614,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "assert_matches", "frame-benchmarking", @@ -4489,6 +4630,7 @@ dependencies = [ [[package]] name = "pallet-core-fellowship" version = "12.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4506,6 +4648,7 @@ dependencies = [ [[package]] name = "pallet-delegated-staking" version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4520,6 +4663,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4536,6 +4680,7 @@ dependencies = [ [[package]] name = "pallet-dev-mode" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4550,6 +4695,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4571,6 +4717,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4583,6 +4730,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4600,6 +4748,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -4617,6 +4766,7 @@ dependencies = [ [[package]] name = "pallet-glutton" version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "blake2", "frame-benchmarking", @@ -4634,6 +4784,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4655,6 +4806,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4670,6 +4822,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4688,6 +4841,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4703,6 +4857,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4715,6 +4870,7 @@ dependencies = [ [[package]] name = "pallet-lottery" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4727,6 +4883,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4742,6 +4899,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "environmental", "frame-benchmarking", @@ -4760,6 +4918,7 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -4776,6 +4935,7 @@ dependencies = [ [[package]] name = "pallet-mixnet" version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4794,6 +4954,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4810,6 +4971,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4824,6 +4986,7 @@ dependencies = [ [[package]] name = "pallet-nft-fractionalization" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4839,6 +5002,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "22.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4855,6 +5019,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "pallet-nfts", "parity-scale-codec", @@ -4864,6 +5029,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -4878,6 +5044,7 @@ dependencies = [ [[package]] name = "pallet-node-authorization" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4892,6 +5059,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4903,12 +5071,13 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "pallet-nomination-pools-benchmarking" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4921,13 +5090,14 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-runtime-interface 24.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-staking", ] [[package]] name = "pallet-nomination-pools-runtime-api" version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -4937,6 +5107,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -4952,6 +5123,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4974,6 +5146,7 @@ dependencies = [ [[package]] name = "pallet-paged-list" version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -4990,6 +5163,7 @@ dependencies = [ [[package]] name = "pallet-parameters" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5006,6 +5180,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5021,6 +5196,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5034,6 +5210,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5051,6 +5228,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5064,6 +5242,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5080,6 +5259,7 @@ dependencies = [ [[package]] name = "pallet-remark" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5095,6 +5275,7 @@ dependencies = [ [[package]] name = "pallet-revive" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitflags 1.3.2", "environmental", @@ -5116,7 +5297,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", ] @@ -5124,6 +5305,7 @@ dependencies = [ [[package]] name = "pallet-revive-fixtures" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "anyhow", "frame-system", @@ -5137,6 +5319,7 @@ dependencies = [ [[package]] name = "pallet-revive-mock-network" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5160,7 +5343,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -5170,6 +5353,7 @@ dependencies = [ [[package]] name = "pallet-revive-proc-macro" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "proc-macro2", "quote", @@ -5179,6 +5363,7 @@ dependencies = [ [[package]] name = "pallet-revive-uapi" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", @@ -5190,6 +5375,7 @@ dependencies = [ [[package]] name = "pallet-root-offences" version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5204,6 +5390,7 @@ dependencies = [ [[package]] name = "pallet-root-testing" version = "4.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5217,6 +5404,7 @@ dependencies = [ [[package]] name = "pallet-safe-mode" version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5234,6 +5422,7 @@ dependencies = [ [[package]] name = "pallet-salary" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5251,6 +5440,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5267,6 +5457,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5279,6 +5470,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5299,6 +5491,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5314,6 +5507,7 @@ dependencies = [ [[package]] name = "pallet-skip-feeless-payment" version = "3.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5325,6 +5519,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5341,6 +5536,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5358,19 +5554,10 @@ dependencies = [ "sp-staking", ] -[[package]] -name = "pallet-staking-reward-curve" -version = "11.0.0" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.76", -] - [[package]] name = "pallet-staking-reward-fn" version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "log", "sp-arithmetic", @@ -5379,6 +5566,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "sp-api", @@ -5388,6 +5576,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5403,6 +5592,7 @@ dependencies = [ [[package]] name = "pallet-statement" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5419,6 +5609,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5433,6 +5624,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5444,13 +5636,14 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-storage 19.0.0", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-timestamp", ] [[package]] name = "pallet-tips" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5468,6 +5661,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -5482,6 +5676,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5493,6 +5688,7 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5511,6 +5707,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5528,6 +5725,7 @@ dependencies = [ [[package]] name = "pallet-tx-pause" version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -5544,6 +5742,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5557,6 +5756,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5571,6 +5771,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5584,6 +5785,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5597,6 +5799,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -5619,6 +5822,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -5636,6 +5840,7 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-messages", "bp-runtime", @@ -5649,7 +5854,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -5658,6 +5863,7 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub-router" version = "0.5.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", @@ -5668,7 +5874,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", ] @@ -5676,6 +5882,7 @@ dependencies = [ [[package]] name = "parachains-common" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", @@ -5705,6 +5912,7 @@ dependencies = [ [[package]] name = "parachains-runtimes-test-utils" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -5724,7 +5932,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-parachain-info", "staging-xcm", "staging-xcm-executor", @@ -5954,6 +6162,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -5964,6 +6173,7 @@ dependencies = [ [[package]] name = "polkadot-parachain-primitives" version = "6.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bounded-collections", "derive_more", @@ -5979,6 +6189,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitvec", "hex-literal", @@ -6004,6 +6215,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitvec", "frame-benchmarking", @@ -6052,17 +6264,19 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bs58", "frame-benchmarking", "parity-scale-codec", "polkadot-primitives", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "polkadot-runtime-parachains" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bitflags 1.3.2", "bitvec", @@ -6102,7 +6316,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-executor", ] @@ -6110,6 +6324,7 @@ dependencies = [ [[package]] name = "polkadot-sdk" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "asset-test-utils", "assets-common", @@ -6186,8 +6401,6 @@ dependencies = [ "pallet-collective-content", "pallet-contracts", "pallet-contracts-mock-network", - "pallet-contracts-proc-macro", - "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", @@ -6231,8 +6444,6 @@ dependencies = [ "pallet-revive", "pallet-revive-fixtures", "pallet-revive-mock-network", - "pallet-revive-proc-macro", - "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", @@ -6244,7 +6455,6 @@ dependencies = [ "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", - "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", @@ -6274,9 +6484,7 @@ dependencies = [ "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", - "sc-chain-spec-derive", "sc-executor", - "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", @@ -6307,11 +6515,11 @@ dependencies = [ "sp-consensus-slots", "sp-core", "sp-core-hashing", - "sp-crypto-ec-utils 0.10.0", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0", - "sp-externalities 0.25.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -6323,22 +6531,22 @@ dependencies = [ "sp-npos-elections", "sp-offchain", "sp-runtime", - "sp-runtime-interface 24.0.0", - "sp-runtime-interface-proc-macro 17.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", - "sp-std 14.0.0", - "sp-storage 19.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-timestamp", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", - "sp-wasm-interface 20.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-weights", "staging-parachain-info", "staging-xcm", @@ -6346,14 +6554,13 @@ dependencies = [ "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", - "tracing-gum-proc-macro", - "xcm-procedural", "xcm-runtime-apis", ] [[package]] name = "polkadot-sdk-frame" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "frame-benchmarking", @@ -6377,7 +6584,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-storage 19.0.0", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-transaction-pool", "sp-version", ] @@ -6900,7 +7107,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" name = "revive-benchmarks" version = "0.1.0" dependencies = [ - "alloy-primitives 0.6.4", + "alloy-primitives 0.8.0", "criterion", "hex", "polkavm 0.10.0", @@ -6926,17 +7133,21 @@ dependencies = [ name = "revive-differential" version = "0.1.0" dependencies = [ - "alloy-primitives 0.6.4", - "evm-interpreter", - "primitive-types", + "alloy-genesis", + "alloy-primitives 0.8.0", + "alloy-serde", + "hex", + "serde", + "serde_json", + "tempfile", ] [[package]] name = "revive-integration" version = "0.1.0" dependencies = [ - "alloy-primitives 0.6.4", - "alloy-sol-types 0.6.4", + "alloy-primitives 0.8.0", + "alloy-sol-types 0.8.0", "env_logger", "hex", "log", @@ -6998,6 +7209,7 @@ dependencies = [ "hex", "parity-scale-codec", "polkadot-sdk", + "revive-differential", "revive-solidity", "scale-info", "serde", @@ -7078,6 +7290,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "polkadot-primitives", @@ -7246,26 +7459,18 @@ dependencies = [ [[package]] name = "sc-allocator" version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "log", "sp-core", - "sp-wasm-interface 20.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "thiserror", ] -[[package]] -name = "sc-chain-spec-derive" -version = "11.0.0" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.76", -] - [[package]] name = "sc-executor" version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "parking_lot", @@ -7275,24 +7480,25 @@ dependencies = [ "schnellru", "sp-api", "sp-core", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-io", "sp-panic-handler", - "sp-runtime-interface 24.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", "sp-version", - "sp-wasm-interface 20.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "tracing", ] [[package]] name = "sc-executor-common" version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "polkavm 0.9.3", "sc-allocator", "sp-maybe-compressed-blob", - "sp-wasm-interface 20.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "thiserror", "wasm-instrument", ] @@ -7300,16 +7506,18 @@ dependencies = [ [[package]] name = "sc-executor-polkavm" version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "log", "polkavm 0.9.3", "sc-executor-common", - "sp-wasm-interface 20.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "sc-executor-wasmtime" version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "anyhow", "cfg-if", @@ -7319,21 +7527,11 @@ dependencies = [ "rustix 0.36.17", "sc-allocator", "sc-executor-common", - "sp-runtime-interface 24.0.0", - "sp-wasm-interface 20.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "wasmtime", ] -[[package]] -name = "sc-tracing-proc-macro" -version = "11.0.0" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.76", -] - [[package]] name = "scale-info" version = "2.11.3" @@ -7691,6 +7889,7 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "enumn", "parity-scale-codec", @@ -7717,6 +7916,7 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "byte-slice-cast", "frame-support", @@ -7730,7 +7930,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "ssz_rs", "ssz_rs_derive", ] @@ -7738,6 +7938,7 @@ dependencies = [ [[package]] name = "snowbridge-core" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "ethabi-decode", "frame-support", @@ -7752,7 +7953,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", ] @@ -7760,6 +7961,7 @@ dependencies = [ [[package]] name = "snowbridge-ethereum" version = "0.3.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "ethabi-decode", "ethbloom", @@ -7773,7 +7975,7 @@ dependencies = [ "serde-big-array", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] @@ -7794,6 +7996,7 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-merkle-tree" version = "0.3.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -7804,18 +8007,20 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-runtime-api" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "parity-scale-codec", "snowbridge-core", "snowbridge-outbound-queue-merkle-tree", "sp-api", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "snowbridge-pallet-ethereum-client" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -7832,24 +8037,26 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "static_assertions", ] [[package]] name = "snowbridge-pallet-ethereum-client-fixtures" version = "0.9.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "snowbridge-pallet-inbound-queue" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "alloy-primitives 0.4.2", "alloy-sol-types 0.4.2", @@ -7868,7 +8075,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-executor", ] @@ -7876,17 +8083,19 @@ dependencies = [ [[package]] name = "snowbridge-pallet-inbound-queue-fixtures" version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bridge-hub-common", "ethabi-decode", @@ -7902,12 +8111,13 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "snowbridge-pallet-system" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-benchmarking", "frame-support", @@ -7919,7 +8129,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-executor", ] @@ -7927,6 +8137,7 @@ dependencies = [ [[package]] name = "snowbridge-router-primitives" version = "0.9.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "hex-literal", @@ -7937,7 +8148,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-executor", ] @@ -7945,13 +8156,14 @@ dependencies = [ [[package]] name = "snowbridge-runtime-common" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "log", "parity-scale-codec", "snowbridge-core", "sp-arithmetic", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -7960,6 +8172,7 @@ dependencies = [ [[package]] name = "snowbridge-runtime-test-common" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -7990,17 +8203,19 @@ dependencies = [ [[package]] name = "snowbridge-system-runtime-api" version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "snowbridge-core", "sp-api", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", ] [[package]] name = "sp-api" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "hash-db", @@ -8009,10 +8224,10 @@ dependencies = [ "scale-info", "sp-api-proc-macro", "sp-core", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-metadata-ir", "sp-runtime", - "sp-runtime-interface 24.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-state-machine", "sp-trie", "sp-version", @@ -8022,6 +8237,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "Inflector", "blake2", @@ -8035,6 +8251,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8046,6 +8263,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "integer-sqrt", @@ -8077,6 +8295,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8088,6 +8307,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "sp-api", "sp-inherents", @@ -8097,6 +8317,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "async-trait", "parity-scale-codec", @@ -8112,6 +8333,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "async-trait", "parity-scale-codec", @@ -8129,6 +8351,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "lazy_static", "parity-scale-codec", @@ -8149,6 +8372,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "finality-grandpa", "log", @@ -8165,6 +8389,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "sp-api", @@ -8175,6 +8400,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8185,6 +8411,7 @@ dependencies = [ [[package]] name = "sp-core" version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "array-bytes", "bandersnatch_vrfs", @@ -8215,11 +8442,11 @@ dependencies = [ "secrecy", "serde", "sp-crypto-hashing", - "sp-debug-derive 14.0.0", - "sp-externalities 0.25.0", - "sp-runtime-interface 24.0.0", - "sp-std 14.0.0", - "sp-storage 19.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "ss58-registry", "substrate-bip39", "thiserror", @@ -8231,6 +8458,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "sp-crypto-hashing", ] @@ -8238,6 +8466,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -8251,7 +8480,7 @@ dependencies = [ "ark-ed-on-bls12-381-bandersnatch", "ark-ed-on-bls12-381-bandersnatch-ext", "ark-scale", - "sp-runtime-interface 24.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] @@ -8277,6 +8506,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "blake2b_simd", "byteorder", @@ -8289,6 +8519,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "quote", "sp-crypto-hashing", @@ -8298,6 +8529,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "proc-macro2", "quote", @@ -8317,10 +8549,11 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "environmental", "parity-scale-codec", - "sp-storage 19.0.0", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] @@ -8336,6 +8569,7 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.8.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8347,6 +8581,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8359,6 +8594,7 @@ dependencies = [ [[package]] name = "sp-io" version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bytes", "docify", @@ -8371,11 +8607,11 @@ dependencies = [ "secp256k1", "sp-core", "sp-crypto-hashing", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-keystore", - "sp-runtime-interface 24.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-state-machine", - "sp-tracing 16.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-trie", "tracing", "tracing-core", @@ -8384,6 +8620,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "sp-core", "sp-runtime", @@ -8393,16 +8630,18 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "parking_lot", "sp-core", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] name = "sp-maybe-compressed-blob" version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "thiserror", "zstd 0.12.4", @@ -8411,6 +8650,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -8420,6 +8660,7 @@ dependencies = [ [[package]] name = "sp-mixnet" version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8430,6 +8671,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "log", "parity-scale-codec", @@ -8438,7 +8680,7 @@ dependencies = [ "serde", "sp-api", "sp-core", - "sp-debug-derive 14.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-runtime", "thiserror", ] @@ -8446,6 +8688,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8458,6 +8701,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "sp-api", "sp-core", @@ -8467,6 +8711,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "backtrace", "lazy_static", @@ -8476,6 +8721,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "31.0.1" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "docify", "either", @@ -8493,7 +8739,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-io", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-weights", "tracing", ] @@ -8501,18 +8747,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "polkavm-derive 0.9.1", "primitive-types", - "sp-externalities 0.25.0", - "sp-runtime-interface-proc-macro 17.0.0", - "sp-std 14.0.0", - "sp-storage 19.0.0", - "sp-tracing 16.0.0", - "sp-wasm-interface 20.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "static_assertions", ] @@ -8538,6 +8785,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "Inflector", "expander", @@ -8563,6 +8811,7 @@ dependencies = [ [[package]] name = "sp-session" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "scale-info", @@ -8576,6 +8825,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8588,6 +8838,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "hash-db", "log", @@ -8596,7 +8847,7 @@ dependencies = [ "rand", "smallvec", "sp-core", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-panic-handler", "sp-trie", "thiserror", @@ -8607,6 +8858,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "aes-gcm", "curve25519-dalek", @@ -8620,9 +8872,9 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-crypto-hashing", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-runtime", - "sp-runtime-interface 24.0.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "thiserror", "x25519-dalek", ] @@ -8630,6 +8882,7 @@ dependencies = [ [[package]] name = "sp-std" version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" [[package]] name = "sp-std" @@ -8639,12 +8892,13 @@ source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c [[package]] name = "sp-storage" version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 14.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] @@ -8662,6 +8916,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "async-trait", "parity-scale-codec", @@ -8673,6 +8928,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "tracing", @@ -8694,6 +8950,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "sp-api", "sp-runtime", @@ -8702,6 +8959,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "async-trait", "parity-scale-codec", @@ -8715,6 +8973,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "ahash 0.8.11", "hash-db", @@ -8727,7 +8986,7 @@ dependencies = [ "scale-info", "schnellru", "sp-core", - "sp-externalities 0.25.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "thiserror", "tracing", "trie-db", @@ -8737,6 +8996,7 @@ dependencies = [ [[package]] name = "sp-version" version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8745,7 +9005,7 @@ dependencies = [ "serde", "sp-crypto-hashing-proc-macro", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "sp-version-proc-macro", "thiserror", ] @@ -8753,6 +9013,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8763,6 +9024,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -8784,6 +9046,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "bounded-collections", "parity-scale-codec", @@ -8791,7 +9054,7 @@ dependencies = [ "serde", "smallvec", "sp-arithmetic", - "sp-debug-derive 14.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", ] [[package]] @@ -8870,6 +9133,7 @@ dependencies = [ [[package]] name = "staging-parachain-info" version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -8882,6 +9146,7 @@ dependencies = [ [[package]] name = "staging-xcm" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "array-bytes", "bounded-collections", @@ -8900,6 +9165,7 @@ dependencies = [ [[package]] name = "staging-xcm-builder" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -8921,6 +9187,7 @@ dependencies = [ [[package]] name = "staging-xcm-executor" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "environmental", "frame-benchmarking", @@ -9004,6 +9271,7 @@ dependencies = [ [[package]] name = "substrate-bip39" version = "0.4.7" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -9015,6 +9283,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "build-helper", "cargo_metadata", @@ -9073,9 +9342,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.6.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3d0961cd53c23ea94eeec56ba940f636f6394788976e9f16ca5ee0aca7464a" +checksum = "284c41c2919303438fcf8dede4036fd1e82d4fc0fbb2b279bd2a1442c909ca92" dependencies = [ "paste", "proc-macro2", @@ -9132,6 +9401,7 @@ dependencies = [ [[package]] name = "testnet-parachains-constants" version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -9325,17 +9595,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-gum-proc-macro" -version = "5.0.0" -dependencies = [ - "expander", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.76", -] - [[package]] name = "tracing-log" version = "0.2.0" @@ -9933,6 +10192,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "polkadot-primitives", @@ -10298,6 +10558,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "Inflector", "proc-macro2", @@ -10308,6 +10569,7 @@ dependencies = [ [[package]] name = "xcm-runtime-apis" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "parity-scale-codec", @@ -10321,6 +10583,7 @@ dependencies = [ [[package]] name = "xcm-simulator" version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591#1c4141abeb4c581e503f07af2a3522e6918db591" dependencies = [ "frame-support", "frame-system", @@ -10333,7 +10596,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503f07af2a3522e6918db591)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", diff --git a/Cargo.toml b/Cargo.toml index 455c3e4d..f7bc9cc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,20 +54,17 @@ polkavm-common = "0.10" polkavm-linker = "0.10" polkavm-disassembler = "0.10" polkavm = "0.10" -alloy-primitives = "0.6" -alloy-sol-types = "0.6" +alloy-primitives = { version = "0.8", features = ["serde"] } +alloy-sol-types = "0.8" +alloy-genesis = "0.3" +alloy-serde = "0.3" env_logger = { version = "0.10.0", default-features = false } serde_stacker = "0.1" criterion = { version = "0.5", features = ["html_reports"] } log = { version = "0.4" } codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" } scale-info = { version = "2.11.1", default-features = false } -#polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "559fa1db0594a81d5dbf343613ba2f3fc16708da" } -polkadot-sdk = { path = "../polkadot-sdk/umbrella" } - -# Benchmarking against EVM -primitive-types = { version = "0.12", features = ["codec"] } -evm-interpreter = { git = "https://github.com/xermicus/evm.git", branch = "separate-compilation" } +polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "1c4141abeb4c581e503f07af2a3522e6918db591" } [workspace.dependencies.inkwell] version = "0.5" diff --git a/crates/differential/Cargo.toml b/crates/differential/Cargo.toml index 543d8eb7..d38c1050 100644 --- a/crates/differential/Cargo.toml +++ b/crates/differential/Cargo.toml @@ -8,6 +8,7 @@ repository.workspace = true [dependencies] hex = { workspace = true } +tempfile = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } alloy-primitives = { workspace = true, features = ["serde"] } diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index 52504096..0244f513 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -1,4 +1,10 @@ -use std::collections::BTreeMap; +use core::str; +use std::{ + collections::BTreeMap, + io::Write, + path::PathBuf, + process::{Command, Stdio}, +}; use alloy_genesis::{Genesis, GenesisAccount}; use alloy_primitives::{Address, Bytes, B256, U256}; @@ -6,7 +12,18 @@ use alloy_serde::storage::deserialize_storage_map; use serde::{Deserialize, Serialize}; use serde_json::{Deserializer, Value}; -pub const GENESIS_JSON: &str = include_str!("../genesis.json"); +const GENESIS_JSON: &str = include_str!("../genesis.json"); +const EXECUTABLE_NAME: &str = "evm"; +const EXECUTABLE_ARGS: [&str; 8] = [ + "--log.format=json", + "run", + "--dump", + "--nomemory=false", + "--noreturndata=false", + "--json", + "--codefile", + "-", +]; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct StateDump { @@ -70,9 +87,7 @@ impl From<&str> for EvmLog { fn from(value: &str) -> Self { let mut output = None; let mut state_dump = None; - - let stream = Deserializer::from_str(value).into_iter::(); - for value in stream { + for value in Deserializer::from_str(value).into_iter::() { let Ok(value) = value else { continue }; if let Ok(value @ EvmOutput { .. }) = serde_json::from_value(value.clone()) { output = Some(value); @@ -90,12 +105,114 @@ impl From<&str> for EvmLog { } } +#[derive(Debug, Default)] +struct Evm { + genesis_path: Option, + code: Option>, + input: Option, + create: bool, +} + +impl Evm { + /// Run the code found in `code_file` + pub fn code_file(self, path: PathBuf) -> Self { + Self { + code: std::fs::read_to_string(&path) + .unwrap_or_else(|err| { + panic!("can not read EVM byte code from file {path:?}: {err}") + }) + .into_bytes() + .into(), + ..self + } + } + + /// Run the `code` + pub fn code_blob(self, blob: Vec) -> Self { + Self { + code: Some(blob), + ..self + } + } + + /// Set the calldata + pub fn input(self, bytes: Bytes) -> Self { + Self { + input: Some(bytes), + ..self + } + } + + /// Set the create flag + pub fn deploy(self, enable: bool) -> Self { + Self { + create: enable, + ..self + } + } + + pub fn genesis_json(self, path: PathBuf) -> Self { + Self { + genesis_path: Some(path), + ..self + } + } + + pub fn run(&self) -> EvmLog { + let Some(code) = &self.code else { + panic!("no code or code file specified") + }; + + let genesis_json_path = "/tmp/genesis.json"; + std::fs::write(genesis_json_path, GENESIS_JSON) + .unwrap_or_else(|err| panic!("failed to write genesis.json: {err}")); + let mut command = Command::new(PathBuf::from(EXECUTABLE_NAME)); + command.stdin(Stdio::piped()); + command.stdout(Stdio::piped()); + command.stderr(Stdio::piped()); + command.args(EXECUTABLE_ARGS); + command.args(["--prestate", genesis_json_path]); + if let Some(input) = &self.input { + command.args(["--input", hex::encode(input).as_str()]); + } + if self.create { + command.arg("--create"); + } + + let process = command.spawn().unwrap_or_else(|error| { + panic!("{EXECUTABLE_NAME} subprocess spawning error: {error:?}") + }); + process + .stdin + .as_ref() + .unwrap_or_else(|| panic!("{EXECUTABLE_NAME} stdin getting error")) + .write_all(code) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stdin writing error: {err:?}")); + + let output = process + .wait_with_output() + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} subprocess output error: {err}")); + + assert!( + output.status.success(), + "{EXECUTABLE_NAME} command failed: {}", + output.status + ); + + str::from_utf8(output.stdout.as_slice()) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} output failed to parse: {err}")) + .into() + } +} + #[cfg(test)] mod tests { + use std::str::FromStr; + use alloy_genesis::Genesis; - use alloy_primitives::{B256, U256}; + use alloy_primitives::{Bytes, B256, U256}; - use crate::{EvmLog, EvmOutput, StateDump}; + use crate::{Evm, EvmLog, EvmOutput, StateDump}; const OUTPUT_OK: &str = r#"{"output":"0000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x11d"}"#; const OUTPUT_REVERTED: &str = r#"{"output":"","gasUsed":"0x2d","error":"execution reverted"}"#; @@ -117,6 +234,11 @@ mod tests { } } }"#; + const EVM_BIN_FIXTURE: &str = "6080604052348015600e575f80fd5b506040516101403803806101408339818101604052810190602e9190607f565b805f806101000a81548160ff0219169083151502179055505060a5565b5f80fd5b5f8115159050919050565b606181604f565b8114606a575f80fd5b50565b5f81519050607981605a565b92915050565b5f602082840312156091576090604b565b5b5f609c84828501606d565b91505092915050565b608f806100b15f395ff3fe6080604052348015600e575f80fd5b50600436106026575f3560e01c8063cde4efa914602a575b5f80fd5b60306032565b005b5f8054906101000a900460ff16155f806101000a81548160ff02191690831515021790555056fea264697066735822122046c92dd2fd612b1ed93d184dad4c49f61c44690722c4a6c7c746ebeb0aadeb4a64736f6c63430008190033"; + const EVM_BIN_RUNTIME_FIXTURE: &str = "6080604052348015600e575f80fd5b50600436106026575f3560e01c8063cde4efa914602a575b5f80fd5b60306032565b005b5f8054906101000a900460ff16155f806101000a81548160ff02191690831515021790555056fea264697066735822122046c92dd2fd612b1ed93d184dad4c49f61c44690722c4a6c7c746ebeb0aadeb4a64736f6c63430008190033"; + const EVM_BIN_FIXTURE_INPUT: &str = + "0000000000000000000000000000000000000000000000000000000000000001"; + const EVM_BIN_RUNTIME_FIXTURE_INPUT: &str = "cde4efa9"; #[test] fn parse_evm_output_ok() { @@ -156,4 +278,20 @@ mod tests { .expect("genesis account should have key 0 occupied"); assert_eq!(*storage_value, B256::from(U256::from(2))); } + + #[test] + fn flipper() { + let log_deploy = Evm::default() + .code_blob(EVM_BIN_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_FIXTURE_INPUT).unwrap()) + .deploy(true) + .run(); + assert!(log_deploy.output.error.is_none()); + + let log_runtime = Evm::default() + .code_blob(EVM_BIN_RUNTIME_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) + .run(); + assert!(log_runtime.output.error.is_none()); + } } diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index 69d408e1..ab42ad5d 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -13,7 +13,15 @@ serde_json = { workspace = true } hex = { workspace = true, features = ["serde"] } codec = { workspace = true, default-features = false } scale-info = { workspace = true, default-features = false } -polkadot-sdk = { workspace = true, features = ["experimental", "runtime"] } +polkadot-sdk.workspace = true +polkadot-sdk.features = [ + "experimental", + "runtime", + "polkadot-runtime-common", + "pallet-revive", + "pallet-balances", + "pallet-timestamp" +] revive-solidity = { workspace = true } revive-differential = { workspace = true } From 15ae43a574b9ffcff2c6a2f30c39f22633acc257 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 12:06:29 +0200 Subject: [PATCH 11/27] geth evm: extract created account Signed-off-by: xermicus --- crates/differential/src/lib.rs | 168 ++++++++++++++---- .../src/polkavm_guest.rs | 1 + 2 files changed, 136 insertions(+), 33 deletions(-) diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index 0244f513..123dddfa 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -4,13 +4,15 @@ use std::{ io::Write, path::PathBuf, process::{Command, Stdio}, + str::FromStr, }; use alloy_genesis::{Genesis, GenesisAccount}; -use alloy_primitives::{Address, Bytes, B256, U256}; +use alloy_primitives::{hex::ToHexExt, Address, Bytes, B256, U256}; use alloy_serde::storage::deserialize_storage_map; use serde::{Deserialize, Serialize}; use serde_json::{Deserializer, Value}; +use tempfile::NamedTempFile; const GENESIS_JSON: &str = include_str!("../genesis.json"); const EXECUTABLE_NAME: &str = "evm"; @@ -25,16 +27,17 @@ const EXECUTABLE_ARGS: [&str; 8] = [ "-", ]; +/// The geth EVM state dump structure #[derive(Clone, Debug, Serialize, Deserialize)] pub struct StateDump { pub root: Bytes, pub accounts: BTreeMap, } -impl Into for StateDump { - fn into(self) -> Genesis { +impl From for Genesis { + fn from(value: StateDump) -> Self { let mut genesis: Genesis = serde_json::from_str(GENESIS_JSON).unwrap(); - genesis.alloc = self + genesis.alloc = value .accounts .iter() .map(|(address, account)| (*address, account.clone().into())) @@ -43,6 +46,7 @@ impl Into for StateDump { } } +/// The geth EVM state dump account structure #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Account { pub balance: U256, @@ -57,18 +61,19 @@ pub struct Account { pub key: Option, } -impl Into for Account { - fn into(self) -> GenesisAccount { +impl From for GenesisAccount { + fn from(value: Account) -> Self { GenesisAccount { - balance: self.balance, - nonce: Some(self.nonce), - code: self.code, - storage: self.storage, - private_key: self.key, + balance: value.balance, + nonce: Some(value.nonce), + code: value.code, + storage: value.storage, + private_key: value.key, } } } +/// Contains the output from geth `emv` invocations #[derive(Clone, Debug, Serialize, Deserialize)] pub struct EvmOutput { output: Bytes, @@ -77,8 +82,20 @@ pub struct EvmOutput { error: Option, } +impl EvmOutput { + /// Return if there was no error found and the gas used is non-zero. + /// + /// It is not sufficient to check for the absence of an error alone, + /// i.e. when there was no receiving account no error is reported (but no gas used). + pub fn run_success(&self) -> bool { + self.error.is_none() && self.gas_used > U256::ZERO + } +} + +/// Contains the full log from geth `emv` invocations #[derive(Clone, Debug)] pub struct EvmLog { + pub account_deployed: Option
, pub output: EvmOutput, pub state_dump: StateDump, } @@ -99,21 +116,42 @@ impl From<&str> for EvmLog { } Self { + account_deployed: None, output: output.expect("the EVM log should contain the output"), state_dump: state_dump.expect("the EVM log should contain the state dump"), } } } -#[derive(Debug, Default)] -struct Evm { - genesis_path: Option, +/// Builder for running contracts in geth `evm` +pub struct Evm { + genesis_json: String, code: Option>, input: Option, + receiver: Option, + sender: String, create: bool, } +impl Default for Evm { + fn default() -> Self { + Self { + genesis_json: GENESIS_JSON.to_string(), + code: None, + input: None, + receiver: None, + sender: Address::default().encode_hex(), + create: false, + } + } +} + impl Evm { + /// Create a new EVM with the given `genesis` + pub fn from_genesis(genesis: Genesis) -> Self { + Self::default().genesis_json(genesis) + } + /// Run the code found in `code_file` pub fn code_file(self, path: PathBuf) -> Self { Self { @@ -151,57 +189,109 @@ impl Evm { } } - pub fn genesis_json(self, path: PathBuf) -> Self { + /// Provide the prestate genesis configuration + pub fn genesis_json(self, genesis: Genesis) -> Self { + let genesis_json = serde_json::to_string(&genesis).expect("state dump should be valid"); + // TODO: Investigate + let genesis_json = genesis_json.replace("\"0x0\"", "0"); + Self { - genesis_path: Some(path), + genesis_json, ..self } } - pub fn run(&self) -> EvmLog { - let Some(code) = &self.code else { - panic!("no code or code file specified") - }; + /// Set the callee address + pub fn receiver(self, address: Address) -> Self { + Self { + receiver: Some(address.encode_hex()), + ..self + } + } - let genesis_json_path = "/tmp/genesis.json"; - std::fs::write(genesis_json_path, GENESIS_JSON) - .unwrap_or_else(|err| panic!("failed to write genesis.json: {err}")); + /// Set the caller address + pub fn sender(self, address: Address) -> Self { + Self { + sender: address.encode_hex(), + ..self + } + } + + /// Calculate the address of the contract account this deploy call would create + pub fn expect_account_created(&self) -> Address { + assert!(self.create, "expected a deploy call"); + let sender = Address::from_str(&self.sender).expect("sender address should be valid"); + let genesis: Genesis = serde_json::from_str(&self.genesis_json).unwrap(); + let nonce = genesis + .alloc + .get(&sender) + .map(|account| account.nonce.unwrap_or(0)) + .unwrap_or(0); + sender.create(nonce) + } + + /// Run the call in a geth `evm` subprocess + pub fn run(self) -> EvmLog { + // Write genesis.json to disk + let mut temp_file = NamedTempFile::new().unwrap(); + temp_file.write_all(self.genesis_json.as_bytes()).unwrap(); + let path = temp_file.into_temp_path(); + let genesis_json_path = &path.display().to_string(); + + // Static args let mut command = Command::new(PathBuf::from(EXECUTABLE_NAME)); command.stdin(Stdio::piped()); command.stdout(Stdio::piped()); command.stderr(Stdio::piped()); command.args(EXECUTABLE_ARGS); command.args(["--prestate", genesis_json_path]); + + // Dynamic args if let Some(input) = &self.input { command.args(["--input", hex::encode(input).as_str()]); } - if self.create { + let account_deployed = if self.create { command.arg("--create"); + self.expect_account_created().into() + } else { + None + }; + command.args(["--sender", &self.sender]); + match (&self.code, &self.receiver) { + (Some(_), None) => {} + (None, Some(address)) => { + command.args(["--receiver", address]); + } + (Some(_), Some(_)) => panic!("code and receiver specified"), + _ => panic!("no code file or receiver specified"), } + // Run the evm subprocess and assert success return value let process = command.spawn().unwrap_or_else(|error| { panic!("{EXECUTABLE_NAME} subprocess spawning error: {error:?}") }); + let buf = vec![]; process .stdin .as_ref() .unwrap_or_else(|| panic!("{EXECUTABLE_NAME} stdin getting error")) - .write_all(code) + .write_all(self.code.as_ref().unwrap_or(&buf)) .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stdin writing error: {err:?}")); let output = process .wait_with_output() .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} subprocess output error: {err}")); - assert!( output.status.success(), - "{EXECUTABLE_NAME} command failed: {}", - output.status + "{EXECUTABLE_NAME} command failed: {output:?}", ); - str::from_utf8(output.stdout.as_slice()) + // Set the deployed account + let mut log: EvmLog = str::from_utf8(output.stdout.as_slice()) .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} output failed to parse: {err}")) - .into() + .into(); + log.account_deployed = account_deployed; + log } } @@ -281,17 +371,29 @@ mod tests { #[test] fn flipper() { + let log_runtime = Evm::default() + .code_blob(EVM_BIN_RUNTIME_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) + .run(); + assert!(log_runtime.output.run_success()); + } + + #[test] + fn prestate() { let log_deploy = Evm::default() .code_blob(EVM_BIN_FIXTURE.as_bytes().to_vec()) .input(Bytes::from_str(EVM_BIN_FIXTURE_INPUT).unwrap()) .deploy(true) .run(); - assert!(log_deploy.output.error.is_none()); + assert!(log_deploy.output.run_success()); + let address = log_deploy.account_deployed.unwrap(); + let genesis: Genesis = log_deploy.state_dump.into(); let log_runtime = Evm::default() - .code_blob(EVM_BIN_RUNTIME_FIXTURE.as_bytes().to_vec()) + .genesis_json(genesis) + .receiver(address) .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) .run(); - assert!(log_runtime.output.error.is_none()); + assert!(log_runtime.output.run_success(), "{:?}", log_runtime.output); } } diff --git a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs b/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs index 77bbccb7..58b2c588 100644 --- a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs +++ b/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs @@ -14,6 +14,7 @@ include!(concat!(env!("OUT_DIR"), "/polkavm_guest.rs")); /// The module does: /// - Export the `call` and `deploy` functions (which are named thereafter). /// - Import (most) `pallet-contracts` runtime API functions. +/// /// Returns `Error` if the bitcode fails to parse, which should never happen. pub fn module<'context>( context: &'context Context, From df5d687d7a9c97bb143300f25a9a4092ad848719 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 16:27:26 +0200 Subject: [PATCH 12/27] support differential tests which derive verifications Signed-off-by: xermicus --- Cargo.lock | 1 + crates/differential/src/lib.rs | 41 +++++- crates/integration/contracts/Value.sol | 6 - crates/integration/src/tests.rs | 70 +++------- crates/runner/Cargo.toml | 1 + crates/runner/src/lib.rs | 6 +- crates/runner/src/specs.rs | 123 +++++++++++++++--- .../input/settings/selection/file/flag.rs | 3 + .../input/settings/selection/file/mod.rs | 1 + crates/solidity/src/test_utils.rs | 39 ++++-- 10 files changed, 197 insertions(+), 94 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02216930..858751ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7206,6 +7206,7 @@ dependencies = [ name = "revive-runner" version = "0.1.0" dependencies = [ + "alloy-primitives 0.8.0", "hex", "parity-scale-codec", "polkadot-sdk", diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index 123dddfa..30f32f21 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -76,19 +76,20 @@ impl From for GenesisAccount { /// Contains the output from geth `emv` invocations #[derive(Clone, Debug, Serialize, Deserialize)] pub struct EvmOutput { - output: Bytes, + pub output: Bytes, #[serde(rename = "gasUsed")] - gas_used: U256, - error: Option, + pub gas_used: U256, + pub error: Option, } impl EvmOutput { - /// Return if there was no error found and the gas used is non-zero. + /// Return if there was no error found. /// - /// It is not sufficient to check for the absence of an error alone, - /// i.e. when there was no receiving account no error is reported (but no gas used). + /// Panics if the gas used is zero as this indicates nothing was run, i.e. + /// there was no receiving account but still no error is reported. pub fn run_success(&self) -> bool { - self.error.is_none() && self.gas_used > U256::ZERO + assert_ne!(self.gas_used, U256::ZERO, "nothing was executed"); + self.error.is_none() } } @@ -130,6 +131,8 @@ pub struct Evm { input: Option, receiver: Option, sender: String, + value: Option, + gas: Option, create: bool, } @@ -141,6 +144,8 @@ impl Default for Evm { input: None, receiver: None, sender: Address::default().encode_hex(), + value: None, + gas: None, create: false, } } @@ -189,6 +194,22 @@ impl Evm { } } + /// Set the transferred value + pub fn value(self, value: u128) -> Self { + Self { + value: Some(value), + ..self + } + } + + /// Set the gas limit + pub fn gas(self, limit: u64) -> Self { + Self { + gas: Some(limit), + ..self + } + } + /// Provide the prestate genesis configuration pub fn genesis_json(self, genesis: Genesis) -> Self { let genesis_json = serde_json::to_string(&genesis).expect("state dump should be valid"); @@ -265,6 +286,12 @@ impl Evm { (Some(_), Some(_)) => panic!("code and receiver specified"), _ => panic!("no code file or receiver specified"), } + if let Some(gas) = self.gas { + command.args(["--gas", &format!("{gas}")]); + } + if let Some(value) = self.value { + command.args(["--value", &format!("{value}")]); + } // Run the evm subprocess and assert success return value let process = command.spawn().unwrap_or_else(|error| { diff --git a/crates/integration/contracts/Value.sol b/crates/integration/contracts/Value.sol index 57c2ec34..031463f3 100644 --- a/crates/integration/contracts/Value.sol +++ b/crates/integration/contracts/Value.sol @@ -27,12 +27,6 @@ pragma solidity ^0.8; */ contract Value { - uint foo; - - constructor() { - foo = 2; - } - function value() public payable returns (uint ret) { ret = msg.value; } diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 1e58d322..5d5c93bc 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,4 +1,3 @@ -use alloy_sol_types::{SolCall, SolValue}; use revive_runner::*; macro_rules! test_spec { @@ -23,41 +22,31 @@ test_spec!(computation, "Computation", "Computation.sol"); test_spec!(msize, "MSize", "MSize.sol"); test_spec!(transferred_value, "Value", "Value.sol"); +/* #[test] -fn foo() { - alloy_sol_types::sol!( - contract Value { - function value() public payable returns (uint); - } - ); +fn balance() { + // TODO: We do not have the correct balance API in the pallet yet + let (_, output) = assert_success(&Contract::value_balance_of(Default::default()), false); - dbg!(hex::encode(&crate::cases::Contract::baseline().calldata)); - dbg!(hex::encode(&Value::valueCall::new(()).abi_encode())); - dbg!(hex::encode(&alloy_primitives::U256::from(123).abi_encode())); -} + let expected = U256::ZERO; + let received = U256::from_be_slice(&output.data); + assert_eq!(expected, received); -/* -#[test] -fn transferred_value() { - sol!( - contract Value { - function value() public payable returns (uint); - } - ); - let code = compile_blob("Value", include_str!("../contracts/Value.sol")); + let expected = U256::from(54589); + let (mut state, address) = State::new_deployed(Contract::value_balance_of(Default::default())); + state.accounts_mut().get_mut(&address).unwrap().value = expected; - let (_, output) = State::default() + let contract = Contract::value_balance_of(address); + let (_, output) = state .transaction() - .calldata(Value::valueCall::SELECTOR.to_vec()) - .callvalue(U256::from(123)) - .with_default_account(&code) + .with_default_account(&contract.pvm_runtime) + .calldata(contract.calldata) .call(); - assert_eq!(output.flags, ReturnFlags::Success); + assert_eq!(ReturnFlags::Success, output.flags); - let expected = I256::try_from(123).unwrap(); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - assert_eq!(received, expected); + let received = U256::from_be_slice(&output.data); + assert_eq!(expected, received) } #[test] @@ -451,31 +440,6 @@ fn mcopy() { assert_eq!(expected, received); } -#[test] -fn balance() { - let (_, output) = assert_success(&Contract::value_balance_of(Default::default()), false); - - let expected = U256::ZERO; - let received = U256::from_be_slice(&output.data); - assert_eq!(expected, received); - - let expected = U256::from(54589); - let (mut state, address) = State::new_deployed(Contract::value_balance_of(Default::default())); - state.accounts_mut().get_mut(&address).unwrap().value = expected; - - let contract = Contract::value_balance_of(address); - let (_, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata) - .call(); - - assert_eq!(ReturnFlags::Success, output.flags); - - let received = U256::from_be_slice(&output.data); - assert_eq!(expected, received) -} - #[test] fn bitwise_byte() { assert_success(&Contract::bitwise_byte(U256::ZERO, U256::ZERO), true); diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index ab42ad5d..2d7f3da6 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -13,6 +13,7 @@ serde_json = { workspace = true } hex = { workspace = true, features = ["serde"] } codec = { workspace = true, default-features = false } scale-info = { workspace = true, default-features = false } +alloy-primitives = { workspace = true } polkadot-sdk.workspace = true polkadot-sdk.features = [ "experimental", diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index fde21f49..69860912 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -6,9 +6,9 @@ //! ## Example //! ```rust //! use revive_runner::*; -//! use specs::SpecsAction::*; +//! use SpecsAction::*; //! Specs { -//! differential: true, +//! differential: false, //! balances: vec![(ALICE, 1_000_000_000)], //! actions: vec![Instantiate { //! origin: TestAccountId::Alice, @@ -112,7 +112,7 @@ impl VerifyCallExpectation { assert_eq!( self.success, result.is_ok(), - "contract execution reverted: {result:?}" + "contract execution result mismatch: {result:?}" ); if let Some(gas_consumed) = self.gas_consumed { assert_eq!(gas_consumed, result.gas_consumed()); diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index 46c021db..a5f1615d 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -1,6 +1,8 @@ +use revive_differential::{Evm, EvmLog}; use serde::{Deserialize, Serialize}; use crate::*; +use alloy_primitives::Address; use revive_solidity::test_utils::*; /// An action to perform in a contract test @@ -55,7 +57,55 @@ pub enum SpecsAction { }, } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] +impl SpecsAction { + /// Derive verification actions from the EVM output log + pub fn derive_verification( + log: &EvmLog, + address_evm: Address, + account_pvm: TestAccountId, + ) -> Vec { + let account = log + .state_dump + .accounts + .get(&address_evm) + .unwrap_or_else(|| panic!("account {address_evm} not in state dump")); + + let mut actions = vec![ + Self::VerifyCall(VerifyCallExpectation { + gas_consumed: None, + success: log.output.run_success(), + output: log.output.output.clone().into(), + }), + Self::VerifyBalance { + origin: account_pvm.clone(), + expected: account + .balance + .try_into() + .expect("balance should fit into u128"), + }, + ]; + + let Some(storage) = &account.storage else { + return actions; + }; + + for (key, expected) in storage { + let mut key = key.to_vec(); + key.reverse(); + let mut expected = expected.to_vec(); + expected.reverse(); + actions.push(Self::VerifyStorage { + contract: account_pvm.clone(), + key, + expected, + }); + } + + actions + } +} + +#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)] pub enum TestAccountId { /// The ALICE account #[default] @@ -65,7 +115,7 @@ pub enum TestAccountId { /// The CHARLIE account Charlie, /// AccountID that was created during the nth call in this run. - Instantiated(u32), + Instantiated(usize), /// Arbitrary AccountID AccountId(AccountId), } @@ -78,7 +128,7 @@ impl TestAccountId { TestAccountId::Charlie => CHARLIE, TestAccountId::AccountId(account_id) => account_id.clone(), TestAccountId::Instantiated(n) => match results - .get(*n as usize) + .get(*n) .expect("should provide valid index into call results") { CallResult::Exec(_) => panic!("call #{n} should be an instantiation"), @@ -119,7 +169,7 @@ impl Default for Specs { impl Specs { /// Get the list of actions to perform /// A default [`SpecAction::VerifyCall`] is injected after each Instantiate or Call action when - /// missing + /// missing and not in differential mode pub fn actions(&self) -> Vec { self.actions .iter() @@ -129,7 +179,10 @@ impl Specs { if matches!( item, SpecsAction::Instantiate { .. } | SpecsAction::Call { .. } - ) && !matches!(next_item, Some(SpecsAction::VerifyCall(_))) + ) && matches!( + next_item, + Some(SpecsAction::Instantiate { .. }) | Some(SpecsAction::Call { .. }) + ) && !self.differential { return vec![ item.clone(), @@ -176,13 +229,16 @@ impl Specs { } fn run_on_evm(self) -> Self { - let mut specs = Self { + let mut derived_specs = Self { actions: vec![], ..self }; + let mut evm = Evm::default(); + let mut deployed_accounts = vec![]; + for action in self.actions { - specs.actions.push(action.clone()); + derived_specs.actions.push(action.clone()); use specs::SpecsAction::*; match action { @@ -204,8 +260,11 @@ impl Specs { else { panic!("the differential runner requires Code::Solidity source"); }; + assert_ne!(solc_optimizer, Some(false), "solc_optimizer must be enabled in differntial mode"); + assert_ne!(pipeline, Some(revive_solidity::SolcPipeline::EVMLA), "yul pipeline must be enabled in differntial mode"); assert!(storage_deposit_limit.is_none(), "storage deposit limit is not supported in differential mode"); assert!(salt.is_empty(), "salt is not supported in differential mode"); + assert_eq!(origin, TestAccountId::default(), "configuring the origin is not supported in differential mode"); let deploy_code = match std::fs::read_to_string(&path) { Ok(solidity_source) => compile_evm_deploy_code(&contract, &solidity_source), Err(err) => panic!( @@ -214,6 +273,25 @@ impl Specs { err ), }; + let deploy_code = hex::encode(deploy_code); + println!("CODE: {}", &deploy_code); + let mut vm = evm.code_blob(deploy_code.as_bytes().to_vec()).sender(Address::default()).deploy(true); + if !data.is_empty() { + vm = vm.input(data.into()); + } + if value > 0 { + vm = vm.value(value); + } + if let Some(gas) = gas_limit { + vm = vm.gas(gas.ref_time()); + } + let mut log = vm.run(); + log.output.output = Default::default(); // PVM will not have constructor output + let deployed_account = log.account_deployed.expect("no account was created"); + let account_pvm = TestAccountId::Instantiated(deployed_accounts.len()); + deployed_accounts.push(deployed_account); + derived_specs.actions.append(&mut SpecsAction::derive_verification(&log, deployed_account, account_pvm)); + evm = Evm::from_genesis(log.state_dump.into()); } Call { origin, @@ -223,15 +301,32 @@ impl Specs { storage_deposit_limit, data, } => { - //let TestAccountId::Instantiated(n) = dest else { - // panic!("the differential runner requires TestAccountId::Instantiated(n) as dest"); - //}; + assert_eq!(origin, TestAccountId::default(), "configuring the origin is not supported in differential mode"); + assert!(storage_deposit_limit.is_none(), "storage deposit limit is not supported in differential mode"); + let TestAccountId::Instantiated(n) = dest else { + panic!("the differential runner requires TestAccountId::Instantiated(n) as dest"); + }; + let address = deployed_accounts.get(n).unwrap_or_else(|| panic!("no account at index {n} ")); + let mut vm = evm.receiver(*address).sender(Address::default()); + if !data.is_empty() { + vm = vm.input(data.into()); + } + if value > 0 { + vm = vm.value(value); + } + if let Some(gas) = gas_limit { + vm = vm.gas(gas.ref_time()); + } + + let log = vm.run(); + derived_specs.actions.append(&mut SpecsAction::derive_verification(&log, *address, dest)); + evm = Evm::from_genesis(log.state_dump.into()); } _ => panic!("only instantiate and call action allowed in differential mode, got: {action:?}"), } } - specs + derived_specs } fn run_on_pallet(self) -> Vec { @@ -243,8 +338,6 @@ impl Specs { .execute_with(|| { use specs::SpecsAction::*; - let actions = self.actions(); - for action in self.actions() { match action { Instantiate { @@ -287,7 +380,7 @@ impl Specs { expectation.verify(results.last().expect("No call to verify")); } VerifyBalance { origin, expected } => { - let balance = Balances::free_balance(origin.to_account_id(&results)); + let balance = Balances::usable_balance(origin.to_account_id(&results)); assert_eq!(balance, expected); } VerifyStorage { @@ -304,7 +397,7 @@ impl Specs { let Some(value) = storage else { panic!("No value for storage key 0x{}", hex::encode(key)); }; - assert_eq!(value, expected); + assert_eq!(value, expected, "at key {}", hex::encode(&key)); } } } diff --git a/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs b/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs index 9ad481a9..d3cedff4 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs @@ -37,6 +37,8 @@ pub enum Flag { /// The EVM legacy assembly JSON. #[serde(rename = "evm.legacyAssembly")] EVMLA, + #[serde(rename = "evm.bytecode")] + EVMBC, #[serde(rename = "evm.deployedBytecode")] EVMDBC, } @@ -62,6 +64,7 @@ impl std::fmt::Display for Flag { Self::AST => write!(f, "ast"), Self::Yul => write!(f, "irOptimized"), Self::EVMLA => write!(f, "evm.legacyAssembly"), + Self::EVMBC => write!(f, "evm.bytecode"), Self::EVMDBC => write!(f, "evm.deployedBytecode"), } } diff --git a/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs b/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs index cb546126..df232c35 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs @@ -28,6 +28,7 @@ impl File { Self { per_file: Some(HashSet::from_iter([SelectionFlag::AST])), per_contract: Some(HashSet::from_iter([ + SelectionFlag::EVMBC, SelectionFlag::EVMDBC, SelectionFlag::MethodIdentifiers, SelectionFlag::Metadata, diff --git a/crates/solidity/src/test_utils.rs b/crates/solidity/src/test_utils.rs index b2b2833c..52d6ff91 100644 --- a/crates/solidity/src/test_utils.rs +++ b/crates/solidity/src/test_utils.rs @@ -120,21 +120,39 @@ pub fn build_solidity_with_options_evm( libraries: BTreeMap>, remappings: Option>, pipeline: SolcPipeline, - optimzer_settings: revive_llvm_context::OptimizerSettings, solc_optimizer_enabled: bool, ) -> anyhow::Result> { - let mut build_unoptimized = build_solidity_with_options( + check_dependencies(); + + inkwell::support::enable_llvm_pretty_stack_trace(); + revive_llvm_context::initialize_target(revive_llvm_context::Target::PVM); + let _ = crate::process::EXECUTABLE.set(PathBuf::from(crate::r#const::DEFAULT_EXECUTABLE_NAME)); + + let mut solc = SolcCompiler::new(SolcCompiler::DEFAULT_EXECUTABLE_NAME.to_owned())?; + let solc_version = solc.version()?; + + let input = SolcStandardJsonInput::try_from_sources( + None, sources.clone(), - libraries, + libraries.clone(), remappings, - pipeline, - optimzer_settings, - solc_optimizer_enabled, - ) - .expect("Build failure"); + SolcStandardJsonInputSettingsSelection::new_required(pipeline), + SolcStandardJsonInputSettingsOptimizer::new( + solc_optimizer_enabled, + None, + &solc_version.default, + false, + false, + ), + None, + pipeline == SolcPipeline::Yul, + None, + )?; + + let mut output = solc.standard_json(input, pipeline, None, vec![], None)?; let mut contracts = BTreeMap::new(); - if let Some(files) = build_unoptimized.contracts.as_mut() { + if let Some(files) = output.contracts.as_mut() { for (_, file) in files.iter_mut() { for (name, contract) in file.iter_mut() { if let Some(evm) = contract.evm.as_mut() { @@ -273,6 +291,8 @@ pub fn compile_evm_bin_runtime(contract_name: &str, source_code: &str) -> Vec Vec { compile_evm(contract_name, source_code, false) } @@ -296,7 +316,6 @@ fn compile_evm(contract_name: &str, source_code: &str, runtime: bool) -> Vec Default::default(), None, pipeline, - revive_llvm_context::OptimizerSettings::cycles(), solc_optimizer_enabled, ) .expect("source should compile"); From f9868a79622f4267d58ee637dc1651830348cd47 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 17:14:14 +0200 Subject: [PATCH 13/27] add evm bin-runtime blob cache Signed-off-by: xermicus --- crates/solidity/src/test_utils.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/solidity/src/test_utils.rs b/crates/solidity/src/test_utils.rs index 52d6ff91..09b873ff 100644 --- a/crates/solidity/src/test_utils.rs +++ b/crates/solidity/src/test_utils.rs @@ -21,6 +21,8 @@ use crate::warning::Warning; static PVM_BLOB_CACHE: Lazy>>> = Lazy::new(Default::default); static EVM_BLOB_CACHE: Lazy>>> = Lazy::new(Default::default); +static EVM_RUNTIME_BLOB_CACHE: Lazy>>> = + Lazy::new(Default::default); #[derive(Hash, PartialEq, Eq)] struct CachedBlob { @@ -306,7 +308,12 @@ fn compile_evm(contract_name: &str, source_code: &str, runtime: bool) -> Vec solc_optimizer_enabled, }; - if let Some(blob) = EVM_BLOB_CACHE.lock().unwrap().get(&id) { + let cache = if runtime { + &EVM_RUNTIME_BLOB_CACHE + } else { + &EVM_BLOB_CACHE + }; + if let Some(blob) = cache.lock().unwrap().get(&id) { return blob.clone(); } @@ -322,6 +329,8 @@ fn compile_evm(contract_name: &str, source_code: &str, runtime: bool) -> Vec let object = &contracts .get(contract_name) .unwrap_or_else(|| panic!("contract '{}' didn't produce bin-runtime", contract_name)); + println!("runtime: {}", object.1.object.as_str()); + println!("deploy: {}", object.0.object.as_str()); let code = if runtime { object.1.object.as_str() } else { @@ -329,7 +338,7 @@ fn compile_evm(contract_name: &str, source_code: &str, runtime: bool) -> Vec }; let blob = hex::decode(code).expect("code shold be hex encoded"); - EVM_BLOB_CACHE.lock().unwrap().insert(id, blob.clone()); + cache.lock().unwrap().insert(id, blob.clone()); blob } From 917d80c5f70fdfc6d955740a25cddac6e92a45c6 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 17:14:30 +0200 Subject: [PATCH 14/27] sha1 Signed-off-by: xermicus --- crates/integration/contracts/SHA1.sol | 25 +++++++++++++++++++++++++ crates/integration/src/tests.rs | 15 ++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/crates/integration/contracts/SHA1.sol b/crates/integration/contracts/SHA1.sol index db116e55..cac1563a 100644 --- a/crates/integration/contracts/SHA1.sol +++ b/crates/integration/contracts/SHA1.sol @@ -1,6 +1,31 @@ // SPDX-License-Identifier: BSD-2-Clause pragma solidity ^0.8.4; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "SHA1" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "1605782b00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000200ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + } + ] +} +*/ + contract SHA1 { function sha1(bytes memory data) public pure returns (bytes20 ret) { assembly { diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 5d5c93bc..40d5e1a5 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,4 +1,5 @@ use revive_runner::*; +use sha1::Digest; macro_rules! test_spec { ($test_name:ident, $contract_name:literal, $source_file:literal) => { @@ -21,6 +22,7 @@ test_spec!(erc20, "ERC20", "ERC20.sol"); test_spec!(computation, "Computation", "Computation.sol"); test_spec!(msize, "MSize", "MSize.sol"); test_spec!(transferred_value, "Value", "Value.sol"); +test_spec!(sha1, "SHA1", "SHA1.sol"); /* #[test] @@ -123,19 +125,6 @@ fn mstore8() { } } -#[test] -fn sha1() { - let pre = vec![0xffu8; 512]; - let mut hasher = sha1::Sha1::new(); - hasher.update(&pre); - let hash = hasher.finalize(); - - let (_, output) = assert_success(&Contract::sha1(pre), true); - let expected = FixedBytes::<20>::from_slice(&hash[..]); - let received = FixedBytes::<20>::from_slice(&output.data[..20]); - assert_eq!(received, expected); -} - #[test] fn block_number() { let (_, output) = assert_success(&Contract::block_number(), true); From fcf8b921e280a49250520f5623351e8b07ea46ba Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 18:03:13 +0200 Subject: [PATCH 15/27] block Signed-off-by: xermicus --- Cargo.lock | 22 +++++++-------- crates/common/src/byte_length.rs | 4 +-- crates/integration/contracts/Block.sol | 39 +++++++++++++++++++++++++- crates/integration/src/tests.rs | 18 +----------- crates/runner/src/specs.rs | 1 - crates/solidity/src/test_utils.rs | 2 -- 6 files changed, 52 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 858751ab..ca86e7b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6798,9 +6798,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.22" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", "syn 2.0.76", @@ -8487,7 +8487,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -8540,7 +8540,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "proc-macro2", "quote", @@ -8560,7 +8560,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "environmental", "parity-scale-codec", @@ -8767,7 +8767,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8799,7 +8799,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "Inflector", "expander", @@ -8888,7 +8888,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?rev=1c4141abeb4c581e503 [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" [[package]] name = "sp-storage" @@ -8905,7 +8905,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8940,7 +8940,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "parity-scale-codec", "tracing", @@ -9037,7 +9037,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#ad0de7495e0e4685408d70c755cddaa14e3b02ca" +source = "git+https://github.com/paritytech/polkadot-sdk#b3c2a25b73bb4854f26204068f0aec3e8577196c" dependencies = [ "impl-trait-for-tuples", "log", diff --git a/crates/common/src/byte_length.rs b/crates/common/src/byte_length.rs index 7af12fd1..c41f498f 100644 --- a/crates/common/src/byte_length.rs +++ b/crates/common/src/byte_length.rs @@ -25,7 +25,7 @@ pub const BYTE_LENGTH_WORD: usize = 32; pub const BYTE_LENGTH_VALUE: usize = 32; /// Byte length of the runtime block number type. -pub const BYTE_LENGTH_BLOCK_NUMBER: usize = 8; +pub const BYTE_LENGTH_BLOCK_NUMBER: usize = 4; /// Byte length of the runtime block timestamp type. -pub const BYTE_LENGTH_BLOCK_TIMESTAMP: usize = 8; +pub const BYTE_LENGTH_BLOCK_TIMESTAMP: usize = 4; diff --git a/crates/integration/contracts/Block.sol b/crates/integration/contracts/Block.sol index d4d93287..e078d483 100644 --- a/crates/integration/contracts/Block.sol +++ b/crates/integration/contracts/Block.sol @@ -2,12 +2,49 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Block" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "8381f58a" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b80777ea" + } + } + ] +} +*/ + contract Block { function timestamp() public view returns (uint ret) { ret = block.timestamp; } function number() public view returns (uint ret) { - ret = block.number; + if (block.number == 0) { + ret = 1; + } else { + ret = block.number; + } } } diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 40d5e1a5..64cbf84d 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,5 +1,4 @@ use revive_runner::*; -use sha1::Digest; macro_rules! test_spec { ($test_name:ident, $contract_name:literal, $source_file:literal) => { @@ -23,6 +22,7 @@ test_spec!(computation, "Computation", "Computation.sol"); test_spec!(msize, "MSize", "MSize.sol"); test_spec!(transferred_value, "Value", "Value.sol"); test_spec!(sha1, "SHA1", "SHA1.sol"); +test_spec!(block, "Block", "Block.sol"); /* #[test] @@ -125,22 +125,6 @@ fn mstore8() { } } -#[test] -fn block_number() { - let (_, output) = assert_success(&Contract::block_number(), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::from(mock_runtime::State::BLOCK_NUMBER); - assert_eq!(received, expected); -} - -#[test] -fn block_timestamp() { - let (_, output) = assert_success(&Contract::block_timestamp(), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::from(mock_runtime::State::BLOCK_TIMESTAMP); - assert_eq!(received, expected); -} - #[test] fn address() { let contract = Contract::context_address(); diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index a5f1615d..7c493aba 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -274,7 +274,6 @@ impl Specs { ), }; let deploy_code = hex::encode(deploy_code); - println!("CODE: {}", &deploy_code); let mut vm = evm.code_blob(deploy_code.as_bytes().to_vec()).sender(Address::default()).deploy(true); if !data.is_empty() { vm = vm.input(data.into()); diff --git a/crates/solidity/src/test_utils.rs b/crates/solidity/src/test_utils.rs index 09b873ff..63305069 100644 --- a/crates/solidity/src/test_utils.rs +++ b/crates/solidity/src/test_utils.rs @@ -329,8 +329,6 @@ fn compile_evm(contract_name: &str, source_code: &str, runtime: bool) -> Vec let object = &contracts .get(contract_name) .unwrap_or_else(|| panic!("contract '{}' didn't produce bin-runtime", contract_name)); - println!("runtime: {}", object.1.object.as_str()); - println!("deploy: {}", object.0.object.as_str()); let code = if runtime { object.1.object.as_str() } else { From 15faef2602c72f62471f33f4ea6ffc508e6979a1 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 18:10:18 +0200 Subject: [PATCH 16/27] mcopy Signed-off-by: xermicus --- crates/integration/contracts/MCopy.sol | 25 +++++++++++++++++++++++++ crates/integration/src/tests.rs | 14 +------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/crates/integration/contracts/MCopy.sol b/crates/integration/contracts/MCopy.sol index 03431fad..38ec8521 100644 --- a/crates/integration/contracts/MCopy.sol +++ b/crates/integration/contracts/MCopy.sol @@ -1,5 +1,30 @@ // SPDX-License-Identifier: MIT +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "MCopy" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "0ee188b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030102030000000000000000000000000000000000000000000000000000000000" + } + } + ] +} +*/ + pragma solidity ^0.8; contract MCopy { diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index 64cbf84d..ad9a8de7 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -23,6 +23,7 @@ test_spec!(msize, "MSize", "MSize.sol"); test_spec!(transferred_value, "Value", "Value.sol"); test_spec!(sha1, "SHA1", "SHA1.sol"); test_spec!(block, "Block", "Block.sol"); +test_spec!(mcopy, "MCopy", "MCopy.sol"); /* #[test] @@ -400,19 +401,6 @@ fn echo() { assert_eq!(expected, received); } -#[test] -fn mcopy() { - let expected = vec![1, 2, 3]; - - let (_, output) = assert_success(&Contract::memcpy(expected.clone()), false); - - let received = alloy_primitives::Bytes::abi_decode(&output.data, true) - .unwrap() - .to_vec(); - - assert_eq!(expected, received); -} - #[test] fn bitwise_byte() { assert_success(&Contract::bitwise_byte(U256::ZERO, U256::ZERO), true); From b7ff2f686120a21ef64010f1dc51846507ad3883 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 29 Aug 2024 18:25:50 +0200 Subject: [PATCH 17/27] events Signed-off-by: xermicus --- crates/integration/contracts/Events.sol | 37 +++++++++++++++++++++++++ crates/integration/contracts/MCopy.sol | 4 +-- crates/integration/src/tests.rs | 28 +++++++++++++++---- crates/runner/src/lib.rs | 24 ++++++++-------- 4 files changed, 74 insertions(+), 19 deletions(-) diff --git a/crates/integration/contracts/Events.sol b/crates/integration/contracts/Events.sol index d52064bb..c3f7dd7b 100644 --- a/crates/integration/contracts/Events.sol +++ b/crates/integration/contracts/Events.sol @@ -2,6 +2,43 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Events" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "4d43bec90000000000000000000000000000000000000000000000000000000000000000" + } + } + ] +} +*/ + +/* TODO when pallet_revive accepts Solidity event topics + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "4d43bec9000000000000000000000000000000000000000000000000000000000000007b" + } + } + +*/ + contract Events { event A() anonymous; event E(uint, uint indexed, uint indexed, uint indexed); diff --git a/crates/integration/contracts/MCopy.sol b/crates/integration/contracts/MCopy.sol index 38ec8521..4d746c73 100644 --- a/crates/integration/contracts/MCopy.sol +++ b/crates/integration/contracts/MCopy.sol @@ -1,5 +1,7 @@ // SPDX-License-Identifier: MIT +pragma solidity ^0.8; + /* runner.json { "differential": true, @@ -25,8 +27,6 @@ } */ -pragma solidity ^0.8; - contract MCopy { function memcpy(bytes memory payload) public pure returns (bytes memory) { return payload; diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index ad9a8de7..ea2f75db 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -24,9 +24,31 @@ test_spec!(transferred_value, "Value", "Value.sol"); test_spec!(sha1, "SHA1", "SHA1.sol"); test_spec!(block, "Block", "Block.sol"); test_spec!(mcopy, "MCopy", "MCopy.sol"); +test_spec!(events, "Events", "Events.sol"); +#[test] +fn foo() { + alloy_sol_types::sol!( + contract Value { + function value() public payable returns (uint); + function balance_of(address _address) public view returns (uint ret); + } + ); + + use crate::cases::Contract; + dbg!(hex::encode( + &Contract::event(alloy_primitives::U256::ZERO).calldata + )); + dbg!(hex::encode( + &Contract::event(alloy_primitives::U256::from(123)).calldata + )); +} /* #[test] +fn events() { + assert_success(&Contract::event(U256::ZERO), true); + assert_success(&Contract::event(U256::from(123)), true); +}#[test] fn balance() { // TODO: We do not have the correct balance API in the pallet yet let (_, output) = assert_success(&Contract::value_balance_of(Default::default()), false); @@ -263,12 +285,6 @@ fn signed_remainder() { } } -#[test] -fn events() { - assert_success(&Contract::event(U256::ZERO), true); - assert_success(&Contract::event(U256::from(123)), true); -} - #[test] fn create2() { let mut state = State::default(); diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 69860912..9a7c7099 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -226,19 +226,21 @@ pub fn specs_from_comment(contract_name: &str, path: &str) -> Vec { is_reading = true; continue; } - if line.starts_with(SPEC_MARKER_END) { - match serde_json::from_str::(&json_string) { - Ok(mut spec) => { - spec.replace_empty_code(contract_name, path); - specs.push(spec); + + if is_reading { + if line.starts_with(SPEC_MARKER_END) { + match serde_json::from_str::(&json_string) { + Ok(mut spec) => { + spec.replace_empty_code(contract_name, path); + specs.push(spec); + } + Err(e) => panic!("invalid spec JSON: {e}"), } - Err(e) => panic!("invalid spec JSON: {e}"), + is_reading = false; + json_string.clear(); + continue; } - is_reading = false; - json_string.clear(); - continue; - } - if is_reading { + json_string.push_str(line) } } From bc6862a6dccd3331c31e00cdd3cc8af9dda5bd83 Mon Sep 17 00:00:00 2001 From: xermicus Date: Fri, 30 Aug 2024 17:47:05 +0200 Subject: [PATCH 18/27] wip split up import and export modules Signed-off-by: xermicus --- Cargo.lock | 18 ++++---- Cargo.toml | 2 +- README.md | 2 +- crates/integration/codesize.json | 16 +++---- crates/integration/contracts/Storage.sol | 25 +++++++++++ crates/integration/src/tests.rs | 39 +++++------------- crates/llvm-context/Cargo.toml | 2 +- .../src/polkavm/const/runtime_api.rs | 2 +- .../llvm-context/src/polkavm/context/mod.rs | 39 ++++++++++++------ crates/llvm-context/src/polkavm/evm/call.rs | 4 +- crates/llvm-context/src/polkavm/evm/create.rs | 4 +- crates/pallet-contracts-pvm-llapi/src/lib.rs | 2 - crates/runner/Cargo.toml | 4 +- .../Cargo.toml | 6 +-- .../README.md | 0 .../build.rs | 33 ++++++++++----- crates/runtime-api/polkavm_exports.bc | Bin 0 -> 7132 bytes crates/runtime-api/polkavm_imports.bc | Bin 0 -> 27616 bytes .../src/calling_convention.rs | 16 +++++++ crates/runtime-api/src/lib.rs | 11 +++++ crates/runtime-api/src/polkavm_exports.c | 7 ++++ crates/runtime-api/src/polkavm_exports.rs | 29 +++++++++++++ .../src/polkavm_guest.h | 0 .../src/polkavm_imports.c} | 10 +---- .../src/polkavm_imports.rs} | 33 +++------------ 25 files changed, 185 insertions(+), 119 deletions(-) delete mode 100644 crates/pallet-contracts-pvm-llapi/src/lib.rs rename crates/{pallet-contracts-pvm-llapi => runtime-api}/Cargo.toml (65%) rename crates/{pallet-contracts-pvm-llapi => runtime-api}/README.md (100%) rename crates/{pallet-contracts-pvm-llapi => runtime-api}/build.rs (63%) create mode 100644 crates/runtime-api/polkavm_exports.bc create mode 100644 crates/runtime-api/polkavm_imports.bc rename crates/{pallet-contracts-pvm-llapi => runtime-api}/src/calling_convention.rs (89%) create mode 100644 crates/runtime-api/src/lib.rs create mode 100644 crates/runtime-api/src/polkavm_exports.c create mode 100644 crates/runtime-api/src/polkavm_exports.rs rename crates/{pallet-contracts-pvm-llapi => runtime-api}/src/polkavm_guest.h (100%) rename crates/{pallet-contracts-pvm-llapi/src/polkavm_guest.c => runtime-api/src/polkavm_imports.c} (95%) rename crates/{pallet-contracts-pvm-llapi/src/polkavm_guest.rs => runtime-api/src/polkavm_imports.rs} (50%) diff --git a/Cargo.lock b/Cargo.lock index ca86e7b0..139326f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4591,14 +4591,6 @@ dependencies = [ "syn 2.0.76", ] -[[package]] -name = "pallet-contracts-pvm-llapi" -version = "0.1.0" -dependencies = [ - "anyhow", - "inkwell", -] - [[package]] name = "pallet-contracts-uapi" version = "5.0.0" @@ -7188,13 +7180,13 @@ dependencies = [ "md5", "num", "once_cell", - "pallet-contracts-pvm-llapi", "polkavm-common 0.10.0", "polkavm-disassembler", "regex", "revive-builtins", "revive-common", "revive-linker", + "revive-runtime-api", "revive-stdlib", "semver 1.0.23", "serde", @@ -7217,6 +7209,14 @@ dependencies = [ "serde_json", ] +[[package]] +name = "revive-runtime-api" +version = "0.1.0" +dependencies = [ + "anyhow", + "inkwell", +] + [[package]] name = "revive-solidity" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index f7bc9cc5..f18fa472 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ revive-integration = { version = "0.1.0", path = "crates/integration" } revive-linker = { version = "0.1.0", path = "crates/linker" } lld-sys = { version = "0.1.0", path = "crates/lld-sys" } revive-llvm-context = { version = "0.1.0", path = "crates/llvm-context" } -pallet-contracts-pvm-llapi = { version = "0.1.0", path = "crates/pallet-contracts-pvm-llapi" } +revive-runtime-api = { version = "0.1.0", path = "crates/runtime-api" } revive-runner = { version = "0.1.0", path = "crates/runner" } revive-solidity = { version = "0.1.0", path = "crates/solidity" } revive-stdlib = { version = "0.1.0", path = "crates/stdlib" } diff --git a/README.md b/README.md index 7e70fd63..95c1fef8 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,4 @@ Please consult the [Makefile](Makefile) targets to learn how to run tests and be Ensure that your branch passes `make test` locally when submitting a pull request. ## Design overview -`revive` uses [solc](https://github.com/ethereum/solidity/), the Ethereum Solidity compiler, as the [Solidity frontend](crates/solidity/src/lib.rs) to process smart contracts written in Solidity. The YUL IR code (or legacy EVM assembly as a fallback for older `solc` versions) emitted by `solc` is then translated to LLVM IR, targetting a runtime similar to [Polkadots `contracts` pallet](https://docs.rs/pallet-contracts/latest/pallet_contracts/api_doc/trait.Current.html). +`revive` uses [solc](https://github.com/ethereum/solidity/), the Ethereum Solidity compiler, as the [Solidity frontend](crates/solidity/src/lib.rs) to process smart contracts written in Solidity. The YUL IR code (or legacy EVM assembly as a fallback for older `solc` versions) emitted by `solc` is then translated to LLVM IR, targetting [Polkadots `revive` pallet](https://docs.rs/pallet-revive/latest/pallet_revive/trait.SyscallDoc.html). diff --git a/crates/integration/codesize.json b/crates/integration/codesize.json index 26b0d3ea..ab9370ec 100644 --- a/crates/integration/codesize.json +++ b/crates/integration/codesize.json @@ -1,10 +1,10 @@ { - "Baseline": 934, - "Computation": 4360, - "DivisionArithmetics": 39824, - "ERC20": 47040, - "Events": 1749, - "FibonacciIterative": 2973, - "Flipper": 3626, - "SHA1": 32541 + "Baseline": 891, + "Computation": 4318, + "DivisionArithmetics": 39782, + "ERC20": 47007, + "Events": 1706, + "FibonacciIterative": 2930, + "Flipper": 3584, + "SHA1": 32499 } \ No newline at end of file diff --git a/crates/integration/contracts/Storage.sol b/crates/integration/contracts/Storage.sol index b0c474bb..b1ef75b2 100644 --- a/crates/integration/contracts/Storage.sol +++ b/crates/integration/contracts/Storage.sol @@ -2,6 +2,31 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Storage" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fabc9efaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + } + ] +} +*/ + contract Storage { function transient(uint value) public returns (uint ret) { assembly { diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index ea2f75db..db272379 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -25,25 +25,21 @@ test_spec!(sha1, "SHA1", "SHA1.sol"); test_spec!(block, "Block", "Block.sol"); test_spec!(mcopy, "MCopy", "MCopy.sol"); test_spec!(events, "Events", "Events.sol"); +test_spec!(storage, "Storage", "Storage.sol"); +/* #[test] -fn foo() { - alloy_sol_types::sol!( - contract Value { - function value() public payable returns (uint); - function balance_of(address _address) public view returns (uint ret); - } - ); +fn transient_storage() { + let expected = U256::MAX; + let (state, output) = assert_success(&Contract::storage_transient(expected), false); + let received = U256::abi_decode(&output.data, true).unwrap(); + assert_eq!(expected, received); - use crate::cases::Contract; - dbg!(hex::encode( - &Contract::event(alloy_primitives::U256::ZERO).calldata - )); - dbg!(hex::encode( - &Contract::event(alloy_primitives::U256::from(123)).calldata - )); + assert!(state + .accounts() + .values() + .all(|account| account.storage.is_empty())); } -/* #[test] fn events() { assert_success(&Contract::event(U256::ZERO), true); @@ -438,17 +434,4 @@ fn bitwise_byte() { assert_eq!(expected, received) } } - -#[test] -fn transient_storage() { - let expected = U256::MAX; - let (state, output) = assert_success(&Contract::storage_transient(expected), false); - let received = U256::abi_decode(&output.data, true).unwrap(); - assert_eq!(expected, received); - - assert!(state - .accounts() - .values() - .all(|account| account.storage.is_empty())); -} */ diff --git a/crates/llvm-context/Cargo.toml b/crates/llvm-context/Cargo.toml index 8dc66b99..715e3363 100644 --- a/crates/llvm-context/Cargo.toml +++ b/crates/llvm-context/Cargo.toml @@ -34,7 +34,7 @@ polkavm-disassembler = { workspace = true } polkavm-common = { workspace = true } revive-common = { workspace = true } -pallet-contracts-pvm-llapi = { workspace = true } +revive-runtime-api = { workspace = true } revive-linker = { workspace = true } revive-builtins = { workspace = true } revive-stdlib = { workspace = true } diff --git a/crates/llvm-context/src/polkavm/const/runtime_api.rs b/crates/llvm-context/src/polkavm/const/runtime_api.rs index 01b65acc..39290048 100644 --- a/crates/llvm-context/src/polkavm/const/runtime_api.rs +++ b/crates/llvm-context/src/polkavm/const/runtime_api.rs @@ -19,7 +19,7 @@ pub mod imports { pub static BLOCK_NUMBER: &str = "block_number"; - pub static CALL: &str = "seal_call"; + pub static CALL: &str = "call"; pub static CALLER: &str = "caller"; diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 4e98ec62..b5f88e4f 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -124,17 +124,36 @@ where .expect("the stdlib module should be linkable"); } - /// Link in the PolkaVM guest module, containing imported and exported functions, + /// Link in the PolkaVM imports module, containing imported functions, /// and marking them as external (they need to be relocatable as too). - fn link_polkavm_guest_module( + fn link_polkavm_imports( llvm: &'ctx inkwell::context::Context, module: &inkwell::module::Module<'ctx>, ) { module .link_in_module( - pallet_contracts_pvm_llapi::polkavm_guest::module(llvm, "polkavm_guest").unwrap(), + revive_runtime_api::polkavm_imports::module(llvm, "polkavm_imports").unwrap(), ) - .expect("the PolkaVM guest API module should be linkable"); + .expect("the PolkaVM imports module should be linkable"); + + for import in runtime_api::imports::IMPORTS { + module + .get_function(import) + .expect("should be declared") + .set_linkage(inkwell::module::Linkage::External); + } + } + + /// Link in the PolkaVM exports module, containing exported functions. + fn link_polkavm_exports( + llvm: &'ctx inkwell::context::Context, + module: &inkwell::module::Module<'ctx>, + ) { + module + .link_in_module( + revive_runtime_api::polkavm_exports::module(llvm, "polkavm_exports").unwrap(), + ) + .expect("the PolkaVM exports module should be linkable"); for export in runtime_api::exports::EXPORTS { module @@ -145,13 +164,6 @@ where llvm.create_enum_attribute(Attribute::NoReturn as u32, 0), ); } - - for import in runtime_api::imports::IMPORTS { - module - .get_function(import) - .expect("should be declared") - .set_linkage(inkwell::module::Linkage::External); - } } /// Configure the PolkaVM minimum stack size. @@ -161,7 +173,7 @@ where size: u32, ) { module - .link_in_module(pallet_contracts_pvm_llapi::polkavm_guest::min_stack_size( + .link_in_module(revive_runtime_api::calling_convention::min_stack_size( llvm, "polkavm_stack_size", size, @@ -191,7 +203,8 @@ where debug_config: Option, ) -> Self { Self::link_stdlib_module(llvm, &module); - Self::link_polkavm_guest_module(llvm, &module); + Self::link_polkavm_imports(llvm, &module); + Self::link_polkavm_exports(llvm, &module); Self::set_polkavm_stack_size(llvm, &module, Self::POLKAVM_STACK_SIZE); Self::set_module_flags(llvm, &module); diff --git a/crates/llvm-context/src/polkavm/evm/call.rs b/crates/llvm-context/src/polkavm/evm/call.rs index 12154006..804291f0 100644 --- a/crates/llvm-context/src/polkavm/evm/call.rs +++ b/crates/llvm-context/src/polkavm/evm/call.rs @@ -57,9 +57,9 @@ where let output_length_pointer = context.get_global(crate::polkavm::GLOBAL_RETURN_DATA_SIZE)?; context.build_store(output_length_pointer.into(), output_length)?; - let argument_pointer = pallet_contracts_pvm_llapi::calling_convention::Spill::new( + let argument_pointer = revive_runtime_api::calling_convention::Spill::new( context.builder(), - pallet_contracts_pvm_llapi::calling_convention::call(context.llvm()), + revive_runtime_api::calling_convention::call(context.llvm()), "call_arguments", )? .next(context.xlen_type().const_int(flags as u64, false))? diff --git a/crates/llvm-context/src/polkavm/evm/create.rs b/crates/llvm-context/src/polkavm/evm/create.rs index ecb19672..a60ed8db 100644 --- a/crates/llvm-context/src/polkavm/evm/create.rs +++ b/crates/llvm-context/src/polkavm/evm/create.rs @@ -58,9 +58,9 @@ where context.build_stack_parameter(revive_common::BIT_LENGTH_ETH_ADDRESS, "address_pointer"); context.build_store(address_pointer, context.word_const(0))?; - let argument_pointer = pallet_contracts_pvm_llapi::calling_convention::Spill::new( + let argument_pointer = revive_runtime_api::calling_convention::Spill::new( context.builder(), - pallet_contracts_pvm_llapi::calling_convention::instantiate(context.llvm()), + revive_runtime_api::calling_convention::instantiate(context.llvm()), "create2_arguments", )? .next(code_hash_pointer.value)? diff --git a/crates/pallet-contracts-pvm-llapi/src/lib.rs b/crates/pallet-contracts-pvm-llapi/src/lib.rs deleted file mode 100644 index 34648d58..00000000 --- a/crates/pallet-contracts-pvm-llapi/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod calling_convention; -pub mod polkavm_guest; diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index 2d7f3da6..6008e2d3 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -4,8 +4,8 @@ version.workspace = true license.workspace = true edition.workspace = true repository.workspace = true -repository.authors = true -descritption = "Execute revive contracts in a simulated blockchain runtime" +authors.workspace = true +description = "Execute revive contracts in a simulated blockchain runtime" [dependencies] serde = { workspace = true } diff --git a/crates/pallet-contracts-pvm-llapi/Cargo.toml b/crates/runtime-api/Cargo.toml similarity index 65% rename from crates/pallet-contracts-pvm-llapi/Cargo.toml rename to crates/runtime-api/Cargo.toml index 16308453..32bff3a3 100644 --- a/crates/pallet-contracts-pvm-llapi/Cargo.toml +++ b/crates/runtime-api/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "pallet-contracts-pvm-llapi" +name = "revive-runtime-api" version.workspace = true license.workspace = true edition.workspace = true repository.workspace = true -repository.authors = true -descritption = "Implements the low level runtime API bindings with pallet contracts" +authors.workspace = true +description = "Implements the low level runtime API bindings with pallet contracts" [features] riscv-64 = [] diff --git a/crates/pallet-contracts-pvm-llapi/README.md b/crates/runtime-api/README.md similarity index 100% rename from crates/pallet-contracts-pvm-llapi/README.md rename to crates/runtime-api/README.md diff --git a/crates/pallet-contracts-pvm-llapi/build.rs b/crates/runtime-api/build.rs similarity index 63% rename from crates/pallet-contracts-pvm-llapi/build.rs rename to crates/runtime-api/build.rs index 6a17ac7a..6559e579 100644 --- a/crates/pallet-contracts-pvm-llapi/build.rs +++ b/crates/runtime-api/build.rs @@ -20,7 +20,15 @@ const TARGET_ABI_FLAG: &str = "-mabi=ilp32e"; #[cfg(feature = "riscv-64")] const TARGET_ABI_FLAG: &str = "-mabi=lp64e"; -fn compile(bitcode_path: &str) { +const IMPORTS_SOUCE: &str = "src/polkavm_imports.c"; +const IMPORTS_BC: &str = "polkavm_imports.bc"; +const IMPORTS_RUST: &str = "polkavm_imports.rs"; + +const EXPORTS_SOUCE: &str = "src/polkavm_exports.c"; +const EXPORTS_BC: &str = "polkavm_exports.bc"; +const EXPORTS_RUST: &str = "polkavm_exports.rs"; + +fn compile(source_path: &str, bitcode_path: &str) { let output = Command::new("clang") .args([ TARGET_FLAG, @@ -35,9 +43,9 @@ fn compile(bitcode_path: &str) { "-O3", "-emit-llvm", "-c", - "src/polkavm_guest.c", "-o", bitcode_path, + source_path, ]) .output() .expect("should be able to invoke C clang"); @@ -49,19 +57,24 @@ fn compile(bitcode_path: &str) { ); } -fn main() { +fn build_module(source_path: &str, bitcode_path: &str, rust_file: &str) { let out_dir = env::var_os("OUT_DIR").expect("env should have $OUT_DIR"); - let lib = "polkavm_guest.bc"; - let bitcode_path = Path::new(&out_dir).join(lib); - compile(bitcode_path.to_str().expect("$OUT_DIR should be UTF-8")); + let lib = Path::new(&out_dir).join(bitcode_path); + compile(source_path, lib.to_str().expect("$OUT_DIR should be UTF-8")); - let bitcode = fs::read(bitcode_path).expect("bitcode should have been built"); + let bitcode = fs::read(lib).expect("bitcode should have been built"); let len = bitcode.len(); - let src_path = Path::new(&out_dir).join("polkavm_guest.rs"); - let src = format!("pub static BITCODE: &[u8; {len}] = include_bytes!(\"{lib}\");"); + let src_path = Path::new(&out_dir).join(rust_file); + let src = format!("pub static BITCODE: &[u8; {len}] = include_bytes!(\"{bitcode_path}\");"); fs::write(src_path, src).expect("should be able to write in $OUT_DIR"); +} + +fn main() { + build_module(IMPORTS_SOUCE, IMPORTS_BC, IMPORTS_RUST); + build_module(EXPORTS_SOUCE, EXPORTS_BC, EXPORTS_RUST); println!("cargo:rerun-if-changed=build.rs"); - println!("cargo:rerun-if-changed=src/polkavm_guest.c"); + println!("cargo:rerun-if-changed=src/polkavm_imports.c"); + println!("cargo:rerun-if-changed=src/polkavm_exports.c"); println!("cargo:rerun-if-changed=src/polkavm_guest.h"); } diff --git a/crates/runtime-api/polkavm_exports.bc b/crates/runtime-api/polkavm_exports.bc new file mode 100644 index 0000000000000000000000000000000000000000..844092be01d973be6ff2439711e53be8b6dbdc06 GIT binary patch literal 7132 zcmdTpeNY=$es2+IWgFhg4!*##yR3}s<2p88gFnE6o`md_T%D=xxE=SdSG0T?V!%Rt zJ2w{z;S=ZL8`(oz=IYK!soP2K(hf=KjN5uT65=>Yltkyrag4*b5+4dAvMpok`h02A z-`my7q$$b$TMfJWd%yR4zxVroA5>cccMjzul!Xwg%NBQk^N;?u>78Hy<9pjqI!{o5 zGh`!V(IT`h!+>hHJJTdS-N~a^H1xX`r{eZSGQFU>PvIW zb$P$HwX}Mu#y)8%I<~_ztT$iHXqeW$nJZYH8xsDFDy<$ogT32#9rOAJUdzZ2(QohE zQazmg0|6lr2kmOg)W20dux0xxcwOn3u-0tdvgg=TR(16r-B*89WQywo(UO)+#nRe~ zXHPnR`N<1)8CqM$*!EreD_K|QD;Z*jb>Jt#oXn9Jit9`iI+=&idm4lanh)y!`_oT9 zeFfnFbv?-4@#jqX`CBe-#lX!=JenYw6*E6U@ln9U*xNpC!o^1@AKm}D$AO0WeI9$B zr@L9x=k@gZJdQm2LLc4Vtm$~2?i4)^ujlZnrz--KNhGWo*rgadjC_QW=&_Y$L{l7@Om7hv@IuY!jlGW#g#MbW9Mu+w*fHm zGcIm|DxCA>Ot^A@Cjip`_}C=H&zSjJer_fRim-G3oOJ^`Wnkl*^-ApR7#H2FH^@!~ z+1sH0W&{RqD#(J-HszoYNc^S(7`QJIz{SU79B4N~6-NE+5)k{@c^5z7;%=J?6JIJ` zkPn;LaE!kVrtsy2K?_8<-2%Wykhf%f9Lz=Ww<#XF;u1e$07nyo1SlRPa}j)ypEt14 z7;yyYqWDR_3#Z*e@l89_Fo}2NL zxdDUH_ zDsmylDU>S|H)CL@%`DL!6{ee$pKTI9rhDb!Ap%2Q_+cPB6@ySA5tZ0T1|j4pQ8X<_ zY?_!zwUG?G;OB0+*yQJsQSg*mwwO9m+)y~L*iFSGTGzZrlYtteMCm4X>LK- zII$u&z>_f!Y6Y-WU=lwnysp9^GdPQQT<)4Oa3n_**u_C!$cEw|c)(DKBESt2a7iV* z6O@BW9uk**v<^%lNhNm1kQz?pbn);vr;L(SSfTg{KOgtYW-)LPNIxB{=U0n)KW2RDF|DRt^j2p(y#0BnjJ5jm^Kk7txTX|#BCgLS6&a5 zkGm@8LhLkU0&dfxiV;oKxT|8sQXa8XOUwGa(+p59>*aYTc7Htgi9YjtPugd%hr4=XaDkXHu?jv{*BSPjPut=OpeClK# z+Mp?0Sb=T$p1>>y2*bxV{J^FRVd9{ytm&eNALy9}>9KmEDIk}U8yKp{2T80@t~>Fv z9xn;9?oKA%T#)&so5YXlUO9M(z>pVK$PT=i1n&@sKH5kIA!H>{v?NDtnwUtnkxW*9 z)r22^4w(c`39`l1i5_~Hdy3su%p()NZ<1+jj1v6dFGZgFNDe3iOceJq3-T<`{8%7%CO{e^s{;T3sE+^MD>bU`R8(>b5gugJ($dit1Ek!Yld4e&w|L#+V8 z6qsbF3O`X{kQtmsqFwG<^g@|b;Q)rbAR0jmix`ZiC<5Fd0oPQr`%yWl}Tltjt5JN&^Wf_kOIrqcVPsgcFeg0EH3&X9}ap@Uh~} zF$}CozW5lxCHr*cl{=^l~p+tBMkbeA&~NI>kc(miQnk#^YWo(;WZc~WQT zLUh0FX|o&BEj`dicWr>Xt#s!G%04~a4}4Io@O`oz7orx8IWv&oDr}|7HRyRbL&Fgo zJu_gd7Ea`8UnB5gIL`Lx(Jzl`Dw^FF?4EABr}qZk`&rmwqdVsUuUZPm-Ta89AmHZ1 zE_Njd=Z=EwZY}~FHi{c}838#S+zanFhUO7}$HmPW;Ml}{4~_`r@CQc?enL7P!U-F5 zH>!nVwhon2Pu|~Tblb0*zdxM2W!J&#(QAL$`K!lSul&O=rI&yG?WxeeJD$uRx?`q( zA(UJ6ATvVx(+DMeKR&1T8FVs2_uB~dSX)hc%Sa|d@Q2J&aHW;E?O?4fHECICUiRBo#BTwb%@-m zkY9!`WA|ZQ?(dW$G@U_lfGOoibMv>K@D6X;^Se`-mPt~z9ESbz*5Z1u{s0#L6;lAN6JN>ebTyNOz^aZ=7r_W;-Jo(}6IN^oW zm1&2Jfjy2Dm+2?DJFwd|z#*7#5`SR4=_VVuaZM#`+y*tqa5A^YM!(!lA8GbD;O!)L zBz7C!Q%v_f&H}c*PEW1Q(~$=^C7%9K*WPY^9%9y@ut5!mU5@};3|uA@%l8Cu?_wZlqxmRY_HZ9jd{f@Z@-fTNYi?uMx;v$a z&C}aQ_l=%BvF;@ss51T~enw*9&It}u-=laUuz^cT+S3=^<>8QV%u)pg`DCJU$zmLW zW@z}QTR~G#FUX^#FBH>`QP&^CqLB#TWh;It76sv;ycBzOF2=#Bx2Y!IIOeVzcNYwX z%78$m8bV$Z?_N!-A}4F`B|#ZcHJ{H5`xrRs(TcGDH%GdIEepzH;Zv&PeF z_vF9*A-)g0xhP&WF{?h9B}8dDU#CHr+EEAb!O=6+Or-^#2LR(Lt8jSEZ+wmjmZ$=&bubbzPwXoUI&gr0}I zaPT#PWhgs;i=(tgC~^&7x$^U4K7DaR<$==bA9@Xc)hD!5m+E$3c4LHk>zgGRYAu zvqDd!qqF6FyKtbq< zDU{V6sykGFpt1g-R3=s&lIp~Y!wn5b%EiX=gAGTdy7B`}WerD~n!b)uk#6GPfUvhn zH&8YpSj)0&ykSw85G~fQSUgx38q0e-J7_3!ZJ8Om{LbIM^VfGTzwyJr3;%R@U!t`= zw@$kDwVj6#|I6V&KloPZk$*m!0rm55p@!@OTW#CwD2CjmFPyQDLOc*xRzyMradt|% zQVo)@QDXip2jRT(p%qezSt1F=d0;Sv-wz0U(tO5*&C{Tdw3DC2c^)krAg z925-}4$bod+)R-73Rw~06wXd7!6^kPh8z~bzfQbuNC}dx_sSt8<{3%x9P~g`ba*E7Z+;|*vze}c+M~-pY_`3XbMfHGSF=!&c1k~B8_Tr$y32_UfgzgVDUPjw7;!IIeQ5+_(=j;u>Qa3{M=s%;s=?o*dE=9BWByp|D|)`Y|QjU`Wirg zvfOXmDxr*~pdQT(7|;$tz^_A4_B*9mziTjSdRw1$TE;iR|3tuaXoqIxG2u=2MBjyH zKRhSkA#rmC9`YmKE%1ndBy>N4rvRQQcy^{9_@F*ADD@-sD4d66TXB8`9F{PRq+YH5k4eN2pz#A$o(~d zb?`tK%Ka+-Ftmv&)vwG4Y^VMRfAaePp6xQEyuJ+o1juqy^xpw~#{mXke2w^`9!hF$ z?eR0#-#>M__J!l8&Bx5A%?*wA*7N>hk zw%W!%`*}xKZ9{ikTfaz{|6d&klnGKb`!}t`@}f{yy05$aT>JUn_Vl;0wW-rlzyGrn db(YkZsF*fbUm9T9C^;cZue=o<)GpaN{{zs7+Q$F@ literal 0 HcmV?d00001 diff --git a/crates/runtime-api/polkavm_imports.bc b/crates/runtime-api/polkavm_imports.bc new file mode 100644 index 0000000000000000000000000000000000000000..188d5f1285bc94a5e6b163711e58ab9712532297 GIT binary patch literal 27616 zcmeHveRNY**8WM8CV{4DfQl_m(gX@dESR=XQrcqD@KF)9AkLH*XPWejR{D{)p|l{F zG=&7H5U?^;8K>3yPIYvqC~9YhnP1XWthHiAhN%pL0ZT2c4)QAUqO$b2_r3RoCJZyo zyB03~FpFmI`<#9EdCorjoO^H1xnvnVC+9{J5>5!omuM4~uKIKF``^CtLBw*~G9F-R z2_gL32#E+&lQ1~G9sWf2X}b-*f_sIs=OzAM|(qn@^KqO(b6*b`RRE8ZWiGA?$h-sL6dH|9#+6Q(V6w>3N;7V8teciXu9 zCdoDxA+w;4sl@`>YgrB3Cai$3-BsN=+2hB}SbQivD}RRgm~B|>P7Bj^-S^DYr7c&E zu8Q{0ef-H58?S|w2^xsNFh%gLY{=-IXqYdEolt0WhZ|-J>SYO8?s0~Rf^icH7rCPi zd&w3;3>pC;Srdp^&?;$BMTboiw8b>2#0@z@gKVi<+@Oj!$of!v~R z8fR6jbG_S{DsyhoifS~X`VvQdwrG<^M50K8vfH3M+$JAsi#)_rp5y79)fQ*9+i8t) zrn*HNTli^2yg@9g2fWpps&!V2MH@Oq^%`eAIcAa$>E%c4%0W|PpFQ$es{)jvHu<1h ze!(7jTqPfDjXVU34V6A#yuVF8q*fenlb^6FyY0}Z_-?bj+pN4^>7h2oN#1o!`wjB` zHU%{QdZ!;T%ljc{*Z0603}2tXk$*{G#H>6Ct!tHE;3@kIN-*y8Dn``u!M4bYUgf`~ zH|mx5c;)BY6y4y&gCQEgpkZ@{0aP=%NeSWdw<-KkWKs^R^-FzVQfa(>O6)ds~a%F7eNQk&{=AFiWzFTst=l# zn2q{)7{Z4P%3-!4a25K`OG21a|F(^b9}G~cBNk} zKWA3LoQ9|H6fgjpKylwE82lKd6IEDCKyV1_EN+uxJRJR)QF5o!%+U{J2*P>7eu)(>jehKR@n(LDy*jpK%9xX`nRo7kG?my~go` z%tk&mYC)q<*XYZ*UTKpt{UHCkr7aF!i!mLVf4$S&eP94VyRHY;p#S;=+W#ei0bj;J zY-XCDpV92d0OMvy`hZc_X^b0jWd2)vgN`(pBkhDSy%C()F+{ECZ9XXd02=2b?#+O3 zd5q~EM(;Q3+QB~^sPuF5`Uk&sa9|(@#(xikR+04?yDp#rvTX`AFFB%V=?ALfQoM7Dsxo45Y^hJzWX$L>UbXLGL4Ml7F%CJrzaSLkXFyN& zjy>0xG2}>Rjd6Yxwg~%c1a;j( zBMw_m=QAW(+<_5B95_Q~8R;oLUAu!}%M^9`GB6wM3t$L0IWqd$hM|>~c5-94T^+H29!j4SP$5=9xl6?Vl7MFFP zv&}>$;33dt@Zie`c;K23ATvP$|4yUaW0!Ne!5sGTlx#i^^3!|lihiE*YN<#6YT&xvOFalLXBZ|79tZRnJ|51zt2a(GA?X;Tih$%lEljx;yFDqFO{ zj7wpzy0f(TETz3 z|BR(ZRNF;$C}O$~JphdoinlneB_ixokF#DY+6ZYA(6u7?0jJ7@4j$J=%EutD| zEVk5H72~XPIj`EgSWr}5H^w0cI_v6KOVI{B{+?4UW7_Ts9Ez&2-oPQ#kAXubd9YD1 zE;LSy%2`z>TCc(m-8l9vNFfbo5p?2MW28FP44dz?szi^4f}%R;DR>fQLYn!Gp6t;DKvCy2Z%~ z+G29*Z2UAXH<&{=KZElus&(x?_HaBkiiCD8uE*06!#Ewv@QLg;OH;GS_7r-}2+7 z`8t<%?T?q{A1}>6UYhwoUYdWrH2-*M-qb0oz1f#$2@fvK&)-Q_4C-}4{rEW7XLyko z>5uF6Jc|(4+wX<7YZ=H%+x0Q7{4BHBw|tpK!c%V_m-YOzn8{mO^oiq_FVjxmqG>74 z+OJvYT_&4c)Q!rV!;Pk=Wf_wiMYum;QYt*?)x!f3w5Y_f!2-8W&h=fQ^}%|zNmMiF zdCC}fz@cn5#(5mD#3&zuAG8f|?f8p|5`GgnU{43|fHx7oUvZrvurR7Prk0PkDK^7m zA1*z^VwSSoyvQdVHAVfyFZ@T26n-inf?vpG(xp-2345}(Hbsw{Iwz}T-%o13z8wDe z>wh(G{Px)j-zU}IoS1vkz&oZI@yTEV0DJ_K2}#%Nh-=&&)4%{WPZ%+Yri(sNT?w-3 z$dx$^;%#a%VLg^)@Y0fb;=7UrxbcDzdpPk(&nJ0pnFS5Ksh=LJ)$J!tR* zQ~GL>(BTfQu52Vu@XMg;9$qr2x)5C5PreYg-4RsXs}H4$?+L1IdwZvW><9{Y#-hlE z+@J_F+@*~XycSel`0A6Y=C{YTPV>L#gxRRTB*928J^L>v=HV_odl`q@9s`emP z9ag@>kQ2=6&Yub$p2I!nD`D&WOU<-CNJEqVfyFJL&VXew# zn7xM(8>9xCEw7qQ(Y{9#AY0%cn|RxO9Dt3R0j~7#*Zdx zn+1N)WN;OyQE0E5XDzOLpdy zCxVD2#LD|+Q-X;7Bw5#Dm=i?o-9n4XR}w_5?_Gbk@JJA`@V#EM|CP{CiYmY{IENi*y0pjt6^>sv6qT13w@6U5!?PgMC@1)u`SPf z+a#|B6PxGY$37BFtX{Ze&cR?}mn1t&Y{A4X#>zjG#RWy|Qi`tKkQzj6TM0z0EQr|B z4}sY6AY$P!c#|UE2qw1J@o8+?7-D3@%}p5%Jm zeGfYp@oioffjT;E>W6FvO03OimM%hJzSlZ@kI-i083!5JT)-1;3kbQ*$gB zVt+X)d|yNylm!x-c{Flz6xoU`#1BL4^|%BRA;uuHlaWoK{7=UvDv1P=l=(3HkI&2Q zCPc{RFvi=ZxP(x%@8*>xlbG?G71PZ97P5^;BoQ3Oc&pP{dI;Hyn+5U1czaYXk0lZc zF=nTACB31QZkDS;&6cIH7Gd2%y z*IOA|klC6@#GC`$(?OS^{*G)1>XPx}?ZP=DM-4}(PEbr_^;JU+QpNb~46eTT`~(G* zf5>-86%&^>pshXHAyrOf%XcSyDpg{63Y25n!h$G9u4IqZg=~3}mCxX39Uv$6F}^=+ zX3Ny=(%jKbpy(>Xbp zlZ!x39KQw6UH))_47sTbhZwGEYa_I&uMx|twg^7Jva`(z6BJY5)IZ~Vreko?RNI+d zu5H_=Bp=%b;u+X+>aEw#Pkq_8W$Jf#hD~`%^}H(v&Hg*@nSEld>t~YuZ(e+N8*!)# z*^<4}1*TQvkBe24yUC2xx7&)^ z@^5e7J)`w$nQ5x)>$ct zxSOE5cOKpBjdgub+8t1xX_aeaN&6?;WcE4g|FIrCP{reE>hJMYOQ zTRI<4|Lgx^fg?Oe{O#|`pKE^+$ZbAF+{1VLc3Vk8Pbs!OtnYGc)*j**TnvF^Th>~7 z2N#H}eZ!Ue76Z+~?Y6};T`oS0u`>;kpX zwhdHC3#f0t25QmW&!YM|s9VN82kM|7)mT)oJh$B@d;8m$Q2iCC;U`}Owe=*b=TZG; z#}26Ny)IOnKrMRpkD%`TBdUKw^}8=YJ#*jxL-iu4;a%^7>Up*a)Lv9ie*)_C@rP0M zgL>xiK~VqfdIHp4sGj^Ss$U;R^>?Vg@^?^o{teZGsJ3_Sga*wXMb!uDmerqwdig6< z*P`0-%Uz(J{2JBgK%M@ZE1-VShw2|uZ8{I?+oRv1`Z=gC#*G^X4chI-NTTZb6R6=M z5vcwd)VIe)fqLQssgboCzP&Ua)r+7`pE48F z(`|b|or&te$DoG4Gz-<^pe`!Yf!gSN64b{~ZT&r{;m@U``UgPMg!MU;Sg$+j2NI8?vu0QJnXkD~e# zs4sq82I}$mQ9TPP%;EcE2!YEbNfF!RJ*VWw(Y#F9MAPVN%3?Nj*R)hgU{~Bf;DOa9 zO_5|NyJ3%Bo4i;X&X_sk`uVWS3^w>=_SZGR0tKv6!n3sn7Kbf-T=`KsWBVsaN8Qp> z+NcU`)TbAu7jmR2vL0r;r5d)TDvPz-V8;#Yih|uk83!F1uo0>MLUgT3w6R1qk6E#t z2P-*l{4EyNW@|5pgIic|%VX9dt6|}{#h!Tng7my!`jtmIs^#bR;@UX7LN14GhOpKR zTLk*d!eegST$a|te8WZt*zyA_6V1N6q0%c2%q9z;nj1aOi7#dpxw%39DYPdIS6Jt6S`kd@7TUdZcGypPhD^_lN@ z!iFqI9J8G&4fd~fdDD7*(8i4Z>;tfn2&`af4z}&b{_PO=%ftm$)ER9QZ0oy}BdvhF zfm$gXe(4vU^-G6xq?fhRPLIMqS=c~&>h@8!0=6FD=594?LXR(2{Svm}WWrXOW=C3o z?m_5%Xe{gw*pLm&ch1=NK9hc~jXLF*p4CU4ZG~EVJbq0FuHfatVz>n(Y#neyiyC30 z9BdCUWw8*pyR_e+Jn5AeClqLLR*=os7a^Rn(~g zXzZtYM?JId4GX`7)T;>j8H|f+Wwy%blEjXyPR>?Mvp4PD{o%q^nWiu!DLHGWTm3?Z zc7(S*Kj8_7^ua>BXhXO-5Nt83vX z*`m!Whp&gq&1Gc^%~tcW((+PkL7BN?jjFb&x~8*W)1=iV6s7lG7n?JW8siX&JfC$_XU4GxYTf8_Yd-gAR}kMs|AA0A$;ZY_C!g}LDM zwKexnyQ}7fxal3_C76@&{hEmJ)fyPw}cXy<#x`_43n! zGWigGJ;UEBMg7daTbN*AGomAd*8)6AZ3Hcu_tKZdlKi?M_ zR$=od!f$%_3bgmBBrC}>i#Ro z{0%4S#Sc96@oSz=*%O%&a=!Zh1y6jU&sX$jU0#?nc)+99?)pUcIto^;rnGDj?)~oCpO0G__aLuI#t9e(P7)y_YK|SG(;pue0bTTUASP= z>H{9Iy)#14Fg-$m{CP?6{uRj8!UWHolI`t?sR6^s!-%bHl8zHh2dbHdNB^z=G9xLK^*S2mB&s#OJjjK0kLplEDrWHsL3NmUKx2Q z*(|m}2^$j+$Vq~wOia*W!b(FV2qri17;V_~%_F)(uGam6^7!%kqCIrHm31L*nHk{hJeX8S> za48;oHI1vb3dR-3?wJhV*>2l=Dkf)FL%ZgA zus1gQB`v!kLp?b=W<>~|cq$?>dzz%tf6qe)enlFhzq88ThfZ)rk7K&gI?mZC(;G8y zH>tKfILGluL?ZTf_qR`^ta?MAl4k!jar39k-rCjDWjn$q?f*Jkxk?5Vsx6bgwx^hC zXSpSfbH28opSHw;Uigp!E>FgrFh2H2X!Oy%nB+(1mY)j~%NCKXl3!Fs%;5;F{MJ<( zq2&&Srp=h8&t94Hx3>tbcV6XZVSPh_ov*_Pd-^S+);?G<61J4dvakO1EBi{_?z?sG z`|p`hCG+SP?wzfdG!Crp(kES>^FX}bFz2DhkGpIQbGr57?@|_Roi#x7^Zc~pSvDrO zcRj)@!U5gzk>tBc6GS}8!a{%8mZ6X8$`6M*JQ>BawUS2D-^2Pj3SYa5BBCL$af)EZ zD*jxuTBv~>T>&|&Is0*P9q-K|;vj!ZZnC$R#~xNeQK`(ddh1+wD%j#!hAEjuz`Bdg zx=Jgs{XQ`!O!dfQ36IQ%q`v%AxJyfT%VXZ!ZxY)cS!EK0X=SgzM#hmWO_TZI$#Q{K zkkvLbLe@rHChdx%u!-Ux61^C5pA>e>$U87I;P7BRW)&gRL7OBnFyjE{NI{cR`11?D zH_Y#X8yS8~FF(e^TL4=#Z3cNK5A--2FP8o80o}d;w%Q*wekl6FBRs2$g7a~1#ql$# zF{$^7NUw03Fnm&j$se92v{lQb0%pwaP1I*+FP1a$r*j&fvsy?ZF$VZCs|dLRB;_^% zbV1W!g^$YWDlGW=#1Ii$Y*7{>;{K_m+v867(tG)7$k0AD3SN-t+aoRWM|}%-90PbW z^7TLz!w-L(0)7KejO&gWJtQzo>I!_FRSGgqxCpqm3VFY=>M$0_iJhI;zN8%I1CAfF z>ZWrXL5`P^esdIbK1I`of^=wf9%IOkaz4 z14maca9sR<=Xe*~TinF^9u;zIMvlvZIT~&tj(C5H_dyYod|8+tp8|i7`yd^1Zbi;3 zf;ro7fHUQIljE9$9A80>xxpO0&;9%S48&EeCMFCpe9Wqwet%hloV$?o&;N7Il;cf~ zs|`8!AjiUBj=cXQu3L$gE`(!TZ!+f=uIO>sOJ90c4 z%<(^o<4w-bT;$k^9FGTcG~7TO$K5_QuB$u4&!Gd+09Y=tquU1aq|C07uMEX1zxCf=Z|+m&}GFF;B&A z2s5j0`n|~javw$RmxHX6p$E+e`Daf1H9xb+KAGRka zxIOk8><2aQi`Z@u+nRH=0{w%Db&k0vzDjo7q!G`}=FidbQ#AbK7=DtNuf2S5=id%U z{`kuFXWGRZ_OT(@kPENr!fVwwQLRN}%@I{=MHZQ;;(~CkM_BF_K57!Ku?Y)vgat%s zRtZnORrSlQMaLdq{$#Xa*GJkN4GD*mWLt>fB9MSjm5PuVAd{uCsg3u&KBafz@9g*g zK5pc|2lfY_SBT#@VPAexq4~>M`$LD6*ua@!UAPtV1>=8kJvbx_suu(VgrR;{Hu7r}w4>YXVIo(yex}nrR zy<=}l!`e4z^j<1&D0kg4GI?V|rT-4`UtJAVZ)!A4b~e@g zCB=II$M#Z5@s9w=cal9VlFOO7Gd^uoK;g3p+*8qlo zsHFHV4yTghzX4nce^gTZUBK|#KqbY`0fzg5sHC_ECO(|gsHC_YaP&_l#peT#JgKDk zPXM0+IF%H)0FM9vGL;l}a(<|!_zRpLDk=Ua4yTghe+3+QQc3Zz09OM}CB-Mh{UG)W zl@y-~IPPhnlH&IRj{d2n_*%eY0jHAUjhr7UDZUSI%v&lc-U+x0a4IQ2065l5CB@GJ zj{Qg_#Uo%)qdk=rzY}m3;8arlUJj>{;-wr;CB?S^J{|l}N%7wTj`dPW@qP}clH%t8 zhszkDlH#!Kf{7=U6kiLIAq+`!2bAM@LmWG*3UC~!cL9jy6tCy-q!8TB;qyZ9Z5*B% zg74;VV+j5&@b@^pG6X-$ z;k6<7-#L6!2tLf=jUo8w9KIt2zs%u#LU0~*3i5wC1Ru}gts(d%4*zusj+?>I&u>HU z=^Xw>2tJ#`4~F3LINTS4>p8qH1izQVKMcWFaQI*dzM8{73Be0Fd^iLz=kR}o;I$ln zF$8~{!@mu|T^t?;_Z`p`fjrsG;p0N^XEE}nBjl_>}_%RMQb6mUv;}-9C@$)knm&tHn0MEAdcfxULg=L*JFYn&_a~@o= zGVlIHD-8<`D-AV8=CZu%BI~;9ifhVPxDZ}DD5$j5UsGIbE?ZZWXRS6@)D#z0R~Hpt zV^LFN&8x9iR-4xpT~h{cJzTe}psWaAkGRg61(g+6b7@7*bq%cMwMEx0EPyvDt|3!c zR93XcY%R+Br=?Jr)m&jMMT5}zS&OR6ODq0a3A!q(zUG9|nmlYkwYlKh&M2rXEXpe} z*OXjy7E^-ni(FGuxxNA%UiUnf1XNmCUAm_9+CJu3f)N4*#p(7dOVqGM$ zKHx1TtT>7FlFWKZ<~Xokl36dwte0fgOET*vne~#)dP!!zq_AF6ST8ADQ&=x4td|tl zOG+y9E)%>nWhsS0J9}MCQDJ#eIfNO$3oP~UU0zuWd0UfTy_T6s$IP3-)8sX?;+RQr z%$yfA#f8pjV<#}omZ0hBYVQ^WCLeYbkC|Em$q|@1g64^t{&qozzzDKF;0gx zHyUBUhK$dk;W&2m1r4^4vBex-9ZF*lVdNmIypVwsG%kXM!PU3~vYsY6_ln$&zWBzx zgO`##YhA@!XlF%07L^s(R2STBsVrM-t}V}l*WoIwtu?a?W>cgbUgyKhXKpmoXfk&*g#3Rl C=eGU; literal 0 HcmV?d00001 diff --git a/crates/pallet-contracts-pvm-llapi/src/calling_convention.rs b/crates/runtime-api/src/calling_convention.rs similarity index 89% rename from crates/pallet-contracts-pvm-llapi/src/calling_convention.rs rename to crates/runtime-api/src/calling_convention.rs index df3472a0..700f5fb8 100644 --- a/crates/pallet-contracts-pvm-llapi/src/calling_convention.rs +++ b/crates/runtime-api/src/calling_convention.rs @@ -1,10 +1,26 @@ use inkwell::{ builder::Builder, context::Context, + module::Module, types::{BasicType, StructType}, values::{BasicValue, PointerValue}, }; +/// Creates a module that sets the PolkaVM minimum stack size to [`size`] if linked in. +pub fn min_stack_size<'context>( + context: &'context Context, + module_name: &str, + size: u32, +) -> Module<'context> { + let module = context.create_module(module_name); + module.set_inline_assembly(&format!( + ".pushsection .polkavm_min_stack_size,\"\",@progbits + .word {size} + .popsection" + )); + module +} + pub struct Spill<'a, 'ctx> { pointer: PointerValue<'ctx>, builder: &'a Builder<'ctx>, diff --git a/crates/runtime-api/src/lib.rs b/crates/runtime-api/src/lib.rs new file mode 100644 index 00000000..2a4f0e07 --- /dev/null +++ b/crates/runtime-api/src/lib.rs @@ -0,0 +1,11 @@ +//! This crate vendors the [PolkaVM][0] C API and provides a LLVM module for interacting +//! with the `pallet-revive` runtime API. +//! At present, the contracts pallet requires blobs to export `call` and `deploy`, +//! and offers a bunch of [runtime API methods][1]. The provided [module] implements +//! those exports and imports. +//! [0]: [https://crates.io/crates/polkavm] +//! [1]: [https://docs.rs/pallet-contracts/26.0.0/pallet_contracts/api_doc/index.html] + +pub mod calling_convention; +pub mod polkavm_exports; +pub mod polkavm_imports; diff --git a/crates/runtime-api/src/polkavm_exports.c b/crates/runtime-api/src/polkavm_exports.c new file mode 100644 index 00000000..882f61bd --- /dev/null +++ b/crates/runtime-api/src/polkavm_exports.c @@ -0,0 +1,7 @@ +#include "polkavm_guest.h" + +extern void call(); +extern void deploy(); + +POLKAVM_EXPORT(void, call) +POLKAVM_EXPORT(void, deploy) diff --git a/crates/runtime-api/src/polkavm_exports.rs b/crates/runtime-api/src/polkavm_exports.rs new file mode 100644 index 00000000..70b7e548 --- /dev/null +++ b/crates/runtime-api/src/polkavm_exports.rs @@ -0,0 +1,29 @@ +use inkwell::{context::Context, memory_buffer::MemoryBuffer, module::Module, support::LLVMString}; + +include!(concat!(env!("OUT_DIR"), "/polkavm_exports.rs")); + +/// Creates a LLVM module from the [BITCODE]. +/// The module exports `call` and `deploy` functions (which are named thereafter). +/// Returns `Error` if the bitcode fails to parse, which should never happen. +pub fn module<'context>( + context: &'context Context, + module_name: &str, +) -> Result, LLVMString> { + let buf = MemoryBuffer::create_from_memory_range(BITCODE, module_name); + Module::parse_bitcode_from_buffer(&buf, context) +} + +#[cfg(test)] +mod tests { + use crate::polkavm_exports; + + #[test] + fn it_works() { + inkwell::targets::Target::initialize_riscv(&Default::default()); + let context = inkwell::context::Context::create(); + let module = polkavm_exports::module(&context, "polkavm_exports").unwrap(); + + assert!(module.get_function("call").is_some()); + assert!(module.get_function("deploy").is_some()); + } +} diff --git a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.h b/crates/runtime-api/src/polkavm_guest.h similarity index 100% rename from crates/pallet-contracts-pvm-llapi/src/polkavm_guest.h rename to crates/runtime-api/src/polkavm_guest.h diff --git a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.c b/crates/runtime-api/src/polkavm_imports.c similarity index 95% rename from crates/pallet-contracts-pvm-llapi/src/polkavm_guest.c rename to crates/runtime-api/src/polkavm_imports.c index b9e5d585..065d6fb4 100644 --- a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.c +++ b/crates/runtime-api/src/polkavm_imports.c @@ -48,14 +48,6 @@ void * __sbrk(uint32_t size) { return (void *)address; } -// Exports - -extern void call(); -POLKAVM_EXPORT(void, call) - -extern void deploy(); -POLKAVM_EXPORT(void, deploy) - // Imports @@ -77,7 +69,7 @@ POLKAVM_IMPORT(uint32_t, contains_storage, uint32_t, uint32_t) POLKAVM_IMPORT(uint32_t, take_storage, uint32_t, uint32_t, uint32_t, uint32_t) -POLKAVM_IMPORT(uint32_t, seal_call, uint32_t) +POLKAVM_IMPORT(uint32_t, call, uint32_t) POLKAVM_IMPORT(uint32_t, delegate_call, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t) diff --git a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs b/crates/runtime-api/src/polkavm_imports.rs similarity index 50% rename from crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs rename to crates/runtime-api/src/polkavm_imports.rs index 58b2c588..fc90f3f7 100644 --- a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.rs +++ b/crates/runtime-api/src/polkavm_imports.rs @@ -1,6 +1,6 @@ //! This crate vendors the [PolkaVM][0] C API and provides a LLVM module for interacting -//! with the `pallet-contracts` runtime API. -//! At present, the contracts pallet requires blobs to export `call` and `deploy`, +//! with the `pallet-revive` runtime API. +//! At present, the revive pallet requires blobs to export `call` and `deploy`, //! and offers a bunch of [runtime API methods][1]. The provided [module] implements //! those exports and imports. //! [0]: [https://crates.io/crates/polkavm] @@ -8,13 +8,10 @@ use inkwell::{context::Context, memory_buffer::MemoryBuffer, module::Module, support::LLVMString}; -include!(concat!(env!("OUT_DIR"), "/polkavm_guest.rs")); +include!(concat!(env!("OUT_DIR"), "/polkavm_imports.rs")); /// Creates a LLVM module from the [BITCODE]. -/// The module does: -/// - Export the `call` and `deploy` functions (which are named thereafter). -/// - Import (most) `pallet-contracts` runtime API functions. -/// +/// The module imports `pallet-revive` runtime API functions. /// Returns `Error` if the bitcode fails to parse, which should never happen. pub fn module<'context>( context: &'context Context, @@ -24,32 +21,14 @@ pub fn module<'context>( Module::parse_bitcode_from_buffer(&buf, context) } -/// Creates a module that sets the PolkaVM minimum stack size to [`size`] if linked in. -pub fn min_stack_size<'context>( - context: &'context Context, - module_name: &str, - size: u32, -) -> Module<'context> { - let module = context.create_module(module_name); - module.set_inline_assembly(&format!( - ".pushsection .polkavm_min_stack_size,\"\",@progbits - .word {size} - .popsection" - )); - module -} - #[cfg(test)] mod tests { - use crate::polkavm_guest; + use crate::polkavm_imports; #[test] fn it_works() { inkwell::targets::Target::initialize_riscv(&Default::default()); let context = inkwell::context::Context::create(); - let module = polkavm_guest::module(&context, "polkavm_guest").unwrap(); - - assert!(module.get_function("call").is_some()); - assert!(module.get_function("deploy").is_some()); + let _ = polkavm_imports::module(&context, "polkavm_imports").unwrap(); } } From 295a75e3d771227d6f1678dc88919b9af530c08e Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Sun, 1 Sep 2024 14:45:38 +0200 Subject: [PATCH 19/27] module private symbols for exports Signed-off-by: Cyrill Leutwiler --- crates/integration/codesize.json | 16 ++++---- .../polkavm/context/function/runtime/entry.rs | 31 +++------------- .../llvm-context/src/polkavm/context/mod.rs | 37 +++++++++---------- .../llvm-context/src/polkavm/evm/context.rs | 4 +- crates/runtime-api/src/polkavm_exports.c | 15 ++++++-- 5 files changed, 45 insertions(+), 58 deletions(-) diff --git a/crates/integration/codesize.json b/crates/integration/codesize.json index ab9370ec..e2c613dc 100644 --- a/crates/integration/codesize.json +++ b/crates/integration/codesize.json @@ -1,10 +1,10 @@ { - "Baseline": 891, - "Computation": 4318, - "DivisionArithmetics": 39782, - "ERC20": 47007, - "Events": 1706, - "FibonacciIterative": 2930, - "Flipper": 3584, - "SHA1": 32499 + "Baseline": 878, + "Computation": 4305, + "DivisionArithmetics": 39774, + "ERC20": 53405, + "Events": 1693, + "FibonacciIterative": 2917, + "Flipper": 3570, + "SHA1": 32557 } \ No newline at end of file diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs b/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs index 46f8ad77..28ef4993 100644 --- a/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs +++ b/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs @@ -233,11 +233,12 @@ where fn declare(&mut self, context: &mut Context) -> anyhow::Result<()> { let entry_arguments = vec![context.bool_type().as_basic_type_enum()]; let entry_function_type = context.function_type(entry_arguments, 0, false); - context.add_function(runtime::FUNCTION_ENTRY, entry_function_type, 0, None)?; - - for symbol in runtime_api::exports::EXPORTS { - context.declare_extern_function(symbol)?; - } + context.add_function( + runtime::FUNCTION_ENTRY, + entry_function_type, + 0, + Some(inkwell::module::Linkage::External), + )?; Ok(()) } @@ -258,26 +259,6 @@ where true, ); - context.set_current_function(runtime_api::exports::DEPLOY)?; - context.set_basic_block(context.current_function().borrow().entry_block()); - - assert!(context - .build_call(entry, &[context.bool_const(true).into()], "entry_deploy") - .is_none()); - - context.set_basic_block(context.current_function().borrow().return_block); - context.build_unreachable(); - - context.set_current_function(runtime_api::exports::CALL)?; - context.set_basic_block(context.current_function().borrow().entry_block()); - - assert!(context - .build_call(entry, &[context.bool_const(false).into()], "entry_call") - .is_none()); - - context.set_basic_block(context.current_function().borrow().return_block); - context.build_unreachable(); - context.set_current_function(runtime::FUNCTION_ENTRY)?; context.set_basic_block(context.current_function().borrow().entry_block()); diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index b5f88e4f..c739b004 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -144,26 +144,22 @@ where } } - /// Link in the PolkaVM exports module, containing exported functions. - fn link_polkavm_exports( - llvm: &'ctx inkwell::context::Context, - module: &inkwell::module::Module<'ctx>, - ) { - module - .link_in_module( - revive_runtime_api::polkavm_exports::module(llvm, "polkavm_exports").unwrap(), + fn link_polkavm_exports(&self, contract_path: &str) -> anyhow::Result<()> { + let exports = revive_runtime_api::polkavm_exports::module(self.llvm(), "polkavm_exports") + .map_err(|error| { + anyhow::anyhow!( + "The contract `{}` exports module loading error: {}", + contract_path, + error ) - .expect("the PolkaVM exports module should be linkable"); - - for export in runtime_api::exports::EXPORTS { - module - .get_function(export) - .expect("should be declared") - .add_attribute( - inkwell::attributes::AttributeLoc::Function, - llvm.create_enum_attribute(Attribute::NoReturn as u32, 0), - ); - } + })?; + self.module.link_in_module(exports).map_err(|error| { + anyhow::anyhow!( + "The contract `{}` exports module linking error: {}", + contract_path, + error + ) + }) } /// Configure the PolkaVM minimum stack size. @@ -204,7 +200,6 @@ where ) -> Self { Self::link_stdlib_module(llvm, &module); Self::link_polkavm_imports(llvm, &module); - Self::link_polkavm_exports(llvm, &module); Self::set_polkavm_stack_size(llvm, &module, Self::POLKAVM_STACK_SIZE); Self::set_module_flags(llvm, &module); @@ -243,6 +238,8 @@ where ) -> anyhow::Result { let module_clone = self.module.clone(); + self.link_polkavm_exports(contract_path)?; + let target_machine = TargetMachine::new(Target::PVM, self.optimizer.settings())?; target_machine.set_target_data(self.module()); diff --git a/crates/llvm-context/src/polkavm/evm/context.rs b/crates/llvm-context/src/polkavm/evm/context.rs index e270da46..ee16b799 100644 --- a/crates/llvm-context/src/polkavm/evm/context.rs +++ b/crates/llvm-context/src/polkavm/evm/context.rs @@ -38,12 +38,12 @@ where /// Translates the `chain_id` instruction. pub fn chain_id<'ctx, D>( - _context: &mut Context<'ctx, D>, + context: &mut Context<'ctx, D>, ) -> anyhow::Result> where D: Dependency + Clone, { - todo!() + Ok(context.word_const(0).as_basic_value_enum()) } /// Translates the `block_number` instruction. diff --git a/crates/runtime-api/src/polkavm_exports.c b/crates/runtime-api/src/polkavm_exports.c index 882f61bd..24020778 100644 --- a/crates/runtime-api/src/polkavm_exports.c +++ b/crates/runtime-api/src/polkavm_exports.c @@ -1,7 +1,16 @@ +#include + #include "polkavm_guest.h" -extern void call(); -extern void deploy(); +extern void __entry(bool); + +static void deploy() { + __entry(true); +} + +static void call() { + __entry(false); +} -POLKAVM_EXPORT(void, call) POLKAVM_EXPORT(void, deploy) +POLKAVM_EXPORT(void, call) From 9046b70deec84b3a22d333c963c548789c5145ba Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Mon, 2 Sep 2024 09:58:27 +0200 Subject: [PATCH 20/27] bitwise and mstore8 cases Signed-off-by: Cyrill Leutwiler --- crates/integration/contracts/Bitwise.sol | 25 ++++ crates/integration/contracts/MStore8.sol | 101 ++++++++++++++ crates/integration/contracts/mStore8.sol | 12 -- crates/integration/src/cases.rs | 2 +- crates/integration/src/tests.rs | 165 ++++++++--------------- 5 files changed, 185 insertions(+), 120 deletions(-) create mode 100644 crates/integration/contracts/MStore8.sol delete mode 100644 crates/integration/contracts/mStore8.sol diff --git a/crates/integration/contracts/Bitwise.sol b/crates/integration/contracts/Bitwise.sol index 7cf581ae..0e2d82ad 100644 --- a/crates/integration/contracts/Bitwise.sol +++ b/crates/integration/contracts/Bitwise.sol @@ -2,6 +2,31 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Bitwise" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "3fa4f245" + } + } + ] +} +*/ + contract Bitwise { function opByte(uint i, uint x) public payable returns (uint ret) { assembly { diff --git a/crates/integration/contracts/MStore8.sol b/crates/integration/contracts/MStore8.sol new file mode 100644 index 00000000..e238fa89 --- /dev/null +++ b/crates/integration/contracts/MStore8.sol @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "MStore8" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000001" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000002" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad42100000000000000000000000000000000000000000000000000000000000000ff" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000100" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000101" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000102" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad42100000000000000000000000000000000000000000000000000000000075bcd15" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad421ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + } + ] +} +*/ + +contract MStore8 { + function mStore8(uint value) public pure returns (uint256 word) { + assembly { + mstore8(0x80, value) + word := mload(0x80) + } + } +} diff --git a/crates/integration/contracts/mStore8.sol b/crates/integration/contracts/mStore8.sol deleted file mode 100644 index 3be7193f..00000000 --- a/crates/integration/contracts/mStore8.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8; - -contract MStore8 { - function mStore8(uint value) public pure returns (uint256 word) { - assembly { - mstore8(0x80, value) - word := mload(0x80) - } - } -} diff --git a/crates/integration/src/cases.rs b/crates/integration/src/cases.rs index 03e8920f..f6e3bcf8 100644 --- a/crates/integration/src/cases.rs +++ b/crates/integration/src/cases.rs @@ -161,7 +161,7 @@ sol!( function mStore8(uint value) public pure returns (uint256 word); } ); -case!("mStore8.sol", MStore8, mStore8Call, mstore8, value: U256); +case!("MStore8.sol", MStore8, mStore8Call, mstore8, value: U256); sol!( contract Events { diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index db272379..d80450e2 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,4 +1,10 @@ +use std::str::FromStr; + +use alloy_primitives::*; use revive_runner::*; +use SpecsAction::*; + +use crate::cases::Contract; macro_rules! test_spec { ($test_name:ident, $contract_name:literal, $source_file:literal) => { @@ -26,27 +32,67 @@ test_spec!(block, "Block", "Block.sol"); test_spec!(mcopy, "MCopy", "MCopy.sol"); test_spec!(events, "Events", "Events.sol"); test_spec!(storage, "Storage", "Storage.sol"); +test_spec!(mstore8, "MStore8", "MStore8.sol"); -/* #[test] -fn transient_storage() { - let expected = U256::MAX; - let (state, output) = assert_success(&Contract::storage_transient(expected), false); - let received = U256::abi_decode(&output.data, true).unwrap(); - assert_eq!(expected, received); +fn bitwise_byte() { + let mut actions = vec![Instantiate { + origin: TestAccountId::Alice, + value: 0, + gas_limit: Some(GAS_LIMIT), + storage_deposit_limit: None, + code: Code::Solidity { + path: Some("contracts/Bitwise.sol".into()), + contract: "Bitwise".to_string(), + solc_optimizer: None, + pipeline: None, + }, + data: vec![], + salt: vec![], + }]; - assert!(state - .accounts() - .values() - .all(|account| account.storage.is_empty())); + let de_bruijn_sequence = + hex::decode("4060503824160d0784426150b864361d0f88c4a27148ac5a2f198d46e391d8f4").unwrap(); + let value = U256::from_be_bytes::<32>(de_bruijn_sequence.clone().try_into().unwrap()); + for input in de_bruijn_sequence + .iter() + .enumerate() + .map(|(index, _)| Contract::bitwise_byte(U256::from(index), value).calldata) + .chain([ + Contract::bitwise_byte(U256::ZERO, U256::ZERO).calldata, + Contract::bitwise_byte(U256::ZERO, U256::MAX).calldata, + Contract::bitwise_byte(U256::MAX, U256::ZERO).calldata, + Contract::bitwise_byte(U256::from_str("18446744073709551619").unwrap(), U256::MAX) + .calldata, + ]) + { + actions.push(Call { + origin: TestAccountId::Alice, + dest: TestAccountId::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: input, + }) + } + + Specs { + differential: true, + balances: vec![(ALICE, 1_000_000_000)], + actions, + } + .run(); } + +/* #[test] fn events() { assert_success(&Contract::event(U256::ZERO), true); assert_success(&Contract::event(U256::from(123)), true); -}#[test] +} + +#[test] fn balance() { - // TODO: We do not have the correct balance API in the pallet yet let (_, output) = assert_success(&Contract::value_balance_of(Default::default()), false); let expected = U256::ZERO; @@ -70,79 +116,6 @@ fn balance() { assert_eq!(expected, received) } -#[test] -fn mstore8() { - for (received, expected) in [ - (U256::MIN, U256::MIN), - ( - U256::from(1), - U256::from_str_radix( - "452312848583266388373324160190187140051835877600158453279131187530910662656", - 10, - ) - .unwrap(), - ), - ( - U256::from(2), - U256::from_str_radix( - "904625697166532776746648320380374280103671755200316906558262375061821325312", - 10, - ) - .unwrap(), - ), - ( - U256::from(255), - U256::from_str_radix( - "115339776388732929035197660848497720713218148788040405586178452820382218977280", - 10, - ) - .unwrap(), - ), - (U256::from(256), U256::from(0)), - ( - U256::from(257), - U256::from_str_radix( - "452312848583266388373324160190187140051835877600158453279131187530910662656", - 10, - ) - .unwrap(), - ), - ( - U256::from(258), - U256::from_str_radix( - "904625697166532776746648320380374280103671755200316906558262375061821325312", - 10, - ) - .unwrap(), - ), - ( - U256::from(123456789), - U256::from_str_radix( - "9498569820248594155839807363993929941088553429603327518861754938149123915776", - 10, - ) - .unwrap(), - ), - ( - U256::MAX, - U256::from_str_radix( - "115339776388732929035197660848497720713218148788040405586178452820382218977280", - 10, - ) - .unwrap(), - ), - ] - .par_iter() - .map(|(parameter, expected)| { - let (_, output) = assert_success(&Contract::mstore8(*parameter), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *expected) - }) - .collect::>() - { - assert_eq!(received, expected); - } -} #[test] fn address() { @@ -412,26 +385,4 @@ fn echo() { assert_eq!(expected, received); } - -#[test] -fn bitwise_byte() { - assert_success(&Contract::bitwise_byte(U256::ZERO, U256::ZERO), true); - assert_success(&Contract::bitwise_byte(U256::ZERO, U256::MAX), true); - assert_success(&Contract::bitwise_byte(U256::MAX, U256::ZERO), true); - assert_success( - &Contract::bitwise_byte(U256::from_str("18446744073709551619").unwrap(), U256::MAX), - true, - ); - - let de_bruijn_sequence = - hex::decode("4060503824160d0784426150b864361d0f88c4a27148ac5a2f198d46e391d8f4").unwrap(); - let value = U256::from_be_bytes::<32>(de_bruijn_sequence.clone().try_into().unwrap()); - - for (index, byte) in de_bruijn_sequence.iter().enumerate() { - let (_, output) = assert_success(&Contract::bitwise_byte(U256::from(index), value), true); - let expected = U256::from(*byte as i32); - let received = U256::abi_decode(&output.data, true).unwrap(); - assert_eq!(expected, received) - } -} */ From 7083fff2e1fab04558ec22494de1d2d6db575a20 Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Mon, 2 Sep 2024 10:37:55 +0200 Subject: [PATCH 21/27] divisions Signed-off-by: Cyrill Leutwiler --- crates/integration/src/tests.rs | 281 +++++++++++++++++--------------- 1 file changed, 149 insertions(+), 132 deletions(-) diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index d80450e2..2dfa34e2 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -34,22 +34,35 @@ test_spec!(events, "Events", "Events.sol"); test_spec!(storage, "Storage", "Storage.sol"); test_spec!(mstore8, "MStore8", "MStore8.sol"); -#[test] -fn bitwise_byte() { - let mut actions = vec![Instantiate { +fn instantiate(path: &str, contract: &str) -> Vec { + vec![Instantiate { origin: TestAccountId::Alice, value: 0, gas_limit: Some(GAS_LIMIT), storage_deposit_limit: None, code: Code::Solidity { - path: Some("contracts/Bitwise.sol".into()), - contract: "Bitwise".to_string(), + path: Some(path.into()), + contract: contract.to_string(), solc_optimizer: None, pipeline: None, }, data: vec![], salt: vec![], - }]; + }] +} + +fn run_differential(actions: Vec) { + Specs { + differential: true, + balances: vec![(ALICE, 1_000_000_000)], + actions, + } + .run(); +} + +#[test] +fn bitwise_byte() { + let mut actions = instantiate("contracts/Bitwise.sol", "Bitwise"); let de_bruijn_sequence = hex::decode("4060503824160d0784426150b864361d0f88c4a27148ac5a2f198d46e391d8f4").unwrap(); @@ -76,12 +89,137 @@ fn bitwise_byte() { }) } - Specs { - differential: true, - balances: vec![(ALICE, 1_000_000_000)], - actions, + run_differential(actions); +} + +#[test] +fn unsigned_division() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + + let one = U256::from(1); + let two = U256::from(2); + let five = U256::from(5); + for (n, d) in [ + (five, five), + (five, one), + (U256::ZERO, U256::MAX), + (five, two), + (one, U256::ZERO), + ] { + actions.push(Call { + origin: TestAccountId::Alice, + dest: TestAccountId::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_div(n, d).calldata, + }) + } + + run_differential(actions); +} + +#[test] +fn signed_division() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + + let one = I256::try_from(1).unwrap(); + let two = I256::try_from(2).unwrap(); + let minus_two = I256::try_from(-2).unwrap(); + let five = I256::try_from(5).unwrap(); + let minus_five = I256::try_from(-5).unwrap(); + for (n, d) in [ + (five, five), + (five, one), + (I256::ZERO, I256::MAX), + (I256::ZERO, I256::MINUS_ONE), + (five, two), + (five, I256::MINUS_ONE), + (I256::MINUS_ONE, minus_two), + (minus_five, minus_five), + (minus_five, two), + (I256::MINUS_ONE, I256::MIN), + (one, I256::ZERO), + ] { + actions.push(Call { + origin: TestAccountId::Alice, + dest: TestAccountId::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_sdiv(n, d).calldata, + }) + } + + run_differential(actions); +} + +#[test] +fn unsigned_remainder() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + + let one = U256::from(1); + let two = U256::from(2); + let five = U256::from(5); + for (n, d) in [ + (five, five), + (five, one), + (U256::ZERO, U256::MAX), + (U256::MAX, U256::MAX), + (five, two), + (two, five), + (U256::MAX, U256::ZERO), + ] { + actions.push(Call { + origin: TestAccountId::Alice, + dest: TestAccountId::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_mod(n, d).calldata, + }) + } + + run_differential(actions); +} + +#[test] +fn signed_remainder() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + + let one = I256::try_from(1).unwrap(); + let two = I256::try_from(2).unwrap(); + let minus_two = I256::try_from(-2).unwrap(); + let five = I256::try_from(5).unwrap(); + let minus_five = I256::try_from(-5).unwrap(); + for (n, d) in [ + (five, five), + (five, one), + (I256::ZERO, I256::MAX), + (I256::MAX, I256::MAX), + (five, two), + (two, five), + (five, minus_five), + (five, I256::MINUS_ONE), + (five, minus_two), + (minus_five, two), + (minus_two, five), + (minus_five, minus_five), + (minus_five, I256::MINUS_ONE), + (minus_five, minus_two), + (minus_two, minus_five), + (I256::MIN, I256::MINUS_ONE), + (I256::ZERO, I256::ZERO), + ] { + actions.push(Call { + origin: TestAccountId::Alice, + dest: TestAccountId::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_smod(n, d).calldata, + }) } - .run(); } /* @@ -116,7 +254,6 @@ fn balance() { assert_eq!(expected, received) } - #[test] fn address() { let contract = Contract::context_address(); @@ -134,126 +271,6 @@ fn caller() { assert_eq!(received, expected); } -#[test] -fn unsigned_division() { - let one = U256::from(1); - let two = U256::from(2); - let five = U256::from(5); - for (received, expected) in [ - (five, five, one), - (five, one, five), - (U256::ZERO, U256::MAX, U256::ZERO), - (five, two, two), - (one, U256::ZERO, U256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_div(*n, *d), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected) - } -} - -#[test] -fn signed_division() { - let one = I256::try_from(1).unwrap(); - let two = I256::try_from(2).unwrap(); - let minus_two = I256::try_from(-2).unwrap(); - let five = I256::try_from(5).unwrap(); - let minus_five = I256::try_from(-5).unwrap(); - for (received, expected) in [ - (five, five, one), - (five, one, five), - (I256::ZERO, I256::MAX, I256::ZERO), - (I256::ZERO, I256::MINUS_ONE, I256::ZERO), - (five, two, two), - (five, I256::MINUS_ONE, minus_five), - (I256::MINUS_ONE, minus_two, I256::ZERO), - (minus_five, minus_five, one), - (minus_five, two, minus_two), - (I256::MINUS_ONE, I256::MIN, I256::ZERO), - (one, I256::ZERO, I256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_sdiv(*n, *d), true); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected); - } -} - -#[test] -fn unsigned_remainder() { - let one = U256::from(1); - let two = U256::from(2); - let five = U256::from(5); - for (received, expected) in [ - (five, five, U256::ZERO), - (five, one, U256::ZERO), - (U256::ZERO, U256::MAX, U256::ZERO), - (U256::MAX, U256::MAX, U256::ZERO), - (five, two, one), - (two, five, two), - (U256::MAX, U256::ZERO, U256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_mod(*n, *d), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected); - } -} - -#[test] -fn signed_remainder() { - let one = I256::try_from(1).unwrap(); - let two = I256::try_from(2).unwrap(); - let minus_two = I256::try_from(-2).unwrap(); - let five = I256::try_from(5).unwrap(); - let minus_five = I256::try_from(-5).unwrap(); - for (received, expected) in [ - (five, five, I256::ZERO), - (five, one, I256::ZERO), - (I256::ZERO, I256::MAX, I256::ZERO), - (I256::MAX, I256::MAX, I256::ZERO), - (five, two, one), - (two, five, two), - (five, minus_five, I256::ZERO), - (five, I256::MINUS_ONE, I256::ZERO), - (five, minus_two, one), - (minus_five, two, I256::MINUS_ONE), - (minus_two, five, minus_two), - (minus_five, minus_five, I256::ZERO), - (minus_five, I256::MINUS_ONE, I256::ZERO), - (minus_five, minus_two, I256::MINUS_ONE), - (minus_two, minus_five, minus_two), - (I256::MIN, I256::MINUS_ONE, I256::ZERO), - (I256::ZERO, I256::ZERO, I256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_smod(*n, *d), true); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected); - } -} - #[test] fn create2() { let mut state = State::default(); From 4e8865b56c7cd7b5060b5309ea1e11736ca7bef0 Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Mon, 2 Sep 2024 15:24:10 +0200 Subject: [PATCH 22/27] support parsing the go time duration Signed-off-by: Cyrill Leutwiler --- crates/differential/src/go_duration.rs | 200 +++++++++++++++++++++++++ crates/differential/src/lib.rs | 122 +++++++++++++-- 2 files changed, 307 insertions(+), 15 deletions(-) create mode 100644 crates/differential/src/go_duration.rs diff --git a/crates/differential/src/go_duration.rs b/crates/differential/src/go_duration.rs new file mode 100644 index 00000000..121c0ef1 --- /dev/null +++ b/crates/differential/src/go_duration.rs @@ -0,0 +1,200 @@ +use std::time::Duration; + +/// Parse a go formatted duration. +/// +/// Sources: +/// - https://crates.io/crates/go-parse-duration (fixed an utf8 bug) +/// - https://github.com/golang/go/blob/master/src/time/format.go +pub fn parse_go_duration(value: &str) -> Result { + parse_duration(value).map(|ns| Duration::from_nanos(ns.abs() as u64)) +} + +fn parse_duration(string: &str) -> Result { + // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+ + let mut s = string; + let mut d: i64 = 0; // duration to be returned + let mut neg = false; + + // Consume [-+]? + if s != "" { + let c = *s.as_bytes().get(0).unwrap(); + if c == b'-' || c == b'+' { + neg = c == b'-'; + s = &s[1..]; + } + } + // Special case: if all that is left is "0", this is zero. + if s == "0" { + return Ok(0); + } + if s == "" { + return Err(format!("invalid duration: {string}")); + } + while s != "" { + // integers before, after decimal point + let mut v: i64; + let mut f: i64 = 0; + // value = v + f / scale + let mut scale: f64 = 1f64; + + // The next character must be [0-9.] + let c = *s.as_bytes().get(0).unwrap(); + if !(c == b'.' || b'0' <= c && c <= b'9') { + return Err(format!("invalid duration: {string}")); + } + // Consume [0-9]* + let pl = s.len(); + match leading_int(s) { + Ok((_v, _s)) => { + v = _v; + s = _s; + } + Err(_) => { + return Err(format!("invalid duration: {string}")); + } + } + let pre = pl != s.len(); // whether we consume anything before a period + + // Consume (\.[0-9]*)? + let mut post = false; + if s != "" && *s.as_bytes().get(0).unwrap() == b'.' { + s = &s[1..]; + let pl = s.len(); + match leading_fraction(s) { + (f_, scale_, s_) => { + f = f_; + scale = scale_; + s = s_; + } + } + post = pl != s.len(); + } + if !pre && !post { + // no digits (e.g. ".s" or "-.s") + return Err(format!("invalid duration: {string}")); + } + + // Consume unit. + let mut i = 0; + while i < s.len() { + let c = *s.as_bytes().get(i).unwrap(); + if c == b'.' || b'0' <= c && c <= b'9' { + break; + } + i += 1; + } + if i == 0 { + return Err(format!("missing unit in duration: {string}")); + } + let u = &s[..i]; + s = &s[i..]; + let unit = match u { + "ns" => 1i64, + "us" => 1000i64, + "µs" => 1000i64, // U+00B5 = micro symbol + "μs" => 1000i64, // U+03BC = Greek letter mu + "ms" => 1000000i64, + "s" => 1000000000i64, + "m" => 60000000000i64, + "h" => 3600000000000i64, + _ => { + return Err(format!("unknown unit {u} in duration {string}")); + } + }; + if v > (1 << 63 - 1) / unit { + // overflow + return Err(format!("invalid duration {string}")); + } + v *= unit; + if f > 0 { + // f64 is needed to be nanosecond accurate for fractions of hours. + // v >= 0 && (f*unit/scale) <= 3.6e+12 (ns/h, h is the largest unit) + v += (f as f64 * (unit as f64 / scale)) as i64; + if v < 0 { + // overflow + return Err(format!("invalid duration {string}")); + } + } + d += v; + if d < 0 { + // overflow + return Err(format!("invalid duration {string}")); + } + } + if neg { + d = -d; + } + Ok(d) +} + +fn leading_int(s: &str) -> Result<(i64, &str), String> { + let mut x = 0; + let mut i = 0; + while i < s.len() { + let c = s.chars().nth(i).unwrap(); + if c < '0' || c > '9' { + break; + } + if x > (1 << 63 - 1) / 10 { + return Err("overflow".into()); + } + let d = i64::from(c.to_digit(10).unwrap()); + x = x * 10 + d; + if x < 0 { + // overflow + return Err("overflow".into()); + } + i += 1; + } + Ok((x, &s[i..])) +} + +fn leading_fraction(s: &str) -> (i64, f64, &str) { + let mut i = 0; + let mut x = 0i64; + let mut scale = 1f64; + let mut overflow = false; + while i < s.len() { + let c = s.chars().nth(i).unwrap(); + if c < '0' || c > '9' { + break; + } + if overflow { + continue; + } + if x > (1 << 63 - 1) / 10 { + // It's possible for overflow to give a positive number, so take care. + overflow = true; + continue; + } + let d = i64::from(c.to_digit(10).unwrap()); + let y = x * 10 + d; + if y < 0 { + overflow = true; + continue; + } + x = y; + scale *= 10f64; + i += 1; + } + (x, scale, &s[i..]) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_duration() { + assert_eq!(parse_duration("8.731µs"), Ok(8731)); + assert_eq!(parse_duration("50ns"), Ok(50)); + assert_eq!(parse_duration("3ms"), Ok(3000000)); + assert_eq!(parse_duration("2us"), Ok(2000)); + assert_eq!(parse_duration("4.0s"), Ok(4000000000)); + assert_eq!(parse_duration("1h45m"), Ok(6300000000000)); + assert_eq!( + parse_duration("1"), + Err(String::from("missing unit in duration: 1")), + ); + } +} diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index 30f32f21..da85b2db 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -5,6 +5,7 @@ use std::{ path::PathBuf, process::{Command, Stdio}, str::FromStr, + time::Duration, }; use alloy_genesis::{Genesis, GenesisAccount}; @@ -14,6 +15,10 @@ use serde::{Deserialize, Serialize}; use serde_json::{Deserializer, Value}; use tempfile::NamedTempFile; +pub use self::go_duration::parse_go_duration; + +mod go_duration; + const GENESIS_JSON: &str = include_str!("../genesis.json"); const EXECUTABLE_NAME: &str = "evm"; const EXECUTABLE_ARGS: [&str; 8] = [ @@ -26,9 +31,12 @@ const EXECUTABLE_ARGS: [&str; 8] = [ "--codefile", "-", ]; +const EXECUTABLE_ARGS_BENCH: [&str; 2] = ["run", "--bench"]; +const GAS_USED_MARKER: &str = "EVM gas used:"; +const REVERT_MARKER: &str = "error: execution reverted"; /// The geth EVM state dump structure -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct StateDump { pub root: Bytes, pub accounts: BTreeMap, @@ -74,7 +82,7 @@ impl From for GenesisAccount { } /// Contains the output from geth `emv` invocations -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct EvmOutput { pub output: Bytes, #[serde(rename = "gasUsed")] @@ -99,6 +107,24 @@ pub struct EvmLog { pub account_deployed: Option
, pub output: EvmOutput, pub state_dump: StateDump, + pub raw: String, +} + +impl EvmLog { + pub const EXECUTION_TIME_MARKER: &'static str = "execution time:"; + + pub fn execution_time(&self) -> Result { + for line in self.raw.lines() { + if let Some(value) = line.split("execution time:").nth(1) { + return parse_go_duration(value.trim()); + } + } + + Err(format!( + "execution time marker '{}' not found in raw EVM log", + Self::EXECUTION_TIME_MARKER + )) + } } impl From<&str> for EvmLog { @@ -116,11 +142,36 @@ impl From<&str> for EvmLog { } } - Self { - account_deployed: None, - output: output.expect("the EVM log should contain the output"), - state_dump: state_dump.expect("the EVM log should contain the state dump"), + if let (Some(output), Some(state_dump)) = (output, state_dump) { + return Self { + account_deployed: None, + output, + state_dump, + raw: value.into(), + }; + } + + // Expect benchmark output + for line in value.lines() { + if let Some(gas_line) = line.split(GAS_USED_MARKER).nth(1) { + let gas = gas_line.trim().parse::().unwrap_or_else(|error| { + panic!("invalid output '{value}' for gas used: {error}") + }); + + return EvmLog { + account_deployed: None, + output: EvmOutput { + gas_used: U256::from(gas), + error: value.find(REVERT_MARKER).map(|_| REVERT_MARKER.to_string()), + ..Default::default() + }, + state_dump: Default::default(), + raw: value.into(), + }; + } } + + panic!("neither JSON dump nor benchmark results found"); } } @@ -134,6 +185,7 @@ pub struct Evm { value: Option, gas: Option, create: bool, + bench: bool, } impl Default for Evm { @@ -147,6 +199,7 @@ impl Default for Evm { value: None, gas: None, create: false, + bench: false, } } } @@ -238,6 +291,14 @@ impl Evm { } } + /// Run as a benchmark + pub fn bench(self, flag: bool) -> Self { + Self { + bench: flag, + ..self + } + } + /// Calculate the address of the contract account this deploy call would create pub fn expect_account_created(&self) -> Address { assert!(self.create, "expected a deploy call"); @@ -264,7 +325,11 @@ impl Evm { command.stdin(Stdio::piped()); command.stdout(Stdio::piped()); command.stderr(Stdio::piped()); - command.args(EXECUTABLE_ARGS); + if self.bench { + command.args(EXECUTABLE_ARGS_BENCH); + } else { + command.args(EXECUTABLE_ARGS); + }; command.args(["--prestate", genesis_json_path]); // Dynamic args @@ -313,10 +378,11 @@ impl Evm { "{EXECUTABLE_NAME} command failed: {output:?}", ); - // Set the deployed account let mut log: EvmLog = str::from_utf8(output.stdout.as_slice()) .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} output failed to parse: {err}")) .into(); + + // Set the deployed account log.account_deployed = account_deployed; log } @@ -324,15 +390,16 @@ impl Evm { #[cfg(test)] mod tests { - use std::str::FromStr; + use std::{str::FromStr, time::Duration}; use alloy_genesis::Genesis; use alloy_primitives::{Bytes, B256, U256}; use crate::{Evm, EvmLog, EvmOutput, StateDump}; - const OUTPUT_OK: &str = r#"{"output":"0000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x11d"}"#; - const OUTPUT_REVERTED: &str = r#"{"output":"","gasUsed":"0x2d","error":"execution reverted"}"#; + const OUTPUT_JSON_OK: &str = r#"{"output":"0000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x11d"}"#; + const OUTPUT_JSON_REVERTED: &str = + r#"{"output":"","gasUsed":"0x2d","error":"execution reverted"}"#; const STATE_DUMP: &str = r#" { "root": "eb5d51177cb9049b848ea92f87f9a3f00abfb683d0866c2eddecc5692ad27f86", @@ -356,15 +423,40 @@ mod tests { const EVM_BIN_FIXTURE_INPUT: &str = "0000000000000000000000000000000000000000000000000000000000000001"; const EVM_BIN_RUNTIME_FIXTURE_INPUT: &str = "cde4efa9"; + const OUTPUT_BENCH_OK: &str = r#"EVM gas used: 560071 +execution time: 1.460881ms +allocations: 29 +allocated bytes: 2558 +"#; + const OUTPUT_BENCH_REVERT: &str = r#"EVM gas used: 69 +execution time: 10.11µs +allocations: 43 +allocated bytes: 3711 + + error: execution reverted"#; #[test] fn parse_evm_output_ok() { - serde_json::from_str::(OUTPUT_OK).unwrap(); + serde_json::from_str::(OUTPUT_JSON_OK).unwrap(); } #[test] fn parse_evm_output_revert() { - serde_json::from_str::(OUTPUT_REVERTED).unwrap(); + serde_json::from_str::(OUTPUT_JSON_REVERTED).unwrap(); + } + + #[test] + fn parse_evm_output_bench_ok() { + let log = EvmLog::from(OUTPUT_BENCH_OK); + assert!(log.output.run_success()); + + assert_eq!(log.execution_time().unwrap(), Duration::from_nanos(1460881)); + } + + #[test] + fn parse_evm_output_bench_revert() { + let log = EvmLog::from(OUTPUT_BENCH_REVERT); + assert!(!log.output.run_success()); } #[test] @@ -374,13 +466,13 @@ mod tests { #[test] fn evm_log_from_str() { - let log = format!("{OUTPUT_OK}\n{STATE_DUMP}"); + let log = format!("{OUTPUT_JSON_OK}\n{STATE_DUMP}"); let _ = EvmLog::from(log.as_str()); } #[test] fn generate_genesis() { - let log = format!("{OUTPUT_OK}\n{STATE_DUMP}"); + let log = format!("{OUTPUT_JSON_OK}\n{STATE_DUMP}"); let log = EvmLog::from(log.as_str()); let mut genesis: Genesis = log.state_dump.into(); let storage = genesis From 2428b23bf3107589ac324e978dda8f4aa0206d7c Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Mon, 2 Sep 2024 22:02:31 +0200 Subject: [PATCH 23/27] collect benchmark results Signed-off-by: Cyrill Leutwiler --- Cargo.toml | 3 + crates/differential/src/lib.rs | 103 +++++++++++++++++++++------------ crates/runner/src/lib.rs | 24 +++++--- crates/runner/src/specs.rs | 70 +++++++++++++--------- 4 files changed, 126 insertions(+), 74 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f18fa472..92db4e95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,10 +62,13 @@ env_logger = { version = "0.10.0", default-features = false } serde_stacker = "0.1" criterion = { version = "0.5", features = ["html_reports"] } log = { version = "0.4" } + +# polkadot-sdk and friends codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" } scale-info = { version = "2.11.1", default-features = false } polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "1c4141abeb4c581e503f07af2a3522e6918db591" } +# llvm [workspace.dependencies.inkwell] version = "0.5" default-features = false diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index da85b2db..9676403d 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -31,7 +31,14 @@ const EXECUTABLE_ARGS: [&str; 8] = [ "--codefile", "-", ]; -const EXECUTABLE_ARGS_BENCH: [&str; 2] = ["run", "--bench"]; +const EXECUTABLE_ARGS_BENCH: [&str; 6] = [ + "run", + "--bench", + "--nomemory=false", + "--noreturndata=false", + "--codefile", + "-", +]; const GAS_USED_MARKER: &str = "EVM gas used:"; const REVERT_MARKER: &str = "error: execution reverted"; @@ -107,14 +114,14 @@ pub struct EvmLog { pub account_deployed: Option
, pub output: EvmOutput, pub state_dump: StateDump, - pub raw: String, + pub stderr: String, } impl EvmLog { pub const EXECUTION_TIME_MARKER: &'static str = "execution time:"; pub fn execution_time(&self) -> Result { - for line in self.raw.lines() { + for line in self.stderr.lines() { if let Some(value) = line.split("execution time:").nth(1) { return parse_go_duration(value.trim()); } @@ -125,6 +132,17 @@ impl EvmLog { Self::EXECUTION_TIME_MARKER )) } + + fn parse_gas_used_from_bench(&mut self) { + for line in self.stderr.lines() { + if let Some(gas_line) = line.split(GAS_USED_MARKER).nth(1) { + let gas_used = gas_line.trim().parse::().unwrap_or_else(|error| { + panic!("invalid output '{gas_line}' for gas used: {error}") + }); + self.output.gas_used = U256::from(gas_used); + } + } + } } impl From<&str> for EvmLog { @@ -147,31 +165,19 @@ impl From<&str> for EvmLog { account_deployed: None, output, state_dump, - raw: value.into(), + stderr: value.into(), }; } - // Expect benchmark output - for line in value.lines() { - if let Some(gas_line) = line.split(GAS_USED_MARKER).nth(1) { - let gas = gas_line.trim().parse::().unwrap_or_else(|error| { - panic!("invalid output '{value}' for gas used: {error}") - }); - - return EvmLog { - account_deployed: None, - output: EvmOutput { - gas_used: U256::from(gas), - error: value.find(REVERT_MARKER).map(|_| REVERT_MARKER.to_string()), - ..Default::default() - }, - state_dump: Default::default(), - raw: value.into(), - }; - } - } - - panic!("neither JSON dump nor benchmark results found"); + return EvmLog { + account_deployed: None, + output: EvmOutput { + error: value.find(REVERT_MARKER).map(|_| REVERT_MARKER.to_string()), + ..Default::default() + }, + state_dump: Default::default(), + stderr: Default::default(), + }; } } @@ -234,7 +240,7 @@ impl Evm { /// Set the calldata pub fn input(self, bytes: Bytes) -> Self { Self { - input: Some(bytes), + input: (!bytes.is_empty()).then(|| bytes), ..self } } @@ -330,9 +336,10 @@ impl Evm { } else { command.args(EXECUTABLE_ARGS); }; - command.args(["--prestate", genesis_json_path]); // Dynamic args + command.args(["--prestate", genesis_json_path]); + command.args(["--sender", &self.sender]); if let Some(input) = &self.input { command.args(["--input", hex::encode(input).as_str()]); } @@ -342,7 +349,6 @@ impl Evm { } else { None }; - command.args(["--sender", &self.sender]); match (&self.code, &self.receiver) { (Some(_), None) => {} (None, Some(address)) => { @@ -378,9 +384,16 @@ impl Evm { "{EXECUTABLE_NAME} command failed: {output:?}", ); - let mut log: EvmLog = str::from_utf8(output.stdout.as_slice()) - .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} output failed to parse: {err}")) - .into(); + let stdout = str::from_utf8(output.stdout.as_slice()) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stdout failed to parse: {err}")); + let stderr = str::from_utf8(output.stderr.as_slice()) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stderr failed to parse: {err}")); + + let mut log: EvmLog = stdout.into(); + log.stderr = stderr.into(); + if self.bench { + log.parse_gas_used_from_bench(); + } // Set the deployed account log.account_deployed = account_deployed; @@ -423,17 +436,16 @@ mod tests { const EVM_BIN_FIXTURE_INPUT: &str = "0000000000000000000000000000000000000000000000000000000000000001"; const EVM_BIN_RUNTIME_FIXTURE_INPUT: &str = "cde4efa9"; - const OUTPUT_BENCH_OK: &str = r#"EVM gas used: 560071 + const STDERR_BENCH_OK: &str = r#"EVM gas used: 560071 execution time: 1.460881ms allocations: 29 allocated bytes: 2558 "#; - const OUTPUT_BENCH_REVERT: &str = r#"EVM gas used: 69 + const STDERR_BENCH_REVERT: &str = r#"EVM gas used: 69 execution time: 10.11µs allocations: 43 -allocated bytes: 3711 - - error: execution reverted"#; +allocated bytes: 3711"#; + const STDOUT_BENCH_REVERT: &str = r#" error: execution reverted"#; #[test] fn parse_evm_output_ok() { @@ -447,7 +459,9 @@ allocated bytes: 3711 #[test] fn parse_evm_output_bench_ok() { - let log = EvmLog::from(OUTPUT_BENCH_OK); + let mut log = EvmLog::from(""); + log.stderr = STDERR_BENCH_OK.into(); + log.parse_gas_used_from_bench(); assert!(log.output.run_success()); assert_eq!(log.execution_time().unwrap(), Duration::from_nanos(1460881)); @@ -455,7 +469,9 @@ allocated bytes: 3711 #[test] fn parse_evm_output_bench_revert() { - let log = EvmLog::from(OUTPUT_BENCH_REVERT); + let mut log = EvmLog::from(STDOUT_BENCH_REVERT); + log.stderr = STDERR_BENCH_REVERT.into(); + log.parse_gas_used_from_bench(); assert!(!log.output.run_success()); } @@ -515,4 +531,15 @@ allocated bytes: 3711 .run(); assert!(log_runtime.output.run_success(), "{:?}", log_runtime.output); } + + #[test] + fn bench_flipper() { + let log_runtime = Evm::default() + .code_blob(EVM_BIN_RUNTIME_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) + .bench(true) + .run(); + assert!(log_runtime.output.run_success()); + assert!(log_runtime.execution_time().unwrap() > Duration::from_nanos(0)); + } } diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 9a7c7099..83b0f4ff 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -23,6 +23,8 @@ //! .run(); //! ``` +use std::time::Duration; + use polkadot_sdk::*; use polkadot_sdk::{ pallet_revive::{CollectEvents, ContractExecResult, ContractInstantiateResult, DebugInfo}, @@ -124,27 +126,33 @@ impl VerifyCallExpectation { /// Result of a call #[derive(Clone, Debug)] pub enum CallResult { - Exec(ContractExecResult), - Instantiate(ContractInstantiateResult), + Exec { + result: ContractExecResult, + wall_time: Duration, + }, + Instantiate { + result: ContractInstantiateResult, + wall_time: Duration, + }, } impl CallResult { /// Check if the call was successful fn is_ok(&self) -> bool { match self { - Self::Exec(res) => res.result.is_ok(), - Self::Instantiate(res) => res.result.is_ok(), + Self::Exec { result, .. } => result.result.is_ok(), + Self::Instantiate { result, .. } => result.result.is_ok(), } } /// Get the output of the call fn output(&self) -> Vec { match self { - Self::Exec(res) => res + Self::Exec { result, .. } => result .result .as_ref() .map(|r| r.data.clone()) .unwrap_or_default(), - Self::Instantiate(res) => res + Self::Instantiate { result, .. } => result .result .as_ref() .map(|r| r.result.data.clone()) @@ -154,8 +162,8 @@ impl CallResult { /// Get the gas consumed by the call fn gas_consumed(&self) -> Weight { match self { - Self::Exec(res) => res.gas_consumed, - Self::Instantiate(res) => res.gas_consumed, + Self::Exec { result, .. } => result.gas_consumed, + Self::Instantiate { result, .. } => result.gas_consumed, } } } diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index 7c493aba..41a236c1 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -1,3 +1,5 @@ +use std::time::Instant; + use revive_differential::{Evm, EvmLog}; use serde::{Deserialize, Serialize}; @@ -131,8 +133,8 @@ impl TestAccountId { .get(*n) .expect("should provide valid index into call results") { - CallResult::Exec(_) => panic!("call #{n} should be an instantiation"), - CallResult::Instantiate(res) => res + CallResult::Exec { .. } => panic!("call #{n} should be an instantiation"), + CallResult::Instantiate { result, .. } => result .result .as_ref() .expect("call #{n} reverted") @@ -347,17 +349,25 @@ impl Specs { code, data, salt, - } => results.push(CallResult::Instantiate(Contracts::bare_instantiate( - RuntimeOrigin::signed(origin.to_account_id(&results)), - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - code.into(), - data, - salt, - DebugInfo::Skip, - CollectEvents::Skip, - ))), + } => { + let origin = RuntimeOrigin::signed(origin.to_account_id(&results)); + let time_start = Instant::now(); + let result = Contracts::bare_instantiate( + origin, + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + code.into(), + data, + salt, + DebugInfo::Skip, + CollectEvents::Skip, + ); + results.push(CallResult::Instantiate { + result, + wall_time: time_start.elapsed(), + }) + } Call { origin, dest, @@ -365,16 +375,25 @@ impl Specs { gas_limit, storage_deposit_limit, data, - } => results.push(CallResult::Exec(Contracts::bare_call( - RuntimeOrigin::signed(origin.to_account_id(&results)), - dest.to_account_id(&results), - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - data, - DebugInfo::Skip, - CollectEvents::Skip, - ))), + } => { + let origin = RuntimeOrigin::signed(origin.to_account_id(&results)); + let dest = dest.to_account_id(&results); + let time_start = Instant::now(); + let result = Contracts::bare_call( + origin, + dest, + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + data, + DebugInfo::Skip, + CollectEvents::Skip, + ); + results.push(CallResult::Exec { + result, + wall_time: time_start.elapsed(), + }); + } VerifyCall(expectation) => { expectation.verify(results.last().expect("No call to verify")); } @@ -402,11 +421,6 @@ impl Specs { } }); - match &results[0] { - CallResult::Instantiate(res) => res.result.as_ref().unwrap().account_id.clone(), - _ => todo!(), - }; - results } } From c17723fc249efdbacded40ba6aef931ddcb13caa Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Tue, 3 Sep 2024 11:48:13 +0200 Subject: [PATCH 24/27] call verification does not compare output bytes by default Signed-off-by: Cyrill Leutwiler --- crates/runner/src/lib.rs | 49 ++++++++++++++++++++++++++++++++++---- crates/runner/src/specs.rs | 6 ++--- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 83b0f4ff..94182583 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -25,6 +25,7 @@ use std::time::Duration; +use hex::{FromHex, FromHexError, ToHex}; use polkadot_sdk::*; use polkadot_sdk::{ pallet_revive::{CollectEvents, ContractExecResult, ContractInstantiateResult, DebugInfo}, @@ -92,17 +93,55 @@ pub struct VerifyCallExpectation { /// When provided, the expected gas consumed pub gas_consumed: Option, /// When provided, the expected output - #[serde(default, with = "hex::serde")] - pub output: Vec, + #[serde(default, with = "hex")] + pub output: OptionalHex, ///Expected call result pub success: bool, } +#[derive(Clone, Debug, Default, PartialEq)] +pub struct OptionalHex(Option>); + +impl FromHex for OptionalHex { + type Error = FromHexError; + + fn from_hex>(hex: T) -> Result { + let value = hex::decode(hex)?; + Ok(Self(Some(value))) + } +} + +impl ToHex for &OptionalHex { + fn encode_hex>(&self) -> T { + match self.0.as_ref() { + None => T::from_iter("".chars()), + Some(data) => T::from_iter(hex::encode(data).chars()), + } + } + + fn encode_hex_upper>(&self) -> T { + match self.0.as_ref() { + None => T::from_iter("".chars()), + Some(data) => T::from_iter(hex::encode_upper(data).chars()), + } + } +} + +impl Into for alloy_primitives::Bytes { + fn into(self) -> OptionalHex { + if self.is_empty() { + OptionalHex(None) + } else { + OptionalHex(Some(self.into())) + } + } +} + impl Default for VerifyCallExpectation { fn default() -> Self { Self { gas_consumed: None, - output: vec![], + output: OptionalHex(None), success: true, } } @@ -119,7 +158,9 @@ impl VerifyCallExpectation { if let Some(gas_consumed) = self.gas_consumed { assert_eq!(gas_consumed, result.gas_consumed()); } - assert_eq!(self.output, result.output()); + if let OptionalHex(Some(data)) = self.output { + assert_eq!(data, result.output()); + } } } diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index 41a236c1..cd29611f 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -181,10 +181,8 @@ impl Specs { if matches!( item, SpecsAction::Instantiate { .. } | SpecsAction::Call { .. } - ) && matches!( - next_item, - Some(SpecsAction::Instantiate { .. }) | Some(SpecsAction::Call { .. }) - ) && !self.differential + ) && !matches!(next_item, Some(SpecsAction::VerifyCall { .. })) + && !self.differential { return vec![ item.clone(), From 30ec3f25b65d1e3e6a0a648fbfa72a727cfa2d47 Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Tue, 3 Sep 2024 16:06:59 +0200 Subject: [PATCH 25/27] clippy Signed-off-by: Cyrill Leutwiler --- crates/differential/src/go_duration.rs | 41 +++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/crates/differential/src/go_duration.rs b/crates/differential/src/go_duration.rs index 121c0ef1..f7c15d04 100644 --- a/crates/differential/src/go_duration.rs +++ b/crates/differential/src/go_duration.rs @@ -6,7 +6,7 @@ use std::time::Duration; /// - https://crates.io/crates/go-parse-duration (fixed an utf8 bug) /// - https://github.com/golang/go/blob/master/src/time/format.go pub fn parse_go_duration(value: &str) -> Result { - parse_duration(value).map(|ns| Duration::from_nanos(ns.abs() as u64)) + parse_duration(value).map(|ns| Duration::from_nanos(ns.unsigned_abs())) } fn parse_duration(string: &str) -> Result { @@ -16,8 +16,8 @@ fn parse_duration(string: &str) -> Result { let mut neg = false; // Consume [-+]? - if s != "" { - let c = *s.as_bytes().get(0).unwrap(); + if !s.is_empty() { + let c = *s.as_bytes().first().unwrap(); if c == b'-' || c == b'+' { neg = c == b'-'; s = &s[1..]; @@ -27,10 +27,10 @@ fn parse_duration(string: &str) -> Result { if s == "0" { return Ok(0); } - if s == "" { + if s.is_empty() { return Err(format!("invalid duration: {string}")); } - while s != "" { + while !s.is_empty() { // integers before, after decimal point let mut v: i64; let mut f: i64 = 0; @@ -38,8 +38,8 @@ fn parse_duration(string: &str) -> Result { let mut scale: f64 = 1f64; // The next character must be [0-9.] - let c = *s.as_bytes().get(0).unwrap(); - if !(c == b'.' || b'0' <= c && c <= b'9') { + let c = *s.as_bytes().first().unwrap(); + if !(c == b'.' || c.is_ascii_digit()) { return Err(format!("invalid duration: {string}")); } // Consume [0-9]* @@ -57,15 +57,14 @@ fn parse_duration(string: &str) -> Result { // Consume (\.[0-9]*)? let mut post = false; - if s != "" && *s.as_bytes().get(0).unwrap() == b'.' { + if !s.is_empty() && *s.as_bytes().first().unwrap() == b'.' { s = &s[1..]; let pl = s.len(); - match leading_fraction(s) { - (f_, scale_, s_) => { - f = f_; - scale = scale_; - s = s_; - } + let (f_, scale_, s_) = leading_fraction(s); + { + f = f_; + scale = scale_; + s = s_; } post = pl != s.len(); } @@ -78,7 +77,7 @@ fn parse_duration(string: &str) -> Result { let mut i = 0; while i < s.len() { let c = *s.as_bytes().get(i).unwrap(); - if c == b'.' || b'0' <= c && c <= b'9' { + if c == b'.' || c.is_ascii_digit() { break; } i += 1; @@ -101,7 +100,7 @@ fn parse_duration(string: &str) -> Result { return Err(format!("unknown unit {u} in duration {string}")); } }; - if v > (1 << 63 - 1) / unit { + if v > (1 << (63 - 1)) / unit { // overflow return Err(format!("invalid duration {string}")); } @@ -132,10 +131,10 @@ fn leading_int(s: &str) -> Result<(i64, &str), String> { let mut i = 0; while i < s.len() { let c = s.chars().nth(i).unwrap(); - if c < '0' || c > '9' { + if !c.is_ascii_digit() { break; } - if x > (1 << 63 - 1) / 10 { + if x > (1 << (63 - 1)) / 10 { return Err("overflow".into()); } let d = i64::from(c.to_digit(10).unwrap()); @@ -156,13 +155,13 @@ fn leading_fraction(s: &str) -> (i64, f64, &str) { let mut overflow = false; while i < s.len() { let c = s.chars().nth(i).unwrap(); - if c < '0' || c > '9' { + if !c.is_ascii_digit() { break; } if overflow { continue; } - if x > (1 << 63 - 1) / 10 { + if x > (1 << (63 - 1)) / 10 { // It's possible for overflow to give a positive number, so take care. overflow = true; continue; @@ -182,7 +181,7 @@ fn leading_fraction(s: &str) -> (i64, f64, &str) { #[cfg(test)] mod tests { - use super::*; + use super::parse_duration; #[test] fn test_parse_duration() { From c0a3dfdc425cf7a85dbf090637225a8454e99cf5 Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Tue, 3 Sep 2024 16:19:54 +0200 Subject: [PATCH 26/27] benchmark vs. geth evm Signed-off-by: Cyrill Leutwiler --- Cargo.lock | 2 +- Makefile | 21 ++-- crates/benchmarks/BENCHMARKS.md | 73 ++++++++++++ crates/benchmarks/Cargo.toml | 13 +- crates/benchmarks/benches/execute.rs | 150 +++++------------------ crates/benchmarks/benches/prepare.rs | 171 --------------------------- crates/benchmarks/src/lib.rs | 93 +++++++++++---- crates/differential/genesis.json | 2 +- crates/differential/src/lib.rs | 85 ++++++++----- crates/integration/src/cases.rs | 4 +- crates/runner/src/lib.rs | 8 +- 11 files changed, 247 insertions(+), 375 deletions(-) delete mode 100644 crates/benchmarks/benches/prepare.rs diff --git a/Cargo.lock b/Cargo.lock index 139326f2..98637b40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7102,9 +7102,9 @@ dependencies = [ "alloy-primitives 0.8.0", "criterion", "hex", - "polkavm 0.10.0", "revive-differential", "revive-integration", + "revive-runner", ] [[package]] diff --git a/Makefile b/Makefile index 530913b7..101e1217 100644 --- a/Makefile +++ b/Makefile @@ -26,23 +26,16 @@ test-workspace: install test-cli: install npm run test:cli -bench-prepare: install-bin - cargo criterion --bench prepare --features bench-evm,bench-pvm --message-format=json \ - | criterion-table > crates/benchmarks/PREPARE.md +bench-pvm: install-bin + cargo criterion --bench execute --features bench-pvm-interpreter --message-format=json \ + | criterion-table > crates/benchmarks/PVM.md -bench-execute: install-bin - cargo criterion --bench execute --features bench-evm,bench-pvm --message-format=json \ - | criterion-table > crates/benchmarks/EXECUTE.md - -bench-extensive: install-bin - cargo criterion --all --all-features --message-format=json \ - | criterion-table > crates/benchmarks/BENCHMARKS.md - -bench-quick: install-bin - cargo criterion --all --features bench-evm +bench-evm: install-bin + cargo criterion --bench execute --features bench-evm --message-format=json \ + | criterion-table > crates/benchmarks/EVM.md bench: install-bin - cargo criterion --all --features bench-evm,bench-pvm --message-format=json \ + cargo criterion --all --all-features --message-format=json \ | criterion-table > crates/benchmarks/BENCHMARKS.md clippy: diff --git a/crates/benchmarks/BENCHMARKS.md b/crates/benchmarks/BENCHMARKS.md index e69de29b..568a2545 100644 --- a/crates/benchmarks/BENCHMARKS.md +++ b/crates/benchmarks/BENCHMARKS.md @@ -0,0 +1,73 @@ +# Benchmarks + +## Table of Contents + +- [Benchmark Results](#benchmark-results) + - [Baseline](#baseline) + - [OddPorduct](#oddporduct) + - [TriangleNumber](#trianglenumber) + - [FibonacciRecursive](#fibonaccirecursive) + - [FibonacciIterative](#fibonacciiterative) + - [FibonacciBinet](#fibonaccibinet) + - [SHA1](#sha1) + +## Benchmark Results + +### Baseline + +| | `EVM` | `PVMInterpreter` | +|:--------|:------------------------|:-------------------------------- | +| **`0`** | `5.97 us` (✅ **1.00x**) | `27.04 us` (❌ *4.53x slower*) | + +### OddPorduct + +| | `EVM` | `PVMInterpreter` | +|:-------------|:--------------------------|:-------------------------------- | +| **`10000`** | `4.26 ms` (✅ **1.00x**) | `2.88 ms` (✅ **1.48x faster**) | +| **`100000`** | `42.37 ms` (✅ **1.00x**) | `28.35 ms` (✅ **1.49x faster**) | +| **`300000`** | `127.88 ms` (✅ **1.00x**) | `88.43 ms` (✅ **1.45x faster**) | + +### TriangleNumber + +| | `EVM` | `PVMInterpreter` | +|:-------------|:--------------------------|:-------------------------------- | +| **`10000`** | `2.85 ms` (✅ **1.00x**) | `2.37 ms` (✅ **1.20x faster**) | +| **`100000`** | `27.85 ms` (✅ **1.00x**) | `23.01 ms` (✅ **1.21x faster**) | +| **`360000`** | `103.01 ms` (✅ **1.00x**) | `83.66 ms` (✅ **1.23x faster**) | + +### FibonacciRecursive + +| | `EVM` | `PVMInterpreter` | +|:---------|:--------------------------|:--------------------------------- | +| **`12`** | `195.19 us` (✅ **1.00x**) | `333.53 us` (❌ *1.71x slower*) | +| **`16`** | `1.22 ms` (✅ **1.00x**) | `1.97 ms` (❌ *1.62x slower*) | +| **`20`** | `8.14 ms` (✅ **1.00x**) | `13.20 ms` (❌ *1.62x slower*) | +| **`24`** | `55.09 ms` (✅ **1.00x**) | `88.56 ms` (❌ *1.61x slower*) | + +### FibonacciIterative + +| | `EVM` | `PVMInterpreter` | +|:----------|:-------------------------|:--------------------------------- | +| **`64`** | `33.39 us` (✅ **1.00x**) | `86.02 us` (❌ *2.58x slower*) | +| **`128`** | `52.91 us` (✅ **1.00x**) | `126.38 us` (❌ *2.39x slower*) | +| **`256`** | `82.33 us` (✅ **1.00x**) | `208.74 us` (❌ *2.54x slower*) | + +### FibonacciBinet + +| | `EVM` | `PVMInterpreter` | +|:----------|:-------------------------|:--------------------------------- | +| **`64`** | `32.29 us` (✅ **1.00x**) | `161.75 us` (❌ *5.01x slower*) | +| **`128`** | `36.02 us` (✅ **1.00x**) | `172.59 us` (❌ *4.79x slower*) | +| **`256`** | `41.21 us` (✅ **1.00x**) | `185.30 us` (❌ *4.50x slower*) | + +### SHA1 + +| | `EVM` | `PVMInterpreter` | +|:----------|:--------------------------|:--------------------------------- | +| **`1`** | `160.17 us` (✅ **1.00x**) | `403.46 us` (❌ *2.52x slower*) | +| **`64`** | `286.69 us` (✅ **1.00x**) | `479.79 us` (❌ *1.67x slower*) | +| **`512`** | `1.18 ms` (✅ **1.00x**) | `1.37 ms` (❌ *1.16x slower*) | + +--- +Made with [criterion-table](https://github.com/nu11ptr/criterion-table) + diff --git a/crates/benchmarks/Cargo.toml b/crates/benchmarks/Cargo.toml index bc08a8c2..f10cf284 100644 --- a/crates/benchmarks/Cargo.toml +++ b/crates/benchmarks/Cargo.toml @@ -9,17 +9,16 @@ description = "revive compiler benchmarks" [features] default = ["bench-pvm-interpreter"] -bench-pvm-interpreter = [] -bench-pvm = [] +bench-pvm-interpreter = ["revive-runner"] bench-evm = ["revive-differential"] -bench-extensive = [] [dependencies] hex = { workspace = true } -polkavm = { workspace = true } +alloy-primitives = { workspace = true } + revive-integration = { workspace = true } revive-differential = { workspace = true, optional = true } -alloy-primitives = { workspace = true } +revive-runner = { workspace = true, optional = true } [dev-dependencies] criterion = { workspace = true } @@ -27,7 +26,3 @@ criterion = { workspace = true } [[bench]] name = "execute" harness = false - -[[bench]] -name = "prepare" -harness = false diff --git a/crates/benchmarks/benches/execute.rs b/crates/benchmarks/benches/execute.rs index 56af6eaf..5bb05051 100644 --- a/crates/benchmarks/benches/execute.rs +++ b/crates/benchmarks/benches/execute.rs @@ -1,104 +1,42 @@ +#![cfg(any(feature = "bench-pvm-interpreter", feature = "bench-evm"))] + use alloy_primitives::U256; use criterion::{ - criterion_group, criterion_main, measurement::Measurement, BenchmarkGroup, BenchmarkId, - Criterion, + criterion_group, criterion_main, + measurement::{Measurement, WallTime}, + BenchmarkGroup, BenchmarkId, Criterion, }; use revive_integration::cases::Contract; -fn bench(mut group: BenchmarkGroup<'_, M>, parameters: &[P], labels: &[L], contract: I) -where +fn bench( + mut group: BenchmarkGroup<'_, WallTime>, + parameters: &[P], + labels: &[L], + contract: I, +) where P: Clone, L: std::fmt::Display, I: Fn(P) -> Contract, - M: Measurement, { assert_eq!(parameters.len(), labels.len()); + group.sample_size(10); + for (p, l) in parameters.iter().zip(labels.iter()) { + let contract = contract(p.clone()); + #[cfg(feature = "bench-evm")] - { - let contract = contract(p.clone()); - group.bench_with_input(BenchmarkId::new("EVM", l), p, move |b, _| { - b.iter(|| { - revive_differential::execute(revive_differential::prepare( - contract.evm_runtime.clone(), - contract.calldata.clone(), - )); - }); - }); - } - - #[cfg(not(feature = "bench-extensive"))] - { - #[cfg(all(feature = "bench-pvm-interpreter", not(feature = "bench-extensive")))] - { - let contract = contract(p.clone()); - let (transaction, mut instance, export) = revive_benchmarks::prepare_pvm( - &contract.pvm_runtime, - contract.calldata, - polkavm::BackendKind::Interpreter, - ); - group.bench_with_input(BenchmarkId::new("PVMInterpreter", l), p, |b, _| { - b.iter(|| { - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - - #[cfg(all(feature = "bench-pvm", not(feature = "bench-extensive")))] - { - let contract = contract(p.clone()); - let (transaction, mut instance, export) = revive_benchmarks::prepare_pvm( - &contract.pvm_runtime, - contract.calldata, - polkavm::BackendKind::Compiler, - ); - group.bench_with_input(BenchmarkId::new("PVM", l), p, |b, _| { - b.iter(|| { - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - } - #[cfg(feature = "bench-extensive")] - { - use revive_benchmarks::instantiate_engine; - use revive_integration::mock_runtime::{instantiate_module, recompile_code, State}; - - #[cfg(feature = "bench-pvm-interpreter")] - { - let contract = contract(p.clone()); - let engine = instantiate_engine(polkavm::BackendKind::Interpreter); - let module = recompile_code(&contract.pvm_runtime, &engine); - let transaction = State::default() - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata); - group.bench_with_input(BenchmarkId::new("PVMInterpreter", l), p, |b, _| { - b.iter(|| { - let (mut instance, export) = instantiate_module(&module, &engine); - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - - #[cfg(feature = "bench-pvm")] - { - let contract = contract(p.clone()); - let engine = instantiate_engine(polkavm::BackendKind::Compiler); - let module = recompile_code(&contract.pvm_runtime, &engine); - let transaction = State::default() - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata); - group.bench_with_input(BenchmarkId::new("PVM", l), p, |b, _| { - b.iter(|| { - let (mut instance, export) = instantiate_module(&module, &engine); - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - } + group.bench_with_input(BenchmarkId::new("EVM", l), p, |b, _| { + let code = &contract.evm_runtime; + let input = &contract.calldata; + b.iter_custom(|iters| revive_benchmarks::measure_evm(code, input, iters)); + }); + + #[cfg(feature = "bench-pvm-interpreter")] + group.bench_with_input(BenchmarkId::new("PVMInterpreter", l), p, |b, _| { + let specs = revive_benchmarks::create_specs(&contract); + b.iter_custom(|iters| revive_benchmarks::measure_pvm(&specs, iters)); + }); } group.finish(); @@ -108,14 +46,6 @@ fn group<'error, M>(c: &'error mut Criterion, group_name: &str) -> BenchmarkG where M: Measurement, { - #[cfg(feature = "bench-extensive")] - { - let mut group = c.benchmark_group(group_name); - group.sample_size(10); - group - } - - #[cfg(not(feature = "bench-extensive"))] return c.benchmark_group(group_name); } @@ -128,33 +58,21 @@ fn bench_baseline(c: &mut Criterion) { fn bench_odd_product(c: &mut Criterion) { let group = group(c, "OddPorduct"); - #[cfg(feature = "bench-extensive")] - let parameters = &[300000, 1200000, 12000000, 180000000, 720000000]; - #[cfg(not(feature = "bench-extensive"))] - let parameters = &[10_000, 100_000]; + let parameters = &[10_000, 100_000, 300000]; bench(group, parameters, parameters, Contract::odd_product); } fn bench_triangle_number(c: &mut Criterion) { let group = group(c, "TriangleNumber"); - #[cfg(feature = "bench-extensive")] - let parameters = &[360000, 1440000, 14400000, 216000000, 864000000]; - #[cfg(not(feature = "bench-extensive"))] - let parameters = &[10_000, 100_000]; + let parameters = &[10_000, 100_000, 360000]; bench(group, parameters, parameters, Contract::triangle_number); } fn bench_fibonacci_recurisve(c: &mut Criterion) { let group = group(c, "FibonacciRecursive"); - #[cfg(feature = "bench-extensive")] - let parameters = [24, 27, 31, 36, 39] - .iter() - .map(|p| U256::from(*p)) - .collect::>(); - #[cfg(not(feature = "bench-extensive"))] - let parameters = [12, 16, 20] + let parameters = [12, 16, 20, 24] .iter() .map(|p| U256::from(*p)) .collect::>(); @@ -164,12 +82,6 @@ fn bench_fibonacci_recurisve(c: &mut Criterion) { fn bench_fibonacci_iterative(c: &mut Criterion) { let group = group(c, "FibonacciIterative"); - #[cfg(feature = "bench-extensive")] - let parameters = [256, 162500, 650000, 6500000, 100000000, 400000000] - .iter() - .map(|p| U256::from(*p)) - .collect::>(); - #[cfg(not(feature = "bench-extensive"))] let parameters = [64, 128, 256] .iter() .map(|p| U256::from(*p)) @@ -193,7 +105,9 @@ fn bench_sha1(c: &mut Criterion) { let parameters = &[vec![0xff], vec![0xff; 64], vec![0xff; 512]]; let labels = parameters.iter().map(|p| p.len()).collect::>(); - bench(group, parameters, &labels, Contract::sha1); + bench(group, parameters, &labels, |input| { + Contract::sha1(input.into()) + }); } criterion_group!( diff --git a/crates/benchmarks/benches/prepare.rs b/crates/benchmarks/benches/prepare.rs deleted file mode 100644 index 4de4301f..00000000 --- a/crates/benchmarks/benches/prepare.rs +++ /dev/null @@ -1,171 +0,0 @@ -use alloy_primitives::U256; -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; - -use revive_integration::cases::Contract; - -fn bench( - c: &mut Criterion, - group_name: &str, - #[cfg(feature = "bench-evm")] evm_runtime: Vec, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] pvm_runtime: Vec, -) { - let mut group = c.benchmark_group(group_name); - let code_size = 0; - - #[cfg(feature = "bench-evm")] - group.bench_with_input( - BenchmarkId::new("Evm", code_size), - &evm_runtime, - |b, code| b.iter(|| revive_differential::prepare(code.clone(), Vec::new())), - ); - - #[cfg(feature = "bench-pvm-interpreter")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Interpreter); - group.bench_with_input( - BenchmarkId::new("PVMInterpreterCompile", code_size), - &(&pvm_runtime, engine), - |b, (code, engine)| { - b.iter(|| { - revive_integration::mock_runtime::recompile_code(code, engine); - }); - }, - ); - } - - #[cfg(feature = "bench-pvm-interpreter")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Interpreter); - let module = revive_integration::mock_runtime::recompile_code(&pvm_runtime, &engine); - group.bench_with_input( - BenchmarkId::new("PVMInterpreterInstantiate", code_size), - &(module, engine), - |b, (module, engine)| { - b.iter(|| { - revive_integration::mock_runtime::instantiate_module(module, engine); - }); - }, - ); - } - - #[cfg(feature = "bench-pvm")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Compiler); - group.bench_with_input( - BenchmarkId::new("PVMCompile", code_size), - &(&pvm_runtime, engine), - |b, (code, engine)| { - b.iter(|| { - revive_integration::mock_runtime::recompile_code(code, engine); - }); - }, - ); - } - - #[cfg(feature = "bench-pvm")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Compiler); - let module = revive_integration::mock_runtime::recompile_code(&pvm_runtime, &engine); - group.bench_with_input( - BenchmarkId::new("PVMInstantiate", code_size), - &(module, engine), - |b, (module, engine)| { - b.iter(|| { - revive_integration::mock_runtime::instantiate_module(module, engine); - }); - }, - ); - } - - group.finish(); -} - -fn bench_baseline(c: &mut Criterion) { - bench( - c, - "PrepareBaseline", - #[cfg(feature = "bench-evm")] - Contract::baseline().evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::baseline().pvm_runtime, - ); -} - -fn bench_odd_product(c: &mut Criterion) { - bench( - c, - "PrepareOddProduct", - #[cfg(feature = "bench-evm")] - Contract::odd_product(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::baseline().pvm_runtime, - ); -} - -fn bench_triangle_number(c: &mut Criterion) { - bench( - c, - "PrepareTriangleNumber", - #[cfg(feature = "bench-evm")] - Contract::triangle_number(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::triangle_number(0).pvm_runtime, - ); -} - -fn bench_fibonacci_recursive(c: &mut Criterion) { - bench( - c, - "PrepareFibonacciRecursive", - #[cfg(feature = "bench-evm")] - Contract::fib_recursive(U256::ZERO).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::fib_recursive(U256::ZERO).pvm_runtime, - ); -} - -fn bench_fibonacci_iterative(c: &mut Criterion) { - bench( - c, - "PrepareFibonacciIterative", - #[cfg(feature = "bench-evm")] - Contract::fib_iterative(U256::ZERO).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::fib_iterative(U256::ZERO).pvm_runtime, - ); -} - -fn bench_fibonacci_binet(c: &mut Criterion) { - bench( - c, - "PrepareFibonacciBinet", - #[cfg(feature = "bench-evm")] - Contract::fib_binet(U256::ZERO).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::fib_binet(U256::ZERO).pvm_runtime, - ); -} - -fn bench_sha1(c: &mut Criterion) { - bench( - c, - "PrepareSHA1", - #[cfg(feature = "bench-evm")] - Contract::sha1(Default::default()).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::sha1(Default::default()).pvm_runtime, - ); -} - -criterion_group!( - name = prepare; - config = Criterion::default(); - targets = bench_baseline, - bench_odd_product, - bench_triangle_number, - bench_fibonacci_recursive, - bench_fibonacci_iterative, - bench_fibonacci_binet, - bench_sha1 -); -criterion_main!(prepare); diff --git a/crates/benchmarks/src/lib.rs b/crates/benchmarks/src/lib.rs index 18805090..dc0a24a4 100644 --- a/crates/benchmarks/src/lib.rs +++ b/crates/benchmarks/src/lib.rs @@ -1,28 +1,71 @@ -use polkavm::{BackendKind, Config, Engine, ExportIndex, Instance, SandboxKind}; -use revive_integration::mock_runtime::{self, TransactionBuilder}; -use revive_integration::mock_runtime::{State, Transaction}; - -pub fn prepare_pvm( - code: &[u8], - input: Vec, - backend: BackendKind, -) -> (TransactionBuilder, Instance, ExportIndex) { - let mut config = Config::new(); - config.set_backend(Some(backend)); - config.set_sandbox(Some(SandboxKind::Linux)); - - let (instance, export_index) = mock_runtime::prepare(code, Some(config)); - let transaction = State::default() - .transaction() - .with_default_account(code) - .calldata(input); - - (transaction, instance, export_index) +#[cfg(feature = "bench-pvm-interpreter")] +pub fn create_specs(contract: &revive_integration::cases::Contract) -> revive_runner::Specs { + use revive_runner::*; + use SpecsAction::*; + Specs { + differential: false, + actions: vec![ + Instantiate { + code: Code::Bytes(contract.pvm_runtime.to_vec()), + origin: TestAccountId::Alice, + data: Default::default(), + value: Default::default(), + gas_limit: Default::default(), + storage_deposit_limit: Default::default(), + salt: Default::default(), + }, + Call { + origin: TestAccountId::Alice, + dest: TestAccountId::Instantiated(0), + data: contract.calldata.to_vec(), + value: Default::default(), + gas_limit: Default::default(), + storage_deposit_limit: Default::default(), + }, + ], + ..Default::default() + } } -pub fn instantiate_engine(backend: BackendKind) -> Engine { - let mut config = Config::new(); - config.set_backend(Some(backend)); - config.set_sandbox(Some(SandboxKind::Linux)); - mock_runtime::setup(Some(config)) +#[cfg(feature = "bench-pvm-interpreter")] +pub fn measure_pvm(specs: &revive_runner::Specs, iters: u64) -> std::time::Duration { + use revive_runner::*; + let mut total_time = std::time::Duration::default(); + + for _ in 0..iters { + let results = specs.clone().run(); + + let CallResult::Exec { result, wall_time } = + results.get(1).expect("contract should have been called") + else { + panic!("expected a execution result"); + }; + let ret = result.result.as_ref().unwrap(); + assert!(!ret.did_revert()); + + total_time += *wall_time; + } + + total_time +} + +#[cfg(feature = "bench-evm")] +pub fn measure_evm(code: &[u8], input: &[u8], iters: u64) -> std::time::Duration { + let mut total_time = std::time::Duration::default(); + + let code = hex::encode(code); + + for _ in 0..iters { + let log = revive_differential::Evm::default() + .code_blob(code.as_bytes().to_vec()) + .input(input.to_vec().into()) + .genesis_path("/tmp/genesis.json".into()) + .bench(true) + .run(); + assert!(log.output.run_success(), "evm run failed: {log:?}"); + + total_time += log.execution_time().unwrap(); + } + + total_time } diff --git a/crates/differential/genesis.json b/crates/differential/genesis.json index 3088ca17..6d61c4e8 100644 --- a/crates/differential/genesis.json +++ b/crates/differential/genesis.json @@ -21,7 +21,7 @@ "coinbase": "0x0000000000000000000000000000000000000000", "difficulty": "0x20000", "extraData": "", - "gasLimit": "0x2fefd8", + "gasLimit": "0xffffffff", "nonce": "0x0000000000000042", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index 9676403d..757713fd 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -13,7 +13,7 @@ use alloy_primitives::{hex::ToHexExt, Address, Bytes, B256, U256}; use alloy_serde::storage::deserialize_storage_map; use serde::{Deserialize, Serialize}; use serde_json::{Deserializer, Value}; -use tempfile::NamedTempFile; +use tempfile::{NamedTempFile, TempPath}; pub use self::go_duration::parse_go_duration; @@ -120,6 +120,7 @@ pub struct EvmLog { impl EvmLog { pub const EXECUTION_TIME_MARKER: &'static str = "execution time:"; + /// Parse the reported execution time from stderr (requires --bench) pub fn execution_time(&self) -> Result { for line in self.stderr.lines() { if let Some(value) = line.split("execution time:").nth(1) { @@ -169,7 +170,7 @@ impl From<&str> for EvmLog { }; } - return EvmLog { + EvmLog { account_deployed: None, output: EvmOutput { error: value.find(REVERT_MARKER).map(|_| REVERT_MARKER.to_string()), @@ -177,13 +178,14 @@ impl From<&str> for EvmLog { }, state_dump: Default::default(), stderr: Default::default(), - }; + } } } /// Builder for running contracts in geth `evm` pub struct Evm { - genesis_json: String, + genesis_json: Option, + genesis_path: Option, code: Option>, input: Option, receiver: Option, @@ -197,7 +199,8 @@ pub struct Evm { impl Default for Evm { fn default() -> Self { Self { - genesis_json: GENESIS_JSON.to_string(), + genesis_json: Some(GENESIS_JSON.to_string()), + genesis_path: None, code: None, input: None, receiver: None, @@ -216,19 +219,6 @@ impl Evm { Self::default().genesis_json(genesis) } - /// Run the code found in `code_file` - pub fn code_file(self, path: PathBuf) -> Self { - Self { - code: std::fs::read_to_string(&path) - .unwrap_or_else(|err| { - panic!("can not read EVM byte code from file {path:?}: {err}") - }) - .into_bytes() - .into(), - ..self - } - } - /// Run the `code` pub fn code_blob(self, blob: Vec) -> Self { Self { @@ -240,7 +230,7 @@ impl Evm { /// Set the calldata pub fn input(self, bytes: Bytes) -> Self { Self { - input: (!bytes.is_empty()).then(|| bytes), + input: (!bytes.is_empty()).then_some(bytes), ..self } } @@ -273,10 +263,20 @@ impl Evm { pub fn genesis_json(self, genesis: Genesis) -> Self { let genesis_json = serde_json::to_string(&genesis).expect("state dump should be valid"); // TODO: Investigate - let genesis_json = genesis_json.replace("\"0x0\"", "0"); + let genesis_json = genesis_json.replace("\"0x0\"", "0").into(); Self { genesis_json, + genesis_path: None, + ..self + } + } + + /// Provide a path to the genesis file to be used + pub fn genesis_path(self, path: PathBuf) -> Self { + Self { + genesis_path: Some(path), + genesis_json: None, ..self } } @@ -309,7 +309,13 @@ impl Evm { pub fn expect_account_created(&self) -> Address { assert!(self.create, "expected a deploy call"); let sender = Address::from_str(&self.sender).expect("sender address should be valid"); - let genesis: Genesis = serde_json::from_str(&self.genesis_json).unwrap(); + let genesis: Genesis = match (self.genesis_json.as_ref(), self.genesis_path.as_ref()) { + (Some(json), None) => serde_json::from_str(json).unwrap(), + (None, Some(path)) => { + serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() + } + _ => panic!("provided a genesis json and a genesis json path"), + }; let nonce = genesis .alloc .get(&sender) @@ -318,19 +324,37 @@ impl Evm { sender.create(nonce) } - /// Run the call in a geth `evm` subprocess + /// Return the path to the genesis file; + /// writes the genesis file into a tmpdir if necessary. + /// + /// `TempPath`` will delete on drop, so need to keep it around + fn write_genesis_file(&self, temp_path: &mut Option) -> String { + match (self.genesis_json.as_ref(), self.genesis_path.as_ref()) { + (Some(json), None) => { + let mut temp_file = NamedTempFile::new().unwrap(); + temp_file.write_all(json.as_bytes()).unwrap(); + let path = temp_file.into_temp_path(); + *temp_path = Some(path); + temp_path.as_ref().unwrap().display().to_string() + } + (None, Some(path)) => path.display().to_string(), + _ => panic!("provided a genesis json and a genesis json path"), + } + } + + /// Run the call in a geth `evm` subprocess. + /// + /// Definitively not a hairy plumbing function. pub fn run(self) -> EvmLog { - // Write genesis.json to disk - let mut temp_file = NamedTempFile::new().unwrap(); - temp_file.write_all(self.genesis_json.as_bytes()).unwrap(); - let path = temp_file.into_temp_path(); - let genesis_json_path = &path.display().to_string(); + let mut temp_path = None; + let genesis_json_path = &self.write_genesis_file(&mut temp_path); // Static args let mut command = Command::new(PathBuf::from(EXECUTABLE_NAME)); - command.stdin(Stdio::piped()); - command.stdout(Stdio::piped()); - command.stderr(Stdio::piped()); + command + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); if self.bench { command.args(EXECUTABLE_ARGS_BENCH); } else { @@ -383,6 +407,7 @@ impl Evm { output.status.success(), "{EXECUTABLE_NAME} command failed: {output:?}", ); + drop(temp_path); let stdout = str::from_utf8(output.stdout.as_slice()) .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stdout failed to parse: {err}")); diff --git a/crates/integration/src/cases.rs b/crates/integration/src/cases.rs index f6e3bcf8..6536d3d9 100644 --- a/crates/integration/src/cases.rs +++ b/crates/integration/src/cases.rs @@ -44,8 +44,8 @@ macro_rules! case { }; } -case!("Create.sol", "CreateA", vec![0; 4].into(), create_a); -case!("Create.sol", "CreateB", vec![0; 4].into(), create_b); +case!("Create.sol", "CreateA", vec![0; 4], create_a); +case!("Create.sol", "CreateB", vec![0; 4], create_b); sol!(contract Baseline { function baseline() public payable; }); case!("Baseline.sol", Baseline, baselineCall, baseline,); diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 94182583..da7fc7e5 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -127,12 +127,12 @@ impl ToHex for &OptionalHex { } } -impl Into for alloy_primitives::Bytes { - fn into(self) -> OptionalHex { - if self.is_empty() { +impl From for OptionalHex { + fn from(value: alloy_primitives::Bytes) -> Self { + if value.is_empty() { OptionalHex(None) } else { - OptionalHex(Some(self.into())) + OptionalHex(Some(value.into())) } } } From d664c834e7e3c241a1b87ce21169a664446c4271 Mon Sep 17 00:00:00 2001 From: xermicus Date: Tue, 3 Sep 2024 16:43:23 +0200 Subject: [PATCH 27/27] install geth on the ci Signed-off-by: xermicus --- .github/workflows/rust.yml | 5 ++++- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 812978f8..64241eb0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -31,7 +31,10 @@ jobs: echo "$(pwd)/llvm18/bin" >> $GITHUB_PATH - name: Install apt dependencies - run: sudo apt update && sudo apt install -y libtinfo5 + run: | + sudo add-apt-repository -y ppa:ethereum/ethereum + sudo apt update + sudo apt install -y libtinfo5 ethereum - name: Format run: make format diff --git a/Cargo.toml b/Cargo.toml index 92db4e95..45deccea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ version = "0.5" default-features = false features = ["serde", "llvm18-0", "no-libffi-linking", "target-riscv"] -[profile.benchmark] +[profile.bench] inherits = "release" lto = true codegen-units = 1