git.delta.rocks / unique-network / refs/commits / 01896baccffe

difftreelog

fix after rebase

Trubnikov Sergey2022-10-13parent: #b44fe9b.patch.diff
in: master

7 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1097,18 +1097,18 @@
 
 [[package]]
 name = "const_format"
-version = "0.2.26"
+version = "0.2.30"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "939dc9e2eb9077e0679d2ce32de1ded8531779360b003b4a972a7a39ec263495"
+checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e"
 dependencies = [
  "const_format_proc_macros",
 ]
 
 [[package]]
 name = "const_format_proc_macros"
-version = "0.2.22"
+version = "0.2.29"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d"
+checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -2333,13 +2333,13 @@
 [[package]]
 name = "evm"
 version = "0.35.0"
-source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27#e9252ed42dc26fc85b6703b1ba50660a08209e55"
+source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29#e9252ed42dc26fc85b6703b1ba50660a08209e55"
 dependencies = [
  "auto_impl",
  "ethereum",
- "evm-core 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
- "evm-gasometer 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
- "evm-runtime 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
+ "evm-core 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
+ "evm-gasometer 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
+ "evm-runtime 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
  "log",
  "parity-scale-codec 3.2.1",
  "primitive-types",
@@ -2381,7 +2381,7 @@
  "hex",
  "hex-literal",
  "impl-trait-for-tuples",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit)",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.29)",
  "primitive-types",
  "sha3-const",
  "similar-asserts",
@@ -2403,7 +2403,7 @@
 [[package]]
 name = "evm-core"
 version = "0.35.0"
-source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27#e9252ed42dc26fc85b6703b1ba50660a08209e55"
+source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29#e9252ed42dc26fc85b6703b1ba50660a08209e55"
 dependencies = [
  "parity-scale-codec 3.2.1",
  "primitive-types",
@@ -2424,10 +2424,10 @@
 [[package]]
 name = "evm-gasometer"
 version = "0.35.0"
-source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27#e9252ed42dc26fc85b6703b1ba50660a08209e55"
+source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29#e9252ed42dc26fc85b6703b1ba50660a08209e55"
 dependencies = [
- "evm-core 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
- "evm-runtime 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
+ "evm-core 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
+ "evm-runtime 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
  "primitive-types",
 ]
 
@@ -2445,10 +2445,10 @@
 [[package]]
 name = "evm-runtime"
 version = "0.35.0"
-source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27#e9252ed42dc26fc85b6703b1ba50660a08209e55"
+source = "git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29#e9252ed42dc26fc85b6703b1ba50660a08209e55"
 dependencies = [
  "auto_impl",
- "evm-core 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
+ "evm-core 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
  "primitive-types",
  "sha3",
 ]
@@ -2794,14 +2794,14 @@
 [[package]]
 name = "fp-evm"
 version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"
+source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.29#852f994e82f9e5718dde75e8c4d877db5a44dd45"
 dependencies = [
- "evm 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
- "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "evm 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
+ "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "impl-trait-for-tuples",
  "parity-scale-codec 3.2.1",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -2821,10 +2821,10 @@
 [[package]]
 name = "fp-evm-mapping"
 version = "0.1.0"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"
+source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.29#852f994e82f9e5718dde75e8c4d877db5a44dd45"
 dependencies = [
- "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -3010,11 +3010,11 @@
 [[package]]
 name = "frame-support"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "bitflags",
  "frame-metadata",
- "frame-support-procedural 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "frame-support-procedural 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "impl-trait-for-tuples",
  "k256",
  "log",
@@ -3022,15 +3022,16 @@
  "paste",
  "scale-info",
  "smallvec",
- "sp-arithmetic 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-tracing 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-arithmetic 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-tracing 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "tt-call",
 ]
 
@@ -3069,10 +3070,12 @@
 [[package]]
 name = "frame-support-procedural"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "Inflector",
- "frame-support-procedural-tools 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "cfg-expr",
+ "frame-support-procedural-tools 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "itertools",
  "proc-macro2",
  "quote",
  "syn",
@@ -3095,9 +3098,9 @@
 [[package]]
 name = "frame-support-procedural-tools"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
- "frame-support-procedural-tools-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "frame-support-procedural-tools-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "proc-macro-crate",
  "proc-macro2",
  "quote",
@@ -3119,7 +3122,7 @@
 [[package]]
 name = "frame-support-procedural-tools-derive"
 version = "3.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -3139,17 +3142,17 @@
 [[package]]
 name = "frame-system"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
- "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "log",
  "parity-scale-codec 3.2.1",
  "scale-info",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-version 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-version 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -6137,26 +6140,26 @@
 [[package]]
 name = "pallet-evm"
 version = "6.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"
+source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.29#852f994e82f9e5718dde75e8c4d877db5a44dd45"
 dependencies = [
- "evm 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.27)",
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit)",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit)",
- "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "evm 0.35.0 (git+https://github.com/uniquenetwork/evm?branch=unique-polkadot-v0.9.29)",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.29)",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.29)",
+ "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "hex",
  "impl-trait-for-tuples",
  "log",
- "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "parity-scale-codec 3.2.1",
  "primitive-types",
  "rlp",
  "scale-info",
  "sha3",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -6914,17 +6917,17 @@
 [[package]]
 name = "pallet-timestamp"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
- "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "log",
  "parity-scale-codec 3.2.1",
  "scale-info",
- "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -11108,9 +11111,9 @@
 
 [[package]]
 name = "sha3-const"
-version = "0.1.0"
+version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af9625d558d174dbdc711248b479271c0fdca39e9d3d67f6e890b3d4251fbf8e"
+checksum = "b04774de876479a8f712e787f8271b14712971329a4be66c6dff144db7cfc343"
 
 [[package]]
 name = "sharded-slab"
@@ -11282,15 +11285,15 @@
 [[package]]
 name = "sp-api"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "log",
  "parity-scale-codec 3.2.1",
- "sp-api-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-version 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-api-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-version 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -11314,7 +11317,7 @@
 [[package]]
 name = "sp-api-proc-macro"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "blake2",
  "proc-macro-crate",
@@ -11338,13 +11341,13 @@
 [[package]]
 name = "sp-application-crypto"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
  "scale-info",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -11363,14 +11366,14 @@
 [[package]]
 name = "sp-arithmetic"
 version = "5.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "integer-sqrt",
  "num-traits",
  "parity-scale-codec 3.2.1",
  "scale-info",
- "sp-debug-derive 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-debug-derive 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "static_assertions",
 ]
 
@@ -11534,7 +11537,7 @@
 [[package]]
 name = "sp-core"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "bitflags",
  "byteorder",
@@ -11547,10 +11550,10 @@
  "primitive-types",
  "scale-info",
  "secrecy",
- "sp-debug-derive 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-storage 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-debug-derive 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-storage 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "ss58-registry",
  "zeroize",
 ]
@@ -11604,14 +11607,14 @@
 [[package]]
 name = "sp-core-hashing"
 version = "4.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "blake2",
  "byteorder",
  "digest 0.10.5",
  "sha2 0.10.6",
  "sha3",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "twox-hash",
 ]
 
@@ -11632,11 +11635,11 @@
 [[package]]
 name = "sp-core-hashing-proc-macro"
 version = "5.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "proc-macro2",
  "quote",
- "sp-core-hashing 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core-hashing 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "syn",
 ]
 
@@ -11663,7 +11666,7 @@
 [[package]]
 name = "sp-debug-derive"
 version = "4.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -11683,12 +11686,12 @@
 [[package]]
 name = "sp-externalities"
 version = "0.12.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "environmental",
  "parity-scale-codec 3.2.1",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-storage 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-storage 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -11723,12 +11726,12 @@
 [[package]]
 name = "sp-inherents"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "impl-trait-for-tuples",
  "parity-scale-codec 3.2.1",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -11748,16 +11751,17 @@
 [[package]]
 name = "sp-io"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
+ "bytes",
  "hash-db",
  "parity-scale-codec 3.2.1",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-externalities 0.12.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-tracing 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-wasm-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-externalities 0.12.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-tracing 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-wasm-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "tracing",
  "tracing-core",
 ]
@@ -11887,7 +11891,7 @@
 [[package]]
 name = "sp-runtime"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "either",
  "hash256-std-hasher",
@@ -11897,11 +11901,11 @@
  "parity-util-mem",
  "paste",
  "scale-info",
- "sp-application-crypto 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-arithmetic 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-application-crypto 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-arithmetic 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-core 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-io 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -11930,17 +11934,18 @@
 [[package]]
 name = "sp-runtime-interface"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
+ "bytes",
  "impl-trait-for-tuples",
  "parity-scale-codec 3.2.1",
  "primitive-types",
- "sp-externalities 0.12.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-storage 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-tracing 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-wasm-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-externalities 0.12.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime-interface-proc-macro 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-storage 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-tracing 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-wasm-interface 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "static_assertions",
 ]
 
