fix conflicts
This commit is contained in:
commit
37694af016
20 changed files with 288 additions and 830 deletions
|
@ -76,6 +76,9 @@ jobs:
|
|||
command: rustc --version; cargo --version; rustup --version
|
||||
- setup-sccache
|
||||
- restore-sccache-cache
|
||||
- run:
|
||||
name: Install foundry
|
||||
command: ./scripts/install_foundry.sh
|
||||
- run:
|
||||
name: Run integration tests
|
||||
no_output_timeout: "30m"
|
||||
|
|
421
Cargo.lock
generated
421
Cargo.lock
generated
|
@ -172,7 +172,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44"
|
||||
dependencies = [
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -184,7 +184,7 @@ dependencies = [
|
|||
"num-bigint 0.4.3",
|
||||
"num-traits 0.2.15",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -334,9 +334,9 @@ version = "0.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dd4e5f0bf8285d5ed538d27fab7411f3e297908fd93c62195de8bee3f199e82"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -361,12 +361,6 @@ dependencies = [
|
|||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.4.12"
|
||||
|
@ -402,23 +396,11 @@ version = "0.2.14"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "auto_impl"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a8c1df849285fbacd587de7818cc7d13be6cd2cbcd47a04fb1801b0e2706e33"
|
||||
dependencies = [
|
||||
"proc-macro-error 1.0.4",
|
||||
"proc-macro2 1.0.40",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -555,7 +537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"block-padding 0.2.1",
|
||||
"generic-array 0.14.5",
|
||||
"generic-array 0.14.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -564,7 +546,7 @@ version = "0.10.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
"generic-array 0.14.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -626,9 +608,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.1.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
|
||||
|
||||
[[package]]
|
||||
name = "camino"
|
||||
|
@ -656,7 +638,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
|
|||
dependencies = [
|
||||
"camino",
|
||||
"cargo-platform",
|
||||
"semver 1.0.12",
|
||||
"semver 1.0.16",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
@ -719,19 +701,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c6dd675567eb3e35787bd2583d129e85fabc7503b0a093d08c51198a307e2091"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error 0.4.12",
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmake"
|
||||
version = "0.1.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -897,7 +870,7 @@ version = "0.1.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5999502d32b9c48d492abe66392408144895020ec4709e549e840799f3bb74c0"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
"generic-array 0.14.6",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
|
@ -917,7 +890,7 @@ version = "0.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
"generic-array 0.14.6",
|
||||
"subtle 2.4.1",
|
||||
]
|
||||
|
||||
|
@ -950,7 +923,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
|
||||
dependencies = [
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -959,9 +932,9 @@ version = "2.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -997,14 +970,14 @@ version = "0.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
"generic-array 0.14.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.3"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
|
||||
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.2",
|
||||
"crypto-common",
|
||||
|
@ -1045,7 +1018,7 @@ dependencies = [
|
|||
"atty",
|
||||
"humantime",
|
||||
"log",
|
||||
"regex 1.6.0",
|
||||
"regex 1.7.1",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
|
@ -1082,7 +1055,7 @@ dependencies = [
|
|||
"ethereum-types",
|
||||
"hex 0.4.3",
|
||||
"once_cell",
|
||||
"regex 1.6.0",
|
||||
"regex 1.7.1",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha3 0.10.1",
|
||||
|
@ -1139,9 +1112,9 @@ version = "0.1.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -1181,9 +1154,9 @@ dependencies = [
|
|||
"num-bigint 0.2.6",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1315,9 +1288,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.5"
|
||||
version = "0.14.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
|
@ -1375,15 +1348,6 @@ dependencies = [
|
|||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
|
@ -1402,6 +1366,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.3.2"
|
||||
|
@ -1472,9 +1445,9 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1552,9 +1525,6 @@ name = "lazy_static"
|
|||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
|
@ -1633,20 +1603,6 @@ dependencies = [
|
|||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
|
||||
dependencies = [
|
||||
"num-bigint 0.4.3",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-rational",
|
||||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.2.6"
|
||||
|
@ -1670,15 +1626,6 @@ dependencies = [
|
|||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19"
|
||||
dependencies = [
|
||||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
|
@ -1700,18 +1647,6 @@ dependencies = [
|
|||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-bigint 0.4.3",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.1.43"
|
||||
|
@ -1732,35 +1667,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.1"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
|
||||
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.2.6",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9"
|
||||
dependencies = [
|
||||
"num_enum_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum_derive"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2 1.0.40",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.28.4"
|
||||
|
@ -1772,9 +1686,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.13.0"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
|
@ -1829,9 +1743,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1880,9 +1794,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
|
|||
dependencies = [
|
||||
"pest",
|
||||
"pest_meta",
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1983,23 +1897,10 @@ version = "0.4.12"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr 0.4.12",
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr 1.0.4",
|
||||
"proc-macro2 1.0.40",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
|
@ -2009,24 +1910,13 @@ version = "0.4.12"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
"syn-mid",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"quote 1.0.20",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
|
@ -2044,9 +1934,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.40"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2077,7 +1967,7 @@ version = "1.0.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2216,9 +2106,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.6.0"
|
||||
version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
||||
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
|
||||
dependencies = [
|
||||
"aho-corasick 0.7.18",
|
||||
"memchr",
|
||||
|
@ -2255,53 +2145,11 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b60030444003ac25474f5281e7e91f15e8475c173b729aac1c10aced56b3adac"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"auto_impl",
|
||||
"bytes",
|
||||
"hashbrown 0.12.1",
|
||||
"num_enum",
|
||||
"primitive-types",
|
||||
"revm_precompiles",
|
||||
"rlp",
|
||||
"sha3 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm_precompiles"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd6aae8f44783ef6ff39fc22c9c999dfa0e17b79d663b752730c02a025935185"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"num 0.4.0",
|
||||
"primitive-types",
|
||||
"ripemd",
|
||||
"secp256k1",
|
||||
"sha2 0.10.2",
|
||||
"sha3 0.10.1",
|
||||
"substrate-bn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ripemd"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3"
|
||||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rlp"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "999508abb0ae792aabed2460c45b89106d97fe4adac593bdaef433c2605847b5"
|
||||
checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"rustc-hex",
|
||||
|
@ -2372,24 +2220,6 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "secp256k1"
|
||||
version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0"
|
||||
dependencies = [
|
||||
"secp256k1-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "secp256k1-sys"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "152e20a0fd0519390fc43ab404663af8a0b794273d2a91d60ad4a39f13ffe110"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.11.0"
|
||||
|
@ -2401,9 +2231,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.12"
|
||||
version = "1.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
|
||||
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -2442,9 +2272,9 @@ version = "1.0.138"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2485,13 +2315,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.2"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
|
||||
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cpufeatures",
|
||||
"digest 0.10.3",
|
||||
"digest 0.10.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2512,7 +2342,7 @@ version = "0.10.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86"
|
||||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
"digest 0.10.6",
|
||||
"keccak",
|
||||
]
|
||||
|
||||
|
@ -2546,21 +2376,6 @@ version = "0.4.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||
|
||||
[[package]]
|
||||
name = "solc"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/g-r-a-n-t/solc-rust?rev=52d4146#52d414631bc6c3f0c29749503923a8d7e48b9f4d"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
|
@ -2579,19 +2394,6 @@ version = "0.9.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||
|
||||
[[package]]
|
||||
name = "substrate-bn"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b5bbfa79abbae15dd642ea8176a21a635ff3c00059961d1ea27ad04e5b441c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crunchy",
|
||||
"lazy_static",
|
||||
"rand 0.8.5",
|
||||
"rustc-hex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "1.0.0"
|
||||
|
@ -2617,11 +2419,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.98"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
|
||||
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2632,9 +2434,9 @@ version = "0.5.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2643,10 +2445,10 @@ version = "0.12.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"unicode-xid 0.2.3",
|
||||
"syn 1.0.107",
|
||||
"unicode-xid 0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2699,22 +2501,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.31"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
|
||||
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.31"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2746,9 +2548,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.35"
|
||||
version = "0.1.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
|
||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"pin-project-lite",
|
||||
|
@ -2758,20 +2560,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.22"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
|
||||
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.28"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
|
||||
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
|
@ -2857,9 +2659,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
|
||||
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
|
@ -2929,9 +2731,9 @@ dependencies = [
|
|||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -2963,9 +2765,9 @@ version = "0.2.81"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -2996,7 +2798,7 @@ version = "0.3.31"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ad594bf33e73cafcac2ae9062fc119d4f75f9c77e25022f91c9a64bd5b6463"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
]
|
||||
|
||||
|
@ -3065,9 +2867,9 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.40",
|
||||
"proc-macro2 1.0.50",
|
||||
"quote 1.0.20",
|
||||
"syn 1.0.98",
|
||||
"syn 1.0.107",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -3110,7 +2912,7 @@ dependencies = [
|
|||
"csv",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"num 0.1.42",
|
||||
"num",
|
||||
"num-bigint 0.2.6",
|
||||
"pretty_assertions 0.6.1",
|
||||
"reduce",
|
||||
|
@ -3225,7 +3027,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_cbor",
|
||||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.6",
|
||||
"tempdir",
|
||||
"typed-arena",
|
||||
"zokrates_abi",
|
||||
|
@ -3240,7 +3042,6 @@ dependencies = [
|
|||
"zokrates_fs_resolver",
|
||||
"zokrates_interpreter",
|
||||
"zokrates_proof_systems",
|
||||
"zokrates_solidity_test",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3269,7 +3070,7 @@ dependencies = [
|
|||
"csv",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"num 0.1.42",
|
||||
"num",
|
||||
"num-bigint 0.2.6",
|
||||
"pretty_assertions 0.6.1",
|
||||
"serde",
|
||||
|
@ -3349,7 +3150,7 @@ name = "zokrates_interpreter"
|
|||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"ark-bls12-377",
|
||||
"num 0.1.42",
|
||||
"num",
|
||||
"num-bigint 0.2.6",
|
||||
"pairing_ce",
|
||||
"serde",
|
||||
|
@ -3428,20 +3229,6 @@ dependencies = [
|
|||
"zokrates_field",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zokrates_solidity_test"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"ethabi",
|
||||
"hex 0.4.3",
|
||||
"primitive-types",
|
||||
"rand 0.8.5",
|
||||
"revm",
|
||||
"serde_json",
|
||||
"solc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zokrates_stdlib"
|
||||
version = "0.3.3"
|
||||
|
|
|
@ -12,7 +12,6 @@ members = [
|
|||
"zokrates_abi",
|
||||
"zokrates_test",
|
||||
"zokrates_core_test",
|
||||
"zokrates_solidity_test",
|
||||
"zokrates_ark",
|
||||
"zokrates_ast",
|
||||
"zokrates_interpreter",
|
||||
|
|
1
changelogs/unreleased/1266-schaeff
Normal file
1
changelogs/unreleased/1266-schaeff
Normal file
|
@ -0,0 +1 @@
|
|||
Remove solc dependency for tests, use foundry instead
|
1
changelogs/unreleased/1269-schaeff
Normal file
1
changelogs/unreleased/1269-schaeff
Normal file
|
@ -0,0 +1 @@
|
|||
Fix array propagation for spreads and repeaters
|
|
@ -1,11 +1,9 @@
|
|||
FROM rustlang/rust:nightly
|
||||
|
||||
MAINTAINER JacobEberhardt <jacob.eberhardt@tu-berlin.de>, Thibaut Schaeffer <thibaut@schaeff.fr>
|
||||
|
||||
RUN useradd -u 1000 -m zokrates
|
||||
|
||||
COPY ./scripts/install_solcjs_deb.sh /tmp/
|
||||
RUN /tmp/install_solcjs_deb.sh
|
||||
COPY ./scripts/install_foundry_deb.sh /tmp/
|
||||
RUN /tmp/install_foundry_deb.sh
|
||||
|
||||
USER zokrates
|
||||
|
||||
|
|
|
@ -2,5 +2,4 @@
|
|||
|
||||
# Exit if any subcommand fails
|
||||
set -e
|
||||
|
||||
cargo test -j 4 --release --package zokrates_cli -- --ignored
|
6
scripts/install_foundry.sh
Executable file
6
scripts/install_foundry.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
apt-get update -y
|
||||
apt-get install -y curl gnupg sudo build-essential git
|
||||
curl -L https://foundry.paradigm.xyz | bash
|
||||
$HOME/.foundry/bin/foundryup
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
apt-get update -y
|
||||
apt-get install -y curl gnupg sudo build-essential git
|
||||
curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
||||
apt-get install -y nodejs
|
||||
npm i -g solc
|
|
@ -2664,7 +2664,7 @@ impl<'ast, T: Field> Constant for ArrayExpression<'ast, T> {
|
|||
e: TypedExpressionOrSpread<T>,
|
||||
) -> Vec<TypedExpression<T>> {
|
||||
match e {
|
||||
TypedExpressionOrSpread::Expression(e) => vec![e],
|
||||
TypedExpressionOrSpread::Expression(e) => vec![e.into_canonical_constant()],
|
||||
TypedExpressionOrSpread::Spread(s) => match s.array.into_inner() {
|
||||
ArrayExpressionInner::Value(v) => v
|
||||
.into_iter()
|
||||
|
@ -2698,7 +2698,7 @@ impl<'ast, T: Field> Constant for ArrayExpression<'ast, T> {
|
|||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
vec![e; count as usize]
|
||||
vec![e.into_canonical_constant(); count as usize]
|
||||
}
|
||||
a => unreachable!("{}", a),
|
||||
},
|
||||
|
|
|
@ -47,7 +47,6 @@ zokrates_bellman = { version = "0.1", path = "../zokrates_bellman", features = [
|
|||
glob = "0.2.11"
|
||||
assert_cli = "0.5"
|
||||
tempdir = "0.3"
|
||||
zokrates_solidity_test = { version = "0.1", path = "../zokrates_solidity_test", default-features = false }
|
||||
ethabi = "17.0.0"
|
||||
primitive-types = { version = "0.11", features = ["rlp"] }
|
||||
fs_extra = "1.1.0"
|
||||
|
|
|
@ -4,10 +4,10 @@ extern crate primitive_types;
|
|||
extern crate rand_0_4;
|
||||
extern crate rand_0_8;
|
||||
extern crate serde_json;
|
||||
extern crate zokrates_solidity_test;
|
||||
|
||||
#[cfg(test)]
|
||||
mod integration {
|
||||
use ethabi::Token;
|
||||
use fs_extra::copy_items;
|
||||
use fs_extra::dir::CopyOptions;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
@ -15,16 +15,16 @@ mod integration {
|
|||
use serde_json::from_reader;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader, Read};
|
||||
use std::io::{BufReader, Read, Write};
|
||||
use std::panic;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use tempdir::TempDir;
|
||||
use zokrates_abi::{parse_strict, Encode};
|
||||
use zokrates_ast::typed::abi::Abi;
|
||||
use zokrates_field::Bn128Field;
|
||||
use zokrates_proof_systems::{
|
||||
to_token::ToToken, Marlin, Proof, SolidityCompatibleScheme, G16, GM17,
|
||||
SOLIDITY_G2_ADDITION_LIB,
|
||||
};
|
||||
|
||||
macro_rules! map(
|
||||
|
@ -41,6 +41,7 @@ mod integration {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_compile_and_witness_dir() {
|
||||
let forge = dirs::home_dir().unwrap().join(".foundry/bin/forge");
|
||||
let global_dir = TempDir::new("global").unwrap();
|
||||
let global_base = global_dir.path();
|
||||
let universal_setup_path = global_base.join("universal_setup.dat");
|
||||
|
@ -59,6 +60,38 @@ mod integration {
|
|||
.succeeds()
|
||||
.unwrap();
|
||||
|
||||
let solidity_test_path = global_base.join("zokrates_verifier");
|
||||
std::fs::create_dir(&solidity_test_path).unwrap();
|
||||
|
||||
Command::new(&forge)
|
||||
.output()
|
||||
.expect("Could not run `forge`. Make sure foundry is installed to run this test");
|
||||
|
||||
let output = Command::new(&forge)
|
||||
.current_dir(&solidity_test_path)
|
||||
.arg("init")
|
||||
.arg("--no-git")
|
||||
.arg("--no-commit")
|
||||
.arg(".")
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
std::io::stdout().write_all(&output.stdout).unwrap();
|
||||
std::io::stderr().write_all(&output.stderr).unwrap();
|
||||
|
||||
assert!(output.status.success());
|
||||
|
||||
Command::new("rm")
|
||||
.current_dir(&solidity_test_path)
|
||||
.arg("./src/*.sol")
|
||||
.output()
|
||||
.unwrap();
|
||||
Command::new("rm")
|
||||
.current_dir(&solidity_test_path)
|
||||
.arg("./test/*.t.sol")
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
let dir = Path::new("./tests/code");
|
||||
assert!(dir.is_dir());
|
||||
for entry in fs::read_dir(dir).unwrap() {
|
||||
|
@ -80,6 +113,17 @@ mod integration {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
let output = Command::new(&forge)
|
||||
.current_dir(&solidity_test_path)
|
||||
.arg("test")
|
||||
.output()
|
||||
.expect("failed to forge test");
|
||||
|
||||
std::io::stdout().write_all(&output.stdout).unwrap();
|
||||
std::io::stderr().write_all(&output.stderr).unwrap();
|
||||
|
||||
assert!(output.status.success());
|
||||
}
|
||||
|
||||
fn test_compile_and_witness(
|
||||
|
@ -106,6 +150,7 @@ mod integration {
|
|||
.join(program_name)
|
||||
.join("proving")
|
||||
.with_extension("key");
|
||||
let solidity_test_path = global_path.join("zokrates_verifier");
|
||||
let verification_contract_path = tmp_base
|
||||
.join(program_name)
|
||||
.join("verifier")
|
||||
|
@ -241,7 +286,6 @@ mod integration {
|
|||
|
||||
for (backend, schemes) in backends {
|
||||
for scheme in &schemes {
|
||||
println!("test with {}, {}", backend, scheme);
|
||||
// SETUP
|
||||
let setup = assert_cli::Assert::main_binary()
|
||||
.with_args(&[
|
||||
|
@ -324,7 +368,14 @@ mod integration {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
test_solidity_verifier(contract_str, proof);
|
||||
test_solidity_verifier(
|
||||
program_name,
|
||||
backend,
|
||||
scheme,
|
||||
&solidity_test_path,
|
||||
&contract_str,
|
||||
proof,
|
||||
);
|
||||
}
|
||||
"g16" => {
|
||||
// Get the proof
|
||||
|
@ -333,7 +384,14 @@ mod integration {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
test_solidity_verifier(contract_str, proof);
|
||||
test_solidity_verifier(
|
||||
program_name,
|
||||
backend,
|
||||
scheme,
|
||||
&solidity_test_path,
|
||||
&contract_str,
|
||||
proof,
|
||||
);
|
||||
}
|
||||
"gm17" => {
|
||||
// Get the proof
|
||||
|
@ -342,7 +400,14 @@ mod integration {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
test_solidity_verifier(contract_str, proof);
|
||||
test_solidity_verifier(
|
||||
program_name,
|
||||
backend,
|
||||
scheme,
|
||||
&solidity_test_path,
|
||||
&contract_str,
|
||||
proof,
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
@ -352,48 +417,13 @@ mod integration {
|
|||
}
|
||||
|
||||
fn test_solidity_verifier<S: SolidityCompatibleScheme<Bn128Field> + ToToken<Bn128Field>>(
|
||||
src: String,
|
||||
program_name: &str,
|
||||
backend: &str,
|
||||
scheme: &str,
|
||||
solidity_test_path: &Path,
|
||||
contract_str: &str,
|
||||
proof: Proof<Bn128Field, S>,
|
||||
) {
|
||||
use ethabi::Token;
|
||||
use rand_0_8::{rngs::StdRng, SeedableRng};
|
||||
use zokrates_solidity_test::{address::*, contract::*, evm::*, to_be_bytes};
|
||||
|
||||
// Setup EVM
|
||||
let mut rng = StdRng::from_seed([0; 32]);
|
||||
let mut evm = Evm::default();
|
||||
let deployer = Address::random(&mut rng);
|
||||
evm.create_account(&deployer, 0);
|
||||
|
||||
// Compile lib
|
||||
let g2_lib =
|
||||
Contract::compile_from_src_string(SOLIDITY_G2_ADDITION_LIB, "BN256G2", true, &[])
|
||||
.unwrap();
|
||||
|
||||
// Deploy lib
|
||||
let create_result = evm
|
||||
.deploy(g2_lib.encode_create_contract_bytes(&[]).unwrap(), &deployer)
|
||||
.unwrap();
|
||||
let lib_addr = create_result.addr;
|
||||
|
||||
// Compile contract
|
||||
let contract = Contract::compile_from_src_string(
|
||||
&src,
|
||||
"Verifier",
|
||||
true,
|
||||
&[("BN256G2", lib_addr.as_token())],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Deploy contract
|
||||
let create_result = evm
|
||||
.deploy(
|
||||
contract.encode_create_contract_bytes(&[]).unwrap(),
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
let contract_addr = create_result.addr;
|
||||
|
||||
// convert to the solidity proof format
|
||||
let solidity_proof = S::Proof::from(proof.proof);
|
||||
|
||||
|
@ -412,40 +442,95 @@ mod integration {
|
|||
.collect::<Vec<_>>(),
|
||||
);
|
||||
|
||||
let inputs = [proof_token, input_token.clone()];
|
||||
|
||||
// Call verify function on contract
|
||||
let result = evm
|
||||
.call(
|
||||
contract
|
||||
.encode_call_contract_bytes("verifyTx", &inputs)
|
||||
.unwrap(),
|
||||
&contract_addr,
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(&result.out, &to_be_bytes(&U256::from(1)));
|
||||
let inputs = ethabi::encode(&[proof_token, input_token.clone()]);
|
||||
|
||||
// modify the proof
|
||||
let modified_solidity_proof = S::modify(solidity_proof);
|
||||
|
||||
let modified_proof_token = S::to_token(modified_solidity_proof);
|
||||
|
||||
let inputs = [modified_proof_token, input_token];
|
||||
let modified_inputs = ethabi::encode(&[modified_proof_token, input_token]);
|
||||
|
||||
// Call verify function on contract
|
||||
let result = evm
|
||||
.call(
|
||||
contract
|
||||
.encode_call_contract_bytes("verifyTx", &inputs)
|
||||
.unwrap(),
|
||||
&contract_addr,
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
let verifier_name = format!("Verifier_{}_{}_{}", program_name, scheme, backend);
|
||||
|
||||
assert_eq!(result.op_out, Return::InvalidOpcode);
|
||||
let verifier_path = solidity_test_path
|
||||
.join("src")
|
||||
.join(&verifier_name)
|
||||
.with_extension("sol");
|
||||
let mut file = File::create(verifier_path).unwrap();
|
||||
write!(file, "{}", contract_str).unwrap();
|
||||
|
||||
let test_path = solidity_test_path
|
||||
.join("test")
|
||||
.join(format!(
|
||||
"Verifier_{}_{}_{}_Test",
|
||||
program_name, scheme, backend
|
||||
))
|
||||
.with_extension("t.sol");
|
||||
let mut file = File::create(test_path).unwrap();
|
||||
let test_content = format!(
|
||||
r#"
|
||||
|
||||
pragma solidity ^0.8.17;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import "../src/{}.sol";
|
||||
|
||||
contract VerifierTest is Test {{
|
||||
Verifier public verifier;
|
||||
|
||||
constructor() {{
|
||||
verifier = new Verifier();
|
||||
}}
|
||||
|
||||
function testValidProof() public {{
|
||||
bytes4 selector = verifier.verifyTx.selector;
|
||||
uint8[{}] memory b = [{}];
|
||||
bytes memory data = new bytes(b.length + 4);
|
||||
for(uint i; i < 4; i++) {{
|
||||
data[i] = selector[i];
|
||||
}}
|
||||
for(uint i; i < b.length; i++) {{
|
||||
data[i + 4] = bytes1(b[i]);
|
||||
}}
|
||||
(bool success, bytes memory returnData) = address(verifier).call(data);
|
||||
assertEq(success, true);
|
||||
bool res = abi.decode(returnData, (bool));
|
||||
assertEq(res, true);
|
||||
}}
|
||||
|
||||
function testInvalidProof() public {{
|
||||
bytes4 selector = verifier.verifyTx.selector;
|
||||
uint8[{}] memory b = [{}];
|
||||
bytes memory data = new bytes(b.length + 4);
|
||||
for(uint i; i < 4; i++) {{
|
||||
data[i] = selector[i];
|
||||
}}
|
||||
for(uint i; i < b.length; i++) {{
|
||||
data[i + 4] = bytes1(b[i]);
|
||||
}}
|
||||
(bool success, ) = address(verifier).call(data);
|
||||
assertEq(success, false);
|
||||
}}
|
||||
}}
|
||||
|
||||
"#,
|
||||
verifier_name,
|
||||
inputs.len(),
|
||||
inputs
|
||||
.iter()
|
||||
.map(|v| format!("{:#04X?}", v))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
modified_inputs.len(),
|
||||
modified_inputs
|
||||
.iter()
|
||||
.map(|v| format!("{:#04X?}", v))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
);
|
||||
|
||||
write!(file, "{}", test_content).unwrap();
|
||||
}
|
||||
|
||||
fn test_compile_and_smtlib2(
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"curves": ["Bn128"],
|
||||
"max_constraint_count": 0,
|
||||
"tests": []
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
def main() {
|
||||
field[2][2] mut a = [[1; 2], [1; 2]];
|
||||
a[0][0] = 0;
|
||||
field[2][2] mut b = [...[[1; 2]; 2]];
|
||||
b[0][0] = 0;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
[package]
|
||||
name = "zokrates_solidity_test"
|
||||
version = "0.1.1"
|
||||
authors = ["Nirvan Tyagi <nirvan.tyagi@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# Modeled after the testing pipeline of the Fe project: https://github.com/ethereum/fe/
|
||||
|
||||
[dependencies]
|
||||
ethabi = "17.0.0"
|
||||
primitive-types = { version = "0.11", features = ["rlp"] }
|
||||
hex = { version = "0.4" }
|
||||
bytes = { version = "1.1", default-features = false }
|
||||
serde_json = { version = "1.0" }
|
||||
rand = { version = "0.8" }
|
||||
|
||||
revm = { version = "1.6.0" }
|
||||
solc = { git = "https://github.com/g-r-a-n-t/solc-rust", rev = "52d4146" }
|
|
@ -1,18 +0,0 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.10;
|
||||
|
||||
contract SimpleStorage {
|
||||
Var myVariable;
|
||||
|
||||
struct Var {
|
||||
uint v;
|
||||
}
|
||||
|
||||
function set(Var memory x) public {
|
||||
myVariable = x;
|
||||
}
|
||||
|
||||
function get() public view returns (uint) {
|
||||
return myVariable.v;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
use ethabi::token::Token;
|
||||
use primitive_types::H160;
|
||||
use rand::Rng;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct Address(pub H160);
|
||||
|
||||
impl Address {
|
||||
pub fn random<R: Rng>(rng: &mut R) -> Self {
|
||||
Self(H160(rng.gen()))
|
||||
}
|
||||
|
||||
pub fn as_token(&self) -> Token {
|
||||
Token::Address(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<H160> for Address {
|
||||
fn as_ref(&self) -> &H160 {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<H160> for Address {
|
||||
fn from(hash: H160) -> Self {
|
||||
Self(hash)
|
||||
}
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
use ethabi::{Contract as ContractAbi, Token};
|
||||
use serde_json::{from_str, json};
|
||||
use solc::compile;
|
||||
|
||||
use std::{fs::File, io::Read, path::Path};
|
||||
|
||||
use crate::{Error, EvmTestError};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Contract {
|
||||
pub binary: Vec<u8>,
|
||||
pub abi: ContractAbi,
|
||||
}
|
||||
|
||||
impl Contract {
|
||||
pub fn new(binary: Vec<u8>, abi: ContractAbi) -> Self {
|
||||
Self { binary, abi }
|
||||
}
|
||||
|
||||
pub fn compile_from_solidity_file<P: AsRef<Path>>(
|
||||
path: P,
|
||||
contract_name: &str,
|
||||
opt: bool,
|
||||
) -> Result<Self, Error> {
|
||||
// Load source file
|
||||
let mut src_file = File::open(path)
|
||||
.map_err(|_| Box::new(EvmTestError("src file open failed".to_string())))?;
|
||||
let mut src = String::new();
|
||||
src_file
|
||||
.read_to_string(&mut src)
|
||||
.map_err(|_| Box::new(EvmTestError("src file read failed".to_string())))?;
|
||||
|
||||
Self::compile_from_src_string(&src, contract_name, opt, &[])
|
||||
}
|
||||
|
||||
pub fn compile_from_src_string(
|
||||
src: &str,
|
||||
contract_name: &str,
|
||||
opt: bool,
|
||||
libraries: &[(&str, Token)],
|
||||
) -> Result<Self, Error> {
|
||||
// Compile source file using solc
|
||||
// Configuration: https://docs.soliditylang.org/en/v0.8.10/using-the-compiler.html
|
||||
// TODO: Change output selection to only compile 'input' file
|
||||
let solc_config = format!(
|
||||
r#"
|
||||
{{
|
||||
"language": "Solidity",
|
||||
"sources": {{ "input.sol": {{ "content": {} }} }},
|
||||
"settings": {{
|
||||
"optimizer": {{ "enabled": {} }},
|
||||
"libraries": {{
|
||||
"input.sol" : {{ {} }}
|
||||
}},
|
||||
"outputSelection": {{
|
||||
"*": {{
|
||||
"*": [
|
||||
"evm.bytecode.object", "abi"
|
||||
],
|
||||
"": [ "*" ] }}
|
||||
}}
|
||||
}}
|
||||
}}"#,
|
||||
json!(src),
|
||||
opt,
|
||||
libraries
|
||||
.iter()
|
||||
.map(|(name, address)| format!("\"{}\": \"0x{}\"", name, address))
|
||||
.collect::<Vec<_>>()
|
||||
.join(",\n")
|
||||
);
|
||||
|
||||
Self::compile_from_config(&solc_config, contract_name)
|
||||
}
|
||||
|
||||
pub fn compile_from_config(config: &str, contract_name: &str) -> Result<Self, Error> {
|
||||
// Compile source file using solc
|
||||
// Configuration: https://docs.soliditylang.org/en/v0.8.10/using-the-compiler.html
|
||||
let out = from_str::<serde_json::Value>(&compile(config))
|
||||
.map_err(|_| Box::new(EvmTestError("solc compile failed".to_string())))?;
|
||||
|
||||
if out["errors"].is_array()
|
||||
&& out["errors"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.any(|e| e["severity"] == "error")
|
||||
{
|
||||
return Err(Box::new(EvmTestError(format!(
|
||||
"solc compiled with errors: {}",
|
||||
out["errors"]
|
||||
))));
|
||||
}
|
||||
|
||||
let binary = {
|
||||
let hex_code = out["contracts"]["input.sol"][contract_name]["evm"]["bytecode"]
|
||||
["object"]
|
||||
.to_string()
|
||||
.replace('\"', "");
|
||||
|
||||
hex::decode(&hex_code)
|
||||
.map_err(|_| Box::new(EvmTestError("decode hex binary failed".to_string())))?
|
||||
};
|
||||
let abi = {
|
||||
if out["contracts"]["input.sol"][contract_name]["abi"] == "null" {
|
||||
return Err(Box::new(EvmTestError(
|
||||
"solc compiled with null abi".to_string(),
|
||||
)));
|
||||
}
|
||||
ContractAbi::load(
|
||||
out["contracts"]["input.sol"][contract_name]["abi"]
|
||||
.to_string()
|
||||
.as_bytes(),
|
||||
)
|
||||
.map_err(|_| Box::new(EvmTestError("ethabi failed loading abi".to_string())))?
|
||||
};
|
||||
|
||||
Ok(Contract { binary, abi })
|
||||
}
|
||||
|
||||
pub fn encode_create_contract_bytes(&self, init: &[Token]) -> Result<Vec<u8>, Error> {
|
||||
match &self.abi.constructor {
|
||||
Some(constructor) => {
|
||||
let binary = constructor
|
||||
.encode_input(self.binary.clone(), init)
|
||||
.map_err(|_| {
|
||||
Box::new(EvmTestError(
|
||||
"abi constructor failed to encode inputs".to_string(),
|
||||
))
|
||||
})?;
|
||||
Ok(binary.to_vec())
|
||||
}
|
||||
None => Ok(self.binary.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn encode_call_contract_bytes(
|
||||
&self,
|
||||
fn_name: &str,
|
||||
input: &[Token],
|
||||
) -> Result<Vec<u8>, Error> {
|
||||
match self.abi.functions.get(fn_name) {
|
||||
Some(f) => {
|
||||
let call_binary = f[0].encode_input(input).map_err(|_| {
|
||||
Box::new(EvmTestError(
|
||||
"abi function failed to encode inputs".to_string(),
|
||||
))
|
||||
})?;
|
||||
Ok(call_binary.to_vec())
|
||||
}
|
||||
None => Err(Box::new(EvmTestError(
|
||||
"abi does not include function".to_string(),
|
||||
))),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
use primitive_types::U256;
|
||||
pub use revm::Return;
|
||||
use revm::{AccountInfo, Database, InMemoryDB, Log, TransactOut, TransactTo, EVM};
|
||||
|
||||
use crate::{address::Address, Error, EvmTestError};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CallResult {
|
||||
pub op_out: Return,
|
||||
pub out: Vec<u8>,
|
||||
pub gas: u64,
|
||||
pub log_out: Vec<Log>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CreateContractResult {
|
||||
pub addr: Address,
|
||||
pub gas: u64,
|
||||
}
|
||||
|
||||
pub struct Evm {
|
||||
vm: EVM<InMemoryDB>,
|
||||
}
|
||||
|
||||
impl Default for Evm {
|
||||
fn default() -> Self {
|
||||
let mut vm = revm::new();
|
||||
vm.database(InMemoryDB::default());
|
||||
Self { vm }
|
||||
}
|
||||
}
|
||||
|
||||
impl Evm {
|
||||
pub fn call(
|
||||
&mut self,
|
||||
input: Vec<u8>,
|
||||
addr: &Address,
|
||||
caller: &Address,
|
||||
) -> Result<CallResult, Error> {
|
||||
self.vm.env.tx.caller = *caller.as_ref();
|
||||
self.vm.env.tx.transact_to = TransactTo::Call(*addr.as_ref());
|
||||
self.vm.env.tx.data = input.into();
|
||||
let (op_out, tx_out, gas, log_out) = self.vm.transact_commit();
|
||||
let out = match tx_out {
|
||||
TransactOut::Call(out) => Ok(out.to_vec()),
|
||||
_ => Err(Box::new(EvmTestError(
|
||||
"call contract function failed".to_string(),
|
||||
))),
|
||||
}?;
|
||||
Ok(CallResult {
|
||||
op_out,
|
||||
out,
|
||||
gas,
|
||||
log_out,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn deploy(
|
||||
&mut self,
|
||||
contract: Vec<u8>,
|
||||
deployer: &Address,
|
||||
) -> Result<CreateContractResult, Error> {
|
||||
self.vm.env.tx.caller = *deployer.as_ref();
|
||||
self.vm.env.tx.transact_to = TransactTo::create();
|
||||
self.vm.env.tx.data = contract.into();
|
||||
let (_, tx_out, gas, _) = self.vm.transact_commit();
|
||||
let contract_address = match tx_out {
|
||||
TransactOut::Create(_, Some(addr)) => Ok(Address(addr)),
|
||||
_ => Err(Box::new(EvmTestError("create contract failed".to_string()))),
|
||||
}?;
|
||||
Ok(CreateContractResult {
|
||||
addr: contract_address,
|
||||
gas,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn create_account(&mut self, address: &Address, balance: impl Into<U256>) {
|
||||
let acc = AccountInfo::from_balance(balance.into());
|
||||
self.vm.db().unwrap().insert_cache(*address.as_ref(), acc);
|
||||
}
|
||||
|
||||
pub fn set_account_balance(
|
||||
&mut self,
|
||||
address: &Address,
|
||||
balance: impl Into<U256>,
|
||||
) -> Result<(), Error> {
|
||||
let mut acc = self.vm.db().unwrap().basic(*address.as_ref());
|
||||
acc.balance = balance.into();
|
||||
self.vm.db().unwrap().insert_cache(*address.as_ref(), acc);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn balance_of(&mut self, address: &Address) -> U256 {
|
||||
self.vm.db().unwrap().basic(*address.as_ref()).balance
|
||||
}
|
||||
|
||||
pub fn get_account(&mut self, address: &Address) -> AccountInfo {
|
||||
self.vm.db().unwrap().basic(*address.as_ref())
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
use primitive_types::U256;
|
||||
|
||||
use std::{
|
||||
error::Error as ErrorTrait,
|
||||
fmt::{self, Debug},
|
||||
};
|
||||
|
||||
pub mod address;
|
||||
pub mod contract;
|
||||
pub mod evm;
|
||||
|
||||
pub type Error = Box<dyn ErrorTrait>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EvmTestError(String);
|
||||
|
||||
impl ErrorTrait for EvmTestError {
|
||||
fn source(&self) -> Option<&(dyn ErrorTrait + 'static)> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for EvmTestError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_be_bytes(n: &U256) -> [u8; 32] {
|
||||
let mut input_bytes: [u8; 32] = [0; 32];
|
||||
n.to_big_endian(&mut input_bytes);
|
||||
input_bytes
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{address::Address, contract::Contract, evm::Evm};
|
||||
use ethabi::Token;
|
||||
use rand::{rngs::StdRng, SeedableRng};
|
||||
|
||||
#[test]
|
||||
fn simple_storage_contract_test() {
|
||||
let mut rng = StdRng::seed_from_u64(0u64);
|
||||
|
||||
// Compile contract
|
||||
let contract_path = format!(
|
||||
"{}/contracts/simple_storage.sol",
|
||||
env!("CARGO_MANIFEST_DIR")
|
||||
);
|
||||
let contract =
|
||||
Contract::compile_from_solidity_file(contract_path, "SimpleStorage", false).unwrap();
|
||||
|
||||
// Setup EVM
|
||||
let mut evm = Evm::default();
|
||||
let deployer = Address::random(&mut rng);
|
||||
evm.create_account(&deployer, 0);
|
||||
|
||||
// Deploy contract
|
||||
let create_result = evm
|
||||
.deploy(
|
||||
contract.encode_create_contract_bytes(&[]).unwrap(),
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
let contract_addr = create_result.addr.clone();
|
||||
println!("Contract deploy gas cost: {}", create_result.gas);
|
||||
|
||||
// Call get function on contract
|
||||
let get_result = evm
|
||||
.call(
|
||||
contract.encode_call_contract_bytes("get", &[]).unwrap(),
|
||||
&contract_addr,
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(&get_result.out, &to_be_bytes(&U256::from(0)));
|
||||
|
||||
// Call set function on contract
|
||||
let _ = evm
|
||||
.call(
|
||||
contract
|
||||
.encode_call_contract_bytes(
|
||||
"set",
|
||||
&[Token::Tuple(vec![Token::Uint(U256::from(40))])],
|
||||
)
|
||||
.unwrap(),
|
||||
&contract_addr,
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Call get function on contract
|
||||
let get_result = evm
|
||||
.call(
|
||||
contract.encode_call_contract_bytes("get", &[]).unwrap(),
|
||||
&contract_addr,
|
||||
&deployer,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(&get_result.out, &to_be_bytes(&U256::from(40)));
|
||||
println!("{:?}", get_result);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue