From 2657f23965de2e652a3952207b34a7bc6c86b30b Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Wed, 24 Mar 2021 11:46:03 -0700 Subject: [PATCH] Implement upgradability and meta-transactions. (#6) * Add constructor and encapsulate configured engine state. * Add sim test for upgrades and upgrade code. * Implement meta-transaction parsing and processing. (Closes #4) * Implement the ecrecover precompile. (#5) --- .gitignore | 3 + Cargo.lock | 3694 ++++++++++++++++++++++++++++++++---- Cargo.toml | 10 +- src/.gitkeep | 0 src/engine.rs | 70 +- src/lib.rs | 149 +- src/meta_parsing.rs | 556 ++++++ src/parameters.rs | 40 +- src/precompiles.rs | 50 +- src/prelude.rs | 10 +- src/sdk.rs | 55 +- src/transaction.rs | 2 +- src/types.rs | 26 + tests/.gitkeep | 0 tests/test_meta_parsing.rs | 119 ++ tests/test_upgrade.rs | 55 + 16 files changed, 4396 insertions(+), 443 deletions(-) delete mode 100644 src/.gitkeep create mode 100644 src/meta_parsing.rs delete mode 100644 tests/.gitkeep create mode 100644 tests/test_meta_parsing.rs create mode 100644 tests/test_upgrade.rs diff --git a/.gitignore b/.gitignore index beca5a900..4c577a1ed 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ # Visual Studio Code .vscode/ +# IDEA +.idea + # Editor backup files *~ diff --git a/Cargo.lock b/Cargo.lock index bb1c2b27d..386382d74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,56 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + +[[package]] +name = "addr2line" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +dependencies = [ + "gimli 0.23.0", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "ahash" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767" + [[package]] name = "arrayref" version = "0.3.6" @@ -18,15 +63,50 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-trait" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + [[package]] name = "aurora-engine" version = "0.0.0" dependencies = [ "borsh", + "ethabi", "evm", "hex", - "lazy_static", "libsecp256k1", + "lunarity-lexer", + "near-crypto", + "near-sdk", + "near-sdk-sim", "primitive-types", "ripemd160", "rlp", @@ -35,6 +115,78 @@ dependencies = [ "wee_alloc", ] +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "backtrace" +version = "0.3.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" +dependencies = [ + "addr2line", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object 0.23.0", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772" +dependencies = [ + "byteorder", + "serde", +] + +[[package]] +name = "bindgen" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36" +dependencies = [ + "bitflags", + "cexpr", + "cfg-if 0.1.10", + "clang-sys", + "clap", + "env_logger", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2 1.0.24", + "quote 1.0.9", + "regex", + "rustc-hash", + "shlex", + "which 3.1.1", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + [[package]] name = "bitvec" version = "0.20.2" @@ -47,6 +199,32 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" +dependencies = [ + "crypto-mac", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "blake3" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 0.1.10", + "constant_time_eq", + "crypto-mac", + "digest 0.9.0", +] + [[package]] name = "block-buffer" version = "0.7.3" @@ -103,8 +281,8 @@ dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate", - "proc-macro2", - "syn", + "proc-macro2 1.0.24", + "syn 1.0.57", ] [[package]] @@ -113,9 +291,9 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2104c73179359431cc98e016998f2f23bc7a05bc53e79741bcba705f30047bc" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", ] [[package]] @@ -124,11 +302,17 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae29eb8418fcd46f723f8691a2ac06857d31179d33d2f2d91eb13967de97c728" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "byte-slice-cast" version = "1.0.0" @@ -143,9 +327,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "bytes" @@ -154,631 +338,3372 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "c2-chacha" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "fb6b83fa00a7c53f420893670940c8fdfaa89f9dd9adb52062cca39482a31ab6" +dependencies = [ + "cipher", + "ppv-lite86", +] [[package]] -name = "cfg-if" -version = "1.0.0" +name = "cached" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "5e2afe73808fbaac302e39c9754bfc3c4b4d0f99c9c240b9f4e4efc841ad1b74" +dependencies = [ + "async-mutex", + "async-trait", + "cached_proc_macro", + "cached_proc_macro_types", + "futures", + "hashbrown", + "once_cell", +] [[package]] -name = "cpuid-bool" -version = "0.1.2" +name = "cached_proc_macro" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" +checksum = "bf857ae42d910aede5c5186e62684b0d7a597ce2fe3bd14448ab8f7ef439848c" +dependencies = [ + "async-mutex", + "cached_proc_macro_types", + "darling 0.10.2", + "quote 1.0.9", + "syn 1.0.57", +] [[package]] -name = "crunchy" -version = "0.2.2" +name = "cached_proc_macro_types" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663" [[package]] -name = "digest" -version = "0.8.1" +name = "cc" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" dependencies = [ - "generic-array 0.12.4", + "jobserver", ] [[package]] -name = "digest" -version = "0.9.0" +name = "cexpr" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" dependencies = [ - "generic-array 0.14.4", + "nom", ] [[package]] -name = "ethbloom" -version = "0.11.0" +name = "cfg-if" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779864b9c7f7ead1f092972c3257496c6a84b46dba2ce131dd8a282cb2cc5972" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-rlp", - "tiny-keccak", -] +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] -name = "ethereum" -version = "0.7.1" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567ce064a8232c16e2b2c2173a936b91fbe35c2f2c5278871f5a1a31688b42e9" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "ethereum-types", - "funty", - "hash-db", - "hash256-std-hasher", - "parity-scale-codec", - "rlp", - "rlp-derive", + "libc", + "num-integer", + "num-traits", "serde", - "sha3 0.9.1", - "triehash", + "time", + "winapi", ] [[package]] -name = "ethereum-types" -version = "0.11.0" +name = "cipher" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f64b5df66a228d85e4b17e5d6c6aa43b0310898ffe8a85988c4c032357aaabfd" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "ethbloom", - "fixed-hash", - "impl-rlp", - "primitive-types", - "uint", + "generic-array 0.14.4", ] [[package]] -name = "evm" -version = "0.25.0" -source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +name = "clang-sys" +version = "0.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ - "ethereum", - "evm-core", - "evm-gasometer", - "evm-runtime", - "log", - "parity-scale-codec", - "primitive-types", - "rlp", - "serde", - "sha3 0.8.2", + "glob", + "libc", + "libloading 0.5.2", ] [[package]] -name = "evm-core" -version = "0.25.0" -source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "funty", - "parity-scale-codec", - "primitive-types", - "serde", + "ansi_term", + "atty", + "bitflags", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] -name = "evm-gasometer" -version = "0.25.0" -source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "evm-core", - "evm-runtime", - "primitive-types", + "bitflags", ] [[package]] -name = "evm-runtime" -version = "0.25.0" -source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" -dependencies = [ - "evm-core", - "primitive-types", - "sha3 0.8.2", -] +name = "concat-with" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae45936bbf9bddd6a0268c0ea5d3814a72403f4b69a1c318aae2ce90444ad55" [[package]] -name = "fixed-hash" -version = "0.7.0" +name = "constant_time_eq" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" -dependencies = [ - "byteorder", - "rand 0.8.3", - "rustc-hex", - "static_assertions", -] +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -name = "funty" -version = "1.1.0" +name = "convert_case" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] -name = "generic-array" -version = "0.12.4" +name = "cpuid-bool" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] -name = "generic-array" -version = "0.14.4" +name = "cranelift-bforest" +version = "0.67.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "0f065f6889758f817f61a230220d1811ba99a9762af2fb69ae23048314f75ff2" dependencies = [ - "typenum", - "version_check", + "cranelift-entity 0.67.0", ] [[package]] -name = "getrandom" -version = "0.2.2" +name = "cranelift-bforest" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cranelift-entity 0.68.0", ] [[package]] -name = "hash-db" -version = "0.15.2" +name = "cranelift-codegen" +version = "0.67.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" +checksum = "510aa2ab4307644100682b94e449940a0ea15c5887f1d4b9678b8dd5ef31e736" +dependencies = [ + "byteorder", + "cranelift-bforest 0.67.0", + "cranelift-codegen-meta 0.67.0", + "cranelift-codegen-shared 0.67.0", + "cranelift-entity 0.67.0", + "gimli 0.21.0", + "log", + "regalloc 0.0.30", + "serde", + "smallvec", + "target-lexicon 0.11.2", + "thiserror", +] [[package]] -name = "hash256-std-hasher" -version = "0.15.2" +name = "cranelift-codegen" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1" dependencies = [ - "crunchy", + "byteorder", + "cranelift-bforest 0.68.0", + "cranelift-codegen-meta 0.68.0", + "cranelift-codegen-shared 0.68.0", + "cranelift-entity 0.68.0", + "gimli 0.22.0", + "log", + "regalloc 0.0.31", + "smallvec", + "target-lexicon 0.11.2", + "thiserror", ] [[package]] -name = "hashbrown" -version = "0.9.1" +name = "cranelift-codegen-meta" +version = "0.67.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "b4cb0c7e87c60d63b35f9670c15479ee4a5e557dd127efab88b2f9b2ca83c9a0" dependencies = [ - "ahash", + "cranelift-codegen-shared 0.67.0", + "cranelift-entity 0.67.0", ] [[package]] -name = "hex" -version = "0.4.3" +name = "cranelift-codegen-meta" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7" +dependencies = [ + "cranelift-codegen-shared 0.68.0", + "cranelift-entity 0.68.0", +] [[package]] -name = "impl-codec" +name = "cranelift-codegen-shared" +version = "0.67.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60636227098693e06de8d6d88beea2a7d32ecf8a8030dacdb57c68e06f381826" + +[[package]] +name = "cranelift-codegen-shared" +version = "0.68.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938" + +[[package]] +name = "cranelift-entity" +version = "0.67.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6156db73e0c9f65f80c512988d63ec736be0dee3dd66bf951e3e28aed9dc02d3" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-entity" +version = "0.68.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-frontend" +version = "0.67.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e09cd158c9a820a4cc14a34076811da225cce1d31dc6d03c5ef85b91aef560b9" +dependencies = [ + "cranelift-codegen 0.67.0", + "log", + "smallvec", + "target-lexicon 0.11.2", +] + +[[package]] +name = "cranelift-frontend" +version = "0.68.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8" +dependencies = [ + "cranelift-codegen 0.68.0", + "log", + "smallvec", + "target-lexicon 0.11.2", +] + +[[package]] +name = "cranelift-native" +version = "0.67.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7054533ae1fc2048c1a6110bdf8f4314b77c60329ec6a7df79d2cfb84e3dcc1c" +dependencies = [ + "cranelift-codegen 0.67.0", + "raw-cpuid", + "target-lexicon 0.11.2", +] + +[[package]] +name = "cranelift-wasm" +version = "0.67.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aee0e0b68eba99f99a4923212d97aca9e44655ca8246f07fffe11236109b0d0" +dependencies = [ + "cranelift-codegen 0.67.0", + "cranelift-entity 0.67.0", + "cranelift-frontend 0.67.0", + "log", + "serde", + "thiserror", + "wasmparser 0.59.0", +] + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "parity-scale-codec", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] -name = "impl-rlp" -version = "0.3.0" +name = "crossbeam-deque" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "rlp", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] -name = "keccak" -version = "0.1.0" +name = "crossbeam-epoch" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset 0.6.1", + "scopeguard", +] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "crossbeam-utils" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "spin", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] -name = "libc" -version = "0.2.90" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "libsecp256k1" -version = "0.3.5" +name = "crypto-mac" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "arrayref", - "crunchy", - "digest 0.8.1", - "rand 0.7.3", + "generic-array 0.14.4", "subtle", ] [[package]] -name = "log" -version = "0.4.14" +name = "curve25519-dalek" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" dependencies = [ - "cfg-if 1.0.0", + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", ] [[package]] -name = "memory_units" -version = "0.4.0" +name = "darling" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core 0.10.2", + "darling_macro 0.10.2", +] [[package]] -name = "opaque-debug" -version = "0.2.3" +name = "darling" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc" +dependencies = [ + "darling_core 0.12.2", + "darling_macro 0.12.2", +] [[package]] -name = "opaque-debug" -version = "0.3.0" +name = "darling_core" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2 1.0.24", + "quote 1.0.9", + "strsim 0.9.3", + "syn 1.0.57", +] [[package]] -name = "parity-scale-codec" -version = "2.0.1" +name = "darling_core" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cd3dab59b5cf4bc81069ade0fc470341a1ef3ad5fa73e5a8943bed2ec12b2e8" +checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684" dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "parity-scale-codec-derive", + "fnv", + "ident_case", + "proc-macro2 1.0.24", + "quote 1.0.9", + "strsim 0.10.0", + "syn 1.0.57", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core 0.10.2", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "darling_macro" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81" +dependencies = [ + "darling_core 0.12.2", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "derive_more" +version = "0.99.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6" +dependencies = [ + "convert_case", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "dynasm" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7d1242462849390bb2ad38aeed769499f1afc7383affa2ab0c1baa894c0200" +dependencies = [ + "bitflags", + "byteorder", + "lazy_static", + "proc-macro-error", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "dynasmrt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dd4d1d5ca12258cef339a57a7643e8b233a42dea9bb849630ddd9dd7726aa9" +dependencies = [ + "byteorder", + "dynasm", + "memmap2", +] + +[[package]] +name = "easy-ext" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80581ee1c96b68c603eee514af47f075b39829304bde1a04381c826f3e06a9b4" +dependencies = [ + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "ed25519" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand 0.7.3", "serde", + "sha2", + "zeroize", ] [[package]] -name = "parity-scale-codec-derive" -version = "2.0.1" +name = "either" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa04976a81fde04924b40cc4036c4d12841e8bb04325a5cf2ada75731a150a7d" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "elastic-array" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d63720ea2bc2e1b79f7aa044d9dc0b825f9ccb6930b32120f8fb9e873aa84bc" dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", + "heapsize", +] + +[[package]] +name = "enumset" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbd795df6708a599abf1ee10eacc72efd052b7a5f70fdf0715e4d5151a6db9c3" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19c52f9ec503c8a68dc04daf71a04b07e690c32ab1a8b68e33897f255269d47" +dependencies = [ + "darling 0.12.2", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +dependencies = [ + "gcc", + "libc", +] + +[[package]] +name = "ethabi" +version = "13.0.0" +source = "git+https://github.com/darwinia-network/ethabi?branch=xavier-no-std#baacf174d5c2f12122c4ee3fe31506fb52069983" +dependencies = [ + "anyhow", + "ethereum-types", + "hex", + "serde", + "serde_json", + "sha3 0.9.1", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779864b9c7f7ead1f092972c3257496c6a84b46dba2ce131dd8a282cb2cc5972" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567ce064a8232c16e2b2c2173a936b91fbe35c2f2c5278871f5a1a31688b42e9" +dependencies = [ + "ethereum-types", + "funty", + "hash-db", + "hash256-std-hasher", + "parity-scale-codec", + "rlp", + "rlp-derive", + "serde", + "sha3 0.9.1", + "triehash", +] + +[[package]] +name = "ethereum-types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64b5df66a228d85e4b17e5d6c6aa43b0310898ffe8a85988c4c032357aaabfd" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "evm" +version = "0.25.0" +source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +dependencies = [ + "ethereum", + "evm-core", + "evm-gasometer", + "evm-runtime", + "log", + "parity-scale-codec", + "primitive-types", + "rlp", + "serde", + "sha3 0.8.2", +] + +[[package]] +name = "evm-core" +version = "0.25.0" +source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +dependencies = [ + "funty", + "parity-scale-codec", + "primitive-types", + "serde", +] + +[[package]] +name = "evm-gasometer" +version = "0.25.0" +source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +dependencies = [ + "evm-core", + "evm-runtime", + "primitive-types", +] + +[[package]] +name = "evm-runtime" +version = "0.25.0" +source = "git+https://github.com/aurora-is-near/sputnikvm?rev=85631ce#85631ce946189f998ee85e2a26a2f3d00c1cb6cf" +dependencies = [ + "evm-core", + "primitive-types", + "sha3 0.8.2", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.3", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" + +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "futures" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" + +[[package]] +name = "futures-executor" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" + +[[package]] +name = "futures-macro" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "futures-sink" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" + +[[package]] +name = "futures-task" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" + +[[package]] +name = "futures-util" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gcc" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] + +[[package]] +name = "heapsize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" +dependencies = [ + "winapi", +] + +[[package]] +name = "heck" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" +dependencies = [ + "serde", +] + +[[package]] +name = "indexmap" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +dependencies = [ + "autocfg", + "hashbrown", + "serde", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "jemalloc-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" +dependencies = [ + "cc", + "fs_extra", + "libc", +] + +[[package]] +name = "jemallocator" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" +dependencies = [ + "jemalloc-sys", + "libc", +] + +[[package]] +name = "jobserver" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +dependencies = [ + "libc", +] + +[[package]] +name = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + +[[package]] +name = "lazy-static-include" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c942ea960c2d8678d32cb14aa56d5c37f21107b54aa281c944e4d03690c55d1" +dependencies = [ + "lazy_static", + "slash-formatter", + "syn 1.0.57", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "leb128" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" + +[[package]] +name = "libc" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" + +[[package]] +name = "libloading" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +dependencies = [ + "cc", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" +dependencies = [ + "cfg-if 1.0.0", + "winapi", +] + +[[package]] +name = "librocksdb-sys" +version = "6.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b56f651c204634b936be2f92dbb42c36867e00ff7fe2405591f3b9fa66f09" +dependencies = [ + "bindgen", + "cc", + "glob", + "libc", +] + +[[package]] +name = "libsecp256k1" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +dependencies = [ + "arrayref", + "crunchy", + "digest 0.8.1", + "rand 0.7.3", + "subtle", +] + +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "logos" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ca690691528b32832c7e8aaae8ae1edcdee4e9ffde55b2d31a4795bc7a12d0" +dependencies = [ + "logos-derive", + "toolshed", +] + +[[package]] +name = "logos-derive" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917dccdd529d5681f3d28b26bcfdafd2ed67fe4f26d15b5ac679f67b55279f3d" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "regex-syntax", + "syn 0.15.44", + "utf8-ranges", +] + +[[package]] +name = "lunarity-lexer" +version = "0.2.1" +source = "git+https://github.com/ilblackdragon/lunarity?rev=5201d9a76f7e491082b7f74af7e64049271e387f#5201d9a76f7e491082b7f74af7e64049271e387f" +dependencies = [ + "logos", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "memmap2" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "more-asserts" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" + +[[package]] +name = "near-crypto" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb14bec070cfd808438712cda5d54703001b9cf1196c8afaeadc9514e06d00a3" +dependencies = [ + "arrayref", + "blake2", + "borsh", + "bs58", + "c2-chacha", + "curve25519-dalek", + "derive_more", + "ed25519-dalek", + "lazy_static", + "libc", + "parity-secp256k1", + "rand 0.7.3", + "rand_core 0.5.1", + "serde", + "serde_json", + "subtle", + "thiserror", +] + +[[package]] +name = "near-metrics" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7b9dcbc960db15fcec85bcb29a78b57e4005b7b1a0afc70a26a97453862528e" +dependencies = [ + "lazy_static", + "log", + "prometheus", +] + +[[package]] +name = "near-pool" +version = "0.1.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde79472f7cfc0675733b65f79f9e50c20bfbb9806298ab2872916869a45dccd" +dependencies = [ + "borsh", + "near-crypto", + "near-primitives", + "rand 0.7.3", +] + +[[package]] +name = "near-primitives" +version = "0.1.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ed2263518ca67a3c158c144813832fd96f48ab239494bb9d7793d315f31417" +dependencies = [ + "base64 0.13.0", + "borsh", + "bs58", + "byteorder", + "chrono", + "derive_more", + "easy-ext", + "hex", + "jemallocator", + "lazy_static", + "near-crypto", + "near-primitives-core 0.4.0", + "near-rpc-error-macro", + "near-vm-errors 4.0.0-pre.1", + "num-rational", + "primitive-types", + "rand 0.7.3", + "reed-solomon-erasure", + "regex", + "serde", + "serde_json", + "sha2", + "smart-default", + "validator", +] + +[[package]] +name = "near-primitives-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92035b79bf9983502fe7b67b5a9fecea7604e979d439727827fd0d8f0d77720e" +dependencies = [ + "base64 0.11.0", + "borsh", + "bs58", + "derive_more", + "hex", + "lazy_static", + "num-rational", + "serde", + "serde_json", + "sha2", +] + +[[package]] +name = "near-primitives-core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2b3fb5acf3a494aed4e848446ef2d6ebb47dbe91c681105d4d1786c2ee63e52" +dependencies = [ + "base64 0.13.0", + "borsh", + "bs58", + "derive_more", + "hex", + "lazy_static", + "num-rational", + "serde", + "serde_json", + "sha2", +] + +[[package]] +name = "near-rpc-error-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa8dbf8437a28ac40fcb85859ab0d0b8385013935b000c7a51ae79631dd74d9" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "serde", + "serde_json", + "syn 1.0.57", +] + +[[package]] +name = "near-rpc-error-macro" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6111d713e90c7c551dee937f4a06cb9ea2672243455a4454cc7566387ba2d9" +dependencies = [ + "near-rpc-error-core", + "proc-macro2 1.0.24", + "quote 1.0.9", + "serde", + "serde_json", + "syn 1.0.57", +] + +[[package]] +name = "near-runtime" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e4c0a4cd2ee5ccbc1fd5d492180ebf33ac1159d721b2e0c58c11953131fb449" +dependencies = [ + "borsh", + "byteorder", + "ethereum-types", + "hex", + "lazy_static", + "log", + "near-crypto", + "near-metrics", + "near-primitives", + "near-runtime-utils 4.0.0-pre.1", + "near-store", + "near-vm-errors 4.0.0-pre.1", + "near-vm-logic 4.0.0-pre.1", + "near-vm-runner", + "num-bigint", + "num-rational", + "num-traits", + "rand 0.7.3", + "serde", + "serde_json", +] + +[[package]] +name = "near-runtime-utils" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47f5c1891cec5a03e3dc99f985031408b19516305e2e59d64c4ce52b409e46a0" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "near-runtime-utils" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a48d80c4ca1d4cf99bc16490e1e3d49826c150dfc4410ac498918e45c7d98e07" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "near-sdk" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=9d99077c6acfde68c06845f2a1eb2b5ed7983401#9d99077c6acfde68c06845f2a1eb2b5ed7983401" +dependencies = [ + "base64 0.13.0", + "borsh", + "bs58", + "near-primitives-core 0.1.0", + "near-sdk-macros", + "near-vm-logic 3.0.0", + "serde", + "serde_json", + "wee_alloc", +] + +[[package]] +name = "near-sdk-core" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=9d99077c6acfde68c06845f2a1eb2b5ed7983401#9d99077c6acfde68c06845f2a1eb2b5ed7983401" +dependencies = [ + "Inflector", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "near-sdk-macros" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=9d99077c6acfde68c06845f2a1eb2b5ed7983401#9d99077c6acfde68c06845f2a1eb2b5ed7983401" +dependencies = [ + "near-sdk-core", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "near-sdk-sim" +version = "3.0.0-pre.3" +source = "git+https://github.com/near/near-sdk-rs?rev=9d99077c6acfde68c06845f2a1eb2b5ed7983401#9d99077c6acfde68c06845f2a1eb2b5ed7983401" +dependencies = [ + "funty", + "lazy-static-include", + "near-crypto", + "near-pool", + "near-primitives", + "near-runtime", + "near-sdk", + "near-store", + "near-vm-logic 4.0.0-pre.1", +] + +[[package]] +name = "near-store" +version = "0.1.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e880d1d9a4ca5a1ca1ea0366fd80e295465f90cd0c1209f45d6d0b7a443ed4" +dependencies = [ + "borsh", + "byteorder", + "cached", + "derive_more", + "elastic-array", + "lazy_static", + "near-crypto", + "near-primitives", + "num_cpus", + "rand 0.7.3", + "rocksdb", + "serde", + "serde_json", + "strum", +] + +[[package]] +name = "near-vm-errors" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a100dda565c5375ac061126167afc5c33cdba1f2e325cfae3ce08f4a5a432a" +dependencies = [ + "borsh", + "hex", + "near-rpc-error-macro", + "serde", +] + +[[package]] +name = "near-vm-errors" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e281d8730ed8cb0e3e69fb689acee6b93cdb43824cd69a8ffd7e1bfcbd1177d7" +dependencies = [ + "borsh", + "hex", + "near-rpc-error-macro", + "serde", +] + +[[package]] +name = "near-vm-logic" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12201244dd59ae79506767afe7a8f51b5eb7bd0aa237d355dfa635f7b777c4a" +dependencies = [ + "base64 0.13.0", + "borsh", + "bs58", + "byteorder", + "near-primitives-core 0.1.0", + "near-runtime-utils 3.0.0", + "near-vm-errors 3.0.0", + "serde", + "sha2", + "sha3 0.9.1", +] + +[[package]] +name = "near-vm-logic" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11cb28a2d07f37680efdaf860f4c9802828c44fc50c08009e7884de75d982c5" +dependencies = [ + "base64 0.13.0", + "borsh", + "bs58", + "byteorder", + "near-primitives-core 0.4.0", + "near-runtime-utils 4.0.0-pre.1", + "near-vm-errors 4.0.0-pre.1", + "serde", + "sha2", + "sha3 0.9.1", +] + +[[package]] +name = "near-vm-runner" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93a66e94e12ec66a29674cc4efa975c280415aa0c944d7294cedbdb0c3858b48" +dependencies = [ + "anyhow", + "borsh", + "cached", + "log", + "near-primitives", + "near-vm-errors 4.0.0-pre.1", + "near-vm-logic 4.0.0-pre.1", + "parity-wasm", + "pwasm-utils", + "tracing", + "wasmer", + "wasmer-compiler-singlepass", + "wasmer-runtime-core-near", + "wasmer-runtime-near", + "wasmer-types", + "wasmtime", +] + +[[package]] +name = "nix" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + +[[package]] +name = "nom" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +dependencies = [ + "memchr", + "version_check", +] + +[[package]] +name = "num-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d0a3d5e207573f948a9e5376662aa743a2ea13f7c50a554d7af443a73fbfeba" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693" +dependencies = [ + "crc32fast", + "indexmap", + "wasmparser 0.57.0", +] + +[[package]] +name = "object" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +dependencies = [ + "crc32fast", + "indexmap", +] + +[[package]] +name = "object" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" + +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "page_size" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "parity-scale-codec" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd3dab59b5cf4bc81069ade0fc470341a1ef3ad5fa73e5a8943bed2ec12b2e8" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa04976a81fde04924b40cc4036c4d12841e8bb04325a5cf2ada75731a150a7d" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "parity-secp256k1" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fca4f82fccae37e8bbdaeb949a4a218a1bbc485d11598f193d2a908042e5fc1" +dependencies = [ + "arrayvec", + "cc", + "cfg-if 0.1.10", + "rand 0.7.3", +] + +[[package]] +name = "parity-wasm" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" + +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api 0.4.2", + "parking_lot_core 0.8.3", +] + +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.5", + "smallvec", + "winapi", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "primitive-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[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", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", + "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.24", + "quote 1.0.9", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid 0.2.1", +] + +[[package]] +name = "prometheus" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8425533e7122f0c3cc7a37e6244b16ad3a2cc32ae7ac6276e2a75da0d9c200d" +dependencies = [ + "cfg-if 1.0.0", + "fnv", + "lazy_static", + "parking_lot 0.11.1", + "protobuf", + "regex", + "thiserror", +] + +[[package]] +name = "protobuf" +version = "2.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b7f4a129bb3754c25a4e04032a90173c68f85168f77118ac4cb4936e7f06f92" + +[[package]] +name = "pwasm-utils" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" +dependencies = [ + "byteorder", + "log", + "parity-wasm", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2 1.0.24", +] + +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", + "rand_hc 0.3.0", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.2", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.2", +] + +[[package]] +name = "raw-cpuid" +version = "7.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb71f708fe39b2c5e98076204c3cc094ee5a4c12c4cdb119a2b72dc34164f41" +dependencies = [ + "bitflags", + "cc", + "rustc_version", +] + +[[package]] +name = "rayon" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +dependencies = [ + "bitflags", +] + +[[package]] +name = "reed-solomon-erasure" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" +dependencies = [ + "smallvec", +] + +[[package]] +name = "regalloc" +version = "0.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2041c2d34f6ff346d6f428974f03d8bf12679b0c816bb640dc5eb1d48848d8d1" +dependencies = [ + "log", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "regalloc" +version = "0.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" +dependencies = [ + "log", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" + +[[package]] +name = "region" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" +dependencies = [ + "bitflags", + "libc", + "mach", + "winapi", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "rlp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e54369147e3e7796c9b885c7304db87ca3d09a0a98f72843d532868675bbfba8" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "rocksdb" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6" +dependencies = [ + "libc", + "librocksdb-sys", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-bench" +version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" +dependencies = [ + "byteorder", + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha3" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +dependencies = [ + "block-buffer 0.7.3", + "byte-tools", + "digest 0.8.1", + "keccak", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug 0.3.0", +] + +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" + +[[package]] +name = "signature" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "slash-formatter" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55a065b7c425d213cbefcaaa4b62dd936183fa41c806a74767c72dd659ff4ad0" +dependencies = [ + "concat-with", +] + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "smart-default" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "strsim" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "subtle" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + +[[package]] +name = "syn" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "unicode-xid 0.2.1", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", + "unicode-xid 0.2.1", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" + +[[package]] +name = "target-lexicon" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "rand 0.8.3", + "redox_syscall 0.2.5", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "toolshed" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a272adbf14cfbb486774d09ee3e00c38d488cd390084a528f70e10e3a184a8" +dependencies = [ + "fxhash", +] + +[[package]] +name = "tracing" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", +] + +[[package]] +name = "tracing-core" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "triehash" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" +dependencies = [ + "hash-db", + "rlp", +] + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "uint" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "url" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "utf8-ranges" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" + +[[package]] +name = "validator" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d6937c33ec6039d8071bcf72933146b5bbe378d645d8fa59bdadabfc2a249" +dependencies = [ + "idna", + "lazy_static", + "regex", + "serde", + "serde_derive", + "serde_json", + "url", + "validator_types", ] [[package]] -name = "ppv-lite86" -version = "0.2.10" +name = "validator_types" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "ad9680608df133af2c1ddd5eaf1ddce91d60d61b6bc51494ef326458365a470a" [[package]] -name = "primitive-types" -version = "0.9.0" +name = "vec_map" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", - "uint", -] +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] -name = "proc-macro-crate" -version = "0.1.5" +name = "version_check" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] -name = "proc-macro2" -version = "1.0.24" +name = "void" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid", -] +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] -name = "quote" -version = "1.0.9" +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -dependencies = [ - "proc-macro2", -] +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "radium" -version = "0.6.2" +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] -name = "rand" -version = "0.7.3" +name = "wasmer" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "a70cfae554988d904d64ca17ab0e7cd652ee5c8a0807094819c1ea93eb9d6866" dependencies = [ - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", + "cfg-if 0.1.10", + "indexmap", + "more-asserts", + "target-lexicon 0.11.2", + "thiserror", + "wasmer-compiler", + "wasmer-compiler-cranelift", + "wasmer-derive", + "wasmer-engine", + "wasmer-engine-jit", + "wasmer-engine-native", + "wasmer-types", + "wasmer-vm", + "wat", + "winapi", ] [[package]] -name = "rand" -version = "0.8.3" +name = "wasmer-compiler" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "6b7732a9cab472bd921d5a0c422f45b3d03f62fa2c40a89e0770cef6d47e383e" dependencies = [ - "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", + "enumset", + "serde", + "serde_bytes", + "smallvec", + "target-lexicon 0.11.2", + "thiserror", + "wasmer-types", + "wasmer-vm", + "wasmparser 0.65.0", ] [[package]] -name = "rand_chacha" -version = "0.2.2" +name = "wasmer-compiler-cranelift" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "48cb9395f094e1d81534f4c5e330ed4cdb424e8df870d29ad585620284f5fddb" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "cranelift-codegen 0.68.0", + "cranelift-frontend 0.68.0", + "gimli 0.22.0", + "more-asserts", + "rayon", + "serde", + "smallvec", + "tracing", + "wasmer-compiler", + "wasmer-types", + "wasmer-vm", ] [[package]] -name = "rand_chacha" -version = "0.3.0" +name = "wasmer-compiler-singlepass" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "426ae6ef0f606ca815510f3e2ef6f520e217514bfb7a664defe180b9a9e75d07" dependencies = [ - "ppv-lite86", - "rand_core 0.6.2", + "byteorder", + "dynasm", + "dynasmrt", + "lazy_static", + "more-asserts", + "rayon", + "serde", + "smallvec", + "wasmer-compiler", + "wasmer-types", + "wasmer-vm", ] [[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" - -[[package]] -name = "rand_core" -version = "0.6.2" +name = "wasmer-derive" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d8b86dcd2c3efdb8390728a2b56f762db07789aaa5aa872a9dc776ba3a7912ed" dependencies = [ - "getrandom", + "proc-macro-error", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", ] [[package]] -name = "rand_hc" -version = "0.2.0" +name = "wasmer-engine" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "efe4667d6bd888f26ae8062a63a9379fa697415b4b4e380f33832e8418fd71b5" dependencies = [ - "rand_core 0.5.1", + "backtrace", + "bincode", + "lazy_static", + "memmap2", + "more-asserts", + "rustc-demangle", + "serde", + "serde_bytes", + "target-lexicon 0.11.2", + "thiserror", + "wasmer-compiler", + "wasmer-types", + "wasmer-vm", ] [[package]] -name = "ripemd160" -version = "0.9.1" +name = "wasmer-engine-jit" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +checksum = "26770be802888011b4a3072f2a282fc2faa68aa48c71b3db6252a3937a85f3da" dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "bincode", + "cfg-if 0.1.10", + "region", + "serde", + "serde_bytes", + "wasmer-compiler", + "wasmer-engine", + "wasmer-types", + "wasmer-vm", + "winapi", ] [[package]] -name = "rlp" -version = "0.5.0" +name = "wasmer-engine-native" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54369147e3e7796c9b885c7304db87ca3d09a0a98f72843d532868675bbfba8" +checksum = "2bb4083a6c69f2cd4b000b82a80717f37c6cc2e536aee3a8ffe9af3edc276a8b" dependencies = [ - "bytes", - "rustc-hex", + "bincode", + "cfg-if 0.1.10", + "leb128", + "libloading 0.6.7", + "serde", + "tempfile", + "tracing", + "wasmer-compiler", + "wasmer-engine", + "wasmer-object", + "wasmer-types", + "wasmer-vm", + "which 4.0.2", ] [[package]] -name = "rlp-derive" -version = "0.1.0" +name = "wasmer-object" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +checksum = "abf8e0c12b82ff81ebecd30d7e118be5fec871d6de885a90eeb105df0a769a7b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "object 0.22.0", + "thiserror", + "wasmer-compiler", + "wasmer-types", ] [[package]] -name = "rustc-hex" -version = "2.1.0" +name = "wasmer-runtime-core-near" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +checksum = "2390b0b8cf58615c2f8b454d9535e1aed1d14c510cc1ce1af806a1992ad53300" +dependencies = [ + "bincode", + "blake3", + "cc", + "digest 0.8.1", + "errno", + "hex", + "indexmap", + "lazy_static", + "libc", + "nix", + "page_size", + "parking_lot 0.10.2", + "rustc_version", + "serde", + "serde-bench", + "serde_bytes", + "serde_derive", + "smallvec", + "target-lexicon 0.10.0", + "wasmparser 0.51.4", + "winapi", +] [[package]] -name = "serde" -version = "1.0.124" +name = "wasmer-runtime-near" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +checksum = "e6660e86bc7697fa29bab902214d5b33d394a990826c401b10816bcd285f938f" dependencies = [ + "lazy_static", + "memmap", + "serde", "serde_derive", + "wasmer-runtime-core-near", + "wasmer-singlepass-backend-near", ] [[package]] -name = "serde_derive" -version = "1.0.124" +name = "wasmer-singlepass-backend-near" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +checksum = "d3f23543ef8f59667be4945c22eb4b1a50a79ff340555f6f23354223d2695541" dependencies = [ - "proc-macro2", - "quote", - "syn", + "bincode", + "byteorder", + "dynasm", + "dynasmrt", + "lazy_static", + "libc", + "nix", + "serde", + "serde_derive", + "smallvec", + "wasmer-runtime-core-near", ] [[package]] -name = "sha2" -version = "0.9.3" +name = "wasmer-types" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" +checksum = "c7f4ac28c2951cd792c18332f03da523ed06b170f5cf6bb5b1bdd7e36c2a8218" dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpuid-bool", - "digest 0.9.0", - "opaque-debug 0.3.0", + "cranelift-entity 0.68.0", + "serde", + "thiserror", ] [[package]] -name = "sha3" -version = "0.8.2" +name = "wasmer-vm" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +checksum = "a7635ba0b6d2fd325f588d69a950ad9fa04dddbf6ad08b6b2a183146319bf6ae" dependencies = [ - "block-buffer 0.7.3", - "byte-tools", - "digest 0.8.1", - "keccak", - "opaque-debug 0.2.3", + "backtrace", + "cc", + "cfg-if 0.1.10", + "indexmap", + "libc", + "memoffset 0.6.1", + "more-asserts", + "region", + "serde", + "thiserror", + "wasmer-types", + "winapi", ] [[package]] -name = "sha3" -version = "0.9.1" +name = "wasmparser" +version = "0.51.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug 0.3.0", -] +checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" [[package]] -name = "spin" -version = "0.5.2" +name = "wasmparser" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6" [[package]] -name = "static_assertions" -version = "1.1.0" +name = "wasmparser" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "a950e6a618f62147fd514ff445b2a0b53120d382751960797f85f058c7eda9b9" [[package]] -name = "subtle" -version = "2.4.0" +name = "wasmparser" +version = "0.65.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf" [[package]] -name = "syn" -version = "1.0.64" +name = "wasmtime" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" +checksum = "373b87ebd6721f4121e28eeaaa41943548c48bcca04ac9bb063004207e5e7d70" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "anyhow", + "backtrace", + "bincode", + "cfg-if 0.1.10", + "lazy_static", + "libc", + "log", + "region", + "rustc-demangle", + "serde", + "smallvec", + "target-lexicon 0.11.2", + "wasmparser 0.59.0", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-profiling", + "wasmtime-runtime", + "winapi", ] [[package]] -name = "tap" -version = "1.0.1" +name = "wasmtime-cranelift" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +checksum = "40c01df908e54d40bed80326ade122825d464888991beafd950d186f1be309c2" +dependencies = [ + "cranelift-codegen 0.67.0", + "cranelift-entity 0.67.0", + "cranelift-frontend 0.67.0", + "cranelift-wasm", + "wasmtime-environ", +] [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "wasmtime-debug" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +checksum = "28962772f96fadb79dc7be5ade135ca55d2b0017a012f4869e2476a03abbe733" dependencies = [ - "crunchy", + "anyhow", + "gimli 0.21.0", + "more-asserts", + "object 0.21.1", + "target-lexicon 0.11.2", + "thiserror", + "wasmparser 0.59.0", + "wasmtime-environ", ] [[package]] -name = "toml" -version = "0.5.8" +name = "wasmtime-environ" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "9c0d7401bf253b7b1f426afd70d285bb23ea9a1c7605d6af788c95db5084edf5" dependencies = [ + "anyhow", + "cfg-if 0.1.10", + "cranelift-codegen 0.67.0", + "cranelift-entity 0.67.0", + "cranelift-wasm", + "gimli 0.21.0", + "indexmap", + "log", + "more-asserts", "serde", + "thiserror", + "wasmparser 0.59.0", ] [[package]] -name = "triehash" -version = "0.8.4" +name = "wasmtime-jit" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" +checksum = "8c838a108318e7c5a2201addb3d3b27a6ef3d142f0eb0addc815b9c2541e5db5" dependencies = [ - "hash-db", - "rlp", + "anyhow", + "cfg-if 0.1.10", + "cranelift-codegen 0.67.0", + "cranelift-entity 0.67.0", + "cranelift-frontend 0.67.0", + "cranelift-native", + "cranelift-wasm", + "gimli 0.21.0", + "log", + "more-asserts", + "object 0.21.1", + "region", + "serde", + "target-lexicon 0.11.2", + "thiserror", + "wasmparser 0.59.0", + "wasmtime-cranelift", + "wasmtime-debug", + "wasmtime-environ", + "wasmtime-obj", + "wasmtime-profiling", + "wasmtime-runtime", + "winapi", ] [[package]] -name = "typenum" -version = "1.13.0" +name = "wasmtime-obj" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "cc8422b0acce519b74c3ae5db59167c611ea92220e5c334ad406e977277e0f23" +dependencies = [ + "anyhow", + "more-asserts", + "object 0.21.1", + "target-lexicon 0.11.2", + "wasmtime-debug", + "wasmtime-environ", +] [[package]] -name = "uint" -version = "0.9.0" +name = "wasmtime-profiling" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +checksum = "33f2689bf523f843555e57e24d59abf0c5013007366b866081d73a15e510b4b2" dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", + "anyhow", + "cfg-if 0.1.10", + "lazy_static", + "libc", + "serde", + "target-lexicon 0.11.2", + "wasmtime-environ", + "wasmtime-runtime", ] [[package]] -name = "unicode-xid" -version = "0.2.1" +name = "wasmtime-runtime" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "d7353f5e79390048128e44b5ceda7255723b2066de4026df9a168b0b2593df71" +dependencies = [ + "backtrace", + "cc", + "cfg-if 0.1.10", + "indexmap", + "lazy_static", + "libc", + "log", + "memoffset 0.5.6", + "more-asserts", + "region", + "thiserror", + "wasmtime-environ", + "winapi", +] [[package]] -name = "version_check" -version = "0.9.3" +name = "wast" +version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "db5ae96da18bb5926341516fd409b5a8ce4e4714da7f0a1063d3b20ac9f9a1e1" +dependencies = [ + "leb128", +] [[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +name = "wat" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "0b0fa059022c5dabe129f02b429d67086400deb8277f89c975555dacc1dadbcc" +dependencies = [ + "wast", +] [[package]] name = "wee_alloc" @@ -792,6 +3717,25 @@ dependencies = [ "winapi", ] +[[package]] +name = "which" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +dependencies = [ + "libc", +] + +[[package]] +name = "which" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" +dependencies = [ + "libc", + "thiserror", +] + [[package]] name = "winapi" version = "0.3.9" @@ -808,6 +3752,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -819,3 +3772,24 @@ name = "wyz" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "zeroize" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.57", + "synstructure", +] diff --git a/Cargo.toml b/Cargo.toml index 19cb90622..45a5d54d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,6 @@ rpath = false [dependencies] borsh = { version = "0.8.2", default-features = false } evm = { git = "https://github.com/aurora-is-near/sputnikvm", rev = "85631ce", default-features = false } -lazy_static = { version = "1.4.0", default-features = false } libsecp256k1 = { version = "0.3.5", default-features = false } primitive-types = { version = "0.9.0", default-features = false, features = ["rlp"] } ripemd160 = { version = "0.9.1", default-features = false } @@ -47,11 +46,16 @@ rlp = { version = "0.5.0", default-features = false } sha2 = { version = "0.9.3", default-features = false, optional = true } sha3 = { version = "0.9.1", default-features = false } wee_alloc = { version = "0.4.5", default-features = false } +lunarity-lexer = { git = "https://github.com/ilblackdragon/lunarity", rev = "5201d9a76f7e491082b7f74af7e64049271e387f", default-features = false } +ethabi = { git = "https://github.com/darwinia-network/ethabi", branch = "xavier-no-std", default-features = false } [dev-dependencies] hex = { version = "0.4.3", default-features = false } +near-sdk = { git = "https://github.com/near/near-sdk-rs", rev = "9d99077c6acfde68c06845f2a1eb2b5ed7983401" } +near-sdk-sim = { git = "https://github.com/near/near-sdk-rs", rev = "9d99077c6acfde68c06845f2a1eb2b5ed7983401" } +near-crypto = "0.1.0" [features] default = ["sha2", "std"] -std = ["borsh/std", "evm/std", "primitive-types/std", "rlp/std", "sha3/std"] -contract = ["lazy_static/spin_no_std"] +std = ["borsh/std", "evm/std", "primitive-types/std", "rlp/std", "sha3/std", "ethabi/std", "lunarity-lexer/std"] +contract = [] diff --git a/src/.gitkeep b/src/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/engine.rs b/src/engine.rs index a83f213c8..b987c7741 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1,23 +1,73 @@ -use crate::parameters::{FunctionCallArgs, ViewCallArgs}; +use borsh::{BorshDeserialize, BorshSerialize}; +use evm::backend::{Apply, ApplyBackend, Backend, Basic, Log}; +use evm::executor::{MemoryStackState, StackExecutor, StackSubstateMetadata}; +use evm::{Config, CreateScheme, ExitFatal, ExitReason}; + +use crate::parameters::{FunctionCallArgs, NewCallArgs, ViewCallArgs}; use crate::precompiles; use crate::prelude::{Address, Vec, H256, U256}; use crate::sdk; use crate::storage::{address_to_key, storage_to_key, KeyPrefix}; -use crate::types::{bytes_to_hex, log_to_bytes, u256_to_arr}; -use evm::backend::{Apply, ApplyBackend, Backend, Basic, Log}; -use evm::executor::{MemoryStackState, StackExecutor, StackSubstateMetadata}; -use evm::{Config, CreateScheme, ExitFatal, ExitReason}; +use crate::types::{bytes_to_hex, log_to_bytes, u256_to_arr, AccountId}; + +/// Engine internal state, mostly configuration. +/// Should not contain anything large or enumerable. +#[derive(BorshSerialize, BorshDeserialize)] +pub struct EngineState { + /// Chain id, according to the EIP-115 / ethereum-lists spec. + pub chain_id: [u8; 32], + /// Account which can upgrade this contract. + /// Use empty to disable updatability. + pub owner_id: AccountId, + /// Account of the bridge prover. + /// Use empty to not use base token as bridged asset. + pub bridge_prover_id: AccountId, + /// How many blocks after staging upgrade can deploy it. + pub upgrade_delay_blocks: u64, +} + +impl From for EngineState { + fn from(args: NewCallArgs) -> Self { + EngineState { + chain_id: args.chain_id, + owner_id: args.owner_id, + bridge_prover_id: args.bridge_prover_id, + upgrade_delay_blocks: args.upgrade_delay_blocks, + } + } +} pub struct Engine { - chain_id: U256, + state: EngineState, origin: Address, } -const CONFIG: &'static Config = &Config::istanbul(); // TODO: upgrade to Berlin HF +// TODO: upgrade to Berlin HF +const CONFIG: &'static Config = &Config::istanbul(); + +/// Key for storing the state of the engine. +const STATE_KEY: &[u8; 6] = b"\0STATE"; impl Engine { - pub fn new(chain_id: U256, origin: Address) -> Self { - Self { chain_id, origin } + pub fn new(origin: Address) -> Self { + Self::new_with_state(Engine::get_state(), origin) + } + + pub fn new_with_state(state: EngineState, origin: Address) -> Self { + Self { state, origin } + } + + /// Saves state into the storage. + pub fn set_state(state: EngineState) { + sdk::write_storage(STATE_KEY, &state.try_to_vec().expect("ERR_SER")); + } + + /// Fails if state is not found. + pub fn get_state() -> EngineState { + EngineState::try_from_slice( + &sdk::read_storage(STATE_KEY).expect("ERR_STATE_NOT_INITIALIZED"), + ) + .expect("ERR_DESER") } pub fn set_code(address: &Address, code: &[u8]) { @@ -219,7 +269,7 @@ impl evm::backend::Backend for Engine { } fn chain_id(&self) -> U256 { - self.chain_id + U256::from(self.state.chain_id) } fn exists(&self, address: Address) -> bool { diff --git a/src/lib.rs b/src/lib.rs index 64fc5afbe..a7f2cb747 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,12 +7,13 @@ extern crate alloc; #[cfg(not(feature = "std"))] extern crate core; -mod parameters; +pub mod meta_parsing; +pub mod parameters; mod precompiles; -mod prelude; +pub mod prelude; mod storage; mod transaction; -mod types; +pub mod types; #[cfg(feature = "contract")] mod engine; @@ -21,29 +22,23 @@ mod sdk; #[cfg(feature = "contract")] mod contract { + use borsh::BorshDeserialize; + use evm::ExitReason; + use crate::engine::Engine; use crate::parameters::{ - BeginBlockArgs, BeginChainArgs, FunctionCallArgs, GetStorageAtArgs, ViewCallArgs, + BeginBlockArgs, BeginChainArgs, FunctionCallArgs, GetStorageAtArgs, NewCallArgs, + ViewCallArgs, }; use crate::prelude::{vec, Address, H256, U256}; use crate::sdk; use crate::types::{near_account_to_evm_address, u256_to_arr}; - use borsh::BorshDeserialize; - use evm::ExitReason; - use lazy_static::lazy_static; #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; - lazy_static! { - static ref CHAIN_ID: U256 = match sdk::read_storage(b"\0chain_id") { - Some(v) => U256::from_big_endian(v.as_slice()), - None => match option_env!("NEAR_EVM_CHAIN") { - Some(v) => U256::from_dec_str(v).unwrap_or_else(|_| U256::zero()), - None => U256::from(1313161556), // NEAR BetaNet - }, - }; - } + const CODE_KEY: &[u8; 5] = b"\0CODE"; + const CODE_STAGE_KEY: &[u8; 11] = b"\0CODE_STAGE"; #[panic_handler] #[no_mangle] @@ -57,6 +52,15 @@ mod contract { ::core::intrinsics::abort(); } + /// Sets the configuration for the Engine. + /// Should be called on deployment. + #[no_mangle] + pub extern "C" fn new() { + let args = NewCallArgs::try_from_slice(&sdk::read_input()).expect("ERR_ARG_PARSE"); + Engine::set_state(args.into()); + } + + /// Get version of the contract. #[no_mangle] pub extern "C" fn get_version() { let version = match option_env!("NEAR_EVM_VERSION") { @@ -66,32 +70,82 @@ mod contract { sdk::return_output(version) } + /// Get owner account id for this contract. + #[no_mangle] + pub extern "C" fn get_owner() { + let state = Engine::get_state(); + sdk::return_output(state.owner_id.as_bytes()); + } + + /// Get bridge prover id for this contract. + #[no_mangle] + pub extern "C" fn get_bridge_provider() { + let state = Engine::get_state(); + sdk::return_output(state.bridge_prover_id.as_bytes()); + } + + /// Get chain id for this contract. #[no_mangle] pub extern "C" fn get_chain_id() { - let mut result = [0u8; 32]; - (*CHAIN_ID).to_big_endian(&mut result); - sdk::return_output(&result) + sdk::return_output(&Engine::get_state().chain_id) } + /// Stage new code for deployment. + #[no_mangle] + pub extern "C" fn stage_upgrade() { + let state = Engine::get_state(); + if state.owner_id.as_bytes() != sdk::predecessor_account_id() { + sdk::panic_utf8(b"ERR_NOT_ALLOWED"); + } + sdk::read_input_and_store(CODE_KEY); + sdk::write_storage(CODE_STAGE_KEY, &sdk::block_index().to_le_bytes()); + } + + #[no_mangle] + pub extern "C" fn get_upgrade_index() { + let state = Engine::get_state(); + let index = sdk::read_u64(CODE_STAGE_KEY).expect("ERR_NO_UPGRADE"); + sdk::return_output(&(index + state.upgrade_delay_blocks).to_le_bytes()) + } + + /// Deploy staged upgrade. + #[no_mangle] + pub extern "C" fn deploy_upgrade() { + let state = Engine::get_state(); + let index = sdk::read_u64(CODE_STAGE_KEY).unwrap(); + if sdk::block_index() <= index + state.upgrade_delay_blocks { + sdk::panic_utf8(b"ERR_NOT_ALLOWED:TOO_EARLY"); + } + sdk::self_deploy(CODE_KEY); + } + + /// + /// EVM METHODS + /// + + /// Deploy code into the EVM. #[no_mangle] pub extern "C" fn deploy_code() { let input = sdk::read_input(); - let mut engine = Engine::new(*CHAIN_ID, predecessor_address()); + let mut engine = Engine::new(predecessor_address()); let (status, result) = Engine::deploy_code_with_input(&mut engine, &input); // TODO: charge for storage process_exit_reason(status, &result.0) } + /// Call method on the EVM contract. #[no_mangle] pub extern "C" fn call() { let input = sdk::read_input(); let args = FunctionCallArgs::try_from_slice(&input).unwrap(); - let mut engine = Engine::new(*CHAIN_ID, predecessor_address()); + let mut engine = Engine::new(predecessor_address()); let (status, result) = Engine::call_with_args(&mut engine, args); // TODO: charge for storage process_exit_reason(status, &result) } + /// Process signed Ethereum transaction. + /// Must match CHAIN_ID to make sure it's signed for given chain vs replayed from another chain. #[no_mangle] pub extern "C" fn raw_call() { use crate::transaction::EthSignedTransaction; @@ -99,24 +153,26 @@ mod contract { let input = sdk::read_input(); let signed_transaction = EthSignedTransaction::decode(&Rlp::new(&input)) - .or_else(|_| Err(sdk::panic_utf8(b"invalid transaction"))) + .or_else(|_| Err(sdk::panic_utf8(b"ERR_INVALID_TX"))) .unwrap(); + let state = Engine::get_state(); + // Validate the chain ID, if provided inside the signature: if let Some(chain_id) = signed_transaction.chain_id() { - if U256::from(chain_id) != *CHAIN_ID { - return sdk::panic_utf8(b"invalid chain ID"); + if U256::from(chain_id) != U256::from(state.chain_id) { + return sdk::panic_utf8(b"ERR_INVALID_CHAIN_ID"); } } // Retrieve the signer of the transaction: let sender = match signed_transaction.sender() { Some(sender) => sender, - None => return sdk::panic_utf8(b"invalid ECDSA signature"), + None => return sdk::panic_utf8(b"ERR_INVALID_ECDSA_SIGNATURE"), }; // Figure out what kind of a transaction this is, and execute it: - let mut engine = Engine::new(*CHAIN_ID, predecessor_address()); + let mut engine = Engine::new_with_state(state, sender); let value = signed_transaction.transaction.value; let data = signed_transaction.transaction.data; if let Some(receiver) = signed_transaction.transaction.to { @@ -142,15 +198,39 @@ mod contract { #[no_mangle] pub extern "C" fn meta_call() { - let _input = sdk::read_input(); - todo!(); // TODO: https://github.com/aurora-is-near/aurora-engine/issues/4 + let input = sdk::read_input(); + let state = Engine::get_state(); + let domain_separator = crate::meta_parsing::near_erc712_domain(U256::from(state.chain_id)); + let meta_call_args = match crate::meta_parsing::parse_meta_call( + &domain_separator, + &sdk::current_account_id(), + input, + ) { + Ok(args) => args, + Err(_error_kind) => { + sdk::panic_utf8(b"ERR_META_TX_PARSE"); + return; + } + }; + let mut engine = Engine::new_with_state(state, meta_call_args.sender); + let (status, result) = engine.call( + meta_call_args.sender, + meta_call_args.contract_address, + meta_call_args.value, + meta_call_args.input, + ); + process_exit_reason(status, &result); } + /// + /// Reading data from EVM + /// + #[no_mangle] pub extern "C" fn view() { let input = sdk::read_input(); let args = ViewCallArgs::try_from_slice(&input).unwrap(); - let mut engine = Engine::new(*CHAIN_ID, Address::from_slice(&args.sender)); + let mut engine = Engine::new(Address::from_slice(&args.sender)); let (status, result) = Engine::view_with_args(&mut engine, args); process_exit_reason(status, &result) } @@ -184,11 +264,14 @@ mod contract { sdk::return_output(&value.0) } + /// + /// Methods for testing. + /// + #[no_mangle] pub extern "C" fn begin_chain() { let input = sdk::read_input(); - let args = BeginChainArgs::try_from_slice(&input).unwrap(); - sdk::write_storage(b"\0chain_id", &args.chain_id) + let _args = BeginChainArgs::try_from_slice(&input).unwrap(); // TODO: https://github.com/aurora-is-near/aurora-engine/issues/1 } @@ -199,6 +282,10 @@ mod contract { // TODO: https://github.com/aurora-is-near/aurora-engine/issues/2 } + /// + /// Utility methods. + /// + fn predecessor_address() -> Address { near_account_to_evm_address(&sdk::predecessor_account_id()) } diff --git a/src/meta_parsing.rs b/src/meta_parsing.rs new file mode 100644 index 000000000..7a2d401e3 --- /dev/null +++ b/src/meta_parsing.rs @@ -0,0 +1,556 @@ +use borsh::BorshDeserialize; +use ethabi::{encode, Token as ABIToken}; +use lunarity_lexer::{Lexer, Token}; +use rlp::{Decodable, DecoderError, Rlp}; + +use crate::parameters::MetaCallArgs; +use crate::prelude::{vec, Address, Box, HashMap, String, ToOwned, ToString, Vec, U256}; +use crate::transaction::ecrecover_address; +use crate::types::{keccak, u256_to_arr, ErrorKind, InternalMetaCallArgs, RawU256, Result}; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ArgType { + Address, + Uint, + Int, + String, + Bool, + Bytes, + Byte(u8), + Custom(String), + Array { + length: Option, + inner: Box, + }, +} + +/// the type string is being validated before it's parsed. +/// field_type: A single evm function arg type in string, without the argument name +/// e.g. "bytes" "uint256[][3]" "CustomStructName" +pub fn parse_type(field_type: &str) -> Result { + #[derive(PartialEq)] + enum State { + Open, + Close, + } + + let mut lexer = Lexer::new(field_type); + let mut token = None; + let mut state = State::Close; + let mut array_depth = 0; + let mut current_array_length: Option = None; + + while lexer.token != Token::EndOfProgram { + let type_ = match lexer.token { + Token::Identifier => ArgType::Custom(lexer.slice().to_owned()), + Token::TypeByte => ArgType::Byte(lexer.extras.0), + Token::TypeBytes => ArgType::Bytes, + Token::TypeBool => ArgType::Bool, + Token::TypeUint => ArgType::Uint, + Token::TypeInt => ArgType::Int, + Token::TypeString => ArgType::String, + Token::TypeAddress => ArgType::Address, + Token::LiteralInteger => { + let length = lexer.slice(); + current_array_length = Some( + length + .parse() + .map_err(|_| ErrorKind::InvalidMetaTransactionMethodName)?, + ); + lexer.advance(); + continue; + } + Token::BracketOpen if token.is_some() && state == State::Close => { + state = State::Open; + lexer.advance(); + continue; + } + Token::BracketClose if array_depth < 10 => { + if state == State::Open && token.is_some() { + let length = current_array_length.take(); + state = State::Close; + token = Some(ArgType::Array { + inner: Box::new(token.expect("if statement checks for some; qed")), + length, + }); + lexer.advance(); + array_depth += 1; + continue; + } else { + return Err(ErrorKind::InvalidMetaTransactionMethodName); + } + } + Token::BracketClose if array_depth == 10 => { + return Err(ErrorKind::InvalidMetaTransactionMethodName); + } + _ => { + return Err(ErrorKind::InvalidMetaTransactionMethodName); + } + }; + + token = Some(type_); + lexer.advance(); + } + + token.ok_or(ErrorKind::InvalidMetaTransactionMethodName) +} + +/// NEAR's domainSeparator +/// See https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator +/// and https://eips.ethereum.org/EIPS/eip-712#rationale-for-domainseparator +/// for definition and rationale for domainSeparator. +pub fn near_erc712_domain(chain_id: U256) -> RawU256 { + let mut bytes = Vec::with_capacity(70); + bytes.extend_from_slice( + &keccak("EIP712Domain(string name,string version,uint256 chainId)".as_bytes()).as_bytes(), + ); + let near: RawU256 = keccak(b"NEAR").into(); + bytes.extend_from_slice(&near); + let version: RawU256 = keccak(b"1").into(); + bytes.extend_from_slice(&version); + bytes.extend_from_slice(&u256_to_arr(&chain_id)); + keccak(&bytes).into() +} + +/// method_sig: format like "adopt(uint256,PetObj)" (no additional PetObj definition) +pub fn method_sig_to_abi(method_sig: &str) -> [u8; 4] { + let mut result = [0u8; 4]; + result.copy_from_slice(&keccak(method_sig.as_bytes())[..4]); + result +} + +pub fn encode_address(addr: Address) -> Vec { + let mut bytes = vec![0u8; 12]; + bytes.extend_from_slice(&addr.0); + bytes +} + +pub fn encode_string(s: &str) -> Vec { + let mut bytes = vec![]; + bytes.extend_from_slice(&keccak(s.as_bytes()).as_bytes()); + bytes +} + +#[derive(Debug, Eq, PartialEq)] +pub enum RlpValue { + Bytes(Vec), + List(Vec), +} + +impl Decodable for RlpValue { + fn decode(rlp: &Rlp<'_>) -> core::result::Result { + if rlp.is_list() { + Ok(RlpValue::List(rlp.as_list()?)) + } else { + Ok(RlpValue::Bytes( + rlp.decoder().decode_value(|bytes| Ok(bytes.to_vec()))?, + )) + } + } +} + +#[derive(Debug, Eq, PartialEq)] +/// An argument specified in a evm method definition +pub struct Arg { + #[allow(dead_code)] + pub name: String, + pub type_raw: String, + pub t: ArgType, +} + +#[derive(Debug, Eq, PartialEq)] +/// A parsed evm method definition +pub struct Method { + pub name: String, + pub raw: String, + pub args: Vec, +} + +#[derive(Debug, Eq, PartialEq)] +pub struct MethodAndTypes { + pub method: Method, + pub type_sequences: Vec, + pub types: HashMap, +} + +impl Arg { + fn parse(text: &str) -> Result<(Arg, &str)> { + let (type_raw, remains) = parse_type_raw(text)?; + let t = parse_type(&type_raw)?; + let remains = consume(remains, ' ')?; + let (name, remains) = parse_ident(remains)?; + Ok((Arg { type_raw, t, name }, remains)) + } + + fn parse_args(text: &str) -> Result<(Vec, &str)> { + let mut remains = consume(text, '(')?; + if remains.is_empty() { + return Err(ErrorKind::InvalidMetaTransactionMethodName); + } + let mut args = vec![]; + let first = remains.chars().next().unwrap(); + if is_arg_start(first) { + let (arg, r) = Arg::parse(remains)?; + remains = r; + args.push(arg); + while remains.starts_with(',') { + remains = consume(remains, ',')?; + let (arg, r) = Arg::parse(remains)?; + remains = r; + args.push(arg); + } + } + + let remains = consume(remains, ')')?; + + Ok((args, remains)) + } +} + +impl Method { + fn parse(method_def: &str) -> Result<(Method, &str)> { + let (name, remains) = parse_ident(method_def)?; + let (args, remains) = Arg::parse_args(remains)?; + Ok(( + Method { + name, + args, + raw: method_def[..method_def.len() - remains.len()].to_string(), + }, + remains, + )) + } +} + +impl MethodAndTypes { + pub fn parse(method_def: &str) -> Result { + let method_def = method_def; + let mut parsed_types = HashMap::new(); + let mut type_sequences = vec![]; + let (method, mut types) = Method::parse(method_def)?; + while types.is_empty() { + let (ty, remains) = Method::parse(types)?; + type_sequences.push(ty.name.clone()); + parsed_types.insert(ty.name.clone(), ty); + types = remains; + } + Ok(MethodAndTypes { + method, + types: parsed_types, + type_sequences, + }) + } +} + +fn parse_ident(text: &str) -> Result<(String, &str)> { + let mut chars = text.chars(); + if text.is_empty() || !is_arg_start(chars.next().unwrap()) { + return Err(ErrorKind::InvalidMetaTransactionMethodName); + } + + let mut i = 1; + for c in chars { + if !is_arg_char(c) { + break; + } + i += 1; + } + Ok((text[..i].to_string(), &text[i..])) +} + +/// Tokenizer a type specifier from a method definition +/// E.g. text: "uint256[] petIds,..." +/// returns: "uint256[]", " petIds,..." +/// "uint256[]" is not parsed further to "an array of uint256" in this fn +fn parse_type_raw(text: &str) -> Result<(String, &str)> { + let i = text + .find(' ') + .ok_or(ErrorKind::InvalidMetaTransactionMethodName)?; + Ok((text[..i].to_string(), &text[i..])) +} + +/// Consume next char in text, it must be c or return parse error +/// return text without the first char +fn consume(text: &str, c: char) -> Result<&str> { + let first = text.chars().next(); + if first.is_none() || first.unwrap() != c { + return Err(ErrorKind::InvalidMetaTransactionMethodName); + } + + Ok(&text[1..]) +} + +/// Return true if c can be used as first char of a evm method arg +fn is_arg_start(c: char) -> bool { + c.is_ascii_alphabetic() || c == '_' +} + +/// Return true if c can be used as consequent char of a evm method arg +fn is_arg_char(c: char) -> bool { + c.is_ascii_alphanumeric() || c == '_' +} + +/// Return a signature of the method_def with additional args +/// E.g. methods_signature(Methods before parse: "adopt(uint256 petId,PetObj petobj)PetObj(string name)") +/// -> "adopt(uint256,PetObj)" +fn method_signature(method_and_type: &MethodAndTypes) -> String { + let mut result = method_and_type.method.name.clone(); + result.push('('); + for (i, arg) in method_and_type.method.args.iter().enumerate() { + if i > 0 { + result.push(','); + } + result.push_str(&arg.type_raw); + } + result.push(')'); + result +} + +/// Decode rlp-encoded args into vector of Values +fn rlp_decode(args: &[u8]) -> Result> { + let rlp = Rlp::new(args); + let res: core::result::Result, DecoderError> = rlp.as_list(); + res.map_err(|_| ErrorKind::InvalidMetaTransactionFunctionArg) +} + +/// eip-712 hash a single argument, whose type is ty, and value is value. +/// Definition of all types is in `types`. +fn eip_712_hash_argument( + ty: &ArgType, + value: &RlpValue, + types: &HashMap, +) -> Result> { + match ty { + ArgType::String | ArgType::Bytes => { + eip_712_rlp_value(value, |b| Ok(keccak(&b).as_bytes().to_vec())) + } + ArgType::Byte(_) => eip_712_rlp_value(value, |b| Ok(b.clone())), + // TODO: ensure rlp int is encoded as sign extended uint256, otherwise this is wrong + ArgType::Uint | ArgType::Int | ArgType::Bool => eip_712_rlp_value(value, |b| { + Ok(u256_to_arr(&U256::from_big_endian(&b)).to_vec()) + }), + ArgType::Address => { + eip_712_rlp_value(value, |b| Ok(encode_address(Address::from_slice(b)))) + } + ArgType::Array { inner, .. } => eip_712_rlp_list(value, |l| { + let mut r = vec![]; + for element in l { + r.extend_from_slice(&eip_712_hash_argument(inner, element, types)?); + } + Ok(keccak(&r).as_bytes().to_vec()) + }), + ArgType::Custom(type_name) => eip_712_rlp_list(value, |l| { + let struct_type = types + .get(type_name) + .ok_or(ErrorKind::InvalidMetaTransactionFunctionArg)?; + // struct_type.raw is with struct type with argument names (a "method_def"), so it follows + // EIP-712 typeHash. + let mut r = keccak(struct_type.raw.as_bytes()).as_bytes().to_vec(); + for (i, element) in l.iter().enumerate() { + r.extend_from_slice(&eip_712_hash_argument( + &struct_type.args[i].t, + element, + types, + )?); + } + Ok(keccak(&r).as_bytes().to_vec()) + }), + } +} + +/// EIP-712 hash a RLP list. f must contain actual logic of EIP-712 encoding +/// This function serves as a guard to assert value is a List instead of Value +fn eip_712_rlp_list(value: &RlpValue, f: F) -> Result> +where + F: Fn(&Vec) -> Result>, +{ + match value { + RlpValue::Bytes(_) => Err(ErrorKind::InvalidMetaTransactionFunctionArg), + RlpValue::List(l) => f(l), + } +} + +/// EIP-712 hash a RLP value. f must contain actual logic of EIP-712 encoding +/// This function serves as a guard to assert value is a Value instead of List +fn eip_712_rlp_value(value: &RlpValue, f: F) -> Result> +where + F: Fn(&Vec) -> Result>, +{ + match value { + RlpValue::List(_) => Err(ErrorKind::InvalidMetaTransactionFunctionArg), + RlpValue::Bytes(b) => f(b), + } +} + +fn eth_abi_encode_args(args_decoded: &[RlpValue], methods: &MethodAndTypes) -> Result> { + let mut tokens = vec![]; + for (i, arg) in args_decoded.iter().enumerate() { + tokens.push(arg_to_abi_token(&methods.method.args[i].t, arg, methods)?); + } + Ok(encode(&tokens)) +} + +fn arg_to_abi_token(ty: &ArgType, arg: &RlpValue, methods: &MethodAndTypes) -> Result { + match ty { + ArgType::String | ArgType::Bytes => { + value_to_abi_token(arg, |b| Ok(ABIToken::Bytes(b.clone()))) + } + ArgType::Byte(_) => value_to_abi_token(arg, |b| Ok(ABIToken::FixedBytes(b.clone()))), + ArgType::Uint | ArgType::Int | ArgType::Bool => { + value_to_abi_token(arg, |b| Ok(ABIToken::Uint(U256::from_big_endian(&b)))) + } + ArgType::Address => { + value_to_abi_token(arg, |b| Ok(ABIToken::Address(Address::from_slice(b)))) + } + ArgType::Array { + inner, + length: None, + } => list_to_abi_token(arg, |l| { + let mut tokens = vec![]; + for arg in l { + tokens.push(arg_to_abi_token(inner, arg, methods)?); + } + Ok(ABIToken::Array(tokens)) + }), + ArgType::Array { + inner, + length: Some(_), + } => list_to_abi_token(arg, |l| { + let mut tokens = vec![]; + for arg in l { + tokens.push(arg_to_abi_token(inner, arg, methods)?); + } + Ok(ABIToken::FixedArray(tokens)) + }), + ArgType::Custom(type_name) => list_to_abi_token(arg, |l| { + let struct_type = methods + .types + .get(type_name) + .ok_or(ErrorKind::InvalidMetaTransactionFunctionArg)?; + let mut tokens = vec![]; + for (i, element) in l.iter().enumerate() { + tokens.push(arg_to_abi_token(&struct_type.args[i].t, element, methods)?); + } + Ok(ABIToken::Tuple(tokens)) + }), + } +} + +fn value_to_abi_token(value: &RlpValue, f: F) -> Result +where + F: Fn(&Vec) -> Result, +{ + match value { + RlpValue::List(_) => Err(ErrorKind::InvalidMetaTransactionFunctionArg), + RlpValue::Bytes(b) => f(b), + } +} + +fn list_to_abi_token(value: &RlpValue, f: F) -> Result +where + F: Fn(&Vec) -> Result, +{ + match value { + RlpValue::Bytes(_) => Err(ErrorKind::InvalidMetaTransactionFunctionArg), + RlpValue::List(l) => f(l), + } +} + +/// eip-712 hash struct of entire meta txn and abi-encode function args to evm input +pub fn prepare_meta_call_args( + domain_separator: &RawU256, + account_id: &[u8], + method_def: String, + input: &InternalMetaCallArgs, +) -> Result<(RawU256, Vec)> { + let mut bytes = Vec::new(); + let method_arg_start = match method_def.find('(') { + Some(index) => index, + None => return Err(ErrorKind::InvalidMetaTransactionMethodName), + }; + let arguments = "Arguments".to_string() + &method_def[method_arg_start..]; + // Note: method_def is like "adopt(uint256 petId,PetObj petObj)PetObj(string name,address owner)", + // MUST have no space after `,`. EIP-712 requires hashStruct start by packing the typeHash, + // See "Rationale for typeHash" in https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct + // method_def is used here for typeHash + let types = "NearTx(string evmId,uint256 nonce,uint256 feeAmount,address feeAddress,address contractAddress,uint256 value,string contractMethod,Arguments arguments)".to_string() + &arguments; + bytes.extend_from_slice(&keccak(types.as_bytes()).as_bytes()); + bytes.extend_from_slice(&keccak(account_id).as_bytes()); + bytes.extend_from_slice(&u256_to_arr(&input.nonce)); + bytes.extend_from_slice(&u256_to_arr(&input.fee_amount)); + bytes.extend_from_slice(&encode_address(input.fee_address)); + bytes.extend_from_slice(&encode_address(input.contract_address)); + bytes.extend_from_slice(&u256_to_arr(&input.value)); + + let methods = MethodAndTypes::parse(&method_def)?; + let method_sig = method_signature(&methods); + bytes.extend_from_slice(&keccak(method_sig.as_bytes()).as_bytes()); + + let mut arg_bytes = Vec::new(); + arg_bytes.extend_from_slice(&keccak(arguments.as_bytes()).as_bytes()); + let args_decoded: Vec = rlp_decode(&input.input)?; + for (i, arg) in args_decoded.iter().enumerate() { + arg_bytes.extend_from_slice(&eip_712_hash_argument( + &methods.method.args[i].t, + arg, + &methods.types, + )?); + } + + // ETH-ABI require function selector to use method_sig, instead of method_name, + // See https://docs.soliditylang.org/en/v0.7.5/abi-spec.html#function-selector + // Above spec is not completely clear, this implementation shows signature is the one without + // argument name: + // https://github.com/rust-ethereum/ethabi/blob/69285cf6b6202d9faa19c7d0239df6a2bd79d55f/ethabi/src/signature.rs#L28 + let method_selector = method_sig_to_abi(&method_sig); + let args_eth_abi = eth_abi_encode_args(&args_decoded, &methods)?; + let input = [method_selector.to_vec(), args_eth_abi.to_vec()].concat(); + + let arg_bytes_hash: RawU256 = keccak(&arg_bytes).into(); + bytes.extend_from_slice(&arg_bytes_hash); + + let message: RawU256 = keccak(&bytes).into(); + let mut bytes = Vec::with_capacity(2 + 32 + 32); + bytes.extend_from_slice(&[0x19, 0x01]); + bytes.extend_from_slice(domain_separator); + bytes.extend_from_slice(&message); + Ok((keccak(&bytes).into(), input)) +} + +/// Parse encoded `MetaCallArgs`, validate with given domain and account and recover the sender's address from the signature. +/// Returns error if method definition or arguments are wrong, invalid signature or EC recovery failed. +pub fn parse_meta_call( + domain_separator: &RawU256, + account_id: &[u8], + args: Vec, +) -> Result { + let meta_tx = MetaCallArgs::try_from_slice(&args).map_err(|_| ErrorKind::ArgumentParseError)?; + let nonce = U256::from(meta_tx.nonce); + let fee_amount = U256::from(meta_tx.fee_amount); + let fee_address = Address::from(meta_tx.fee_address); + let contract_address = Address::from(meta_tx.contract_address); + let value = U256::from(meta_tx.value); + + let mut result = InternalMetaCallArgs { + sender: Address::zero(), + nonce, + fee_amount, + fee_address, + contract_address, + value, + input: meta_tx.args, + }; + let (msg, input) = + prepare_meta_call_args(domain_separator, account_id, meta_tx.method_def, &result)?; + let mut signature: [u8; 65] = [0; 65]; + signature[0] = meta_tx.v; + signature[1..].copy_from_slice(&meta_tx.signature); + match ecrecover_address(&msg, &signature) { + Some(sender) => { + result.sender = sender; + result.input = input; + Ok(result) + } + None => Err(ErrorKind::InvalidEcRecoverSignature), + } +} diff --git a/src/parameters.rs b/src/parameters.rs index 007c7423d..f0c4c1494 100644 --- a/src/parameters.rs +++ b/src/parameters.rs @@ -1,10 +1,36 @@ -use crate::prelude::Vec; - use borsh::{BorshDeserialize, BorshSerialize}; -pub type RawAddress = [u8; 20]; -pub type RawU256 = [u8; 32]; -pub type RawH256 = [u8; 32]; +use crate::prelude::{String, Vec}; +use crate::types::{AccountId, RawAddress, RawH256, RawU256}; + +/// Borsh-encoded parameters for the `new` function. +#[derive(BorshSerialize, BorshDeserialize)] +pub struct NewCallArgs { + /// Chain id, according to the EIP-115 / ethereum-lists spec. + pub chain_id: RawU256, + /// Account which can upgrade this contract. + /// Use empty to disable updatability. + pub owner_id: AccountId, + /// Account of the bridge prover. + /// Use empty to not use base token as bridged asset. + pub bridge_prover_id: AccountId, + /// How many blocks after staging upgrade can deploy it. + pub upgrade_delay_blocks: u64, +} + +/// Borsh-encoded parameters for the `meta_call` function. +#[derive(BorshSerialize, BorshDeserialize)] +pub struct MetaCallArgs { + pub signature: [u8; 64], + pub v: u8, + pub nonce: RawU256, + pub fee_amount: RawU256, + pub fee_address: RawAddress, + pub contract_address: RawAddress, + pub value: RawU256, + pub method_def: String, + pub args: Vec, +} /// Borsh-encoded parameters for the `call` function. #[derive(BorshSerialize, BorshDeserialize)] @@ -31,9 +57,7 @@ pub struct GetStorageAtArgs { /// Borsh-encoded parameters for the `begin_chain` function. #[derive(BorshSerialize, BorshDeserialize)] -pub struct BeginChainArgs { - pub chain_id: RawU256, -} +pub struct BeginChainArgs {} /// Borsh-encoded parameters for the `begin_block` function. #[derive(BorshSerialize, BorshDeserialize)] diff --git a/src/precompiles.rs b/src/precompiles.rs index b1eb6c208..411c9e151 100644 --- a/src/precompiles.rs +++ b/src/precompiles.rs @@ -1,4 +1,5 @@ use crate::prelude::{Address, Vec, H160, H256, U256}; +use crate::transaction::ecrecover_address; use evm::{Context, ExitError, ExitSucceed}; type PrecompileResult = Result<(ExitSucceed, Vec, u64), ExitError>; @@ -20,41 +21,40 @@ pub fn istanbul_precompiles( _target_gas: Option, _context: &Context, ) -> Option { - if address == Address::from_low_u64_be(1) { - todo!() // TODO: implement ecrecover() - } else if address == Address::from_low_u64_be(2) { - Some(Ok(( + match address.to_low_u64_be() { + 1 => Some(Ok(( + ExitSucceed::Returned, + ecrecover(input).as_bytes().to_vec(), + 0, + ))), + 2 => Some(Ok(( ExitSucceed::Returned, sha256(input).as_bytes().to_vec(), 0, - ))) - } else if address == Address::from_low_u64_be(3) { - Some(Ok(( + ))), + 3 => Some(Ok(( ExitSucceed::Returned, ripemd160(input).as_bytes().to_vec(), 0, - ))) - } else if address == Address::from_low_u64_be(4) { - Some(Ok((ExitSucceed::Returned, identity(input).to_vec(), 0))) - } else if address == Address::from_low_u64_be(5) { - todo!() // TODO: implement modexp() - } else if address == Address::from_low_u64_be(6) { - todo!() // TODO: implement alt_bn128_add() - } else if address == Address::from_low_u64_be(7) { - todo!() // TODO: implement alt_bn128_mul() - } else if address == Address::from_low_u64_be(8) { - todo!() // TODO: implement alt_bn128_pair() - } else if address == Address::from_low_u64_be(9) { - todo!() // TODO: implement blake2f() - } else { - None // not supported + ))), + 4 => Some(Ok((ExitSucceed::Returned, identity(input).to_vec(), 0))), + 5 => todo!(), // TODO: implement modexp() + 6 => todo!(), // TODO: implement alt_bn128_add() + 7 => todo!(), // TODO: implement alt_bn128_mul() + 8 => todo!(), // TODO: implement alt_bn128_pair() + 9 => todo!(), // TODO: implement blake2f() + // Not supported. + _ => None, } } /// See: https://ethereum.github.io/yellowpaper/paper.pdf -#[allow(dead_code)] -fn ecrecover(_hash: H256, _v: u8, _r: H256, _s: H256) -> Address { - Address::zero() // TODO: implement ECRECOVER +fn ecrecover(input: &[u8]) -> Address { + let mut hash = [0; 32]; + hash.copy_from_slice(&input[..32]); + let mut signature = [0; 65]; + signature.copy_from_slice(&input[63..]); + ecrecover_address(&hash, &signature).unwrap_or_else(Address::zero) } /// See: https://ethereum.github.io/yellowpaper/paper.pdf diff --git a/src/prelude.rs b/src/prelude.rs index 4a5887960..1b64ce2b6 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,7 +1,13 @@ #[cfg(not(feature = "std"))] -pub use alloc::{string::String, vec, vec::Vec}; +pub use alloc::{ + borrow::ToOwned, boxed::Box, collections::BTreeMap as HashMap, string::String, + string::ToString, vec, vec::Vec, +}; #[cfg(feature = "std")] -pub use std::{string::String, vec, vec::Vec}; +pub use std::{ + borrow::ToOwned, boxed::Box, collections::HashMap, string::String, string::ToString, vec, + vec::Vec, +}; pub use primitive_types::{H160, H256, U256}; diff --git a/src/sdk.rs b/src/sdk.rs index 387751634..f1795a2df 100644 --- a/src/sdk.rs +++ b/src/sdk.rs @@ -12,7 +12,7 @@ mod exports { // ############### // # Context API # // ############### - fn current_account_id(register_id: u64); + pub(crate) fn current_account_id(register_id: u64); fn signer_account_id(register_id: u64); fn signer_account_pk(register_id: u64); pub(crate) fn predecessor_account_id(register_id: u64); @@ -69,13 +69,17 @@ mod exports { gas: u64, ) -> u64; fn promise_and(promise_idx_ptr: u64, promise_idx_count: u64) -> u64; - fn promise_batch_create(account_id_len: u64, account_id_ptr: u64) -> u64; + pub(crate) fn promise_batch_create(account_id_len: u64, account_id_ptr: u64) -> u64; fn promise_batch_then(promise_index: u64, account_id_len: u64, account_id_ptr: u64) -> u64; // ####################### // # Promise API actions # // ####################### fn promise_batch_action_create_account(promise_index: u64); - fn promise_batch_action_deploy_contract(promise_index: u64, code_len: u64, code_ptr: u64); + pub(crate) fn promise_batch_action_deploy_contract( + promise_index: u64, + code_len: u64, + code_ptr: u64, + ); fn promise_batch_action_function_call( promise_index: u64, method_name_len: u64, @@ -170,6 +174,15 @@ pub fn read_input_arr20() -> [u8; 20] { } } +/// Reads current input and stores in the given key keeping data in the runtime. +pub fn read_input_and_store(key: &[u8]) { + unsafe { + exports::input(0); + // Store register 0 into key, store the previous value in register 1. + exports::storage_write(key.len() as _, key.as_ptr() as _, u64::MAX, 0, 1); + } +} + #[allow(dead_code)] pub fn return_output(value: &[u8]) { unsafe { @@ -190,6 +203,19 @@ pub fn read_storage(key: &[u8]) -> Option> { } } +/// Read u64 from storage at given key. +pub fn read_u64(key: &[u8]) -> Option { + unsafe { + if exports::storage_read(key.len() as u64, key.as_ptr() as u64, 0) == 1 { + let result = [0u8; 8]; + exports::read_register(0, result.as_ptr() as _); + Some(u64::from_le_bytes(result)) + } else { + None + } + } +} + #[allow(dead_code)] pub fn write_storage(key: &[u8], value: &[u8]) { unsafe { @@ -278,3 +304,26 @@ pub fn panic_hex(data: &[u8]) -> ! { unsafe { exports::panic_utf8(message.len() as _, message.as_ptr() as _) } unreachable!() } + +/// Returns account id of the current account. +pub fn current_account_id() -> Vec { + unsafe { + exports::current_account_id(1); + let bytes: Vec = vec![0u8; exports::register_len(1) as usize]; + exports::read_register(1, bytes.as_ptr() as *const u64 as u64); + bytes + } +} + +/// Deploy code from given key in place of the current key. +pub fn self_deploy(code_key: &[u8]) { + unsafe { + // Load current account id into register 0. + exports::current_account_id(0); + // Use register 0 as the destination for the promise. + let promise_id = exports::promise_batch_create(u64::MAX as _, 0); + // Remove code from storage and store it in register 1. + exports::storage_remove(code_key.len() as _, code_key.as_ptr() as _, 1); + exports::promise_batch_action_deploy_contract(promise_id, u64::MAX as _, 1); + } +} diff --git a/src/transaction.rs b/src/transaction.rs index c31170d4f..380082370 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -148,7 +148,7 @@ fn vrs_to_arr(v: u8, r: U256, s: U256) -> [u8; 65] { type RawHash = [u8; 32]; /// Given signature and data, validates that signature is valid for given data and returns ecrecover address. -fn ecrecover_address(hash: &RawHash, signature: &[u8; 65]) -> Option
{ +pub(crate) fn ecrecover_address(hash: &RawHash, signature: &[u8; 65]) -> Option
{ use sha3::Digest; let hash = secp256k1::Message::parse(&H256::from_slice(hash).0); diff --git a/src/types.rs b/src/types.rs index 32f86b203..c85e533ed 100644 --- a/src/types.rs +++ b/src/types.rs @@ -8,6 +8,32 @@ use evm::backend::Log; #[cfg(feature = "contract")] use crate::sdk; +pub type AccountId = String; +pub type RawAddress = [u8; 20]; +pub type RawU256 = [u8; 32]; +pub type RawH256 = [u8; 32]; + +/// Internal args format for meta call. +pub struct InternalMetaCallArgs { + pub sender: Address, + pub nonce: U256, + pub fee_amount: U256, + pub fee_address: Address, + pub contract_address: Address, + pub value: U256, + pub input: Vec, +} + +/// Internal errors to propagate up and format in the single place. +pub enum ErrorKind { + ArgumentParseError, + InvalidMetaTransactionMethodName, + InvalidMetaTransactionFunctionArg, + InvalidEcRecoverSignature, +} + +pub type Result = core::result::Result; + #[allow(dead_code)] pub fn u256_to_arr(value: &U256) -> [u8; 32] { let mut result = [0u8; 32]; diff --git a/tests/.gitkeep b/tests/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/test_meta_parsing.rs b/tests/test_meta_parsing.rs new file mode 100644 index 000000000..254e605b7 --- /dev/null +++ b/tests/test_meta_parsing.rs @@ -0,0 +1,119 @@ +use borsh::BorshSerialize; + +use near_crypto::{InMemorySigner, KeyType, PublicKey, Signature, Signer}; + +use aurora_engine::meta_parsing::{near_erc712_domain, parse_meta_call, prepare_meta_call_args}; +use aurora_engine::parameters::MetaCallArgs; +use aurora_engine::prelude::{Address, U256}; +use aurora_engine::types::{keccak, u256_to_arr, InternalMetaCallArgs}; + +pub fn encode_meta_call_function_args( + signer: &dyn Signer, + chain_id: u64, + nonce: U256, + fee_amount: U256, + fee_address: Address, + contract_address: Address, + value: U256, + method_def: &str, + args: Vec, +) -> Vec { + let domain_separator = near_erc712_domain(U256::from(chain_id)); + let (msg, _) = match prepare_meta_call_args( + &domain_separator, + "evm".as_bytes(), + method_def.to_string(), + &InternalMetaCallArgs { + sender: Address::zero(), + nonce, + fee_amount, + fee_address, + contract_address, + value, + input: args.clone(), + }, + ) { + Ok(x) => x, + Err(_) => panic!("Failed to prepare"), + }; + match signer.sign(&msg) { + Signature::ED25519(_) => panic!("Wrong Signer"), + Signature::SECP256K1(sig) => { + let array = Into::<[u8; 65]>::into(sig.clone()).to_vec(); + let mut signature = [0u8; 64]; + signature.copy_from_slice(&array[..64]); + MetaCallArgs { + signature, + // Add 27 to align eth-sig-util signature format + v: array[64] + 27, + nonce: u256_to_arr(&nonce), + fee_amount: u256_to_arr(&fee_amount), + fee_address: fee_address.0, + contract_address: contract_address.0, + value: u256_to_arr(&value), + method_def: method_def.to_string(), + args, + } + .try_to_vec() + .expect("Failed to serialize") + } + } +} + +pub fn public_key_to_address(public_key: PublicKey) -> Address { + match public_key { + PublicKey::ED25519(_) => panic!("Wrong PublicKey"), + PublicKey::SECP256K1(pubkey) => { + let pk: [u8; 64] = pubkey.into(); + let bytes = keccak(&pk.to_vec()); + let mut result = Address::zero(); + result.as_bytes_mut().copy_from_slice(&bytes[12..]); + result + } + } +} + +#[test] +fn test_meta_parsing() { + let chain_id = 1313161555; + let signer = InMemorySigner::from_seed("doesnt", KeyType::SECP256K1, "a"); + let signer_addr = public_key_to_address(signer.public_key.clone()); + let domain_separator = near_erc712_domain(U256::from(chain_id)); + + let meta_tx = encode_meta_call_function_args( + &signer, + chain_id, + U256::from(14), + U256::from(6), + Address::from_slice(&[0u8; 20]), + signer_addr.clone(), + U256::from(0), + "adopt(uint256 petId)", + // RLP encode of ["0x09"] + hex::decode("c109").unwrap(), + ); + + // meta_tx[0..65] is eth-sig-util format signature + // assert signature same as eth-sig-util, which also implies msg before sign (constructed by prepare_meta_call_args, follow eip-712) same + assert_eq!(hex::encode(&meta_tx[0..65]), "4066a42cf17d167d33ef62c8cee82d3748de0e804569212a839257dafdbb9d09084bd910f16ddb9643e98a0787cdf0137cad109687a00106c701e430657ae99a1b"); + let result = parse_meta_call(&domain_separator, "evm".as_bytes(), meta_tx) + .unwrap_or_else(|_| panic!("Fail")); + assert_eq!(result.sender, signer_addr); + + let meta_tx3 = encode_meta_call_function_args( + &signer, + chain_id, + U256::from(14), + U256::from(6), + Address::from_slice(&[0u8; 20]), + signer_addr.clone(), + U256::from(0), + "adopt(uint256 petId,PetObj petObject)PetObj(string petName,address owner)", + // RLP encode of ["0x09", ["0x436170734C6F636B", "0x0123456789012345678901234567890123456789"]] + hex::decode("e009de88436170734c6f636b940123456789012345678901234567890123456789").unwrap(), + ); + assert_eq!(hex::encode(&meta_tx3[0..65]), "d5fc0804e27c7ee36178b5ce1f0ef97e9f9317855743f16a38cc2ec81eb852dc58f76aaebb8f0264eeb6a61ba5d094a546fa95efcded4d507708c1d96a3c06561b"); + let result = parse_meta_call(&domain_separator, "evm".as_bytes(), meta_tx3) + .unwrap_or_else(|_| panic!("Fail")); + assert_eq!(result.sender, signer_addr); +} diff --git a/tests/test_upgrade.rs b/tests/test_upgrade.rs new file mode 100644 index 000000000..ac536143a --- /dev/null +++ b/tests/test_upgrade.rs @@ -0,0 +1,55 @@ +use near_sdk::borsh::BorshSerialize; +use near_sdk::test_utils::accounts; +use near_sdk_sim::{to_yocto, UserAccount, DEFAULT_GAS, STORAGE_AMOUNT}; + +use aurora_engine::parameters::NewCallArgs; + +near_sdk_sim::lazy_static_include::lazy_static_include_bytes! { + EVM_WASM_BYTES => "release.wasm" +} + +fn init() -> (UserAccount, UserAccount) { + let master_account = near_sdk_sim::init_simulator(None); + let contract_account = + master_account.deploy(*EVM_WASM_BYTES, accounts(0).to_string(), to_yocto("1000")); + contract_account + .call( + accounts(0).to_string(), + "new", + &NewCallArgs { + chain_id: [0u8; 32], + owner_id: master_account.account_id.clone(), + bridge_prover_id: accounts(0).to_string(), + upgrade_delay_blocks: 1, + } + .try_to_vec() + .unwrap(), + DEFAULT_GAS, + STORAGE_AMOUNT, + ) + .assert_success(); + (master_account, contract_account) +} + +#[test] +fn test_contract_upgrade() { + let (master_account, _contract_account) = init(); + master_account + .call( + accounts(0).to_string(), + "stage_upgrade", + &EVM_WASM_BYTES, + DEFAULT_GAS, + 0, + ) + .assert_success(); + master_account + .call( + accounts(0).to_string(), + "deploy_upgrade", + &[], + DEFAULT_GAS, + 0, + ) + .assert_success(); +}