@@ -11965,7 +11970,7 @@
 [[package]]
 name = "sp-runtime-interface-proc-macro"
 version = "5.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "Inflector",
  "proc-macro-crate",
@@ -12017,12 +12022,12 @@
 [[package]]
 name = "sp-staking"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
  "scale-info",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -12061,7 +12066,7 @@
 [[package]]
 name = "sp-std"
 version = "4.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 
 [[package]]
 name = "sp-std"
@@ -12071,12 +12076,12 @@
 [[package]]
 name = "sp-storage"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
  "ref-cast",
- "sp-debug-derive 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-debug-derive 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -12108,13 +12113,13 @@
 [[package]]
 name = "sp-timestamp"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
- "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -12136,10 +12141,10 @@
 [[package]]
 name = "sp-tracing"
 version = "5.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
  "tracing",
  "tracing-core",
 ]
@@ -12207,14 +12212,14 @@
 [[package]]
 name = "sp-version"
 version = "5.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
  "scale-info",
- "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
- "sp-version-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-core-hashing-proc-macro 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-runtime 6.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
+ "sp-version-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
@@ -12237,7 +12242,7 @@
 [[package]]
 name = "sp-version-proc-macro"
 version = "4.0.0-dev"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "parity-scale-codec 3.2.1",
  "proc-macro2",
@@ -12259,11 +12264,11 @@
 [[package]]
 name = "sp-wasm-interface"
 version = "6.0.0"
-source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27#5bfdbab8ba28523ef10e365627fed64ef2b77cbf"
+source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
 dependencies = [
  "impl-trait-for-tuples",
  "parity-scale-codec 3.2.1",
- "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.27)",
+ "sp-std 4.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29)",
 ]
 
 [[package]]
modifiedcrates/evm-coder/Cargo.tomldiffbeforeafterboth
--- a/crates/evm-coder/Cargo.toml
+++ b/crates/evm-coder/Cargo.toml
@@ -6,7 +6,7 @@
 
 [dependencies]
 const_format = { version = "0.2.26", default-features = false }
-sha3-const = { version = "0.1.0", default-features = false }
+sha3-const = { version = "0.1.1", default-features = false }
 # Ethereum uses keccak (=sha3) for selectors
 # sha3 = "0.10.1"
 # evm-coder reexports those proc-macro
@@ -22,7 +22,7 @@
 # We have tuple-heavy code in solidity.rs
 impl-trait-for-tuples = "0.2.2"
 
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.29" }
 
 [dev-dependencies]
 # We want to assert some large binary blobs equality in tests
modifiedcrates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth
--- a/crates/evm-coder/procedural/src/solidity_interface.rs
+++ b/crates/evm-coder/procedural/src/solidity_interface.rs
@@ -895,7 +895,7 @@
 		};
 		custom_signature.extend(custom_signature_group.to_token_stream());
 
-		// println!("!!!!! {}", custom_signature);
+		println!("!!!!! {}", custom_signature);
 		custom_signature
 	}
 
