diff --git a/.gitignore b/.gitignore index 19f59a1..533eefc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # will have compiled files and executables debug/ target/ +revive/ # These are backup files generated by rustfmt **/*.rs.bk diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..c342153 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,24 @@ +# Basic +edition = "2021" +hard_tabs = true +max_width = 100 +use_small_heuristics = "Max" +# Imports +imports_granularity = "Crate" +reorder_imports = true +# Consistency +newline_style = "Unix" +# Misc +chain_width = 80 +spaces_around_ranges = false +binop_separator = "Back" +reorder_impl_items = false +match_arm_leading_pipes = "Preserve" +match_arm_blocks = false +match_block_trailing_comma = true +trailing_comma = "Vertical" +trailing_semicolon = false +use_field_init_shorthand = true +# Format comments +comment_width = 100 +wrap_comments = true diff --git a/Cargo.lock b/Cargo.lock index f6d4d8b..f4420f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,19 +23,13 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ - "gimli 0.29.0", + "gimli 0.31.0", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -173,7 +167,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", "syn-solidity", "tiny-keccak", ] @@ -262,9 +256,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "approx" @@ -286,7 +280,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -465,7 +459,7 @@ dependencies = [ "num-bigint", "num-traits", "paste", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "zeroize", ] @@ -715,7 +709,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", "synstructure 0.13.1", ] @@ -738,7 +732,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -750,7 +744,6 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "asset-test-utils" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -779,13 +772,13 @@ dependencies = [ [[package]] name = "assets-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-support", "impl-trait-for-tuples", "log", "pallet-asset-conversion", + "pallet-assets", "pallet-xcm", "parachains-common", "parity-scale-codec", @@ -839,13 +832,13 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ebdfa2ebdab6b1760375fa7d6f382b9f486eac35fc994625a00e89280bdbb7" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-lite 2.3.0", "slab", ] @@ -906,7 +899,7 @@ dependencies = [ "futures-lite 2.3.0", "parking", "polling 3.7.3", - "rustix 0.38.34", + "rustix 0.38.36", "slab", "tracing", "windows-sys 0.59.0", @@ -967,7 +960,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.34", + "rustix 0.38.36", "windows-sys 0.48.0", ] @@ -986,7 +979,7 @@ dependencies = [ "cfg-if", "event-listener 5.3.1", "futures-lite 2.3.0", - "rustix 0.38.34", + "rustix 0.38.36", "tracing", "windows-sys 0.59.0", ] @@ -1003,7 +996,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.34", + "rustix 0.38.36", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -1017,13 +1010,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -1070,7 +1063,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -1081,17 +1074,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ - "addr2line 0.22.0", - "cc", + "addr2line 0.24.1", "cfg-if", "libc", - "miniz_oxide 0.7.4", - "object 0.36.3", + "miniz_oxide", + "object 0.36.4", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -1169,10 +1162,10 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "hash-db", "log", + "parity-scale-codec", ] [[package]] @@ -1196,13 +1189,13 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "prettyplease 0.2.20", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -1315,7 +1308,7 @@ checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ "arrayref", "arrayvec 0.7.6", - "constant_time_eq 0.3.0", + "constant_time_eq 0.3.1", ] [[package]] @@ -1326,7 +1319,7 @@ checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" dependencies = [ "arrayref", "arrayvec 0.7.6", - "constant_time_eq 0.3.0", + "constant_time_eq 0.3.1", ] [[package]] @@ -1339,7 +1332,7 @@ dependencies = [ "arrayvec 0.7.6", "cc", "cfg-if", - "constant_time_eq 0.3.0", + "constant_time_eq 0.3.1", ] [[package]] @@ -1397,7 +1390,6 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-runtime", "finality-grandpa", @@ -1408,13 +1400,12 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "bp-messages" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-runtime", @@ -1423,13 +1414,13 @@ dependencies = [ "scale-info", "serde", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-io", + "sp-std 14.0.0", ] [[package]] name = "bp-parachains" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1440,26 +1431,24 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "bp-polkadot" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" 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.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "bp-polkadot-core" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-messages", "bp-runtime", @@ -1471,27 +1460,29 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "bp-relayers" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "bp-header-chain", "bp-messages", + "bp-parachains", "bp-runtime", "frame-support", + "frame-system", + "pallet-utility", "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "bp-runtime" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -1506,7 +1497,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "sp-trie", "trie-db", ] @@ -1514,7 +1505,6 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-parachains", @@ -1527,33 +1517,40 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "bp-messages", + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std 14.0.0", + "staging-xcm", ] [[package]] name = "bp-xcm-bridge-hub-router" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", "sp-core", "sp-runtime", + "staging-xcm", ] [[package]] name = "bridge-hub-common" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1563,21 +1560,23 @@ dependencies = [ "snowbridge-core", "sp-core", "sp-runtime", + "sp-std 14.0.0", "staging-xcm", ] [[package]] name = "bridge-hub-test-utils" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "asset-test-utils", "bp-header-chain", "bp-messages", + "bp-parachains", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", + "bp-xcm-bridge-hub", "bridge-runtime-common", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -1592,6 +1591,8 @@ dependencies = [ "pallet-bridge-relayers", "pallet-timestamp", "pallet-utility", + "pallet-xcm", + "pallet-xcm-bridge-hub", "parachains-common", "parachains-runtimes-test-utils", "parity-scale-codec", @@ -1599,7 +1600,7 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -1608,7 +1609,6 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-messages", @@ -1617,7 +1617,6 @@ dependencies = [ "bp-relayers", "bp-runtime", "bp-xcm-bridge-hub", - "bp-xcm-bridge-hub-router", "frame-support", "frame-system", "log", @@ -1631,10 +1630,9 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "sp-trie", "staging-xcm", - "staging-xcm-builder", "tuplex", ] @@ -1659,12 +1657,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - [[package]] name = "bs58" version = "0.5.1" @@ -1703,9 +1695,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" [[package]] name = "byteorder" @@ -1774,9 +1766,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.13" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" dependencies = [ "jobserver", "libc", @@ -1932,9 +1924,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -1942,9 +1934,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -1962,7 +1954,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -1992,6 +1984,27 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "color-print" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee543c60ff3888934877a5671f45494dd27ed4ba25c6670b9a7576b7ed7a8c0" +dependencies = [ + "color-print-proc-macro", +] + +[[package]] +name = "color-print-proc-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ff1a80c5f3cb1ca7c06ffdd71b6a6dd6d8f896c42141fbd43f50ed28dcdb93" +dependencies = [ + "nom", + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "colorchoice" version = "1.0.2" @@ -2110,9 +2123,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "constcat" @@ -2172,9 +2185,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -2277,21 +2290,6 @@ dependencies = [ "wasmtime-types", ] -[[package]] -name = "crc" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - [[package]] name = "crc32fast" version = "1.4.2" @@ -2396,7 +2394,6 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "clap", "parity-scale-codec", @@ -2413,7 +2410,6 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -2436,7 +2432,6 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-client-collator", @@ -2451,6 +2446,7 @@ dependencies = [ "parking_lot 0.12.3", "polkadot-node-primitives", "polkadot-node-subsystem", + "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", "sc-client-api", @@ -2481,7 +2477,6 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -2511,7 +2506,6 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-proposer" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "anyhow", "async-trait", @@ -2526,7 +2520,6 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -2549,7 +2542,6 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -2575,7 +2567,6 @@ dependencies = [ [[package]] name = "cumulus-client-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2585,11 +2576,11 @@ dependencies = [ "parity-scale-codec", "sc-client-api", "sp-api", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-trie", "tracing", ] @@ -2597,7 +2588,6 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2623,7 +2613,6 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -2660,7 +2649,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -2677,7 +2665,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -2694,7 +2681,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -2714,12 +2700,12 @@ dependencies = [ "polkadot-runtime-parachains", "scale-info", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master)", + "sp-std 14.0.0", "sp-trie", "sp-version", "staging-xcm", @@ -2730,18 +2716,16 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "cumulus-pallet-session-benchmarking" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -2754,7 +2738,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-solo-to-para" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -2769,7 +2752,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2784,7 +2766,6 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bounded-collections", "bp-xcm-bridge-hub-router", @@ -2809,7 +2790,6 @@ dependencies = [ [[package]] name = "cumulus-ping" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-pallet-xcm", "cumulus-primitives-core", @@ -2824,7 +2804,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-aura" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "sp-api", "sp-consensus-aura", @@ -2833,7 +2812,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -2849,7 +2827,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2863,17 +2840,15 @@ dependencies = [ [[package]] name = "cumulus-primitives-proof-size-hostfunction" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-proof-size-hostfunction", @@ -2889,7 +2864,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "sp-inherents", @@ -2899,7 +2873,6 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2916,7 +2889,6 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2940,12 +2912,11 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-primitives-core", "futures", - "jsonrpsee-core 0.23.2", + "jsonrpsee-core 0.24.4", "parity-scale-codec", "polkadot-overseer", "sc-client-api", @@ -2959,7 +2930,6 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "async-trait", @@ -2994,7 +2964,6 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -3002,10 +2971,11 @@ dependencies = [ "either", "futures", "futures-timer", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "parity-scale-codec", "pin-project", "polkadot-overseer", + "prometheus", "rand", "sc-client-api", "sc-rpc-api", @@ -3021,8 +2991,9 @@ dependencies = [ "sp-core", "sp-runtime", "sp-state-machine", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-version", + "substrate-prometheus-endpoint", "thiserror", "tokio", "tokio-util", @@ -3033,7 +3004,6 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -3054,7 +3024,7 @@ dependencies = [ "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "subtle 2.6.1", "zeroize", ] @@ -3067,7 +3037,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3085,9 +3055,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.126" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c4eae4b7fc8dcb0032eb3b1beee46b38d371cdeaf2d0c64b9944f6f69ad7755" +checksum = "54ccead7d199d584d139148b04b4a368d1ec7556a1d9ea2548febb1b9d49f9a4" dependencies = [ "cc", "cxxbridge-flags", @@ -3097,9 +3067,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.126" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c822bf7fb755d97328d6c337120b6f843678178751cba33c9da25cf522272e0" +checksum = "c77953e99f01508f89f55c494bfa867171ef3a6c8cea03d26975368f2121a5c1" dependencies = [ "cc", "codespan-reporting", @@ -3107,24 +3077,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "cxxbridge-flags" -version = "1.0.126" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719d6197dc016c88744aff3c0d0340a01ecce12e8939fc282e7c8f583ee64bc6" +checksum = "65777e06cc48f0cb0152024c77d6cf9e4bdb4408e7b48bea993d42fa0f5b02b6" [[package]] name = "cxxbridge-macro" -version = "1.0.126" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35de3b547387863c8f82013c4f79f1c2162edee956383e4089e1d04c18c4f16c" +checksum = "98532a60dedaebc4848cb2cba5023337cc9ea3af16a5b062633fabfd9f18fb60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3172,7 +3142,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3194,7 +3164,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3302,7 +3272,7 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3313,7 +3283,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3325,16 +3295,10 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn 2.0.75", + "rustc_version 0.4.1", + "syn 2.0.77", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "difflib" version = "0.4.0" @@ -3421,7 +3385,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3461,7 +3425,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.75", + "syn 2.0.77", "termcolor", "toml 0.8.19", "walkdir", @@ -3602,10 +3566,10 @@ dependencies = [ [[package]] name = "emulated-integration-tests-common" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "asset-test-utils", "bp-messages", + "bp-xcm-bridge-hub", "bridge-runtime-common", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -3616,6 +3580,7 @@ dependencies = [ "pallet-bridge-messages", "pallet-message-queue", "pallet-xcm", + "pallet-xcm-bridge-hub", "parachains-common", "parity-scale-codec", "paste", @@ -3652,14 +3617,14 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3679,7 +3644,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3690,7 +3655,17 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", +] + +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", ] [[package]] @@ -3706,6 +3681,19 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "environmental" version = "1.1.4" @@ -3734,17 +3722,19 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "eth-rpc-api", + "env_logger 0.11.5", "futures", + "hex", "hex-literal", "hyper 1.4.1", "indoc", - "jsonrpsee 0.24.3", + "jsonrpsee 0.24.4", "log", - "pallet-contracts-evm-primitives", "parity-scale-codec", "polkadot-sdk", - "secp256k1 0.29.0", + "scale-decode", + "scale-info", + "secp256k1", "serde_json", "subxt", "thiserror", @@ -3754,37 +3744,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "eth-rpc-api" -version = "0.1.0" -dependencies = [ - "derive_more", - "ethereum-types", - "hex", - "hex-literal", - "parity-scale-codec", - "polkadot-sdk", - "pretty_assertions", - "rlp", - "scale-info", - "secp256k1 0.29.0", - "serde", - "serde_json", -] - -[[package]] -name = "eth-rpc-codegen" -version = "0.1.0" -dependencies = [ - "Inflector", - "anyhow", - "indoc", - "lazy_static", - "pretty_assertions", - "serde", - "serde_json", -] - [[package]] name = "ethabi-decode" version = "1.0.0" @@ -3892,10 +3851,10 @@ dependencies = [ "blake2 0.10.6", "file-guard", "fs-err", - "prettyplease 0.2.20", + "prettyplease", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -3921,9 +3880,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fastrlp" @@ -3953,11 +3912,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb42427514b063d97ce21d5199f36c0c307d981434a6be32582bc79fe5bd2303" dependencies = [ "expander", - "indexmap 2.4.0", - "proc-macro-crate 3.1.0", + "indexmap 2.5.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -4015,15 +3974,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger", + "env_logger 0.10.2", "log", ] [[package]] name = "filetime" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ "cfg-if", "libc", @@ -4077,12 +4036,12 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -4100,25 +4059,9 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "fork-tree" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", ] @@ -4151,7 +4094,6 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-support-procedural", @@ -4167,15 +4109,14 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-runtime-interface 24.0.0", + "sp-storage 19.0.0", "static_assertions", ] [[package]] name = "frame-benchmarking-cli" version = "32.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "Inflector", "array-bytes", @@ -4208,16 +4149,16 @@ dependencies = [ "sp-blockchain", "sp-core", "sp-database", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keystore", "sp-runtime", "sp-state-machine", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-trie", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-wasm-interface 20.0.0", "thiserror", "thousands", ] @@ -4225,7 +4166,6 @@ dependencies = [ [[package]] name = "frame-benchmarking-pallet-pov" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4239,18 +4179,16 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "frame-election-provider-support" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -4266,7 +4204,6 @@ dependencies = [ [[package]] name = "frame-executive" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "aquamarine", "frame-support", @@ -4278,7 +4215,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", ] [[package]] @@ -4307,7 +4244,6 @@ dependencies = [ [[package]] name = "frame-metadata-hash-extension" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "docify", @@ -4322,16 +4258,15 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "indicatif", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "serde", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-io", "sp-runtime", "sp-state-machine", @@ -4344,10 +4279,10 @@ dependencies = [ [[package]] name = "frame-support" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "aquamarine", "array-bytes", + "binary-merkle-tree", "bitflags 1.3.2", "docify", "environmental", @@ -4367,7 +4302,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-debug-derive 14.0.0", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -4375,8 +4310,9 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", + "sp-tracing 16.0.0", + "sp-trie", "sp-weights", "static_assertions", "tt-call", @@ -4385,7 +4321,6 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "Inflector", "cfg-expr", @@ -4398,36 +4333,33 @@ dependencies = [ "proc-macro-warning 1.0.2", "proc-macro2", "quote", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "syn 2.0.75", + "sp-crypto-hashing 0.1.0", + "syn 2.0.77", ] [[package]] name = "frame-support-procedural-tools" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "frame-support-procedural-tools-derive" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "frame-system" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cfg-if", "docify", @@ -4439,7 +4371,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "sp-version", "sp-weights", ] @@ -4447,7 +4379,6 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -4461,7 +4392,6 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "parity-scale-codec", @@ -4471,7 +4401,6 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "parity-scale-codec", @@ -4504,7 +4433,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" dependencies = [ - "rustix 0.38.34", + "rustix 0.38.36", "windows-sys 0.48.0", ] @@ -4594,7 +4523,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-core", "futures-io", "parking", @@ -4609,7 +4538,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -4674,7 +4603,6 @@ dependencies = [ [[package]] name = "generate-bags" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "chrono", "frame-election-provider-support", @@ -4769,9 +4697,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "glob" @@ -4868,7 +4796,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.4.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -4887,7 +4815,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.4.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -5006,6 +4934,51 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hickory-proto" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.6.1", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.3", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "hkdf" version = "0.12.4" @@ -5045,15 +5018,6 @@ dependencies = [ "hmac 0.8.1", ] -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "hostname" version = "0.3.1" @@ -5208,16 +5172,16 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", "hyper 1.4.1", "hyper-util", "log", - "rustls 0.23.12", + "rustls 0.23.13", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -5226,9 +5190,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", @@ -5422,9 +5386,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -5519,15 +5483,15 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "iri-string" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f5f6c2df22c009ac44f6f1499308e7a3ac7ba42cd2378475cc691510e1eef1b" +checksum = "5f80d71a680f471ab23df28c5cb3e6a5598f96ab5570a2e320b73a44c46db440" dependencies = [ "memchr", "serde", @@ -5546,9 +5510,9 @@ dependencies = [ [[package]] name = "is_executable" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9acdc6d67b75e626ad644734e8bc6df893d9cd2a834129065d3dd6158ea9c8" +checksum = "4ba3d8548b8b04dafdf2f4cc6f5e379db766d0a6d9aac233ad4c9a92ea892233" dependencies = [ "winapi", ] @@ -5586,6 +5550,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -5649,29 +5622,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b089779ad7f80768693755a031cc14a7766aba707cbe886674e3f79e9b7e47" dependencies = [ "jsonrpsee-core 0.23.2", - "jsonrpsee-http-client 0.23.2", - "jsonrpsee-proc-macros 0.23.2", - "jsonrpsee-server 0.23.2", "jsonrpsee-types 0.23.2", "jsonrpsee-ws-client 0.23.2", - "tokio", - "tracing", ] [[package]] name = "jsonrpsee" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ec465b607a36dc5dd45d48b7689bc83f679f66a3ac6b6b21cc787a11e0f8685" +checksum = "8fd1ead9fb95614e8dc5556d12a8681c2f6d352d0c1d3efc8708c7ccbba47bc6" dependencies = [ - "jsonrpsee-client-transport 0.24.3", - "jsonrpsee-core 0.24.3", - "jsonrpsee-http-client 0.24.3", - "jsonrpsee-proc-macros 0.24.3", - "jsonrpsee-server 0.24.3", - "jsonrpsee-types 0.24.3", + "jsonrpsee-client-transport 0.24.4", + "jsonrpsee-core 0.24.4", + "jsonrpsee-http-client 0.24.4", + "jsonrpsee-proc-macros", + "jsonrpsee-server", + "jsonrpsee-types 0.24.4", "jsonrpsee-wasm-client", - "jsonrpsee-ws-client 0.24.3", + "jsonrpsee-ws-client 0.24.4", "tokio", "tracing", ] @@ -5686,7 +5654,7 @@ dependencies = [ "http 0.2.12", "jsonrpsee-core 0.22.5", "pin-project", - "rustls-native-certs 0.7.2", + "rustls-native-certs 0.7.3", "rustls-pki-types", "soketto 0.7.1", "thiserror", @@ -5708,7 +5676,7 @@ dependencies = [ "http 1.1.0", "jsonrpsee-core 0.23.2", "pin-project", - "rustls 0.23.12", + "rustls 0.23.13", "rustls-pki-types", "rustls-platform-verifier", "soketto 0.8.0", @@ -5722,18 +5690,18 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f0977f9c15694371b8024c35ab58ca043dbbf4b51ccb03db8858a021241df1" +checksum = "89841d4f03a14c055eb41d4f41901819573ef948e8ee0d5c86466fd286b2ce7f" dependencies = [ "base64 0.22.1", "futures-channel", "futures-util", "gloo-net", "http 1.1.0", - "jsonrpsee-core 0.24.3", + "jsonrpsee-core 0.24.4", "pin-project", - "rustls 0.23.12", + "rustls 0.23.13", "rustls-pki-types", "rustls-platform-verifier", "soketto 0.8.0", @@ -5777,16 +5745,10 @@ dependencies = [ "anyhow", "async-trait", "beef", - "bytes", "futures-timer", "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "http-body-util", "jsonrpsee-types 0.23.2", - "parking_lot 0.12.3", "pin-project", - "rand", "rustc-hash 1.1.0", "serde", "serde_json", @@ -5798,9 +5760,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e942c55635fbf5dc421938b8558a8141c7e773720640f4f1dbe1f4164ca4e221" +checksum = "ff79651479f69ada7bda604ef2acf3f1aa50755d97cc36d25ff04c2664f9d96f" dependencies = [ "async-trait", "bytes", @@ -5809,7 +5771,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "jsonrpsee-types 0.24.3", + "jsonrpsee-types 0.24.4", "parking_lot 0.12.3", "pin-project", "rand", @@ -5845,44 +5807,19 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d90064e04fb9d7282b1c71044ea94d0bbc6eff5621c66f1a0bce9e9de7cf3ac" -dependencies = [ - "async-trait", - "base64 0.22.1", - "http-body 1.0.1", - "hyper 1.4.1", - "hyper-rustls 0.27.2", - "hyper-util", - "jsonrpsee-core 0.23.2", - "jsonrpsee-types 0.23.2", - "rustls 0.23.12", - "rustls-platform-verifier", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "tracing", - "url", -] - -[[package]] -name = "jsonrpsee-http-client" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33774602df12b68a2310b38a535733c477ca4a498751739f89fe8dbbb62ec4c" +checksum = "68ed8b301b19f4dad8ddc66ed956a70fc227def5c19b3898e0a29ce8f0edee06" dependencies = [ "async-trait", "base64 0.22.1", "http-body 1.0.1", "hyper 1.4.1", - "hyper-rustls 0.27.2", + "hyper-rustls 0.27.3", "hyper-util", - "jsonrpsee-core 0.24.3", - "jsonrpsee-types 0.24.3", - "rustls 0.23.12", + "jsonrpsee-core 0.24.4", + "jsonrpsee-types 0.24.4", + "rustls 0.23.13", "rustls-platform-verifier", "serde", "serde_json", @@ -5895,72 +5832,31 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7895f186d5921065d96e16bd795e5ca89ac8356ec423fafc6e3d7cf8ec11aee4" -dependencies = [ - "heck 0.5.0", - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "jsonrpsee-proc-macros" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b07a2daf52077ab1b197aea69a5c990c060143835bf04c77070e98903791715" +checksum = "a0d4c6bec4909c966f59f52db3655c0e9d4685faae8b49185973d9d7389bb884" dependencies = [ "heck 0.5.0", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "jsonrpsee-server" -version = "0.23.2" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "654afab2e92e5d88ebd8a39d6074483f3f2bfdf91c5ac57fe285e7127cdd4f51" +checksum = "ebe2198e5fd96cf2153ecc123364f699b6e2151317ea09c7bf799c43c2fe1415" dependencies = [ - "anyhow", "futures-util", "http 1.1.0", "http-body 1.0.1", "http-body-util", "hyper 1.4.1", "hyper-util", - "jsonrpsee-core 0.23.2", - "jsonrpsee-types 0.23.2", - "pin-project", - "route-recognizer", - "serde", - "serde_json", - "soketto 0.8.0", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tracing", -] - -[[package]] -name = "jsonrpsee-server" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038fb697a709bec7134e9ccbdbecfea0e2d15183f7140254afef7c5610a3f488" -dependencies = [ - "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "http-body-util", - "hyper 1.4.1", - "hyper-util", - "jsonrpsee-core 0.24.3", - "jsonrpsee-types 0.24.3", + "jsonrpsee-core 0.24.4", + "jsonrpsee-types 0.24.4", "pin-project", "route-recognizer", "serde", @@ -6002,9 +5898,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b67d6e008164f027afbc2e7bb79662650158d26df200040282d2aa1cbb093b" +checksum = "531e386460425e49679587871a056f2895a47dade21457324ad1262cd78ef6d9" dependencies = [ "http 1.1.0", "serde", @@ -6014,13 +5910,13 @@ dependencies = [ [[package]] name = "jsonrpsee-wasm-client" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0470d0ae043ffcb0cd323797a631e637fb4b55fe3eaa6002934819458bba62a7" +checksum = "5a2d2206c8f04c6b79a11bd1d92d6726b6f7fd3dec57c91e07fa53e867268bbb" dependencies = [ - "jsonrpsee-client-transport 0.24.3", - "jsonrpsee-core 0.24.3", - "jsonrpsee-types 0.24.3", + "jsonrpsee-client-transport 0.24.4", + "jsonrpsee-core 0.24.4", + "jsonrpsee-types 0.24.4", ] [[package]] @@ -6038,22 +5934,22 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.24.3" +version = "0.24.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "992bf67d1132f88edf4a4f8cff474cf01abb2be203004a2b8e11c2b20795b99e" +checksum = "87bc869e143d430e748988261d19b630e8f1692074e68f1a7f0eb4c521d2fc58" dependencies = [ "http 1.1.0", - "jsonrpsee-client-transport 0.24.3", - "jsonrpsee-core 0.24.3", - "jsonrpsee-types 0.24.3", + "jsonrpsee-client-transport 0.24.4", + "jsonrpsee-core 0.24.4", + "jsonrpsee-types 0.24.4", "url", ] [[package]] name = "k256" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -6290,7 +6186,7 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55cca1eb2bc1fd29f099f3daaab7effd01e1a54b7c577d0ed082521034d912e8" dependencies = [ - "bs58 0.5.1", + "bs58", "ed25519-dalek", "hkdf", "multihash 0.19.1", @@ -6427,7 +6323,7 @@ dependencies = [ "libp2p-tls", "log", "parking_lot 0.12.3", - "quinn 0.10.2", + "quinn", "rand", "ring 0.16.20", "rustls 0.21.12", @@ -6487,7 +6383,7 @@ dependencies = [ "proc-macro-warning 0.4.2", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -6666,9 +6562,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.19" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "pkg-config", @@ -6740,21 +6636,22 @@ dependencies = [ [[package]] name = "litep2p" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f46c51c205264b834ceed95c8b195026e700494bc3991aaba3b4ea9e20626d9" +checksum = "d4ab2528b02b6dbbc3e6ec4b55ccde885647c622a315b7da45081ed2dfe4b813" dependencies = [ "async-trait", - "bs58 0.4.0", + "bs58", "bytes", "cid 0.10.1", "ed25519-dalek", "futures", "futures-timer", "hex-literal", - "indexmap 2.4.0", + "hickory-resolver", + "indexmap 2.5.0", "libc", - "mockall 0.12.1", + "mockall 0.13.0", "multiaddr 0.17.1", "multihash 0.17.0", "network-interface", @@ -6762,8 +6659,7 @@ dependencies = [ "parking_lot 0.12.3", "pin-project", "prost 0.12.6", - "prost-build 0.11.9", - "quinn 0.9.4", + "prost-build 0.13.2", "rand", "rcgen", "ring 0.16.20", @@ -6775,18 +6671,15 @@ dependencies = [ "snow", "socket2 0.5.7", "static_assertions", - "str0m", "thiserror", "tokio", "tokio-stream", "tokio-tungstenite", "tokio-util", "tracing", - "trust-dns-resolver", "uint", "unsigned-varint 0.8.0", "url", - "webpki", "x25519-dalek", "x509-parser 0.16.0", "yasna", @@ -6880,7 +6773,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -6894,7 +6787,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -6905,7 +6798,7 @@ checksum = "b02abfe41815b5bd98dbd4260173db2c116dda171dc0fe7838cb206333b83308" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -6916,7 +6809,7 @@ checksum = "73ea28ee64b88876bf45277ed9a5817c1817df061a74f2b988971a12570e5869" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -6968,7 +6861,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.34", + "rustix 0.38.36", ] [[package]] @@ -7052,15 +6945,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -7110,7 +6994,6 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "log", @@ -7129,9 +7012,8 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "parity-scale-codec", "serde", "sp-api", @@ -7158,15 +7040,14 @@ dependencies = [ [[package]] name = "mockall" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" +checksum = "d4c28b3fb6d753d28c20e826cd46ee611fda1cf3cde03a443a974043247c065a" dependencies = [ "cfg-if", "downcast", "fragile", - "lazy_static", - "mockall_derive 0.12.1", + "mockall_derive 0.13.0", "predicates 3.1.2", "predicates-tree", ] @@ -7185,14 +7066,14 @@ dependencies = [ [[package]] name = "mockall_derive" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" +checksum = "341014e7f530314e9a1fdbc7400b244efea7122662c96bfa248c31da5bfb2020" dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -7308,12 +7189,6 @@ dependencies = [ "synstructure 0.12.6", ] -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - [[package]] name = "multimap" version = "0.10.0" @@ -7358,7 +7233,7 @@ checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -7497,9 +7372,9 @@ dependencies = [ "futures", "futures-timer", "hex-literal", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "polkadot-sdk", - "runtime", + "revive-runtime", "serde_json", ] @@ -7586,7 +7461,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -7668,9 +7543,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -7686,9 +7561,9 @@ dependencies = [ [[package]] name = "oid-registry" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" +checksum = "a8d8034d9489cdaf79228eb9f6a3b8d7bb32ba00d6645ebd48eef4077ceb5bd9" dependencies = [ "asn1-rs 0.6.2", ] @@ -7711,60 +7586,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openssl" -version = "0.10.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "300.3.1+3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" -dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -7795,10 +7622,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7b1d40dd8f367db3c65bec8d3dd47d4a604ee8874480738f93191bddab4e0e0" dependencies = [ "expander", - "indexmap 2.4.0", + "indexmap 2.5.0", "itertools 0.11.0", "petgraph", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 1.0.109", @@ -7822,7 +7649,6 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pallet-alliance" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "frame-benchmarking", @@ -7834,7 +7660,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-io", "sp-runtime", ] @@ -7842,7 +7668,6 @@ dependencies = [ [[package]] name = "pallet-asset-conversion" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7860,7 +7685,6 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-ops" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7878,7 +7702,6 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-tx-payment" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -7892,7 +7715,6 @@ dependencies = [ [[package]] name = "pallet-asset-rate" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7906,7 +7728,6 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7923,7 +7744,6 @@ dependencies = [ [[package]] name = "pallet-assets" version = "29.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7939,7 +7759,6 @@ dependencies = [ [[package]] name = "pallet-assets-freezer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7954,7 +7773,6 @@ dependencies = [ [[package]] name = "pallet-atomic-swap" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -7968,7 +7786,6 @@ dependencies = [ [[package]] name = "pallet-aura" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -7984,7 +7801,6 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -7999,7 +7815,6 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8012,7 +7827,6 @@ dependencies = [ [[package]] name = "pallet-babe" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8035,7 +7849,6 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "aquamarine", "docify", @@ -8050,13 +7863,12 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", ] [[package]] name = "pallet-balances" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -8071,7 +7883,6 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8090,7 +7901,6 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -8115,7 +7925,6 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8132,7 +7941,6 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-runtime", @@ -8145,13 +7953,12 @@ dependencies = [ "scale-info", "sp-consensus-grandpa", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "pallet-bridge-messages" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-messages", @@ -8163,14 +7970,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "sp-trie", ] [[package]] name = "pallet-bridge-parachains" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-header-chain", "bp-parachains", @@ -8184,14 +7990,14 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "pallet-bridge-relayers" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "bp-header-chain", "bp-messages", "bp-relayers", "bp-runtime", @@ -8199,18 +8005,20 @@ dependencies = [ "frame-support", "frame-system", "log", + "pallet-bridge-grandpa", "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-transaction-payment", "parity-scale-codec", "scale-info", "sp-arithmetic", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "pallet-broker" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "frame-benchmarking", @@ -8228,7 +8036,6 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8246,7 +8053,6 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8265,8 +8071,8 @@ dependencies = [ [[package]] name = "pallet-collective" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "docify", "frame-benchmarking", "frame-support", "frame-system", @@ -8281,7 +8087,6 @@ dependencies = [ [[package]] name = "pallet-collective-content" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8295,7 +8100,6 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitflags 1.3.2", "environmental", @@ -8318,41 +8122,16 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "wasm-instrument", "wasmi 0.32.3", ] -[[package]] -name = "pallet-contracts-evm" -version = "0.1.0" -dependencies = [ - "eth-rpc-api", - "log", - "pallet-contracts-evm-primitives", - "parity-scale-codec", - "polkadot-sdk", - "scale-info", -] - -[[package]] -name = "pallet-contracts-evm-primitives" -version = "0.1.0" -dependencies = [ - "eth-rpc-api", - "parity-scale-codec", - "polkadot-sdk", - "scale-info", - "serde", - "serde_json", -] - [[package]] name = "pallet-contracts-mock-network" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8377,7 +8156,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -8387,29 +8166,25 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "pallet-contracts-uapi" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", "paste", - "polkavm-derive", "scale-info", ] [[package]] name = "pallet-conviction-voting" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "assert_matches", "frame-benchmarking", @@ -8425,7 +8200,6 @@ dependencies = [ [[package]] name = "pallet-core-fellowship" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8443,7 +8217,6 @@ dependencies = [ [[package]] name = "pallet-delegated-staking" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8458,7 +8231,6 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8475,7 +8247,6 @@ dependencies = [ [[package]] name = "pallet-dev-mode" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8490,7 +8261,6 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8512,7 +8282,6 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8525,7 +8294,6 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8543,7 +8311,6 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -8561,7 +8328,6 @@ dependencies = [ [[package]] name = "pallet-glutton" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "blake2 0.10.6", "frame-benchmarking", @@ -8579,7 +8345,6 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8601,7 +8366,6 @@ dependencies = [ [[package]] name = "pallet-identity" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "enumflags2", "frame-benchmarking", @@ -8617,7 +8381,6 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8636,7 +8399,6 @@ dependencies = [ [[package]] name = "pallet-indices" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8652,7 +8414,6 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8665,7 +8426,6 @@ dependencies = [ [[package]] name = "pallet-lottery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8678,7 +8438,6 @@ dependencies = [ [[package]] name = "pallet-membership" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8694,7 +8453,6 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "environmental", "frame-benchmarking", @@ -8713,8 +8471,8 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "cfg-if", "docify", "frame-benchmarking", "frame-support", @@ -8730,7 +8488,6 @@ dependencies = [ [[package]] name = "pallet-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8749,7 +8506,6 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8766,7 +8522,6 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8781,7 +8536,6 @@ dependencies = [ [[package]] name = "pallet-nft-fractionalization" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8797,7 +8551,6 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "enumflags2", "frame-benchmarking", @@ -8814,7 +8567,6 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "pallet-nfts", "parity-scale-codec", @@ -8824,7 +8576,6 @@ dependencies = [ [[package]] name = "pallet-nis" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8839,7 +8590,6 @@ dependencies = [ [[package]] name = "pallet-node-authorization" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8854,7 +8604,6 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8866,13 +8615,12 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", ] [[package]] name = "pallet-nomination-pools-benchmarking" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8885,14 +8633,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -8902,7 +8649,6 @@ dependencies = [ [[package]] name = "pallet-offences" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -8918,7 +8664,6 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8941,7 +8686,6 @@ dependencies = [ [[package]] name = "pallet-paged-list" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -8958,7 +8702,6 @@ dependencies = [ [[package]] name = "pallet-parameters" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -8975,7 +8718,6 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -8991,7 +8733,6 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9005,7 +8746,6 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9023,7 +8763,6 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9037,7 +8776,6 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "assert_matches", "frame-benchmarking", @@ -9055,7 +8793,6 @@ dependencies = [ [[package]] name = "pallet-remark" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9068,10 +8805,115 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "pallet-revive" +version = "0.1.0" +dependencies = [ + "bitflags 1.3.2", + "derive_more", + "environmental", + "ethereum-types", + "frame-benchmarking", + "frame-support", + "frame-system", + "hex", + "impl-trait-for-tuples", + "jsonrpsee 0.24.4", + "log", + "pallet-balances", + "pallet-revive-fixtures", + "pallet-revive-proc-macro", + "pallet-revive-uapi", + "pallet-transaction-payment", + "parity-scale-codec", + "paste", + "polkavm 0.11.0", + "rlp", + "scale-info", + "serde", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0", + "sp-weights", + "staging-xcm", + "staging-xcm-builder", +] + +[[package]] +name = "pallet-revive-fixtures" +version = "0.1.0" +dependencies = [ + "anyhow", + "frame-system", + "log", + "parity-wasm", + "polkavm-linker 0.11.0", + "sp-core", + "sp-io", + "sp-runtime", + "tempfile", + "toml 0.8.19", +] + +[[package]] +name = "pallet-revive-mock-network" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-message-queue", + "pallet-proxy", + "pallet-revive", + "pallet-revive-proc-macro", + "pallet-revive-uapi", + "pallet-timestamp", + "pallet-utility", + "pallet-xcm", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-parachains", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-tracing 16.0.0", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "xcm-simulator", +] + +[[package]] +name = "pallet-revive-proc-macro" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "pallet-revive-uapi" +version = "0.1.0" +dependencies = [ + "bitflags 1.3.2", + "parity-scale-codec", + "paste", + "polkavm-derive 0.11.0", + "scale-info", +] + [[package]] name = "pallet-root-offences" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9086,7 +8928,6 @@ dependencies = [ [[package]] name = "pallet-root-testing" version = "4.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9100,7 +8941,6 @@ dependencies = [ [[package]] name = "pallet-safe-mode" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -9118,7 +8958,6 @@ dependencies = [ [[package]] name = "pallet-salary" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9136,7 +8975,6 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -9153,7 +8991,6 @@ dependencies = [ [[package]] name = "pallet-scored-pool" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9166,7 +9003,6 @@ dependencies = [ [[package]] name = "pallet-session" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9187,7 +9023,6 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9203,7 +9038,6 @@ dependencies = [ [[package]] name = "pallet-skip-feeless-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9215,7 +9049,6 @@ dependencies = [ [[package]] name = "pallet-society" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9232,7 +9065,6 @@ dependencies = [ [[package]] name = "pallet-staking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -9251,21 +9083,9 @@ dependencies = [ "sp-staking", ] -[[package]] -name = "pallet-staking-reward-curve" -version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" -dependencies = [ - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "pallet-staking-reward-fn" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", "sp-arithmetic", @@ -9274,7 +9094,6 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "sp-api", @@ -9284,7 +9103,6 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9300,7 +9118,6 @@ dependencies = [ [[package]] name = "pallet-statement" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9317,7 +9134,6 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -9332,7 +9148,6 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -9344,14 +9159,13 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-timestamp", ] [[package]] name = "pallet-tips" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9369,7 +9183,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -9384,9 +9197,8 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "sp-api", @@ -9400,7 +9212,6 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -9412,7 +9223,6 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "frame-benchmarking", @@ -9432,7 +9242,6 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -9450,7 +9259,6 @@ dependencies = [ [[package]] name = "pallet-tx-pause" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -9467,7 +9275,6 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9481,7 +9288,6 @@ dependencies = [ [[package]] name = "pallet-utility" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9496,7 +9302,6 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9510,7 +9315,6 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9524,7 +9328,6 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -9547,7 +9350,6 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9565,12 +9367,10 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-messages", "bp-runtime", "bp-xcm-bridge-hub", - "bridge-runtime-common", "frame-support", "frame-system", "log", @@ -9579,7 +9379,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -9588,7 +9388,6 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub-router" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", @@ -9599,7 +9398,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", ] @@ -9607,7 +9406,6 @@ dependencies = [ [[package]] name = "parachains-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", @@ -9637,7 +9435,6 @@ dependencies = [ [[package]] name = "parachains-runtimes-test-utils" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -9657,7 +9454,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "staging-parachain-info", "staging-xcm", "staging-xcm-executor", @@ -9725,7 +9522,7 @@ version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 1.0.109", @@ -9768,9 +9565,9 @@ checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -9876,9 +9673,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" dependencies = [ "memchr", "thiserror", @@ -9887,9 +9684,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +checksum = "664d22978e2815783adbdd2c588b455b1bd625299ce36b2a99881ac9627e6d8d" dependencies = [ "pest", "pest_generator", @@ -9897,22 +9694,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +checksum = "a2d5487022d5d33f4c30d91c22afa240ce2a644e87fe08caad974d4eab6badbe" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "pest_meta" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +checksum = "0091754bbd0ea592c4deb3a122ce8ecbb0753b738aa82bc055fcc2eccc8d8174" dependencies = [ "once_cell", "pest", @@ -9926,7 +9723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.4.0", + "indexmap 2.5.0", ] [[package]] @@ -9946,7 +9743,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -9968,7 +9765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-io", ] @@ -9991,13 +9788,11 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "polkadot-approval-distribution" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "futures", "futures-timer", "itertools 0.11.0", - "polkadot-node-jaeger", "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -10011,7 +9806,6 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "always-assert", "futures", @@ -10027,7 +9821,6 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "derive_more", "fatality", @@ -10051,7 +9844,6 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "fatality", @@ -10084,7 +9876,6 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cfg-if", "clap", @@ -10112,7 +9903,6 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "fatality", @@ -10123,6 +9913,7 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", + "schnellru", "sp-core", "sp-keystore", "sp-runtime", @@ -10134,7 +9925,6 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -10145,13 +9935,12 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "derive_more", "fatality", "futures", "futures-timer", - "indexmap 2.4.0", + "indexmap 2.5.0", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -10170,7 +9959,6 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -10184,7 +9972,6 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "futures-timer", @@ -10198,7 +9985,7 @@ dependencies = [ "sc-network-common", "sp-application-crypto", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-keystore", "tracing-gum", ] @@ -10206,7 +9993,6 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "always-assert", "async-trait", @@ -10229,7 +10015,6 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "parity-scale-codec", @@ -10247,8 +10032,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "async-trait", "bitvec", "derive_more", "futures", @@ -10257,7 +10042,6 @@ dependencies = [ "kvdb", "merlin", "parity-scale-codec", - "polkadot-node-jaeger", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-util", @@ -10277,10 +10061,39 @@ dependencies = [ "tracing-gum", ] +[[package]] +name = "polkadot-node-core-approval-voting-parallel" +version = "7.0.0" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "itertools 0.11.0", + "polkadot-approval-distribution", + "polkadot-node-core-approval-voting", + "polkadot-node-jaeger", + "polkadot-node-metrics", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-primitives", + "rand", + "rand_chacha", + "rand_core", + "sc-keystore", + "sp-application-crypto", + "sp-consensus", + "sp-consensus-slots", + "sp-runtime", + "thiserror", + "tracing-gum", +] + [[package]] name = "polkadot-node-core-av-store" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "futures", @@ -10302,7 +10115,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "fatality", @@ -10322,7 +10134,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "polkadot-node-subsystem", @@ -10337,7 +10148,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -10359,7 +10169,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "polkadot-node-metrics", @@ -10373,7 +10182,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "futures-timer", @@ -10390,7 +10198,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "fatality", "futures", @@ -10409,7 +10216,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -10426,7 +10232,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-prospective-parachains" version = "6.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "fatality", "futures", @@ -10440,7 +10245,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "fatality", @@ -10458,7 +10262,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "always-assert", "array-bytes", @@ -10487,7 +10290,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "polkadot-node-primitives", @@ -10503,7 +10305,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cpu-time", "futures", @@ -10518,10 +10319,10 @@ dependencies = [ "sc-executor-wasmtime", "seccompiler", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", + "sp-externalities 0.25.0", "sp-io", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "thiserror", "tracing-gum", ] @@ -10529,7 +10330,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-execute-worker" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cfg-if", "cpu-time", @@ -10547,7 +10347,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-prepare-worker" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "blake3", "cfg-if", @@ -10570,7 +10369,6 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "polkadot-node-metrics", @@ -10585,7 +10383,6 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "lazy_static", "log", @@ -10604,9 +10401,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "bs58 0.5.1", + "bs58", "futures", "futures-timer", "log", @@ -10623,7 +10419,6 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-channel 1.9.0", "async-trait", @@ -10649,18 +10444,20 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "bounded-vec", "futures", + "futures-timer", "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-primitives", + "sc-keystore", "schnorrkel 0.11.4", "serde", "sp-application-crypto", "sp-consensus-babe", + "sp-consensus-slots", "sp-core", "sp-keystore", "sp-maybe-compressed-blob", @@ -10672,7 +10469,6 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -10682,7 +10478,6 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "bitvec", @@ -10712,7 +10507,6 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "derive_more", @@ -10748,7 +10542,6 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -10767,10 +10560,77 @@ dependencies = [ "tracing-gum", ] +[[package]] +name = "polkadot-parachain-lib" +version = "0.1.0" +dependencies = [ + "async-trait", + "clap", + "color-print", + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-client-consensus-aura", + "cumulus-client-consensus-common", + "cumulus-client-consensus-proposer", + "cumulus-client-consensus-relay-chain", + "cumulus-client-parachain-inherent", + "cumulus-client-service", + "cumulus-primitives-aura", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "docify", + "frame-benchmarking", + "frame-benchmarking-cli", + "frame-support", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "futures", + "jsonrpsee 0.24.4", + "log", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc", + "pallet-transaction-payment-rpc-runtime-api", + "parachains-common", + "parity-scale-codec", + "polkadot-cli", + "polkadot-primitives", + "sc-basic-authorship", + "sc-chain-spec", + "sc-cli", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-network", + "sc-rpc", + "sc-service", + "sc-sysinfo", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "serde", + "serde_json", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "sp-session", + "sp-timestamp", + "sp-transaction-pool", + "sp-version", + "sp-weights", + "substrate-frame-rpc-system", + "substrate-prometheus-endpoint", + "substrate-state-trie-migration-rpc", +] + [[package]] name = "polkadot-parachain-primitives" version = "6.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bounded-collections", "derive_more", @@ -10786,7 +10646,6 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "hex-literal", @@ -10807,14 +10666,14 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", + "sp-std 14.0.0", ] [[package]] name = "polkadot-rpc" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "mmr-rpc", "pallet-transaction-payment-rpc", "polkadot-primitives", @@ -10847,7 +10706,6 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitvec", "frame-benchmarking", @@ -10897,19 +10755,17 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "bs58 0.5.1", + "bs58", "frame-benchmarking", "parity-scale-codec", "polkadot-primitives", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", ] [[package]] name = "polkadot-runtime-parachains" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bitflags 1.3.2", "bitvec", @@ -10949,7 +10805,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", "static_assertions", @@ -10958,7 +10814,6 @@ dependencies = [ [[package]] name = "polkadot-sdk" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "asset-test-utils", "assets-common", @@ -11057,8 +10912,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", @@ -11099,6 +10952,9 @@ dependencies = [ "pallet-recovery", "pallet-referenda", "pallet-remark", + "pallet-revive", + "pallet-revive-fixtures", + "pallet-revive-mock-network", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", @@ -11110,7 +10966,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", @@ -11147,6 +11002,7 @@ dependencies = [ "polkadot-network-bridge", "polkadot-node-collation-generation", "polkadot-node-core-approval-voting", + "polkadot-node-core-approval-voting-parallel", "polkadot-node-core-av-store", "polkadot-node-core-backing", "polkadot-node-core-bitfield-signing", @@ -11171,6 +11027,7 @@ dependencies = [ "polkadot-node-subsystem-types", "polkadot-node-subsystem-util", "polkadot-overseer", + "polkadot-parachain-lib", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-rpc", @@ -11186,7 +11043,6 @@ dependencies = [ "sc-basic-authorship", "sc-block-builder", "sc-chain-spec", - "sc-chain-spec-derive", "sc-cli", "sc-client-api", "sc-client-db", @@ -11231,7 +11087,6 @@ dependencies = [ "sc-sysinfo", "sc-telemetry", "sc-tracing", - "sc-tracing-proc-macro", "sc-transaction-pool", "sc-transaction-pool-api", "sc-utils", @@ -11268,12 +11123,12 @@ dependencies = [ "sp-core", "sp-core-hashing", "sp-core-hashing-proc-macro", - "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-ec-utils 0.10.0", + "sp-crypto-hashing 0.1.0", "sp-crypto-hashing-proc-macro", "sp-database", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-debug-derive 14.0.0", + "sp-externalities 0.25.0", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -11288,22 +11143,22 @@ dependencies = [ "sp-panic-handler", "sp-rpc", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", + "sp-storage 19.0.0", "sp-timestamp", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master)", + "sp-wasm-interface 20.0.0", "sp-weights", "staging-chain-spec-builder", "staging-node-inspect", @@ -11323,9 +11178,7 @@ dependencies = [ "substrate-wasm-builder", "testnet-parachains-constants", "tracing-gum", - "tracing-gum-proc-macro", "xcm-emulator", - "xcm-procedural", "xcm-runtime-apis", "xcm-simulator", ] @@ -11333,7 +11186,6 @@ dependencies = [ [[package]] name = "polkadot-sdk-frame" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-benchmarking", @@ -11357,7 +11209,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", ] @@ -11365,23 +11217,18 @@ dependencies = [ [[package]] name = "polkadot-service" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "frame-benchmarking", "frame-benchmarking-cli", - "frame-support", "frame-system", "frame-system-rpc-runtime-api", "futures", - "hex-literal", "is_executable", "kvdb", "kvdb-rocksdb", "log", "mmr-gadget", - "pallet-babe", - "pallet-staking", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "parity-db", @@ -11398,6 +11245,7 @@ dependencies = [ "polkadot-network-bridge", "polkadot-node-collation-generation", "polkadot-node-core-approval-voting", + "polkadot-node-core-approval-voting-parallel", "polkadot-node-core-av-store", "polkadot-node-core-backing", "polkadot-node-core-bitfield-signing", @@ -11417,7 +11265,6 @@ dependencies = [ "polkadot-node-subsystem-types", "polkadot-node-subsystem-util", "polkadot-overseer", - "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-rpc", "polkadot-runtime-parachains", @@ -11425,10 +11272,8 @@ dependencies = [ "rococo-runtime", "sc-authority-discovery", "sc-basic-authorship", - "sc-block-builder", "sc-chain-spec", "sc-client-api", - "sc-client-db", "sc-consensus", "sc-consensus-babe", "sc-consensus-beefy", @@ -11437,7 +11282,6 @@ dependencies = [ "sc-executor", "sc-keystore", "sc-network", - "sc-network-common", "sc-network-sync", "sc-offchain", "sc-service", @@ -11446,7 +11290,6 @@ dependencies = [ "sc-telemetry", "sc-transaction-pool", "sc-transaction-pool-api", - "schnellru", "serde", "serde_json", "sp-api", @@ -11458,16 +11301,14 @@ dependencies = [ "sp-consensus-beefy", "sp-consensus-grandpa", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", - "sp-keystore", "sp-mmr-primitives", "sp-offchain", "sp-runtime", "sp-session", - "sp-state-machine", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", "sp-timestamp", "sp-transaction-pool", "sp-version", @@ -11483,14 +11324,13 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "arrayvec 0.7.6", "bitvec", "fatality", "futures", "futures-timer", - "indexmap 2.4.0", + "indexmap 2.5.0", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -11506,7 +11346,6 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -11522,9 +11361,22 @@ checksum = "8a3693e5efdb2bf74e449cd25fd777a28bd7ed87e41f5d5da75eb31b4de48b94" dependencies = [ "libc", "log", - "polkavm-assembler", - "polkavm-common", - "polkavm-linux-raw", + "polkavm-assembler 0.9.0", + "polkavm-common 0.9.0", + "polkavm-linux-raw 0.9.0", +] + +[[package]] +name = "polkavm" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1195fbc12f11645143a4f3974bf909d25c7f7efddcc6f4e57688d9a518c90bae" +dependencies = [ + "libc", + "log", + "polkavm-assembler 0.11.0", + "polkavm-common 0.11.0", + "polkavm-linux-raw 0.11.0", ] [[package]] @@ -11536,6 +11388,15 @@ dependencies = [ "log", ] +[[package]] +name = "polkavm-assembler" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b0399659fe7a5370c3e3464188888d29069cfa46d99631d19834a379c15826" +dependencies = [ + "log", +] + [[package]] name = "polkavm-common" version = "0.9.0" @@ -11545,13 +11406,32 @@ dependencies = [ "log", ] +[[package]] +name = "polkavm-common" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "254b19b64ff9b57c06b32c0affed961cb9a32429b8d3e5cf2633cad7fbb3e270" +dependencies = [ + "log", + "polkavm-assembler 0.11.0", +] + [[package]] name = "polkavm-derive" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae8c4bea6f3e11cd89bb18bcdddac10bd9a24015399bd1c485ad68a985a19606" dependencies = [ - "polkavm-derive-impl-macro", + "polkavm-derive-impl-macro 0.9.0", +] + +[[package]] +name = "polkavm-derive" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f565f0106fbb3598d64b8528d5cb966b6a87a8dd93fbcfe09fb6388ff2865711" +dependencies = [ + "polkavm-derive-impl-macro 0.11.0", ] [[package]] @@ -11560,10 +11440,22 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c" dependencies = [ - "polkavm-common", + "polkavm-common 0.9.0", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "314445fb5688b4769354087d92be2ac94c487e63ffe74a6fb7bb312e57f20827" +dependencies = [ + "polkavm-common 0.11.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -11572,8 +11464,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" dependencies = [ - "polkavm-derive-impl", - "syn 2.0.75", + "polkavm-derive-impl 0.9.0", + "syn 2.0.77", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf952e05bc5ce7d81293bae18cb44c271c78615b201d75e983cdcc40d5c6ef1" +dependencies = [ + "polkavm-derive-impl 0.11.0", + "syn 2.0.77", ] [[package]] @@ -11586,7 +11488,22 @@ dependencies = [ "hashbrown 0.14.5", "log", "object 0.32.2", - "polkavm-common", + "polkavm-common 0.9.0", + "regalloc2 0.9.3", + "rustc-demangle", +] + +[[package]] +name = "polkavm-linker" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535a2095a186ccde2cd2fa721d6370c495586d47714817565b2f6621d31164b3" +dependencies = [ + "gimli 0.28.1", + "hashbrown 0.14.5", + "log", + "object 0.36.4", + "polkavm-common 0.11.0", "regalloc2 0.9.3", "rustc-demangle", ] @@ -11595,7 +11512,13 @@ dependencies = [ name = "polkavm-linux-raw" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26e85d3456948e650dff0cfc85603915847faf893ed1e66b020bb82ef4557120" +checksum = "26e85d3456948e650dff0cfc85603915847faf893ed1e66b020bb82ef4557120" + +[[package]] +name = "polkavm-linux-raw" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011697430dfcfe800d1d7c540ef69e3bdd66e9037cc38f01fee1c2e0908011e" [[package]] name = "polling" @@ -11623,7 +11546,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.34", + "rustix 0.38.36", "tracing", "windows-sys 0.59.0", ] @@ -11712,34 +11635,14 @@ dependencies = [ "termtree", ] -[[package]] -name = "pretty_assertions" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" -dependencies = [ - "diff", - "yansi", -] - -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - [[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.75", + "syn 2.0.77", ] [[package]] @@ -11784,11 +11687,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -11823,7 +11726,7 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -11834,7 +11737,7 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -11880,7 +11783,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -11905,116 +11808,115 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive 0.11.9", + "prost-derive 0.12.6", ] [[package]] name = "prost" -version = "0.12.6" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" dependencies = [ "bytes", - "prost-derive 0.12.6", + "prost-derive 0.13.2", ] [[package]] name = "prost-build" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck 0.4.1", - "itertools 0.10.5", - "lazy_static", + "heck 0.5.0", + "itertools 0.12.1", "log", - "multimap 0.8.3", + "multimap", + "once_cell", "petgraph", - "prettyplease 0.1.25", - "prost 0.11.9", - "prost-types 0.11.9", + "prettyplease", + "prost 0.12.6", + "prost-types 0.12.6", "regex", - "syn 1.0.109", + "syn 2.0.77", "tempfile", - "which", ] [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "f8650aabb6c35b860610e9cff5dc1af886c9e25073b7b1712a68972af4281302" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.12.1", + "itertools 0.13.0", "log", - "multimap 0.10.0", + "multimap", "once_cell", "petgraph", - "prettyplease 0.2.20", - "prost 0.12.6", - "prost-types 0.12.6", + "prettyplease", + "prost 0.13.2", + "prost-types 0.13.2", "regex", - "syn 2.0.75", + "syn 2.0.77", "tempfile", ] [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.77", ] [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "prost-types" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ - "prost 0.11.9", + "prost 0.12.6", ] [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "60caa6738c7369b940c3d49246a8d1749323674c65cb13010134f5c9bad5b519" dependencies = [ - "prost 0.12.6", + "prost 0.13.2", ] [[package]] name = "psm" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" dependencies = [ "cc", ] @@ -12062,24 +11964,6 @@ dependencies = [ "unsigned-varint 0.7.2", ] -[[package]] -name = "quinn" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8b432585672228923edbbf64b8b12c14e1112f62e88737655b4a083dbcd78e" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto 0.9.6", - "quinn-udp 0.3.2", - "rustc-hash 1.1.0", - "rustls 0.20.9", - "thiserror", - "tokio", - "tracing", - "webpki", -] - [[package]] name = "quinn" version = "0.10.2" @@ -12089,8 +11973,8 @@ dependencies = [ "bytes", "futures-io", "pin-project-lite", - "quinn-proto 0.10.6", - "quinn-udp 0.4.1", + "quinn-proto", + "quinn-udp", "rustc-hash 1.1.0", "rustls 0.21.12", "thiserror", @@ -12098,24 +11982,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "quinn-proto" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b0b33c13a79f669c85defaf4c275dc86a0c0372807d0ca3d78e0bb87274863" -dependencies = [ - "bytes", - "rand", - "ring 0.16.20", - "rustc-hash 1.1.0", - "rustls 0.20.9", - "slab", - "thiserror", - "tinyvec", - "tracing", - "webpki", -] - [[package]] name = "quinn-proto" version = "0.10.6" @@ -12133,19 +11999,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "quinn-udp" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641538578b21f5e5c8ea733b736895576d0fe329bb883b937db6f4d163dbaaf4" -dependencies = [ - "libc", - "quinn-proto 0.9.6", - "socket2 0.4.10", - "tracing", - "windows-sys 0.42.0", -] - [[package]] name = "quinn-udp" version = "0.4.1" @@ -12161,9 +12014,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -12353,7 +12206,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -12435,6 +12288,15 @@ dependencies = [ "quick-error", ] +[[package]] +name = "revive-runtime" +version = "0.1.0" +dependencies = [ + "parity-scale-codec", + "polkadot-sdk", + "scale-info", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -12515,7 +12377,6 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "binary-merkle-tree", "bitvec", @@ -12601,7 +12462,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", "staging-xcm", @@ -12615,7 +12476,6 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "polkadot-primitives", @@ -12700,18 +12560,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" -[[package]] -name = "runtime" -version = "0.1.0" -dependencies = [ - "eth-rpc-api", - "pallet-contracts-evm", - "pallet-contracts-evm-primitives", - "parity-scale-codec", - "polkadot-sdk", - "scale-info", -] - [[package]] name = "rustc-demangle" version = "0.1.24" @@ -12756,9 +12604,9 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver 1.0.23", ] @@ -12802,9 +12650,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ "bitflags 2.6.0", "errno", @@ -12845,22 +12693,22 @@ dependencies = [ "log", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.6", + "rustls-webpki 0.102.8", "subtle 2.6.1", "zeroize", ] [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "log", "once_cell", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.6", + "rustls-webpki 0.102.8", "subtle 2.6.1", "zeroize", ] @@ -12879,9 +12727,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", "rustls-pemfile 2.1.3", @@ -12917,22 +12765,22 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-platform-verifier" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93bda3f493b9abe5b93b3e7e3ecde0df292f2bd28c0296b90586ee0055ff5123" +checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" dependencies = [ "core-foundation", "core-foundation-sys", "jni", "log", "once_cell", - "rustls 0.23.12", - "rustls-native-certs 0.7.2", + "rustls 0.23.13", + "rustls-native-certs 0.7.3", "rustls-platform-verifier-android", - "rustls-webpki 0.102.6", + "rustls-webpki 0.102.8", "security-framework", "security-framework-sys", - "webpki-roots 0.26.3", + "webpki-roots 0.26.5", "winapi", ] @@ -12954,9 +12802,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -13050,18 +12898,16 @@ dependencies = [ [[package]] name = "sc-allocator" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", "sp-core", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-wasm-interface 20.0.0", "thiserror", ] [[package]] name = "sc-authority-discovery" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -13091,7 +12937,6 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "futures-timer", @@ -13113,7 +12958,6 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "sp-api", @@ -13128,7 +12972,6 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "clap", @@ -13145,29 +12988,27 @@ dependencies = [ "serde_json", "sp-blockchain", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-genesis-builder", "sp-io", "sp-runtime", "sp-state-machine", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", ] [[package]] name = "sc-chain-spec-derive" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sc-cli" version = "0.36.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "chrono", @@ -13208,7 +13049,6 @@ dependencies = [ [[package]] name = "sc-client-api" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "fnv", "futures", @@ -13223,11 +13063,11 @@ dependencies = [ "sp-consensus", "sp-core", "sp-database", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-runtime", "sp-state-machine", "sp-statement-store", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-trie", "substrate-prometheus-endpoint", ] @@ -13235,7 +13075,6 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "hash-db", "kvdb", @@ -13261,7 +13100,6 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -13285,7 +13123,6 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -13314,7 +13151,6 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "fork-tree", @@ -13339,7 +13175,7 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-slots", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-inherents", "sp-keystore", "sp-runtime", @@ -13350,10 +13186,9 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", @@ -13372,7 +13207,6 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -13396,7 +13230,7 @@ dependencies = [ "sp-consensus", "sp-consensus-beefy", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-keystore", "sp-runtime", "substrate-prometheus-endpoint", @@ -13408,10 +13242,9 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -13428,7 +13261,6 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "fork-tree", "parity-scale-codec", @@ -13441,7 +13273,6 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "ahash 0.8.11", "array-bytes", @@ -13475,7 +13306,7 @@ dependencies = [ "sp-consensus", "sp-consensus-grandpa", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-keystore", "sp-runtime", "substrate-prometheus-endpoint", @@ -13485,11 +13316,10 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "finality-grandpa", "futures", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "sc-client-api", @@ -13505,13 +13335,12 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "assert_matches", "async-trait", "futures", "futures-timer", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "sc-client-api", @@ -13540,7 +13369,6 @@ dependencies = [ [[package]] name = "sc-consensus-pow" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -13565,7 +13393,6 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -13588,7 +13415,6 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", @@ -13598,25 +13424,24 @@ dependencies = [ "schnellru", "sp-api", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-io", "sp-panic-handler", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-runtime-interface 24.0.0", "sp-trie", "sp-version", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-wasm-interface 20.0.0", "tracing", ] [[package]] name = "sc-executor-common" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "polkavm", + "polkavm 0.9.3", "sc-allocator", "sp-maybe-compressed-blob", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-wasm-interface 20.0.0", "thiserror", "wasm-instrument", ] @@ -13624,18 +13449,16 @@ dependencies = [ [[package]] name = "sc-executor-polkavm" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", - "polkavm", + "polkavm 0.9.3", "sc-executor-common", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-wasm-interface 20.0.0", ] [[package]] name = "sc-executor-wasmtime" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "anyhow", "cfg-if", @@ -13645,15 +13468,14 @@ dependencies = [ "rustix 0.36.17", "sc-allocator", "sc-executor-common", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-runtime-interface 24.0.0", + "sp-wasm-interface 20.0.0", "wasmtime", ] [[package]] name = "sc-informant" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "console", "futures", @@ -13670,7 +13492,6 @@ dependencies = [ [[package]] name = "sc-keystore" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "parking_lot 0.12.3", @@ -13684,7 +13505,6 @@ dependencies = [ [[package]] name = "sc-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "arrayvec 0.7.6", @@ -13713,7 +13533,6 @@ dependencies = [ [[package]] name = "sc-network" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -13764,7 +13583,6 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -13782,7 +13600,6 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "ahash 0.8.11", "futures", @@ -13801,7 +13618,6 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -13822,7 +13638,6 @@ dependencies = [ [[package]] name = "sc-network-statement" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -13842,7 +13657,6 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -13850,7 +13664,6 @@ dependencies = [ "fork-tree", "futures", "futures-timer", - "libp2p", "log", "mockall 0.11.4", "parity-scale-codec", @@ -13879,7 +13692,6 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "futures", @@ -13898,9 +13710,8 @@ dependencies = [ [[package]] name = "sc-network-types" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "bs58 0.5.1", + "bs58", "ed25519-dalek", "libp2p-identity", "litep2p", @@ -13915,7 +13726,6 @@ dependencies = [ [[package]] name = "sc-offchain" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "bytes", @@ -13938,7 +13748,7 @@ dependencies = [ "sc-utils", "sp-api", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-keystore", "sp-offchain", "sp-runtime", @@ -13949,7 +13759,6 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -13958,10 +13767,9 @@ dependencies = [ [[package]] name = "sc-rpc" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -13990,9 +13798,8 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "parity-scale-codec", "sc-chain-spec", "sc-mixnet", @@ -14010,8 +13817,8 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "dyn-clone", "forwarded-header-value", "futures", "governor", @@ -14019,8 +13826,9 @@ dependencies = [ "http-body-util", "hyper 1.4.1", "ip_network", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", + "sc-rpc-api", "serde", "serde_json", "substrate-prometheus-endpoint", @@ -14032,13 +13840,12 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "futures", "futures-util", "hex", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -14064,14 +13871,13 @@ dependencies = [ [[package]] name = "sc-service" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "directories", "exit-future", "futures", "futures-timer", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -14106,12 +13912,12 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-keystore", "sp-runtime", "sp-session", "sp-state-machine", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", @@ -14128,7 +13934,6 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.30.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", "parity-scale-codec", @@ -14139,7 +13944,6 @@ dependencies = [ [[package]] name = "sc-statement-store" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", "parity-db", @@ -14158,7 +13962,6 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "clap", "fs4", @@ -14171,9 +13974,8 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "parity-scale-codec", "sc-chain-spec", "sc-client-api", @@ -14190,7 +13992,6 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "derive_more", "futures", @@ -14203,15 +14004,14 @@ dependencies = [ "serde", "serde_json", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-io", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "sc-telemetry" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "chrono", "futures", @@ -14231,7 +14031,6 @@ dependencies = [ [[package]] name = "sc-tracing" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "chrono", "console", @@ -14250,7 +14049,7 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "thiserror", "tracing", "tracing-log", @@ -14260,18 +14059,16 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sc-transaction-pool" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -14287,9 +14084,9 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "sp-transaction-pool", "substrate-prometheus-endpoint", "thiserror", @@ -14298,7 +14095,6 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -14314,7 +14110,6 @@ dependencies = [ [[package]] name = "sc-utils" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-channel 1.9.0", "futures", @@ -14413,7 +14208,7 @@ version = "2.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 1.0.109", @@ -14438,7 +14233,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.75", + "syn 2.0.77", "thiserror", ] @@ -14465,11 +14260,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -14540,21 +14335,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "sctp-proto" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6220f78bb44c15f326b0596113305f6101097a18755d53727a575c97e09fb24" -dependencies = [ - "bytes", - "crc", - "fxhash", - "log", - "rand", - "slab", - "thiserror", -] - [[package]] name = "sec1" version = "0.7.3" @@ -14585,16 +14365,7 @@ version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ - "secp256k1-sys 0.9.2", -] - -[[package]] -name = "secp256k1" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" -dependencies = [ - "secp256k1-sys 0.10.0", + "secp256k1-sys", ] [[package]] @@ -14606,15 +14377,6 @@ dependencies = [ "cc", ] -[[package]] -name = "secp256k1-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" -dependencies = [ - "cc", -] - [[package]] name = "secrecy" version = "0.8.0" @@ -14713,9 +14475,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -14740,20 +14502,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -14793,18 +14555,6 @@ dependencies = [ "opaque-debug 0.3.1", ] -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", - "sha1-asm", -] - [[package]] name = "sha1" version = "0.10.6" @@ -14816,15 +14566,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha1-asm" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286acebaf8b67c1130aedffad26f594eff0c1292389158135327d2e23aed582b" -dependencies = [ - "cc", -] - [[package]] name = "sha2" version = "0.9.9" @@ -14908,9 +14649,9 @@ dependencies = [ [[package]] name = "simple-dns" -version = "0.5.7" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae9a3fcdadafb6d97f4c0e007e4247b114ee0f119f650c3cbf3a8b3a1479694" +checksum = "4c80e565e7dcc4f1ef247e2f395550d4cf7d777746d5988e7e4e3156b71077fc" dependencies = [ "bitflags 2.6.0", ] @@ -14951,7 +14692,6 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "enumn", "parity-scale-codec", @@ -14993,9 +14733,9 @@ dependencies = [ [[package]] name = "smol" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aad24f41392790e6ac67f4f4cd871da61f7d758e07b5622431e491e897d9c8a7" +checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f" dependencies = [ "async-channel 2.3.1", "async-executor", @@ -15020,7 +14760,7 @@ dependencies = [ "base64 0.21.7", "bip39", "blake2-rfc", - "bs58 0.5.1", + "bs58", "chacha20", "crossbeam-queue", "derive_more", @@ -15074,7 +14814,7 @@ dependencies = [ "base64 0.21.7", "bip39", "blake2-rfc", - "bs58 0.5.1", + "bs58", "chacha20", "crossbeam-queue", "derive_more", @@ -15184,7 +14924,7 @@ dependencies = [ "serde_json", "siphasher 1.0.1", "slab", - "smol 2.0.1", + "smol 2.0.2", "smoldot 0.16.0", "zeroize", ] @@ -15207,7 +14947,7 @@ dependencies = [ "curve25519-dalek", "rand_core", "ring 0.17.8", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "sha2 0.10.8", "subtle 2.6.1", ] @@ -15225,7 +14965,6 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "byte-slice-cast", "frame-support", @@ -15239,7 +14978,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "ssz_rs", "ssz_rs_derive", ] @@ -15247,7 +14986,6 @@ dependencies = [ [[package]] name = "snowbridge-core" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "ethabi-decode", "frame-support", @@ -15262,7 +15000,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", ] @@ -15270,7 +15008,6 @@ dependencies = [ [[package]] name = "snowbridge-ethereum" version = "0.3.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "ethabi-decode", "ethbloom", @@ -15284,7 +15021,7 @@ dependencies = [ "serde-big-array", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] @@ -15305,7 +15042,6 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-merkle-tree" version = "0.3.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -15316,20 +15052,18 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-runtime-api" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" 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.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-ethereum-client" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -15347,26 +15081,24 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-inbound-queue" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -15386,7 +15118,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -15394,19 +15126,17 @@ dependencies = [ [[package]] name = "snowbridge-pallet-inbound-queue-fixtures" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bridge-hub-common", "ethabi-decode", @@ -15422,13 +15152,12 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", ] [[package]] name = "snowbridge-pallet-system" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-benchmarking", "frame-support", @@ -15440,7 +15169,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -15448,7 +15177,6 @@ dependencies = [ [[package]] name = "snowbridge-router-primitives" version = "0.9.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "hex-literal", @@ -15459,7 +15187,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -15467,14 +15195,13 @@ dependencies = [ [[package]] name = "snowbridge-runtime-common" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "log", "parity-scale-codec", "snowbridge-core", "sp-arithmetic", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -15483,7 +15210,6 @@ dependencies = [ [[package]] name = "snowbridge-runtime-test-common" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -15514,12 +15240,11 @@ dependencies = [ [[package]] name = "snowbridge-system-runtime-api" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "snowbridge-core", "sp-api", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", ] @@ -15555,7 +15280,7 @@ dependencies = [ "httparse", "log", "rand", - "sha-1 0.9.8", + "sha-1", ] [[package]] @@ -15577,7 +15302,6 @@ dependencies = [ [[package]] name = "sp-api" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "hash-db", @@ -15586,10 +15310,10 @@ dependencies = [ "scale-info", "sp-api-proc-macro", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-metadata-ir", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-runtime-interface 24.0.0", "sp-state-machine", "sp-trie", "sp-version", @@ -15599,21 +15323,19 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "Inflector", "blake2 0.10.6", "expander", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sp-application-crypto" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -15625,7 +15347,6 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "integer-sqrt", @@ -15642,7 +15363,7 @@ version = "0.4.2" source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" dependencies = [ "ark-bls12-381-ext", - "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk.git)", ] [[package]] @@ -15651,13 +15372,12 @@ version = "0.4.2" source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" dependencies = [ "ark-ed-on-bls12-381-bandersnatch-ext", - "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk.git)", ] [[package]] name = "sp-authority-discovery" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -15669,7 +15389,6 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "sp-api", "sp-inherents", @@ -15679,7 +15398,6 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "futures", "parity-scale-codec", @@ -15698,7 +15416,6 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "futures", @@ -15713,7 +15430,6 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "parity-scale-codec", @@ -15729,7 +15445,6 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "parity-scale-codec", @@ -15747,7 +15462,6 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "lazy_static", "parity-scale-codec", @@ -15756,7 +15470,7 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-io", "sp-keystore", "sp-mmr-primitives", @@ -15768,7 +15482,6 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "finality-grandpa", "log", @@ -15785,7 +15498,6 @@ dependencies = [ [[package]] name = "sp-consensus-pow" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "sp-api", @@ -15796,7 +15508,6 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -15807,14 +15518,13 @@ dependencies = [ [[package]] name = "sp-core" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "bandersnatch_vrfs", "bitflags 1.3.2", "blake2 0.10.6", "bounded-collections", - "bs58 0.5.1", + "bs58", "dyn-clonable", "ed25519-zebra", "futures", @@ -15834,15 +15544,15 @@ dependencies = [ "rand", "scale-info", "schnorrkel 0.11.4", - "secp256k1 0.28.2", + "secp256k1", "secrecy", "serde", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", + "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", @@ -15854,15 +15564,13 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", ] [[package]] name = "sp-core-hashing-proc-macro" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "sp-crypto-hashing-proc-macro", ] @@ -15870,7 +15578,6 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -15884,13 +15591,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.git?branch=master)", + "sp-runtime-interface 24.0.0", ] [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -15904,14 +15611,12 @@ 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)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", ] [[package]] name = "sp-crypto-hashing" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9927a7f81334ed5b8a98a4a978c81324d12bd9713ec76b5c68fd410174c5eb" dependencies = [ "blake2b_simd", "byteorder", @@ -15924,7 +15629,8 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9927a7f81334ed5b8a98a4a978c81324d12bd9713ec76b5c68fd410174c5eb" dependencies = [ "blake2b_simd", "byteorder", @@ -15937,17 +15643,15 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "quote", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "syn 2.0.75", + "sp-crypto-hashing 0.1.0", + "syn 2.0.77", ] [[package]] name = "sp-database" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "kvdb", "parking_lot 0.12.3", @@ -15956,47 +15660,44 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "environmental", "parity-scale-codec", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", ] [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "environmental", "parity-scale-codec", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", ] [[package]] name = "sp-genesis-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -16008,7 +15709,6 @@ dependencies = [ [[package]] name = "sp-inherents" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -16021,7 +15721,6 @@ dependencies = [ [[package]] name = "sp-io" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bytes", "docify", @@ -16029,16 +15728,16 @@ dependencies = [ "libsecp256k1", "log", "parity-scale-codec", - "polkavm-derive", + "polkavm-derive 0.9.1", "rustversion", - "secp256k1 0.28.2", + "secp256k1", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", + "sp-externalities 0.25.0", "sp-keystore", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-runtime-interface 24.0.0", "sp-state-machine", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", "sp-trie", "tracing", "tracing-core", @@ -16047,7 +15746,6 @@ dependencies = [ [[package]] name = "sp-keyring" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "sp-core", "sp-runtime", @@ -16057,18 +15755,16 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", ] [[package]] name = "sp-maybe-compressed-blob" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "thiserror", "zstd 0.12.4", @@ -16077,7 +15773,6 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-metadata 16.0.0", "parity-scale-codec", @@ -16087,7 +15782,6 @@ dependencies = [ [[package]] name = "sp-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -16098,7 +15792,6 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "log", "parity-scale-codec", @@ -16107,7 +15800,7 @@ dependencies = [ "serde", "sp-api", "sp-core", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-debug-derive 14.0.0", "sp-runtime", "thiserror", ] @@ -16115,7 +15808,6 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -16128,7 +15820,6 @@ dependencies = [ [[package]] name = "sp-offchain" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "sp-api", "sp-core", @@ -16138,7 +15829,6 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "backtrace", "lazy_static", @@ -16148,7 +15838,6 @@ dependencies = [ [[package]] name = "sp-rpc" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "rustc-hash 1.1.0", "serde", @@ -16158,8 +15847,8 @@ dependencies = [ [[package]] name = "sp-runtime" version = "31.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "binary-merkle-tree", "docify", "either", "hash256-std-hasher", @@ -16176,7 +15865,8 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-io", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", + "sp-trie", "sp-weights", "tracing", ] @@ -16184,71 +15874,68 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "polkavm-derive", + "polkavm-derive 0.9.1", "primitive-types", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "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#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "polkavm-derive", + "polkavm-derive 0.9.1", "primitive-types", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "Inflector", "expander", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "Inflector", "expander", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sp-session" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "scale-info", @@ -16262,7 +15949,6 @@ dependencies = [ [[package]] name = "sp-staking" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -16275,7 +15961,6 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "hash-db", "log", @@ -16284,7 +15969,7 @@ dependencies = [ "rand", "smallvec", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "sp-panic-handler", "sp-trie", "thiserror", @@ -16295,7 +15980,6 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "aes-gcm", "curve25519-dalek", @@ -16308,10 +15992,10 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", + "sp-externalities 0.25.0", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-runtime-interface 24.0.0", "thiserror", "x25519-dalek", ] @@ -16319,41 +16003,38 @@ dependencies = [ [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-debug-derive 14.0.0", ] [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git)", ] [[package]] name = "sp-timestamp" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "parity-scale-codec", @@ -16365,7 +16046,6 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", "tracing", @@ -16376,7 +16056,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ "parity-scale-codec", "tracing", @@ -16387,7 +16067,6 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "sp-api", "sp-runtime", @@ -16396,7 +16075,6 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", "parity-scale-codec", @@ -16410,7 +16088,6 @@ dependencies = [ [[package]] name = "sp-trie" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "ahash 0.8.11", "hash-db", @@ -16423,7 +16100,7 @@ dependencies = [ "scale-info", "schnellru", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-externalities 0.25.0", "thiserror", "tracing", "trie-db", @@ -16433,7 +16110,6 @@ dependencies = [ [[package]] name = "sp-version" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "impl-serde", "parity-scale-codec", @@ -16442,7 +16118,7 @@ dependencies = [ "serde", "sp-crypto-hashing-proc-macro", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "sp-version-proc-macro", "thiserror", ] @@ -16450,18 +16126,17 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "parity-scale-codec", + "proc-macro-warning 1.0.2", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -16473,8 +16148,9 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#717bbb24c40717e70d2e3b648bcd372559c71bd2" +source = "git+https://github.com/paritytech/polkadot-sdk.git#d66dee3c3da836bcf41a12ca4e1191faee0b6a5b" dependencies = [ + "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -16483,7 +16159,6 @@ dependencies = [ [[package]] name = "sp-weights" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "bounded-collections", "parity-scale-codec", @@ -16491,7 +16166,7 @@ dependencies = [ "serde", "smallvec", "sp-arithmetic", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-debug-derive 14.0.0", ] [[package]] @@ -16538,9 +16213,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.47.0" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4743ce898933fbff7bbf414f497c459a782d496269644b3d650a398ae6a487ba" +checksum = "43fce22ed1df64d04b262351c8f9d5c6da4f76f79f25ad15529792f893fad25d" dependencies = [ "Inflector", "num-format", @@ -16583,19 +16258,18 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "staging-chain-spec-builder" version = "1.6.1" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "clap", "log", "sc-chain-spec", + "serde", "serde_json", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-tracing 16.0.0", ] [[package]] name = "staging-node-inspect" version = "0.12.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "clap", "parity-scale-codec", @@ -16613,7 +16287,6 @@ dependencies = [ [[package]] name = "staging-parachain-info" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -16626,12 +16299,10 @@ dependencies = [ [[package]] name = "staging-tracking-allocator" version = "2.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" [[package]] name = "staging-xcm" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "array-bytes", "bounded-collections", @@ -16650,7 +16321,6 @@ dependencies = [ [[package]] name = "staging-xcm-builder" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -16672,7 +16342,6 @@ dependencies = [ [[package]] name = "staging-xcm-executor" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "environmental", "frame-benchmarking", @@ -16723,26 +16392,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "str0m" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6706347e49b13373f7ddfafad47df7583ed52083d6fc8a594eb2c80497ef959d" -dependencies = [ - "combine", - "crc", - "fastrand 2.1.0", - "hmac 0.12.1", - "once_cell", - "openssl", - "openssl-sys", - "sctp-proto", - "serde", - "sha-1 0.10.1", - "thiserror", - "tracing", -] - [[package]] name = "string-interner" version = "0.17.0" @@ -16807,13 +16456,12 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "subkey" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "clap", "sc-cli", @@ -16822,7 +16470,6 @@ dependencies = [ [[package]] name = "substrate-bip39" version = "0.4.7" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -16834,30 +16481,27 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" [[package]] name = "substrate-frame-rpc-support" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "parity-scale-codec", "sc-rpc-api", "serde", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", ] [[package]] name = "substrate-frame-rpc-system" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "docify", "frame-system-rpc-runtime-api", "futures", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "parity-scale-codec", "sc-rpc-api", @@ -16872,7 +16516,6 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "http-body-util", "hyper 1.4.1", @@ -16886,10 +16529,9 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "async-trait", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "log", "sc-rpc-api", "serde", @@ -16899,9 +16541,8 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.4", "parity-scale-codec", "sc-client-api", "sc-rpc-api", @@ -16916,7 +16557,6 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "build-helper", "cargo_metadata", @@ -16924,7 +16564,8 @@ dependencies = [ "filetime", "jobserver", "parity-wasm", - "polkavm-linker", + "polkavm-linker 0.9.2", + "shlex", "sp-maybe-compressed-blob", "strum 0.26.3", "tempfile", @@ -17003,7 +16644,7 @@ dependencies = [ "scale-info", "scale-typegen", "subxt-metadata", - "syn 2.0.75", + "syn 2.0.77", "thiserror", "tokio", ] @@ -17064,7 +16705,7 @@ dependencies = [ "quote", "scale-typegen", "subxt-codegen", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17093,9 +16734,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.75" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -17111,7 +16752,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17134,7 +16775,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17177,9 +16818,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", - "fastrand 2.1.0", + "fastrand 2.1.1", "once_cell", - "rustix 0.38.34", + "rustix 0.38.36", "windows-sys 0.59.0", ] @@ -17198,7 +16839,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.38.34", + "rustix 0.38.36", "windows-sys 0.48.0", ] @@ -17211,7 +16852,6 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "testnet-parachains-constants" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -17249,7 +16889,7 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17260,7 +16900,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17389,9 +17029,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.3" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -17413,7 +17053,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17454,16 +17094,16 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.12", + "rustls 0.23.13", "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -17488,9 +17128,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -17518,7 +17158,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit", ] [[package]] @@ -17530,28 +17170,17 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.4.0", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow", ] [[package]] @@ -17633,7 +17262,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17659,7 +17288,6 @@ dependencies = [ [[package]] name = "tracing-gum" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "coarsetime", "polkadot-primitives", @@ -17670,13 +17298,12 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "expander", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -17766,7 +17393,7 @@ dependencies = [ "async-trait", "cfg-if", "data-encoding", - "enum-as-inner 0.6.0", + "enum-as-inner 0.6.1", "futures-channel", "futures-io", "futures-util", @@ -17900,9 +17527,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -18120,7 +17747,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", "wasm-bindgen-shared", ] @@ -18154,7 +17781,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -18542,9 +18169,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" dependencies = [ "rustls-pki-types", ] @@ -18552,7 +18179,6 @@ dependencies = [ [[package]] name = "westend-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "binary-merkle-tree", "bitvec", @@ -18626,6 +18252,7 @@ dependencies = [ "scale-info", "serde", "serde_derive", + "serde_json", "smallvec", "sp-api", "sp-application-crypto", @@ -18634,6 +18261,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-babe", "sp-consensus-beefy", + "sp-consensus-grandpa", "sp-core", "sp-genesis-builder", "sp-inherents", @@ -18644,7 +18272,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", "staging-xcm", @@ -18658,7 +18286,6 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "polkadot-primitives", @@ -18671,18 +18298,6 @@ dependencies = [ "staging-xcm-builder", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.34", -] - [[package]] name = "wide" version = "0.7.28" @@ -18758,21 +18373,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -18987,15 +18587,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "0.6.18" @@ -19064,7 +18655,7 @@ dependencies = [ "der-parser 9.0.0", "lazy_static", "nom", - "oid-registry 0.7.0", + "oid-registry 0.7.1", "rusticata-macros", "thiserror", "time", @@ -19073,8 +18664,8 @@ dependencies = [ [[package]] name = "xcm-emulator" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ + "array-bytes", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", @@ -19095,11 +18686,11 @@ dependencies = [ "polkadot-runtime-parachains", "sp-arithmetic", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-crypto-hashing 0.1.0", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", + "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-executor", ] @@ -19107,18 +18698,16 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "xcm-runtime-apis" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "parity-scale-codec", @@ -19132,7 +18721,6 @@ dependencies = [ [[package]] name = "xcm-simulator" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=master#717bbb24c40717e70d2e3b648bcd372559c71bd2" dependencies = [ "frame-support", "frame-system", @@ -19145,7 +18733,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?branch=master)", + "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -19153,9 +18741,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" +checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" [[package]] name = "xmltree" @@ -19181,12 +18769,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "yap" version = "0.11.0" @@ -19220,7 +18802,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -19240,7 +18822,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 53595f9..b28178f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,18 +3,14 @@ authors = ["Parity Technologies "] edition = "2021" homepage = "https://substrate.io" license = "MIT-0" -repository = "https://github.com/paritytech/eth-rpc.git" +repository = "https://github.com/paritytech/revive-ethereum-rpc.git" version = "0.1.0" [workspace] members = [ "chain/node", - "chain/pallet-contracts-evm", - "chain/primitives", "chain/runtime", "rpc", - "rpc/api", - "rpc/codegen", ] resolver = "2" @@ -38,22 +34,14 @@ indoc = "2.0.5" jsonrpsee = { version = "0.24.0", features = ["full"] } lazy_static = "1.5.0" log = { version = "0.4.22", default-features = false } -parity-scale-codec = { version = "3", features = [ - "derive", -], default-features = false } -polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk.git", default-features = false, branch = "master" } -polkavm = "0.9.3" -polkavm-derive = "0.9.1" -polkavm-linker = "0.9.2" +codec = { version = "3", package = "parity-scale-codec", features = ["derive"], default-features = false } +polkadot-sdk = { path = "../polkadot-sdk/umbrella", default-features = false } pretty_assertions = "1.4.0" quote = { version = "1.0.36" } rlp = { version = "0.5.2", default-features = false } scale-info = { version = "2", features = ["derive"], default-features = false } -secp256k1 = { version = "0.29.0", features = ["recovery"] } serde = { version = "1", features = ["derive"], default-features = false } -serde-big-array = { version = "0.5.1" } serde_json = { version = "1.0.120", default-features = false } -serde_yaml = { version = "0.9" } subxt = { version = "0.37.0", features = ["unstable-reconnecting-rpc-client"] } subxt-signer = "0.37.0" syn = { version = "2.0.72" } @@ -63,3 +51,8 @@ tower = "0.4.13" tower-http = { version = "0.5.2", features = ["full"] } tracing = { version = "0.1.40" } tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +scale-decode = {version = "0.13.1", features = ["derive", "primitive-types"] } +secp256k1 = { version = "0.28.0", features = ["recovery"] } + +# [patch.crates-io] +# sp-crypto-hashing = { git = "https://github.com/paritytech/polkadot-sdk.git" } diff --git a/Makefile b/Makefile index 74906c6..e6dc1f7 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ .PHONY: node node: - RUST_LOG="error,evm=trace,sc_rpc_server=info,runtime::contracts=trace" cargo run -p node -- --dev --consensus instant-seal + RUST_LOG="error,evm=debug,sc_rpc_server=info,runtime::revive=debug" cargo run -p node -- --dev --consensus instant-seal .PHONY: rpc rpc: - cargo run -p eth-rpc --features dev + RUST_LOG="eth-rpc=debug" cargo run -p eth-rpc --features dev .PHONY: demo demo: @@ -12,9 +12,9 @@ demo: .PHONY: metadata metadata: - @subxt explore --url ws://localhost:9944 pallet ContractsEvm constants chainId > /dev/null - subxt metadata --url ws://localhost:9944 -o eth-rpc-server/metadata.scale - touch eth-rpc-server/src/subxt_client.rs + @subxt explore --url ws://localhost:9944 pallet Revive constants chainId > /dev/null + subxt metadata --url ws://localhost:9944 -o rpc/metadata.scale + touch rpc/src/subxt_client.rs SALT ?= 0 .PHONY: example_deploy @@ -25,6 +25,3 @@ example_deploy: example_transfer: RUST_LOG=info cargo run --manifest-path rpc/Cargo.toml --features example --example transfer -codegen: - cargo run -p eth-rpc-codegen - cargo +nightly fmt diff --git a/README.md b/README.md index c13a1ba..445a97f 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ This serves the following purposes: It uses [subxt](https://github.com/paritytech/subxt) to interact with the Substrate node hosting the RISC-V contracts runtime pallet. - `./chain` - A Node bootstrapped from the [minimal template](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal) - The node is configured with pallet-contracts and an [evm adapter pallet](./chain/pallet-contracts-evm). + A Node configured with `pallet-revive` bootstrapped from the [minimal template](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal) - `./demo` A barebone html page to interact with the node using MetaMask and [Ether.js](https://github.com/ethers-io/ethers.js). @@ -66,7 +65,7 @@ Make sure the node and the rpc server are started, and use the following setting - Network name: Revive demo - RPC URL: -- Chain ID: [596](https://github.com/paritytech/revive-ethereum-rpc/blob/main/chain/runtime/src/lib.rs?plain=1#L198) +- Chain ID: [42](https://github.com/paritytech/revive-ethereum-rpc/blob/main/chain/runtime/src/lib.rs?plain=1#L198) - Currency Symbol: `DEV` #### Import Dev account diff --git a/chain/node/Cargo.toml b/chain/node/Cargo.toml index da24212..31a205f 100644 --- a/chain/node/Cargo.toml +++ b/chain/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node" -description = "A node running the runtime with pallet-contracts and pallet-contracts-evm" +description = "A node running the runtime with pallet-revive" version = "0.1.0" license = "MIT-0" authors.workspace = true @@ -17,12 +17,12 @@ targets = ["x86_64-unknown-linux-gnu"] clap.workspace = true futures.workspace = true futures-timer.workspace = true -jsonrpsee = { version = "0.23.2", features = ["server"] } +jsonrpsee = { workspace = true, features = ["server"] } serde_json = { workspace = true, default-features = true } hex-literal.workspace = true polkadot-sdk = { workspace = true, features = ["experimental", "node"] } -runtime = { path = "../runtime" } +runtime = { package = "revive-runtime", path = "../runtime" } [build-dependencies] polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] } diff --git a/chain/node/build.rs b/chain/node/build.rs index 468b1ae..b260368 100644 --- a/chain/node/build.rs +++ b/chain/node/build.rs @@ -18,6 +18,6 @@ use polkadot_sdk::substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; fn main() { - generate_cargo_keys(); - rerun_if_git_head_changed(); + generate_cargo_keys(); + rerun_if_git_head_changed(); } diff --git a/chain/node/src/chain_spec.rs b/chain/node/src/chain_spec.rs index 9d4f305..076dd14 100644 --- a/chain/node/src/chain_spec.rs +++ b/chain/node/src/chain_spec.rs @@ -15,53 +15,56 @@ // See the License for the specific language governing permissions and // limitations under the License. -use hex_literal::hex; use polkadot_sdk::{ - sc_service::{ChainType, Properties}, - sp_keyring::AccountKeyring, - *, + sc_service::{ChainType, Properties}, + sp_keyring::AccountKeyring, + *, }; -use runtime::{BalancesConfig, ContractsEvmConfig, SudoConfig, NATIVE_DECIMALS, WASM_BINARY}; +use runtime::{BalancesConfig, SudoConfig, NATIVE_DECIMALS, WASM_BINARY}; use serde_json::{json, Value}; +use sp_runtime::AccountId32; /// This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec; fn props() -> Properties { - let mut properties = Properties::new(); - properties.insert("tokenDecimals".to_string(), NATIVE_DECIMALS.into()); - properties.insert("tokenSymbol".to_string(), "REV".into()); - properties + let mut properties = Properties::new(); + properties.insert("tokenDecimals".to_string(), NATIVE_DECIMALS.into()); + properties.insert("tokenSymbol".to_string(), "REV".into()); + properties } pub fn development_config() -> Result { - Ok(ChainSpec::builder( - WASM_BINARY.expect("Development wasm not available"), - Default::default(), - ) - .with_name("Development") - .with_id("dev") - .with_chain_type(ChainType::Development) - .with_genesis_config_patch(testnet_genesis()) - .with_properties(props()) - .build()) + Ok(ChainSpec::builder(WASM_BINARY.expect("Development wasm not available"), Default::default()) + .with_name("Development") + .with_id("dev") + .with_chain_type(ChainType::Development) + .with_genesis_config_patch(testnet_genesis()) + .with_properties(props()) + .build()) } /// Configure initial storage state for FRAME pallets. fn testnet_genesis() -> Value { - use polkadot_sdk::polkadot_sdk_frame::traits::Get; - use runtime::interface::{Balance, MinimumBalance}; - let endowment = >::get().max(1) * 100_000_000_000_000_000; - let balances = AccountKeyring::iter() - .map(|a| (a.to_account_id(), endowment)) - .collect::>(); - json!({ - "balances": BalancesConfig { balances }, - "sudo": SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) }, - "contractsEvm": ContractsEvmConfig { - endowed_accounts: vec![ - (hex!("75e480db528101a381ce68544611c169ad7eb342").into(), endowment)], - }, + use polkadot_sdk::{polkadot_sdk_frame::traits::Get, sp_application_crypto::Ss58Codec}; + use runtime::interface::{Balance, MinimumBalance}; - }) + let alice_ecdsa = + AccountId32::from_string("13VAtLwNPFNMpqRJ6yzU4cwe3w4eyS9pDaLVW5DFzdvFwWa").unwrap(); + let alice_eee = to_account_id(hex_literal::hex!("75e480db528101a381ce68544611c169ad7eb342")); + let endowment = >::get().max(1) * 100_000_000_000_000_000; + let balances = AccountKeyring::iter() + .map(|a| (a.to_account_id(), endowment)) + .chain(vec![(alice_ecdsa, endowment), (alice_eee, endowment * 2)]) + .collect::>(); + json!({ + "balances": BalancesConfig { balances }, + "sudo": SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) }, + }) +} + +fn to_account_id(address: [u8; 20]) -> AccountId32 { + let mut account_id = AccountId32::new([0xEE; 32]); + >::as_mut(&mut account_id)[..20].copy_from_slice(&address); + account_id } diff --git a/chain/node/src/cli.rs b/chain/node/src/cli.rs index c7a9eae..54107df 100644 --- a/chain/node/src/cli.rs +++ b/chain/node/src/cli.rs @@ -19,63 +19,63 @@ use polkadot_sdk::{sc_cli::RunCmd, *}; #[derive(Debug, Clone)] pub enum Consensus { - ManualSeal(u64), - InstantSeal, + ManualSeal(u64), + InstantSeal, } impl std::str::FromStr for Consensus { - type Err = String; - - fn from_str(s: &str) -> Result { - Ok(if s == "instant-seal" { - Consensus::InstantSeal - } else if let Some(block_time) = s.strip_prefix("manual-seal-") { - Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?) - } else { - return Err("incorrect consensus identifier".into()); - }) - } + type Err = String; + + fn from_str(s: &str) -> Result { + Ok(if s == "instant-seal" { + Consensus::InstantSeal + } else if let Some(block_time) = s.strip_prefix("manual-seal-") { + Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?) + } else { + return Err("incorrect consensus identifier".into()); + }) + } } #[derive(Debug, clap::Parser)] pub struct Cli { - #[command(subcommand)] - pub subcommand: Option, + #[command(subcommand)] + pub subcommand: Option, - #[clap(long, default_value = "manual-seal-3000")] - pub consensus: Consensus, + #[clap(long, default_value = "manual-seal-3000")] + pub consensus: Consensus, - #[clap(flatten)] - pub run: RunCmd, + #[clap(flatten)] + pub run: RunCmd, } #[derive(Debug, clap::Subcommand)] pub enum Subcommand { - /// Key management cli utilities - #[command(subcommand)] - Key(sc_cli::KeySubcommand), + /// Key management cli utilities + #[command(subcommand)] + Key(sc_cli::KeySubcommand), - /// Build a chain specification. - BuildSpec(sc_cli::BuildSpecCmd), + /// Build a chain specification. + BuildSpec(sc_cli::BuildSpecCmd), - /// Validate blocks. - CheckBlock(sc_cli::CheckBlockCmd), + /// Validate blocks. + CheckBlock(sc_cli::CheckBlockCmd), - /// Export blocks. - ExportBlocks(sc_cli::ExportBlocksCmd), + /// Export blocks. + ExportBlocks(sc_cli::ExportBlocksCmd), - /// Export the state of a given block into a chain spec. - ExportState(sc_cli::ExportStateCmd), + /// Export the state of a given block into a chain spec. + ExportState(sc_cli::ExportStateCmd), - /// Import blocks. - ImportBlocks(sc_cli::ImportBlocksCmd), + /// Import blocks. + ImportBlocks(sc_cli::ImportBlocksCmd), - /// Remove the whole chain. - PurgeChain(sc_cli::PurgeChainCmd), + /// Remove the whole chain. + PurgeChain(sc_cli::PurgeChainCmd), - /// Revert the chain to a previous state. - Revert(sc_cli::RevertCmd), + /// Revert the chain to a previous state. + Revert(sc_cli::RevertCmd), - /// Db meta columns information. - ChainInfo(sc_cli::ChainInfoCmd), + /// Db meta columns information. + ChainInfo(sc_cli::ChainInfoCmd), } diff --git a/chain/node/src/command.rs b/chain/node/src/command.rs index b946a78..58fd4b6 100644 --- a/chain/node/src/command.rs +++ b/chain/node/src/command.rs @@ -16,9 +16,9 @@ // limitations under the License. use crate::{ - chain_spec, - cli::{Cli, Subcommand}, - service, + chain_spec, + cli::{Cli, Subcommand}, + service, }; use polkadot_sdk::{sc_cli::SubstrateCli, sc_service::PartialComponents, *}; @@ -26,132 +26,108 @@ use polkadot_sdk::{sc_cli::SubstrateCli, sc_service::PartialComponents, *}; use try_runtime_cli::block_building_info::timestamp_with_aura_info; impl SubstrateCli for Cli { - fn impl_name() -> String { - "Substrate Node".into() - } + fn impl_name() -> String { + "Substrate Node".into() + } - fn impl_version() -> String { - env!("SUBSTRATE_CLI_IMPL_VERSION").into() - } + fn impl_version() -> String { + env!("SUBSTRATE_CLI_IMPL_VERSION").into() + } - fn description() -> String { - env!("CARGO_PKG_DESCRIPTION").into() - } + fn description() -> String { + env!("CARGO_PKG_DESCRIPTION").into() + } - fn author() -> String { - env!("CARGO_PKG_AUTHORS").into() - } + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() + } - fn support_url() -> String { - "support.anonymous.an".into() - } + fn support_url() -> String { + "support.anonymous.an".into() + } - fn copyright_start_year() -> i32 { - 2017 - } + fn copyright_start_year() -> i32 { + 2017 + } - fn load_spec(&self, id: &str) -> Result, String> { - Ok(match id { - "dev" => Box::new(chain_spec::development_config()?), - path => Box::new(chain_spec::ChainSpec::from_json_file( - std::path::PathBuf::from(path), - )?), - }) - } + fn load_spec(&self, id: &str) -> Result, String> { + Ok(match id { + "dev" => Box::new(chain_spec::development_config()?), + path => + Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), + }) + } } /// Parse and run command line arguments pub fn run() -> sc_cli::Result<()> { - let cli = Cli::from_args(); + let cli = Cli::from_args(); - match &cli.subcommand { - Some(Subcommand::Key(cmd)) => cmd.run(&cli), - Some(Subcommand::BuildSpec(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) - } - Some(Subcommand::CheckBlock(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - import_queue, - .. - } = service::new_partial(&config)?; - Ok((cmd.run(client, import_queue), task_manager)) - }) - } - Some(Subcommand::ExportBlocks(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - .. - } = service::new_partial(&config)?; - Ok((cmd.run(client, config.database), task_manager)) - }) - } - Some(Subcommand::ExportState(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - .. - } = service::new_partial(&config)?; - Ok((cmd.run(client, config.chain_spec), task_manager)) - }) - } - Some(Subcommand::ImportBlocks(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - import_queue, - .. - } = service::new_partial(&config)?; - Ok((cmd.run(client, import_queue), task_manager)) - }) - } - Some(Subcommand::PurgeChain(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.sync_run(|config| cmd.run(config.database)) - } - Some(Subcommand::Revert(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - backend, - .. - } = service::new_partial(&config)?; - Ok((cmd.run(client, backend, None), task_manager)) - }) - } - Some(Subcommand::ChainInfo(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.sync_run(|config| cmd.run::(&config)) - } - None => { - let runner = cli.create_runner(&cli.run)?; - runner.run_node_until_exit(|config| async move { - match config.network.network_backend { - sc_network::config::NetworkBackendType::Libp2p => { - service::new_full::>(config, cli.consensus) - .map_err(sc_cli::Error::Service) - } - sc_network::config::NetworkBackendType::Litep2p => service::new_full::< - sc_network::Litep2pNetworkBackend, - >( - config, cli.consensus - ) - .map_err(sc_cli::Error::Service), - } - }) - } - } + match &cli.subcommand { + Some(Subcommand::Key(cmd)) => cmd.run(&cli), + Some(Subcommand::BuildSpec(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) + }, + Some(Subcommand::CheckBlock(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, import_queue, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, import_queue), task_manager)) + }) + }, + Some(Subcommand::ExportBlocks(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, .. } = service::new_partial(&config)?; + Ok((cmd.run(client, config.database), task_manager)) + }) + }, + Some(Subcommand::ExportState(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, .. } = service::new_partial(&config)?; + Ok((cmd.run(client, config.chain_spec), task_manager)) + }) + }, + Some(Subcommand::ImportBlocks(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, import_queue, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, import_queue), task_manager)) + }) + }, + Some(Subcommand::PurgeChain(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.database)) + }, + Some(Subcommand::Revert(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, backend, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, backend, None), task_manager)) + }) + }, + Some(Subcommand::ChainInfo(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run::(&config)) + }, + None => { + let runner = cli.create_runner(&cli.run)?; + runner.run_node_until_exit(|config| async move { + match config.network.network_backend { + sc_network::config::NetworkBackendType::Libp2p => + service::new_full::>(config, cli.consensus) + .map_err(sc_cli::Error::Service), + sc_network::config::NetworkBackendType::Litep2p => service::new_full::< + sc_network::Litep2pNetworkBackend, + >(config, cli.consensus) + .map_err(sc_cli::Error::Service), + } + }) + }, + } } diff --git a/chain/node/src/main.rs b/chain/node/src/main.rs index 9594350..ed6cb96 100644 --- a/chain/node/src/main.rs +++ b/chain/node/src/main.rs @@ -16,7 +16,7 @@ // limitations under the License. //! Substrate Node Template CLI library. -#![warn(missing_docs)] +//#![warn(missing_docs)] mod chain_spec; mod cli; @@ -25,5 +25,5 @@ mod rpc; mod service; fn main() -> polkadot_sdk::sc_cli::Result<()> { - command::run() + command::run() } diff --git a/chain/node/src/rpc.rs b/chain/node/src/rpc.rs index 32ef9df..94cb0dc 100644 --- a/chain/node/src/rpc.rs +++ b/chain/node/src/rpc.rs @@ -20,54 +20,47 @@ //! used by Substrate nodes. This file extends those RPC definitions with //! capabilities that are specific to this project's runtime configuration. -#![warn(missing_docs)] +//#![warn(missing_docs)] use jsonrpsee::RpcModule; use polkadot_sdk::{ - sc_transaction_pool_api::TransactionPool, - sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}, - *, + sc_transaction_pool_api::TransactionPool, + sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}, + *, }; use runtime::interface::{AccountId, Nonce, OpaqueBlock}; use std::sync::Arc; -pub use polkadot_sdk::sc_rpc_api::DenyUnsafe; - /// Full client dependencies. pub struct FullDeps { - /// The client instance to use. - pub client: Arc, - /// Transaction pool instance. - pub pool: Arc

, - /// Whether to deny unsafe calls - pub deny_unsafe: DenyUnsafe, + /// The client instance to use. + pub client: Arc, + /// Transaction pool instance. + pub pool: Arc

, } /// Instantiate all full RPC extensions. pub fn create_full( - deps: FullDeps, + deps: FullDeps, ) -> Result, Box> where - C: Send - + Sync - + 'static - + sp_api::ProvideRuntimeApi - + HeaderBackend - + HeaderMetadata - + 'static, - C::Api: sp_block_builder::BlockBuilder, - C::Api: substrate_frame_rpc_system::AccountNonceApi, - P: TransactionPool + 'static, + C: Send + + Sync + + 'static + + sp_api::ProvideRuntimeApi + + HeaderBackend + + HeaderMetadata + + 'static, + C::Api: sp_block_builder::BlockBuilder, + C::Api: substrate_frame_rpc_system::AccountNonceApi, + P: TransactionPool + 'static, { - use polkadot_sdk::substrate_frame_rpc_system::{System, SystemApiServer}; - let mut module = RpcModule::new(()); - let FullDeps { - client, - pool, - deny_unsafe, - } = deps; + use polkadot_sdk::substrate_frame_rpc_system::{System, SystemApiServer}; + let mut module = RpcModule::new(()); + let FullDeps { client, pool } = deps; - module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; + let system = System::new(client.clone(), pool.clone()).into_rpc(); + module.merge(system)?; - Ok(module) + Ok(module) } diff --git a/chain/node/src/service.rs b/chain/node/src/service.rs index 1490b41..d4cbfc6 100644 --- a/chain/node/src/service.rs +++ b/chain/node/src/service.rs @@ -17,13 +17,15 @@ use futures::FutureExt; use polkadot_sdk::{ - sc_client_api::backend::Backend, - sc_executor::WasmExecutor, - sc_service::{error::Error as ServiceError, Configuration, TaskManager}, - sc_telemetry::{Telemetry, TelemetryWorker}, - sc_transaction_pool_api::OffchainTransactionPoolFactory, - sp_runtime::traits::Block as BlockT, - *, + sc_client_api::backend::Backend, + sc_executor::WasmExecutor, + sc_service::{ + build_polkadot_syncing_strategy, error::Error as ServiceError, Configuration, TaskManager, + }, + sc_telemetry::{Telemetry, TelemetryWorker}, + sc_transaction_pool_api::OffchainTransactionPoolFactory, + sp_runtime::traits::Block as BlockT, + *, }; use runtime::{self, interface::OpaqueBlock as Block, RuntimeApi}; use std::sync::Arc; @@ -31,253 +33,249 @@ use std::sync::Arc; use crate::cli::Consensus; #[cfg(feature = "runtime-benchmarks")] -type HostFunctions = ( - sp_io::SubstrateHostFunctions, - frame_benchmarking::benchmarking::HostFunctions, -); +type HostFunctions = + (sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions); #[cfg(not(feature = "runtime-benchmarks"))] type HostFunctions = sp_io::SubstrateHostFunctions; pub(crate) type FullClient = - sc_service::TFullClient>; + sc_service::TFullClient>; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; /// Assembly of PartialComponents (enough to run chain ops subcommands) pub type Service = sc_service::PartialComponents< - FullClient, - FullBackend, - FullSelectChain, - sc_consensus::DefaultImportQueue, - sc_transaction_pool::FullPool, - Option, + FullClient, + FullBackend, + FullSelectChain, + sc_consensus::DefaultImportQueue, + sc_transaction_pool::FullPool, + Option, >; pub fn new_partial(config: &Configuration) -> Result { - let telemetry = config - .telemetry_endpoints - .clone() - .filter(|x| !x.is_empty()) - .map(|endpoints| -> Result<_, sc_telemetry::Error> { - let worker = TelemetryWorker::new(16)?; - let telemetry = worker.handle().new_telemetry(endpoints); - Ok((worker, telemetry)) - }) - .transpose()?; - - let executor = sc_service::new_wasm_executor(config); - - let (client, backend, keystore_container, task_manager) = - sc_service::new_full_parts::( - config, - telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), - executor, - )?; - let client = Arc::new(client); - - let telemetry = telemetry.map(|(worker, telemetry)| { - task_manager - .spawn_handle() - .spawn("telemetry", None, worker.run()); - telemetry - }); - - let select_chain = sc_consensus::LongestChain::new(backend.clone()); - - let transaction_pool = sc_transaction_pool::BasicPool::new_full( - config.transaction_pool.clone(), - config.role.is_authority().into(), - config.prometheus_registry(), - task_manager.spawn_essential_handle(), - client.clone(), - ); - - let import_queue = sc_consensus_manual_seal::import_queue( - Box::new(client.clone()), - &task_manager.spawn_essential_handle(), - config.prometheus_registry(), - ); - - Ok(sc_service::PartialComponents { - client, - backend, - task_manager, - import_queue, - keystore_container, - select_chain, - transaction_pool, - other: (telemetry), - }) + let telemetry = config + .telemetry_endpoints + .clone() + .filter(|x| !x.is_empty()) + .map(|endpoints| -> Result<_, sc_telemetry::Error> { + let worker = TelemetryWorker::new(16)?; + let telemetry = worker.handle().new_telemetry(endpoints); + Ok((worker, telemetry)) + }) + .transpose()?; + + let executor = sc_service::new_wasm_executor(&config.executor); + + let (client, backend, keystore_container, task_manager) = + sc_service::new_full_parts::( + config, + telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), + executor, + )?; + let client = Arc::new(client); + + let telemetry = telemetry.map(|(worker, telemetry)| { + task_manager.spawn_handle().spawn("telemetry", None, worker.run()); + telemetry + }); + + let select_chain = sc_consensus::LongestChain::new(backend.clone()); + + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + config.role.is_authority().into(), + config.prometheus_registry(), + task_manager.spawn_essential_handle(), + client.clone(), + ); + + let import_queue = sc_consensus_manual_seal::import_queue( + Box::new(client.clone()), + &task_manager.spawn_essential_handle(), + config.prometheus_registry(), + ); + + Ok(sc_service::PartialComponents { + client, + backend, + task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: (telemetry), + }) } /// Builds a new service for a full client. pub fn new_full::Hash>>( - config: Configuration, - consensus: Consensus, + config: Configuration, + consensus: Consensus, ) -> Result { - let sc_service::PartialComponents { - client, - backend, - mut task_manager, - import_queue, - keystore_container, - select_chain, - transaction_pool, - other: mut telemetry, - } = new_partial(&config)?; - - let net_config = sc_network::config::FullNetworkConfiguration::< - Block, - ::Hash, - Network, - >::new( - &config.network, - config - .prometheus_config - .as_ref() - .map(|cfg| cfg.registry.clone()), - ); - let metrics = Network::register_notification_metrics( - config.prometheus_config.as_ref().map(|cfg| &cfg.registry), - ); - - let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = - sc_service::build_network(sc_service::BuildNetworkParams { - config: &config, - client: client.clone(), - transaction_pool: transaction_pool.clone(), - spawn_handle: task_manager.spawn_handle(), - import_queue, - net_config, - block_announce_validator_builder: None, - warp_sync_params: None, - block_relay: None, - metrics, - })?; - - if config.offchain_worker.enabled { - task_manager.spawn_handle().spawn( - "offchain-workers-runner", - "offchain-worker", - sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { - runtime_api_provider: client.clone(), - is_validator: config.role.is_authority(), - keystore: Some(keystore_container.keystore()), - offchain_db: backend.offchain_storage(), - transaction_pool: Some(OffchainTransactionPoolFactory::new( - transaction_pool.clone(), - )), - network_provider: Arc::new(network.clone()), - enable_http_requests: true, - custom_extensions: |_| vec![], - }) - .run(client.clone(), task_manager.spawn_handle()) - .boxed(), - ); - } - - let rpc_extensions_builder = { - let client = client.clone(); - let pool = transaction_pool.clone(); - - Box::new(move |deny_unsafe, _| { - let deps = crate::rpc::FullDeps { - client: client.clone(), - pool: pool.clone(), - deny_unsafe, - }; - crate::rpc::create_full(deps).map_err(Into::into) - }) - }; - - let prometheus_registry = config.prometheus_registry().cloned(); - - let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { - network, - client: client.clone(), - keystore: keystore_container.keystore(), - task_manager: &mut task_manager, - transaction_pool: transaction_pool.clone(), - rpc_builder: rpc_extensions_builder, - backend, - system_rpc_tx, - tx_handler_controller, - sync_service, - config, - telemetry: telemetry.as_mut(), - })?; - - let proposer = sc_basic_authorship::ProposerFactory::new( - task_manager.spawn_handle(), - client.clone(), - transaction_pool.clone(), - prometheus_registry.as_ref(), - telemetry.as_ref().map(|x| x.handle()), - ); - - match consensus { - Consensus::InstantSeal => { - let params = sc_consensus_manual_seal::InstantSealParams { - block_import: client.clone(), - env: proposer, - client, - pool: transaction_pool, - select_chain, - consensus_data_provider: None, - create_inherent_data_providers: move |_, ()| async move { - Ok(sp_timestamp::InherentDataProvider::from_system_time()) - }, - }; - - let authorship_future = sc_consensus_manual_seal::run_instant_seal_and_finalize(params); - - task_manager.spawn_essential_handle().spawn_blocking( - "instant-seal", - None, - authorship_future, - ); - } - Consensus::ManualSeal(block_time) => { - let (mut sink, commands_stream) = futures::channel::mpsc::channel(1024); - task_manager - .spawn_handle() - .spawn("block_authoring", None, async move { - loop { - futures_timer::Delay::new(std::time::Duration::from_millis(block_time)) - .await; - sink.try_send(sc_consensus_manual_seal::EngineCommand::SealNewBlock { - create_empty: true, - finalize: true, - parent_hash: None, - sender: None, - }) - .unwrap(); - } - }); - - let params = sc_consensus_manual_seal::ManualSealParams { - block_import: client.clone(), - env: proposer, - client, - pool: transaction_pool, - select_chain, - commands_stream: Box::pin(commands_stream), - consensus_data_provider: None, - create_inherent_data_providers: move |_, ()| async move { - Ok(sp_timestamp::InherentDataProvider::from_system_time()) - }, - }; - let authorship_future = sc_consensus_manual_seal::run_manual_seal(params); - - task_manager.spawn_essential_handle().spawn_blocking( - "manual-seal", - None, - authorship_future, - ); - } - } - - network_starter.start_network(); - Ok(task_manager) + let sc_service::PartialComponents { + client, + backend, + mut task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: mut telemetry, + } = new_partial(&config)?; + + let mut net_config = sc_network::config::FullNetworkConfiguration::< + Block, + ::Hash, + Network, + >::new( + &config.network, + config.prometheus_config.as_ref().map(|cfg| cfg.registry.clone()), + ); + let metrics = Network::register_notification_metrics( + config.prometheus_config.as_ref().map(|cfg| &cfg.registry), + ); + + let syncing_strategy = build_polkadot_syncing_strategy( + config.protocol_id(), + config.chain_spec.fork_id(), + &mut net_config, + None, + client.clone(), + &task_manager.spawn_handle(), + config.prometheus_config.as_ref().map(|config| &config.registry), + )?; + + let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + net_config, + block_announce_validator_builder: None, + syncing_strategy, + block_relay: None, + metrics, + })?; + + if config.offchain_worker.enabled { + task_manager.spawn_handle().spawn( + "offchain-workers-runner", + "offchain-worker", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + is_validator: config.role.is_authority(), + keystore: Some(keystore_container.keystore()), + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new( + transaction_pool.clone(), + )), + network_provider: Arc::new(network.clone()), + enable_http_requests: true, + custom_extensions: |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), + ); + } + + let rpc_extensions_builder = { + let client = client.clone(); + let pool = transaction_pool.clone(); + + Box::new(move |_| { + let deps = crate::rpc::FullDeps { client: client.clone(), pool: pool.clone() }; + crate::rpc::create_full(deps).map_err(Into::into) + }) + }; + + let prometheus_registry = config.prometheus_registry().cloned(); + + let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { + network, + client: client.clone(), + keystore: keystore_container.keystore(), + task_manager: &mut task_manager, + transaction_pool: transaction_pool.clone(), + rpc_builder: rpc_extensions_builder, + backend, + system_rpc_tx, + tx_handler_controller, + sync_service, + config, + telemetry: telemetry.as_mut(), + })?; + + let proposer = sc_basic_authorship::ProposerFactory::new( + task_manager.spawn_handle(), + client.clone(), + transaction_pool.clone(), + prometheus_registry.as_ref(), + telemetry.as_ref().map(|x| x.handle()), + ); + + match consensus { + Consensus::InstantSeal => { + let params = sc_consensus_manual_seal::InstantSealParams { + block_import: client.clone(), + env: proposer, + client, + pool: transaction_pool, + select_chain, + consensus_data_provider: None, + create_inherent_data_providers: move |_, ()| async move { + Ok(sp_timestamp::InherentDataProvider::from_system_time()) + }, + }; + + let authorship_future = sc_consensus_manual_seal::run_instant_seal_and_finalize(params); + + task_manager.spawn_essential_handle().spawn_blocking( + "instant-seal", + None, + authorship_future, + ); + }, + Consensus::ManualSeal(block_time) => { + let (mut sink, commands_stream) = futures::channel::mpsc::channel(1024); + task_manager.spawn_handle().spawn("block_authoring", None, async move { + loop { + futures_timer::Delay::new(std::time::Duration::from_millis(block_time)).await; + sink.try_send(sc_consensus_manual_seal::EngineCommand::SealNewBlock { + create_empty: true, + finalize: true, + parent_hash: None, + sender: None, + }) + .unwrap(); + } + }); + + let params = sc_consensus_manual_seal::ManualSealParams { + block_import: client.clone(), + env: proposer, + client, + pool: transaction_pool, + select_chain, + commands_stream: Box::pin(commands_stream), + consensus_data_provider: None, + create_inherent_data_providers: move |_, ()| async move { + Ok(sp_timestamp::InherentDataProvider::from_system_time()) + }, + }; + let authorship_future = sc_consensus_manual_seal::run_manual_seal(params); + + task_manager.spawn_essential_handle().spawn_blocking( + "manual-seal", + None, + authorship_future, + ); + }, + } + + network_starter.start_network(); + Ok(task_manager) } diff --git a/chain/pallet-contracts-evm/Cargo.toml b/chain/pallet-contracts-evm/Cargo.toml deleted file mode 100644 index 6279650..0000000 --- a/chain/pallet-contracts-evm/Cargo.toml +++ /dev/null @@ -1,42 +0,0 @@ -[package] -name = "pallet-contracts-evm" -description = "An EVM compatibility layer for pallet-contracts" -version = "0.1.0" -license = "MIT-0" -authors.workspace = true -homepage.workspace = true -repository.workspace = true -edition.workspace = true -publish = false - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -parity-scale-codec = { workspace = true, features = [ - "derive", -], default-features = false } -scale-info = { workspace = true, default-features = false, features = [ - "derive", -] } -eth-rpc-api = { path = "../../rpc/api", default-features = false } # TODO move shared stuff to primitives -primitives = { package = "pallet-contracts-evm-primitives", path = "../primitives", default-features = false } -log = { workspace = true } -polkadot-sdk = { workspace = true, default-features = false, features = [ - "experimental", - "runtime", -] } - -[features] -default = ["std"] -std = [ - "eth-rpc-api/std", - "log/std", - "parity-scale-codec/std", - "polkadot-sdk/std", - "primitives/std", - "scale-info/std", -] - -[package.metadata.cargo-machete] -ignored = ["scale-info"] diff --git a/chain/pallet-contracts-evm/src/convert.rs b/chain/pallet-contracts-evm/src/convert.rs deleted file mode 100644 index a99f3ed..0000000 --- a/chain/pallet-contracts-evm/src/convert.rs +++ /dev/null @@ -1,71 +0,0 @@ -//! EVM decimals converter trait. -use core::marker::PhantomData; - -use core::fmt::Debug; -use polkadot_sdk::{polkadot_sdk_frame::arithmetic::CheckedRem, sp_runtime}; -use sp_runtime::traits::{CheckedDiv, Saturating, Zero}; - -/// EVM decimals converter trait. -/// Convert decimal from native token to EVM(18). -pub trait EvmDecimalsConverter< - Balance: Zero + Saturating + CheckedDiv + CheckedRem + PartialEq + Copy, -> -{ - /// Convert decimal from native token to EVM(18). - fn convert_decimals_to_evm(native_balance: Balance) -> Balance; - /// Convert decimal from EVM(18) to native. - fn convert_decimals_from_evm(evm_balance: Balance) -> Option; -} - -/// EVM uses 18 decimals. -pub const EVM_DECIMALS: u32 = 18; - -/// An [`EvmDecimalsConverter`] implementation -pub struct Converter(PhantomData); - -impl EvmDecimalsConverter - for Converter -where - Balance: Zero + Saturating + CheckedDiv + CheckedRem + PartialEq + Copy + From + Debug, -{ - fn convert_decimals_to_evm(b: Balance) -> Balance { - if b.is_zero() { - return b; - } - b.saturating_mul(DECIMALS_VALUE.into()) - } - - /// Convert decimal from EVM(18) to native - fn convert_decimals_from_evm(b: Balance) -> Option { - if b.is_zero() { - return Some(b); - } - if !b - .checked_rem(&Into::::into(DECIMALS_VALUE))? - .is_zero() - { - log::error!("Failed to convert EVM balance: {b:?}, ratio: {DECIMALS_VALUE:?}"); - return None; - } - - b.checked_div(&Into::::into(DECIMALS_VALUE)) - } -} - -#[test] -fn convert_works() { - const NATIVE_DECIMALS: u32 = 15; - type C = Converter<{ 10u64.pow(EVM_DECIMALS - NATIVE_DECIMALS) }, u128>; - let native_value = 1_000; - - let evm_value = C::convert_decimals_to_evm(native_value); - assert_eq!(evm_value, 1_000_000); - assert_eq!( - native_value, - C::convert_decimals_from_evm(evm_value).unwrap() - ); - assert!(C::convert_decimals_from_evm(evm_value + 1).is_none()); - - assert_eq!(C::convert_decimals_to_evm(0), 0); - assert_eq!(C::convert_decimals_from_evm(0).unwrap(), 0); -} diff --git a/chain/pallet-contracts-evm/src/lib.rs b/chain/pallet-contracts-evm/src/lib.rs deleted file mode 100644 index e06778e..0000000 --- a/chain/pallet-contracts-evm/src/lib.rs +++ /dev/null @@ -1,419 +0,0 @@ -#![cfg_attr(not(feature = "std"), no_std)] -#![allow(clippy::too_many_arguments)] -#[cfg(not(feature = "std"))] -extern crate alloc; - -#[cfg(not(feature = "std"))] -use alloc::{vec, vec::Vec}; - -use eth_rpc_api::{adapters::*, GenericTransaction}; -use frame_system::RawOrigin; -use parity_scale_codec::{Codec, Decode, Encode, HasCompact}; -use polkadot_sdk::pallet_contracts; -use polkadot_sdk::{ - polkadot_sdk_frame::{ - derive::DefaultNoBound, - prelude::*, - primitives::{H160, U256}, - runtime::apis, - traits::{ - fungible::{Inspect, Mutate}, - tokens::Preservation, - }, - traits::{LookupError, StaticLookup}, - }, - sp_runtime::MultiAddress, -}; - -mod convert; -pub use convert::*; - -use pallet_contracts::Code; -use primitives::{self, AccountIndex}; - -// Re-export all pallet parts, this is needed to properly import the pallet into the runtime. -pub use pallet::*; -pub mod weights; -use pallet_contracts::WeightInfo as PalletContractsWeightInfo; -use polkadot_sdk::polkadot_sdk_frame as frame; -use weights::WeightInfo; - -type BalanceOf = <::Currency as Inspect< - ::AccountId, ->>::Balance; - -/// A mapping between `AccountId` and `EvmAddress`. -pub trait AddressMapping { - /// Returns the AccountId associated to the EVM address. - fn get_account_id(evm: &H160) -> AccountId; -} - -#[frame::pallet] -pub mod pallet { - use pallet_contracts::{CollectEvents, DebugInfo, Determinism}; - use polkadot_sdk::frame_support::dispatch::PostDispatchInfo; - - use super::*; - use crate::frame_system; - - #[pallet::error] - pub enum Error { - /// Decimals conversion failed. - DecimalsConversionFailed, - /// Invalid EVM Transaction. - InvalidTransaction, - } - - #[pallet::config] - #[pallet::disable_frame_system_supertrait_check] - pub trait Config: frame_system::Config + pallet_contracts::Config { - /// Chain ID of EVM. - #[pallet::constant] - type ChainId: Get; - - /// Converter for EVM decimals. - type EvmDecimalsConverter: convert::EvmDecimalsConverter>; - - /// Describes the weights of the dispatchables of this module - type WeightInfo: WeightInfo; - - /// Mapping from address to account id. - type AddressMapping: AddressMapping; - } - - #[pallet::genesis_config] - #[derive(DefaultNoBound)] - pub struct GenesisConfig { - /// List of accounts to be endowed some initial balance. - pub endowed_accounts: Vec<(H160, BalanceOf)>, - } - - #[pallet::genesis_build] - impl BuildGenesisConfig for GenesisConfig { - fn build(&self) { - for (address, balance) in &self.endowed_accounts { - let account_id = T::AddressMapping::get_account_id(address); - log::trace!(target: "evm", "Endow eth_address: {address:?} account_id: {account_id:?} balance: {balance:?}"); - T::Currency::set_balance(&account_id, *balance); - } - } - } - - /// When dispatching an extrinsic from an EVM account, the [`H160`] source address will be set. We need to ensure that it matches the derived [`H160`] address from the `origin`. - /// When dispatching an extrinsic from an AccountId, the source should be `None` and will be derived from the `origin` by truncating the `account_id`. - pub fn ensure_signed_source< - T: Config, - OuterOrigin: Into, OuterOrigin>>, - >( - origin: OuterOrigin, - source: Option, - ) -> Result { - let origin = ensure_signed(origin)?; - if let Some(source) = source { - let source_account_id = T::AddressMapping::get_account_id(&source); - ensure!(origin == source_account_id, frame::traits::BadOrigin); - } - Ok(origin) - } - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::call] - impl Pallet - where - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - BalanceOf: Into + TryFrom, - { - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::instantiate_with_code(code.len() as u32, data.len() as u32, salt.len() as u32).saturating_add(*gas_limit))] - pub fn eth_instantiate( - origin: OriginFor, - source: Option, - code: Vec, - data: Vec, - salt: Vec, - #[pallet::compact] eth_value: BalanceOf, - #[pallet::compact] _eth_gas_price: u64, // checked by tx validation logic - #[pallet::compact] _eth_gas_limit: u128, // checked by tx validation logic - gas_limit: Weight, - storage_deposit_limit: Option< as HasCompact>::Type>, - ) -> DispatchResultWithPostInfo { - let origin = ensure_signed_source::(origin, source)?; - let storage_deposit_limit = storage_deposit_limit.map(|v| v.into()); - log::trace!(target: "evm", "instantiate contract from {origin:?} source: {source:?}"); - - let code_len = code.len() as u32; - let data_len = data.len() as u32; - let salt_len = salt.len() as u32; - let value = T::EvmDecimalsConverter::convert_decimals_from_evm(eth_value) - .ok_or(Error::::DecimalsConversionFailed) - .inspect_err(|err| { - log::trace!(target: "evm", "Invalid request, failed to convert value from EVM: eth_value: {eth_value:?}: {err:?}") - })?; - - let exec = pallet_contracts::Pallet::::bare_instantiate( - origin, - value, - gas_limit, - storage_deposit_limit, - pallet_contracts::Code::Upload(code), - data, - salt, - DebugInfo::Skip, - CollectEvents::Skip, - ); - log::trace!(target: "evm", "instantiate contract result: {:?}", exec.result); - exec.result?; - - let post_info = PostDispatchInfo { - actual_weight: Some(exec.gas_consumed.saturating_add( - ::WeightInfo::instantiate_with_code( - code_len, data_len, salt_len, - ), - )), - pays_fee: Default::default(), - }; - - Ok(post_info) - } - #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::call().saturating_add(*gas_limit))] - pub fn eth_call( - origin: OriginFor, - source: Option, - to: H160, - data: Vec, - #[pallet::compact] eth_value: BalanceOf, - #[pallet::compact] _eth_gas_price: u64, // checked by tx validation logic - #[pallet::compact] _eth_gas_limit: u128, // checked by tx validation logic - gas_limit: Weight, - storage_deposit_limit: Option< as HasCompact>::Type>, - ) -> DispatchResultWithPostInfo { - let origin = ensure_signed_source::(origin, source)?; - let storage_deposit_limit = storage_deposit_limit.map(|v| v.into()); - log::trace!(target: "evm", "dispatched eth_call: origin: {origin:?} source: {source:?} to: {to:?} value: {eth_value:?}"); - let value = T::EvmDecimalsConverter::convert_decimals_from_evm(eth_value) - .ok_or(Error::::DecimalsConversionFailed) - .inspect_err(|err| { - log::trace!(target: "evm", "Invalid request, failed to convert value from EVM: eth_value: {eth_value:?}: {err:?}") - })?; - - let dest = T::AddressMapping::get_account_id(&to); - - let Some(code_hash) = pallet_contracts::Pallet::::code_hash(&dest) else { - log::trace!(target: "evm", "eth_call contract {dest:?} does not exist, transferring value: {value:?} to: {dest:?})"); - T::Currency::transfer(&origin, &dest, value, Preservation::Preserve).inspect_err( - |err| log::trace!(target: "evm", "eth_call transfer failed: {err:?}"), - )?; - - return Ok(PostDispatchInfo { - actual_weight: Some(::WeightInfo::eth_transfer()), - pays_fee: Default::default(), - }); - }; - - log::trace!(target: "evm", "call contract: {dest:?} hash: {code_hash:?}"); - let exec = pallet_contracts::Pallet::::bare_call( - origin, - dest, - value, - gas_limit, - storage_deposit_limit, - data, - DebugInfo::Skip, - CollectEvents::Skip, - Determinism::Enforced, - ); - - log::trace!(target: "evm", "call contract result: {:?}", exec.result); - exec.result?; - - let post_info = PostDispatchInfo { - actual_weight: Some( - exec.gas_consumed - .saturating_add(::WeightInfo::call()), - ), - pays_fee: Default::default(), - }; - - Ok(post_info) - } - } -} - -apis::decl_runtime_apis! { - - pub trait ContractsEvmApi where - AccountId: Codec, - Balance: Codec, - { - /// Get the account id for the given EVM address. - fn account_id(address: &H160) -> AccountId; - - /// Dry run a transaction and return the gas used. - fn gas_estimate(transaction: GenericTransaction) -> Result, DispatchError>; - } -} - -impl Pallet -where - BalanceOf: Into + TryFrom, -{ - /// Convert the raw input data from an EVM transaction into a `CallInput` struct. - pub fn split_input_data(input: Vec) -> Result { - let input = CallInput::decode(&mut &input[..]).map_err(|_| { - log::trace!(target: "evm", "eth_call decoding code & data failed"); - pallet_contracts::Error::::DecodingFailed - })?; - Ok(input) - } - - /// Dry run a transaction and return the result. - pub fn gas_estimate(tx: GenericTransaction) -> Result>, DispatchError> { - log::trace!(target: "evm", "Get gas estimate for address: {:?}", tx.from); - let origin = tx - .from - .map(|from| T::AddressMapping::get_account_id(&from)) - .ok_or(Error::::InvalidTransaction) - .inspect_err(|_| { - log::trace!(target: "evm", "Invalid request, failed to get account_id from EVM address: {:?}", tx.from); - })?; - - log::trace!(target: "evm", "Get gas estimate account_id: {origin:?}"); - - // check if it is a simple balance transfer - if let Some(to) = tx.to { - let to = T::AddressMapping::get_account_id(&to); - match pallet_contracts::Pallet::::code_hash(&to) { - None => { - log::trace!(target: "evm", "eth_call contract {to:?} does not exist, dry run transfer..."); - let info = DryRunInfo::> { - gas_limit: ::WeightInfo::eth_transfer(), - storage_deposit_limit: None, - return_data: vec![], - }; - - return Ok(info); - } - Some(code_hash) => { - log::trace!(target: "evm", "eth_call contract {to:?} code_hash: {code_hash:?}"); - } - } - } - - let input_data = tx.input.map(|bytes| bytes.0).unwrap_or_default(); - log::trace!(target: "evm", "Get gas estimate for input.len() = {}", input_data.len()); - - let value = tx - .value - .map(|v| BalanceOf::::try_from(v).map_err(|_| Error::::InvalidTransaction)) - .transpose()? - .unwrap_or_default(); - - log::trace!(target: "evm", "Get gas estimate value = {value:?}"); - let gas_limit = T::BlockWeights::get() - .get(DispatchClass::Normal) - .max_total - .unwrap_or_else(|| T::BlockWeights::get().max_block); - - let storage_deposit_limit = None; - - let dry_run_info = match tx.to { - None => { - let CallInput { code, data, salt } = Self::split_input_data(input_data)?; - let result = pallet_contracts::Pallet::::bare_instantiate( - origin, - value, - gas_limit, - storage_deposit_limit, - Code::Upload(code), - data, - salt, - pallet_contracts::DebugInfo::UnsafeDebug, - pallet_contracts::CollectEvents::UnsafeCollect, - ); - - let exec_result = result.result.inspect_err(|err| { - log::trace!(target: "evm", "Get gas estimate failed {err:?}"); - })?; - - if exec_result.result.did_revert() { - log::trace!(target: "evm", "Get gas estimate failed, contract reverted"); - return Err(pallet_contracts::Error::::ContractReverted.into()); - } - - let return_data = exec_result.result.data; - - DryRunInfo::> { - gas_limit: result.gas_required, - storage_deposit_limit: Some(result.storage_deposit.charge_or_zero()), - return_data, - } - } - Some(address) => { - let dest = T::AddressMapping::get_account_id(&address); - - let result = pallet_contracts::Pallet::::bare_call( - origin, - dest, - value, - gas_limit, - storage_deposit_limit, - input_data, - pallet_contracts::DebugInfo::UnsafeDebug, - pallet_contracts::CollectEvents::UnsafeCollect, - pallet_contracts::Determinism::Enforced, - ); - - let exec_result = result.result.inspect_err(|err| { - log::trace!(target: "evm", "Get gas estimate failed {err:?}"); - })?; - - if exec_result.did_revert() { - log::trace!(target: "evm", "Get gas estimate failed, contract reverted"); - return Err(pallet_contracts::Error::::ContractReverted.into()); - } - - DryRunInfo::> { - gas_limit: result.gas_required, - storage_deposit_limit: Some(result.storage_deposit.charge_or_zero()), - return_data: exec_result.data, - } - } - }; - - log::trace!(target: "evm", "gas_estimate: {dry_run_info:?}"); - Ok(dry_run_info) - } -} - -/// An implementation of [`AddressMapping`] that maps [`H160`] addresses to Substrate `AccountId`s. -pub struct EVMAddressMapping(PhantomData); -impl AddressMapping for EVMAddressMapping -where - T::AccountId: IsType, -{ - fn get_account_id(evm: &H160) -> T::AccountId { - primitives::get_account_id(evm).into() - } -} - -impl StaticLookup for Pallet { - type Source = MultiAddress; - type Target = T::AccountId; - - fn lookup(a: Self::Source) -> Result { - match a { - MultiAddress::Id(id) => Ok(id), - MultiAddress::Address20(i) => { - Ok(T::AddressMapping::get_account_id(&H160::from_slice(&i))) - } - _ => Err(LookupError), - } - } - - fn unlookup(a: Self::Target) -> Self::Source { - MultiAddress::Id(a) - } -} diff --git a/chain/pallet-contracts-evm/src/weights.rs b/chain/pallet-contracts-evm/src/weights.rs deleted file mode 100644 index 44821c4..0000000 --- a/chain/pallet-contracts-evm/src/weights.rs +++ /dev/null @@ -1,11 +0,0 @@ -use core::marker::PhantomData; - -use polkadot_sdk::{frame_system, polkadot_sdk_frame::prelude::Weight}; -pub trait WeightInfo { - fn eth_transfer() -> Weight { - Weight::from_parts(280_000_000, 4_000) - } -} - -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight {} diff --git a/chain/primitives/Cargo.toml b/chain/primitives/Cargo.toml deleted file mode 100644 index c2f56cb..0000000 --- a/chain/primitives/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "pallet-contracts-evm-primitives" -description = "primitive types for the pallet-contracts-evm" -version = "0.1.0" -license = "MIT-0" -authors.workspace = true -homepage.workspace = true -repository.workspace = true -edition.workspace = true -publish = false - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -parity-scale-codec = { workspace = true, features = [ - "derive", -], default-features = false } -scale-info = { workspace = true, default-features = false, features = [ - "derive", -] } -serde = { workspace = true, features = ["alloc", "derive"] } -eth-rpc-api = { path = "../../rpc/api", default-features = false } -polkadot-sdk = { workspace = true, default-features = false, features = [ - "experimental", - "runtime", -] } - -[dev-dependencies] -serde_json.workspace = true - -[features] -default = ["std"] -std = [ - "eth-rpc-api/std", - "parity-scale-codec/std", - "polkadot-sdk/std", - "scale-info/std", - "serde/std", - "serde_json/std", -] diff --git a/chain/primitives/src/lib.rs b/chain/primitives/src/lib.rs deleted file mode 100644 index 9a74c3d..0000000 --- a/chain/primitives/src/lib.rs +++ /dev/null @@ -1,59 +0,0 @@ -//! Core types and traits used in the runtime. - -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg(not(feature = "std"))] -extern crate alloc; - -mod signature; -pub use signature::*; - -mod unchecked_extrinsic; -pub use unchecked_extrinsic::*; - -use parity_scale_codec::Encode; -use polkadot_sdk::polkadot_sdk_frame::{ - derive::Decode, - primitives::{H160, H256}, - traits::{Hash, TrailingZeroInput}, -}; -use polkadot_sdk::sp_runtime::{self, AccountId32}; - -/// Some way of identifying an account on the chain. -pub type AccountId = AccountId32; - -/// The address format for describing accounts. -pub type MultiAddress = sp_runtime::MultiAddress; - -/// The type for looking up accounts. We don't expect more than 4 billion of them. -pub type AccountIndex = u32; - -/// The hashing algorithm used. -pub type Hashing = sp_runtime::traits::BlakeTwo256; - -/// Generate the contract's [`H160`] address from the provided inputs. -/// This function is shared by both the Runtime and the RPC to resolve the contract address. -pub fn evm_contract_address( - deploying_address: &AccountId, - code_hash: &H256, - input_data: &[u8], - salt: &[u8], -) -> H160 { - let entropy = ( - b"contract_addr_v1", - deploying_address, - code_hash, - input_data, - salt, - ) - .using_encoded(Hashing::hash); - Decode::decode(&mut TrailingZeroInput::new(entropy.as_ref())) - .expect("infinite length input; no invalid inputs for type; qed") -} - -/// Derive the [`AccountId`] from the provided [`H160`] address. -pub fn get_account_id(evm: &H160) -> AccountId { - let payload = (b"AccountId32:", evm); - let bytes = payload.using_encoded(Hashing::hash).0; - AccountId::new(bytes) -} diff --git a/chain/primitives/src/signature.rs b/chain/primitives/src/signature.rs deleted file mode 100644 index a380bbd..0000000 --- a/chain/primitives/src/signature.rs +++ /dev/null @@ -1,49 +0,0 @@ -//! Signature runtime primitives. -use parity_scale_codec::{Decode, Encode}; -use polkadot_sdk::{ - sp_core, sp_io, - sp_runtime::{ - traits::{Lazy, Verify}, - AccountId32, MultiSigner, RuntimeDebug, - }, -}; -use scale_info::TypeInfo; -use sp_core::{crypto::ByteArray, ecdsa, ed25519, sr25519}; - -/// Signature verify that can work with any known signature types. -/// -/// This is [`polkadot_sdk::sp_runtime::MultiSignature`], with an extra Ethereum variant. -#[derive(Eq, PartialEq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] -pub enum MultiSignature { - /// An Ed25519 signature. - Ed25519(ed25519::Signature), - /// An Sr25519 signature. - Sr25519(sr25519::Signature), - /// An ECDSA/SECP256k1 signature. - Ecdsa(ecdsa::Signature), - // An Ethereum compatible SECP256k1 signature. - Ethereum([u8; 65]), -} - -impl Verify for MultiSignature { - type Signer = MultiSigner; - fn verify>(&self, mut msg: L, signer: &AccountId32) -> bool { - match (self, signer) { - (Self::Ed25519(ref sig), who) => ed25519::Public::from_slice(who.as_ref()) - .map_or(false, |signer| sig.verify(msg, &signer)), - (Self::Sr25519(ref sig), who) => sr25519::Public::from_slice(who.as_ref()) - .map_or(false, |signer| sig.verify(msg, &signer)), - (Self::Ecdsa(ref sig), who) => { - let m = sp_io::hashing::blake2_256(msg.get()); - match sp_io::crypto::secp256k1_ecdsa_recover_compressed(sig.as_ref(), &m) { - Ok(pubkey) => { - &sp_io::hashing::blake2_256(pubkey.as_ref()) - == >::as_ref(who) - } - _ => false, - } - } - _ => false, - } - } -} diff --git a/chain/primitives/src/unchecked_extrinsic.rs b/chain/primitives/src/unchecked_extrinsic.rs deleted file mode 100644 index 6f2cfe2..0000000 --- a/chain/primitives/src/unchecked_extrinsic.rs +++ /dev/null @@ -1,158 +0,0 @@ -//! Unchecked extrinsic with support for Ethereum signatures. -use crate::{MultiAddress, MultiSignature}; -use eth_rpc_api::{SignerRecovery, TransactionLegacyUnsigned, TransactionUnsigned}; -use parity_scale_codec::{Decode, Encode}; -#[cfg(not(feature = "std"))] -use polkadot_sdk::sp_std::alloc::format; - -use polkadot_sdk::{ - frame_support::dispatch::{DispatchInfo, GetDispatchInfo}, - polkadot_sdk_frame::{log, prelude::*, primitives::H160, traits::ExtrinsicCall}, - sp_core, - sp_runtime::{ - generic::{self, CheckedExtrinsic}, - traits::{self, Checkable, Convert, Extrinsic, ExtrinsicMetadata, Member, SignedExtension}, - transaction_validity::{InvalidTransaction, TransactionValidityError}, - AccountId32, RuntimeDebug, - }, -}; - -/// Unchecked extrinsic with support for Ethereum signatures. -/// This is a wrapper on top of [`generic::UncheckedExtrinsic`] to support Ethereum -/// transactions. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] -#[scale_info(skip_type_params(ConvertEthTx))] -pub struct UncheckedExtrinsic( - pub generic::UncheckedExtrinsic, - PhantomData, -); - -impl Extrinsic - for UncheckedExtrinsic -{ - type Call = Call; - - type SignaturePayload = (MultiAddress, MultiSignature, Extra); - - fn is_signed(&self) -> Option { - self.0.is_signed() - } - - fn new(function: Call, signed_data: Option) -> Option { - Some(if let Some((address, signature, extra)) = signed_data { - Self( - generic::UncheckedExtrinsic::new_signed(function, address, signature, extra), - PhantomData, - ) - } else { - Self( - generic::UncheckedExtrinsic::new_unsigned(function), - PhantomData, - ) - }) - } -} - -impl ExtrinsicMetadata - for UncheckedExtrinsic -{ - const VERSION: u8 = - generic::UncheckedExtrinsic::::VERSION; - type SignedExtensions = Extra; -} - -impl ExtrinsicCall - for UncheckedExtrinsic -{ - fn call(&self) -> &Self::Call { - self.0.call() - } -} - -impl Checkable - for UncheckedExtrinsic -where - Call: Encode + Member, - Extra: SignedExtension, - ConvertEthTx: - Convert<(Call, Extra), Result<(TransactionUnsigned, H160, Extra), InvalidTransaction>>, - Lookup: traits::Lookup, -{ - type Checked = CheckedExtrinsic; - - fn check(self, lookup: &Lookup) -> Result { - let function = self.0.function.clone(); - - match self.0.signature { - Some((addr, MultiSignature::Ethereum(sig), extra)) => { - log::trace!(target: "evm", "Checking extrinsic with ethereum signature..."); - let (eth_msg, source, eth_extra) = - ConvertEthTx::convert((function.clone(), extra))?; - - let msg = TransactionLegacyUnsigned::try_from(eth_msg) - .map_err(|_| InvalidTransaction::Call)?; - - log::trace!(target: "evm", "Received ethereum transaction: {msg:#?}"); - - let signer = msg - .recover_signer(&sig) - .ok_or(InvalidTransaction::BadProof)?; - if signer != source { - log::trace!(target: "evm", "Invalid recovered signer: ({signer:?}) != source ({source:?}"); - return Err(InvalidTransaction::BadProof.into()); - } - - let account_id = lookup.lookup(MultiAddress::Address20(signer.into()))?; - log::trace!(target: "evm", "Signer address20 is: {account_id:?}"); - - let expected_account_id = lookup.lookup(addr)?; - - if account_id != expected_account_id { - log::trace!(target: "evm", "Account ID should be: {expected_account_id:?}"); - return Err(InvalidTransaction::BadProof.into()); - } - - log::trace!(target: "evm", "Valid ethereum message"); - Ok(CheckedExtrinsic { - signed: Some((account_id, eth_extra)), - function, - }) - } - _ => self.0.check(lookup), - } - } -} - -impl GetDispatchInfo for UncheckedExtrinsic -where - Call: GetDispatchInfo, - Extra: SignedExtension, -{ - fn get_dispatch_info(&self) -> DispatchInfo { - self.0.get_dispatch_info() - } -} - -impl serde::Serialize - for UncheckedExtrinsic -{ - fn serialize(&self, seq: S) -> Result - where - S: ::serde::Serializer, - { - self.0.serialize(seq) - } -} - -impl<'a, Call: Decode, Extra: SignedExtension, ConvertEthTx> serde::Deserialize<'a> - for UncheckedExtrinsic -{ - fn deserialize(de: D) -> Result - where - D: serde::Deserializer<'a>, - { - let r = sp_core::bytes::deserialize(de)?; - Decode::decode(&mut &r[..]) - .map_err(|e| serde::de::Error::custom(format!("Decode error: {}", e))) - } -} diff --git a/chain/runtime/Cargo.toml b/chain/runtime/Cargo.toml index c1f0960..5425d7e 100644 --- a/chain/runtime/Cargo.toml +++ b/chain/runtime/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "runtime" +name = "revive-runtime" description = "A solochain runtime template built with Substrate, part of Polkadot Sdk. (polkadot v1.12.0)" version = "0.1.0" license = "MIT-0" @@ -11,31 +11,38 @@ publish = false [dependencies] -parity-scale-codec = { workspace = true, default-features = false } +codec = { workspace = true, default-features = false } scale-info = { workspace = true, default-features = false } -pallet-contracts-evm = { path = "../pallet-contracts-evm", default-features = false } -pallet-contracts-evm-primitives = { path = "../primitives", default-features = false } -eth-rpc-api = { path = "../../rpc/api", default-features = false } # Move to shared primitives stuff? - # genesis builder that allows us to interact with runtime genesis config -polkadot-sdk = { workspace = true, features = ["experimental", "runtime"] } +polkadot-sdk = { workspace = true, features = [ + "experimental", + "pallet-balances", + "pallet-revive", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "runtime", +]} [build-dependencies] polkadot-sdk = { optional = true, workspace = true, features = [ "substrate-wasm-builder", ] } - [features] default = ["std"] std = [ - "eth-rpc-api/std", - "pallet-contracts-evm-primitives/std", - "pallet-contracts-evm/std", - "parity-scale-codec/std", + "codec/std", "polkadot-sdk/std", "scale-info/std", ] +try-runtime = [ + "polkadot-sdk/try-runtime", +] [package.metadata.cargo-machete] -ignored = ["parity-scale-codec", "scale-info"] +ignored = ["codec", "scale-info"] + + + diff --git a/chain/runtime/build.rs b/chain/runtime/build.rs index 5971ebc..213633e 100644 --- a/chain/runtime/build.rs +++ b/chain/runtime/build.rs @@ -16,8 +16,8 @@ // limitations under the License. fn main() { - #[cfg(feature = "std")] - { - polkadot_sdk::substrate_wasm_builder::WasmBuilder::build_using_defaults(); - } + #[cfg(feature = "std")] + { + polkadot_sdk::substrate_wasm_builder::WasmBuilder::build_using_defaults(); + } } diff --git a/chain/runtime/src/lib.rs b/chain/runtime/src/lib.rs index 1974a3c..7127283 100644 --- a/chain/runtime/src/lib.rs +++ b/chain/runtime/src/lib.rs @@ -1,5 +1,4 @@ -//! A minimal runtime that includes [`pallet-contracts`] and [`pallet-contracts-evm`]. - +//! A minimal runtime that includes [`pallet-revive`]. #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] @@ -15,149 +14,201 @@ use alloc::{vec, vec::Vec}; #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -use eth_rpc_api::{adapters::*, U256}; - -use eth_rpc_api::{GenericTransaction, TransactionLegacyUnsigned, TransactionUnsigned}; use frame_support::{ - genesis_builder_helper::{build_state, get_preset}, - runtime, - weights::{FixedFee, IdentityFee, WeightToFee}, + genesis_builder_helper::{build_state, get_preset}, + runtime, + weights::{FixedFee, IdentityFee}, }; use interface::*; -use pallet_contracts_evm::{EVMAddressMapping, EVM_DECIMALS}; -use pallet_contracts_evm_primitives::{evm_contract_address, UncheckedExtrinsic}; -use polkadot_sdk::frame_system::limits::BlockWeights; -use polkadot_sdk::pallet_contracts::AddressGenerator; -use polkadot_sdk::pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; -use polkadot_sdk::polkadot_sdk_frame::{ - log, - prelude::*, - primitives::{BlakeTwo256, H160, H256}, - runtime::{ - apis::{ - self, impl_runtime_apis, ApplyExtrinsicResult, CheckInherentsResult, - ExtrinsicInclusionMode, OpaqueMetadata, - }, - prelude::*, - types_common::BlockNumber, - }, - traits::Convert, +use polkadot_sdk::{ + frame_system::limits::BlockWeights, + pallet_revive::{ + evm::runtime::{EthExtra, UncheckedExtrinsic}, + AddressMapper, ContractResult, EthContractResult, ExecReturnValue, InstantiateReturnValue, + }, + pallet_transaction_payment::{ConstFeeMultiplier, FeeDetails, Multiplier, RuntimeDispatchInfo}, + polkadot_sdk_frame::{ + log, + prelude::*, + primitives::{BlakeTwo256, H160}, + runtime::{ + apis::{self, impl_runtime_apis}, + prelude::*, + types_common::BlockNumber, + }, + traits::One, + }, + sp_inherents::CheckInherentsResult, + sp_runtime::{ + generic, + traits::{LookupError, StaticLookup}, + ApplyExtrinsicResult, ExtrinsicInclusionMode, MultiAddress, + }, + *, }; -use polkadot_sdk::sp_runtime::generic; -use polkadot_sdk::*; -use sp_runtime::transaction_validity::InvalidTransaction; /// The runtime version. #[runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("minimal-runtime"), - impl_name: create_runtime_str!("minimal-runtime"), - authoring_version: 1, - spec_version: 0, - impl_version: 1, - apis: RUNTIME_API_VERSIONS, - transaction_version: 1, - state_version: 1, + spec_name: create_runtime_str!("minimal-runtime"), + impl_name: create_runtime_str!("minimal-runtime"), + authoring_version: 1, + spec_version: 0, + impl_version: 1, + apis: RUNTIME_API_VERSIONS, + transaction_version: 1, + system_version: 1, }; /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { - NativeVersion { - runtime_version: VERSION, - can_author_with: Default::default(), - } + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } /// The signed extensions that are added to the runtime. -type SignedExtra = ( - // Checks that the sender is not the zero address. - frame_system::CheckNonZeroSender, - // Checks that the runtime version is correct. - frame_system::CheckSpecVersion, - // Checks that the transaction version is correct. - frame_system::CheckTxVersion, - // Checks that the genesis hash is correct. - frame_system::CheckGenesis, - // Checks that the era is valid. - frame_system::CheckEra, - // Checks that the nonce is valid. - frame_system::CheckNonce, - // Checks that the weight is valid. - frame_system::CheckWeight, - // Ensures that the sender has enough funds to pay for the transaction - // and deducts the fee from the sender's account. - pallet_transaction_payment::ChargeTransactionPayment, +pub type SignedExtra = ( + // Checks that the sender is not the zero address. + frame_system::CheckNonZeroSender, + // Checks that the runtime version is correct. + frame_system::CheckSpecVersion, + // Checks that the transaction version is correct. + frame_system::CheckTxVersion, + // Checks that the genesis hash is correct. + frame_system::CheckGenesis, + // Checks that the era is valid. + frame_system::CheckEra, + // Checks that the nonce is valid. + frame_system::CheckNonce, + // Checks that the weight is valid. + frame_system::CheckWeight, + // Ensures that the sender has enough funds to pay for the transaction + // and deducts the fee from the sender's account. + pallet_transaction_payment::ChargeTransactionPayment, + pallet_revive::evm::runtime::CheckEthTransact, ); +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct Extra; + +impl EthExtra for Extra { + type Config = Runtime; + type Extra = SignedExtra; + + fn get_eth_transact_extra(nonce: u32, eth_fee: u128) -> Self::Extra { + ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::from(crate::generic::Era::Immortal), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + pallet_revive::evm::runtime::CheckEthTransact::::from(eth_fee), + ) + } +} + // Composes the runtime by adding all the used pallets and deriving necessary types. #[runtime] mod runtime { - /// The main runtime type. - #[runtime::runtime] - #[runtime::derive( - RuntimeCall, - RuntimeEvent, - RuntimeError, - RuntimeOrigin, - RuntimeFreezeReason, - RuntimeHoldReason, - RuntimeSlashReason, - RuntimeLockId, - RuntimeTask - )] - pub struct Runtime; - - /// Mandatory system pallet that should always be included in a FRAME runtime. - #[runtime::pallet_index(0)] - pub type System = frame_system; - - /// Provides a way for consensus systems to set and check the onchain time. - #[runtime::pallet_index(1)] - pub type Timestamp = pallet_timestamp; - - /// Provides the ability to keep track of balances. - #[runtime::pallet_index(2)] - pub type Balances = pallet_balances; - - /// Provides a way to execute privileged functions. - #[runtime::pallet_index(3)] - pub type Sudo = pallet_sudo; - - /// Provides the ability to charge for extrinsic execution. - #[runtime::pallet_index(4)] - pub type TransactionPayment = pallet_transaction_payment; - - /// Provides the ability to deploy and interact with smart contracts. - #[runtime::pallet_index(5)] - pub type Contracts = pallet_contracts; - - /// Provides the ability to deploy and interact with EVM wallets. - #[runtime::pallet_index(6)] - pub type ContractsEvm = pallet_contracts_evm; + /// The main runtime type. + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + /// Mandatory system pallet that should always be included in a FRAME runtime. + #[runtime::pallet_index(0)] + pub type System = frame_system; + + /// Provides a way for consensus systems to set and check the onchain time. + #[runtime::pallet_index(1)] + pub type Timestamp = pallet_timestamp; + + /// Provides the ability to keep track of balances. + #[runtime::pallet_index(2)] + pub type Balances = pallet_balances; + + /// Provides a way to execute privileged functions. + #[runtime::pallet_index(3)] + pub type Sudo = pallet_sudo; + + /// Provides the ability to charge for extrinsic execution. + #[runtime::pallet_index(4)] + pub type TransactionPayment = pallet_transaction_payment; + + /// Provides the ability to deploy and interact with smart contracts. + #[runtime::pallet_index(5)] + pub type Revive = pallet_revive; +} + +impl TryInto> for RuntimeCall { + type Error = (); + fn try_into(self) -> Result, Self::Error> { + match self { + RuntimeCall::Revive(call) => Ok(call), + _ => Err(()), + } + } } parameter_types! { pub const Version: RuntimeVersion = VERSION; } +impl StaticLookup for Runtime { + type Source = MultiAddress; + type Target = AccountId; + + fn lookup(a: Self::Source) -> Result { + match a { + MultiAddress::Id(id) => { + log::debug!(target: "evm", "Lookup accountid32: {id:?}"); + Ok(id) + }, + MultiAddress::Address20(i) => { + log::debug!(target: "evm", "Lookup accountid20: {i:?}"); + Ok(::AddressMapper::to_account_id( + &H160::from_slice(&i), + )) + }, + _ => Err(LookupError), + } + } + + fn unlookup(a: Self::Target) -> Self::Source { + MultiAddress::Id(a) + } +} + /// Implements the types required for the system pallet. #[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)] impl frame_system::Config for Runtime { - type Block = Block; - type Version = Version; - type Lookup = ContractsEvm; - // Use the account data from the balances pallet - type AccountData = pallet_balances::AccountData<::Balance>; + type Block = Block; + type Version = Version; + type Lookup = Self; + // Use the account data from the balances pallet + type AccountData = pallet_balances::AccountData<::Balance>; } // Implements the types required for the balances pallet. #[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] impl pallet_balances::Config for Runtime { - type AccountStore = System; - type Balance = u128; - type ExistentialDeposit = ConstU128<1_000>; + type AccountStore = System; + type Balance = u128; + type ExistentialDeposit = ConstU128<1_000>; } // Implements the types required for the sudo pallet. @@ -168,49 +219,31 @@ impl pallet_sudo::Config for Runtime {} #[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)] impl pallet_timestamp::Config for Runtime {} +parameter_types! { + pub FeeMultiplier: Multiplier = Multiplier::one(); +} + // Implements the types required for the transaction payment pallet. #[derive_impl(pallet_transaction_payment::config_preludes::TestDefaultConfig)] impl pallet_transaction_payment::Config for Runtime { - type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; - type WeightToFee = IdentityFee<::Balance>; - type LengthToFee = FixedFee<100, ::Balance>; + type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; + type WeightToFee = IdentityFee<::Balance>; + type LengthToFee = FixedFee<100, ::Balance>; + type FeeMultiplierUpdate = ConstFeeMultiplier; } parameter_types! { - pub ContractSchedule: pallet_contracts::Schedule = Default::default(); pub const DepositPerItem: Balance = 10_000; pub const DepositPerByte: Balance = 10_000; } -/// A struct implementing the [`AddressGenerator`] trait, which derives the contract's address -/// using the shared [`evm_contract_address`] function. This function is used by both the runtime -/// and the Ethereum JSON-RPC server to ensure consistent contract address derivation. -pub struct EvmAddressGenerator; -impl AddressGenerator for EvmAddressGenerator { - fn contract_address( - deploying_address: &AccountId, - code_hash: &H256, - input_data: &[u8], - salt: &[u8], - ) -> AccountId { - let address = evm_contract_address(deploying_address, code_hash, input_data, salt); - ::AddressMapping::get_account_id(&address) - } -} - -#[derive_impl(pallet_contracts::config_preludes::TestDefaultConfig)] -impl pallet_contracts::Config for Runtime { - type AddressGenerator = EvmAddressGenerator; - type CallStack = [pallet_contracts::Frame; 5]; - type DepositPerByte = DepositPerByte; - type DepositPerItem = DepositPerItem; - type Currency = Balances; - type Schedule = ContractSchedule; - type Time = Timestamp; -} - -parameter_types! { - pub const ChainId: u64 = 596u64; +#[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)] +impl pallet_revive::Config for Runtime { + type DepositPerByte = DepositPerByte; + type DepositPerItem = DepositPerItem; + type WeightPrice = pallet_transaction_payment::Pallet; + type Currency = Balances; + type Time = Timestamp; } // TODO integrity check with tokenDecimals? @@ -218,373 +251,246 @@ parameter_types! { // code it here. pub const NATIVE_DECIMALS: u32 = 15; -impl pallet_contracts_evm::Config for Runtime { - type AddressMapping = EVMAddressMapping; - type WeightInfo = pallet_contracts_evm::weights::SubstrateWeight; - type EvmDecimalsConverter = - pallet_contracts_evm::Converter<{ 10u64.pow(EVM_DECIMALS - NATIVE_DECIMALS) }, Balance>; - type ChainId = ChainId; -} - -/// An implementation of the [`Convert`] trait, used to extract an [`TransactionUnsigned`] Ethereum -/// transaction and a source [`H160`] address from an extrinsic. -/// This is used to check that an UncheckedExtrinsic that carry an Ethereum signature is valid. -#[derive(CloneNoBound, PartialEqNoBound, EqNoBound, DebugNoBound)] -pub struct ConvertEthTx(core::marker::PhantomData); - -/// Custom [`InvalidTransaction`] error code for fee mismatch. -pub const FEE_MISMATCH: u8 = 1; - -impl>> ConvertEthTx { - /// Ensure that the fees defined in the transaction (`gas_price` * `gas_limit`) cover the fees - /// calculated by the runtime, using the provided weight and storage deposit limit. - fn validate_fee( - eth_gas_price: u64, - eth_gas_limit: u128, - weight: Weight, - storage_deposit_limit: Balance, - ) -> Result<(), InvalidTransaction> { - let eth_fee = eth_gas_limit * (eth_gas_price as u128); - let actual_fee = - T::weight_to_fee(&weight).into() + Into::::into(storage_deposit_limit); - - if eth_fee < actual_fee { - log::trace!("Eth Fee do not match calculated fee: eth_fee: {eth_fee:?}, actual_fee: {actual_fee:?}"); - return Err(InvalidTransaction::Custom(FEE_MISMATCH)); - } - Ok(()) - } - - /// Validate the [`SignedExtra`] and return the nonce. - fn validate_extra(extra: SignedExtra) -> Result { - let ( - _check_non_zero, - _check_spec_version, - _check_tx_version, - _check_genesis, - mortality, - check_nonce, - _check_weight, - _check_charge, - ) = extra; - - // require immortal - if mortality != frame_system::CheckEra::from(sp_runtime::generic::Era::Immortal) { - return Err(InvalidTransaction::BadProof); - } - - Ok(check_nonce.0.into()) - } -} -impl>> - Convert< - (RuntimeCall, SignedExtra), - Result<(TransactionUnsigned, H160, SignedExtra), InvalidTransaction>, - > for ConvertEthTx -{ - fn convert( - (call, extra): (RuntimeCall, SignedExtra), - ) -> Result<(TransactionUnsigned, H160, SignedExtra), InvalidTransaction> { - match call { - RuntimeCall::ContractsEvm(pallet_contracts_evm::Call::eth_instantiate { - source, - code, - data, - salt, - eth_value, - eth_gas_price, - eth_gas_limit, - gas_limit, - storage_deposit_limit, - }) => { - let source = source.ok_or(InvalidTransaction::BadProof)?; - - Self::validate_fee( - eth_gas_price, - eth_gas_limit, - gas_limit, - storage_deposit_limit.map(|x| x.into()).unwrap_or_default(), - )?; - - let nonce = Self::validate_extra(extra.clone())?; - let chain_id = ::ChainId::get().into(); - let tx = TransactionLegacyUnsigned::from_instantiate( - CallInput { code, data, salt }, - eth_value.into(), - eth_gas_price.into(), - eth_gas_limit.into(), - nonce, - chain_id, - ); - Ok((tx.into(), source, extra)) - } - RuntimeCall::ContractsEvm(pallet_contracts_evm::Call::eth_call { - source, - to, - data: input, - eth_value, - eth_gas_price, - eth_gas_limit, - gas_limit, - storage_deposit_limit, - }) => { - let source = source.ok_or(InvalidTransaction::BadProof)?; - - Self::validate_fee( - eth_gas_price, - eth_gas_limit, - gas_limit, - storage_deposit_limit.map(|x| x.into()).unwrap_or_default(), - )?; - let nonce = Self::validate_extra(extra.clone())?; - let chain_id = ::ChainId::get().into(); - let tx = TransactionLegacyUnsigned::from_call( - to, - input, - eth_value.into(), - eth_gas_price.into(), - eth_gas_limit.into(), - nonce, - chain_id, - ); - - Ok((tx.into(), source, extra)) - } - _ => Err(InvalidTransaction::Call), - } - } -} - -type WeightToFeeOf = ::WeightToFee; type Header = generic::Header; -type Block = generic::Block< - Header, - UncheckedExtrinsic>>, ->; +type Block = generic::Block>; type RuntimeExecutive = - Executive, Runtime, AllPalletsWithSystem>; + Executive, Runtime, AllPalletsWithSystem>; type EventRecord = frame_system::EventRecord< - ::RuntimeEvent, - ::Hash, + ::RuntimeEvent, + ::Hash, >; -use pallet_contracts_evm::AddressMapping; impl_runtime_apis! { - impl pallet_contracts_evm::ContractsEvmApi for Runtime { - - fn account_id(address: &H160) -> AccountId { - ::AddressMapping::get_account_id(address) - } - fn gas_estimate(transaction: GenericTransaction) -> Result, DispatchError> { - ContractsEvm::gas_estimate(transaction) - } - } - - impl pallet_contracts::ContractsApi for Runtime - { - fn call( - origin: AccountId, - dest: AccountId, - value: interface::Balance, - gas_limit: Option, - storage_deposit_limit: Option, - input_data: Vec, - ) -> pallet_contracts::ContractExecResult { - let blockweights: BlockWeights = ::BlockWeights::get(); - let gas_limit = gas_limit.unwrap_or(blockweights.max_block); - Contracts::bare_call( - origin, - dest, - value, - gas_limit, - storage_deposit_limit, - input_data, - pallet_contracts::DebugInfo::UnsafeDebug, - pallet_contracts::CollectEvents::UnsafeCollect, - pallet_contracts::Determinism::Enforced, - ) - } - - fn instantiate( - origin: AccountId, - value: interface::Balance, - gas_limit: Option, - storage_deposit_limit: Option, - code: pallet_contracts::Code, - data: Vec, - salt: Vec, - ) -> pallet_contracts::ContractInstantiateResult - { - log::info!("dry-run instantiate"); - let blockweights: BlockWeights = ::BlockWeights::get(); - let gas_limit = gas_limit.unwrap_or(blockweights.max_block); - Contracts::bare_instantiate( - origin, - value, - gas_limit, - storage_deposit_limit, - code, - data, - salt, - pallet_contracts::DebugInfo::UnsafeDebug, - pallet_contracts::CollectEvents::UnsafeCollect, - ) - } - - fn upload_code( - origin: AccountId, - code: Vec, - storage_deposit_limit: Option, - determinism: pallet_contracts::Determinism, - ) -> pallet_contracts::CodeUploadResult - { - Contracts::bare_upload_code( - origin, - code, - storage_deposit_limit, - determinism, - ) - } - - fn get_storage( - address: AccountId, - key: Vec, - ) -> pallet_contracts::GetStorageResult { - Contracts::get_storage( - address, - key - ) - } - } + impl pallet_revive::ReviveApi for Runtime + { + fn call( + origin: AccountId, + dest: H160, + value: Balance, + gas_limit: Option, + storage_deposit_limit: Option, + input_data: Vec, + ) -> ContractResult { + let blockweights: BlockWeights = ::BlockWeights::get(); + Revive::bare_call( + RuntimeOrigin::signed(origin), + dest, + value, + gas_limit.unwrap_or(blockweights.max_block), + storage_deposit_limit.unwrap_or(u128::MAX), + input_data, + pallet_revive::DebugInfo::UnsafeDebug, + pallet_revive::CollectEvents::UnsafeCollect, + ) + } + + fn instantiate( + origin: AccountId, + value: Balance, + gas_limit: Option, + storage_deposit_limit: Option, + code: pallet_revive::Code, + data: Vec, + salt: Option<[u8; 32]>, + ) -> ContractResult + { + let blockweights: BlockWeights = ::BlockWeights::get(); + Revive::bare_instantiate( + RuntimeOrigin::signed(origin), + value, + gas_limit.unwrap_or(blockweights.max_block), + storage_deposit_limit.unwrap_or(u128::MAX), + code, + data, + salt, + pallet_revive::DebugInfo::UnsafeDebug, + pallet_revive::CollectEvents::UnsafeCollect, + ) + } + + fn eth_transact( + from: H160, + dest: Option, + value: Balance, + input: Vec, + gas_limit: Option, + storage_deposit_limit: Option, + ) -> EthContractResult + { + let blockweights: BlockWeights = ::BlockWeights::get(); + let origin = ::AddressMapper::to_account_id_contract(&from); + let result = Revive::bare_eth_transact( + RuntimeOrigin::signed(origin), + dest, + value, + input, + gas_limit.unwrap_or(blockweights.max_block), + storage_deposit_limit.unwrap_or(u128::MAX), + pallet_revive::DebugInfo::UnsafeDebug, + pallet_revive::CollectEvents::UnsafeCollect, + ); + + EthContractResult { + kind: result.kind, + result: result.result, + gas_limit: result.gas_limit, + storage_deposit: result.storage_deposit, + fee: pallet_transaction_payment::Pallet::::compute_fee(result.len, &result.dispatch_info, 0), + } + } + + fn upload_code( + origin: AccountId, + code: Vec, + storage_deposit_limit: Option, + ) -> pallet_revive::CodeUploadResult + { + Revive::bare_upload_code( + RuntimeOrigin::signed(origin), + code, + storage_deposit_limit.unwrap_or(u128::MAX), + ) + } + + fn get_storage( + address: H160, + key: [u8; 32], + ) -> pallet_revive::GetStorageResult { + Revive::get_storage( + address, + key + ) + } + } impl apis::Core for Runtime { - fn version() -> RuntimeVersion { - VERSION - } + fn version() -> RuntimeVersion { + VERSION + } - fn execute_block(block: Block) { - RuntimeExecutive::execute_block(block) - } + fn execute_block(block: Block) { + RuntimeExecutive::execute_block(block) + } - fn initialize_block(header: &Header) -> ExtrinsicInclusionMode { - RuntimeExecutive::initialize_block(header) - } + fn initialize_block(header: &Header) -> ExtrinsicInclusionMode { + RuntimeExecutive::initialize_block(header) + } } impl apis::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - OpaqueMetadata::new(Runtime::metadata().into()) - } + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } - fn metadata_at_version(version: u32) -> Option { - Runtime::metadata_at_version(version) - } + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } - fn metadata_versions() -> Vec { - Runtime::metadata_versions() - } + fn metadata_versions() -> Vec { + Runtime::metadata_versions() + } } impl apis::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ExtrinsicFor) -> ApplyExtrinsicResult { - RuntimeExecutive::apply_extrinsic(extrinsic) - } - - fn finalize_block() -> HeaderFor { - RuntimeExecutive::finalize_block() - } - - fn inherent_extrinsics(data: InherentData) -> Vec> { - data.create_extrinsics() - } - - fn check_inherents( - block: Block, - data: InherentData, - ) -> CheckInherentsResult { - data.check_extrinsics(&block) - } + fn apply_extrinsic(extrinsic: ExtrinsicFor) -> ApplyExtrinsicResult { + RuntimeExecutive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> HeaderFor { + RuntimeExecutive::finalize_block() + } + + fn inherent_extrinsics(data: InherentData) -> Vec> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: InherentData, + ) -> CheckInherentsResult { + data.check_extrinsics(&block) + } } impl apis::TaggedTransactionQueue for Runtime { - fn validate_transaction( - source: TransactionSource, - tx: ExtrinsicFor, - block_hash: ::Hash, - ) -> TransactionValidity { - RuntimeExecutive::validate_transaction(source, tx, block_hash) - } + fn validate_transaction( + source: TransactionSource, + tx: ExtrinsicFor, + block_hash: ::Hash, + ) -> TransactionValidity { + RuntimeExecutive::validate_transaction(source, tx, block_hash) + } } impl apis::OffchainWorkerApi for Runtime { - fn offchain_worker(header: &HeaderFor) { - RuntimeExecutive::offchain_worker(header) - } + fn offchain_worker(header: &HeaderFor) { + RuntimeExecutive::offchain_worker(header) + } } impl apis::SessionKeys for Runtime { - fn generate_session_keys(_seed: Option>) -> Vec { - Default::default() - } - - fn decode_session_keys( - _encoded: Vec, - ) -> Option, apis::KeyTypeId)>> { - Default::default() - } + fn generate_session_keys(_seed: Option>) -> Vec { + Default::default() + } + + fn decode_session_keys( + _encoded: Vec, + ) -> Option, apis::KeyTypeId)>> { + Default::default() + } } impl apis::AccountNonceApi for Runtime { - fn account_nonce(account: interface::AccountId) -> interface::Nonce { - System::account_nonce(account) - } + fn account_nonce(account: interface::AccountId) -> interface::Nonce { + System::account_nonce(account) + } } impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi< - Block, - interface::Balance, + Block, + interface::Balance, > for Runtime { - fn query_info(uxt: ExtrinsicFor, len: u32) -> RuntimeDispatchInfo { - TransactionPayment::query_info(uxt, len) - } - fn query_fee_details(uxt: ExtrinsicFor, len: u32) -> FeeDetails { - TransactionPayment::query_fee_details(uxt, len) - } - fn query_weight_to_fee(weight: Weight) -> interface::Balance { - TransactionPayment::weight_to_fee(weight) - } - fn query_length_to_fee(length: u32) -> interface::Balance { - TransactionPayment::length_to_fee(length) - } + fn query_info(uxt: ExtrinsicFor, len: u32) -> RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details(uxt: ExtrinsicFor, len: u32) -> FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + fn query_weight_to_fee(weight: Weight) -> interface::Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> interface::Balance { + TransactionPayment::length_to_fee(length) + } } impl sp_genesis_builder::GenesisBuilder for Runtime { - fn build_state(config: Vec) -> sp_genesis_builder::Result { - build_state::(config) - } + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } - fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) - } + fn get_preset(id: &Option) -> Option> { + get_preset::(id, |_| None) + } - fn preset_names() -> Vec { - vec![] - } + fn preset_names() -> Vec { + vec![] + } } } /// Some re-exports that the node side code needs to know. Some are useful in this context as well. pub mod interface { - use super::Runtime; - use polkadot_sdk::*; - - pub type Block = super::Block; - pub use polkadot_sdk::polkadot_sdk_frame::runtime::types_common::OpaqueBlock; - pub type AccountId = ::AccountId; - pub type Nonce = ::Nonce; - pub type Hash = ::Hash; - pub type Balance = ::Balance; - pub type MinimumBalance = ::ExistentialDeposit; + use super::Runtime; + use polkadot_sdk::*; + + pub type Block = super::Block; + pub use polkadot_sdk::polkadot_sdk_frame::runtime::types_common::OpaqueBlock; + pub type AccountId = ::AccountId; + pub type Nonce = ::Nonce; + pub type Hash = ::Hash; + pub type Balance = ::Balance; + pub type MinimumBalance = ::ExistentialDeposit; } diff --git a/demo/yarn.lock b/demo/yarn.lock new file mode 100644 index 0000000..744071a --- /dev/null +++ b/demo/yarn.lock @@ -0,0 +1,535 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + +"@esbuild/linux-loong64@0.14.54": + version "0.14.54" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028" + integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw== + +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/curves@^1.3.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" + integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ== + dependencies: + "@noble/hashes" "1.5.0" + +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + +"@noble/hashes@1.5.0", "@noble/hashes@^1.3.3": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" + integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== + +"@polkadot/keyring@^13.0.2": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-13.1.1.tgz#14b85d4e73ebfa8ccb0fadcdee127e102624dc11" + integrity sha512-Wm+9gn946GIPjGzvueObLGBBS9s541HE6mvKdWGEmPFMzH93ESN931RZlOd67my5MWryiSP05h5SHTp7bSaQTA== + dependencies: + "@polkadot/util" "13.1.1" + "@polkadot/util-crypto" "13.1.1" + tslib "^2.7.0" + +"@polkadot/networks@13.1.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-13.1.1.tgz#e1a05ef6f78ffc37272c6474df7b55244b311f9c" + integrity sha512-eEQ4+Mfl1xFtApeU5PdXZ2XBhxNSvUz9yW+YQVGUCkXRjWFbqNRsTOYWGd9uFbiAOXiiiXbtqfZpxSDzIm4XOg== + dependencies: + "@polkadot/util" "13.1.1" + "@substrate/ss58-registry" "^1.50.0" + tslib "^2.7.0" + +"@polkadot/types-augment@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-12.4.2.tgz#8b8e278f4cbecbdd586470d31c27576e06e87074" + integrity sha512-3fDCOy2BEMuAtMYl4crKg76bv/0pDNEuzpAzV4EBUMIlJwypmjy5sg3gUPCMcA+ckX3xb8DhkWU4ceUdS7T2KQ== + dependencies: + "@polkadot/types" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types-codec@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-12.4.2.tgz#aa601ddbbe4bb28ef751e4565bd87037dee9a49b" + integrity sha512-DiPGRFWtVMepD9i05eC3orSbGtpN7un/pXOrXu0oriU+oxLkpvZH68ZsPNtJhKdQy03cAYtvB8elJOFJZYqoqQ== + dependencies: + "@polkadot/util" "^13.0.2" + "@polkadot/x-bigint" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types-create@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-12.4.2.tgz#1113746ab92694c3402abc59feb3e3fcaf980997" + integrity sha512-nOpeAKZLdSqNMfzS3waQXgyPPaNt8rUHEmR5+WNv6c/Ke/vyf710wjxiTewfp0wpBgtdrimlgG4DLX1J9Ms1LA== + dependencies: + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types@12.4.2", "@polkadot/types@^12.2.1": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-12.4.2.tgz#948e0191b30c37f0d89b8e120174d6be31ed9f9d" + integrity sha512-ivYtt7hYcRvo69ULb1BJA9BE1uefijXcaR089Dzosr9+sMzvsB1yslNQReOq+Wzq6h6AQj4qex6qVqjWZE6Z4A== + dependencies: + "@polkadot/keyring" "^13.0.2" + "@polkadot/types-augment" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/types-create" "12.4.2" + "@polkadot/util" "^13.0.2" + "@polkadot/util-crypto" "^13.0.2" + rxjs "^7.8.1" + tslib "^2.6.3" + +"@polkadot/util-crypto@13.1.1", "@polkadot/util-crypto@^13.0.2": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-13.1.1.tgz#26960046a9bd6b3b63dc9b006c1a24dc6391b875" + integrity sha512-FG68rrLPdfLcscEyH10vnGkakM4O2lqr71S3GDhgc9WXaS8y9jisLgMPg8jbMHiQBJ3iKYkmtPKiLBowRslj2w== + dependencies: + "@noble/curves" "^1.3.0" + "@noble/hashes" "^1.3.3" + "@polkadot/networks" "13.1.1" + "@polkadot/util" "13.1.1" + "@polkadot/wasm-crypto" "^7.3.2" + "@polkadot/wasm-util" "^7.3.2" + "@polkadot/x-bigint" "13.1.1" + "@polkadot/x-randomvalues" "13.1.1" + "@scure/base" "^1.1.7" + tslib "^2.7.0" + +"@polkadot/util@13.1.1", "@polkadot/util@^13.0.2": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-13.1.1.tgz#9cbf81e8c48e2ac549dbe2a40384624870016658" + integrity sha512-M4iQ5Um8tFdDmD7a96nPzfrEt+kxyWOqQDPqXyaax4QBnq/WCbq0jo8IO61uz55mdMQnGZvq8jd8uge4V6JzzQ== + dependencies: + "@polkadot/x-bigint" "13.1.1" + "@polkadot/x-global" "13.1.1" + "@polkadot/x-textdecoder" "13.1.1" + "@polkadot/x-textencoder" "13.1.1" + "@types/bn.js" "^5.1.5" + bn.js "^5.2.1" + tslib "^2.7.0" + +"@polkadot/wasm-bridge@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz#e1b01906b19e06cbca3d94f10f5666f2ae0baadc" + integrity sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g== + dependencies: + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-crypto-asmjs@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz#c6d41bc4b48b5359d57a24ca3066d239f2d70a34" + integrity sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q== + dependencies: + tslib "^2.6.2" + +"@polkadot/wasm-crypto-init@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz#7e1fe79ba978fb0a4a0f74a92d976299d38bc4b8" + integrity sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g== + dependencies: + "@polkadot/wasm-bridge" "7.3.2" + "@polkadot/wasm-crypto-asmjs" "7.3.2" + "@polkadot/wasm-crypto-wasm" "7.3.2" + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-crypto-wasm@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz#44e08ed5cf6499ce4a3aa7247071a5d01f6a74f4" + integrity sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw== + dependencies: + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-crypto@^7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz#61bbcd9e591500705c8c591e6aff7654bdc8afc9" + integrity sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw== + dependencies: + "@polkadot/wasm-bridge" "7.3.2" + "@polkadot/wasm-crypto-asmjs" "7.3.2" + "@polkadot/wasm-crypto-init" "7.3.2" + "@polkadot/wasm-crypto-wasm" "7.3.2" + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-util@7.3.2", "@polkadot/wasm-util@^7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz#4fe6370d2b029679b41a5c02cd7ebf42f9b28de1" + integrity sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg== + dependencies: + tslib "^2.6.2" + +"@polkadot/x-bigint@13.1.1", "@polkadot/x-bigint@^13.0.2": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-13.1.1.tgz#1a9036c9529ce15deab808bee7333bcbd3ab0078" + integrity sha512-Cq4Y6fd9UWtRBZz8RX2tWEBL1IFwUtY6cL8p6HC9yhZtUR6OPjKZe6RIZQa9gSOoIuqZWd6PmtvSNGVH32yfkQ== + dependencies: + "@polkadot/x-global" "13.1.1" + tslib "^2.7.0" + +"@polkadot/x-global@13.1.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-13.1.1.tgz#1db0c16e45a20eddf682c98b1d3487619203c8a9" + integrity sha512-DViIMmmEs29Qlsp058VTg2Mn7e3/CpGazNnKJrsBa0o1Ptxl13/4Z0fjqCpNi2GB+kaOsnREzxUORrHcU+PqcQ== + dependencies: + tslib "^2.7.0" + +"@polkadot/x-randomvalues@13.1.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-13.1.1.tgz#e3fc6e77cdfe6f345fca7433dd92a914807a7e4f" + integrity sha512-cXj4omwbgzQQSiBtV1ZBw+XhJUU3iz/DS6ghUnGllSZEK+fGqiyaNgeFQzDY0tKjm6kYaDpvtOHR3mHsbzDuTg== + dependencies: + "@polkadot/x-global" "13.1.1" + tslib "^2.7.0" + +"@polkadot/x-textdecoder@13.1.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-13.1.1.tgz#305e9a1be38aa435942bc2a73b088a2ca1c1c89b" + integrity sha512-LpZ9KYc6HdBH+i86bCmun4g4GWMiWN/1Pzs0hNdanlQMfqp3UGzl1Dqp0nozMvjWAlvyG7ip235VgNMd8HEbqg== + dependencies: + "@polkadot/x-global" "13.1.1" + tslib "^2.7.0" + +"@polkadot/x-textencoder@13.1.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-13.1.1.tgz#2588c57c1fae68493a5588a156313d25b91a577e" + integrity sha512-w1mT15B9ptN5CJNgN/A0CmBqD5y9OePjBdU6gmAd8KRhwXCF0MTBKcEZk1dHhXiXtX+28ULJWLrfefC5gxy69Q== + dependencies: + "@polkadot/x-global" "13.1.1" + tslib "^2.7.0" + +"@scure/base@^1.1.7": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" + integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== + +"@substrate/ss58-registry@^1.50.0": + version "1.50.0" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.50.0.tgz#2d2a3d060cd4eadd200e4538078461ba73e13d6d" + integrity sha512-mkmlMlcC+MSd9rA+PN8ljGAm5fVZskvVwkXIsbx4NFwaT8kt38r7e9cyDWscG3z2Zn40POviZvEMrJSk+r2SgQ== + +"@types/bn.js@^5.1.5": + version "5.1.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.6.tgz#9ba818eec0c85e4d3c679518428afdf611d03203" + integrity sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w== + dependencies: + "@types/node" "*" + +"@types/node@*": + version "22.6.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.6.0.tgz#b604c9a628760221905c1b272fd6aee661f45042" + integrity sha512-QyR8d5bmq+eR72TwQDfujwShHMcIrWIYsaQFtXRE58MHPTEKUNxjxvl0yS0qPMds5xbSDWtp7ZpvGFtd7dfMdQ== + dependencies: + undici-types "~6.19.2" + +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + +"@types/node@^14.14.6": + version "14.18.63" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.63.tgz#1788fa8da838dbb5f9ea994b834278205db6ca2b" + integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ== + +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + +bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + +esbuild-android-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz#505f41832884313bbaffb27704b8bcaa2d8616be" + integrity sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ== + +esbuild-android-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz#8ce69d7caba49646e009968fe5754a21a9871771" + integrity sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg== + +esbuild-darwin-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz#24ba67b9a8cb890a3c08d9018f887cc221cdda25" + integrity sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug== + +esbuild-darwin-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz#3f7cdb78888ee05e488d250a2bdaab1fa671bf73" + integrity sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw== + +esbuild-freebsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz#09250f997a56ed4650f3e1979c905ffc40bbe94d" + integrity sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg== + +esbuild-freebsd-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz#bafb46ed04fc5f97cbdb016d86947a79579f8e48" + integrity sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q== + +esbuild-linux-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" + integrity sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw== + +esbuild-linux-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz#de5fdba1c95666cf72369f52b40b03be71226652" + integrity sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg== + +esbuild-linux-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz#dae4cd42ae9787468b6a5c158da4c84e83b0ce8b" + integrity sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig== + +esbuild-linux-arm@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz#a2c1dff6d0f21dbe8fc6998a122675533ddfcd59" + integrity sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw== + +esbuild-linux-mips64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz#d9918e9e4cb972f8d6dae8e8655bf9ee131eda34" + integrity sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw== + +esbuild-linux-ppc64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz#3f9a0f6d41073fb1a640680845c7de52995f137e" + integrity sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ== + +esbuild-linux-riscv64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz#618853c028178a61837bc799d2013d4695e451c8" + integrity sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg== + +esbuild-linux-s390x@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz#d1885c4c5a76bbb5a0fe182e2c8c60eb9e29f2a6" + integrity sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA== + +esbuild-netbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz#69ae917a2ff241b7df1dbf22baf04bd330349e81" + integrity sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w== + +esbuild-openbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz#db4c8495287a350a6790de22edea247a57c5d47b" + integrity sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw== + +esbuild-sunos-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz#54287ee3da73d3844b721c21bc80c1dc7e1bf7da" + integrity sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw== + +esbuild-windows-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz#f8aaf9a5667630b40f0fb3aa37bf01bbd340ce31" + integrity sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w== + +esbuild-windows-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz#bf54b51bd3e9b0f1886ffdb224a4176031ea0af4" + integrity sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ== + +esbuild-windows-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz#937d15675a15e4b0e4fafdbaa3a01a776a2be982" + integrity sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg== + +esbuild@^0.14.27: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" + integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== + optionalDependencies: + "@esbuild/linux-loong64" "0.14.54" + esbuild-android-64 "0.14.54" + esbuild-android-arm64 "0.14.54" + esbuild-darwin-64 "0.14.54" + esbuild-darwin-arm64 "0.14.54" + esbuild-freebsd-64 "0.14.54" + esbuild-freebsd-arm64 "0.14.54" + esbuild-linux-32 "0.14.54" + esbuild-linux-64 "0.14.54" + esbuild-linux-arm "0.14.54" + esbuild-linux-arm64 "0.14.54" + esbuild-linux-mips64le "0.14.54" + esbuild-linux-ppc64le "0.14.54" + esbuild-linux-riscv64 "0.14.54" + esbuild-linux-s390x "0.14.54" + esbuild-netbsd-64 "0.14.54" + esbuild-openbsd-64 "0.14.54" + esbuild-sunos-64 "0.14.54" + esbuild-windows-32 "0.14.54" + esbuild-windows-64 "0.14.54" + esbuild-windows-arm64 "0.14.54" + +ethers@^6.13.1: + version "6.13.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" + integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.17.1" + +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +is-core-module@^2.13.0: + version "2.15.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.1.tgz#a7363a25bee942fefab0de13bf6aa372c82dcc37" + integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== + dependencies: + hasown "^2.0.2" + +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +picocolors@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== + +postcss@^8.4.13: + version "8.4.47" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" + integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== + dependencies: + nanoid "^3.3.7" + picocolors "^1.1.0" + source-map-js "^1.2.1" + +prettier@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + +resolve@^1.22.0: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +"rollup@>=2.59.0 <2.78.0": + version "2.77.3" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.77.3.tgz#8f00418d3a2740036e15deb653bed1a90ee0cc12" + integrity sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g== + optionalDependencies: + fsevents "~2.3.2" + +rxjs@^7.8.1: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +scale-codec@^0.13.0: + version "0.13.0" + resolved "https://registry.yarnpkg.com/scale-codec/-/scale-codec-0.13.0.tgz#7c9842412e0e4fdab5f9f10b475e3fbd40fdb23f" + integrity sha512-HxLaGxglkZP7SwjCLZPMsWGKN8Q/h5bjIH9YLFRcsG3Fmh+qsCOZYRLhntvTyP6B/Q7xHPBc2YKODOSfH0rH8g== + +scale-ts@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/scale-ts/-/scale-ts-1.6.0.tgz#e9641093c5a9e50f964ddb1607139034e3e932e9" + integrity sha512-Ja5VCjNZR8TGKhUumy9clVVxcDpM+YFjAnkMuwQy68Hixio3VRRvWdE3g8T/yC+HXA0ZDQl2TGyUmtmbcVl40Q== + +source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + +tslib@^2.1.0, tslib@^2.6.2, tslib@^2.6.3, tslib@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + +typescript@^4.1.2: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +vite@^2.5.0: + version "2.9.18" + resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.18.tgz#74e2a83b29da81e602dac4c293312cc575f091c7" + integrity sha512-sAOqI5wNM9QvSEE70W3UGMdT8cyEn0+PmJMTFvTB8wB0YbYUWw3gUbY62AOyrXosGieF2htmeLATvNxpv/zNyQ== + dependencies: + esbuild "^0.14.27" + postcss "^8.4.13" + resolve "^1.22.0" + rollup ">=2.59.0 <2.78.0" + optionalDependencies: + fsevents "~2.3.2" + +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== diff --git a/revive b/revive new file mode 120000 index 0000000..55d93de --- /dev/null +++ b/revive @@ -0,0 +1 @@ +/Users/pg/revive \ No newline at end of file diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 6e400f2..fdc102b 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -26,6 +26,11 @@ name = "rpc-playground" path = "examples/rpc-playground.rs" required-features = ["example"] +[[example]] +name = "extrinsic" +path = "examples/extrinsic.rs" +required-features = ["example"] + [dependencies] clap.workspace = true anyhow.workspace = true @@ -35,22 +40,24 @@ serde_json.workspace = true subxt.workspace = true thiserror.workspace = true tokio = { workspace = true, features = ["full"] } -parity-scale-codec = { workspace = true, features = [ - "derive", -], default-features = false } -primitives = { package = "pallet-contracts-evm-primitives", path = "../chain/primitives" } -eth-rpc-api = { path = "./api", features = ["std"] } +codec = { workspace = true, features = ["derive"] } +scale-decode = { workspace = true, features = ["derive"] } log.workspace = true tracing-subscriber.workspace = true -polkadot-sdk = { workspace = true, default-features = false } -secp256k1 = { workspace = true, features = ["recovery"] } +polkadot-sdk = { workspace = true, features = ["pallet-revive", "std", "sp-core", "sp-weights", "sp-runtime"] } tower.workspace = true tower-http = { workspace = true, features = ["full"] } hyper.workspace = true +subxt-signer = { workspace = true, optional = true } +hex = { workspace = true, optional = true } +hex-literal = { workspace = true, optional = true } +scale-info = { workspace = true } +secp256k1 = { workspace = true, optional = true, features = ["recovery"] } +env_logger = { workspace = true } [features] dev = [] -example = [] +example = ["subxt-signer","hex-literal", "hex", "secp256k1"] [dev-dependencies] hex-literal.workspace = true diff --git a/rpc/api/Cargo.toml b/rpc/api/Cargo.toml deleted file mode 100644 index b4d1d33..0000000 --- a/rpc/api/Cargo.toml +++ /dev/null @@ -1,54 +0,0 @@ -[package] -name = "eth-rpc-api" -description = "RPC traits and types for Ethereum JSON-RPC API" -version = "0.1.0" -license = "MIT-0" -authors.workspace = true -homepage.workspace = true -repository.workspace = true -edition.workspace = true -publish = false - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -polkadot-sdk = { workspace = true, default-features = false, features = [ - "experimental", - "runtime", -] } -serde = { workspace = true, features = ["alloc", "derive"] } -ethereum-types = { workspace = true, features = [ - "codec", - "rlp", - "serialize", -], default-features = false } -rlp = { workspace = true, default-features = false } -hex = { workspace = true, default-features = false } -secp256k1 = { workspace = true, features = ["recovery"], optional = true } -derive_more.workspace = true -parity-scale-codec = { workspace = true, features = [ - "derive", -], default-features = false } -scale-info = { workspace = true, features = [ - "derive", -], default-features = false } - -[dev-dependencies] -serde_json.workspace = true -hex-literal.workspace = true -pretty_assertions.workspace = true - -[features] -default = ["std"] -std = [ - "ethereum-types/std", - "hex/std", - "parity-scale-codec/std", - "polkadot-sdk/std", - "rlp/std", - "scale-info/std", - "secp256k1", - "serde/std", - "serde_json/std", -] diff --git a/rpc/api/src/adapters.rs b/rpc/api/src/adapters.rs deleted file mode 100644 index 64a13ba..0000000 --- a/rpc/api/src/adapters.rs +++ /dev/null @@ -1,109 +0,0 @@ -//! Various adapters for the RPC types. -use crate::H160; -use crate::{ - Bytes, GenericTransaction, ReceiptInfo, TransactionInfo, TransactionLegacySigned, - TransactionLegacyUnsigned, U256, -}; - -#[cfg(not(feature = "std"))] -use alloc::vec::Vec; -use polkadot_sdk::polkadot_sdk_frame::prelude::*; - -impl TransactionLegacyUnsigned { - /// Convert a legacy transaction to a [`GenericTransaction`]. - pub fn as_generic(self, from: H160) -> GenericTransaction { - GenericTransaction { - from: Some(from), - chain_id: self.chain_id, - gas: Some(self.gas), - input: Some(self.input), - nonce: Some(self.nonce), - to: self.to, - r#type: Some(self.r#type.as_byte()), - value: Some(self.value), - ..Default::default() - } - } - - /// Build a transaction from an instantiate call. - pub fn from_instantiate( - input: CallInput, - value: U256, - gas_price: U256, - gas: U256, - nonce: U256, - chain_id: U256, - ) -> Self { - Self { - input: Bytes(input.encode()), - value, - gas_price, - gas, - nonce, - chain_id: Some(chain_id), - ..Default::default() - } - } - - /// Build a transaction from a call. - pub fn from_call( - to: H160, - input: Vec, - value: U256, - gas_price: U256, - gas: U256, - nonce: U256, - chain_id: U256, - ) -> Self { - Self { - to: Some(to), - input: Bytes(input), - value, - gas_price, - gas, - nonce, - chain_id: Some(chain_id), - ..Default::default() - } - } -} - -/// The input for a call. -/// -/// It can be encoded as a [`Vec`] and passed as the **input** field of a transaction. -#[derive(Clone, Encode, Decode, Debug)] -pub struct CallInput { - /// The code's bytes. - pub code: Vec, - /// the input data. - pub data: Vec, - /// The salt - pub salt: Vec, -} - -/// The output information of a dry run. -#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, TypeInfo)] -pub struct DryRunInfo { - /// The weight consumed by the transaction. - pub gas_limit: Weight, - /// The deposit consumed by the transaction. - pub storage_deposit_limit: Option, - /// The output data of the transaction. - pub return_data: Vec, -} - -// TODO: store the transaction_signed in the cache so that we can populate `transaction_signed` -impl From for TransactionInfo { - fn from(receipt: ReceiptInfo) -> Self { - Self { - block_hash: receipt.block_hash, - block_number: receipt.block_number, - from: receipt.from, - hash: receipt.transaction_hash, - transaction_index: receipt.transaction_index, - transaction_signed: crate::TransactionSigned::TransactionLegacySigned( - TransactionLegacySigned::default(), - ), - } - } -} diff --git a/rpc/api/src/byte.rs b/rpc/api/src/byte.rs deleted file mode 100644 index 97c9ecc..0000000 --- a/rpc/api/src/byte.rs +++ /dev/null @@ -1,132 +0,0 @@ -//! Define Byte wrapper types for encoding and decoding hex strings -use core::{ - fmt::{Debug, Display, Formatter, Result as FmtResult}, - str::FromStr, -}; -use polkadot_sdk::polkadot_sdk_frame::derive::{Decode, Encode, TypeInfo}; -use serde::{Deserialize, Serialize}; - -#[cfg(not(feature = "std"))] -use alloc::vec; - -#[cfg(not(feature = "std"))] -use alloc::vec::Vec; - -use hex_serde::HexCodec; - -mod hex_serde { - #[cfg(not(feature = "std"))] - use alloc::{format, string::String, vec::Vec}; - use serde::{Deserialize, Deserializer, Serializer}; - - pub trait HexCodec: Sized { - type Error; - fn to_hex(&self) -> String; - fn from_hex(s: String) -> Result; - } - - impl HexCodec for u8 { - type Error = core::num::ParseIntError; - fn to_hex(&self) -> String { - format!("0x{:x}", self) - } - fn from_hex(s: String) -> Result { - u8::from_str_radix(s.trim_start_matches("0x"), 16) - } - } - - impl HexCodec for [u8; T] { - type Error = hex::FromHexError; - fn to_hex(&self) -> String { - format!("0x{}", hex::encode(self)) - } - fn from_hex(s: String) -> Result { - let data = hex::decode(s.trim_start_matches("0x"))?; - data.try_into() - .map_err(|_| hex::FromHexError::InvalidStringLength) - } - } - - impl HexCodec for Vec { - type Error = hex::FromHexError; - fn to_hex(&self) -> String { - format!("0x{}", hex::encode(self)) - } - fn from_hex(s: String) -> Result { - hex::decode(s.trim_start_matches("0x")) - } - } - - pub fn serialize(value: &T, serializer: S) -> Result - where - S: Serializer, - T: HexCodec, - { - let s = value.to_hex(); - serializer.serialize_str(&s) - } - - pub fn deserialize<'de, D, T>(deserializer: D) -> Result - where - D: Deserializer<'de>, - T: HexCodec, - ::Error: core::fmt::Debug, - { - let s = String::deserialize(deserializer)?; - let value = T::from_hex(s).map_err(|e| serde::de::Error::custom(format!("{:?}", e)))?; - Ok(value) - } -} - -impl FromStr for Bytes { - type Err = hex::FromHexError; - fn from_str(s: &str) -> Result { - let data = hex::decode(s.trim_start_matches("0x"))?; - Ok(Bytes(data)) - } -} - -macro_rules! impl_hex { - ($type:ident, $inner:ty, $default:expr) => { - #[derive(Encode, Decode, Eq, PartialEq, TypeInfo, Clone, Serialize, Deserialize)] - #[doc = concat!("`", stringify!($inner), "`", " wrapper type for encoding and decoding hex strings")] - pub struct $type(#[serde(with = "hex_serde")] pub $inner); - - impl Default for $type { - fn default() -> Self { - $type($default) - } - } - - impl From<$inner> for $type { - fn from(inner: $inner) -> Self { - $type(inner) - } - } - - impl Debug for $type { - fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { - write!(f, concat!(stringify!($type), "({})"), self.0.to_hex()) - } - } - - impl Display for $type { - fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { - write!(f, "{}", self.0.to_hex()) - } - } - }; -} - -impl_hex!(Byte, u8, 0u8); -impl_hex!(Bytes, Vec, vec![]); -impl_hex!(Bytes256, [u8; 256], [0u8; 256]); - -#[test] -fn serialize_byte() { - let a = Byte(42); - let s = serde_json::to_string(&a).unwrap(); - assert_eq!(s, "\"0x2a\""); - let b = serde_json::from_str::(&s).unwrap(); - assert_eq!(a, b); -} diff --git a/rpc/api/src/lib.rs b/rpc/api/src/lib.rs deleted file mode 100644 index ae4b074..0000000 --- a/rpc/api/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! Generated JSON-RPC methods and types, for Ethereum. -#![warn(missing_docs)] -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg(not(feature = "std"))] -extern crate alloc; - -mod byte; -pub use byte::*; - -mod rlp_codec; -pub use rlp; -pub use rlp_codec::*; - -mod type_id; -pub use type_id::*; - -pub use ethereum_types::{Address, H256, U256, U64}; - -mod rpc_types; -pub use rpc_types::*; - -pub mod adapters; -pub mod signature; diff --git a/rpc/api/src/rlp_codec.rs b/rpc/api/src/rlp_codec.rs deleted file mode 100644 index 3ea7220..0000000 --- a/rpc/api/src/rlp_codec.rs +++ /dev/null @@ -1,227 +0,0 @@ -//! RLP encoding and decoding for Ethereum transactions. -//! See for more information about RLP encoding. - -use super::*; -use crate::H160; -use polkadot_sdk::{sp_core::keccak_256, sp_io::crypto::secp256k1_ecdsa_recover}; -use rlp::{Decodable, Encodable}; - -/// See -impl Encodable for TransactionLegacyUnsigned { - fn rlp_append(&self, s: &mut rlp::RlpStream) { - if let Some(chain_id) = self.chain_id { - s.begin_list(9); - s.append(&self.nonce); - s.append(&self.gas_price); - s.append(&self.gas); - match self.to { - Some(ref to) => s.append(to), - None => s.append_empty_data(), - }; - s.append(&self.value); - s.append(&self.input.0); - s.append(&chain_id); - s.append(&0_u8); - s.append(&0_u8); - } else { - s.begin_list(6); - s.append(&self.nonce); - s.append(&self.gas_price); - s.append(&self.gas); - match self.to { - Some(ref to) => s.append(to), - None => s.append_empty_data(), - }; - s.append(&self.value); - s.append(&self.input.0); - } - } -} - -/// See -impl Decodable for TransactionLegacyUnsigned { - fn decode(rlp: &rlp::Rlp) -> Result { - Ok(TransactionLegacyUnsigned { - nonce: rlp.val_at(0)?, - gas_price: rlp.val_at(1)?, - gas: rlp.val_at(2)?, - to: { - let to = rlp.at(3)?; - if to.is_empty() { - None - } else { - Some(to.as_val()?) - } - }, - value: rlp.val_at(4)?, - input: Bytes(rlp.val_at(5)?), - chain_id: { - if let Ok(chain_id) = rlp.val_at(6) { - Some(chain_id) - } else { - None - } - }, - ..Default::default() - }) - } -} - -impl Encodable for TransactionLegacySigned { - fn rlp_append(&self, s: &mut rlp::RlpStream) { - s.begin_list(9); - s.append(&self.transaction_legacy_unsigned.nonce); - s.append(&self.transaction_legacy_unsigned.gas_price); - s.append(&self.transaction_legacy_unsigned.gas); - match self.transaction_legacy_unsigned.to { - Some(ref to) => s.append(to), - None => s.append_empty_data(), - }; - s.append(&self.transaction_legacy_unsigned.value); - s.append(&self.transaction_legacy_unsigned.input.0); - - s.append(&self.v); - s.append(&self.r); - s.append(&self.s); - } -} - -/// See -impl Decodable for TransactionLegacySigned { - fn decode(rlp: &rlp::Rlp) -> Result { - let v: U256 = rlp.val_at(6)?; - let extract_chain_id = |v: u64| { - if v >= 35 { - Some((v - 35) / 2) - } else { - None - } - }; - - Ok(TransactionLegacySigned { - transaction_legacy_unsigned: { - TransactionLegacyUnsigned { - nonce: rlp.val_at(0)?, - gas_price: rlp.val_at(1)?, - gas: rlp.val_at(2)?, - to: { - let to = rlp.at(3)?; - if to.is_empty() { - None - } else { - Some(to.as_val()?) - } - }, - value: rlp.val_at(4)?, - input: Bytes(rlp.val_at(5)?), - chain_id: extract_chain_id(v.as_u64()).map(|v| v.into()), - r#type: Type0 {}, - } - }, - v, - r: rlp.val_at(7)?, - s: rlp.val_at(8)?, - }) - } -} - -/// Recover the signer of a transaction. -pub trait SignerRecovery { - /// The signature type. - type Signature; - - /// The signer address type. - type Signer; - - /// Recover the signer of a transaction from its signature. - fn recover_signer(&self, signature: &Self::Signature) -> Option; -} - -impl SignerRecovery for TransactionLegacyUnsigned { - type Signature = [u8; 65]; - type Signer = H160; - fn recover_signer(&self, sig: &Self::Signature) -> Option { - let msg = keccak_256(&rlp::encode(self)); - let pub_key = secp256k1_ecdsa_recover(sig, &msg).ok()?; - let pub_key_hash = keccak_256(&pub_key); - Some(H160::from_slice(&pub_key_hash[12..])) - } -} - -#[cfg(test)] -mod test { - use super::*; - use core::str::FromStr; - use secp256k1::{Message, PublicKey, Secp256k1, SecretKey}; - - struct Account { - sk: SecretKey, - } - - impl Default for Account { - fn default() -> Self { - Account { - sk: SecretKey::from_str( - "a872f6cbd25a0e04a08b1e21098017a9e6194d101d75e13111f71410c59cd57f", - ) - .unwrap(), - } - } - } - - impl Account { - fn address(&self) -> H160 { - let pub_key = - PublicKey::from_secret_key(&Secp256k1::new(), &self.sk).serialize_uncompressed(); - let hash = keccak_256(&pub_key[1..]); - H160::from_slice(&hash[12..]) - } - - fn sign_transaction(&self, tx: TransactionLegacyUnsigned) -> TransactionLegacySigned { - let rlp_encoded = tx.rlp_bytes(); - let tx_hash = keccak_256(&rlp_encoded); - let secp = Secp256k1::new(); - let msg = Message::from_digest(tx_hash); - let sig = secp.sign_ecdsa_recoverable(&msg, &self.sk); - TransactionLegacySigned::from(tx, sig) - } - } - - #[test] - fn encode_decode_legacy_transaction_works() { - let tx = TransactionLegacyUnsigned { - chain_id: Some(596.into()), - gas: U256::from(21000), - nonce: U256::from(1), - gas_price: U256::from("0x640000006a"), - to: Some(H160::from_str("0x1111111111222222222233333333334444444444").unwrap()), - value: U256::from(123123), - input: Bytes(vec![]), - r#type: Type0, - }; - - let rlp_bytes = rlp::encode(&tx); - let decoded = rlp::decode::(&rlp_bytes).unwrap(); - dbg!(&decoded); - } - - #[test] - fn recover_address_works() { - let account = Account::default(); - - let unsigned_tx = TransactionLegacyUnsigned { - value: 200_000_000_000_000_000_000u128.into(), - gas_price: 100_000_000_200u64.into(), - gas: 100_107u32.into(), - nonce: 3.into(), - to: Some(H160::from_str("75e480db528101a381ce68544611c169ad7eb342").unwrap()), - chain_id: Some(596.into()), - ..Default::default() - }; - - let tx = account.sign_transaction(unsigned_tx.clone()); - let recovered_address = tx.recover_eth_address().unwrap(); - - assert_eq!(account.address(), recovered_address); - } -} diff --git a/rpc/api/src/rpc_types.rs b/rpc/api/src/rpc_types.rs deleted file mode 100644 index 4114ec2..0000000 --- a/rpc/api/src/rpc_types.rs +++ /dev/null @@ -1,622 +0,0 @@ -//! Generated JSON-RPC types. -#![allow(missing_docs)] - -use crate::byte::*; -use crate::{Type0, Type1, Type2}; -use derive_more::{From, TryInto}; -pub use ethereum_types::*; -use polkadot_sdk::polkadot_sdk_frame::derive::{Decode, Encode, TypeInfo}; -use serde::{Deserialize, Serialize}; - -#[cfg(not(feature = "std"))] -use alloc::{string::String, vec::Vec}; - -/// Block object -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Block { - /// Base fee per gas - #[serde(rename = "baseFeePerGas", skip_serializing_if = "Option::is_none")] - pub base_fee_per_gas: Option, - /// Blob gas used - #[serde(rename = "blobGasUsed", skip_serializing_if = "Option::is_none")] - pub blob_gas_used: Option, - /// Difficulty - #[serde(skip_serializing_if = "Option::is_none")] - pub difficulty: Option, - /// Excess blob gas - #[serde(rename = "excessBlobGas", skip_serializing_if = "Option::is_none")] - pub excess_blob_gas: Option, - /// Extra data - #[serde(rename = "extraData")] - pub extra_data: Bytes, - /// Gas limit - #[serde(rename = "gasLimit")] - pub gas_limit: U256, - /// Gas used - #[serde(rename = "gasUsed")] - pub gas_used: U256, - /// Hash - pub hash: H256, - /// Bloom filter - #[serde(rename = "logsBloom")] - pub logs_bloom: Bytes256, - /// Coinbase - pub miner: Address, - /// Mix hash - #[serde(rename = "mixHash")] - pub mix_hash: H256, - /// Nonce - pub nonce: String, - /// Number - pub number: U256, - /// Parent Beacon Block Root - #[serde( - rename = "parentBeaconBlockRoot", - skip_serializing_if = "Option::is_none" - )] - pub parent_beacon_block_root: Option, - /// Parent block hash - #[serde(rename = "parentHash")] - pub parent_hash: H256, - /// Receipts root - #[serde(rename = "receiptsRoot")] - pub receipts_root: H256, - /// Ommers hash - #[serde(rename = "sha3Uncles")] - pub sha_3_uncles: H256, - /// Block size - pub size: U256, - /// State root - #[serde(rename = "stateRoot")] - pub state_root: H256, - /// Timestamp - pub timestamp: U256, - /// Total difficulty - #[serde(rename = "totalDifficulty", skip_serializing_if = "Option::is_none")] - pub total_difficulty: Option, - pub transactions: H256OrTransactionInfo, - /// Transactions root - #[serde(rename = "transactionsRoot")] - pub transactions_root: H256, - /// Uncles - pub uncles: Vec, - /// Withdrawals - #[serde(skip_serializing_if = "Option::is_none")] - pub withdrawals: Option>, - /// Withdrawals root - #[serde(rename = "withdrawalsRoot", skip_serializing_if = "Option::is_none")] - pub withdrawals_root: Option, -} - -/// Block number or tag -#[derive( - Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq, -)] -#[serde(untagged)] -pub enum BlockNumberOrTag { - /// Block number - U256(U256), - /// Block tag - BlockTag(BlockTag), -} -impl Default for BlockNumberOrTag { - fn default() -> Self { - BlockNumberOrTag::U256(Default::default()) - } -} - -/// Block number, tag, or block hash -#[derive( - Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq, -)] -#[serde(untagged)] -pub enum BlockNumberOrTagOrHash { - /// Block number - U256(U256), - /// Block tag - BlockTag(BlockTag), - /// Block hash - H256(H256), -} -impl Default for BlockNumberOrTagOrHash { - fn default() -> Self { - BlockNumberOrTagOrHash::U256(Default::default()) - } -} - -/// Transaction object generic to all types -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct GenericTransaction { - /// accessList - /// EIP-2930 access list - #[serde(rename = "accessList", skip_serializing_if = "Option::is_none")] - pub access_list: Option, - /// blobVersionedHashes - /// List of versioned blob hashes associated with the transaction's EIP-4844 data blobs. - #[serde( - rename = "blobVersionedHashes", - skip_serializing_if = "Option::is_none" - )] - pub blob_versioned_hashes: Option>, - /// blobs - /// Raw blob data. - #[serde(skip_serializing_if = "Option::is_none")] - pub blobs: Option>, - /// chainId - /// Chain ID that this transaction is valid on. - #[serde(rename = "chainId", skip_serializing_if = "Option::is_none")] - pub chain_id: Option, - /// from address - #[serde(skip_serializing_if = "Option::is_none")] - pub from: Option

, - /// gas limit - #[serde(skip_serializing_if = "Option::is_none")] - pub gas: Option, - /// gas price - /// The gas price willing to be paid by the sender in wei - #[serde(rename = "gasPrice", skip_serializing_if = "Option::is_none")] - pub gas_price: Option, - /// input data - #[serde(alias = "data", skip_serializing_if = "Option::is_none")] - pub input: Option, - /// max fee per blob gas - /// The maximum total fee per gas the sender is willing to pay for blob gas in wei - #[serde(rename = "maxFeePerBlobGas", skip_serializing_if = "Option::is_none")] - pub max_fee_per_blob_gas: Option, - /// max fee per gas - /// The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei - #[serde(rename = "maxFeePerGas", skip_serializing_if = "Option::is_none")] - pub max_fee_per_gas: Option, - /// max priority fee per gas - /// Maximum fee per gas the sender is willing to pay to miners in wei - #[serde( - rename = "maxPriorityFeePerGas", - skip_serializing_if = "Option::is_none" - )] - pub max_priority_fee_per_gas: Option, - /// nonce - #[serde(skip_serializing_if = "Option::is_none")] - pub nonce: Option, - /// to address - pub to: Option
, - /// type - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, - /// value - #[serde(skip_serializing_if = "Option::is_none")] - pub value: Option, -} - -/// Receipt information -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct ReceiptInfo { - /// blob gas price - /// The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844. - #[serde(rename = "blobGasPrice", skip_serializing_if = "Option::is_none")] - pub blob_gas_price: Option, - /// blob gas used - /// The amount of blob gas used for this specific transaction. Only specified for blob transactions as defined by EIP-4844. - #[serde(rename = "blobGasUsed", skip_serializing_if = "Option::is_none")] - pub blob_gas_used: Option, - /// block hash - #[serde(rename = "blockHash")] - pub block_hash: H256, - /// block number - #[serde(rename = "blockNumber")] - pub block_number: U256, - /// contract address - /// The contract address created, if the transaction was a contract creation, otherwise null. - #[serde(rename = "contractAddress")] - pub contract_address: Option
, - /// cumulative gas used - /// The sum of gas used by this transaction and all preceding transactions in the same block. - #[serde(rename = "cumulativeGasUsed")] - pub cumulative_gas_used: U256, - /// effective gas price - /// The actual value per gas deducted from the sender's account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas). - #[serde(rename = "effectiveGasPrice")] - pub effective_gas_price: U256, - /// from - pub from: Address, - /// gas used - /// The amount of gas used for this specific transaction alone. - #[serde(rename = "gasUsed")] - pub gas_used: U256, - /// logs - pub logs: Vec, - /// logs bloom - #[serde(rename = "logsBloom")] - pub logs_bloom: Bytes256, - /// state root - /// The post-transaction state root. Only specified for transactions included before the Byzantium upgrade. - #[serde(skip_serializing_if = "Option::is_none")] - pub root: Option, - /// status - /// Either 1 (success) or 0 (failure). Only specified for transactions included after the Byzantium upgrade. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// to - /// Address of the receiver or null in a contract creation transaction. - pub to: Option
, - /// transaction hash - #[serde(rename = "transactionHash")] - pub transaction_hash: H256, - /// transaction index - #[serde(rename = "transactionIndex")] - pub transaction_index: U256, - /// type - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, -} - -/// Transaction information -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct TransactionInfo { - /// block hash - #[serde(rename = "blockHash")] - pub block_hash: H256, - /// block number - #[serde(rename = "blockNumber")] - pub block_number: U256, - /// from address - pub from: Address, - /// transaction hash - pub hash: H256, - /// transaction index - #[serde(rename = "transactionIndex")] - pub transaction_index: U256, - #[serde(flatten)] - pub transaction_signed: TransactionSigned, -} - -#[derive( - Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq, -)] -#[serde(untagged)] -pub enum TransactionUnsigned { - Transaction4844Unsigned(Transaction4844Unsigned), - Transaction1559Unsigned(Transaction1559Unsigned), - Transaction2930Unsigned(Transaction2930Unsigned), - TransactionLegacyUnsigned(TransactionLegacyUnsigned), -} -impl Default for TransactionUnsigned { - fn default() -> Self { - TransactionUnsigned::Transaction4844Unsigned(Default::default()) - } -} - -/// Access list -pub type AccessList = Vec; - -/// Block tag -/// `earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub enum BlockTag { - #[serde(rename = "earliest")] - #[default] - Earliest, - #[serde(rename = "finalized")] - Finalized, - #[serde(rename = "safe")] - Safe, - #[serde(rename = "latest")] - Latest, - #[serde(rename = "pending")] - Pending, -} - -#[derive( - Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq, -)] -#[serde(untagged)] -pub enum H256OrTransactionInfo { - /// Transaction hashes - H256s(Vec), - /// Full transactions - TransactionInfos(Vec), -} -impl Default for H256OrTransactionInfo { - fn default() -> Self { - H256OrTransactionInfo::H256s(Default::default()) - } -} - -/// log -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Log { - /// address - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option
, - /// block hash - #[serde(rename = "blockHash", skip_serializing_if = "Option::is_none")] - pub block_hash: Option, - /// block number - #[serde(rename = "blockNumber", skip_serializing_if = "Option::is_none")] - pub block_number: Option, - /// data - #[serde(skip_serializing_if = "Option::is_none")] - pub data: Option, - /// log index - #[serde(rename = "logIndex", skip_serializing_if = "Option::is_none")] - pub log_index: Option, - /// removed - #[serde(skip_serializing_if = "Option::is_none")] - pub removed: Option, - /// topics - #[serde(skip_serializing_if = "Option::is_none")] - pub topics: Option>, - /// transaction hash - #[serde(rename = "transactionHash")] - pub transaction_hash: H256, - /// transaction index - #[serde(rename = "transactionIndex", skip_serializing_if = "Option::is_none")] - pub transaction_index: Option, -} - -/// EIP-1559 transaction. -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Transaction1559Unsigned { - /// accessList - /// EIP-2930 access list - #[serde(rename = "accessList")] - pub access_list: AccessList, - /// chainId - /// Chain ID that this transaction is valid on. - #[serde(rename = "chainId")] - pub chain_id: U256, - /// gas limit - pub gas: U256, - /// gas price - /// The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward. - #[serde(rename = "gasPrice")] - pub gas_price: U256, - /// input data - pub input: Bytes, - /// max fee per gas - /// The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei - #[serde(rename = "maxFeePerGas")] - pub max_fee_per_gas: U256, - /// max priority fee per gas - /// Maximum fee per gas the sender is willing to pay to miners in wei - #[serde(rename = "maxPriorityFeePerGas")] - pub max_priority_fee_per_gas: U256, - /// nonce - pub nonce: U256, - /// to address - pub to: Option
, - /// type - pub r#type: Type2, - /// value - pub value: U256, -} - -/// EIP-2930 transaction. -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Transaction2930Unsigned { - /// accessList - /// EIP-2930 access list - #[serde(rename = "accessList")] - pub access_list: AccessList, - /// chainId - /// Chain ID that this transaction is valid on. - #[serde(rename = "chainId")] - pub chain_id: U256, - /// gas limit - pub gas: U256, - /// gas price - /// The gas price willing to be paid by the sender in wei - #[serde(rename = "gasPrice")] - pub gas_price: U256, - /// input data - pub input: Bytes, - /// nonce - pub nonce: U256, - /// to address - pub to: Option
, - /// type - pub r#type: Type1, - /// value - pub value: U256, -} - -/// EIP-4844 transaction. -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Transaction4844Unsigned { - /// accessList - /// EIP-2930 access list - #[serde(rename = "accessList")] - pub access_list: AccessList, - /// blobVersionedHashes - /// List of versioned blob hashes associated with the transaction's EIP-4844 data blobs. - #[serde(rename = "blobVersionedHashes")] - pub blob_versioned_hashes: Vec, - /// chainId - /// Chain ID that this transaction is valid on. - #[serde(rename = "chainId")] - pub chain_id: U256, - /// gas limit - pub gas: U256, - /// input data - pub input: Bytes, - /// max fee per blob gas - /// The maximum total fee per gas the sender is willing to pay for blob gas in wei - #[serde(rename = "maxFeePerBlobGas")] - pub max_fee_per_blob_gas: U256, - /// max fee per gas - /// The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei - #[serde(rename = "maxFeePerGas")] - pub max_fee_per_gas: U256, - /// max priority fee per gas - /// Maximum fee per gas the sender is willing to pay to miners in wei - #[serde(rename = "maxPriorityFeePerGas")] - pub max_priority_fee_per_gas: U256, - /// nonce - pub nonce: U256, - /// to address - pub to: Address, - /// type - pub r#type: Byte, - /// value - pub value: U256, -} - -/// Legacy transaction. -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct TransactionLegacyUnsigned { - /// chainId - /// Chain ID that this transaction is valid on. - #[serde(rename = "chainId", skip_serializing_if = "Option::is_none")] - pub chain_id: Option, - /// gas limit - pub gas: U256, - /// gas price - /// The gas price willing to be paid by the sender in wei - #[serde(rename = "gasPrice")] - pub gas_price: U256, - /// input data - pub input: Bytes, - /// nonce - pub nonce: U256, - /// to address - pub to: Option
, - /// type - pub r#type: Type0, - /// value - pub value: U256, -} - -#[derive( - Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq, -)] -#[serde(untagged)] -pub enum TransactionSigned { - Transaction4844Signed(Transaction4844Signed), - Transaction1559Signed(Transaction1559Signed), - Transaction2930Signed(Transaction2930Signed), - TransactionLegacySigned(TransactionLegacySigned), -} -impl Default for TransactionSigned { - fn default() -> Self { - TransactionSigned::Transaction4844Signed(Default::default()) - } -} - -/// Validator withdrawal -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Withdrawal { - /// recipient address for withdrawal value - pub address: Address, - /// value contained in withdrawal - pub amount: U256, - /// index of withdrawal - pub index: U256, - /// index of validator that generated withdrawal - #[serde(rename = "validatorIndex")] - pub validator_index: U256, -} - -/// Access list entry -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct AccessListEntry { - pub address: Address, - #[serde(rename = "storageKeys")] - pub storage_keys: Vec, -} - -/// Signed 1559 Transaction -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Transaction1559Signed { - #[serde(flatten)] - pub transaction_1559_unsigned: Transaction1559Unsigned, - /// r - pub r: U256, - /// s - pub s: U256, - /// v - /// For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`. - #[serde(skip_serializing_if = "Option::is_none")] - pub v: Option, - /// yParity - /// The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature. - #[serde(rename = "yParity", skip_serializing_if = "Option::is_none")] - pub y_parity: Option, -} - -/// Signed 2930 Transaction -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Transaction2930Signed { - #[serde(flatten)] - pub transaction_2930_unsigned: Transaction2930Unsigned, - /// r - pub r: U256, - /// s - pub s: U256, - /// v - /// For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`. - #[serde(skip_serializing_if = "Option::is_none")] - pub v: Option, - /// yParity - /// The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature. - #[serde(rename = "yParity")] - pub y_parity: U256, -} - -/// Signed 4844 Transaction -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct Transaction4844Signed { - #[serde(flatten)] - pub transaction_4844_unsigned: Transaction4844Unsigned, - /// r - pub r: U256, - /// s - pub s: U256, - /// yParity - /// The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature. - #[serde(rename = "yParity", skip_serializing_if = "Option::is_none")] - pub y_parity: Option, -} - -/// Signed Legacy Transaction -#[derive( - Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq, -)] -pub struct TransactionLegacySigned { - #[serde(flatten)] - pub transaction_legacy_unsigned: TransactionLegacyUnsigned, - /// r - pub r: U256, - /// s - pub s: U256, - /// v - pub v: U256, -} diff --git a/rpc/api/src/signature.rs b/rpc/api/src/signature.rs deleted file mode 100644 index e73bb71..0000000 --- a/rpc/api/src/signature.rs +++ /dev/null @@ -1,94 +0,0 @@ -//! Ethereum signature utilities -#![cfg(feature = "std")] -use crate::{TransactionLegacySigned, TransactionLegacyUnsigned, H160, U256}; -use polkadot_sdk::sp_core::keccak_256; -use rlp::Encodable; -use secp256k1::{ - ecdsa::{RecoverableSignature, RecoveryId}, - Message, PublicKey, Secp256k1, -}; - -impl TransactionLegacySigned { - /// Create a signed transaction from an [`TransactionLegacyUnsigned`] and a - /// [`RecoverableSignature`]. - pub fn from( - transaction_legacy_unsigned: TransactionLegacyUnsigned, - signature: RecoverableSignature, - ) -> TransactionLegacySigned { - let (recovery_id, sig) = signature.serialize_compact(); - let r = U256::from_big_endian(&sig[..32]); - let s = U256::from_big_endian(&sig[32..64]); - let v = transaction_legacy_unsigned - .chain_id - .map(|chain_id| chain_id * 2 + 35 + recovery_id.to_i32() as u32) - .unwrap_or_else(|| U256::from(27) + recovery_id.to_i32() as u32); - - TransactionLegacySigned { - transaction_legacy_unsigned, - r, - s, - v, - } - } - - /// Get the [`RecoverableSignature`] from the signed transaction. - fn recoverable_signature(&self) -> Result { - let mut s = [0u8; 64]; - self.r.to_big_endian(s[0..32].as_mut()); - self.s.to_big_endian(s[32..64].as_mut()); - RecoverableSignature::from_compact(&s[..], self.extract_recovery_id()?) - } - - /// Get the raw 65 bytes signature from the signed transaction. - pub fn raw_signature(&self) -> Result<[u8; 65], secp256k1::Error> { - let mut s = [0u8; 65]; - self.r.to_big_endian(s[0..32].as_mut()); - self.s.to_big_endian(s[32..64].as_mut()); - let recovery_id = self.extract_recovery_id()?.to_i32(); - s[64] = recovery_id as _; - Ok(s) - } - - /// Get the recovery ID from the signed transaction. - fn extract_recovery_id(&self) -> Result { - let recovery_id = if let Some(chain_id) = self.transaction_legacy_unsigned.chain_id { - self.v - chain_id * 2 - 35 - } else { - self.v - }; - - if self.v < i32::MAX.into() { - RecoveryId::from_i32(recovery_id.as_u32() as _) - } else { - Err(secp256k1::Error::InvalidRecoveryId) - } - } - - /// Recover the Ethereum address from the signed transaction. - pub fn recover_eth_address(&self) -> Result { - let pub_key = self.recover_pub_key()?; - pub_key_to_address(&pub_key) - } - - /// Recover the public key from the signed transaction. - fn recover_pub_key(&self) -> Result { - let sig = self.recoverable_signature()?; - let rlp_encoded = self.transaction_legacy_unsigned.rlp_bytes(); - let tx_hash = keccak_256(&rlp_encoded); - - let msg = Message::from_digest(tx_hash); - let secp = Secp256k1::new(); - secp.recover_ecdsa(&msg, &sig) - } -} - -/// Convert a public key to an Ethereum address. -fn pub_key_to_address(pub_key: &PublicKey) -> Result { - let pub_key = pub_key.serialize_uncompressed(); - if pub_key[0] != 0x04 { - return Err(secp256k1::Error::InvalidPublicKey); - } - - let hash = keccak_256(&pub_key[1..]); - Ok(H160::from_slice(&hash[12..])) -} diff --git a/rpc/api/src/type_id.rs b/rpc/api/src/type_id.rs deleted file mode 100644 index d9e8027..0000000 --- a/rpc/api/src/type_id.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! Ethereum Typed Transaction types -use parity_scale_codec::{Decode, Encode}; -use scale_info::TypeInfo; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -use crate::Byte; - -/// A macro to generate Transaction type identifiers -/// See -macro_rules! transaction_type { - ($name:ident, $value:literal) => { - #[doc = concat!("Transaction type identifier: ", $value)] - #[derive(Clone, Default, Debug, Eq, PartialEq)] - pub struct $name; - - impl $name { - /// Convert to Byte - pub fn as_byte(&self) -> Byte { - Byte::from($value) - } - } - - impl Encode for $name { - fn using_encoded R>(&self, f: F) -> R { - f(&[$value]) - } - } - impl Decode for $name { - fn decode( - input: &mut I, - ) -> Result { - if $value == input.read_byte()? { - Ok(Self {}) - } else { - Err(parity_scale_codec::Error::from(concat!( - "expected ", - $value - ))) - } - } - } - - impl TypeInfo for $name { - type Identity = u8; - fn type_info() -> scale_info::Type { - ::type_info() - } - } - - impl Serialize for $name { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_str(concat!("0x", $value)) - } - } - impl<'de> Deserialize<'de> for $name { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: &str = Deserialize::deserialize(deserializer)?; - if s == concat!("0x", $value) { - Ok($name {}) - } else { - Err(serde::de::Error::custom(concat!("expected ", $value))) - } - } - } - }; -} - -transaction_type!(Type0, 0); -transaction_type!(Type1, 1); -transaction_type!(Type2, 2); diff --git a/rpc/codegen/Cargo.toml b/rpc/codegen/Cargo.toml deleted file mode 100644 index 83741a2..0000000 --- a/rpc/codegen/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "eth-rpc-codegen" -version.workspace = true -edition.workspace = true - -[dependencies] -Inflector.workspace = true -indoc.workspace = true -lazy_static.workspace = true -serde = { workspace = true, features = ["derive"] } -serde_json.workspace = true -anyhow.workspace = true - -[dev-dependencies] -pretty_assertions.workspace = true - -[features] -default = ["std"] -std = ["serde/std", "serde_json/std"] diff --git a/rpc/codegen/README.md b/rpc/codegen/README.md deleted file mode 100644 index 2ca838f..0000000 --- a/rpc/codegen/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Generates the Ethereum JSON-RPC API from the official specification. - -- See -- See building instructions to re-generate the openrpc.json -- Include fixes from diff --git a/rpc/codegen/openrpc.json b/rpc/codegen/openrpc.json deleted file mode 100644 index a143699..0000000 --- a/rpc/codegen/openrpc.json +++ /dev/null @@ -1,2267 +0,0 @@ -{ - "openrpc": "1.2.4", - "info": { - "title": "Ethereum JSON-RPC Specification", - "description": "A specification of the standard interface for Ethereum clients.", - "license": { - "name": "CC0-1.0", - "url": "https://creativecommons.org/publicdomain/zero/1.0/legalcode" - }, - "version": "0.0.0" - }, - "methods": [ - { - "name": "eth_accounts", - "summary": "Returns a list of addresses owned by client.", - "params": [], - "result": { - "name": "Accounts", - "schema": { - "title": "Accounts", - "type": "array", - "items": { - "$ref": "#/components/schemas/address" - } - } - } - }, - { - "name": "eth_blobBaseFee", - "summary": "Returns the base fee per blob gas in wei.", - "params": [], - "result": { - "name": "Blob gas base fee", - "schema": { - "title": "Blob gas base fee", - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_blockNumber", - "summary": "Returns the number of most recent block.", - "params": [], - "result": { - "name": "Block number", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_call", - "summary": "Executes a new message call immediately without creating a transaction on the block chain.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/GenericTransaction" - } - }, - { - "name": "Block", - "required": false, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Return data", - "schema": { - "$ref": "#/components/schemas/bytes" - } - } - }, - { - "name": "eth_chainId", - "summary": "Returns the chain ID of the current network.", - "params": [], - "result": { - "name": "Chain ID", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_coinbase", - "summary": "Returns the client coinbase address.", - "params": [], - "result": { - "name": "Coinbase address", - "schema": { - "$ref": "#/components/schemas/address" - } - } - }, - { - "name": "eth_createAccessList", - "summary": "Generates an access list for a transaction.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/GenericTransaction" - } - }, - { - "name": "Block", - "required": false, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - } - ], - "result": { - "name": "Gas used", - "schema": { - "title": "Access list result", - "type": "object", - "additionalProperties": false, - "properties": { - "accessList": { - "title": "accessList", - "$ref": "#/components/schemas/AccessList" - }, - "error": { - "title": "error", - "type": "string" - }, - "gasUsed": { - "title": "Gas used", - "$ref": "#/components/schemas/uint" - } - } - } - } - }, - { - "name": "eth_estimateGas", - "summary": "Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/GenericTransaction" - } - }, - { - "name": "Block", - "required": false, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - } - ], - "result": { - "name": "Gas used", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_feeHistory", - "summary": "Transaction fee history", - "description": "Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range.", - "params": [ - { - "name": "blockCount", - "description": "Requested range of blocks. Clients will return less than the requested range if not all blocks are available.", - "required": true, - "schema": { - "$ref": "#/components/schemas/uint" - } - }, - { - "name": "newestBlock", - "description": "Highest block of the requested range.", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - }, - { - "name": "rewardPercentiles", - "description": "A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed.", - "required": true, - "schema": { - "title": "rewardPercentiles", - "type": "array", - "items": { - "title": "rewardPercentile", - "description": "Floating point value between 0 and 100.", - "type": "number" - } - } - } - ], - "result": { - "name": "feeHistoryResult", - "description": "Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.", - "schema": { - "title": "feeHistoryResults", - "description": "Fee history results.", - "type": "object", - "required": [ - "oldestBlock", - "baseFeePerGas", - "gasUsedRatio" - ], - "additionalProperties": false, - "properties": { - "oldestBlock": { - "title": "oldestBlock", - "description": "Lowest number block of returned range.", - "$ref": "#/components/schemas/uint" - }, - "baseFeePerGas": { - "title": "baseFeePerGasArray", - "description": "An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.", - "type": "array", - "items": { - "$ref": "#/components/schemas/uint" - } - }, - "baseFeePerBlobGas": { - "title": "baseFeePerBlobGasArray", - "description": "An array of block base fees per blob gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-4844 blocks.", - "type": "array", - "items": { - "$ref": "#/components/schemas/uint" - } - }, - "gasUsedRatio": { - "title": "gasUsedRatio", - "description": "An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ratio" - } - }, - "blobGasUsedRatio": { - "title": "blobGasUsedRatio", - "description": "An array of block blob gas used ratios. These are calculated as the ratio of blobGasUsed and the max blob gas per block.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ratio" - } - }, - "reward": { - "title": "rewardArray", - "description": "A two-dimensional array of effective priority fees per gas at the requested block percentiles.", - "type": "array", - "items": { - "title": "rewardPercentile", - "description": "An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.", - "type": "array", - "items": { - "title": "rewardPercentile", - "description": "A given percentile sample of effective priority fees per gas from a single block in ascending order, weighted by gas used. Zeroes are returned if the block is empty.", - "$ref": "#/components/schemas/uint" - } - } - } - } - } - } - }, - { - "name": "eth_gasPrice", - "summary": "Returns the current price per gas in wei.", - "params": [], - "result": { - "name": "Gas price", - "schema": { - "title": "Gas price", - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_getBalance", - "summary": "Returns the balance of the account of given address.", - "params": [ - { - "name": "Address", - "required": true, - "schema": { - "$ref": "#/components/schemas/address" - } - }, - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Balance", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_getBlockByHash", - "summary": "Returns information about a block by hash.", - "params": [ - { - "name": "Block hash", - "required": true, - "schema": { - "$ref": "#/components/schemas/hash32" - } - }, - { - "name": "Hydrated transactions", - "required": true, - "schema": { - "title": "hydrated", - "type": "boolean" - } - } - ], - "result": { - "name": "Block information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "$ref": "#/components/schemas/Block" - } - ] - } - } - }, - { - "name": "eth_getBlockByNumber", - "summary": "Returns information about a block by number.", - "params": [ - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - }, - { - "name": "Hydrated transactions", - "required": true, - "schema": { - "title": "hydrated", - "type": "boolean" - } - } - ], - "result": { - "name": "Block information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "$ref": "#/components/schemas/Block" - } - ] - } - } - }, - { - "name": "eth_getBlockReceipts", - "summary": "Returns the receipts of a block by number or hash.", - "params": [ - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Receipts information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "title": "Receipts information", - "type": "array", - "items": { - "$ref": "#/components/schemas/ReceiptInfo" - } - } - ] - } - } - }, - { - "name": "eth_getBlockTransactionCountByHash", - "summary": "Returns the number of transactions in a block from a block matching the given block hash.", - "params": [ - { - "name": "Block hash", - "schema": { - "$ref": "#/components/schemas/hash32" - } - } - ], - "result": { - "name": "Transaction count", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "title": "Transaction count", - "$ref": "#/components/schemas/uint" - } - ] - } - } - }, - { - "name": "eth_getBlockTransactionCountByNumber", - "summary": "Returns the number of transactions in a block matching the given block number.", - "params": [ - { - "name": "Block", - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - } - ], - "result": { - "name": "Transaction count", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "title": "Transaction count", - "$ref": "#/components/schemas/uint" - } - ] - } - } - }, - { - "name": "eth_getCode", - "summary": "Returns code at a given address.", - "params": [ - { - "name": "Address", - "required": true, - "schema": { - "$ref": "#/components/schemas/address" - } - }, - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Bytecode", - "schema": { - "$ref": "#/components/schemas/bytes" - } - } - }, - { - "name": "eth_getFilterChanges", - "summary": "Polling method for a filter, which returns an array of logs which occurred since last poll.", - "params": [ - { - "name": "Filter Identifier", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - ], - "result": { - "name": "Log objects", - "schema": { - "$ref": "#/components/schemas/FilterResults" - } - } - }, - { - "name": "eth_getFilterLogs", - "summary": "Returns an array of all logs matching filter with given id.", - "params": [ - { - "name": "Filter Identifier", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - ], - "result": { - "name": "Log objects", - "schema": { - "$ref": "#/components/schemas/FilterResults" - } - } - }, - { - "name": "eth_getLogs", - "summary": "Returns an array of all logs matching filter with given id.", - "params": [ - { - "name": "Filter", - "schema": { - "$ref": "#/components/schemas/Filter" - } - } - ], - "result": { - "name": "Log objects", - "schema": { - "$ref": "#/components/schemas/FilterResults" - } - } - }, - { - "name": "eth_getProof", - "summary": "Returns the merkle proof for a given account and optionally some storage keys.", - "params": [ - { - "name": "Address", - "required": true, - "schema": { - "$ref": "#/components/schemas/address" - } - }, - { - "name": "StorageKeys", - "required": true, - "schema": { - "title": "Storage keys", - "type": "array", - "items": { - "$ref": "#/components/schemas/bytesMax32" - } - } - }, - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Account", - "schema": { - "$ref": "#/components/schemas/AccountProof" - } - } - }, - { - "name": "eth_getStorageAt", - "summary": "Returns the value from a storage position at a given address.", - "params": [ - { - "name": "Address", - "required": true, - "schema": { - "$ref": "#/components/schemas/address" - } - }, - { - "name": "Storage slot", - "required": true, - "schema": { - "$ref": "#/components/schemas/uint256" - } - }, - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Value", - "schema": { - "$ref": "#/components/schemas/bytes" - } - } - }, - { - "name": "eth_getTransactionByBlockHashAndIndex", - "summary": "Returns information about a transaction by block hash and transaction index position.", - "params": [ - { - "name": "Block hash", - "required": true, - "schema": { - "$ref": "#/components/schemas/hash32" - } - }, - { - "name": "Transaction index", - "required": true, - "schema": { - "$ref": "#/components/schemas/uint" - } - } - ], - "result": { - "name": "Transaction information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "$ref": "#/components/schemas/TransactionInfo" - } - ] - } - } - }, - { - "name": "eth_getTransactionByBlockNumberAndIndex", - "summary": "Returns information about a transaction by block number and transaction index position.", - "params": [ - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - }, - { - "name": "Transaction index", - "required": true, - "schema": { - "$ref": "#/components/schemas/uint" - } - } - ], - "result": { - "name": "Transaction information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "$ref": "#/components/schemas/TransactionInfo" - } - ] - } - } - }, - { - "name": "eth_getTransactionByHash", - "summary": "Returns the information about a transaction requested by transaction hash.", - "params": [ - { - "name": "Transaction hash", - "required": true, - "schema": { - "$ref": "#/components/schemas/hash32" - } - } - ], - "result": { - "name": "Transaction information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "$ref": "#/components/schemas/TransactionInfo" - } - ] - } - } - }, - { - "name": "eth_getTransactionCount", - "summary": "Returns the number of transactions sent from an address.", - "params": [ - { - "name": "Address", - "required": true, - "schema": { - "$ref": "#/components/schemas/address" - } - }, - { - "name": "Block", - "required": true, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTagOrHash" - } - } - ], - "result": { - "name": "Transaction count", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_getTransactionReceipt", - "summary": "Returns the receipt of a transaction by transaction hash.", - "params": [ - { - "name": "Transaction hash", - "required": true, - "schema": { - "$ref": "#/components/schemas/hash32" - } - } - ], - "result": { - "name": "Receipt information", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "$ref": "#/components/schemas/ReceiptInfo" - } - ] - } - } - }, - { - "name": "eth_getUncleCountByBlockHash", - "summary": "Returns the number of uncles in a block from a block matching the given block hash.", - "params": [ - { - "name": "Block hash", - "schema": { - "$ref": "#/components/schemas/hash32" - } - } - ], - "result": { - "name": "Uncle count", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "title": "Uncle count", - "$ref": "#/components/schemas/uint" - } - ] - } - } - }, - { - "name": "eth_getUncleCountByBlockNumber", - "summary": "Returns the number of transactions in a block matching the given block number.", - "params": [ - { - "name": "Block", - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - } - ], - "result": { - "name": "Uncle count", - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/notFound" - }, - { - "title": "Uncle count", - "$ref": "#/components/schemas/uint" - } - ] - } - } - }, - { - "name": "eth_maxPriorityFeePerGas", - "summary": "Returns the current maxPriorityFeePerGas per gas in wei.", - "params": [], - "result": { - "name": "Max priority fee per gas", - "schema": { - "title": "Max priority fee per gas", - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_newBlockFilter", - "summary": "Creates a filter in the node, to notify when a new block arrives.", - "params": [], - "result": { - "name": "Filter Identifier", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_newFilter", - "summary": "Creates a filter object, based on filter options, to notify when the state changes (logs).", - "params": [ - { - "name": "Filter", - "schema": { - "$ref": "#/components/schemas/Filter" - } - } - ], - "result": { - "name": "Filter Identifier", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_newPendingTransactionFilter", - "summary": "Creates a filter in the node, to notify when new pending transactions arrive.", - "params": [], - "result": { - "name": "Filter Identifier", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - }, - { - "name": "eth_sendRawTransaction", - "summary": "Submits a raw transaction. For EIP-4844 transactions, the raw form must be the network form. This means it includes the blobs, KZG commitments, and KZG proofs.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/bytes" - } - } - ], - "result": { - "name": "Transaction hash", - "schema": { - "$ref": "#/components/schemas/hash32" - } - } - }, - { - "name": "eth_sendTransaction", - "summary": "Signs and submits a transaction.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/GenericTransaction" - } - } - ], - "result": { - "name": "Transaction hash", - "schema": { - "$ref": "#/components/schemas/hash32" - } - } - }, - { - "name": "eth_sign", - "summary": "Returns an EIP-191 signature over the provided data.", - "params": [ - { - "name": "Address", - "required": true, - "schema": { - "$ref": "#/components/schemas/address" - } - }, - { - "name": "Message", - "required": true, - "schema": { - "$ref": "#/components/schemas/bytes" - } - } - ], - "result": { - "name": "Signature", - "schema": { - "$ref": "#/components/schemas/bytes65" - } - } - }, - { - "name": "eth_signTransaction", - "summary": "Returns an RLP encoded transaction signed by the specified account.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/GenericTransaction" - } - } - ], - "result": { - "name": "Encoded transaction", - "schema": { - "$ref": "#/components/schemas/bytes" - } - } - }, - { - "name": "eth_syncing", - "summary": "Returns an object with data about the sync status or false.", - "params": [], - "result": { - "name": "Syncing status", - "schema": { - "$ref": "#/components/schemas/SyncingStatus" - } - } - }, - { - "name": "eth_uninstallFilter", - "summary": "Uninstalls a filter with given id.", - "params": [ - { - "name": "Filter Identifier", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - ], - "result": { - "name": "Success", - "schema": { - "type": "boolean" - } - } - } - ], - "components": { - "schemas": { - "address": { - "title": "hex encoded address", - "type": "string", - "pattern": "^0x[0-9a-fA-F]{40}$" - }, - "addresses": { - "title": "hex encoded address", - "type": "array", - "items": { - "$ref": "#/components/schemas/address" - } - }, - "byte": { - "title": "hex encoded byte", - "type": "string", - "pattern": "^0x([0-9a-fA-F]?){1,2}$" - }, - "bytes": { - "title": "hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]*$" - }, - "bytesMax32": { - "title": "32 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{0,64}$" - }, - "bytes8": { - "title": "8 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{16}$" - }, - "bytes32": { - "title": "32 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{64}$" - }, - "bytes48": { - "title": "48 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{96}$" - }, - "bytes96": { - "title": "96 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{192}$" - }, - "bytes256": { - "title": "256 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{512}$" - }, - "bytes65": { - "title": "65 hex encoded bytes", - "type": "string", - "pattern": "^0x[0-9a-f]{130}$" - }, - "ratio": { - "title": "normalized ratio", - "type": "number", - "minimum": 0, - "maximum": 1 - }, - "uint": { - "title": "hex encoded unsigned integer", - "type": "string", - "pattern": "^0x([1-9a-f]+[0-9a-f]*|0)$" - }, - "uint64": { - "title": "hex encoded 64 bit unsigned integer", - "type": "string", - "pattern": "^0x([1-9a-f]+[0-9a-f]{0,15})|0$" - }, - "uint256": { - "title": "hex encoded 256 bit unsigned integer", - "type": "string", - "pattern": "^0x([1-9a-f]+[0-9a-f]{0,31})|0$" - }, - "hash32": { - "title": "32 byte hex value", - "type": "string", - "pattern": "^0x[0-9a-f]{64}$" - }, - "notFound": { - "title": "Not Found (null)", - "type": "null" - }, - "Block": { - "title": "Block object", - "type": "object", - "required": [ - "hash", - "parentHash", - "sha3Uncles", - "miner", - "stateRoot", - "transactionsRoot", - "receiptsRoot", - "logsBloom", - "number", - "gasLimit", - "gasUsed", - "timestamp", - "extraData", - "mixHash", - "nonce", - "size", - "transactions", - "uncles" - ], - "additionalProperties": false, - "properties": { - "hash": { - "title": "Hash", - "$ref": "#/components/schemas/hash32" - }, - "parentHash": { - "title": "Parent block hash", - "$ref": "#/components/schemas/hash32" - }, - "sha3Uncles": { - "title": "Ommers hash", - "$ref": "#/components/schemas/hash32" - }, - "miner": { - "title": "Coinbase", - "$ref": "#/components/schemas/address" - }, - "stateRoot": { - "title": "State root", - "$ref": "#/components/schemas/hash32" - }, - "transactionsRoot": { - "title": "Transactions root", - "$ref": "#/components/schemas/hash32" - }, - "receiptsRoot": { - "title": "Receipts root", - "$ref": "#/components/schemas/hash32" - }, - "logsBloom": { - "title": "Bloom filter", - "$ref": "#/components/schemas/bytes256" - }, - "difficulty": { - "title": "Difficulty", - "$ref": "#/components/schemas/uint" - }, - "number": { - "title": "Number", - "$ref": "#/components/schemas/uint" - }, - "gasLimit": { - "title": "Gas limit", - "$ref": "#/components/schemas/uint" - }, - "gasUsed": { - "title": "Gas used", - "$ref": "#/components/schemas/uint" - }, - "timestamp": { - "title": "Timestamp", - "$ref": "#/components/schemas/uint" - }, - "extraData": { - "title": "Extra data", - "$ref": "#/components/schemas/bytes" - }, - "mixHash": { - "title": "Mix hash", - "$ref": "#/components/schemas/hash32" - }, - "nonce": { - "title": "Nonce", - "$ref": "#/components/schemas/bytes8" - }, - "totalDifficulty": { - "title": "Total difficulty", - "$ref": "#/components/schemas/uint" - }, - "baseFeePerGas": { - "title": "Base fee per gas", - "$ref": "#/components/schemas/uint" - }, - "withdrawalsRoot": { - "title": "Withdrawals root", - "$ref": "#/components/schemas/hash32" - }, - "blobGasUsed": { - "title": "Blob gas used", - "$ref": "#/components/schemas/uint" - }, - "excessBlobGas": { - "title": "Excess blob gas", - "$ref": "#/components/schemas/uint" - }, - "parentBeaconBlockRoot": { - "title": "Parent Beacon Block Root", - "$ref": "#/components/schemas/hash32" - }, - "size": { - "title": "Block size", - "$ref": "#/components/schemas/uint" - }, - "transactions": { - "anyOf": [ - { - "title": "Transaction hashes", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - }, - { - "title": "Full transactions", - "type": "array", - "items": { - "$ref": "#/components/schemas/TransactionInfo" - } - } - ] - }, - "withdrawals": { - "title": "Withdrawals", - "type": "array", - "items": { - "$ref": "#/components/schemas/Withdrawal" - } - }, - "uncles": { - "title": "Uncles", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - } - } - }, - "BlockTag": { - "title": "Block tag", - "type": "string", - "enum": [ - "earliest", - "finalized", - "safe", - "latest", - "pending" - ], - "description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error" - }, - "BlockNumberOrTag": { - "title": "Block number or tag", - "oneOf": [ - { - "title": "Block number", - "$ref": "#/components/schemas/uint" - }, - { - "title": "Block tag", - "$ref": "#/components/schemas/BlockTag" - } - ] - }, - "BlockNumberOrTagOrHash": { - "title": "Block number, tag, or block hash", - "anyOf": [ - { - "title": "Block number", - "$ref": "#/components/schemas/uint" - }, - { - "title": "Block tag", - "$ref": "#/components/schemas/BlockTag" - }, - { - "title": "Block hash", - "$ref": "#/components/schemas/hash32" - } - ] - }, - "BadBlock": { - "title": "Bad block", - "type": "object", - "required": [ - "block", - "hash", - "rlp" - ], - "additionalProperties": false, - "properties": { - "block": { - "title": "Block", - "$ref": "#/components/schemas/Block" - }, - "hash": { - "title": "Hash", - "$ref": "#/components/schemas/hash32" - }, - "rlp": { - "title": "RLP", - "$ref": "#/components/schemas/bytes" - } - } - }, - "SyncingStatus": { - "title": "Syncing status", - "oneOf": [ - { - "title": "Syncing progress", - "type": "object", - "additionalProperties": false, - "properties": { - "startingBlock": { - "title": "Starting block", - "$ref": "#/components/schemas/uint" - }, - "currentBlock": { - "title": "Current block", - "$ref": "#/components/schemas/uint" - }, - "highestBlock": { - "title": "Highest block", - "$ref": "#/components/schemas/uint" - } - } - }, - { - "title": "Not syncing", - "description": "Should always return false if not syncing.", - "type": "boolean" - } - ] - }, - "FilterResults": { - "title": "Filter results", - "oneOf": [ - { - "title": "new block or transaction hashes", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - }, - { - "title": "new logs", - "type": "array", - "items": { - "$ref": "#/components/schemas/Log" - } - } - ] - }, - "Filter": { - "title": "filter", - "type": "object", - "additionalProperties": false, - "properties": { - "fromBlock": { - "title": "from block", - "$ref": "#/components/schemas/uint" - }, - "toBlock": { - "title": "to block", - "$ref": "#/components/schemas/uint" - }, - "address": { - "title": "Address(es)", - "oneOf": [ - { - "title": "Any Address", - "type": "null" - }, - { - "title": "Address", - "$ref": "#/components/schemas/address" - }, - { - "title": "Addresses", - "$ref": "#/components/schemas/addresses" - } - ] - }, - "topics": { - "title": "Topics", - "$ref": "#/components/schemas/FilterTopics" - } - } - }, - "FilterTopics": { - "title": "Filter Topics", - "oneOf": [ - { - "title": "Any Topic Match", - "type": "null" - }, - { - "title": "Specified Filter Topics", - "type": "array", - "items": { - "$ref": "#/components/schemas/FilterTopic" - } - } - ] - }, - "FilterTopic": { - "title": "Filter Topic List Entry", - "oneOf": [ - { - "title": "Single Topic Match", - "$ref": "#/components/schemas/bytes32" - }, - { - "title": "Multiple Topic Match", - "type": "array", - "items": { - "$ref": "#/components/schemas/bytes32" - } - } - ] - }, - "Log": { - "title": "log", - "type": "object", - "required": [ - "transactionHash" - ], - "additionalProperties": false, - "properties": { - "removed": { - "title": "removed", - "type": "boolean" - }, - "logIndex": { - "title": "log index", - "$ref": "#/components/schemas/uint" - }, - "transactionIndex": { - "title": "transaction index", - "$ref": "#/components/schemas/uint" - }, - "transactionHash": { - "title": "transaction hash", - "$ref": "#/components/schemas/hash32" - }, - "blockHash": { - "title": "block hash", - "$ref": "#/components/schemas/hash32" - }, - "blockNumber": { - "title": "block number", - "$ref": "#/components/schemas/uint" - }, - "address": { - "title": "address", - "$ref": "#/components/schemas/address" - }, - "data": { - "title": "data", - "$ref": "#/components/schemas/bytes" - }, - "topics": { - "title": "topics", - "type": "array", - "items": { - "$ref": "#/components/schemas/bytes32" - } - } - } - }, - "ReceiptInfo": { - "type": "object", - "title": "Receipt information", - "required": [ - "blockHash", - "blockNumber", - "from", - "cumulativeGasUsed", - "gasUsed", - "logs", - "logsBloom", - "transactionHash", - "transactionIndex", - "effectiveGasPrice" - ], - "additionalProperties": false, - "properties": { - "type": { - "title": "type", - "$ref": "#/components/schemas/byte" - }, - "transactionHash": { - "title": "transaction hash", - "$ref": "#/components/schemas/hash32" - }, - "transactionIndex": { - "title": "transaction index", - "$ref": "#/components/schemas/uint" - }, - "blockHash": { - "title": "block hash", - "$ref": "#/components/schemas/hash32" - }, - "blockNumber": { - "title": "block number", - "$ref": "#/components/schemas/uint" - }, - "from": { - "title": "from", - "$ref": "#/components/schemas/address" - }, - "to": { - "title": "to", - "description": "Address of the receiver or null in a contract creation transaction.", - "oneOf": [ - { - "title": "Contract Creation (null)", - "type": "null" - }, - { - "title": "Recipient Address", - "$ref": "#/components/schemas/address" - } - ] - }, - "cumulativeGasUsed": { - "title": "cumulative gas used", - "description": "The sum of gas used by this transaction and all preceding transactions in the same block.", - "$ref": "#/components/schemas/uint" - }, - "gasUsed": { - "title": "gas used", - "description": "The amount of gas used for this specific transaction alone.", - "$ref": "#/components/schemas/uint" - }, - "blobGasUsed": { - "title": "blob gas used", - "description": "The amount of blob gas used for this specific transaction. Only specified for blob transactions as defined by EIP-4844.", - "$ref": "#/components/schemas/uint" - }, - "contractAddress": { - "title": "contract address", - "description": "The contract address created, if the transaction was a contract creation, otherwise null.", - "oneOf": [ - { - "$ref": "#/components/schemas/address" - }, - { - "title": "Null", - "type": "null" - } - ] - }, - "logs": { - "title": "logs", - "type": "array", - "items": { - "$ref": "#/components/schemas/Log" - } - }, - "logsBloom": { - "title": "logs bloom", - "$ref": "#/components/schemas/bytes256" - }, - "root": { - "title": "state root", - "description": "The post-transaction state root. Only specified for transactions included before the Byzantium upgrade.", - "$ref": "#/components/schemas/hash32" - }, - "status": { - "title": "status", - "description": "Either 1 (success) or 0 (failure). Only specified for transactions included after the Byzantium upgrade.", - "$ref": "#/components/schemas/uint" - }, - "effectiveGasPrice": { - "title": "effective gas price", - "description": "The actual value per gas deducted from the sender's account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas).", - "$ref": "#/components/schemas/uint" - }, - "blobGasPrice": { - "title": "blob gas price", - "description": "The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844.", - "$ref": "#/components/schemas/uint" - } - } - }, - "AccountProof": { - "title": "Account proof", - "type": "object", - "required": [ - "address", - "accountProof", - "balance", - "codeHash", - "nonce", - "storageHash", - "storageProof" - ], - "additionalProperties": false, - "properties": { - "address": { - "title": "address", - "$ref": "#/components/schemas/address" - }, - "accountProof": { - "title": "accountProof", - "type": "array", - "items": { - "$ref": "#/components/schemas/bytes" - } - }, - "balance": { - "title": "balance", - "$ref": "#/components/schemas/uint256" - }, - "codeHash": { - "title": "codeHash", - "$ref": "#/components/schemas/hash32" - }, - "nonce": { - "title": "nonce", - "$ref": "#/components/schemas/uint64" - }, - "storageHash": { - "title": "storageHash", - "$ref": "#/components/schemas/hash32" - }, - "storageProof": { - "title": "Storage proofs", - "type": "array", - "items": { - "$ref": "#/components/schemas/StorageProof" - } - } - } - }, - "StorageProof": { - "title": "Storage proof", - "type": "object", - "required": [ - "key", - "value", - "proof" - ], - "additionalProperties": false, - "properties": { - "key": { - "title": "key", - "$ref": "#/components/schemas/bytesMax32" - }, - "value": { - "title": "value", - "$ref": "#/components/schemas/uint256" - }, - "proof": { - "title": "proof", - "type": "array", - "items": { - "$ref": "#/components/schemas/bytes" - } - } - } - }, - "Transaction4844Unsigned": { - "type": "object", - "title": "EIP-4844 transaction.", - "required": [ - "type", - "nonce", - "to", - "gas", - "value", - "input", - "maxPriorityFeePerGas", - "maxFeePerGas", - "maxFeePerBlobGas", - "accessList", - "blobVersionedHashes", - "chainId" - ], - "properties": { - "type": { - "title": "type", - "$ref": "#/components/schemas/byte" - }, - "nonce": { - "title": "nonce", - "$ref": "#/components/schemas/uint" - }, - "to": { - "title": "to address", - "$ref": "#/components/schemas/address" - }, - "gas": { - "title": "gas limit", - "$ref": "#/components/schemas/uint" - }, - "value": { - "title": "value", - "$ref": "#/components/schemas/uint" - }, - "input": { - "title": "input data", - "$ref": "#/components/schemas/bytes" - }, - "maxPriorityFeePerGas": { - "title": "max priority fee per gas", - "description": "Maximum fee per gas the sender is willing to pay to miners in wei", - "$ref": "#/components/schemas/uint" - }, - "maxFeePerGas": { - "title": "max fee per gas", - "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei", - "$ref": "#/components/schemas/uint" - }, - "maxFeePerBlobGas": { - "title": "max fee per blob gas", - "description": "The maximum total fee per gas the sender is willing to pay for blob gas in wei", - "$ref": "#/components/schemas/uint" - }, - "accessList": { - "title": "accessList", - "description": "EIP-2930 access list", - "$ref": "#/components/schemas/AccessList" - }, - "blobVersionedHashes": { - "title": "blobVersionedHashes", - "description": "List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - }, - "chainId": { - "title": "chainId", - "description": "Chain ID that this transaction is valid on.", - "$ref": "#/components/schemas/uint" - } - } - }, - "AccessListEntry": { - "title": "Access list entry", - "type": "object", - "additionalProperties": false, - "required": [ "address", "storageKeys" ], - "properties": { - "address": { - "$ref": "#/components/schemas/address" - }, - "storageKeys": { - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - } - } - }, - "AccessList": { - "title": "Access list", - "type": "array", - "items": { - "$ref": "#/components/schemas/AccessListEntry" - } - }, - "Transaction1559Unsigned": { - "type": "object", - "title": "EIP-1559 transaction.", - "required": [ - "type", - "nonce", - "gas", - "value", - "input", - "maxFeePerGas", - "maxPriorityFeePerGas", - "gasPrice", - "chainId", - "accessList" - ], - "properties": { - "type": { - "title": "type", - "type": "string", - "pattern": "^0x2$" - }, - "nonce": { - "title": "nonce", - "$ref": "#/components/schemas/uint" - }, - "to": { - "title": "to address", - "oneOf": [ - { - "title": "Contract Creation (null)", - "type": "null" - }, - { - "title": "Address", - "$ref": "#/components/schemas/address" - } - ] - }, - "gas": { - "title": "gas limit", - "$ref": "#/components/schemas/uint" - }, - "value": { - "title": "value", - "$ref": "#/components/schemas/uint" - }, - "input": { - "title": "input data", - "$ref": "#/components/schemas/bytes" - }, - "maxPriorityFeePerGas": { - "title": "max priority fee per gas", - "description": "Maximum fee per gas the sender is willing to pay to miners in wei", - "$ref": "#/components/schemas/uint" - }, - "maxFeePerGas": { - "title": "max fee per gas", - "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei", - "$ref": "#/components/schemas/uint" - }, - "gasPrice": { - "title": "gas price", - "description": "The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward.", - "$ref": "#/components/schemas/uint" - }, - "accessList": { - "title": "accessList", - "description": "EIP-2930 access list", - "$ref": "#/components/schemas/AccessList" - }, - "chainId": { - "title": "chainId", - "description": "Chain ID that this transaction is valid on.", - "$ref": "#/components/schemas/uint" - } - } - }, - "Transaction2930Unsigned": { - "type": "object", - "title": "EIP-2930 transaction.", - "required": [ - "type", - "nonce", - "gas", - "value", - "input", - "gasPrice", - "chainId", - "accessList" - ], - "properties": { - "type": { - "title": "type", - "type": "string", - "pattern": "^0x1$" - }, - "nonce": { - "title": "nonce", - "$ref": "#/components/schemas/uint" - }, - "to": { - "title": "to address", - "oneOf": [ - { - "title": "Contract Creation (null)", - "type": "null" - }, - { - "title": "Address", - "$ref": "#/components/schemas/address" - } - ] - }, - "gas": { - "title": "gas limit", - "$ref": "#/components/schemas/uint" - }, - "value": { - "title": "value", - "$ref": "#/components/schemas/uint" - }, - "input": { - "title": "input data", - "$ref": "#/components/schemas/bytes" - }, - "gasPrice": { - "title": "gas price", - "description": "The gas price willing to be paid by the sender in wei", - "$ref": "#/components/schemas/uint" - }, - "accessList": { - "title": "accessList", - "description": "EIP-2930 access list", - "$ref": "#/components/schemas/AccessList" - }, - "chainId": { - "title": "chainId", - "description": "Chain ID that this transaction is valid on.", - "$ref": "#/components/schemas/uint" - } - } - }, - "TransactionLegacyUnsigned": { - "type": "object", - "title": "Legacy transaction.", - "required": [ - "type", - "nonce", - "gas", - "value", - "input", - "gasPrice" - ], - "properties": { - "type": { - "title": "type", - "type": "string", - "pattern": "^0x0$" - }, - "nonce": { - "title": "nonce", - "$ref": "#/components/schemas/uint" - }, - "to": { - "title": "to address", - "oneOf": [ - { - "title": "Contract Creation (null)", - "type": "null" - }, - { - "title": "Address", - "$ref": "#/components/schemas/address" - } - ] - }, - "gas": { - "title": "gas limit", - "$ref": "#/components/schemas/uint" - }, - "value": { - "title": "value", - "$ref": "#/components/schemas/uint" - }, - "input": { - "title": "input data", - "$ref": "#/components/schemas/bytes" - }, - "gasPrice": { - "title": "gas price", - "description": "The gas price willing to be paid by the sender in wei", - "$ref": "#/components/schemas/uint" - }, - "chainId": { - "title": "chainId", - "description": "Chain ID that this transaction is valid on.", - "$ref": "#/components/schemas/uint" - } - } - }, - "TransactionUnsigned": { - "oneOf": [ - { - "$ref": "#/components/schemas/Transaction4844Unsigned" - }, - { - "$ref": "#/components/schemas/Transaction1559Unsigned" - }, - { - "$ref": "#/components/schemas/Transaction2930Unsigned" - }, - { - "$ref": "#/components/schemas/TransactionLegacyUnsigned" - } - ] - }, - "Transaction4844Signed": { - "title": "Signed 4844 Transaction", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/Transaction4844Unsigned" - }, - { - "title": "EIP-4844 transaction signature properties.", - "required": [ - "r", - "s" - ], - "properties": { - "yParity": { - "title": "yParity", - "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.", - "$ref": "#/components/schemas/uint" - }, - "r": { - "title": "r", - "$ref": "#/components/schemas/uint" - }, - "s": { - "title": "s", - "$ref": "#/components/schemas/uint" - } - } - } - ] - }, - "Transaction1559Signed": { - "title": "Signed 1559 Transaction", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/Transaction1559Unsigned" - }, - { - "title": "EIP-1559 transaction signature properties.", - "required": [ - "r", - "s" - ], - "properties": { - "yParity": { - "title": "yParity", - "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.", - "$ref": "#/components/schemas/uint" - }, - "v": { - "title": "v", - "description": "For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.", - "$ref": "#/components/schemas/uint" - }, - "r": { - "title": "r", - "$ref": "#/components/schemas/uint" - }, - "s": { - "title": "s", - "$ref": "#/components/schemas/uint" - } - } - } - ] - }, - "Transaction2930Signed": { - "title": "Signed 2930 Transaction", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/Transaction2930Unsigned" - }, - { - "title": "EIP-2930 transaction signature properties.", - "required": [ - "yParity", - "r", - "s" - ], - "properties": { - "yParity": { - "title": "yParity", - "description": "The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.", - "$ref": "#/components/schemas/uint" - }, - "v": { - "title": "v", - "description": "For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.", - "$ref": "#/components/schemas/uint" - }, - "r": { - "title": "r", - "$ref": "#/components/schemas/uint" - }, - "s": { - "title": "s", - "$ref": "#/components/schemas/uint" - } - } - } - ] - }, - "TransactionLegacySigned": { - "title": "Signed Legacy Transaction", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/TransactionLegacyUnsigned" - }, - { - "title": "Legacy transaction signature properties.", - "required": [ - "v", - "r", - "s" - ], - "properties": { - "v": { - "title": "v", - "$ref": "#/components/schemas/uint" - }, - "r": { - "title": "r", - "$ref": "#/components/schemas/uint" - }, - "s": { - "title": "s", - "$ref": "#/components/schemas/uint" - } - } - } - ] - }, - "TransactionSigned": { - "oneOf": [ - { - "$ref": "#/components/schemas/Transaction4844Signed" - }, - { - "$ref": "#/components/schemas/Transaction1559Signed" - }, - { - "$ref": "#/components/schemas/Transaction2930Signed" - }, - { - "$ref": "#/components/schemas/TransactionLegacySigned" - } - ] - }, - "TransactionInfo": { - "type": "object", - "title": "Transaction information", - "allOf": [ - { - "title": "Contextual information", - "required": [ - "blockHash", - "blockNumber", - "from", - "hash", - "transactionIndex" - ], - "unevaluatedProperties": false, - "properties": { - "blockHash": { - "title": "block hash", - "$ref": "#/components/schemas/hash32" - }, - "blockNumber": { - "title": "block number", - "$ref": "#/components/schemas/uint" - }, - "from": { - "title": "from address", - "$ref": "#/components/schemas/address" - }, - "hash": { - "title": "transaction hash", - "$ref": "#/components/schemas/hash32" - }, - "transactionIndex": { - "title": "transaction index", - "$ref": "#/components/schemas/uint" - } - } - }, - { - "$ref": "#/components/schemas/TransactionSigned" - } - ] - }, - "GenericTransaction": { - "type": "object", - "title": "Transaction object generic to all types", - "additionalProperties": false, - "properties": { - "type": { - "title": "type", - "$ref": "#/components/schemas/byte" - }, - "nonce": { - "title": "nonce", - "$ref": "#/components/schemas/uint" - }, - "to": { - "title": "to address", - "oneOf": [ - { - "title": "Contract Creation (null)", - "type": "null" - }, - { - "title": "Address", - "$ref": "#/components/schemas/address" - } - ] - }, - "from": { - "title": "from address", - "$ref": "#/components/schemas/address" - }, - "gas": { - "title": "gas limit", - "$ref": "#/components/schemas/uint" - }, - "value": { - "title": "value", - "$ref": "#/components/schemas/uint" - }, - "input": { - "title": "input data", - "$ref": "#/components/schemas/bytes" - }, - "gasPrice": { - "title": "gas price", - "description": "The gas price willing to be paid by the sender in wei", - "$ref": "#/components/schemas/uint" - }, - "maxPriorityFeePerGas": { - "title": "max priority fee per gas", - "description": "Maximum fee per gas the sender is willing to pay to miners in wei", - "$ref": "#/components/schemas/uint" - }, - "maxFeePerGas": { - "title": "max fee per gas", - "description": "The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei", - "$ref": "#/components/schemas/uint" - }, - "maxFeePerBlobGas": { - "title": "max fee per blob gas", - "description": "The maximum total fee per gas the sender is willing to pay for blob gas in wei", - "$ref": "#/components/schemas/uint" - }, - "accessList": { - "title": "accessList", - "description": "EIP-2930 access list", - "$ref": "#/components/schemas/AccessList" - }, - "blobVersionedHashes": { - "title": "blobVersionedHashes", - "description": "List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.", - "type": "array", - "items": { - "$ref": "#/components/schemas/hash32" - } - }, - "blobs": { - "title": "blobs", - "description": "Raw blob data.", - "type": "array", - "items": { - "$ref": "#/components/schemas/bytes" - } - }, - "chainId": { - "title": "chainId", - "description": "Chain ID that this transaction is valid on.", - "$ref": "#/components/schemas/uint" - } - } - }, - "Withdrawal": { - "type": "object", - "title": "Validator withdrawal", - "required": [ - "index", - "validatorIndex", - "address", - "amount" - ], - "additionalProperties": false, - "properties": { - "index": { - "title": "index of withdrawal", - "$ref": "#/components/schemas/uint64" - }, - "validatorIndex": { - "title": "index of validator that generated withdrawal", - "$ref": "#/components/schemas/uint64" - }, - "address": { - "title": "recipient address for withdrawal value", - "$ref": "#/components/schemas/address" - }, - "amount": { - "title": "value contained in withdrawal", - "$ref": "#/components/schemas/uint256" - } - } - } - } - } -} diff --git a/rpc/codegen/src/generator.rs b/rpc/codegen/src/generator.rs deleted file mode 100644 index c550446..0000000 --- a/rpc/codegen/src/generator.rs +++ /dev/null @@ -1,730 +0,0 @@ -use indoc::indoc; -use inflector::Inflector; -use std::{ - collections::{BTreeMap, HashMap, HashSet}, - mem, -}; - -use crate::{ - open_rpc::*, - printer::{ - doc_str_from_schema, Fields, Required, TypeContent, TypeInfo, TypeNameProvider, - TypePrinter, Variants, - }, - writeln, -}; - -lazy_static! { - /// List of supported Ethereum RPC methods we want to generate. - static ref SUPPORTED_ETH_METHODS: Vec<&'static str> = vec![ - "net_version", - "eth_accounts", - "eth_blockNumber", - "eth_call", - "eth_chainId", - "eth_estimateGas", - "eth_gasPrice", - "eth_getBalance", - "eth_getBlockByHash", - "eth_getBlockByNumber", - "eth_getBlockTransactionCountByHash", - "eth_getBlockTransactionCountByNumber", - "eth_getCode", - "eth_getStorageAt", - "eth_getTransactionByBlockHashAndIndex", - "eth_getTransactionByBlockNumberAndIndex", - "eth_getTransactionByHash", - "eth_getTransactionCount", - "eth_getTransactionReceipt", - "eth_sendRawTransaction", - ]; - - /// Mapping of primitive schema types to their Rust counterparts. - pub static ref PRIMITIVE_MAPPINGS: HashMap<&'static str, &'static str> = HashMap::from([ - ("#/components/schemas/address", "Address"), - ("#/components/schemas/byte", "Byte"), - - ("#/components/schemas/bytes", "Bytes"), - ("#/components/schemas/bytes256", "Bytes256"), - ("#/components/schemas/hash32", "H256"), - ("#/components/schemas/bytes32", "H256"), - ("#/components/schemas/bytes8", "String"), - ("#/components/schemas/uint", "U256"), - ("#/components/schemas/uint256", "U256"), - ("#/components/schemas/uint64", "U256"), - ]); - - - /// Mapping of legacy aliases to their new names. - pub static ref LEGACY_ALIASES: HashMap<&'static str, HashMap<&'static str, &'static str>> = HashMap::from([ - // We accept "data" and "input" for backwards-compatibility reasons. - // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 - ("#/components/schemas/GenericTransaction", HashMap::from([("input", "data")])), - ]); -} - -/// Read the OpenRPC specs, and inject extra methods and legacy aliases. -pub fn read_specs() -> anyhow::Result { - let content = include_str!("../openrpc.json"); - let mut specs: OpenRpc = serde_json::from_str(content)?; - - // Inject legacy aliases. - inject_legacy_aliases(&mut specs); - - // Inject extra methods. - specs.methods.push(RefOr::Inline(Method { - name: "net_version".to_string(), - summary: Some("The string value of current network id".to_string()), - result: Some(RefOr::Reference { - reference: "String".to_string(), - }), - ..Default::default() - })); - - Ok(specs) -} - -// Inject legacy aliases declared by [`LEGACY_ALIASES`]. -pub fn inject_legacy_aliases(specs: &mut OpenRpc) { - for (alias, mapping) in LEGACY_ALIASES.iter() { - let schema = specs.get_schema_mut(alias).unwrap(); - match &mut schema.contents { - SchemaContents::Object(o) | SchemaContents::Literal(Literal::Object(o)) => { - o.legacy_aliases = mapping - .iter() - .map(|(k, v)| (k.to_string(), v.to_string())) - .collect(); - } - _ => { - panic!( - "Alias should be an object got {:?} instead", - schema.contents - ); - } - } - } -} - -/// Type generator for generating RPC methods and types. -#[derive(Default)] -pub struct TypeGenerator { - /// List of collected types, that are not yet generated. - collected: BTreeMap, - /// List of already generated types. - generated: HashSet, - /// List of filtered method names, we want to generate. - filtered_method_names: HashSet, - /// Stripped prefix for the generated method names. - prefix: String, -} - -/// Reference or schema -pub enum ReferenceOrSchema { - // A reference to a schema such as `#/components/schemas/Foo`. - Reference(String), - // A schema definition. - Schema(Schema), -} - -impl ReferenceOrSchema { - /// Return the schema for the reference or the schema itself. - fn schema<'a>(&'a self, specs: &'a OpenRpc) -> &'a Schema { - match self { - Self::Schema(schema) => schema, - Self::Reference(reference) => specs.get_schema(reference).unwrap(), - } - } -} - -impl TypeGenerator { - /// Create a new type generator. - pub fn new() -> Self { - let mut generated = - HashSet::from_iter(["notFound"].into_iter().map(|name| name.to_pascal_case())); - - generated.extend( - PRIMITIVE_MAPPINGS - .keys() - .map(|name| reference_to_name(name)), - ); - generated.extend(PRIMITIVE_MAPPINGS.values().map(|name| name.to_string())); - let filtered_method_names = SUPPORTED_ETH_METHODS - .iter() - .map(|name| name.to_string()) - .collect(); - - Self { - collected: Default::default(), - filtered_method_names, - generated, - prefix: "eth".to_string(), - } - } - - /// Generate the RPC method, and add the collected types. - pub fn generate_rpc_methods(&mut self, specs: &OpenRpc) -> String { - let methods = specs - .methods - .iter() - .map(RefOr::unwrap_inline) - .filter(|method| self.filtered_method_names.contains(&method.name)) - .collect::>(); - - if methods.len() != self.filtered_method_names.len() { - let available = methods - .iter() - .map(|method| method.name.clone()) - .collect::>(); - let missing = self - .filtered_method_names - .difference(&available) - .collect::>(); - panic!("Missing methods: {missing:?}"); - } - - let mut code = indoc! {r###" - //! Generated JSON-RPC methods. - #![allow(missing_docs)] - - use crate::*; - use jsonrpsee::core::RpcResult; - use jsonrpsee::proc_macros::rpc; - - #[rpc(server, client)] - pub trait EthRpc { - - "###} - .to_string(); - - for method in methods { - self.generate_rpc_method(&mut code, method); - code.push('\n'); - } - code.push('}'); - code.push('\n'); - code - } - - pub fn collect_extra_type(&mut self, type_name: &str) { - self.collect( - type_name, - ReferenceOrSchema::Reference(format!("#/components/schemas/{}", type_name)), - ); - } - - /// Recursively collect the types and generate them. - /// - /// Note: This should be called after [`TypeGenerator::generate_rpc_methods`] to collect the types used in the - /// RPC methods. - pub fn generate_types(&mut self, specs: &OpenRpc) -> String { - let mut code = indoc! {r###" - //! Generated JSON-RPC types. - #![allow(missing_docs)] - - use crate::byte::*; - use derive_more::{From, TryInto}; - use crate::{Type0, Type1, Type2}; - pub use ethereum_types::*; - use polkadot_sdk::polkadot_sdk_frame::derive::{Decode, Encode, TypeInfo}; - use serde::{Deserialize, Serialize}; - - #[cfg(not(feature = "std"))] - use alloc::{string::String, vec::Vec}; - - "###} - .to_string(); - loop { - let collected = mem::take(&mut self.collected); - self.generated.extend(collected.keys().cloned()); - - if collected.is_empty() { - break; - } - - for (name, ref_or_schema) in collected { - let r#type = self.generate_type(name, ref_or_schema.schema(specs)); - r#type.print(&mut code); - code.push('\n'); - } - } - - code - } - - /// Return the type printer for the given schema. - fn generate_type(&mut self, name: String, schema: &Schema) -> TypePrinter { - let doc = doc_str_from_schema(schema); - - let content = match &schema.contents { - &SchemaContents::Literal(Literal::Object(ref o)) | &SchemaContents::Object(ref o) => { - TypeContent::Struct(Fields::from(o, self)) - } - SchemaContents::AllOf { all_of } => { - TypeContent::Struct(Fields::from_all_of(all_of, self)) - } - &SchemaContents::AnyOf { any_of: ref items } - | &SchemaContents::OneOf { one_of: ref items } => { - TypeContent::Enum(Variants::from_one_of(items, self)) - } - &SchemaContents::Literal(Literal::Array(ArrayLiteral { - items: Some(ref schema), - })) => { - let name = self - .type_info(schema) - .expect("Anonymous array type not supported") - .name; - - let type_info = TypeInfo { - name, - required: Required::Yes, - array: true, - }; - - TypeContent::TypeAlias(type_info) - } - &SchemaContents::Literal(Literal::String(StringLiteral { - min_length: None, - max_length: None, - pattern: None, - format: None, - enumeration: Some(ref enumeration), - })) => TypeContent::UntaggedEnum(enumeration.clone()), - v => { - panic!("Unsupported type {name} {v:#?}") - } - }; - - TypePrinter { name, doc, content } - } - - fn generate_rpc_method(&mut self, buffer: &mut String, method: &Method) { - let Method { - ref summary, - ref name, - ref params, - ref result, - .. - } = method; - writeln!(@doc buffer, summary); - - let result = result - .as_ref() - .map(|content| match content { - RefOr::Inline(descriptor) => self - .type_info(&descriptor.schema) - .expect("Result type should be defined") - .get_type(), - RefOr::Reference { reference } => reference.clone(), - }) - .unwrap_or("()".to_string()); - - let parameters = params - .iter() - .map(RefOr::unwrap_inline) - .map( - |ContentDescriptor { - name, - required, - schema, - .. - }| { - let name_arg = name.to_snake_case().replace(' ', "_"); - let name_type = self - .type_info(schema) - .expect("Parameter type should be defined") - .set_required(*required) - .get_type(); - format!("{name_arg}: {name_type}") - }, - ) - .collect::>() - .join(", "); - - writeln!(buffer, "#[method(name = \"{name}\")]"); - let method_name = name.trim_start_matches(&self.prefix).to_snake_case(); - writeln!( - buffer, - "async fn {method_name}(&self, {parameters}) -> RpcResult<{result}>;" - ); - } - - /// Collect the type if it's not yet generated or collected. - fn collect(&mut self, type_name: &str, ref_or_schema: ReferenceOrSchema) { - if !self.generated.contains(type_name) && !self.collected.contains_key(type_name) { - self.collected.insert(type_name.to_string(), ref_or_schema); - } - } -} - -/// Convert a reference to a type name. -fn reference_to_name(reference: &str) -> String { - if PRIMITIVE_MAPPINGS.contains_key(reference) { - return PRIMITIVE_MAPPINGS[reference].to_string(); - } - reference.split('/').last().unwrap().to_pascal_case() -} - -impl TypeNameProvider for TypeGenerator { - fn type_info(&mut self, schema: &Schema) -> Option { - match &schema.contents { - SchemaContents::Reference { reference } => { - let type_name = reference_to_name(reference); - self.collect( - &type_name, - ReferenceOrSchema::Reference(reference.to_string()), - ); - Some(type_name.into()) - } - SchemaContents::Literal(Literal::Array(ArrayLiteral { - items: Some(ref schema), - })) => { - let name = self - .type_info(schema) - .expect("Anonymous array type not supported") - .name; - - Some(TypeInfo { - name, - required: Required::Yes, - array: true, - }) - } - SchemaContents::AllOf { all_of } => Some( - all_of - .iter() - .map(|s| { - self.type_info(s) - .expect("Anonymous all_of type not supported") - .name - }) - .collect::>() - .join("And") - .into(), - ), - SchemaContents::AnyOf { any_of: ref items } - | SchemaContents::OneOf { one_of: ref items } => { - let mut required = Required::Yes; - let items = items - .iter() - .filter_map(|s| { - let info = self - .type_info(s) - .expect("Anonymous any_of type not supported"); - - if info.name == "Null" || info.name == "NotFound" { - required = Required::No { - skip_if_null: false, - }; - None - } else { - Some(info.name) - } - }) - .collect::>(); - - let name = items.join("Or"); - if items.len() > 1 { - self.collect(&name, ReferenceOrSchema::Schema(schema.clone())); - } - - Some(TypeInfo { - name, - required, - array: false, - }) - } - SchemaContents::Literal(Literal::Null) => Some("Null".into()), - - // Use Type0, Type1, Type2, ... for String that have a single digit pattern. - SchemaContents::Literal(Literal::String(StringLiteral { - min_length: None, - max_length: None, - pattern: Some(ref pattern), - format: None, - enumeration: None, - })) if ["^0x0$", "^0x1$", "^0x2$"].contains(&pattern.as_str()) => { - let type_id = format!("Type{}", &pattern[3..4]); - - Some(type_id.into()) - } - - SchemaContents::Literal(Literal::Boolean) => Some("bool".into()), - SchemaContents::Object(_) => None, - v => { - panic!("No type name for {v:#?}"); - } - } - } -} - -#[cfg(test)] -mod test { - use super::*; - use indoc::indoc; - use pretty_assertions::assert_eq; - - #[test] - fn generate_works() { - let specs = read_specs().unwrap(); - - let mut generator = TypeGenerator::new(); - SUPPORTED_ETH_METHODS.iter().for_each(|name| { - generator.filtered_method_names.insert(name.to_string()); - }); - - let buffer = generator.generate_rpc_methods(&specs); - println!("{}", buffer); - } - - #[test] - fn generate_rpc_works() { - let method = serde_json::from_str::( - r###" - { - "name": "eth_estimateGas", - "summary": "Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.", - "params": [ - { - "name": "Transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/GenericTransaction" - } - }, - { - "name": "Block", - "required": false, - "schema": { - "$ref": "#/components/schemas/BlockNumberOrTag" - } - } - ], - "result": { - "name": "Gas used", - "schema": { - "$ref": "#/components/schemas/uint" - } - } - } - "###, - ) - .unwrap(); - - let mut buffer = String::new(); - let mut generator = TypeGenerator::new(); - - generator.generate_rpc_method(&mut buffer, &method); - assert_eq!( - buffer, - indoc! {r#" - /// Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. - #[method(name = "eth_estimateGas")] - async fn estimate_gas(&self, transaction: GenericTransaction, block: Option) -> RpcResult; - "#} - ); - } - - #[test] - fn generate_type_name_works() { - let mut generator = TypeGenerator::new(); - - let schema: Schema = serde_json::from_str( - r###" - { - "title": "to address", - "oneOf": [ - { "title": "Contract Creation (null)", "type": "null" }, - { "title": "Address", "$ref": "#/components/schemas/address" } - ] - } - "###, - ) - .unwrap(); - - assert_eq!( - &generator.type_info(&schema).unwrap().get_type(), - "Option
" - ); - } - - #[test] - fn generate_all_off_type_works() { - let specs = read_specs().unwrap(); - let mut generator = TypeGenerator::new(); - let res = generator.generate_type( - "Transaction4844Signed".to_string(), - specs - .get_schema("#/components/schemas/Transaction4844Signed") - .unwrap(), - ); - let mut buffer = String::new(); - res.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r###" - /// Signed 4844 Transaction - #[derive(Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq)] - pub struct Transaction4844Signed { - #[serde(flatten)] - pub transaction_4844_unsigned: Transaction4844Unsigned, - /// r - pub r: U256, - /// s - pub s: U256, - /// yParity - /// The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature. - #[serde(rename = "yParity", skip_serializing_if = "Option::is_none")] - pub y_parity: Option, - } - "###} - ); - } - - #[test] - fn generate_one_of_type_works() { - let specs = read_specs().unwrap(); - let mut generator = TypeGenerator::new(); - let res = generator.generate_type( - "TransactionUnsigned".to_string(), - specs - .get_schema("#/components/schemas/TransactionUnsigned") - .unwrap(), - ); - let mut buffer = String::new(); - res.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r###" - #[derive(Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq)] - #[serde(untagged)] - pub enum TransactionUnsigned { - Transaction4844Unsigned(Transaction4844Unsigned), - Transaction1559Unsigned(Transaction1559Unsigned), - Transaction2930Unsigned(Transaction2930Unsigned), - TransactionLegacyUnsigned(TransactionLegacyUnsigned), - } - impl Default for TransactionUnsigned { - fn default() -> Self { - TransactionUnsigned::Transaction4844Unsigned(Default::default()) - } - } - "###} - ); - } - - #[test] - fn generate_array_type_works() { - let specs = read_specs().unwrap(); - let mut generator = TypeGenerator::new(); - let res = generator.generate_type( - "AccessList".to_string(), - specs.get_schema("#/components/schemas/AccessList").unwrap(), - ); - let mut buffer = String::new(); - res.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r###" - /// Access list - pub type AccessList = Vec; - "###} - ); - } - - #[test] - fn generate_one_of_with_null_variant_works() { - let specs = read_specs().unwrap(); - let mut generator = TypeGenerator::new(); - let res = generator.generate_type( - "FilterTopics".to_string(), - specs - .get_schema("#/components/schemas/FilterTopics") - .unwrap(), - ); - let mut buffer = String::new(); - res.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r###" - /// Filter Topics - pub type FilterTopics = Vec; - "###} - ); - } - - #[test] - fn generate_object_type_works() { - let specs = read_specs().unwrap(); - let mut generator = TypeGenerator::new(); - let res = generator.generate_type( - "Transaction".to_string(), - specs - .get_schema("#/components/schemas/GenericTransaction") - .unwrap(), - ); - - let mut buffer = String::new(); - res.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r###" - /// Transaction object generic to all types - #[derive(Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq)] - pub struct Transaction { - /// accessList - /// EIP-2930 access list - #[serde(rename = "accessList", skip_serializing_if = "Option::is_none")] - pub access_list: Option, - /// blobVersionedHashes - /// List of versioned blob hashes associated with the transaction's EIP-4844 data blobs. - #[serde(rename = "blobVersionedHashes", skip_serializing_if = "Option::is_none")] - pub blob_versioned_hashes: Option>, - /// blobs - /// Raw blob data. - #[serde(skip_serializing_if = "Option::is_none")] - pub blobs: Option>, - /// chainId - /// Chain ID that this transaction is valid on. - #[serde(rename = "chainId", skip_serializing_if = "Option::is_none")] - pub chain_id: Option, - /// from address - #[serde(skip_serializing_if = "Option::is_none")] - pub from: Option
, - /// gas limit - #[serde(skip_serializing_if = "Option::is_none")] - pub gas: Option, - /// gas price - /// The gas price willing to be paid by the sender in wei - #[serde(rename = "gasPrice", skip_serializing_if = "Option::is_none")] - pub gas_price: Option, - /// input data - #[serde(alias = "data", skip_serializing_if = "Option::is_none")] - pub input: Option, - /// max fee per blob gas - /// The maximum total fee per gas the sender is willing to pay for blob gas in wei - #[serde(rename = "maxFeePerBlobGas", skip_serializing_if = "Option::is_none")] - pub max_fee_per_blob_gas: Option, - /// max fee per gas - /// The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei - #[serde(rename = "maxFeePerGas", skip_serializing_if = "Option::is_none")] - pub max_fee_per_gas: Option, - /// max priority fee per gas - /// Maximum fee per gas the sender is willing to pay to miners in wei - #[serde(rename = "maxPriorityFeePerGas", skip_serializing_if = "Option::is_none")] - pub max_priority_fee_per_gas: Option, - /// nonce - #[serde(skip_serializing_if = "Option::is_none")] - pub nonce: Option, - /// to address - pub to: Option
, - /// type - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, - /// value - #[serde(skip_serializing_if = "Option::is_none")] - pub value: Option, - } - "###} - ); - } -} diff --git a/rpc/codegen/src/main.rs b/rpc/codegen/src/main.rs deleted file mode 100644 index 1882ebf..0000000 --- a/rpc/codegen/src/main.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::path::Path; - -use crate::generator::TypeGenerator; - -#[macro_use] -extern crate lazy_static; -mod generator; -mod open_rpc; -mod printer; - -fn main() -> anyhow::Result<()> { - let specs = generator::read_specs()?; - - let mut generator = TypeGenerator::new(); - generator.collect_extra_type("TransactionUnsigned"); - - let out_dir = if let Ok(dir) = std::env::var("CARGO_MANIFEST_DIR") { - Path::new(&dir).join("..") - } else { - "./rpc".into() - }; - - let out = std::fs::canonicalize(out_dir.join("src/rpc_methods.rs"))?; - println!("Generating rpc_methods at {out:?}"); - std::fs::write(out, generator.generate_rpc_methods(&specs)).expect("Unable to write file"); - - let out = std::fs::canonicalize(out_dir.join("api/src/rpc_types.rs"))?; - println!("Generating rpc_types at {out:?}"); - std::fs::write(out, generator.generate_types(&specs)).expect("Unable to write file"); - Ok(()) -} diff --git a/rpc/codegen/src/open_rpc.rs b/rpc/codegen/src/open_rpc.rs deleted file mode 100644 index c12a415..0000000 --- a/rpc/codegen/src/open_rpc.rs +++ /dev/null @@ -1,822 +0,0 @@ -//! Defines the types defined by the [`OpenRPC`](https://spec.open-rpc.org) specification. - -#![warn(missing_docs, missing_debug_implementations)] - -use serde::{Deserialize, Serialize}; -use std::collections::{BTreeMap, HashMap}; - -/// Represents an OpenRPC document. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct OpenRpc { - /// The semantic version number of the OpenRPC Specification version that the OpenRPC document - /// uses. - /// - /// This field should be used by tooling specifications and clients to interpret the OpenRPC - /// document. - pub openrpc: String, - /// Provides metadata about the API. - /// - /// This metadata may be used by tooling as required. - pub info: Info, - /// An array of [`Server`] objects, which provide connectivity information to a target server. - /// - /// If the `servers` property is not provided, or is an empty array, the default value would - /// be a [`Server`] with a `url` value of `localhost`. This is taken care of by the - /// [`open-rpc`](crate) crate. - #[serde(default = "serde_fns::servers")] - pub servers: Vec, - /// The available methods for the API. While this field is required, it is legal to leave it - /// empty. - pub methods: Vec>, - /// Holds various schemas for the specification. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub components: Option, - /// Contains additional documentation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub external_docs: Option, -} - -impl OpenRpc { - /// Returns the [`Method`] with the given path reference. - /// - /// # Examples - /// - /// ```no_run - /// let path = "#/components/schemas/MY_SCHEMA"; - /// let schema = openrpc.get_schema(path).unwrap(); - /// ``` - pub fn get_schema(&self, reference: &str) -> Option<&Schema> { - let mut components = reference.split('/'); - - if !matches!(components.next(), Some("#")) { - return None; - } - - if !matches!(components.next(), Some("components")) { - return None; - } - - if !matches!(components.next(), Some("schemas")) { - return None; - } - - let name = components.next()?; - self.components.as_ref()?.schemas.get(name) - } - - /// Same as [`OpenRpc::get_schema`] but returns a &mut reference - pub fn get_schema_mut(&mut self, reference: &str) -> Option<&mut Schema> { - let mut components = reference.split('/'); - - if !matches!(components.next(), Some("#")) { - return None; - } - - if !matches!(components.next(), Some("components")) { - return None; - } - - if !matches!(components.next(), Some("schemas")) { - return None; - } - - let name = components.next()?; - self.components.as_mut()?.schemas.get_mut(name) - } -} - -/// Provides metadata about the API. -/// -/// The metadata may be used by clients if needed, and may be presented in editing or -/// documentation generation tools for convenience. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Info { - /// The title of the application. - #[serde(default)] - pub title: String, - /// A verbose description of the application. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// A URL to the Terms of Service for the API. - /// - /// This must contain an URL. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub terms_of_service: Option, - /// contact information for the exposed API. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub contact: Option, - /// License information for the exposed API. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub license: Option, - /// The version of the OpenRPC document. - /// - /// Note that this is distinct from the `openrpc` field of [`OpenRpc`] which specifies the - /// version of the OpenRPC Specification used. - #[serde(default)] - pub version: String, -} - -/// Contact information for the exposed API. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Contact { - /// The identifying name of the contact person/organization. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - /// The URL pointing to the contact information. - /// - /// This must contain an URL. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - /// The email address of the contact person/organization. - /// - /// This must contain an email address. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, -} - -/// License information for the exposed API. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct License { - /// The name of the license used for the API. - #[serde(default)] - pub name: String, - /// The URL pointing to the license used for the API. - /// - /// This must contain an URL. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, -} - -/// A server. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Server { - /// A name to be used as the canonical name for the server. - #[serde(default)] - pub name: String, - /// A URL to the target host. - /// - /// This URL supports Server Variables and may be relative to indicate that the host location - /// is relative to the location where the OpenRPC document is being served. - /// - /// Server Variables are passed into the Runtime Expression to produce a server URL. - pub url: RuntimeExpression, - /// A short description of what the server is. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Describes the host designated by the URL. - /// - /// GitHub Flavored Markdown may be used for rich text presentation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The values of this object are passed to the [`RuntimeExpression`] to produce an actual - /// URL. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub variables: BTreeMap, -} - -/// An object representing a Server Variable for server URL template substitution. -#[derive(Serialize, Deserialize, Debug, Clone, Default)] -#[serde(rename_all = "camelCase")] -pub struct ServerVariable { - /// An enumeration of string values to be used if the substitution options are from a limited - /// set. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub enum_: Vec, - /// The default value to use for substitution, which shall be sent if an alternate value is - /// not supplied. - /// - /// Note this behavior is different than the Schema Object's treatment of default values, - /// because in those cases parameter values are optional. - #[serde(default)] - pub default: String, - /// An optional description for the server variable. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} - -/// Describes the interface for the given method name. -/// -/// The method name is used as the `method` field of the JSON-RPC body. It therefore must be -/// unique. -#[derive(Default, Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Method { - /// The canonical name of the method. - /// - /// This name must be unique within the methods array. - #[serde(default)] - pub name: String, - /// A list of tags for API documentation control. Tags can be used for logical grouping - /// of methods by resources or any other qualifier. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub tags: Vec>, - /// A short summary of what the method does. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// A verbose explanation of the method behavior. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Additional external documentation for this method. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub external_docs: Option, - /// A list of parameters that are applicable for this method. - /// - /// The list must not include duplicated parameters and therefore require `name` to be - /// unique. - /// - /// All required parameters must be listed *before* any optional parameters. - #[serde(default)] - pub params: Vec>, - /// The description of the result returned by the method. - /// - /// If defined, it must be a [`ContentDescriptor`] or a Reference. - /// - /// If undefined, the method must only be used as a *notification*. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub result: Option>, - /// Declares this method as deprecated. - /// - /// Consumers should refrain from usage of the declared method. - /// - /// The default value is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub deprecated: bool, - /// An alternative `servers` array to service this method. - /// - /// If specified, it overrides the `servers` array defined at the root level. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub servers: Option>, - /// A list of custom application-defined errors that may be returned. - /// - /// The errors must have unique error codes. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub errors: Vec>, - /// A list of possible links from this method call. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub links: Vec>, - /// The expected format of the parameters. - /// - /// The parameters of a method may be an array, an object, or either. When a method - /// has a `param_structure` value of [`ByName`], callers of the method must pass an - /// object as the parameters. When a method has a `param_structure` value of [`ByPosition`], - /// callers of the method must pass an array as the parameters. Otherwise, callers may - /// pass either an array or an object as the parameters. - /// - /// The default value is [`Either`]. - /// - /// [`ByName`]: ParamStructure::ByName - /// [`ByPosition`]: ParamStructure::ByPosition - /// [`Either`]: ParamStructure::Either - #[serde(default, skip_serializing_if = "serde_fns::is_default")] - pub param_structure: ParamStructure, - /// An array of [`ExamplePairing`] objects, where each example includes a valid - /// params-to-result [`ContentDescriptor`] pairing. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub examples: Vec>, -} - -/// A possible value for the `param_structure` field of [`Method`]. -#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Default)] -#[serde(rename_all = "kebab-case")] -pub enum ParamStructure { - /// Parameters must be passed as a JSON object. - ByName, - /// Parameters must be passed as a JSON array. - ByPosition, - /// Parameters may be passed as either a JSON object or a JSON array. - #[default] - Either, -} - -/// Content descriptors are that do just as they suggest - describe content. They are reusable -/// ways of describing either parameters or results. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ContentDescriptor { - /// The name of the content being described. - /// - /// If the content described is a method parameter assignable - /// [`ByName`](ParamStructure::ByName), this field must be the name of the parameter. - #[serde(default)] - pub name: String, - /// A short summary of the content that is being described. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// A verbose explanation of the content being described. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Determines if the content is a required field. - /// - /// Default is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub required: bool, - /// A [`Schema`] that describes what is allowed in the content. - #[serde(default)] - pub schema: Schema, - /// Whether the content is deprecated. - /// - /// Default is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub deprecated: bool, -} - -/// Allows the definition of input and output data types. -#[derive(Serialize, Deserialize, Debug, Clone, Default)] -#[serde(rename_all = "camelCase")] -pub struct Schema { - /// The title of the schema. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - /// The description of the schema. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The contents of the schema. - #[serde(flatten)] - pub contents: SchemaContents, -} - -/// The content of a schema. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(untagged)] -pub enum SchemaContents { - /// The schema contains a reference to another schema. - Reference { - /// The reference string. - #[serde(rename = "$ref")] - reference: String, - }, - /// The schema is made of a combination of other schemas. - /// - /// The final object must match *all* of the schemas. - AllOf { - /// The schemas that the final object must match. - #[serde(rename = "allOf")] - all_of: Vec, - }, - /// The schema is made of a combination of other schemas. - /// - /// The final object must match *any* of the schemas. - AnyOf { - /// The schemas that the final object must match. - #[serde(rename = "anyOf")] - any_of: Vec, - }, - /// The schema is made of a combination of other schemas. - /// - /// The final object must match exactly *one* of the schemas. - OneOf { - /// The schemas that the final object must match. - #[serde(rename = "oneOf")] - one_of: Vec, - }, - /// The schema contains a literal value. - Literal(Literal), - /// The schema contains an Object. - /// - /// Note this is a workaround to parse Literal(Literal::ObjectLiteral), that don't havethe - /// type: "object" field. - Object(ObjectLiteral), -} - -impl Default for SchemaContents { - #[inline] - fn default() -> Self { - Self::Literal(Literal::Null) - } -} - -/// A literal value. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(tag = "type", rename_all = "lowercase")] -pub enum Literal { - /// The literal is a boolean. - Boolean, - /// The literal is an integer. - Integer(IntegerLiteral), - /// The literal is a number. - Number(NumberLiteral), - /// The literal is a string. - String(StringLiteral), - // The literal is an object. - Object(ObjectLiteral), - /// The literal is an array. - Array(ArrayLiteral), - /// The literal is a null value. - Null, -} - -/// The constraints that may be applied to an integer literal schema. -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[derive(Debug, Clone)] -pub struct IntegerLiteral { - /// The integer must be a multiple of this value. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub multiple_of: Option, - /// The minimum value of the integer. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub minimum: Option, - /// The maximum value of the integer. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// Whether the minimum value is exclusive. - /// - /// Default is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub exclusive_minimum: bool, - /// Whether the maximum value is exclusive. - /// - /// Default is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub exclusive_maximum: bool, -} - -/// The constraints that may be applied to a number literal schema. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct NumberLiteral { - /// The number must be a multiple of this value. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub multiple_of: Option, - /// The minimum value of the number. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub minimum: Option, - /// The maximum value of the number. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// Whether the minimum value is exclusive. - /// - /// Default is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub exclusive_minimum: bool, - /// Whether the maximum value is exclusive. - /// - /// Default is `false`. - #[serde(default, skip_serializing_if = "serde_fns::is_false")] - pub exclusive_maximum: bool, -} - -/// The constraints that may be applied to an array literal schema. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ArrayLiteral { - /// The schema that the items in the array must match. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub items: Option>, -} - -/// The constraints that may be applied to an string literal schema. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct StringLiteral { - /// The minimum length of the string. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub min_length: Option, - /// The maximum length of the string.s - #[serde(default, skip_serializing_if = "Option::is_none")] - pub max_length: Option, - /// The pattern that the string must match. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub pattern: Option, - /// The format that the string must be in. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub format: Option, - /// A list of possible values for the string. - #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")] - pub enumeration: Option>, -} - -/// A string format. -#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash)] -#[serde(rename_all = "kebab-case")] -pub enum StringFormat { - /// Date and time together, for example, `2018-11-13T20:20:39+00:00`. - DateTime, - /// Time, for example, `20:20:39+00:00`. - Time, - /// Date, for example, `2018-11-13`. - Date, - /// A duration as defined by the [ISO 8601 ABNF](https://datatracker.ietf.org/doc/html/rfc3339#appendix-A). - Duration, - /// An email. See [RFC 5321](http://tools.ietf.org/html/rfc5321#section-4.1.2). - Email, - /// The internationalized version of an email. See [RFC 6531](https://tools.ietf.org/html/rfc6531). - IdnEmail, - /// A host name. See [RFC 1123](https://datatracker.ietf.org/doc/html/rfc1123#section-2.1). - Hostname, - /// The internationalized version of a host name. See [RFC 5890](https://tools.ietf.org/html/rfc5890#section-2.3.2.3). - IdnHostname, - /// An IP v4. See [RFC 2673](http://tools.ietf.org/html/rfc2673#section-3.2). - #[serde(rename = "ipv4")] - IpV4, - /// An IP v6. See [RFC 2373](http://tools.ietf.org/html/rfc2373#section-2.2). - #[serde(rename = "ipv6")] - IpV6, - /// A universally unique identifier. See [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122). - Uuid, - /// A universal resource identifier . See [RFC 3986](http://tools.ietf.org/html/rfc3986). - Uri, - /// A URI reference. See (RFC 3986)[]. - UriReference, - /// The internationalized version of a URI. See [RFC 3987](https://tools.ietf.org/html/rfc3987). - Iri, - /// The internationalized version of a URI reference. See [RFC 3987](https://tools.ietf.org/html/rfc3987). - IriReference, - /// A URI template. See [RFC 6570](https://tools.ietf.org/html/rfc6570). - UriTemplate, - /// A JSON pointer. See [RFC 6901](https://tools.ietf.org/html/rfc6901). - JsonPointer, - /// A relative JSON pointer. See [Relative JSON Pointer](https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01). - RelativeJsonPointer, - /// A regular expression. See [ECMA 262](https://www.ecma-international.org/publications-and-standards/standards/ecma-262/). - Regex, -} - -/// The constraints that may be applied to an object literal schema. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ObjectLiteral { - /// The properties that the object might have. - pub properties: BTreeMap, - - /// List of legacy aliases for properties. - #[serde(skip)] - pub legacy_aliases: HashMap, - - /// A list of properties that the object must have. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub required: Vec, -} - -/// A set of example parameters and a result. -/// -/// This result is what you'd expect from the JSON-RPC service given the exact params. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ExamplePairing { - /// The name for the example pairing. - #[serde(default)] - pub name: String, - /// A verbose description of the example pairing. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// A short summary of the example pairing. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Example parameters. - #[serde(default)] - pub params: Vec>, - /// Example result. - /// - /// When undefined, shows the usage of the method as a notification. - #[serde(default)] - pub result: RefOr, -} - -/// Defines an example that is intended to match a [`Schema`] of a given [`ContentDescriptor`]. -#[derive(Serialize, Deserialize, Default, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ExampleObject { - /// Canonical name of the example. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - /// A verbose description of the example - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// A short summary of the example. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// The value of the example. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, -} - -/// The example value of an [`ExampleObject`]. -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum ExampleValue { - /// The value is a JSON object embedded in the document. - /// A link to an external document containing the value. - #[serde(rename = "externalValue")] - External(String), -} - -/// Represents a possible design-time link for a result. -/// -/// The presence of a link does not guarantee the caller's ability to successfully invoke it, -/// rather it provides a known relationship and traversal mechanism between results and other -/// methods. -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[derive(Debug, Clone)] -pub struct Link { - /// Canonical name for the link. - #[serde(default)] - pub name: String, - /// A description of the link. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Short description for the link. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// The name of an *existing*, resolvable OpenRPC method, as defined with a unique - /// `method`. This field must resolve to a unique [`Method`] object. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub method: Option, - /// The parameters to pass to a method as specified with `method`. The key is the parameter - /// name to be used, whereas the value can be a constant or a [`RuntimeExpression`] to be - /// evaluated and passed to the linked method. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub params: Option, - /// A server object to be used by the target method. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server: Option, -} - -/// The content of the `params` field of a [`Link`]. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(untagged)] -pub enum LinkParams { - /// A [`RuntimeExpression`] that evaluates to the parameters. - Dynamic(RuntimeExpression), -} - -/// Runtime expressions allow the user to define an expression which will evaluate to a -/// string once the desired value(s) are known. -/// -/// They are used when the desired value of a link or server can only be constructed at -/// run time. This mechanism is used by [`Link`] objects and [`ServerVariable`]s. -/// -/// This runtime expression makes use of JSON template strings. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(transparent)] -pub struct RuntimeExpression(pub String); - -/// An application-level error. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Error { - /// An application-defined error code. - #[serde(default)] - pub code: i64, - /// A string providing a short description of the error. - /// - /// The message should be limited to a concise single sentence. - #[serde(default)] - pub message: String, -} - -/// Holds a set of reusable objects for different aspects of the OpenRPC document. -/// -/// All objects defined within the [`Components`] object will have no effect on the API -/// unless they are explicitly referenced from properties outside of the [`Components`] -/// object. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Components { - /// A list of reusable [`ContentDescriptor`]s. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub content_descriptors: BTreeMap, - /// A list of reusable [`Schema`]s. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub schemas: BTreeMap, - /// A list of reusable [`ExampleObject`]s. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub examples: BTreeMap, - /// A list of reusable [`Link`]s. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub links: BTreeMap, - /// A list of reusable [`Error`]s. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub errors: BTreeMap, - /// A list of reusable [`ExamplePairing`]s. - #[serde( - default, - skip_serializing_if = "BTreeMap::is_empty", - rename = "examplePairingObjects" - )] - pub example_pairings: BTreeMap, - /// A list of reusable [`Tag`]s. - #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub tags: BTreeMap, -} - -/// Adds metadata to a single tag that is used by the [`Method`] Object. -/// -/// It is not mandatory to have a [`Tag`] Object per tag defined in the [`Method`] -/// Object instances. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct Tag { - /// The name of the tag. - #[serde(default)] - pub name: String, - /// A short summary of the tag. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// A verbose explanation of the tag. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Additional external documentation for this tag. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub external_docs: Option, -} - -/// Allows referencing an external resource for extended documentation. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ExternalDocumentation { - /// A verbose explanation of the target documentation. - /// - /// GitHub Flavored Markdown syntax may be used for rich text representation. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - /// A URL for the target documentation. - /// - /// This must contain an URL. - #[serde(default)] - pub url: String, -} - -/// Either a reference or an inline object. -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(untagged)] -pub enum RefOr { - /// A reference to an object defined elsewhere. - Reference { - /// The reference string. - #[serde(rename = "$ref")] - reference: String, - }, - /// An inline object. - Inline(T), -} - -impl RefOr { - /// Unwraps the inlined object. - pub fn unwrap_inline(&self) -> &T { - match self { - RefOr::Reference { reference } => panic!("Unexpected reference: {reference}"), - RefOr::Inline(v) => v, - } - } -} - -impl Default for RefOr { - #[inline] - fn default() -> Self { - RefOr::Inline(T::default()) - } -} - -/// Functions used by `serde`, such as predicates and default values. -mod serde_fns { - use std::collections::BTreeMap; - - use super::{RuntimeExpression, Server}; - - /// Returns the default value of the `servers` field. - pub fn servers() -> Vec { - vec![Server { - name: "default".into(), - url: RuntimeExpression("localhost".into()), - summary: None, - description: None, - variables: BTreeMap::new(), - }] - } - - /// Returns whether `b` is `false`. - pub fn is_false(b: &bool) -> bool { - !*b - } - - /// Returns whether the given value is the default value of its type. - pub fn is_default(t: &T) -> bool { - *t == T::default() - } -} - -#[test] -fn parsing_works() { - let content = include_str!("../openrpc.json"); - let _: OpenRpc = dbg!(serde_json::from_str(content).unwrap()); -} diff --git a/rpc/codegen/src/printer.rs b/rpc/codegen/src/printer.rs deleted file mode 100644 index 691b99b..0000000 --- a/rpc/codegen/src/printer.rs +++ /dev/null @@ -1,498 +0,0 @@ -use crate::open_rpc::*; -use inflector::Inflector; - -/// Type information used for generating the type. -#[derive(Debug)] -pub struct TypeInfo { - /// The type name. - pub name: String, - /// Whether the type is an array. - pub array: bool, - /// Whether the type is required. - pub required: Required, -} - -impl TypeInfo { - pub fn set_required(mut self, required: bool) -> Self { - if required { - self.required = Required::Yes; - } else { - self.required = Required::No { skip_if_null: true }; - } - self - } - - /// Return Whether the type is optional. - pub fn is_optional(&self) -> bool { - matches!(self.required, Required::No { .. }) - } -} - -/// A trait to provide type names. -pub trait TypeNameProvider { - /// Returns type information for a schema. - fn type_info(&mut self, schema: &Schema) -> Option; -} - -/// Describes whether the type is required or not. -#[derive(Debug)] -pub enum Required { - /// The type is required. - Yes, - /// The type is not required, and may be skipped when serializing if it's None and skip_if_null - /// is true. - No { skip_if_null: bool }, -} - -impl TypeInfo { - //// Convert the type info to a string we can use in the generated code. - pub fn get_type(&self) -> String { - let mut type_name = self.name.clone(); - if self.array { - type_name = format!("Vec<{}>", type_name) - } - if self.is_optional() { - type_name = format!("Option<{}>", type_name) - } - type_name - } -} - -impl From for TypeInfo -where - T: Into, -{ - fn from(name: T) -> Self { - Self { - name: name.into(), - required: Required::Yes, - array: false, - } - } -} -/// Represents a field in a struct. -#[derive(Debug)] -pub struct Field { - /// The documentation for the field. - doc: Option, - /// The name of the field. - name: String, - /// the type information for the field. - type_info: TypeInfo, - /// Whether to flatten the field, when serializing. - flatten: bool, - /// Legacy alias for the field. - alias: Option, -} - -/// Represents a collection of fields. -#[derive(Debug)] -pub struct Fields(Vec); - -impl From> for Fields { - fn from(value: Vec) -> Self { - Self(value) - } -} - -impl IntoIterator for Fields { - type Item = Field; - type IntoIter = std::vec::IntoIter; - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl Fields { - /// Creates a collection of fields from an [`ObjectLiteral]. - /// - /// The methods also takes a [`TypeNameProvider`] to resolve the types of the fields, and to - /// collect child types. - pub fn from(value: &ObjectLiteral, provider: &mut impl TypeNameProvider) -> Self { - let ObjectLiteral { - properties, - legacy_aliases, - required, - } = value; - - properties - .iter() - .map(|(name, schema)| { - let mut type_info = provider.type_info(schema).expect("Type should be defined"); - if matches!(type_info.required, Required::Yes) && !required.contains(name) { - type_info.required = Required::No { skip_if_null: true }; - } - - let doc = doc_str_from_schema(schema); - Field { - doc, - name: name.clone(), - type_info, - alias: legacy_aliases.get(name).cloned(), - flatten: false, - } - }) - .collect::>() - .into() - } - - /// Creates a collection of fields from the items of a [`SchemaContents::AllOf`] schema. - pub fn from_all_of(all_of: &[Schema], provider: &mut impl TypeNameProvider) -> Fields { - all_of - .iter() - .flat_map(|schema| { - let doc = doc_str_from_schema(schema); - if let Some(type_info) = provider.type_info(schema) { - vec![Field { - doc, - name: type_info.name.clone(), - type_info, - alias: None, - flatten: true, - }] - } else { - let object = match &schema.contents { - SchemaContents::Object(object) => object, - SchemaContents::Literal(Literal::Object(object)) => object, - v => panic!("Unsupported anonymous all_of type {:?}", v), - }; - - Fields::from(object, provider).0 - } - }) - .collect::>() - .into() - } -} - -/// The variant of an enum. -#[derive(Debug)] -pub struct Variant { - /// The documentation for the variant. - doc: Option, - /// The type information for the variant. - type_info: TypeInfo, -} - -impl Variant { - pub fn name(&self) -> String { - if self.type_info.array { - format!("{}s", self.type_info.name) - } else { - self.type_info.name.clone() - } - } -} - -pub fn doc_str_from_schema(schema: &Schema) -> Option { - let mut doc = schema.title.clone(); - - if let Some(description) = &schema.description { - doc = Some(doc.map_or_else( - || description.clone(), - |doc| format!("{doc}\n{description}"), - )); - } - - doc -} - -#[derive(Debug)] -pub struct Variants(Vec); -impl Variants { - /// Creates a collection of variants from the items of a [`SchemaContents::OneOf`] schema. - pub(crate) fn from_one_of(one_of: &[Schema], provider: &mut impl TypeNameProvider) -> Variants { - one_of - .iter() - .filter_map(|schema| { - let doc = doc_str_from_schema(schema); - let type_info = provider.type_info(schema).expect("Type should be defined"); - if type_info.name == "Null" || type_info.name == "NotFound" { - return None; - } - - Some(Variant { doc, type_info }) - }) - .collect::>() - .into() - } -} - -impl From> for Variants { - fn from(value: Vec) -> Self { - Self(value) - } -} - -/// The content of a type. -#[derive(Debug)] -pub enum TypeContent { - /// A struct type. - Struct(Fields), - /// A unit struct type. - TypeAlias(TypeInfo), - /// An enum type. - Enum(Variants), - /// A serde untagged enum type. - UntaggedEnum(Vec), -} - -/// A type printer. -#[derive(Debug)] -pub struct TypePrinter { - pub doc: Option, - pub name: String, - pub content: TypeContent, -} - -/// A macro to write a formatted line to a buffer. -#[macro_export] -macro_rules! writeln { - (@doc $s: ident, $doc: ident) => { - $crate::writeln!(@doc $s, $doc, 0) - }; - (@doc $s: ident, $doc: ident, $indent: literal) => { - if let Some(doc) = $doc { - for line in doc.lines() { - writeln!($s, "{:indent$}/// {}", "", line, indent = $indent); - } - } - }; - ($s: ident, $($arg: tt)*) => { - $s.push_str(&format!($($arg)*)); - $s.push_str("\n"); - }; - - - -} - -impl TypePrinter { - /// Prints the type to a buffer. - pub fn print(self, buffer: &mut String) { - let Self { - doc, name, content, .. - } = self; - - writeln!(@doc buffer, doc); - match content { - TypeContent::Enum(variants) if variants.0.len() == 1 => { - let type_info = &variants.0[0].type_info; - writeln!(buffer, "pub type {name} = {};", type_info.get_type()); - } - TypeContent::TypeAlias(type_info) => { - writeln!(buffer, "pub type {name} = {};", type_info.get_type()); - } - TypeContent::Enum(variants) => { - writeln!( - buffer, - "#[derive(Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq)]" - ); - writeln!(buffer, "#[serde(untagged)]"); - writeln!(buffer, "pub enum {name} {{"); - for variant in variants.0.iter() { - let doc = &variant.doc; - writeln!(@doc buffer, doc, 2); - writeln!( - buffer, - " {}({}),", - variant.name(), - variant.type_info.get_type() - ); - } - writeln!(buffer, "}}"); - - // Implement Default trait - let variant = variants.0[0].name(); - writeln!(buffer, "impl Default for {name} {{"); - writeln!(buffer, " fn default() -> Self {{"); - writeln!(buffer, " {name}::{variant}(Default::default())"); - writeln!(buffer, " }}"); - writeln!(buffer, "}}"); - } - TypeContent::UntaggedEnum(variants) => { - writeln!( - buffer, - "#[derive(Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq)]" - ); - writeln!(buffer, "pub enum {name} {{"); - for (i, name) in variants.iter().enumerate() { - writeln!(buffer, " #[serde(rename = \"{name}\")]"); - if i == 0 { - writeln!(buffer, " #[default]"); - } - let pascal_name = name.to_pascal_case(); - writeln!(buffer, " {pascal_name},"); - } - writeln!(buffer, "}}"); - } - TypeContent::Struct(fields) => { - writeln!( - buffer, - "#[derive(Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq)]" - ); - - writeln!(buffer, "pub struct {name} {{"); - for Field { - doc, - name, - type_info, - alias, - flatten, - } in fields - { - writeln!(@doc buffer, doc, 2); - let mut snake_name = name.to_snake_case(); - let mut serde_params = vec![]; - - if flatten { - serde_params.push("flatten".to_string()); - } else if snake_name != name { - serde_params.push(format!("rename = \"{}\"", name)); - } - - if let Some(alias) = alias { - serde_params.push(format!("alias = \"{}\"", alias)); - } - - if matches!(type_info.required, Required::No { skip_if_null: true }) { - serde_params.push("skip_serializing_if = \"Option::is_none\"".to_string()); - } - - if !serde_params.is_empty() { - writeln!(buffer, " #[serde({})]", serde_params.join(", ")); - } - - let type_name = type_info.get_type(); - - if snake_name == "type" { - snake_name = "r#type".to_string() - } - writeln!(buffer, " pub {snake_name}: {type_name},"); - } - writeln!(buffer, "}}"); - } - } - } -} - -#[cfg(test)] -mod test { - use super::*; - use indoc::indoc; - use pretty_assertions::assert_eq; - - #[test] - fn print_struct_works() { - let gen = TypePrinter { - doc: Some("A simple struct".to_string()), - name: "SimpleStruct".to_string(), - content: TypeContent::Struct( - vec![ - Field { - doc: Some("The first field".to_string()), - name: "firstField".to_string(), - type_info: "u32".into(), - flatten: false, - alias: None, - }, - Field { - doc: None, - name: "second".to_string(), - type_info: TypeInfo { - name: "String".to_string(), - required: Required::No { skip_if_null: true }, - array: false, - }, - flatten: true, - alias: None, - }, - ] - .into(), - ), - }; - let mut buffer = String::new(); - gen.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r#" - /// A simple struct - #[derive(Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq)] - pub struct SimpleStruct { - /// The first field - #[serde(rename = "firstField")] - pub first_field: u32, - #[serde(flatten, skip_serializing_if = "Option::is_none")] - pub second: Option, - } - "#} - ); - } - - #[test] - fn print_untagged_enum_works() { - let gen = TypePrinter { - doc: Some("A simple untagged enum".to_string()), - name: "SimpleUntaggedEnum".to_string(), - content: TypeContent::UntaggedEnum(vec!["first".to_string(), "second".to_string()]), - }; - let mut buffer = String::new(); - gen.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r#" - /// A simple untagged enum - #[derive(Debug, Default, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, Eq, PartialEq)] - pub enum SimpleUntaggedEnum { - #[serde(rename = "first")] - #[default] - First, - #[serde(rename = "second")] - Second, - } - "#} - ); - } - - #[test] - fn print_enum_works() { - let gen = TypePrinter { - doc: Some("A simple enum".to_string()), - name: "SimpleEnum".to_string(), - content: TypeContent::Enum( - vec![ - Variant { - doc: Some("The Foo variant".to_string()), - type_info: "Foo".into(), - }, - Variant { - doc: Some("The Bar variant".to_string()), - type_info: "Bar".into(), - }, - ] - .into(), - ), - }; - let mut buffer = String::new(); - gen.print(&mut buffer); - assert_eq!( - buffer, - indoc! {r#" - /// A simple enum - #[derive(Debug, Clone, Encode, Decode, TypeInfo, Serialize, Deserialize, From, TryInto, Eq, PartialEq)] - #[serde(untagged)] - pub enum SimpleEnum { - /// The Foo variant - Foo(Foo), - /// The Bar variant - Bar(Bar), - } - impl Default for SimpleEnum { - fn default() -> Self { - SimpleEnum::Foo(Default::default()) - } - } - "#} - ); - } -} diff --git a/rpc/examples/deploy.rs b/rpc/examples/deploy.rs index e2b4b8a..b75964f 100644 --- a/rpc/examples/deploy.rs +++ b/rpc/examples/deploy.rs @@ -1,58 +1,58 @@ -use eth_rpc::example::Account; -use eth_rpc::EthRpcClient; -use eth_rpc_api::{adapters, Bytes, U256}; +use codec::Encode; +use eth_rpc::{example::Account, EthRpcClient, ReceiptInfo}; use jsonrpsee::http_client::HttpClientBuilder; -use polkadot_sdk::polkadot_sdk_frame::{prelude::Encode, traits::Hash}; +use polkadot_sdk::pallet_revive::{ + create1, + evm::{BlockTag, Bytes, U256}, + EthInstantiateInput, +}; -static DUMMY_BYTES: &[u8] = include_bytes!("./dummy.wasm"); +static DUMMY_BYTES: &[u8] = include_bytes!("./dummy.polkavm"); #[tokio::main] async fn main() -> anyhow::Result<()> { - let account = Account::default(); - println!("Account address: {:?}", account.address()); - - let client = HttpClientBuilder::default().build("http://localhost:9090".to_string())?; - - let salt: Vec = vec![std::env::args() - .nth(1) - .unwrap_or("1".to_string()) - .parse() - .unwrap()]; - println!("Using salt: {salt:?}"); - - let data = vec![]; - let input = adapters::CallInput { - code: DUMMY_BYTES.to_vec(), - data: data.clone(), - salt: salt.clone(), - }; - - let input = input.encode(); - let hash = account - .send_transaction(&client, U256::zero(), input.into(), None) - .await?; - println!("Deploy Tx hash: {hash:?}"); - - tokio::time::sleep(std::time::Duration::from_secs(2)).await; - let receipt = client.get_transaction_receipt(hash).await; - println!("Deploy Tx receipt: {receipt:?}"); - - let contract_address = primitives::evm_contract_address( - &primitives::get_account_id(&account.address()), - &primitives::Hashing::hash(&DUMMY_BYTES), - &data, - &salt, - ); - println!("Contract address: {:?}", contract_address); - - let hash = account - .send_transaction( - &client, - U256::zero(), - Bytes::default(), - Some(contract_address), - ) - .await?; - println!("Contract call tx hash: {hash:?}"); - Ok(()) + env_logger::init(); + let account = Account::default(); + let data = vec![]; + let input = EthInstantiateInput { code: DUMMY_BYTES.to_vec(), data: data.clone() }; + + println!("Account address: {:?}", account.address()); + let client = HttpClientBuilder::default().build("http://localhost:9090".to_string())?; + + println!("\n\n=== Deploying contract ===\n\n"); + + let input = input.encode(); + let nonce = client.get_transaction_count(account.address(), BlockTag::Latest.into()).await?; + let hash = account.send_transaction(&client, U256::zero(), input.into(), None).await?; + println!("Deploy Tx hash: {hash:?}"); + + tokio::time::sleep(std::time::Duration::from_secs(2)).await; + let ReceiptInfo { block_number, gas_used, contract_address, .. } = + client.get_transaction_receipt(hash).await?.unwrap(); + println!("Receipt received: "); + println!("Block number: {block_number}"); + println!("Gas used: {gas_used}"); + println!("Contract address: {contract_address:?}"); + + if std::env::var("SKIP_CALL").is_ok() { + return Ok(()) + } + + let contract_address = create1(&account.address(), nonce.try_into().unwrap()); + println!("\n\n=== Calling contract ===\n\n"); + + let hash = account + .send_transaction(&client, U256::zero(), Bytes::default(), Some(contract_address)) + .await?; + + println!("Contract call tx hash: {hash:?}"); + tokio::time::sleep(std::time::Duration::from_secs(2)).await; + + let ReceiptInfo { block_number, gas_used, to, .. } = + client.get_transaction_receipt(hash).await?.unwrap(); + println!("Receipt received: "); + println!("Block number: {block_number}"); + println!("Gas used: {gas_used}"); + println!("To: {to:?}"); + Ok(()) } diff --git a/rpc/examples/dummy.polkavm b/rpc/examples/dummy.polkavm new file mode 100644 index 0000000..6dae518 Binary files /dev/null and b/rpc/examples/dummy.polkavm differ diff --git a/rpc/examples/dummy.wasm b/rpc/examples/dummy.wasm deleted file mode 100644 index 79e3412..0000000 Binary files a/rpc/examples/dummy.wasm and /dev/null differ diff --git a/rpc/examples/extrinsic.rs b/rpc/examples/extrinsic.rs new file mode 100644 index 0000000..6518b8d --- /dev/null +++ b/rpc/examples/extrinsic.rs @@ -0,0 +1,48 @@ +use eth_rpc::{ + subxt_client::{self, build_params, CheckEvmGasParam, SrcChainConfig}, + MultiSignature, +}; +use polkadot_sdk::sp_weights::Weight; +use subxt::{tx::Signer, Config, OnlineClient}; +use subxt_signer::sr25519::dev; + +static DUMMY_BYTES: &[u8] = include_bytes!("./dummy.polkavm"); +struct SrcChainSigner(subxt_signer::sr25519::Keypair); +impl Signer for SrcChainSigner { + fn account_id(&self) -> ::AccountId { + self.0.public_key().into() + } + fn address(&self) -> ::Address { + self.0.public_key().into() + } + + fn sign(&self, signer_payload: &[u8]) -> ::Signature { + MultiSignature::Sr25519(self.0.sign(signer_payload).0.into()) + } +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = OnlineClient::::new().await?; + + println!("\n\n=== Deploying contract ===\n\n"); + + let tx_payload = subxt_client::tx().revive().instantiate_with_code( + 0u32.into(), + Weight::from_parts(2_000, 2_000).into(), + 10000000u32.into(), + DUMMY_BYTES.to_vec(), + vec![], + None, + ); + + let res = client + .tx() + .sign_and_submit_default_then_watch(&tx_payload, &SrcChainSigner(dev::alice())) + .await? + .wait_for_finalized_success() + .await?; + println!("Transaction finalized: {:?}", res.extrinsic_hash()); + + Ok(()) +} diff --git a/rpc/examples/rpc-playground.rs b/rpc/examples/rpc-playground.rs index de5af7d..6ada8bb 100644 --- a/rpc/examples/rpc-playground.rs +++ b/rpc/examples/rpc-playground.rs @@ -1,29 +1,29 @@ -use eth_rpc::example::Account; -use eth_rpc::EthRpcClient; -use eth_rpc_api::BlockTag; +use eth_rpc::{example::Account, EthRpcClient}; use jsonrpsee::http_client::HttpClientBuilder; +use polkadot_sdk::pallet::revive_evm::BlockTag; #[tokio::main] async fn main() -> anyhow::Result<()> { - let account = Account::default(); - println!("Account address: {:?}", account.address()); + let data = hex_literal::hex!("0xf86b800184254ac125947bf369283338e12c90514468aa3868a551ab29298898a7d9b8314c0000808204cba0d82f7414276d8c4925f69c1b1c2507be08973e03ea2cdf5d2cae86610929cbe2a0033f3f7e1dad86b3e2cb466abe41a1658c7247f5ac4cbe237d47564bf990139e"); + let tx = rlp::decode::(&data).unwrap(); + dbg!(tx); - let client = HttpClientBuilder::default().build("http://localhost:9090".to_string())?; + let account = Account::default(); + println!("Account address: {:?}", account.address()); - let block = client - .get_block_by_number(BlockTag::Latest.into(), false) - .await?; - println!("Latest block: {block:#?}"); + let client = HttpClientBuilder::default().build("http://localhost:9090".to_string())?; - let nonce = client - .get_transaction_count(account.address(), BlockTag::Latest.into()) - .await?; - println!("Account nonce: {nonce:?}"); + let block = client.get_block_by_number(BlockTag::Latest.into(), false).await?; + println!("Latest block: {block:#?}"); - let balance = client - .get_balance(account.address(), BlockTag::Latest.into()) - .await?; - println!("Account balance: {balance:?}"); + let nonce = client.get_transaction_count(account.address(), BlockTag::Latest.into()).await?; + println!("Account nonce: {nonce:?}"); - Ok(()) + let balance = client.get_balance(account.address(), BlockTag::Latest.into()).await?; + println!("Account balance: {balance:?}"); + + Ok(()) } +//method: eth_sendRawTransaction params: +// ["0xf86b800184254ac125947bf369283338e12c90514468aa3868a551ab29298898a7d9b8314c0000808204cba0d82f7414276d8c4925f69c1b1c2507be08973e03ea2cdf5d2cae86610929cbe2a0033f3f7e1dad86b3e2cb466abe41a1658c7247f5ac4cbe237d47564bf990139e" +// ], diff --git a/rpc/examples/transfer.rs b/rpc/examples/transfer.rs index aaf98f8..f363ca0 100644 --- a/rpc/examples/transfer.rs +++ b/rpc/examples/transfer.rs @@ -1,37 +1,31 @@ -use eth_rpc::example::Account; -use eth_rpc::EthRpcClient; -use eth_rpc_api::{BlockTag, Bytes, H160}; +use eth_rpc::{example::Account, EthRpcClient}; use hex_literal::hex; use jsonrpsee::http_client::HttpClientBuilder; +use polkadot_sdk::pallet_revive::evm::{BlockTag, Bytes, H160}; #[tokio::main] async fn main() -> anyhow::Result<()> { - let account = Account::default(); - println!("Account address: {:?}", account.address()); + let account = Account::default(); + println!("Account address: {:?}", account.address()); - let client = HttpClientBuilder::default().build("http://localhost:9090".to_string())?; + let client = HttpClientBuilder::default().build("http://localhost:9090".to_string())?; - let balance = client - .get_balance(account.address(), BlockTag::Latest.into()) - .await?; - println!("Account balance: {:?}", balance); + let balance = client.get_balance(account.address(), BlockTag::Latest.into()).await?; + println!("Account balance: {:?}", balance); - let to = Some(H160(hex!("c543bb3eF11d96aCA20b3c906cF2C8Daaff925e4"))); - let value = 10_000_000_000_000_000_000u128.into(); // 10 ETH + let to = Some(H160(hex!("c543bb3eF11d96aCA20b3c906cF2C8Daaff925e4"))); + let value = 10_000_000_000_000_000_000u128.into(); // 10 ETH + println!("\n\n=== Transferring ===\n\n"); - let hash = account - .send_transaction(&client, value, Bytes::default(), to) - .await?; - println!("Transaction hash: {hash:?}"); + let hash = account.send_transaction(&client, value, Bytes::default(), to).await?; + println!("Transaction hash: {hash:?}"); - tokio::time::sleep(std::time::Duration::from_secs(2)).await; - let receipt = client.get_transaction_receipt(hash).await; - println!("Receipt: {receipt:?}"); + tokio::time::sleep(std::time::Duration::from_secs(2)).await; + let receipt = client.get_transaction_receipt(hash).await; + println!("Receipt: {receipt:?}"); - let balance = client - .get_balance(account.address(), BlockTag::Latest.into()) - .await?; - println!("Account balance: {:?}", balance); + let balance = client.get_balance(account.address(), BlockTag::Latest.into()).await?; + println!("Account balance: {:?}", balance); - Ok(()) + Ok(()) } diff --git a/rpc/metadata.scale b/rpc/metadata.scale index 0d24e4e..ffd5662 100644 Binary files a/rpc/metadata.scale and b/rpc/metadata.scale differ diff --git a/rpc/src/client.rs b/rpc/src/client.rs index 5a1d97e..5012d14 100644 --- a/rpc/src/client.rs +++ b/rpc/src/client.rs @@ -1,47 +1,66 @@ //! The client connects to the source substrate chain //! and is used by the rpc server to query and send transactions to the substrate chain. -use eth_rpc_api::{ - adapters::DryRunInfo, BlockNumberOrTag, BlockNumberOrTagOrHash, Bytes256, GenericTransaction, - ReceiptInfo, H160, H256, U256, +#![allow(unused_imports, unused_variables)] +use crate::{ + rlp, + subxt_client::{ + revive::calls::types::EthTransact, + runtime_types::{frame_system::EventRecord, revive_runtime::RuntimeEvent}, + }, + TransactionLegacySigned, LOG_TARGET, }; +use codec::{Decode, Encode}; use futures::{stream, StreamExt}; use jsonrpsee::types::{ErrorCode, ErrorObjectOwned}; -use parity_scale_codec::{Decode, Encode}; -use polkadot_sdk::polkadot_sdk_frame::{prelude::Weight, traits::Hash}; +use polkadot_sdk::{ + pallet_revive::{ + create1, + evm::{ + Block, BlockNumberOrTag, BlockNumberOrTagOrHash, Bytes256, GenericTransaction, + ReceiptInfo, TransactionSigned, H160, H256, U256, + }, + ContractResult, EthContractResult, EthInstantiateInput, + }, + sp_runtime::traits::Hash, + sp_weights::Weight, +}; use std::{ - collections::{HashMap, VecDeque}, - sync::Arc, - time::Duration, + collections::{HashMap, VecDeque}, + sync::Arc, + time::Duration, }; use subxt::{ - backend::{ - legacy::LegacyRpcMethods, - rpc::{ - reconnecting_rpc_client::{Client as ReconnectingRpcClient, ExponentialBackoff}, - RpcClient, - }, - }, - config::Header, - error::RpcError, - storage::Storage, - tx::TxClient, - utils::AccountId32, - Config, OnlineClient, + backend::{ + legacy::LegacyRpcMethods, + rpc::{ + reconnecting_rpc_client::{Client as ReconnectingRpcClient, ExponentialBackoff}, + RpcClient, + }, + }, + config::{signed_extensions::CheckNonce, Header}, + error::RpcError, + storage::Storage, + tx::TxClient, + utils::AccountId32, + Config, OnlineClient, }; use subxt_client::transaction_payment::events::TransactionFeePaid; use thiserror::Error; use tokio::{ - sync::{watch::Sender, RwLock}, - task::JoinSet, + sync::{watch::Sender, RwLock}, + task::JoinSet, }; -use crate::subxt_client::{ - self, - contracts_evm::calls::types::{EthCall, EthInstantiate}, - system::events::ExtrinsicSuccess, - SrcChainConfig, -}; +use crate::subxt_client::{self, system::events::ExtrinsicSuccess, SrcChainConfig}; + +pub mod primitives { + use polkadot_sdk::sp_core::H160; + pub type Hashing = polkadot_sdk::sp_runtime::traits::BlakeTwo256; + pub type AccountId = polkadot_sdk::sp_runtime::AccountId32; + pub type AccountIndex = u32; + pub type MultiAddress = polkadot_sdk::sp_runtime::MultiAddress; +} /// The substrate block type. pub type SubstrateBlock = subxt::blocks::Block>; @@ -61,132 +80,73 @@ pub type Balance = u128; /// The EVM gas price. /// We use a fixed value for the gas price. /// This let us calculate the gas estimate for a transaction with the formula: -/// `gas_estimate = substrate_fee / gas_price`. +/// `estimate_gas = substrate_fee / gas_price`. pub const GAS_PRICE: u128 = 1u128; /// The cache maintains a buffer of the last N blocks, #[derive(Default)] struct BlockCache { - /// A double-ended queue of the last N blocks. - /// The most recent block is at the back of the queue, and the oldest block is at the front. - buffer: VecDeque>, + /// A double-ended queue of the last N blocks. + /// The most recent block is at the back of the queue, and the oldest block is at the front. + buffer: VecDeque>, - /// A map of blocks by block number. - blocks_by_number: HashMap>, + /// A map of blocks by block number. + blocks_by_number: HashMap>, - /// A map of blocks by block hash. - blocks_by_hash: HashMap>, + /// A map of blocks by block hash. + blocks_by_hash: HashMap>, - /// A map of receipts by hash. - receipts_by_hash: HashMap, + /// A map of receipts by hash. + receipts_by_hash: HashMap, - /// A map of receipt hashes by block hash. - receipt_hashes_by_block_and_index: HashMap>, -} - -/// The `pallet_contracts_evm` extrinsics. -#[derive(Debug)] -enum EvmExtrinsic { - /// The `pallet_contracts_evm::call` extrinsic. - Instantiate { - payload: EthInstantiate, - address_bytes: Vec, - }, - - /// The `pallet_contracts_evm::instantiate` extrinsic. - Call(EthCall), -} - -/// The receipt info extracted from an extrinsic. -struct ExtrinsicReceiptInfo { - from: H160, - to: Option, - contract_address: Option, - gas_price: u64, -} + /// A map of Signed transaction by hash. + signed_tx_by_hash: HashMap, -impl EvmExtrinsic { - /// Extract the receipt info from the extrinsic. - fn into_receipt_info(self) -> Option { - match self { - EvmExtrinsic::Call(call) => Some(ExtrinsicReceiptInfo { - from: call.source?, - to: Some(call.to), - contract_address: None, - gas_price: call.eth_gas_price, - }), - EvmExtrinsic::Instantiate { - payload, - address_bytes, - } => { - // Calculate the contract address from the payload - let code_hash = primitives::Hashing::hash(&payload.code); - let address = primitives::MultiAddress::decode(&mut address_bytes.as_ref()).ok()?; - let address: primitives::AccountId = match address { - primitives::MultiAddress::Id(id) => id, - _ => return None, - }; - let contract_address = primitives::evm_contract_address( - &address, - &code_hash, - &payload.data, - &payload.salt, - ); - - log::debug!("Add Contract receipt at address: {contract_address:?}"); - - Some(ExtrinsicReceiptInfo { - from: payload.source?, - to: None, - contract_address: Some(contract_address), - gas_price: payload.eth_gas_price, - }) - } - } - } + /// A map of receipt hashes by block hash. + tx_hashes_by_block_and_index: HashMap>, } /// The error type for the client. #[derive(Error, Debug)] pub enum ClientError { - /// A [`subxt::Error`] wrapper error. - #[error("Subxt error: {0}")] - SubxtError(#[from] subxt::Error), - /// A [`RpcError`] wrapper error. - #[error("RPC error: {0}")] - RpcError(#[from] RpcError), - /// A [`parity_scale_codec::Error`] wrapper error. - #[error("Codec error: {0}")] - CodecError(#[from] parity_scale_codec::Error), - /// The dry run failed. - #[error("Dry run failed")] - DryRunFailed, - /// A decimal conversion failed. - #[error("Conversion failed")] - ConversionFailed, - /// The block hash was not found. - #[error("Hash not found")] - BlockNotFound, - /// The transaction fee could not be found - #[error("TransactionFeePaid event not found")] - TxFeeNotFound, - /// The token decimals property was not found - #[error("tokenDecimals not found in properties")] - TokenDecimalsNotFound, - /// The cache is empty. - #[error("Cache is empty")] - CacheEmpty, + /// A [`subxt::Error`] wrapper error. + #[error("Subxt error: {0}")] + SubxtError(#[from] subxt::Error), + /// A [`RpcError`] wrapper error. + #[error("RPC error: {0}")] + RpcError(#[from] RpcError), + /// A [`codec::Error`] wrapper error. + #[error("Codec error: {0}")] + CodecError(#[from] codec::Error), + /// The dry run failed. + #[error("Dry run failed")] + DryRunFailed, + /// A decimal conversion failed. + #[error("Conversion failed")] + ConversionFailed, + /// The block hash was not found. + #[error("Hash not found")] + BlockNotFound, + /// The transaction fee could not be found + #[error("TransactionFeePaid event not found")] + TxFeeNotFound, + /// The token decimals property was not found + #[error("tokenDecimals not found in properties")] + TokenDecimalsNotFound, + /// The cache is empty. + #[error("Cache is empty")] + CacheEmpty, } // Convert a `ClientError` to an RPC `ErrorObjectOwned`. impl From for ErrorObjectOwned { - fn from(_value: ClientError) -> Self { - ErrorObjectOwned::owned::<()>( - ErrorCode::InternalError.code(), - ErrorCode::InternalError.message(), - None, - ) - } + fn from(_value: ClientError) -> Self { + ErrorObjectOwned::owned::<()>( + ErrorCode::InternalError.code(), + ErrorCode::InternalError.message(), + None, + ) + } } /// The number of recent blocks maintained by the cache. @@ -194,667 +154,590 @@ impl From for ErrorObjectOwned { pub const CACHE_SIZE: usize = 10; impl BlockCache { - fn latest_block(&self) -> Option<&Arc> { - self.buffer.back() - } - - /// Insert an entry into the cache, and prune the oldest entry if the cache is full. - fn insert(&mut self, block: SubstrateBlock) { - if self.buffer.len() >= N { - if let Some(block) = self.buffer.pop_front() { - log::trace!("Pruning block: {}", block.number()); - let hash = block.hash(); - self.blocks_by_hash.remove(&hash); - self.blocks_by_number.remove(&block.number()); - if let Some(entries) = self.receipt_hashes_by_block_and_index.remove(&hash) { - for hash in entries.values() { - self.receipts_by_hash.remove(hash); - } - } - } - } - - let block = Arc::new(block); - self.buffer.push_back(block.clone()); - self.blocks_by_number.insert(block.number(), block.clone()); - self.blocks_by_hash.insert(block.hash(), block); - } + fn latest_block(&self) -> Option<&Arc> { + self.buffer.back() + } + + /// Insert an entry into the cache, and prune the oldest entry if the cache is full. + fn insert(&mut self, block: SubstrateBlock) { + if self.buffer.len() >= N { + if let Some(block) = self.buffer.pop_front() { + log::trace!(target: LOG_TARGET, "Pruning block: {}", block.number()); + let hash = block.hash(); + self.blocks_by_hash.remove(&hash); + self.blocks_by_number.remove(&block.number()); + if let Some(entries) = self.tx_hashes_by_block_and_index.remove(&hash) { + for hash in entries.values() { + self.receipts_by_hash.remove(hash); + } + } + } + } + + let block = Arc::new(block); + self.buffer.push_back(block.clone()); + self.blocks_by_number.insert(block.number(), block.clone()); + self.blocks_by_hash.insert(block.hash(), block); + } } /// A client connect to a node and maintains a cache of the last `CACHE_SIZE` blocks. pub struct Client { - inner: Arc, - join_set: JoinSet>, - /// A watch channel to signal cache updates. - pub updates: tokio::sync::watch::Receiver<()>, + inner: Arc, + join_set: JoinSet>, + /// A watch channel to signal cache updates. + pub updates: tokio::sync::watch::Receiver<()>, } /// The inner state of the client. struct ClientInner { - api: OnlineClient, - rpc_client: ReconnectingRpcClient, - rpc: LegacyRpcMethods, - cache: Shared>, - chain_id: u64, - max_block_weight: Weight, - native_to_evm_ratio: U256, + api: OnlineClient, + rpc_client: ReconnectingRpcClient, + rpc: LegacyRpcMethods, + cache: Shared>, + chain_id: u64, + max_block_weight: Weight, + native_to_evm_ratio: U256, } impl ClientInner { - /// Create a new client instance connecting to the substrate node at the given URL. - async fn from_url(url: &str) -> Result { - let rpc_client = ReconnectingRpcClient::builder() - .retry_policy(ExponentialBackoff::from_millis(100).max_delay(Duration::from_secs(10))) - .build(url.to_string()) - .await?; - - let api = OnlineClient::::from_rpc_client(rpc_client.clone()).await?; - let cache = Arc::new(RwLock::new(BlockCache::::default())); - - let rpc = LegacyRpcMethods::::new(RpcClient::new(rpc_client.clone())); - - let (native_to_evm_ratio, chain_id, max_block_weight) = tokio::try_join!( - native_to_evm_ratio(&rpc), - chain_id(&api), - max_block_weight(&api) - )?; - - Ok(Self { - api, - rpc_client, - rpc, - cache, - chain_id, - max_block_weight, - native_to_evm_ratio, - }) - } - - /// Convert a native balance to an EVM balance. - pub fn native_to_evm_decimals(&self, value: U256) -> U256 { - value.saturating_mul(self.native_to_evm_ratio) - } - - /// Get the receipt infos from the extrinsics in a block. - async fn receipt_infos( - &self, - block: &SubstrateBlock, - ) -> Result, ClientError> { - // Get extrinsics from the block - let extrinsics = block.extrinsics().await?; - - // Filter extrinsics that are pallet_contracts_evm - let extrinsics = extrinsics.iter().flat_map(|ext| { - let ext = ext.ok()?; - - let payload: EvmExtrinsic = - if let Ok(Some(payload)) = ext.as_extrinsic::() { - EvmExtrinsic::Instantiate { - payload, - address_bytes: ext.address_bytes()?.into(), - } - } else if let Ok(Some(payload)) = ext.as_extrinsic::() { - EvmExtrinsic::Call(payload) - } else { - return None; - }; - Some((payload.into_receipt_info()?, ext)) - }); - - // Map each extrinsic to a receipt - stream::iter(extrinsics) - .map( - |( - ExtrinsicReceiptInfo { - from, - to, - contract_address, - gas_price, - }, - ext, - )| async move { - let events = ext.events().await?; - let tx_fees = events - .find_first::()? - .ok_or(ClientError::TxFeeNotFound)?; - - let gas_used = (tx_fees.tip.saturating_add(tx_fees.actual_fee)) - .checked_div(gas_price as _) - .unwrap_or_default(); - - let success = events.find_first::().is_ok(); - let transaction_index = ext.index(); - let transaction_hash = - primitives::Hashing::hash(&Vec::from(ext.bytes()).encode()); - let block_hash = block.hash(); - let block_number = block.number().into(); - - let receipt = ReceiptInfo { - block_hash, - block_number, - contract_address, - effective_gas_price: gas_price.into(), - from, - gas_used: gas_used.into(), - to, - status: Some(if success { U256::one() } else { U256::zero() }), - transaction_hash, - transaction_index: transaction_index.into(), - ..Default::default() - }; - - Ok::<_, ClientError>((receipt.transaction_hash, receipt)) - }, - ) - .buffer_unordered(10) - .collect::>>() - .await - .into_iter() - .collect::, _>>() - } + /// Create a new client instance connecting to the substrate node at the given URL. + async fn from_url(url: &str) -> Result { + let rpc_client = ReconnectingRpcClient::builder() + .retry_policy(ExponentialBackoff::from_millis(100).max_delay(Duration::from_secs(10))) + .build(url.to_string()) + .await?; + + let api = OnlineClient::::from_rpc_client(rpc_client.clone()).await?; + let cache = Arc::new(RwLock::new(BlockCache::::default())); + + let rpc = LegacyRpcMethods::::new(RpcClient::new(rpc_client.clone())); + + let (native_to_evm_ratio, chain_id, max_block_weight) = + tokio::try_join!(native_to_evm_ratio(&rpc), chain_id(&api), max_block_weight(&api))?; + + Ok(Self { api, rpc_client, rpc, cache, chain_id, max_block_weight, native_to_evm_ratio }) + } + + /// Convert a native balance to an EVM balance. + pub fn native_to_evm_decimals(&self, value: U256) -> U256 { + value.saturating_mul(self.native_to_evm_ratio) + } + + /// Get the receipt infos from the extrinsics in a block. + async fn receipt_infos( + &self, + block: &SubstrateBlock, + ) -> Result, ClientError> { + // Get extrinsics from the block + let extrinsics = block.extrinsics().await?; + + // Filter extrinsics from pallet_revive + let extrinsics = extrinsics.iter().flat_map(|ext| { + let ext = ext.ok()?; + + let call = ext.as_extrinsic::().ok()??; + let tx = rlp::decode::(&call.payload).ok()?; + let from = tx.recover_eth_address().ok()?; + let contract_address = if tx.transaction_legacy_unsigned.to.is_none() { + Some(create1(&from, tx.transaction_legacy_unsigned.nonce.try_into().ok()?)) + } else { + None + }; + + Some((from, tx, contract_address, ext)) + }); + + // Map each extrinsic to a receipt + stream::iter(extrinsics) + .map(|(from, tx, contract_address, ext)| async move { + let events = ext.events().await?; + let tx_fees = + events.find_first::()?.ok_or(ClientError::TxFeeNotFound)?; + + let gas_price = tx.transaction_legacy_unsigned.gas_price; + let gas_used = (tx_fees.tip.saturating_add(tx_fees.actual_fee)) + .checked_div(gas_price.as_u128()) + .unwrap_or_default(); + + let success = events.find_first::().is_ok(); + let transaction_index = ext.index(); + let transaction_hash = primitives::Hashing::hash(&Vec::from(ext.bytes()).encode()); + let block_hash = block.hash(); + let block_number = block.number().into(); + + let receipt = ReceiptInfo { + block_hash, + block_number, + contract_address, + from, + to: tx.transaction_legacy_unsigned.to, + effective_gas_price: gas_price, + gas_used: gas_used.into(), + status: Some(if success { U256::one() } else { U256::zero() }), + transaction_hash, + transaction_index: transaction_index.into(), + ..Default::default() + }; + + Ok::<_, ClientError>((receipt.transaction_hash, (tx.into(), receipt))) + }) + .buffer_unordered(10) + .collect::>>() + .await + .into_iter() + .collect::, _>>() + } } /// Drop all the tasks spawned by the client on drop. impl Drop for Client { - fn drop(&mut self) { - self.join_set.abort_all() - } + fn drop(&mut self) { + self.join_set.abort_all() + } } /// Fetch the chain ID from the substrate chain. async fn chain_id(api: &OnlineClient) -> Result { - let query = subxt_client::constants().contracts_evm().chain_id(); - api.constants().at(&query).map_err(|err| err.into()) + let query = subxt_client::constants().revive().chain_id(); + api.constants().at(&query).map_err(|err| err.into()) } /// Fetch the max block weight from the substrate chain. async fn max_block_weight(api: &OnlineClient) -> Result { - let query = subxt_client::constants().system().block_weights(); - let weights = api.constants().at(&query)?; - let max_block = weights - .per_class - .normal - .max_extrinsic - .unwrap_or(weights.max_block); - Ok(Weight::from_parts(max_block.ref_time, max_block.proof_size)) + let query = subxt_client::constants().system().block_weights(); + let weights = api.constants().at(&query)?; + let max_block = weights.per_class.normal.max_extrinsic.unwrap_or(weights.max_block); + Ok(max_block.0) } /// Fetch the native to EVM ratio from the substrate chain. async fn native_to_evm_ratio(rpc: &LegacyRpcMethods) -> Result { - let props = rpc.system_properties().await?; - let eth_decimals = U256::from(18u32); - let native_decimals: U256 = props - .get("tokenDecimals") - .and_then(|v| v.as_number()?.as_u64()) - .ok_or(ClientError::TokenDecimalsNotFound)? - .into(); - - Ok(U256::from(10u32).pow(eth_decimals - native_decimals)) + let props = rpc.system_properties().await?; + let eth_decimals = U256::from(18u32); + let native_decimals: U256 = props + .get("tokenDecimals") + .and_then(|v| v.as_number()?.as_u64()) + .ok_or(ClientError::TokenDecimalsNotFound)? + .into(); + + Ok(U256::from(10u32).pow(eth_decimals - native_decimals)) } /// Extract the block timestamp. async fn extract_block_timestamp(block: &SubstrateBlock) -> Option { - let extrinsics = block.extrinsics().await.ok()?; - let ext = extrinsics - .find_first::() - .ok()??; + let extrinsics = block.extrinsics().await.ok()?; + let ext = extrinsics + .find_first::() + .ok()??; - Some(ext.value.now / 1000) + Some(ext.value.now / 1000) } impl Client { - /// Create a new client instance. - /// The client will subscribe to new blocks and maintain a cache of [`CACHE_SIZE`] blocks. - pub async fn from_url(url: &str) -> Result { - log::info!("Connecting to node at: {url} ..."); - let inner: Arc = Arc::new(ClientInner::from_url(url).await?); - log::info!("Connected to node at: {url}"); - - let (tx, mut updates) = tokio::sync::watch::channel(()); - let mut join_set = JoinSet::new(); - join_set.spawn(Self::subscribe_blocks(inner.clone(), tx)); - join_set.spawn(Self::subscribe_reconnect(inner.clone())); - - updates.changed().await.expect("tx is not dropped"); - Ok(Self { - inner, - join_set, - updates, - }) - } - - /// Subscribe and log reconnection events. - async fn subscribe_reconnect(inner: Arc) -> Result<(), ClientError> { - let rpc = inner.as_ref().rpc_client.clone(); - loop { - let reconnected = rpc.reconnect_initiated().await; - log::info!("RPC client connection lost"); - let now = std::time::Instant::now(); - reconnected.await; - log::info!( - "RPC client reconnection took `{}s`", - now.elapsed().as_secs() - ); - } - } - - /// Subscribe to new blocks and update the cache. - async fn subscribe_blocks(inner: Arc, tx: Sender<()>) -> Result<(), ClientError> { - log::info!("Subscribing to new blocks"); - let mut block_stream = inner - .as_ref() - .api - .blocks() - .subscribe_finalized() - .await - .inspect_err(|err| { - log::error!("Failed to subscribe to blocks: {err:?}"); - })?; - - while let Some(block) = block_stream.next().await { - let block = match block { - Ok(block) => block, - Err(err) => { - if err.is_disconnected_will_reconnect() { - log::warn!( - "The RPC connection was lost and we may have missed a few blocks" - ); - continue; - } - - log::error!("Failed to fetch block: {err:?}"); - return Err(err.into()); - } - }; - - log::debug!("Pushing block: {}", block.number()); - let mut cache = inner.cache.write().await; - - let receipts = inner.receipt_infos(&block).await.inspect_err(|err| { - log::error!("Failed to get receipts: {err:?}"); - })?; - - if !receipts.is_empty() { - log::debug!("Adding {} receipts", receipts.len()); - let values = receipts - .iter() - .map(|(hash, receipt)| (receipt.transaction_index, *hash)) - .collect::>(); - cache.receipts_by_hash.extend(receipts); - cache - .receipt_hashes_by_block_and_index - .insert(block.hash(), values); - } - - cache.insert(block); - tx.send_replace(()); - } - - log::info!("Block subscription ended"); - Ok(()) - } - - /// Get the most recent block stored in the cache. - pub async fn latest_block(&self) -> Option> { - let cache = self.inner.cache.read().await; - let block = cache.latest_block()?; - Some(block.clone()) - } - - /// Expose the transaction API. - pub fn tx(&self) -> TxClient> { - self.inner.api.tx() - } - - /// Get an EVM transaction receipt by hash. - pub async fn receipt(&self, tx_hash: &H256) -> Option { - let cache = self.inner.cache.read().await; - cache.receipts_by_hash.get(tx_hash).cloned() - } - - /// Get an EVM transaction receipt by hash. - pub async fn receipt_by_hash_and_index( - &self, - block_hash: &H256, - transaction_index: &U256, - ) -> Option { - let cache = self.inner.cache.read().await; - let receipt_hash = cache - .receipt_hashes_by_block_and_index - .get(block_hash)? - .get(transaction_index)?; - let receipt = cache.receipts_by_hash.get(receipt_hash)?; - Some(receipt.clone()) - } - - /// Get receipts count per block. - pub async fn receipts_count_per_block(&self, block_hash: &SubstrateBlockHash) -> Option { - let cache = self.inner.cache.read().await; - cache - .receipt_hashes_by_block_and_index - .get(block_hash) - .map(|v| v.len()) - } - - /// Expose the storage API. - pub async fn storage_api( - &self, - at: &BlockNumberOrTagOrHash, - ) -> Result>, ClientError> { - match at { - BlockNumberOrTagOrHash::U256(block_number) => { - let n: SubstrateBlockNumber = (*block_number) - .try_into() - .map_err(|_| ClientError::ConversionFailed)?; - - let hash = self - .get_block_hash(n) - .await? - .ok_or(ClientError::BlockNotFound)?; - Ok(self.inner.api.storage().at(hash)) - } - BlockNumberOrTagOrHash::H256(hash) => Ok(self.inner.api.storage().at(*hash)), - BlockNumberOrTagOrHash::BlockTag(_) => { - if let Some(block) = self.latest_block().await { - return Ok(self.inner.api.storage().at(block.hash())); - } - let storage = self.inner.api.storage().at_latest().await?; - Ok(storage) - } - } - } - - /// Expose the runtime API. - pub async fn runtime_api( - &self, - at: &BlockNumberOrTagOrHash, - ) -> Result< - subxt::runtime_api::RuntimeApi>, - ClientError, - > { - match at { - BlockNumberOrTagOrHash::U256(block_number) => { - let n: SubstrateBlockNumber = (*block_number) - .try_into() - .map_err(|_| ClientError::ConversionFailed)?; - - let hash = self - .get_block_hash(n) - .await? - .ok_or(ClientError::BlockNotFound)?; - Ok(self.inner.api.runtime_api().at(hash)) - } - BlockNumberOrTagOrHash::H256(hash) => Ok(self.inner.api.runtime_api().at(*hash)), - BlockNumberOrTagOrHash::BlockTag(_) => { - if let Some(block) = self.latest_block().await { - return Ok(self.inner.api.runtime_api().at(block.hash())); - } - - let api = self.inner.api.runtime_api().at_latest().await?; - Ok(api) - } - } - } - - /// Get the balance of the given address. - pub async fn balance( - &self, - address: H160, - at: &BlockNumberOrTagOrHash, - ) -> Result { - let account_id = self.account_id(&address); - let query = subxt_client::storage().system().account(account_id); - let Some(account) = self.storage_api(at).await?.fetch(&query).await? else { - return Ok(U256::zero()); - }; - - let native = account.data.free.into(); - Ok(self.inner.native_to_evm_decimals(native)) - } - - /// Helper function to dry run a transaction. - async fn do_dry_run( - runtime_api: &subxt::runtime_api::RuntimeApi>, - tx: &GenericTransaction, - ) -> Result< - crate::subxt_client::src_chain::runtime_types::eth_rpc_api::adapters::DryRunInfo, - ClientError, - > { - // TODO Remove encode/decode hack to convert to subxt generated type - use crate::subxt_client::runtime_types::eth_rpc_api::rpc_types; - let tx = rpc_types::GenericTransaction::decode(&mut tx.encode().as_slice()).unwrap(); - - let payload = subxt_client::apis().contracts_evm_api().gas_estimate(tx); - let result = runtime_api.call(payload).await?.map_err(|err| { - log::debug!("Failed to dry_run: {err:?}"); - ClientError::DryRunFailed - })?; - - Ok(result) - } - - /// Get the contract storage for the given contract address and key. - pub async fn get_contract_storage( - &self, - contract_address: H160, - key: U256, - block: BlockNumberOrTagOrHash, - ) -> Result, ClientError> { - let runtime_api = self.runtime_api(&block).await?; - - let account_id = self.account_id(&contract_address); - let mut bytes = vec![0u8; 32]; - key.to_big_endian(&mut bytes); - let payload = subxt_client::apis() - .contracts_api() - .get_storage(account_id, bytes); - let result = runtime_api - .call(payload) - .await? - .unwrap_or_default() - .unwrap_or_default(); - Ok(result) - } - - /// Get the contract code for the given contract address. - pub async fn get_contract_code( - &self, - contract_address: &H160, - block: BlockNumberOrTagOrHash, - ) -> Result, ClientError> { - let storage_api = self.storage_api(&block).await?; - let account_id = self.account_id(contract_address); - let code_hash: H256 = account_id.0.into(); - let query = subxt_client::storage().contracts().pristine_code(code_hash); - let result = storage_api - .fetch(&query) - .await? - .map(|v| v.0) - .unwrap_or_default(); - Ok(result) - } - - /// Dry run a transaction and returns the [`DryRunInfo`] for the transaction. - pub async fn dry_run( - &self, - tx: &GenericTransaction, - block: BlockNumberOrTagOrHash, - ) -> Result, ClientError> { - let runtime_api = self.runtime_api(&block).await?; - let result = Self::do_dry_run(&runtime_api, tx).await?; - - Ok(DryRunInfo { - gas_limit: Weight::from_parts(result.gas_limit.ref_time, result.gas_limit.proof_size), - storage_deposit_limit: result.storage_deposit_limit, - return_data: result.return_data, - }) - } - - /// Dry run a transaction and returns the gas estimate for the transaction. - pub async fn gas_estimate( - &self, - tx: &GenericTransaction, - block: BlockNumberOrTagOrHash, - ) -> Result { - let runtime_api = self.runtime_api(&block).await?; - let result = Self::do_dry_run(&runtime_api, tx).await?; - let fee = Self::weight_to_fee( - &runtime_api, - Weight::from_parts(result.gas_limit.ref_time, result.gas_limit.proof_size), - ) - .await?; - - let total_fee = fee + result.storage_deposit_limit.unwrap_or_default(); - Ok(U256::from(total_fee / GAS_PRICE) + 1) - } - - /// Get the nonce of the given address. - pub async fn nonce( - &self, - address: H160, - block: BlockNumberOrTagOrHash, - ) -> Result { - let account_id = self.account_id(&address); - let storage = self.storage_api(&block).await?; - let query = subxt_client::storage().system().account(account_id); - let Some(account) = storage.fetch(&query).await? else { - return Ok(0); - }; - - Ok(account.nonce) - } - - /// Get the block number of the latest block. - pub async fn block_number(&self) -> Result { - let cache = self.inner.cache.read().await; - let latest_block = cache.buffer.back().ok_or(ClientError::CacheEmpty)?; - Ok(latest_block.number()) - } - - /// Get a block hash for the given block number. - pub async fn get_block_hash( - &self, - block_number: SubstrateBlockNumber, - ) -> Result, ClientError> { - let cache = self.inner.cache.read().await; - if let Some(block) = cache.blocks_by_number.get(&block_number) { - return Ok(Some(block.hash())); - } - - let hash = self - .inner - .rpc - .chain_get_block_hash(Some(block_number.into())) - .await?; - Ok(hash) - } - - /// Get a block for the specified hash or number. - pub async fn block_by_number_or_tag( - &self, - block: &BlockNumberOrTag, - ) -> Result>, ClientError> { - match block { - BlockNumberOrTag::U256(n) => { - let n = (*n).try_into().map_err(|_| ClientError::ConversionFailed)?; - self.block_by_number(n).await - } - BlockNumberOrTag::BlockTag(_) => { - let cache = self.inner.cache.read().await; - Ok(cache.buffer.back().cloned()) - } - } - } - - /// Get a block by hash - pub async fn block_by_hash( - &self, - hash: &SubstrateBlockHash, - ) -> Result>, ClientError> { - let cache = self.inner.cache.read().await; - if let Some(block) = cache.blocks_by_hash.get(hash) { - return Ok(Some(block.clone())); - } - - match self.inner.api.blocks().at(*hash).await { - Ok(block) => Ok(Some(Arc::new(block))), - Err(subxt::Error::Block(subxt::error::BlockError::NotFound(_))) => Ok(None), - Err(err) => Err(err.into()), - } - } - - /// Get a block by number - pub async fn block_by_number( - &self, - block_number: SubstrateBlockNumber, - ) -> Result>, ClientError> { - let cache = self.inner.cache.read().await; - if let Some(block) = cache.blocks_by_number.get(&block_number) { - return Ok(Some(block.clone())); - } - - let Some(hash) = self.get_block_hash(block_number).await? else { - return Ok(None); - }; - - self.block_by_hash(&hash).await - } - - /// Get the EVM block for the given hash. - pub async fn evm_block( - &self, - block: Arc, - ) -> Result { - let runtime_api = self.inner.api.runtime_api().at(block.hash()); - let max_fee = Self::weight_to_fee(&runtime_api, self.max_block_weight()).await?; - let gas_limit = U256::from(max_fee / GAS_PRICE); - - let header = block.header(); - let timestamp = extract_block_timestamp(&block).await.unwrap_or_default(); - Ok(eth_rpc_api::Block { - hash: block.hash(), - parent_hash: header.parent_hash, - state_root: header.state_root, - transactions_root: header.extrinsics_root, - number: header.number.into(), - timestamp: timestamp.into(), - gas_limit, - logs_bloom: Bytes256([0u8; 256]), - receipts_root: header.extrinsics_root, - ..Default::default() - }) - } - - /// Convert a weight to a fee. - async fn weight_to_fee( - runtime_api: &subxt::runtime_api::RuntimeApi>, - weight: Weight, - ) -> Result { - use crate::subxt_client::runtime_apis::transaction_payment_api::types::query_weight_to_fee; - let payload = subxt_client::apis() - .transaction_payment_api() - .query_weight_to_fee(query_weight_to_fee::Weight { - ref_time: weight.ref_time(), - proof_size: weight.proof_size(), - }); - - let fee = runtime_api.call(payload).await?; - Ok(fee) - } - - /// Get the substrate account ID from the EVM address. - pub fn account_id(&self, address: &H160) -> AccountId32 { - let account_id = primitives::get_account_id(address); - AccountId32(account_id.into()) - } - - /// Get the chain ID. - pub fn chain_id(&self) -> u64 { - self.inner.chain_id - } - - /// Get the Max Block Weight. - pub fn max_block_weight(&self) -> Weight { - self.inner.max_block_weight - } + /// Create a new client instance. + /// The client will subscribe to new blocks and maintain a cache of [`CACHE_SIZE`] blocks. + pub async fn from_url(url: &str) -> Result { + log::info!(target: LOG_TARGET, "Connecting to node at: {url} ..."); + let inner: Arc = Arc::new(ClientInner::from_url(url).await?); + log::info!(target: LOG_TARGET, "Connected to node at: {url}"); + + let (tx, mut updates) = tokio::sync::watch::channel(()); + let mut join_set = JoinSet::new(); + join_set.spawn(Self::subscribe_blocks(inner.clone(), tx)); + join_set.spawn(Self::subscribe_reconnect(inner.clone())); + + updates.changed().await.expect("tx is not dropped"); + Ok(Self { inner, join_set, updates }) + } + + /// Subscribe and log reconnection events. + async fn subscribe_reconnect(inner: Arc) -> Result<(), ClientError> { + let rpc = inner.as_ref().rpc_client.clone(); + loop { + let reconnected = rpc.reconnect_initiated().await; + log::info!("RPC client connection lost"); + let now = std::time::Instant::now(); + reconnected.await; + log::info!("RPC client reconnection took `{}s`", now.elapsed().as_secs()); + } + } + + /// Subscribe to new blocks and update the cache. + async fn subscribe_blocks(inner: Arc, tx: Sender<()>) -> Result<(), ClientError> { + log::info!("Subscribing to new blocks"); + let mut block_stream = + inner.as_ref().api.blocks().subscribe_finalized().await.inspect_err(|err| { + log::error!("Failed to subscribe to blocks: {err:?}"); + })?; + + while let Some(block) = block_stream.next().await { + let block = match block { + Ok(block) => block, + Err(err) => { + if err.is_disconnected_will_reconnect() { + log::warn!( + "The RPC connection was lost and we may have missed a few blocks" + ); + continue; + } + + log::error!("Failed to fetch block: {err:?}"); + return Err(err.into()); + }, + }; + + log::debug!("Pushing block: {}", block.number()); + let mut cache = inner.cache.write().await; + + let receipts = inner + .receipt_infos(&block) + .await + .inspect_err(|err| { + log::error!("Failed to get receipts: {err:?}"); + }) + .unwrap_or_default(); + + if !receipts.is_empty() { + log::debug!("Adding {} receipts", receipts.len()); + let values = receipts + .iter() + .map(|(hash, (_, receipt))| (receipt.transaction_index, *hash)) + .collect::>(); + + cache.tx_hashes_by_block_and_index.insert(block.hash(), values); + + cache + .receipts_by_hash + .extend(receipts.iter().map(|(hash, (_, receipt))| (*hash, receipt.clone()))); + + cache.signed_tx_by_hash.extend( + receipts.iter().map(|(hash, (signed_tx, _))| (*hash, signed_tx.clone())), + ) + } + + cache.insert(block); + tx.send_replace(()); + } + + log::info!("Block subscription ended"); + Ok(()) + } + + /// Get the most recent block stored in the cache. + pub async fn latest_block(&self) -> Option> { + let cache = self.inner.cache.read().await; + let block = cache.latest_block()?; + Some(block.clone()) + } + + /// Expose the transaction API. + pub fn tx(&self) -> TxClient> { + self.inner.api.tx() + } + + /// Get an EVM transaction receipt by hash. + pub async fn receipt(&self, tx_hash: &H256) -> Option { + let cache = self.inner.cache.read().await; + cache.receipts_by_hash.get(tx_hash).cloned() + } + + /// Get an EVM transaction receipt by hash. + pub async fn receipt_by_hash_and_index( + &self, + block_hash: &H256, + transaction_index: &U256, + ) -> Option { + let cache = self.inner.cache.read().await; + let receipt_hash = + cache.tx_hashes_by_block_and_index.get(block_hash)?.get(transaction_index)?; + let receipt = cache.receipts_by_hash.get(receipt_hash)?; + Some(receipt.clone()) + } + + pub async fn signed_tx_by_hash(&self, tx_hash: &H256) -> Option { + let cache = self.inner.cache.read().await; + cache.signed_tx_by_hash.get(tx_hash).cloned() + } + + /// Get receipts count per block. + pub async fn receipts_count_per_block(&self, block_hash: &SubstrateBlockHash) -> Option { + let cache = self.inner.cache.read().await; + cache.tx_hashes_by_block_and_index.get(block_hash).map(|v| v.len()) + } + + /// Expose the storage API. + pub async fn storage_api( + &self, + at: &BlockNumberOrTagOrHash, + ) -> Result>, ClientError> { + match at { + BlockNumberOrTagOrHash::U256(block_number) => { + let n: SubstrateBlockNumber = + (*block_number).try_into().map_err(|_| ClientError::ConversionFailed)?; + + let hash = self.get_block_hash(n).await?.ok_or(ClientError::BlockNotFound)?; + Ok(self.inner.api.storage().at(hash)) + }, + BlockNumberOrTagOrHash::H256(hash) => Ok(self.inner.api.storage().at(*hash)), + BlockNumberOrTagOrHash::BlockTag(_) => { + if let Some(block) = self.latest_block().await { + return Ok(self.inner.api.storage().at(block.hash())); + } + let storage = self.inner.api.storage().at_latest().await?; + Ok(storage) + }, + } + } + + /// Expose the runtime API. + pub async fn runtime_api( + &self, + at: &BlockNumberOrTagOrHash, + ) -> Result< + subxt::runtime_api::RuntimeApi>, + ClientError, + > { + match at { + BlockNumberOrTagOrHash::U256(block_number) => { + let n: SubstrateBlockNumber = + (*block_number).try_into().map_err(|_| ClientError::ConversionFailed)?; + + let hash = self.get_block_hash(n).await?.ok_or(ClientError::BlockNotFound)?; + Ok(self.inner.api.runtime_api().at(hash)) + }, + BlockNumberOrTagOrHash::H256(hash) => Ok(self.inner.api.runtime_api().at(*hash)), + BlockNumberOrTagOrHash::BlockTag(_) => { + if let Some(block) = self.latest_block().await { + return Ok(self.inner.api.runtime_api().at(block.hash())); + } + + let api = self.inner.api.runtime_api().at_latest().await?; + Ok(api) + }, + } + } + + /// Get the balance of the given address. + pub async fn balance( + &self, + address: H160, + at: &BlockNumberOrTagOrHash, + ) -> Result { + let account_id = self.account_id(&address); + let query = subxt_client::storage().system().account(account_id); + let Some(account) = self.storage_api(at).await?.fetch(&query).await? else { + return Ok(U256::zero()); + }; + + let native = account.data.free.into(); + Ok(self.inner.native_to_evm_decimals(native)) + } + + /// Get the contract storage for the given contract address and key. + pub async fn get_contract_storage( + &self, + contract_address: H160, + key: U256, + block: BlockNumberOrTagOrHash, + ) -> Result, ClientError> { + let runtime_api = self.runtime_api(&block).await?; + + let mut bytes = [0u8; 32]; + key.to_big_endian(&mut bytes); + + let payload = subxt_client::apis().revive_api().get_storage(contract_address, bytes); + let result = runtime_api.call(payload).await?.unwrap_or_default().unwrap_or_default(); + Ok(result) + } + + /// Get the contract code for the given contract address. + pub async fn get_contract_code( + &self, + contract_address: &H160, + block: BlockNumberOrTagOrHash, + ) -> Result, ClientError> { + let storage_api = self.storage_api(&block).await?; + let account_id = self.account_id(contract_address); + let code_hash: H256 = account_id.0.into(); + let query = subxt_client::storage().revive().pristine_code(code_hash); + let result = storage_api.fetch(&query).await?.map(|v| v.0).unwrap_or_default(); + Ok(result) + } + + /// Dry run a transaction and returns the [`DryRunInfo`] for the transaction. + pub async fn dry_run( + &self, + tx: &GenericTransaction, + block: BlockNumberOrTagOrHash, + ) -> Result, ClientError> { + let runtime_api = self.runtime_api(&block).await?; + let from = tx.from.ok_or(ClientError::DryRunFailed)?; + let value = tx + .value + .unwrap_or_default() + .try_into() + .map_err(|_| ClientError::ConversionFailed)?; + + let payload = subxt_client::apis().revive_api().eth_transact( + from, + tx.to, + value, + tx.input.clone().unwrap_or_default().0, + None, + None, + ); + let res = runtime_api.call(payload).await?.0; + Ok(res) + } + + /// Dry run a transaction and returns the gas estimate for the transaction. + pub async fn estimate_gas( + &self, + tx: &GenericTransaction, + block: BlockNumberOrTagOrHash, + ) -> Result { + let dry_run = self.dry_run(tx, block).await?; + Ok(U256::from(dry_run.fee / GAS_PRICE) + 1) + } + + /// Get the nonce of the given address. + pub async fn nonce( + &self, + address: H160, + block: BlockNumberOrTagOrHash, + ) -> Result { + let account_id = self.account_id(&address); + let storage = self.storage_api(&block).await?; + let query = subxt_client::storage().system().account(account_id); + let Some(account) = storage.fetch(&query).await? else { + return Ok(0); + }; + + Ok(account.nonce) + } + + /// Get the block number of the latest block. + pub async fn block_number(&self) -> Result { + let cache = self.inner.cache.read().await; + let latest_block = cache.buffer.back().ok_or(ClientError::CacheEmpty)?; + Ok(latest_block.number()) + } + + /// Get a block hash for the given block number. + pub async fn get_block_hash( + &self, + block_number: SubstrateBlockNumber, + ) -> Result, ClientError> { + let cache = self.inner.cache.read().await; + if let Some(block) = cache.blocks_by_number.get(&block_number) { + return Ok(Some(block.hash())); + } + + let hash = self.inner.rpc.chain_get_block_hash(Some(block_number.into())).await?; + Ok(hash) + } + + /// Get a block for the specified hash or number. + pub async fn block_by_number_or_tag( + &self, + block: &BlockNumberOrTag, + ) -> Result>, ClientError> { + match block { + BlockNumberOrTag::U256(n) => { + let n = (*n).try_into().map_err(|_| ClientError::ConversionFailed)?; + self.block_by_number(n).await + }, + BlockNumberOrTag::BlockTag(_) => { + let cache = self.inner.cache.read().await; + Ok(cache.buffer.back().cloned()) + }, + } + } + + /// Get a block by hash + pub async fn block_by_hash( + &self, + hash: &SubstrateBlockHash, + ) -> Result>, ClientError> { + let cache = self.inner.cache.read().await; + if let Some(block) = cache.blocks_by_hash.get(hash) { + return Ok(Some(block.clone())); + } + + match self.inner.api.blocks().at(*hash).await { + Ok(block) => Ok(Some(Arc::new(block))), + Err(subxt::Error::Block(subxt::error::BlockError::NotFound(_))) => Ok(None), + Err(err) => Err(err.into()), + } + } + + /// Get a block by number + pub async fn block_by_number( + &self, + block_number: SubstrateBlockNumber, + ) -> Result>, ClientError> { + let cache = self.inner.cache.read().await; + if let Some(block) = cache.blocks_by_number.get(&block_number) { + return Ok(Some(block.clone())); + } + + let Some(hash) = self.get_block_hash(block_number).await? else { + return Ok(None); + }; + + self.block_by_hash(&hash).await + } + + /// Get the EVM block for the given hash. + pub async fn evm_block(&self, block: Arc) -> Result { + let runtime_api = self.inner.api.runtime_api().at(block.hash()); + let max_fee = Self::weight_to_fee(&runtime_api, self.max_block_weight()).await?; + let gas_limit = U256::from(max_fee / GAS_PRICE); + + let header = block.header(); + let timestamp = extract_block_timestamp(&block).await.unwrap_or_default(); + Ok(Block { + hash: block.hash(), + parent_hash: header.parent_hash, + state_root: header.state_root, + transactions_root: header.extrinsics_root, + number: header.number.into(), + timestamp: timestamp.into(), + gas_limit, + logs_bloom: Bytes256([0u8; 256]), + receipts_root: header.extrinsics_root, + ..Default::default() + }) + } + + /// Convert a weight to a fee. + async fn weight_to_fee( + runtime_api: &subxt::runtime_api::RuntimeApi>, + weight: Weight, + ) -> Result { + let payload = subxt_client::apis() + .transaction_payment_api() + .query_weight_to_fee(weight.into()); + + let fee = runtime_api.call(payload).await?; + Ok(fee) + } + + /// Get the substrate account ID from the EVM address. + pub fn account_id(&self, address: &H160) -> AccountId32 { + let mut id: [u8; 32] = [0xEE; 32]; + id[..20].copy_from_slice(address.as_bytes()); + AccountId32(id) + } + + /// Get the chain ID. + pub fn chain_id(&self) -> u64 { + self.inner.chain_id + } + + /// Get the Max Block Weight. + pub fn max_block_weight(&self) -> Weight { + self.inner.max_block_weight + } } diff --git a/rpc/src/example.rs b/rpc/src/example.rs index d360c87..bd5501b 100644 --- a/rpc/src/example.rs +++ b/rpc/src/example.rs @@ -1,106 +1,116 @@ //! Example utilities #![cfg(feature = "example")] -use std::str::FromStr; - -use crate::rpc_methods::EthRpcClient; use anyhow::Context; -use eth_rpc_api::{ - rlp::*, BlockTag, Bytes, GenericTransaction, TransactionLegacySigned, - TransactionLegacyUnsigned, H160, H256, U256, -}; use jsonrpsee::http_client::HttpClient; -use polkadot_sdk::sp_core::keccak_256; +use polkadot_sdk::{ + pallet_revive::evm::{ + rlp::*, BlockTag, Bytes, EthRpcClient, GenericTransaction, TransactionLegacySigned, + TransactionLegacyUnsigned, H160, H256, U256, + }, + sp_core::keccak_256, +}; use secp256k1::{Message, PublicKey, Secp256k1, SecretKey}; +use std::str::FromStr; /// A simple account that can sign transactions pub struct Account { - /// The secret key of the account - sk: SecretKey, + /// The secret key of the account + sk: SecretKey, } impl Default for Account { - fn default() -> Self { - Account { - sk: SecretKey::from_str( - "a872f6cbd25a0e04a08b1e21098017a9e6194d101d75e13111f71410c59cd57f", - ) - .unwrap(), - } - } + fn default() -> Self { + Account { + sk: SecretKey::from_str( + "a872f6cbd25a0e04a08b1e21098017a9e6194d101d75e13111f71410c59cd57f", + ) + .unwrap(), + } + } } impl Account { - /// Get the [`H160`] address of the account. - pub fn address(&self) -> H160 { - let pub_key = - PublicKey::from_secret_key(&Secp256k1::new(), &self.sk).serialize_uncompressed(); - let hash = keccak_256(&pub_key[1..]); - H160::from_slice(&hash[12..]) - } + /// Create an account from a keypair. + pub fn from_keypair(pair: &subxt_signer::ecdsa::Keypair) -> Self { + let sb = pair.0.secret_key().secret_bytes(); + Account { sk: SecretKey::from_slice(&sb).unwrap() } + } + + /// Get the [`H160`] address of the account. + pub fn address(&self) -> H160 { + let pub_key = + PublicKey::from_secret_key(&Secp256k1::new(), &self.sk).serialize_uncompressed(); + let hash = keccak_256(&pub_key[1..]); + H160::from_slice(&hash[12..]) + } + + /// Sign a transaction. + pub fn sign_transaction(&self, tx: TransactionLegacyUnsigned) -> TransactionLegacySigned { + let rlp_encoded = tx.rlp_bytes(); + let tx_hash = keccak_256(&rlp_encoded); + let secp = Secp256k1::new(); + let msg = Message::from_digest(tx_hash); + let sig = secp.sign_ecdsa_recoverable(&msg, &self.sk); + let (recovery_id, sig) = sig.serialize_compact(); + let sig = sig.into_iter().chain([recovery_id.to_i32() as u8]).collect::>(); + TransactionLegacySigned::from(tx, &sig.try_into().unwrap()) + } - /// Sign a transaction. - pub fn sign_transaction(&self, tx: TransactionLegacyUnsigned) -> TransactionLegacySigned { - let rlp_encoded = tx.rlp_bytes(); - let tx_hash = keccak_256(&rlp_encoded); - let secp = Secp256k1::new(); - let msg = Message::from_digest(tx_hash); - let sig = secp.sign_ecdsa_recoverable(&msg, &self.sk); - TransactionLegacySigned::from(tx, sig) - } + /// Send a transaction. + pub async fn send_transaction( + &self, + client: &HttpClient, + value: U256, + input: Bytes, + to: Option, + ) -> anyhow::Result { + let from = self.address(); - /// Send a transaction. - pub async fn send_transaction( - &self, - client: &HttpClient, - value: U256, - input: Bytes, - to: Option, - ) -> anyhow::Result { - let from = self.address(); + let chain_id = Some(client.chain_id().await?); - let chain_id = Some(client.chain_id().await?); + let gas_price = client.gas_price().await?; + let nonce = client + .get_transaction_count(from, BlockTag::Latest.into()) + .await + .with_context(|| "Failed to fetch account nonce")?; - let gas_price = client.gas_price().await?; - let nonce = client - .get_transaction_count(from, BlockTag::Latest.into()) - .await - .with_context(|| "Failed to fetch account nonce")?; + let gas = client + .estimate_gas( + GenericTransaction { + from: Some(from), + input: Some(input.clone()), + value: Some(value), + gas_price: Some(gas_price), + to, + ..Default::default() + }, + None, + ) + .await + .with_context(|| "Failed to fetch gas estimate")?; - let gas = client - .estimate_gas( - GenericTransaction { - from: Some(from), - input: Some(input.clone()), - value: Some(value), - gas_price: Some(gas_price), - to, - ..Default::default() - }, - None, - ) - .await - .with_context(|| "Failed to fetch gas estimate")?; + println!("Estimated Gas: {gas:?}"); - let unsigned_tx = TransactionLegacyUnsigned { - gas, - nonce, - to, - value, - input, - gas_price, - chain_id, - ..Default::default() - }; + let unsigned_tx = TransactionLegacyUnsigned { + gas, + nonce, + to, + value, + input, + gas_price, + chain_id, + ..Default::default() + }; - let tx = self.sign_transaction(unsigned_tx.clone()); - let bytes = tx.rlp_bytes().to_vec(); + let tx = self.sign_transaction(unsigned_tx.clone()); + let bytes = tx.rlp_bytes().to_vec(); - let hash = client - .send_raw_transaction(bytes.clone().into()) - .await - .with_context(|| "transaction failed")?; + let hash = client + .send_raw_transaction(bytes.clone().into()) + .await + .with_context(|| "transaction failed")?; - Ok(hash) - } + Ok(hash) + } } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 500ee7f..33c5168 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -1,396 +1,297 @@ //! The [`EthRpcServer`] RPC server implementation -#![warn(missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg))] -use adapters::CallInput; use client::{ClientError, GAS_PRICE}; use jsonrpsee::{ - core::{async_trait, RpcResult}, - proc_macros::rpc, - types::{ErrorCode, ErrorObjectOwned}, + core::{async_trait, RpcResult}, + proc_macros::rpc, + types::{ErrorCode, ErrorObjectOwned}, +}; +pub use polkadot_sdk::{ + pallet_revive::{evm::*, EthContractResult, EthTransactReturnValue}, + sp_core::{H160, H256, U256}, }; -use parity_scale_codec::Decode; -use primitives::MultiSignature; -use subxt::{config::DefaultExtrinsicParamsBuilder, tx::Signer, utils::MultiAddress}; -use subxt_client::{runtime_types::sp_weights::weight_v2::Weight, SrcChainConfig}; use thiserror::Error; pub mod client; pub mod example; - -mod rpc_methods; -pub use rpc_methods::*; - pub mod subxt_client; mod tests; -use eth_rpc_api::*; +pub const LOG_TARGET: &str = "eth-rpc"; /// Additional RPC methods, exposed on the RPC server on top of all the eth_xxx methods. #[rpc(server, client)] pub trait MiscRpc { - /// Returns the health status of the server. - #[method(name = "healthcheck")] - async fn healthcheck(&self) -> RpcResult<()>; + /// Returns the health status of the server. + #[method(name = "healthcheck")] + async fn healthcheck(&self) -> RpcResult<()>; } /// An EVM RPC server implementation. pub struct EthRpcServerImpl { - client: client::Client, + client: client::Client, } impl EthRpcServerImpl { - /// Creates a new [`EthRpcServerImpl`]. - pub fn new(client: client::Client) -> Self { - Self { client } - } + /// Creates a new [`EthRpcServerImpl`]. + pub fn new(client: client::Client) -> Self { + Self { client } + } } /// The error type for the EVM RPC server. #[derive(Error, Debug)] pub enum EthRpcError { - /// A [`ClientError`] wrapper error. - #[error("Client error: {0}")] - ClientError(#[from] ClientError), - /// A [`rlp::DecoderError`] wrapper error. - #[error("Decoding error: {0}")] - RlpError(#[from] rlp::DecoderError), - /// A Decimals conversion error. - #[error("Conversion error")] - ConversionError, - /// An invalid signature error. - #[error("Invalid signature")] - InvalidSignature, - /// The account was not found at the given address - #[error("Account not found for address {0:?}")] - AccountNotFound(H160), + /// A [`ClientError`] wrapper error. + #[error("Client error: {0}")] + ClientError(#[from] ClientError), + /// A [`rlp::DecoderError`] wrapper error. + #[error("Decoding error: {0}")] + RlpError(#[from] rlp::DecoderError), + /// A Decimals conversion error. + #[error("Conversion error")] + ConversionError, + /// An invalid signature error. + #[error("Invalid signature")] + InvalidSignature, + /// The account was not found at the given address + #[error("Account not found for address {0:?}")] + AccountNotFound(H160), } impl From for ErrorObjectOwned { - fn from(value: EthRpcError) -> Self { - let code = match value { - EthRpcError::ClientError(_) => ErrorCode::InternalError, - _ => ErrorCode::InvalidRequest, - }; - Self::owned::(code.code(), value.to_string(), None) - } + fn from(value: EthRpcError) -> Self { + let code = match value { + EthRpcError::ClientError(_) => ErrorCode::InternalError, + _ => ErrorCode::InvalidRequest, + }; + Self::owned::(code.code(), value.to_string(), None) + } } #[async_trait] impl EthRpcServer for EthRpcServerImpl { - async fn net_version(&self) -> RpcResult { - Ok(self.client.chain_id().to_string()) - } - - async fn block_number(&self) -> RpcResult { - let number = self.client.block_number().await?; - log::debug!("block_number: {number:?}"); - Ok(number.into()) - } - - async fn get_transaction_receipt( - &self, - transaction_hash: H256, - ) -> RpcResult> { - let receipt = self.client.receipt(&transaction_hash).await; - log::debug!("receipt: {receipt:#?}"); - Ok(receipt) - } - - async fn estimate_gas( - &self, - transaction: GenericTransaction, - _block: Option, - ) -> RpcResult { - let result = self - .client - .gas_estimate(&transaction, BlockTag::Latest.into()) - .await?; - log::debug!("estimate_gas: for {transaction:#?} result = {result:?}"); - Ok(result) - } - - async fn send_raw_transaction(&self, transaction: Bytes) -> RpcResult { - let tx = rlp::decode::(&transaction.0).map_err(|err| { - log::debug!("Failed to decode transaction: {err:?}"); - EthRpcError::from(err) - })?; - - log::debug!("Decoded tx: {tx:?}"); - let eth_addr = tx.recover_eth_address().map_err(|err| { - log::debug!("Failed to recover eth address: {err:?}"); - EthRpcError::InvalidSignature - })?; - - let signature = MultiSignature::Ethereum(tx.raw_signature().map_err(|err| { - log::debug!("Failed to extract signature: {err:?}"); - EthRpcError::InvalidSignature - })?); - - let TransactionLegacyUnsigned { - to, - input, - value, - nonce, - gas_price: eth_gas_price, - gas: eth_gas_limit, - .. - } = tx.transaction_legacy_unsigned; - - let limits = self - .client - .dry_run( - &GenericTransaction { - from: Some(eth_addr), - input: Some(input.clone()), - nonce: Some(nonce), - to, - value: Some(value), - ..Default::default() - }, - BlockTag::Latest.into(), - ) - .await?; - - let gas_limit = Weight { - ref_time: limits.gas_limit.ref_time(), - proof_size: limits.gas_limit.proof_size(), - }; - - let storage_deposit_limit = limits.storage_deposit_limit.map(|limit| limit.into()); - let account_id = self.client.account_id(ð_addr); - let params = DefaultExtrinsicParamsBuilder::default().build(); - let signer = EthSigner { - account_id, - signature, - }; - - let hash = if let Some(to) = to { - let call = subxt_client::tx().contracts_evm().eth_call( - Some(eth_addr), - to, - input.0, - value.try_into().map_err(|_| { - log::debug!("Failed to convert call value: {value} to u64."); - EthRpcError::ConversionError - })?, - eth_gas_price.try_into().map_err(|_| { - log::debug!("Failed to convert call gas_price: {eth_gas_price} to u64."); - EthRpcError::ConversionError - })?, - eth_gas_limit.try_into().map_err(|_| { - log::debug!("Failed to convert call gas_limit: {eth_gas_limit} to u128."); - EthRpcError::ConversionError - })?, - gas_limit, - storage_deposit_limit, - ); - - self.client - .tx() - .sign_and_submit(&call, &signer, params) - .await - .map_err(|err| EthRpcError::ClientError(err.into()))? - } else { - let CallInput { code, data, salt } = - CallInput::decode(&mut &input.0[..]).map_err(|err| { - log::debug!("Failed to decode input: {err:?}"); - ClientError::from(err) - })?; - - let call = subxt_client::tx().contracts_evm().eth_instantiate( - Some(eth_addr), - code, - data, - salt, - value.try_into().map_err(|_| { - log::debug!("Failed to convert instantiate value: {value} to Balance."); - EthRpcError::ConversionError - })?, - eth_gas_price.try_into().map_err(|_| { - log::debug!( - "Failed to convert instantiate gas_price {eth_gas_price} to Balance." - ); - EthRpcError::ConversionError - })?, - eth_gas_limit.try_into().map_err(|_| { - log::debug!("Failed to convert instantiate gas_limit {eth_gas_limit} to u128."); - EthRpcError::ConversionError - })?, - gas_limit, - storage_deposit_limit, - ); - - self.client - .tx() - .sign_and_submit(&call, &signer, params) - .await - .map_err(|err| { - log::debug!("Failed to submit instantiate call: {err:?}"); - EthRpcError::ClientError(err.into()) - })? - }; - - log::debug!("send_raw_transaction succeed with hash: {hash}"); - Ok(hash) - } - - async fn get_block_by_hash( - &self, - block_hash: H256, - _hydrated_transactions: bool, - ) -> RpcResult> { - let Some(block) = self.client.block_by_hash(&block_hash).await? else { - return Ok(None); - }; - let block = self.client.evm_block(block).await?; - Ok(Some(block)) - } - - async fn get_balance( - &self, - address: Address, - block: BlockNumberOrTagOrHash, - ) -> RpcResult { - let balance = self.client.balance(address, &block).await?; - log::debug!("balance({address}): {balance:?}"); - Ok(balance) - } - - async fn chain_id(&self) -> RpcResult { - Ok(self.client.chain_id().into()) - } - - async fn gas_price(&self) -> RpcResult { - Ok(U256::from(GAS_PRICE)) - } - - async fn get_code(&self, address: Address, block: BlockNumberOrTagOrHash) -> RpcResult { - let code = self.client.get_contract_code(&address, block).await?; - Ok(code.into()) - } - - async fn accounts(&self) -> RpcResult> { - Ok(vec![]) - } - - async fn call( - &self, - transaction: GenericTransaction, - block: Option, - ) -> RpcResult { - let info = self - .client - .dry_run( - &transaction, - block.unwrap_or_else(|| BlockTag::Latest.into()), - ) - .await?; - Ok(info.return_data.into()) - } - - async fn get_block_by_number( - &self, - block: BlockNumberOrTag, - _hydrated_transactions: bool, - ) -> RpcResult> { - let Some(block) = self.client.block_by_number_or_tag(&block).await? else { - return Ok(None); - }; - let block = self.client.evm_block(block).await?; - Ok(Some(block)) - } - - async fn get_block_transaction_count_by_hash( - &self, - block_hash: Option, - ) -> RpcResult> { - let block_hash = if let Some(block_hash) = block_hash { - block_hash - } else { - self.client - .latest_block() - .await - .ok_or(ClientError::BlockNotFound)? - .hash() - }; - Ok(self - .client - .receipts_count_per_block(&block_hash) - .await - .map(U256::from)) - } - - async fn get_block_transaction_count_by_number( - &self, - block: Option, - ) -> RpcResult> { - let Some(block) = self - .get_block_by_number(block.unwrap_or_else(|| BlockTag::Latest.into()), false) - .await? - else { - return Ok(None); - }; - - Ok(self - .client - .receipts_count_per_block(&block.hash) - .await - .map(U256::from)) - } - - async fn get_storage_at( - &self, - address: Address, - storage_slot: U256, - block: BlockNumberOrTagOrHash, - ) -> RpcResult { - let bytes = self - .client - .get_contract_storage(address, storage_slot, block) - .await?; - Ok(bytes.into()) - } - - async fn get_transaction_by_block_hash_and_index( - &self, - block_hash: H256, - transaction_index: U256, - ) -> RpcResult> { - let receipt = self - .client - .receipt_by_hash_and_index(&block_hash, &transaction_index) - .await; - Ok(receipt.map(Into::into)) - } - - async fn get_transaction_by_block_number_and_index( - &self, - block: BlockNumberOrTag, - transaction_index: U256, - ) -> RpcResult> { - let Some(block) = self.client.block_by_number_or_tag(&block).await? else { - return Ok(None); - }; - self.get_transaction_by_block_hash_and_index(block.hash(), transaction_index) - .await - } - - async fn get_transaction_by_hash( - &self, - transaction_hash: H256, - ) -> RpcResult> { - let receipt = self.client.receipt(&transaction_hash).await; - Ok(receipt.map(Into::into)) - } - - async fn get_transaction_count( - &self, - address: Address, - block: BlockNumberOrTagOrHash, - ) -> RpcResult { - let nonce = self.client.nonce(address, block).await?; - Ok(nonce.into()) - } + async fn net_version(&self) -> RpcResult { + Ok(self.client.chain_id().to_string()) + } + + async fn block_number(&self) -> RpcResult { + let number = self.client.block_number().await?; + Ok(number.into()) + } + + async fn get_transaction_receipt( + &self, + transaction_hash: H256, + ) -> RpcResult> { + let receipt = self.client.receipt(&transaction_hash).await; + Ok(receipt) + } + + async fn estimate_gas( + &self, + transaction: GenericTransaction, + _block: Option, + ) -> RpcResult { + let result = self.client.estimate_gas(&transaction, BlockTag::Latest.into()).await?; + Ok(result) + } + + async fn send_raw_transaction(&self, transaction: Bytes) -> RpcResult { + let tx = rlp::decode::(&transaction.0).map_err(|err| { + log::debug!(target: LOG_TARGET, "Failed to decode transaction: {err:?}"); + EthRpcError::from(err) + })?; + + let eth_addr = tx.recover_eth_address().map_err(|err| { + log::debug!(target: LOG_TARGET, "Failed to recover eth address: {err:?}"); + EthRpcError::InvalidSignature + })?; + + // Dry run the transaction to get the weight limit and storage deposit limit + let TransactionLegacyUnsigned { to, input, value, .. } = tx.transaction_legacy_unsigned; + let dry_run = self + .client + .dry_run( + &GenericTransaction { + from: Some(eth_addr), + input: Some(input.clone()), + to, + value: Some(value), + ..Default::default() + }, + BlockTag::Latest.into(), + ) + .await?; + + let EthContractResult { kind, gas_limit, storage_deposit, .. } = dry_run; + let call = subxt_client::tx().revive().eth_transact( + transaction.0, + gas_limit.into(), + storage_deposit, + kind.into(), + ); + let ext = self.client.tx().create_unsigned(&call).map_err(|err| ClientError::from(err))?; + let hash = ext.submit().await.map_err(|err| EthRpcError::ClientError(err.into()))?; + + Ok(hash) + } + + async fn get_block_by_hash( + &self, + block_hash: H256, + _hydrated_transactions: bool, + ) -> RpcResult> { + let Some(block) = self.client.block_by_hash(&block_hash).await? else { + return Ok(None); + }; + let block = self.client.evm_block(block).await?; + Ok(Some(block)) + } + + async fn get_balance( + &self, + address: Address, + block: BlockNumberOrTagOrHash, + ) -> RpcResult { + let balance = self.client.balance(address, &block).await?; + log::debug!(target: LOG_TARGET, "balance({address}): {balance:?}"); + Ok(balance) + } + + async fn chain_id(&self) -> RpcResult { + Ok(self.client.chain_id().into()) + } + + async fn gas_price(&self) -> RpcResult { + Ok(U256::from(GAS_PRICE)) + } + + async fn get_code(&self, address: Address, block: BlockNumberOrTagOrHash) -> RpcResult { + let code = self.client.get_contract_code(&address, block).await?; + Ok(code.into()) + } + + async fn accounts(&self) -> RpcResult> { + Ok(vec![]) + } + + async fn call( + &self, + transaction: GenericTransaction, + block: Option, + ) -> RpcResult { + let dry_run = self + .client + .dry_run(&transaction, block.unwrap_or_else(|| BlockTag::Latest.into())) + .await?; + let output = dry_run.result.map_err(|err| { + log::debug!(target: LOG_TARGET, "Dry run failed: {err:?}"); + ClientError::DryRunFailed + })?; + + Ok(output.into()) + } + + async fn get_block_by_number( + &self, + block: BlockNumberOrTag, + _hydrated_transactions: bool, + ) -> RpcResult> { + let Some(block) = self.client.block_by_number_or_tag(&block).await? else { + return Ok(None); + }; + let block = self.client.evm_block(block).await?; + Ok(Some(block)) + } + + async fn get_block_transaction_count_by_hash( + &self, + block_hash: Option, + ) -> RpcResult> { + let block_hash = if let Some(block_hash) = block_hash { + block_hash + } else { + self.client.latest_block().await.ok_or(ClientError::BlockNotFound)?.hash() + }; + Ok(self.client.receipts_count_per_block(&block_hash).await.map(U256::from)) + } + + async fn get_block_transaction_count_by_number( + &self, + block: Option, + ) -> RpcResult> { + let Some(block) = self + .get_block_by_number(block.unwrap_or_else(|| BlockTag::Latest.into()), false) + .await? + else { + return Ok(None); + }; + + Ok(self.client.receipts_count_per_block(&block.hash).await.map(U256::from)) + } + + async fn get_storage_at( + &self, + address: Address, + storage_slot: U256, + block: BlockNumberOrTagOrHash, + ) -> RpcResult { + let bytes = self.client.get_contract_storage(address, storage_slot, block).await?; + Ok(bytes.into()) + } + + async fn get_transaction_by_block_hash_and_index( + &self, + block_hash: H256, + transaction_index: U256, + ) -> RpcResult> { + let Some(receipt) = + self.client.receipt_by_hash_and_index(&block_hash, &transaction_index).await + else { + return Ok(None); + }; + + let Some(signed_tx) = self.client.signed_tx_by_hash(&receipt.transaction_hash).await else { + return Ok(None); + }; + + Ok(Some(TransactionInfo::new(receipt, signed_tx))) + } + + async fn get_transaction_by_block_number_and_index( + &self, + block: BlockNumberOrTag, + transaction_index: U256, + ) -> RpcResult> { + let Some(block) = self.client.block_by_number_or_tag(&block).await? else { + return Ok(None); + }; + self.get_transaction_by_block_hash_and_index(block.hash(), transaction_index) + .await + } + + async fn get_transaction_by_hash( + &self, + transaction_hash: H256, + ) -> RpcResult> { + let receipt = self.client.receipt(&transaction_hash).await; + let signed_tx = self.client.signed_tx_by_hash(&transaction_hash).await; + if let (Some(receipt), Some(signed_tx)) = (receipt, signed_tx) { + return Ok(Some(TransactionInfo::new(receipt, signed_tx))); + } + + Ok(None) + } + + async fn get_transaction_count( + &self, + address: Address, + block: BlockNumberOrTagOrHash, + ) -> RpcResult { + let nonce = self.client.nonce(address, block).await?; + Ok(nonce.into()) + } } /// A [`MiscRpcServer`] RPC server implementation. @@ -398,29 +299,7 @@ pub struct MiscRpcServerImpl; #[async_trait] impl MiscRpcServer for MiscRpcServerImpl { - async fn healthcheck(&self) -> RpcResult<()> { - Ok(()) - } -} - -/// A custom subxt [`Signer`] that simply provide the existing Ethereum signature. -/// Once is merged we can just use -/// a [`subxt::tx::PartialExtrinsic`] and call `sign_with_address_and_signature` on it. -struct EthSigner { - account_id: ::AccountId, - signature: ::Signature, -} - -impl Signer for EthSigner { - fn account_id(&self) -> ::AccountId { - self.account_id.clone() - } - - fn address(&self) -> ::Address { - MultiAddress::Id(self.account_id.clone()) - } - - fn sign(&self, _signer_payload: &[u8]) -> ::Signature { - self.signature.clone() - } + async fn healthcheck(&self) -> RpcResult<()> { + Ok(()) + } } diff --git a/rpc/src/main.rs b/rpc/src/main.rs index 9c9c838..0c76579 100644 --- a/rpc/src/main.rs +++ b/rpc/src/main.rs @@ -1,13 +1,13 @@ //! The Ethereum JSON-RPC server. -//! The API is generated in [`eth_rpc_api::EthRpcServer`] from the Ethereum specs and is use clap::Parser; use eth_rpc::{ - client::Client, EthRpcClient, EthRpcServer, EthRpcServerImpl, MiscRpcServer, MiscRpcServerImpl, + client::Client, EthRpcClient, EthRpcServer, EthRpcServerImpl, MiscRpcServer, MiscRpcServerImpl, + LOG_TARGET, }; use hyper::Method; use jsonrpsee::{ - http_client::HttpClientBuilder, - server::{RpcModule, Server}, + http_client::HttpClientBuilder, + server::{RpcModule, Server}, }; use std::net::SocketAddr; use tower_http::cors::{Any, CorsLayer}; @@ -17,108 +17,108 @@ use tracing_subscriber::{util::SubscriberInitExt, EnvFilter, FmtSubscriber}; #[derive(Parser)] #[clap(author, about, version)] struct CliCommand { - /// The server address to bind to - #[clap(long, default_value = "127.0.0.1:9090")] - url: String, + /// The server address to bind to + #[clap(long, default_value = "127.0.0.1:9090")] + url: String, - /// The node url to connect to - #[clap(long, default_value = "ws://127.0.0.1:9944")] - node_url: String, + /// The node url to connect to + #[clap(long, default_value = "ws://127.0.0.1:9944")] + node_url: String, } /// Initialize tracing fn init_tracing() { - let env_filter = - EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("eth_rpc=trace")); - - FmtSubscriber::builder() - .with_env_filter(env_filter) - .finish() - .try_init() - .expect("failed to initialize tracing"); + let env_filter = + EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("eth_rpc=trace")); + + FmtSubscriber::builder() + .with_env_filter(env_filter) + .finish() + .try_init() + .expect("failed to initialize tracing"); } #[tokio::main] async fn main() -> anyhow::Result<()> { - let CliCommand { url, node_url } = CliCommand::parse(); - init_tracing(); + let CliCommand { url, node_url } = CliCommand::parse(); + init_tracing(); - let client = Client::from_url(&node_url).await.unwrap(); - let mut updates = client.updates.clone(); + let client = Client::from_url(&node_url).await.unwrap(); + let mut updates = client.updates.clone(); - let server_addr = run_server(client, &url).await?; - log::info!("Server started on: {}", server_addr); + let server_addr = run_server(client, &url).await?; + log::info!(target: LOG_TARGET, "Server started on: {}", server_addr); - let url = format!("http://{}", server_addr); - let client = HttpClientBuilder::default().build(url)?; + let url = format!("http://{}", server_addr); + let client = HttpClientBuilder::default().build(url)?; - let response = client.block_number().await?; - log::info!("client initialized with block number {:?}", response); + let response = client.block_number().await?; + log::info!(target: LOG_TARGET, "client initialized with block number {:?}", response); - // keep running server until ctrl-c or client subscription fails - let _ = updates.wait_for(|_| false).await; - Ok(()) + // keep running server until ctrl-c or client subscription fails + let _ = updates.wait_for(|_| false).await; + Ok(()) } #[cfg(feature = "dev")] mod dev { - use futures::{future::BoxFuture, FutureExt}; - use jsonrpsee::{server::middleware::rpc::RpcServiceT, types::Request, MethodResponse}; - - /// Dev Logger middleware, that logs the method and params of the request, along with the success of the response. - #[derive(Clone)] - pub struct DevLogger(pub S); - - impl<'a, S> RpcServiceT<'a> for DevLogger - where - S: RpcServiceT<'a> + Send + Sync + Clone + 'static, - { - type Future = BoxFuture<'a, MethodResponse>; - - fn call(&self, req: Request<'a>) -> Self::Future { - let service = self.0.clone(); - let method = req.method.clone(); - let params = req.params.clone().unwrap_or_default(); - - async move { - let resp = service.call(req).await; - log::info!( - "method: {method} params: {params}, success: {}", - resp.is_success() - ); - resp - } - .boxed() - } - } + use crate::LOG_TARGET; + use futures::{future::BoxFuture, FutureExt}; + use jsonrpsee::{server::middleware::rpc::RpcServiceT, types::Request, MethodResponse}; + + /// Dev Logger middleware, that logs the method and params of the request, along with the + /// success of the response. + #[derive(Clone)] + pub struct DevLogger(pub S); + + impl<'a, S> RpcServiceT<'a> for DevLogger + where + S: RpcServiceT<'a> + Send + Sync + Clone + 'static, + { + type Future = BoxFuture<'a, MethodResponse>; + + fn call(&self, req: Request<'a>) -> Self::Future { + let service = self.0.clone(); + let method = req.method.clone(); + let params = req.params.clone().unwrap_or_default(); + + async move { + log::info!(target: LOG_TARGET, "method: {method} params: {params}"); + let resp = service.call(req).await; + log::info!(target: LOG_TARGET, "method: {method} success: {}", resp.is_success()); + resp + } + .boxed() + } + } } /// Starts the rpc server and returns the server address. async fn run_server(client: Client, url: &str) -> anyhow::Result { - let cors = CorsLayer::new() - .allow_methods([Method::POST]) - .allow_origin(Any) - .allow_headers([hyper::header::CONTENT_TYPE]); - let cors_middleware = tower::ServiceBuilder::new().layer(cors); + let cors = CorsLayer::new() + .allow_methods([Method::POST]) + .allow_origin(Any) + .allow_headers([hyper::header::CONTENT_TYPE]); + let cors_middleware = tower::ServiceBuilder::new().layer(cors); - let builder = Server::builder().set_http_middleware(cors_middleware); + let builder = Server::builder().set_http_middleware(cors_middleware); - #[cfg(feature = "dev")] - let builder = builder - .set_rpc_middleware(jsonrpsee::server::RpcServiceBuilder::new().layer_fn(dev::DevLogger)); + #[cfg(feature = "dev")] + let builder = builder + .set_rpc_middleware(jsonrpsee::server::RpcServiceBuilder::new().layer_fn(dev::DevLogger)); - let server = builder.build(url.parse::()?).await?; - let addr = server.local_addr()?; + let server = builder.build(url.parse::()?).await?; + let addr = server.local_addr()?; - let eth_api = EthRpcServerImpl::new(client).into_rpc(); - let misc_api = MiscRpcServerImpl.into_rpc(); + let eth_api = EthRpcServerImpl::new(client).into_rpc(); + let misc_api = MiscRpcServerImpl.into_rpc(); - let mut module = RpcModule::new(()); - module.merge(eth_api)?; - module.merge(misc_api)?; + let mut module = RpcModule::new(()); + module.merge(eth_api)?; + module.merge(misc_api)?; - let handle = server.start(module); - tokio::spawn(handle.stopped()); + let handle = server.start(module); + tokio::spawn(handle.stopped()); - Ok(addr) + Ok(addr) } diff --git a/rpc/src/rpc_methods.rs b/rpc/src/rpc_methods.rs deleted file mode 100644 index 8aa3ab8..0000000 --- a/rpc/src/rpc_methods.rs +++ /dev/null @@ -1,135 +0,0 @@ -//! Generated JSON-RPC methods. -#![allow(missing_docs)] - -use crate::*; -use jsonrpsee::core::RpcResult; -use jsonrpsee::proc_macros::rpc; - -#[rpc(server, client)] -pub trait EthRpc { - /// Returns a list of addresses owned by client. - #[method(name = "eth_accounts")] - async fn accounts(&self) -> RpcResult>; - - /// Returns the number of most recent block. - #[method(name = "eth_blockNumber")] - async fn block_number(&self) -> RpcResult; - - /// Executes a new message call immediately without creating a transaction on the block chain. - #[method(name = "eth_call")] - async fn call( - &self, - transaction: GenericTransaction, - block: Option, - ) -> RpcResult; - - /// Returns the chain ID of the current network. - #[method(name = "eth_chainId")] - async fn chain_id(&self) -> RpcResult; - - /// Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. - #[method(name = "eth_estimateGas")] - async fn estimate_gas( - &self, - transaction: GenericTransaction, - block: Option, - ) -> RpcResult; - - /// Returns the current price per gas in wei. - #[method(name = "eth_gasPrice")] - async fn gas_price(&self) -> RpcResult; - - /// Returns the balance of the account of given address. - #[method(name = "eth_getBalance")] - async fn get_balance(&self, address: Address, block: BlockNumberOrTagOrHash) - -> RpcResult; - - /// Returns information about a block by hash. - #[method(name = "eth_getBlockByHash")] - async fn get_block_by_hash( - &self, - block_hash: H256, - hydrated_transactions: bool, - ) -> RpcResult>; - - /// Returns information about a block by number. - #[method(name = "eth_getBlockByNumber")] - async fn get_block_by_number( - &self, - block: BlockNumberOrTag, - hydrated_transactions: bool, - ) -> RpcResult>; - - /// Returns the number of transactions in a block from a block matching the given block hash. - #[method(name = "eth_getBlockTransactionCountByHash")] - async fn get_block_transaction_count_by_hash( - &self, - block_hash: Option, - ) -> RpcResult>; - - /// Returns the number of transactions in a block matching the given block number. - #[method(name = "eth_getBlockTransactionCountByNumber")] - async fn get_block_transaction_count_by_number( - &self, - block: Option, - ) -> RpcResult>; - - /// Returns code at a given address. - #[method(name = "eth_getCode")] - async fn get_code(&self, address: Address, block: BlockNumberOrTagOrHash) -> RpcResult; - - /// Returns the value from a storage position at a given address. - #[method(name = "eth_getStorageAt")] - async fn get_storage_at( - &self, - address: Address, - storage_slot: U256, - block: BlockNumberOrTagOrHash, - ) -> RpcResult; - - /// Returns information about a transaction by block hash and transaction index position. - #[method(name = "eth_getTransactionByBlockHashAndIndex")] - async fn get_transaction_by_block_hash_and_index( - &self, - block_hash: H256, - transaction_index: U256, - ) -> RpcResult>; - - /// Returns information about a transaction by block number and transaction index position. - #[method(name = "eth_getTransactionByBlockNumberAndIndex")] - async fn get_transaction_by_block_number_and_index( - &self, - block: BlockNumberOrTag, - transaction_index: U256, - ) -> RpcResult>; - - /// Returns the information about a transaction requested by transaction hash. - #[method(name = "eth_getTransactionByHash")] - async fn get_transaction_by_hash( - &self, - transaction_hash: H256, - ) -> RpcResult>; - - /// Returns the number of transactions sent from an address. - #[method(name = "eth_getTransactionCount")] - async fn get_transaction_count( - &self, - address: Address, - block: BlockNumberOrTagOrHash, - ) -> RpcResult; - - /// Returns the receipt of a transaction by transaction hash. - #[method(name = "eth_getTransactionReceipt")] - async fn get_transaction_receipt( - &self, - transaction_hash: H256, - ) -> RpcResult>; - - /// Submits a raw transaction. For EIP-4844 transactions, the raw form must be the network form. This means it includes the blobs, KZG commitments, and KZG proofs. - #[method(name = "eth_sendRawTransaction")] - async fn send_raw_transaction(&self, transaction: Bytes) -> RpcResult; - - /// The string value of current network id - #[method(name = "net_version")] - async fn net_version(&self) -> RpcResult; -} diff --git a/rpc/src/subxt_client.rs b/rpc/src/subxt_client.rs index 9398595..0e1dca3 100644 --- a/rpc/src/subxt_client.rs +++ b/rpc/src/subxt_client.rs @@ -1,22 +1,45 @@ //! The generated subxt client. -use primitives::MultiSignature; -use subxt::config::{Config, PolkadotConfig, PolkadotExtrinsicParams}; +use subxt::config::{signed_extensions, Config, PolkadotConfig}; -#[allow(missing_docs)] -#[subxt::subxt(runtime_metadata_path = "metadata.scale")] +#[subxt::subxt( + runtime_metadata_path = "metadata.scale", + substitute_type( + path = "pallet_revive::primitives::EthContractResult", + with = "::subxt::utils::Static<::polkadot_sdk::pallet_revive::EthContractResult>" + ), + substitute_type( + path = "pallet_revive::primitives::EthTransactKind", + with = "::subxt::utils::Static<::polkadot_sdk::pallet_revive::EthTransactKind>" + ), + substitute_type( + path = "sp_weights::weight_v2::Weight", + with = "::subxt::utils::Static<::polkadot_sdk::sp_weights::Weight>" + ) +)] mod src_chain {} +pub use src_chain::*; /// The configuration for the source chain. pub enum SrcChainConfig {} impl Config for SrcChainConfig { - type Hash = ::Hash; - type AccountId = ::AccountId; - type Address = ::Address; - type Signature = MultiSignature; - type Hasher = ::Hasher; - type Header = ::Header; - type AssetId = ::AssetId; - type ExtrinsicParams = PolkadotExtrinsicParams; + type Hash = ::Hash; + type AccountId = ::AccountId; + type Address = ::Address; + type Signature = ::Signature; + type Hasher = ::Hasher; + type Header = ::Header; + type AssetId = ::AssetId; + type ExtrinsicParams = signed_extensions::AnyOf< + Self, + ( + signed_extensions::CheckSpecVersion, + signed_extensions::CheckTxVersion, + signed_extensions::CheckNonce, + signed_extensions::CheckGenesis, + signed_extensions::CheckMortality, + signed_extensions::ChargeAssetTxPayment, + signed_extensions::ChargeTransactionPayment, + signed_extensions::CheckMetadataHash, + ), + >; } - -pub use src_chain::*; diff --git a/rpc/src/tests.rs b/rpc/src/tests.rs index 98bf45c..45f354e 100644 --- a/rpc/src/tests.rs +++ b/rpc/src/tests.rs @@ -1,13 +1,20 @@ #![cfg(test)] -use eth_rpc_api::*; use indoc::indoc; +use polkadot_sdk::pallet_revive::evm::*; use crate::ReceiptInfo; +#[test] +fn decode_rlp_tx_works() { + let data = hex_literal::hex!("f86b800184254ac125947bf369283338e12c90514468aa3868a551ab29298898a7d9b8314c0000808204cba0d82f7414276d8c4925f69c1b1c2507be08973e03ea2cdf5d2cae86610929cbe2a0033f3f7e1dad86b3e2cb466abe41a1658c7247f5ac4cbe237d47564bf990139e"); + let tx = rlp::decode::(&data).unwrap(); + dbg!(tx); +} + #[test] fn parse_receipt_info_works() { - let json = indoc! {r###" + let json = indoc! {r###" { "blockHash": "0xfe4fba10cebaf980f48b9b5582bb299f260a29250687a59e9cd568232a87fe40", "blockNumber": "0xb", @@ -40,12 +47,12 @@ fn parse_receipt_info_works() { } "###}; - let _: ReceiptInfo = serde_json::from_str(json).unwrap(); + let _: ReceiptInfo = serde_json::from_str(json).unwrap(); } #[test] fn parse_block_works() { - let json = indoc! {r###" + let json = indoc! {r###" { "baseFeePerGas": "0x2dae10cc", "blobGasUsed": "0x0", @@ -96,6 +103,6 @@ fn parse_block_works() { } "###}; - let block: Block = serde_json::from_str(json).unwrap(); - dbg!(block); + let block: Block = serde_json::from_str(json).unwrap(); + dbg!(block); }