modifiedcrates/evm-coder/src/abi.rsdiffbeforeafterboth
before · crates/evm-coder/src/abi.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! Implementation of EVM RLP reader/writer1819#![allow(dead_code)]2021#[cfg(not(feature = "std"))]22use alloc::vec::Vec;23use evm_core::ExitError;24use primitive_types::{H160, U256};2526use crate::{27	execution::{Error, ResultWithPostInfo, WithPostDispatchInfo},28	types::*,29};30use crate::execution::Result;3132const ABI_ALIGNMENT: usize = 32;3334trait TypeHelper {35	/// Is type dynamic sized.36	fn is_dynamic() -> bool;3738	/// Size for type aligned to [`ABI_ALIGNMENT`].39	fn size() -> usize;40}4142/// View into RLP data, which provides method to read typed items from it43#[derive(Clone)]44pub struct AbiReader<'i> {45	buf: &'i [u8],46	subresult_offset: usize,47	offset: usize,48}49impl<'i> AbiReader<'i> {50	/// Start reading RLP buffer, assuming there is no padding bytes51	pub fn new(buf: &'i [u8]) -> Self {52		Self {53			buf,54			subresult_offset: 0,55			offset: 0,56		}57	}58	/// Start reading RLP buffer, parsing first 4 bytes as selector59	pub fn new_call(buf: &'i [u8]) -> Result<(bytes4, Self)> {60		if buf.len() < 4 {61			return Err(Error::Error(ExitError::OutOfOffset));62		}63		let mut method_id = [0; 4];64		method_id.copy_from_slice(&buf[0..4]);6566		Ok((67			method_id,68			Self {69				buf,70				subresult_offset: 4,71				offset: 4,72			},73		))74	}7576	fn read_pad<const S: usize>(77		buf: &[u8],78		offset: usize,79		pad_start: usize,80		pad_size: usize,81		block_start: usize,82		block_size: usize,83	) -> Result<[u8; S]> {84		if buf.len() - offset < ABI_ALIGNMENT {85			return Err(Error::Error(ExitError::OutOfOffset));86		}87		let mut block = [0; S];88		let is_pad_zeroed = buf[pad_start..pad_size].iter().all(|&v| v == 0);89		if !is_pad_zeroed {90			return Err(Error::Error(ExitError::InvalidRange));91		}92		block.copy_from_slice(&buf[block_start..block_size]);93		Ok(block)94	}9596	fn read_padleft<const S: usize>(&mut self) -> Result<[u8; S]> {97		let offset = self.offset;98		self.offset += ABI_ALIGNMENT;99		Self::read_pad(100			self.buf,101			offset,102			offset,103			offset + ABI_ALIGNMENT - S,104			offset + ABI_ALIGNMENT - S,105			offset + ABI_ALIGNMENT,106		)107	}108109	fn read_padright<const S: usize>(&mut self) -> Result<[u8; S]> {110		let offset = self.offset;111		self.offset += ABI_ALIGNMENT;112		Self::read_pad(113			self.buf,114			offset,115			offset + S,116			offset + ABI_ALIGNMENT,117			offset,118			offset + S,119		)120	}121122	/// Read [`H160`] at current position, then advance123	pub fn address(&mut self) -> Result<H160> {124		Ok(H160(self.read_padleft()?))125	}126127	/// Read [`bool`] at current position, then advance128	pub fn bool(&mut self) -> Result<bool> {129		let data: [u8; 1] = self.read_padleft()?;130		match data[0] {131			0 => Ok(false),132			1 => Ok(true),133			_ => Err(Error::Error(ExitError::InvalidRange)),134		}135	}136137	/// Read [`[u8; 4]`] at current position, then advance138	pub fn bytes4(&mut self) -> Result<[u8; 4]> {139		self.read_padright()140	}141142	/// Read [`Vec<u8>`] at current position, then advance143	pub fn bytes(&mut self) -> Result<Vec<u8>> {144		let mut subresult = self.subresult(None)?;145		let length = subresult.uint32()? as usize;146		if subresult.buf.len() < subresult.offset + length {147			return Err(Error::Error(ExitError::OutOfOffset));148		}149		Ok(subresult.buf[subresult.offset..subresult.offset + length].into())150	}151152	/// Read [`string`] at current position, then advance153	pub fn string(&mut self) -> Result<string> {154		string::from_utf8(self.bytes()?).map_err(|_| Error::Error(ExitError::InvalidRange))155	}156157	/// Read [`u8`] at current position, then advance158	pub fn uint8(&mut self) -> Result<u8> {159		Ok(self.read_padleft::<1>()?[0])160	}161162	/// Read [`u32`] at current position, then advance163	pub fn uint32(&mut self) -> Result<u32> {164		Ok(u32::from_be_bytes(self.read_padleft()?))165	}166167	/// Read [`u128`] at current position, then advance168	pub fn uint128(&mut self) -> Result<u128> {169		Ok(u128::from_be_bytes(self.read_padleft()?))170	}171172	/// Read [`U256`] at current position, then advance173	pub fn uint256(&mut self) -> Result<U256> {174		let buf: [u8; 32] = self.read_padleft()?;175		Ok(U256::from_big_endian(&buf))176	}177178	/// Read [`u64`] at current position, then advance179	pub fn uint64(&mut self) -> Result<u64> {180		Ok(u64::from_be_bytes(self.read_padleft()?))181	}182183	/// Read [`usize`] at current position, then advance184	#[deprecated = "dangerous, as usize may have different width in wasm and native execution"]185	pub fn read_usize(&mut self) -> Result<usize> {186		Ok(usize::from_be_bytes(self.read_padleft()?))187	}188189	/// Slice recursive buffer, advance one word for buffer offset190	/// If `size` is [`None`] then [`Self::offset`] and [`Self::subresult_offset`] evals from [`Self::buf`].191	fn subresult(&mut self, size: Option<usize>) -> Result<AbiReader<'i>> {192		let subresult_offset = self.subresult_offset;193		let offset = if let Some(size) = size {194			self.offset += size;195			self.subresult_offset += size;196			0197		} else {198			self.uint32()? as usize199		};200201		if offset + self.subresult_offset > self.buf.len() {202			return Err(Error::Error(ExitError::InvalidRange));203		}204205		let new_offset = offset + subresult_offset;206		Ok(AbiReader {207			buf: self.buf,208			subresult_offset: new_offset,209			offset: new_offset,210		})211	}212213	/// Is this parser reached end of buffer?214	pub fn is_finished(&self) -> bool {215		self.buf.len() == self.offset216	}217}218219/// Writer for RLP encoded data220#[derive(Default)]221pub struct AbiWriter {222	static_part: Vec<u8>,223	dynamic_part: Vec<(usize, AbiWriter)>,224	had_call: bool,225	is_dynamic: bool,226}227impl AbiWriter {228	/// Initialize internal buffers for output data, assuming no padding required229	pub fn new() -> Self {230		Self::default()231	}232233	/// Initialize internal buffers with data size234	pub fn new_dynamic(is_dynamic: bool) -> Self {235		Self {236			is_dynamic,237			..Default::default()238		}239	}240	/// Initialize internal buffers, inserting method selector at beginning241	pub fn new_call(method_id: u32) -> Self {242		let mut val = Self::new();243		val.static_part.extend(&method_id.to_be_bytes());244		val.had_call = true;245		val246	}247248	fn write_padleft(&mut self, block: &[u8]) {249		assert!(block.len() <= ABI_ALIGNMENT);250		self.static_part251			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);252		self.static_part.extend(block);253	}254255	fn write_padright(&mut self, block: &[u8]) {256		assert!(block.len() <= ABI_ALIGNMENT);257		self.static_part.extend(block);258		self.static_part259			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);260	}261262	/// Write [`H160`] to end of buffer263	pub fn address(&mut self, address: &H160) {264		self.write_padleft(&address.0)265	}266267	/// Write [`bool`] to end of buffer268	pub fn bool(&mut self, value: &bool) {269		self.write_padleft(&[if *value { 1 } else { 0 }])270	}271272	/// Write [`u8`] to end of buffer273	pub fn uint8(&mut self, value: &u8) {274		self.write_padleft(&[*value])275	}276277	/// Write [`u32`] to end of buffer278	pub fn uint32(&mut self, value: &u32) {279		self.write_padleft(&u32::to_be_bytes(*value))280	}281282	/// Write [`u128`] to end of buffer283	pub fn uint128(&mut self, value: &u128) {284		self.write_padleft(&u128::to_be_bytes(*value))285	}286287	/// Write [`U256`] to end of buffer288	pub fn uint256(&mut self, value: &U256) {289		let mut out = [0; 32];290		value.to_big_endian(&mut out);291		self.write_padleft(&out)292	}293294	/// Write [`usize`] to end of buffer295	#[deprecated = "dangerous, as usize may have different width in wasm and native execution"]296	pub fn write_usize(&mut self, value: &usize) {297		self.write_padleft(&usize::to_be_bytes(*value))298	}299300	/// Append recursive data, writing pending offset at end of buffer301	pub fn write_subresult(&mut self, result: Self) {302		self.dynamic_part.push((self.static_part.len(), result));303		// Empty block, to be filled later304		self.write_padleft(&[]);305	}306307	fn memory(&mut self, value: &[u8]) {308		let mut sub = Self::new();309		sub.uint32(&(value.len() as u32));310		for chunk in value.chunks(ABI_ALIGNMENT) {311			sub.write_padright(chunk);312		}313		self.write_subresult(sub);314	}315316	/// Append recursive [`str`] at end of buffer317	pub fn string(&mut self, value: &str) {318		self.memory(value.as_bytes())319	}320321	/// Append recursive [`[u8]`] at end of buffer322	pub fn bytes(&mut self, value: &[u8]) {323		self.memory(value)324	}325326	/// Finish writer, concatenating all internal buffers327	pub fn finish(mut self) -> Vec<u8> {328		for (static_offset, part) in self.dynamic_part {329			let part_offset = self.static_part.len()330				- if self.had_call { 4 } else { 0 }331				- if self.is_dynamic { ABI_ALIGNMENT } else { 0 };332333			let encoded_dynamic_offset = usize::to_be_bytes(part_offset);334			let start = static_offset + ABI_ALIGNMENT - encoded_dynamic_offset.len();335			let stop = static_offset + ABI_ALIGNMENT;336			self.static_part[start..stop].copy_from_slice(&encoded_dynamic_offset);337			self.static_part.extend(part.finish())338		}339		self.static_part340	}341}342343/// [`AbiReader`] implements reading of many types, but it should344/// be limited to types defined in spec345///346/// As this trait can't be made sealed,347/// instead of having `impl AbiRead for T`, we have `impl AbiRead<T> for AbiReader`348pub trait AbiRead<T> {349	/// Read item from current position, advanding decoder350	fn abi_read(&mut self) -> Result<T>;351}352353macro_rules! impl_abi_readable {354	($ty:ty, $method:ident, $dynamic:literal) => {355		impl TypeHelper for $ty {356			fn is_dynamic() -> bool {357				$dynamic358			}359360			fn size() -> usize {361				ABI_ALIGNMENT362			}363		}364		impl AbiRead<$ty> for AbiReader<'_> {365			fn abi_read(&mut self) -> Result<$ty> {366				self.$method()367			}368		}369	};370}371372impl_abi_readable!(bool, bool, false);373impl_abi_readable!(uint8, uint8, false);374impl_abi_readable!(uint32, uint32, false);375impl_abi_readable!(uint64, uint64, false);376impl_abi_readable!(uint128, uint128, false);377impl_abi_readable!(uint256, uint256, false);378impl_abi_readable!(bytes4, bytes4, false);379impl_abi_readable!(address, address, false);380impl_abi_readable!(string, string, true);381// impl_abi_readable!(bytes, bytes, true);382383impl TypeHelper for bytes {384	fn is_dynamic() -> bool {385		true386	}387	fn size() -> usize {388		ABI_ALIGNMENT389	}390}391impl AbiRead<bytes> for AbiReader<'_> {392	fn abi_read(&mut self) -> Result<bytes> {393		Ok(bytes(self.bytes()?))394	}395}396397mod sealed {398	/// Not all types can be placed in vec, i.e `Vec<u8>` is restricted, `bytes` should be used instead399	pub trait CanBePlacedInVec {}400}401402impl sealed::CanBePlacedInVec for U256 {}403impl sealed::CanBePlacedInVec for string {}404impl sealed::CanBePlacedInVec for H160 {}405impl sealed::CanBePlacedInVec for EthCrossAccount {}406407impl<R: sealed::CanBePlacedInVec> AbiRead<Vec<R>> for AbiReader<'_>408where409	Self: AbiRead<R>,410{411	fn abi_read(&mut self) -> Result<Vec<R>> {412		let mut sub = self.subresult(None)?;413		let size = sub.uint32()? as usize;414		sub.subresult_offset = sub.offset;415		let mut out = Vec::with_capacity(size);416		for _ in 0..size {417			out.push(<Self as AbiRead<R>>::abi_read(&mut sub)?);418		}419		Ok(out)420	}421}422423impl TypeHelper for EthCrossAccount {424	fn is_dynamic() -> bool {425		address::is_dynamic() || uint256::is_dynamic()426	}427}428429impl AbiRead<EthCrossAccount> for AbiReader<'_> {430	fn abi_read(&mut self) -> Result<EthCrossAccount> {431		let size = if !EthCrossAccount::is_dynamic() {432			Some(<Self as AbiRead<EthCrossAccount>>::size())433		} else {434			None435		};436		let mut subresult = self.subresult(size)?;437		let eth = <Self as AbiRead<address>>::abi_read(&mut subresult)?;438		let sub = <Self as AbiRead<uint256>>::abi_read(&mut subresult)?;439440		Ok(EthCrossAccount { eth: eth, sub: sub })441	}442443	fn size() -> usize {444		<Self as AbiRead<address>>::size() + <Self as AbiRead<uint256>>::size()445	}446}447448impl AbiWrite for &EthCrossAccount {449	fn abi_write(&self, writer: &mut AbiWriter) {450		self.eth.abi_write(writer);451		self.sub.abi_write(writer);452	}453}454455impl TypeHelper for EthCrossAccount {456	fn is_dynamic() -> bool {457		address::is_dynamic() || uint256::is_dynamic()458	}459}460461impl AbiRead<EthCrossAccount> for AbiReader<'_> {462	fn abi_read(&mut self) -> Result<EthCrossAccount> {463		let size = if !EthCrossAccount::is_dynamic() {464			Some(<Self as AbiRead<EthCrossAccount>>::size())465		} else {466			None467		};468		let mut subresult = self.subresult(size)?;469		let eth = <Self as AbiRead<address>>::abi_read(&mut subresult)?;470		let sub = <Self as AbiRead<uint256>>::abi_read(&mut subresult)?;471472		Ok(EthCrossAccount { eth: eth, sub: sub })473	}474475	fn size() -> usize {476		<Self as AbiRead<address>>::size() + <Self as AbiRead<uint256>>::size()477	}478}479480impl AbiWrite for &EthCrossAccount {481	fn abi_write(&self, writer: &mut AbiWriter) {482		self.eth.abi_write(writer);483		self.sub.abi_write(writer);484	}485}486487macro_rules! impl_tuples {488	($($ident:ident)+) => {489		impl<$($ident: TypeHelper,)+> TypeHelper for ($($ident,)+)490		where491			$(492				$ident: TypeHelper,493			)+494		{495			fn is_dynamic() -> bool {496				false497				$(498					|| <$ident>::is_dynamic()499				)*500			}501502			fn size() -> usize {503				0 $(+ <$ident>::size())+504			}505		}506		impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}507		impl<$($ident),+> AbiRead<($($ident,)+)> for AbiReader<'_>508		where509			$(510				Self: AbiRead<$ident>,511			)+512			($($ident,)+): TypeHelper,513		{514			fn abi_read(&mut self) -> Result<($($ident,)+)> {515				let size = if !<($($ident,)+)>::is_dynamic() { Some(<($($ident,)+)>::size()) } else { None };516				let mut subresult = self.subresult(size)?;517				Ok((518					$(<Self as AbiRead<$ident>>::abi_read(&mut subresult)?,)+519				))520			}521		}522		#[allow(non_snake_case)]523		impl<$($ident),+> AbiWrite for ($($ident,)+)524		where525			$($ident: AbiWrite,)+526		{527			fn abi_write(&self, writer: &mut AbiWriter) {528				let ($($ident,)+) = self;529				if writer.is_dynamic {530					let mut sub = AbiWriter::new();531					$($ident.abi_write(&mut sub);)+532					writer.write_subresult(sub);533				} else {534					$($ident.abi_write(writer);)+535				}536			}537		}538	};539}540541impl_tuples! {A}542impl_tuples! {A B}543impl_tuples! {A B C}544impl_tuples! {A B C D}545impl_tuples! {A B C D E}546impl_tuples! {A B C D E F}547impl_tuples! {A B C D E F G}548impl_tuples! {A B C D E F G H}549impl_tuples! {A B C D E F G H I}550impl_tuples! {A B C D E F G H I J}551552/// For questions about inability to provide custom implementations,553/// see [`AbiRead`]554pub trait AbiWrite {555	/// Write value to end of specified encoder556	fn abi_write(&self, writer: &mut AbiWriter);557	/// Specialization for [`crate::solidity_interface`] implementation,558	/// see comment in `impl AbiWrite for ResultWithPostInfo`559	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {560		let mut writer = AbiWriter::new();561		self.abi_write(&mut writer);562		Ok(writer.into())563	}564}565566/// This particular AbiWrite implementation should be split to another trait,567/// which only implements `to_result`, but due to lack of specialization feature568/// in stable Rust, we can't have blanket impl of this trait `for T where T: AbiWrite`,569/// so here we abusing default trait methods for it570impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {571	fn abi_write(&self, _writer: &mut AbiWriter) {572		debug_assert!(false, "shouldn't be called, see comment")573	}574	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {575		match self {576			Ok(v) => Ok(WithPostDispatchInfo {577				post_info: v.post_info.clone(),578				data: {579					let mut out = AbiWriter::new();580					v.data.abi_write(&mut out);581					out582				},583			}),584			Err(e) => Err(e.clone()),585		}586	}587}588589macro_rules! impl_abi_writeable {590	($ty:ty, $method:ident) => {591		impl AbiWrite for $ty {592			fn abi_write(&self, writer: &mut AbiWriter) {593				writer.$method(&self)594			}595		}596	};597}598599impl_abi_writeable!(u8, uint8);600impl_abi_writeable!(u32, uint32);601impl_abi_writeable!(u128, uint128);602impl_abi_writeable!(U256, uint256);603impl_abi_writeable!(H160, address);604impl_abi_writeable!(bool, bool);605impl_abi_writeable!(&str, string);606607impl AbiWrite for string {608	fn abi_write(&self, writer: &mut AbiWriter) {609		writer.string(self)610	}611}612613impl AbiWrite for bytes {614	fn abi_write(&self, writer: &mut AbiWriter) {615		writer.bytes(self.0.as_slice())616	}617}618619impl<T: AbiWrite + TypeHelper> AbiWrite for Vec<T> {620	fn abi_write(&self, writer: &mut AbiWriter) {621		let is_dynamic = T::is_dynamic();622		let mut sub = if is_dynamic {623			AbiWriter::new_dynamic(is_dynamic)624		} else {625			AbiWriter::new()626		};627628		// Write items count629		(self.len() as u32).abi_write(&mut sub);630631		for item in self {632			item.abi_write(&mut sub);633		}634		writer.write_subresult(sub);635	}636}637638impl AbiWrite for () {639	fn abi_write(&self, _writer: &mut AbiWriter) {}640}641642/// Helper macros to parse reader into variables643#[deprecated]644#[macro_export]645macro_rules! abi_decode {646	($reader:expr, $($name:ident: $typ:ident),+ $(,)?) => {647		$(648			let $name = $reader.$typ()?;649		)+650	}651}652653/// Helper macros to construct RLP-encoded buffer654#[deprecated]655#[macro_export]656macro_rules! abi_encode {657	($($typ:ident($value:expr)),* $(,)?) => {{658		#[allow(unused_mut)]659		let mut writer = ::evm_coder::abi::AbiWriter::new();660		$(661			writer.$typ($value);662		)*663		writer664	}};665	(call $val:expr; $($typ:ident($value:expr)),* $(,)?) => {{666		#[allow(unused_mut)]667		let mut writer = ::evm_coder::abi::AbiWriter::new_call($val);668		$(669			writer.$typ($value);670		)*671		writer672	}}673}674675#[cfg(test)]676pub mod test {677	use crate::{678		abi::{AbiRead, AbiWrite},679		types::*,680	};681682	use super::{AbiReader, AbiWriter};683	use hex_literal::hex;684	use primitive_types::{H160, U256};685	use concat_idents::concat_idents;686687	macro_rules! test_impl {688		($name:ident, $type:ty, $function_identifier:expr, $decoded_data:expr, $encoded_data:expr) => {689			concat_idents!(test_name = encode_decode_, $name {690				#[test]691				fn test_name() {692					let function_identifier: u32 = $function_identifier;693					let decoded_data = $decoded_data;694					let encoded_data = $encoded_data;695696					let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();697					assert_eq!(call, u32::to_be_bytes(function_identifier));698					let data = <AbiReader<'_> as AbiRead<$type>>::abi_read(&mut decoder).unwrap();699					assert_eq!(data, decoded_data);700701					let mut writer = AbiWriter::new_call(function_identifier);702					decoded_data.abi_write(&mut writer);703					let ed = writer.finish();704					similar_asserts::assert_eq!(encoded_data, ed.as_slice());705				}706			});707		};708	}709710	macro_rules! test_impl_uint {711		($type:ident) => {712			test_impl!(713				$type,714				$type,715				0xdeadbeef,716				255 as $type,717				&hex!(718					"719						deadbeef720						00000000000000000000000000000000000000000000000000000000000000ff721					"722				)723			);724		};725	}726727	test_impl_uint!(uint8);728	test_impl_uint!(uint32);729	test_impl_uint!(uint128);730731	test_impl!(732		uint256,733		uint256,734		0xdeadbeef,735		U256([255, 0, 0, 0]),736		&hex!(737			"738				deadbeef739				00000000000000000000000000000000000000000000000000000000000000ff740			"741		)742	);743744	test_impl!(745		vec_tuple_address_uint256,746		Vec<(address, uint256)>,747		0x1ACF2D55,748		vec![749			(750				H160(hex!("2D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC")),751				U256([10, 0, 0, 0]),752			),753			(754				H160(hex!("AB8E3D9134955566483B11E6825C9223B6737B10")),755				U256([20, 0, 0, 0]),756			),757			(758				H160(hex!("8C582BDF2953046705FC56F189385255EFC1BE18")),759				U256([30, 0, 0, 0]),760			),761		],762		&hex!(763			"764				1ACF2D55765				0000000000000000000000000000000000000000000000000000000000000020 // offset of (address, uint256)[]766				0000000000000000000000000000000000000000000000000000000000000003 // length of (address, uint256)[]767	768				0000000000000000000000002D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC // address769				000000000000000000000000000000000000000000000000000000000000000A // uint256770	771				000000000000000000000000AB8E3D9134955566483B11E6825C9223B6737B10 // address772				0000000000000000000000000000000000000000000000000000000000000014 // uint256773	774				0000000000000000000000008C582BDF2953046705FC56F189385255EFC1BE18 // address775				000000000000000000000000000000000000000000000000000000000000001E // uint256776			"777		)778	);779780	test_impl!(781		vec_tuple_uint256_string,782		Vec<(uint256, string)>,783		0xdeadbeef,784		vec![785			(1.into(), "Test URI 0".to_string()),786			(11.into(), "Test URI 1".to_string()),787			(12.into(), "Test URI 2".to_string()),788		],789		&hex!(790			"791				deadbeef792				0000000000000000000000000000000000000000000000000000000000000020 // offset of (uint256, string)[]793				0000000000000000000000000000000000000000000000000000000000000003 // length of (uint256, string)[]794795				0000000000000000000000000000000000000000000000000000000000000060 // offset of first elem796				00000000000000000000000000000000000000000000000000000000000000e0 // offset of second elem797				0000000000000000000000000000000000000000000000000000000000000160 // offset of third elem798799				0000000000000000000000000000000000000000000000000000000000000001 // first token id?   					#60800				0000000000000000000000000000000000000000000000000000000000000040 // offset of string801				000000000000000000000000000000000000000000000000000000000000000a // size of string802				5465737420555249203000000000000000000000000000000000000000000000 // string803804				000000000000000000000000000000000000000000000000000000000000000b // second token id? Why ==11?			#e0805				0000000000000000000000000000000000000000000000000000000000000040 // offset of string806				000000000000000000000000000000000000000000000000000000000000000a // size of string807				5465737420555249203100000000000000000000000000000000000000000000 // string808809				000000000000000000000000000000000000000000000000000000000000000c // third token id?  Why ==12?			#160810				0000000000000000000000000000000000000000000000000000000000000040 // offset of string811				000000000000000000000000000000000000000000000000000000000000000a // size of string812				5465737420555249203200000000000000000000000000000000000000000000 // string813			"814		)815	);816817	#[test]818	fn dynamic_after_static() {819		let mut encoder = AbiWriter::new();820		encoder.bool(&true);821		encoder.string("test");822		let encoded = encoder.finish();823824		let mut encoder = AbiWriter::new();825		encoder.bool(&true);826		// Offset to subresult827		encoder.uint32(&(32 * 2));828		// Len of "test"829		encoder.uint32(&4);830		encoder.write_padright(&[b't', b'e', b's', b't']);831		let alternative_encoded = encoder.finish();832833		assert_eq!(encoded, alternative_encoded);834835		let mut decoder = AbiReader::new(&encoded);836		assert!(decoder.bool().unwrap());837		assert_eq!(decoder.string().unwrap(), "test");838	}839840	#[test]841	fn mint_sample() {842		let (call, mut decoder) = AbiReader::new_call(&hex!(843			"844				50bb4e7f845				000000000000000000000000ad2c0954693c2b5404b7e50967d3481bea432374846				0000000000000000000000000000000000000000000000000000000000000001847				0000000000000000000000000000000000000000000000000000000000000060848				0000000000000000000000000000000000000000000000000000000000000008849				5465737420555249000000000000000000000000000000000000000000000000850			"851		))852		.unwrap();853		assert_eq!(call, u32::to_be_bytes(0x50bb4e7f));854		assert_eq!(855			format!("{:?}", decoder.address().unwrap()),856			"0xad2c0954693c2b5404b7e50967d3481bea432374"857		);858		assert_eq!(decoder.uint32().unwrap(), 1);859		assert_eq!(decoder.string().unwrap(), "Test URI");860	}861862	#[test]863	fn parse_vec_with_dynamic_type() {864		let decoded_data = (865			0x36543006,866			vec![867				(1.into(), "Test URI 0".to_string()),868				(11.into(), "Test URI 1".to_string()),869				(12.into(), "Test URI 2".to_string()),870			],871		);872873		let encoded_data = &hex!(874			"875				36543006876				00000000000000000000000053744e6da587ba10b32a2554d2efdcd985bc27a3 // address877				0000000000000000000000000000000000000000000000000000000000000040 // offset of (uint256, string)[]878				0000000000000000000000000000000000000000000000000000000000000003 // length of (uint256, string)[]879880				0000000000000000000000000000000000000000000000000000000000000060 // offset of first elem881				00000000000000000000000000000000000000000000000000000000000000e0 // offset of second elem882				0000000000000000000000000000000000000000000000000000000000000160 // offset of third elem883884				0000000000000000000000000000000000000000000000000000000000000001 // first token id?   					#60885				0000000000000000000000000000000000000000000000000000000000000040 // offset of string886				000000000000000000000000000000000000000000000000000000000000000a // size of string887				5465737420555249203000000000000000000000000000000000000000000000 // string888889				000000000000000000000000000000000000000000000000000000000000000b // second token id? Why ==11?			#e0890				0000000000000000000000000000000000000000000000000000000000000040 // offset of string891				000000000000000000000000000000000000000000000000000000000000000a // size of string892				5465737420555249203100000000000000000000000000000000000000000000 // string893894				000000000000000000000000000000000000000000000000000000000000000c // third token id?  Why ==12?			#160895				0000000000000000000000000000000000000000000000000000000000000040 // offset of string896				000000000000000000000000000000000000000000000000000000000000000a // size of string897				5465737420555249203200000000000000000000000000000000000000000000 // string898			"899		);900901		let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();902		assert_eq!(call, u32::to_be_bytes(decoded_data.0));903		let address = decoder.address().unwrap();904		let data =905			<AbiReader<'_> as AbiRead<Vec<(uint256, string)>>>::abi_read(&mut decoder).unwrap();906		assert_eq!(data, decoded_data.1);907908		let mut writer = AbiWriter::new_call(decoded_data.0);909		address.abi_write(&mut writer);910		decoded_data.1.abi_write(&mut writer);911		let ed = writer.finish();912		similar_asserts::assert_eq!(encoded_data, ed.as_slice());913	}914}
after · crates/evm-coder/src/abi.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! Implementation of EVM RLP reader/writer1819#![allow(dead_code)]2021#[cfg(not(feature = "std"))]22use alloc::vec::Vec;23use evm_core::ExitError;24use primitive_types::{H160, U256};2526use crate::{27	execution::{Error, ResultWithPostInfo, WithPostDispatchInfo},28	types::*,29};30use crate::execution::Result;3132const ABI_ALIGNMENT: usize = 32;3334trait TypeHelper {35	/// Is type dynamic sized.36	fn is_dynamic() -> bool;3738	/// Size for type aligned to [`ABI_ALIGNMENT`].39	fn size() -> usize;40}4142/// View into RLP data, which provides method to read typed items from it43#[derive(Clone)]44pub struct AbiReader<'i> {45	buf: &'i [u8],46	subresult_offset: usize,47	offset: usize,48}49impl<'i> AbiReader<'i> {50	/// Start reading RLP buffer, assuming there is no padding bytes51	pub fn new(buf: &'i [u8]) -> Self {52		Self {53			buf,54			subresult_offset: 0,55			offset: 0,56		}57	}58	/// Start reading RLP buffer, parsing first 4 bytes as selector59	pub fn new_call(buf: &'i [u8]) -> Result<(bytes4, Self)> {60		if buf.len() < 4 {61			return Err(Error::Error(ExitError::OutOfOffset));62		}63		let mut method_id = [0; 4];64		method_id.copy_from_slice(&buf[0..4]);6566		Ok((67			method_id,68			Self {69				buf,70				subresult_offset: 4,71				offset: 4,72			},73		))74	}7576	fn read_pad<const S: usize>(77		buf: &[u8],78		offset: usize,79		pad_start: usize,80		pad_size: usize,81		block_start: usize,82		block_size: usize,83	) -> Result<[u8; S]> {84		if buf.len() - offset < ABI_ALIGNMENT {85			return Err(Error::Error(ExitError::OutOfOffset));86		}87		let mut block = [0; S];88		let is_pad_zeroed = buf[pad_start..pad_size].iter().all(|&v| v == 0);89		if !is_pad_zeroed {90			return Err(Error::Error(ExitError::InvalidRange));91		}92		block.copy_from_slice(&buf[block_start..block_size]);93		Ok(block)94	}9596	fn read_padleft<const S: usize>(&mut self) -> Result<[u8; S]> {97		let offset = self.offset;98		self.offset += ABI_ALIGNMENT;99		Self::read_pad(100			self.buf,101			offset,102			offset,103			offset + ABI_ALIGNMENT - S,104			offset + ABI_ALIGNMENT - S,105			offset + ABI_ALIGNMENT,106		)107	}108109	fn read_padright<const S: usize>(&mut self) -> Result<[u8; S]> {110		let offset = self.offset;111		self.offset += ABI_ALIGNMENT;112		Self::read_pad(113			self.buf,114			offset,115			offset + S,116			offset + ABI_ALIGNMENT,117			offset,118			offset + S,119		)120	}121122	/// Read [`H160`] at current position, then advance123	pub fn address(&mut self) -> Result<H160> {124		Ok(H160(self.read_padleft()?))125	}126127	/// Read [`bool`] at current position, then advance128	pub fn bool(&mut self) -> Result<bool> {129		let data: [u8; 1] = self.read_padleft()?;130		match data[0] {131			0 => Ok(false),132			1 => Ok(true),133			_ => Err(Error::Error(ExitError::InvalidRange)),134		}135	}136137	/// Read [`[u8; 4]`] at current position, then advance138	pub fn bytes4(&mut self) -> Result<[u8; 4]> {139		self.read_padright()140	}141142	/// Read [`Vec<u8>`] at current position, then advance143	pub fn bytes(&mut self) -> Result<Vec<u8>> {144		let mut subresult = self.subresult(None)?;145		let length = subresult.uint32()? as usize;146		if subresult.buf.len() < subresult.offset + length {147			return Err(Error::Error(ExitError::OutOfOffset));148		}149		Ok(subresult.buf[subresult.offset..subresult.offset + length].into())150	}151152	/// Read [`string`] at current position, then advance153	pub fn string(&mut self) -> Result<string> {154		string::from_utf8(self.bytes()?).map_err(|_| Error::Error(ExitError::InvalidRange))155	}156157	/// Read [`u8`] at current position, then advance158	pub fn uint8(&mut self) -> Result<u8> {159		Ok(self.read_padleft::<1>()?[0])160	}161162	/// Read [`u32`] at current position, then advance163	pub fn uint32(&mut self) -> Result<u32> {164		Ok(u32::from_be_bytes(self.read_padleft()?))165	}166167	/// Read [`u128`] at current position, then advance168	pub fn uint128(&mut self) -> Result<u128> {169		Ok(u128::from_be_bytes(self.read_padleft()?))170	}171172	/// Read [`U256`] at current position, then advance173	pub fn uint256(&mut self) -> Result<U256> {174		let buf: [u8; 32] = self.read_padleft()?;175		Ok(U256::from_big_endian(&buf))176	}177178	/// Read [`u64`] at current position, then advance179	pub fn uint64(&mut self) -> Result<u64> {180		Ok(u64::from_be_bytes(self.read_padleft()?))181	}182183	/// Read [`usize`] at current position, then advance184	#[deprecated = "dangerous, as usize may have different width in wasm and native execution"]185	pub fn read_usize(&mut self) -> Result<usize> {186		Ok(usize::from_be_bytes(self.read_padleft()?))187	}188189	/// Slice recursive buffer, advance one word for buffer offset190	/// If `size` is [`None`] then [`Self::offset`] and [`Self::subresult_offset`] evals from [`Self::buf`].191	fn subresult(&mut self, size: Option<usize>) -> Result<AbiReader<'i>> {192		let subresult_offset = self.subresult_offset;193		let offset = if let Some(size) = size {194			self.offset += size;195			self.subresult_offset += size;196			0197		} else {198			self.uint32()? as usize199		};200201		if offset + self.subresult_offset > self.buf.len() {202			return Err(Error::Error(ExitError::InvalidRange));203		}204205		let new_offset = offset + subresult_offset;206		Ok(AbiReader {207			buf: self.buf,208			subresult_offset: new_offset,209			offset: new_offset,210		})211	}212213	/// Is this parser reached end of buffer?214	pub fn is_finished(&self) -> bool {215		self.buf.len() == self.offset216	}217}218219/// Writer for RLP encoded data220#[derive(Default)]221pub struct AbiWriter {222	static_part: Vec<u8>,223	dynamic_part: Vec<(usize, AbiWriter)>,224	had_call: bool,225	is_dynamic: bool,226}227impl AbiWriter {228	/// Initialize internal buffers for output data, assuming no padding required229	pub fn new() -> Self {230		Self::default()231	}232233	/// Initialize internal buffers with data size234	pub fn new_dynamic(is_dynamic: bool) -> Self {235		Self {236			is_dynamic,237			..Default::default()238		}239	}240	/// Initialize internal buffers, inserting method selector at beginning241	pub fn new_call(method_id: u32) -> Self {242		let mut val = Self::new();243		val.static_part.extend(&method_id.to_be_bytes());244		val.had_call = true;245		val246	}247248	fn write_padleft(&mut self, block: &[u8]) {249		assert!(block.len() <= ABI_ALIGNMENT);250		self.static_part251			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);252		self.static_part.extend(block);253	}254255	fn write_padright(&mut self, block: &[u8]) {256		assert!(block.len() <= ABI_ALIGNMENT);257		self.static_part.extend(block);258		self.static_part259			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);260	}261262	/// Write [`H160`] to end of buffer263	pub fn address(&mut self, address: &H160) {264		self.write_padleft(&address.0)265	}266267	/// Write [`bool`] to end of buffer268	pub fn bool(&mut self, value: &bool) {269		self.write_padleft(&[if *value { 1 } else { 0 }])270	}271272	/// Write [`u8`] to end of buffer273	pub fn uint8(&mut self, value: &u8) {274		self.write_padleft(&[*value])275	}276277	/// Write [`u32`] to end of buffer278	pub fn uint32(&mut self, value: &u32) {279		self.write_padleft(&u32::to_be_bytes(*value))280	}281282	/// Write [`u128`] to end of buffer283	pub fn uint128(&mut self, value: &u128) {284		self.write_padleft(&u128::to_be_bytes(*value))285	}286287	/// Write [`U256`] to end of buffer288	pub fn uint256(&mut self, value: &U256) {289		let mut out = [0; 32];290		value.to_big_endian(&mut out);291		self.write_padleft(&out)292	}293294	/// Write [`usize`] to end of buffer295	#[deprecated = "dangerous, as usize may have different width in wasm and native execution"]296	pub fn write_usize(&mut self, value: &usize) {297		self.write_padleft(&usize::to_be_bytes(*value))298	}299300	/// Append recursive data, writing pending offset at end of buffer301	pub fn write_subresult(&mut self, result: Self) {302		self.dynamic_part.push((self.static_part.len(), result));303		// Empty block, to be filled later304		self.write_padleft(&[]);305	}306307	fn memory(&mut self, value: &[u8]) {308		let mut sub = Self::new();309		sub.uint32(&(value.len() as u32));310		for chunk in value.chunks(ABI_ALIGNMENT) {311			sub.write_padright(chunk);312		}313		self.write_subresult(sub);314	}315316	/// Append recursive [`str`] at end of buffer317	pub fn string(&mut self, value: &str) {318		self.memory(value.as_bytes())319	}320321	/// Append recursive [`[u8]`] at end of buffer322	pub fn bytes(&mut self, value: &[u8]) {323		self.memory(value)324	}325326	/// Finish writer, concatenating all internal buffers327	pub fn finish(mut self) -> Vec<u8> {328		for (static_offset, part) in self.dynamic_part {329			let part_offset = self.static_part.len()330				- if self.had_call { 4 } else { 0 }331				- if self.is_dynamic { ABI_ALIGNMENT } else { 0 };332333			let encoded_dynamic_offset = usize::to_be_bytes(part_offset);334			let start = static_offset + ABI_ALIGNMENT - encoded_dynamic_offset.len();335			let stop = static_offset + ABI_ALIGNMENT;336			self.static_part[start..stop].copy_from_slice(&encoded_dynamic_offset);337			self.static_part.extend(part.finish())338		}339		self.static_part340	}341}342343/// [`AbiReader`] implements reading of many types, but it should344/// be limited to types defined in spec345///346/// As this trait can't be made sealed,347/// instead of having `impl AbiRead for T`, we have `impl AbiRead<T> for AbiReader`348pub trait AbiRead<T> {349	/// Read item from current position, advanding decoder350	fn abi_read(&mut self) -> Result<T>;351}352353macro_rules! impl_abi_readable {354	($ty:ty, $method:ident, $dynamic:literal) => {355		impl TypeHelper for $ty {356			fn is_dynamic() -> bool {357				$dynamic358			}359360			fn size() -> usize {361				ABI_ALIGNMENT362			}363		}364		impl AbiRead<$ty> for AbiReader<'_> {365			fn abi_read(&mut self) -> Result<$ty> {366				self.$method()367			}368		}369	};370}371372impl_abi_readable!(bool, bool, false);373impl_abi_readable!(uint8, uint8, false);374impl_abi_readable!(uint32, uint32, false);375impl_abi_readable!(uint64, uint64, false);376impl_abi_readable!(uint128, uint128, false);377impl_abi_readable!(uint256, uint256, false);378impl_abi_readable!(bytes4, bytes4, false);379impl_abi_readable!(address, address, false);380impl_abi_readable!(string, string, true);381// impl_abi_readable!(bytes, bytes, true);382383impl TypeHelper for bytes {384	fn is_dynamic() -> bool {385		true386	}387	fn size() -> usize {388		ABI_ALIGNMENT389	}390}391impl AbiRead<bytes> for AbiReader<'_> {392	fn abi_read(&mut self) -> Result<bytes> {393		Ok(bytes(self.bytes()?))394	}395}396397mod sealed {398	/// Not all types can be placed in vec, i.e `Vec<u8>` is restricted, `bytes` should be used instead399	pub trait CanBePlacedInVec {}400}401402impl sealed::CanBePlacedInVec for U256 {}403impl sealed::CanBePlacedInVec for string {}404impl sealed::CanBePlacedInVec for H160 {}405impl sealed::CanBePlacedInVec for EthCrossAccount {}406407impl<R: sealed::CanBePlacedInVec> AbiRead<Vec<R>> for AbiReader<'_>408where409	Self: AbiRead<R>,410{411	fn abi_read(&mut self) -> Result<Vec<R>> {412		let mut sub = self.subresult(None)?;413		let size = sub.uint32()? as usize;414		sub.subresult_offset = sub.offset;415		let mut out = Vec::with_capacity(size);416		for _ in 0..size {417			out.push(<Self as AbiRead<R>>::abi_read(&mut sub)?);418		}419		Ok(out)420	}421}422423impl TypeHelper for EthCrossAccount {424	fn is_dynamic() -> bool {425		address::is_dynamic() || uint256::is_dynamic()426	}427428	fn size() -> usize {429		<address as TypeHelper>::size() + <uint256 as TypeHelper>::size()430	}431}432433impl AbiRead<EthCrossAccount> for AbiReader<'_> {434	fn abi_read(&mut self) -> Result<EthCrossAccount> {435		let size = if !EthCrossAccount::is_dynamic() {436			Some(<EthCrossAccount as TypeHelper>::size())437		} else {438			None439		};440		let mut subresult = self.subresult(size)?;441		let eth = <Self as AbiRead<address>>::abi_read(&mut subresult)?;442		let sub = <Self as AbiRead<uint256>>::abi_read(&mut subresult)?;443444		Ok(EthCrossAccount { eth, sub })445	}446}447448impl AbiWrite for &EthCrossAccount {449	fn abi_write(&self, writer: &mut AbiWriter) {450		self.eth.abi_write(writer);451		self.sub.abi_write(writer);452	}453}454455macro_rules! impl_tuples {456	($($ident:ident)+) => {457		impl<$($ident: TypeHelper,)+> TypeHelper for ($($ident,)+)458		where459			$(460				$ident: TypeHelper,461			)+462		{463			fn is_dynamic() -> bool {464				false465				$(466					|| <$ident>::is_dynamic()467				)*468			}469470			fn size() -> usize {471				0 $(+ <$ident>::size())+472			}473		}474		impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}475		impl<$($ident),+> AbiRead<($($ident,)+)> for AbiReader<'_>476		where477			$(478				Self: AbiRead<$ident>,479			)+480			($($ident,)+): TypeHelper,481		{482			fn abi_read(&mut self) -> Result<($($ident,)+)> {483				let size = if !<($($ident,)+)>::is_dynamic() { Some(<($($ident,)+)>::size()) } else { None };484				let mut subresult = self.subresult(size)?;485				Ok((486					$(<Self as AbiRead<$ident>>::abi_read(&mut subresult)?,)+487				))488			}489		}490		#[allow(non_snake_case)]491		impl<$($ident),+> AbiWrite for ($($ident,)+)492		where493			$($ident: AbiWrite,)+494		{495			fn abi_write(&self, writer: &mut AbiWriter) {496				let ($($ident,)+) = self;497				if writer.is_dynamic {498					let mut sub = AbiWriter::new();499					$($ident.abi_write(&mut sub);)+500					writer.write_subresult(sub);501				} else {502					$($ident.abi_write(writer);)+503				}504			}505		}506	};507}508509impl_tuples! {A}510impl_tuples! {A B}511impl_tuples! {A B C}512impl_tuples! {A B C D}513impl_tuples! {A B C D E}514impl_tuples! {A B C D E F}515impl_tuples! {A B C D E F G}516impl_tuples! {A B C D E F G H}517impl_tuples! {A B C D E F G H I}518impl_tuples! {A B C D E F G H I J}519520/// For questions about inability to provide custom implementations,521/// see [`AbiRead`]522pub trait AbiWrite {523	/// Write value to end of specified encoder524	fn abi_write(&self, writer: &mut AbiWriter);525	/// Specialization for [`crate::solidity_interface`] implementation,526	/// see comment in `impl AbiWrite for ResultWithPostInfo`527	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {528		let mut writer = AbiWriter::new();529		self.abi_write(&mut writer);530		Ok(writer.into())531	}532}533534/// This particular AbiWrite implementation should be split to another trait,535/// which only implements `to_result`, but due to lack of specialization feature536/// in stable Rust, we can't have blanket impl of this trait `for T where T: AbiWrite`,537/// so here we abusing default trait methods for it538impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {539	fn abi_write(&self, _writer: &mut AbiWriter) {540		debug_assert!(false, "shouldn't be called, see comment")541	}542	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {543		match self {544			Ok(v) => Ok(WithPostDispatchInfo {545				post_info: v.post_info.clone(),546				data: {547					let mut out = AbiWriter::new();548					v.data.abi_write(&mut out);549					out550				},551			}),552			Err(e) => Err(e.clone()),553		}554	}555}556557macro_rules! impl_abi_writeable {558	($ty:ty, $method:ident) => {559		impl AbiWrite for $ty {560			fn abi_write(&self, writer: &mut AbiWriter) {561				writer.$method(&self)562			}563		}564	};565}566567impl_abi_writeable!(u8, uint8);568impl_abi_writeable!(u32, uint32);569impl_abi_writeable!(u128, uint128);570impl_abi_writeable!(U256, uint256);571impl_abi_writeable!(H160, address);572impl_abi_writeable!(bool, bool);573impl_abi_writeable!(&str, string);574575impl AbiWrite for string {576	fn abi_write(&self, writer: &mut AbiWriter) {577		writer.string(self)578	}579}580581impl AbiWrite for bytes {582	fn abi_write(&self, writer: &mut AbiWriter) {583		writer.bytes(self.0.as_slice())584	}585}586587impl<T: AbiWrite + TypeHelper> AbiWrite for Vec<T> {588	fn abi_write(&self, writer: &mut AbiWriter) {589		let is_dynamic = T::is_dynamic();590		let mut sub = if is_dynamic {591			AbiWriter::new_dynamic(is_dynamic)592		} else {593			AbiWriter::new()594		};595596		// Write items count597		(self.len() as u32).abi_write(&mut sub);598599		for item in self {600			item.abi_write(&mut sub);601		}602		writer.write_subresult(sub);603	}604}605606impl AbiWrite for () {607	fn abi_write(&self, _writer: &mut AbiWriter) {}608}609610/// Helper macros to parse reader into variables611#[deprecated]612#[macro_export]613macro_rules! abi_decode {614	($reader:expr, $($name:ident: $typ:ident),+ $(,)?) => {615		$(616			let $name = $reader.$typ()?;617		)+618	}619}620621/// Helper macros to construct RLP-encoded buffer622#[deprecated]623#[macro_export]624macro_rules! abi_encode {625	($($typ:ident($value:expr)),* $(,)?) => {{626		#[allow(unused_mut)]627		let mut writer = ::evm_coder::abi::AbiWriter::new();628		$(629			writer.$typ($value);630		)*631		writer632	}};633	(call $val:expr; $($typ:ident($value:expr)),* $(,)?) => {{634		#[allow(unused_mut)]635		let mut writer = ::evm_coder::abi::AbiWriter::new_call($val);636		$(637			writer.$typ($value);638		)*639		writer640	}}641}642643#[cfg(test)]644pub mod test {645	use crate::{646		abi::{AbiRead, AbiWrite},647		types::*,648	};649650	use super::{AbiReader, AbiWriter};651	use hex_literal::hex;652	use primitive_types::{H160, U256};653	use concat_idents::concat_idents;654655	macro_rules! test_impl {656		($name:ident, $type:ty, $function_identifier:expr, $decoded_data:expr, $encoded_data:expr) => {657			concat_idents!(test_name = encode_decode_, $name {658				#[test]659				fn test_name() {660					let function_identifier: u32 = $function_identifier;661					let decoded_data = $decoded_data;662					let encoded_data = $encoded_data;663664					let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();665					assert_eq!(call, u32::to_be_bytes(function_identifier));666					let data = <AbiReader<'_> as AbiRead<$type>>::abi_read(&mut decoder).unwrap();667					assert_eq!(data, decoded_data);668669					let mut writer = AbiWriter::new_call(function_identifier);670					decoded_data.abi_write(&mut writer);671					let ed = writer.finish();672					similar_asserts::assert_eq!(encoded_data, ed.as_slice());673				}674			});675		};676	}677678	macro_rules! test_impl_uint {679		($type:ident) => {680			test_impl!(681				$type,682				$type,683				0xdeadbeef,684				255 as $type,685				&hex!(686					"687						deadbeef688						00000000000000000000000000000000000000000000000000000000000000ff689					"690				)691			);692		};693	}694695	test_impl_uint!(uint8);696	test_impl_uint!(uint32);697	test_impl_uint!(uint128);698699	test_impl!(700		uint256,701		uint256,702		0xdeadbeef,703		U256([255, 0, 0, 0]),704		&hex!(705			"706				deadbeef707				00000000000000000000000000000000000000000000000000000000000000ff708			"709		)710	);711712	test_impl!(713		vec_tuple_address_uint256,714		Vec<(address, uint256)>,715		0x1ACF2D55,716		vec![717			(718				H160(hex!("2D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC")),719				U256([10, 0, 0, 0]),720			),721			(722				H160(hex!("AB8E3D9134955566483B11E6825C9223B6737B10")),723				U256([20, 0, 0, 0]),724			),725			(726				H160(hex!("8C582BDF2953046705FC56F189385255EFC1BE18")),727				U256([30, 0, 0, 0]),728			),729		],730		&hex!(731			"732				1ACF2D55733				0000000000000000000000000000000000000000000000000000000000000020 // offset of (address, uint256)[]734				0000000000000000000000000000000000000000000000000000000000000003 // length of (address, uint256)[]735	736				0000000000000000000000002D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC // address737				000000000000000000000000000000000000000000000000000000000000000A // uint256738	739				000000000000000000000000AB8E3D9134955566483B11E6825C9223B6737B10 // address740				0000000000000000000000000000000000000000000000000000000000000014 // uint256741	742				0000000000000000000000008C582BDF2953046705FC56F189385255EFC1BE18 // address743				000000000000000000000000000000000000000000000000000000000000001E // uint256744			"745		)746	);747748	test_impl!(749		vec_tuple_uint256_string,750		Vec<(uint256, string)>,751		0xdeadbeef,752		vec![753			(1.into(), "Test URI 0".to_string()),754			(11.into(), "Test URI 1".to_string()),755			(12.into(), "Test URI 2".to_string()),756		],757		&hex!(758			"759				deadbeef760				0000000000000000000000000000000000000000000000000000000000000020 // offset of (uint256, string)[]761				0000000000000000000000000000000000000000000000000000000000000003 // length of (uint256, string)[]762763				0000000000000000000000000000000000000000000000000000000000000060 // offset of first elem764				00000000000000000000000000000000000000000000000000000000000000e0 // offset of second elem765				0000000000000000000000000000000000000000000000000000000000000160 // offset of third elem766767				0000000000000000000000000000000000000000000000000000000000000001 // first token id?   					#60768				0000000000000000000000000000000000000000000000000000000000000040 // offset of string769				000000000000000000000000000000000000000000000000000000000000000a // size of string770				5465737420555249203000000000000000000000000000000000000000000000 // string771772				000000000000000000000000000000000000000000000000000000000000000b // second token id? Why ==11?			#e0773				0000000000000000000000000000000000000000000000000000000000000040 // offset of string774				000000000000000000000000000000000000000000000000000000000000000a // size of string775				5465737420555249203100000000000000000000000000000000000000000000 // string776777				000000000000000000000000000000000000000000000000000000000000000c // third token id?  Why ==12?			#160778				0000000000000000000000000000000000000000000000000000000000000040 // offset of string779				000000000000000000000000000000000000000000000000000000000000000a // size of string780				5465737420555249203200000000000000000000000000000000000000000000 // string781			"782		)783	);784785	#[test]786	fn dynamic_after_static() {787		let mut encoder = AbiWriter::new();788		encoder.bool(&true);789		encoder.string("test");790		let encoded = encoder.finish();791792		let mut encoder = AbiWriter::new();793		encoder.bool(&true);794		// Offset to subresult795		encoder.uint32(&(32 * 2));796		// Len of "test"797		encoder.uint32(&4);798		encoder.write_padright(&[b't', b'e', b's', b't']);799		let alternative_encoded = encoder.finish();800801		assert_eq!(encoded, alternative_encoded);802803		let mut decoder = AbiReader::new(&encoded);804		assert!(decoder.bool().unwrap());805		assert_eq!(decoder.string().unwrap(), "test");806	}807808	#[test]809	fn mint_sample() {810		let (call, mut decoder) = AbiReader::new_call(&hex!(811			"812				50bb4e7f813				000000000000000000000000ad2c0954693c2b5404b7e50967d3481bea432374814				0000000000000000000000000000000000000000000000000000000000000001815				0000000000000000000000000000000000000000000000000000000000000060816				0000000000000000000000000000000000000000000000000000000000000008817				5465737420555249000000000000000000000000000000000000000000000000818			"819		))820		.unwrap();821		assert_eq!(call, u32::to_be_bytes(0x50bb4e7f));822		assert_eq!(823			format!("{:?}", decoder.address().unwrap()),824			"0xad2c0954693c2b5404b7e50967d3481bea432374"825		);826		assert_eq!(decoder.uint32().unwrap(), 1);827		assert_eq!(decoder.string().unwrap(), "Test URI");828	}829830	#[test]831	fn parse_vec_with_dynamic_type() {832		let decoded_data = (833			0x36543006,834			vec![835				(1.into(), "Test URI 0".to_string()),836				(11.into(), "Test URI 1".to_string()),837				(12.into(), "Test URI 2".to_string()),838			],839		);840841		let encoded_data = &hex!(842			"843				36543006844				00000000000000000000000053744e6da587ba10b32a2554d2efdcd985bc27a3 // address845				0000000000000000000000000000000000000000000000000000000000000040 // offset of (uint256, string)[]846				0000000000000000000000000000000000000000000000000000000000000003 // length of (uint256, string)[]847848				0000000000000000000000000000000000000000000000000000000000000060 // offset of first elem849				00000000000000000000000000000000000000000000000000000000000000e0 // offset of second elem850				0000000000000000000000000000000000000000000000000000000000000160 // offset of third elem851852				0000000000000000000000000000000000000000000000000000000000000001 // first token id?   					#60853				0000000000000000000000000000000000000000000000000000000000000040 // offset of string854				000000000000000000000000000000000000000000000000000000000000000a // size of string855				5465737420555249203000000000000000000000000000000000000000000000 // string856857				000000000000000000000000000000000000000000000000000000000000000b // second token id? Why ==11?			#e0858				0000000000000000000000000000000000000000000000000000000000000040 // offset of string859				000000000000000000000000000000000000000000000000000000000000000a // size of string860				5465737420555249203100000000000000000000000000000000000000000000 // string861862				000000000000000000000000000000000000000000000000000000000000000c // third token id?  Why ==12?			#160863				0000000000000000000000000000000000000000000000000000000000000040 // offset of string864				000000000000000000000000000000000000000000000000000000000000000a // size of string865				5465737420555249203200000000000000000000000000000000000000000000 // string866			"867		);868869		let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();870		assert_eq!(call, u32::to_be_bytes(decoded_data.0));871		let address = decoder.address().unwrap();872		let data =873			<AbiReader<'_> as AbiRead<Vec<(uint256, string)>>>::abi_read(&mut decoder).unwrap();874		assert_eq!(data, decoded_data.1);875876		let mut writer = AbiWriter::new_call(decoded_data.0);877		address.abi_write(&mut writer);878		decoded_data.1.abi_write(&mut writer);879		let ed = writer.finish();880		similar_asserts::assert_eq!(encoded_data, ed.as_slice());881	}882}
modifiedcrates/evm-coder/src/lib.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -169,6 +169,7 @@
 		}
 	}
 
+	#[allow(clippy::from_over_into)]
 	impl Into<Vec<u8>> for bytes {
 		fn into(self) -> Vec<u8> {
 			self.0
modifiedcrates/evm-coder/src/solidity.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -35,12 +35,6 @@
 use crate::types::*;
 
 #[derive(Default)]
-pub struct FunctionSelectorMaker {
-	pub name: string,
-	pub args: Vec<fn() -> string>,
-}
-
-#[derive(Default)]
 pub struct TypeCollector {
 	/// Code => id
 	/// id ordering is required to perform topo-sort on the resulting data
@@ -488,19 +482,6 @@
 	View,
 	Mutable,
 }
-
-// fn fn_selector_str(input: &str) -> u32 {
-// 	use sha3::Digest;
-// 	let mut hasher = sha3::Keccak256::new();
-// 	hasher.update(input.as_bytes());
-// 	let result = hasher.finalize();
-
-// 	let mut selector_bytes = [0; 4];
-// 	selector_bytes.copy_from_slice(&result[0..4]);
-
-// 	u32::from_be_bytes(selector_bytes)
-// }
-
 pub struct SolidityFunction<A, R> {
 	pub docs: &'static [&'static str],
 	pub selector_str: &'static str,
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -16,7 +16,7 @@
 
 //! The module contains a number of functions for converting and checking ethereum identifiers.
 
-use evm_coder::types::{uint256, address, EthCrossAccount};
+use evm_coder::types::{uint256, address};
 pub use pallet_evm::account::{Config, CrossAccountId};
 use sp_core::H160;
 use up_data_structs::CollectionId;