From 0b3cc50234ccab6d7e0362013832436745fba165 Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Fri, 6 Sep 2024 21:23:41 +0000 Subject: [PATCH] init --- .env.example | 3 - Cargo.lock | 68 +- Cargo.toml | 5 +- crates/bindings/Cargo.toml | 2 +- crates/cli/Cargo.lock | 1585 ------------------------------- crates/cli/Cargo.toml | 12 +- crates/cli/src/commands/eval.rs | 12 +- crates/dispair/Cargo.toml | 8 +- crates/env/Cargo.toml | 10 - crates/env/src/lib.rs | 25 - crates/eval/Cargo.toml | 4 +- crates/eval/src/eval.rs | 31 +- crates/eval/src/fork.rs | 157 ++- crates/eval/src/trace.rs | 21 +- crates/parser/Cargo.toml | 8 +- crates/test_fixtures/Cargo.toml | 16 + crates/test_fixtures/src/lib.rs | 236 +++++ test/utils/TestERC20.sol | 19 + 18 files changed, 447 insertions(+), 1775 deletions(-) delete mode 100644 .env.example delete mode 100644 crates/cli/Cargo.lock delete mode 100644 crates/env/Cargo.toml delete mode 100644 crates/env/src/lib.rs create mode 100644 crates/test_fixtures/Cargo.toml create mode 100644 crates/test_fixtures/src/lib.rs create mode 100644 test/utils/TestERC20.sol diff --git a/.env.example b/.env.example deleted file mode 100644 index 63b50c1c..00000000 --- a/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -CI_DEPLOY_SEPOLIA_RPC_URL= -CI_FORK_SEPOLIA_BLOCK_NUMBER= -CI_FORK_SEPOLIA_DEPLOYER_ADDRESS= \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index a13ccc79..0eb7cedd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,12 +73,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ba1c79677c9ce51c8d45e20845b05e6fb070ea2c863fba03ad6af2c778474bd" dependencies = [ "alloy-consensus", + "alloy-contract", "alloy-core", "alloy-eips", "alloy-genesis", + "alloy-network", + "alloy-node-bindings", "alloy-provider", "alloy-rpc-client", + "alloy-rpc-types", "alloy-serde", + "alloy-signer", + "alloy-signer-local", + "alloy-transport", "alloy-transport-http", ] @@ -279,6 +286,22 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-node-bindings" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b2fb0276a78ec13791446a417c2517eee5c8e8a8c520ae0681975b8056e5c" +dependencies = [ + "alloy-genesis", + "alloy-primitives 0.7.7", + "k256", + "serde_json", + "tempfile", + "thiserror", + "tracing", + "url", +] + [[package]] name = "alloy-primitives" version = "0.6.4" @@ -340,9 +363,12 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network", + "alloy-node-bindings", "alloy-primitives 0.7.7", "alloy-rpc-client", + "alloy-rpc-types-anvil", "alloy-rpc-types-eth", + "alloy-signer-local", "alloy-transport", "alloy-transport-http", "async-stream", @@ -435,6 +461,17 @@ dependencies = [ "alloy-serde", ] +[[package]] +name = "alloy-rpc-types-anvil" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7cf4356a9d00df76d6e90d002e2a7b5edc1c8476e90e6f17ab868d99db6435" +dependencies = [ + "alloy-primitives 0.7.7", + "alloy-serde", + "serde", +] + [[package]] name = "alloy-rpc-types-engine" version = "0.1.4" @@ -5102,14 +5139,14 @@ dependencies = [ [[package]] name = "rain-i9r-cli" -version = "0.0.1" +version = "0.0.0-alpha.0" dependencies = [ "alloy", "anyhow", "clap", - "rain-interpreter-env", "rain-interpreter-eval", "rain_interpreter_bindings", + "rain_interpreter_test_fixtures", "serde", "serde_bytes", "tokio", @@ -5117,25 +5154,17 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "rain-interpreter-env" -version = "0.0.0" -dependencies = [ - "alloy", - "once_cell", -] - [[package]] name = "rain-interpreter-eval" -version = "0.1.0" +version = "0.0.0-alpha.0" dependencies = [ "alloy", "eyre", "foundry-evm", "once_cell", "rain-error-decoding", - "rain-interpreter-env", "rain_interpreter_bindings", + "rain_interpreter_test_fixtures", "reqwest 0.11.27", "revm", "serde", @@ -5148,14 +5177,14 @@ dependencies = [ [[package]] name = "rain_interpreter_bindings" -version = "0.1.0" +version = "0.0.0-alpha.0" dependencies = [ "alloy", ] [[package]] name = "rain_interpreter_dispair" -version = "0.1.0" +version = "0.0.0-alpha.0" dependencies = [ "alloy", "alloy-ethers-typecast", @@ -5171,7 +5200,7 @@ dependencies = [ [[package]] name = "rain_interpreter_parser" -version = "0.1.0" +version = "0.0.0-alpha.0" dependencies = [ "alloy", "alloy-ethers-typecast", @@ -5184,6 +5213,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "rain_interpreter_test_fixtures" +version = "0.0.0-alpha.0" +dependencies = [ + "alloy", + "getrandom", + "serde_json", +] + [[package]] name = "rand" version = "0.8.5" diff --git a/Cargo.toml b/Cargo.toml index a9f24f0a..949a3b5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.package] +version = "0.0.0-alpha.0" edition = "2021" license = "CAL-1.0" homepage = "https://github.com/rainprotocol/rain.interpreter" @@ -33,7 +34,6 @@ tracing-subscriber = "0.3.17" reqwest = { version = "0.11.17", features = ["json"] } once_cell = "1.17.1" alloy-ethers-typecast = { git = "https://github.com/rainlanguage/alloy-ethers-typecast", rev = "0881930a22e84db49ba955c5b88e790e1266ac66" } -rain-interpreter-env = { path = "crates/env" } eyre = "0.6" rain-error-decoding = { git = "https://github.com/rainlanguage/rain.error", rev = "72d9577fdaf7135113847027ba951f9a43b41827" } typeshare = { git = "https://github.com/tomjw64/typeshare", rev = "556b44aafd5304eedf17206800f69834e3820b7c" } @@ -49,3 +49,6 @@ path = "crates/bindings" [workspace.dependencies.rain-interpreter-eval] path = "crates/eval" + +[workspace.dependencies.rain_interpreter_test_fixtures] +path = "crates/test_fixtures" diff --git a/crates/bindings/Cargo.toml b/crates/bindings/Cargo.toml index c44579cb..3e632720 100644 --- a/crates/bindings/Cargo.toml +++ b/crates/bindings/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rain_interpreter_bindings" -version = "0.1.0" +version.workspace = true edition.workspace = true license.workspace = true homepage.workspace = true diff --git a/crates/cli/Cargo.lock b/crates/cli/Cargo.lock deleted file mode 100644 index 13e617d5..00000000 --- a/crates/cli/Cargo.lock +++ /dev/null @@ -1,1585 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "anstream" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" - -[[package]] -name = "anstyle-parse" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" -dependencies = [ - "anstyle", - "windows-sys 0.48.0", -] - -[[package]] -name = "anyhow" -version = "1.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" - -[[package]] -name = "ascii" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bumpalo" -version = "3.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "4.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a1f23fa97e1d1641371b51f35535cb26959b8e27ab50d167a8b996b5bada819" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdc5d93c358224b4d6867ef1356d740de2303e9892edc06c5340daeccd96bab" -dependencies = [ - "anstream", - "anstyle", - "bitflags", - "clap_lex", - "once_cell", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "clap_lex" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "combine" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" -dependencies = [ - "ascii", - "byteorder", - "either", - "memchr", - "unreachable", -] - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "pin-utils", -] - -[[package]] -name = "getrandom" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "graphql-introspection-query" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2a4732cf5140bd6c082434494f785a19cfb566ab07d1382c3671f5812fed6d" -dependencies = [ - "serde", -] - -[[package]] -name = "graphql-parser" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ebc8013b4426d5b81a4364c419a95ed0b404af2b82e2457de52d9348f0e474" -dependencies = [ - "combine", - "thiserror", -] - -[[package]] -name = "graphql_client" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa61bb9dc6d373a8b465a5da17b62809483e8527a34b0e9034dc0915b09e160a" -dependencies = [ - "graphql_query_derive", - "serde", - "serde_json", -] - -[[package]] -name = "graphql_client_codegen" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e55df64cc702c4ad6647f8df13a799ad11688a3781fadf5045f7ba12733fa9b" -dependencies = [ - "graphql-introspection-query", - "graphql-parser", - "heck", - "lazy_static", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 1.0.109", -] - -[[package]] -name = "graphql_query_derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52fc9cde811f44b15ec0692b31e56a3067f6f431c5ace712f286e47c1dacc98" -dependencies = [ - "graphql_client_codegen", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "h2" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "idna" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "ipnet" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.142" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" - -[[package]] -name = "linux-raw-sys" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mio" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.45.0", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - -[[package]] -name = "openssl" -version = "0.10.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "windows-sys 0.45.0", -] - -[[package]] -name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" - -[[package]] -name = "proc-macro2" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rain_cli_ob" -version = "0.0.4" -dependencies = [ - "anyhow", - "clap", - "graphql_client", - "once_cell", - "reqwest", - "rust-bigint", - "serde", - "serde_bytes", - "tokio", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags", -] - -[[package]] -name = "reqwest" -version = "0.11.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "rust-bigint" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe1d6964d886b707f3e2cec76ac5b0e887661a6699f695ed0d3d5bb4852d6959" -dependencies = [ - "getrandom", - "rust-gmp-kzen", - "serde", - "serde_derive", -] - -[[package]] -name = "rust-gmp-kzen" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e654bb304958a567aefa09e83cc313251388202c40bfc245fac19a0e2dd8d08" -dependencies = [ - "libc", - "num-traits", - "serde", -] - -[[package]] -name = "rustix" -version = "0.37.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc809f704c03a812ac71f22456c857be34185cac691a4316f27ab0f633bb9009" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" - -[[package]] -name = "schannel" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" -dependencies = [ - "windows-sys 0.42.0", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "security-framework" -version = "2.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "serde" -version = "1.0.160" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.160" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "serde_json" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.45.0", -] - -[[package]] -name = "thiserror" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" -dependencies = [ - "autocfg", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "nu-ansi-term", - "sharded-slab", - "smallvec", - "thread_local", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -dependencies = [ - "void", -] - -[[package]] -name = "url" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "web-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index d7ff5f7f..fc2620e3 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "rain-i9r-cli" -version = "0.0.1" -edition = "2021" -license = "CAL-1.0" description = "Rain Interpreter CLI." -homepage = "https://github.com/rainprotocol/rain.orderbook" +version.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -19,4 +19,6 @@ tokio = { version = "1.28.0", features = ["full"] } tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ['env-filter'] } alloy = { workspace = true } -rain-interpreter-env = { workspace = true } \ No newline at end of file + +[dev-dependencies] +rain_interpreter_test_fixtures = { workspace = true } \ No newline at end of file diff --git a/crates/cli/src/commands/eval.rs b/crates/cli/src/commands/eval.rs index b1cdfef8..a19a4998 100644 --- a/crates/cli/src/commands/eval.rs +++ b/crates/cli/src/commands/eval.rs @@ -112,10 +112,7 @@ impl Execute for Eval { #[cfg(test)] mod tests { use super::*; - - use rain_interpreter_env::{ - CI_DEPLOY_SEPOLIA_RPC_URL, CI_FORK_SEPOLIA_BLOCK_NUMBER, CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, - }; + use rain_interpreter_test_fixtures::LocalEvm; #[test] fn test_parse_int_or_hex() { @@ -127,16 +124,17 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_execute() { + let local_evm = LocalEvm::new().await; let eval = Eval { output_path: None, forked_evm: NewForkedEvmCliArgs { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }, fork_eval_args: ForkEvalCliArgs { rainlang_string: r"_: add(10 2), _: context<0 0>(), _:context<0 1>();".into(), source_index: 0, - deployer: *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, + deployer: *local_evm.deployer.address(), namespace: "0x123".into(), context: vec!["0x06,99".into()], decode_errors: true, diff --git a/crates/dispair/Cargo.toml b/crates/dispair/Cargo.toml index 6369b04c..bf312e69 100644 --- a/crates/dispair/Cargo.toml +++ b/crates/dispair/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "rain_interpreter_dispair" -version = "0.1.0" -edition = "2021" -license = "CAL-1.0" description = "Rain Interpreter Rust Crate." -homepage = "https://github.com/rainlanguage/rain.interpreter" +version.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true [dependencies] alloy-ethers-typecast = { workspace = true } diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml deleted file mode 100644 index d1d2e695..00000000 --- a/crates/env/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "rain-interpreter-env" -version = "0.0.0" -edition.workspace = true -license.workspace = true -homepage.workspace = true - -[dependencies] -once_cell = { workspace = true } -alloy = { workspace = true } diff --git a/crates/env/src/lib.rs b/crates/env/src/lib.rs deleted file mode 100644 index 243ee0ef..00000000 --- a/crates/env/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -use alloy::primitives::{Address, BlockNumber}; -use once_cell::sync::Lazy; - -pub const CI_DEPLOY_SEPOLIA_RPC_URL: &str = env!( - "CI_DEPLOY_SEPOLIA_RPC_URL", - "$CI_DEPLOY_SEPOLIA_RPC_URL not set." -); - -pub static CI_FORK_SEPOLIA_DEPLOYER_ADDRESS: Lazy
= Lazy::new(|| { - env!( - "CI_FORK_SEPOLIA_DEPLOYER_ADDRESS", - "$CI_FORK_SEPOLIA_DEPLOYER_ADDRESS not set." - ) - .parse() - .unwrap() -}); - -pub static CI_FORK_SEPOLIA_BLOCK_NUMBER: Lazy = Lazy::new(|| { - env!( - "CI_FORK_SEPOLIA_BLOCK_NUMBER", - "$CI_FORK_SEPOLIA_BLOCK_NUMBER not set." - ) - .parse() - .unwrap() -}); diff --git a/crates/eval/Cargo.toml b/crates/eval/Cargo.toml index 42fc644d..ffaa9cc8 100644 --- a/crates/eval/Cargo.toml +++ b/crates/eval/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rain-interpreter-eval" -version = "0.1.0" +version.workspace = true edition.workspace = true license.workspace = true homepage.workspace = true @@ -24,4 +24,4 @@ revm = { workspace = true } [dev-dependencies] tokio = { version = "1.28.0", features = ["full"] } tracing = { workspace = true } -rain-interpreter-env = { workspace = true } +rain_interpreter_test_fixtures = { workspace = true } diff --git a/crates/eval/src/eval.rs b/crates/eval/src/eval.rs index 9dd08b04..2278f422 100644 --- a/crates/eval/src/eval.rs +++ b/crates/eval/src/eval.rs @@ -134,22 +134,19 @@ impl Forker { #[cfg(test)] mod tests { - use alloy::primitives::utils::parse_ether; - use rain_interpreter_env::{ - CI_DEPLOY_SEPOLIA_RPC_URL, CI_FORK_SEPOLIA_BLOCK_NUMBER, CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, - }; - - use std::sync::Arc; - use super::*; use crate::fork::NewForkedEvm; + use alloy::primitives::utils::parse_ether; + use rain_interpreter_test_fixtures::LocalEvm; + use std::sync::Arc; #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_fork_parse() { - let deployer: Address = *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS; + let local_evm = LocalEvm::new().await; + let deployer = *local_evm.deployer.address(); let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let fork = Forker::new_with_fork(args, None, None).await.unwrap(); let res = fork @@ -167,10 +164,11 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_fork_eval() { - let deployer: Address = *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS; + let local_evm = LocalEvm::new().await; + let deployer = *local_evm.deployer.address(); let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_owned(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let fork = Forker::new_with_fork(args, None, None).await.unwrap(); let res = fork @@ -209,10 +207,11 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 10)] async fn test_fork_eval_parallel() { - let deployer: Address = *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS; + let local_evm = LocalEvm::new().await; + let deployer = *local_evm.deployer.address(); let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let fork = Forker::new_with_fork(args, None, None).await.unwrap(); let fork = Arc::new(fork); // Wrap in Arc for shared ownership diff --git a/crates/eval/src/fork.rs b/crates/eval/src/fork.rs index 37a31cc3..bc145726 100644 --- a/crates/eval/src/fork.rs +++ b/crates/eval/src/fork.rs @@ -8,7 +8,7 @@ use foundry_evm::{ opts::EvmOpts, }; use rain_error_decoding::AbiDecodedErrorType; -use revm::primitives::B256; +use revm::primitives::{TxKind, B256}; use revm::{ interpreter::InstructionResult, primitives::{Address as Addr, Bytes, Env, HashSet, SpecId}, @@ -477,13 +477,10 @@ impl Forker { )?; let res = match tx { - Some(tx) => match tx.to { - Some(to) => self.call(tx.from.as_slice(), to.as_slice(), &tx.input)?, - None => { - return Err(ForkCallError::ReplayTransactionError( - ReplayTransactionError::NoFromAddressFound(tx_hash.to_string(), fork_url), - )) - } + // if to field is None, it means the tx was a contract deployment, see 'revm::primitives::TxKind' + Some(tx) => match TxKind::from(tx.to) { + TxKind::Call(to) => self.call(tx.from.as_slice(), to.as_slice(), &tx.input)?, + TxKind::Create => self.call(tx.from.as_slice(), &[0u8; 20], &tx.input)?, }, None => { return Err(ForkCallError::ReplayTransactionError( @@ -499,18 +496,16 @@ impl Forker { #[cfg(test)] mod tests { - use crate::namespace::CreateNamespace; - use rain_interpreter_env::{ - CI_DEPLOY_SEPOLIA_RPC_URL, CI_FORK_SEPOLIA_BLOCK_NUMBER, CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, - }; - use super::*; + use crate::namespace::CreateNamespace; + use alloy::eips::BlockNumberOrTag; use alloy::primitives::U256; - use alloy::sol; + use alloy::{providers::Provider, sol}; use rain_interpreter_bindings::{ - DeployerISP::{iParserCall, iStoreCall}, + DeployerISP::iParserCall, IInterpreterStoreV1::{getCall, setCall}, }; + use rain_interpreter_test_fixtures::LocalEvm; sol! { interface IERC20 { @@ -521,57 +516,40 @@ mod tests { function transferFrom(address from, address to, uint256 amount) external returns (bool); } } - const USDT_POLYGON: &str = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; - const USDT_BSC: &str = "0x55d398326f99059fF775485246999027B3197955"; - const POLYGON_FORK_NUMBER: u64 = 54697866; - const BSC_FORK_NUMBER: u64 = 40531873; - const POLYGON_FORK_URL: &str = "https://rpc.ankr.com/polygon"; - const BSC_FORK_URL: &str = "https://rpc.ankr.com/bsc"; - const BSC_ACC: &str = "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A"; - const POLYGON_ACC: &str = "0xF977814e90dA44bFA03b6295A0616a897441aceC"; #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_forker_read() { + let local_evm = LocalEvm::new().await; + let deployer = *local_evm.deployer.address(); let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let forker = Forker::new_with_fork(args, None, None).await.unwrap(); let from_address = Address::default(); - let to_address: Address = *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS; + let to_address = deployer; let call = iParserCall {}; let result = forker .alloy_call(from_address, to_address, call, false) .await .unwrap(); let parser_address = result.typed_return._0; - let expected_address = "0xf14e09601a47552de6abd3a0b165607fafd2b5ba" - .parse::
() - .unwrap(); + let expected_address = *local_evm.parser.address(); assert_eq!(parser_address, expected_address); } #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_forker_write() { + let local_evm = LocalEvm::new().await; let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let mut forker = Forker::new_with_fork(args, None, None).await.unwrap(); let from_address = Address::repeat_byte(0x02); - let store_call = iStoreCall {}; - let store_result = forker - .alloy_call( - from_address, - *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, - store_call, - false, - ) - .await - .unwrap(); - let store_address: Address = store_result.typed_return._0; + let store_address = *local_evm.store.address(); let namespace = U256::from(1); let key = U256::from(3); @@ -612,16 +590,19 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_multi_fork_read_write_switch_reset() -> Result<(), ForkCallError> { + let local_evm1 = LocalEvm::new_with_tokens(1).await; + let local_evm1_token = *local_evm1.tokens[0].address(); + let local_evm1_token_holder = local_evm1.anvil.addresses()[0]; let args = NewForkedEvm { - fork_url: POLYGON_FORK_URL.to_owned(), - fork_block_number: Some(POLYGON_FORK_NUMBER), + fork_url: local_evm1.url(), + fork_block_number: None, }; let mut forker = Forker::new_with_fork(args, None, None).await.unwrap(); let from_address = Address::default(); - let to_address: Address = USDT_POLYGON.parse::
().unwrap(); + let to_address = local_evm1_token; let call = IERC20::balanceOfCall { - account: POLYGON_ACC.parse::
().unwrap(), + account: local_evm1_token_holder, }; let result = forker .alloy_call(from_address, to_address, call, false) @@ -630,8 +611,8 @@ mod tests { let old_balance = result.typed_return._0; let polygon_old_balance = result.typed_return._0; - let from_address = POLYGON_ACC.parse::
().unwrap(); - let to_address: Address = USDT_POLYGON.parse::
().unwrap(); + let from_address = local_evm1_token_holder; + let to_address = local_evm1_token; let send_amount = U256::from(0xffu64); let transfer_call = IERC20::transferCall { to: Address::repeat_byte(0x2), @@ -649,9 +630,9 @@ mod tests { .unwrap(); let from_address = Address::default(); - let to_address: Address = USDT_POLYGON.parse::
().unwrap(); + let to_address = local_evm1_token; let call = IERC20::balanceOfCall { - account: POLYGON_ACC.parse::
().unwrap(), + account: local_evm1_token_holder, }; let result = forker .alloy_call(from_address, to_address, call, false) @@ -662,16 +643,19 @@ mod tests { let polygon_balance = new_balance; // switch fork + let local_evm2 = LocalEvm::new_with_tokens(1).await; + let local_evm2_token = *local_evm2.tokens[0].address(); + let local_evm2_token_holder = local_evm2.anvil.addresses()[0]; let args = NewForkedEvm { - fork_url: BSC_FORK_URL.to_owned(), - fork_block_number: Some(BSC_FORK_NUMBER), + fork_url: local_evm2.url(), + fork_block_number: None, }; forker.add_or_select(args, None).await?; let from_address = Address::default(); - let to_address: Address = USDT_BSC.parse::
().unwrap(); + let to_address = local_evm2_token; let call = IERC20::balanceOfCall { - account: BSC_ACC.parse::
().unwrap(), + account: local_evm2_token_holder, }; let result = forker .alloy_call(from_address, to_address, call, false) @@ -679,9 +663,9 @@ mod tests { .unwrap(); let old_balance = result.typed_return._0; - let from_address = BSC_ACC.parse::
().unwrap(); - let to_address: Address = USDT_BSC.parse::
().unwrap(); - let send_amount = U256::from(0xffffffffu64); + let from_address = local_evm2_token_holder; + let to_address = local_evm2_token; + let send_amount = U256::from(0xffu64); let transfer_call = IERC20::transferCall { to: Address::repeat_byte(0x2), amount: send_amount, @@ -698,9 +682,9 @@ mod tests { .unwrap(); let from_address = Address::default(); - let to_address: Address = USDT_BSC.parse::
().unwrap(); + let to_address = local_evm2_token; let call = IERC20::balanceOfCall { - account: BSC_ACC.parse::
().unwrap(), + account: local_evm2_token_holder, }; let result = forker .alloy_call(from_address, to_address, call, false) @@ -709,17 +693,17 @@ mod tests { let new_balance = result.typed_return._0; assert_eq!(new_balance, old_balance - send_amount); - // switch fork + // switch back to fork1 let args = NewForkedEvm { - fork_url: POLYGON_FORK_URL.to_owned(), - fork_block_number: Some(POLYGON_FORK_NUMBER), + fork_url: local_evm1.url(), + fork_block_number: None, }; forker.add_or_select(args, None).await?; let from_address = Address::default(); - let to_address: Address = USDT_POLYGON.parse::
().unwrap(); + let to_address = local_evm1_token; let call = IERC20::balanceOfCall { - account: POLYGON_ACC.parse::
().unwrap(), + account: local_evm1_token_holder, }; let result = forker .alloy_call(from_address, to_address, call, false) @@ -729,9 +713,9 @@ mod tests { assert_eq!(balance, polygon_balance); // reset fork - forker.roll_fork(Some(POLYGON_FORK_NUMBER), None)?; + forker.roll_fork(None, None)?; let call = IERC20::balanceOfCall { - account: POLYGON_ACC.parse::
().unwrap(), + account: local_evm1_token_holder, }; let result = forker .alloy_call(from_address, to_address, call, false) @@ -746,35 +730,43 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_fork_rolls() { // we need to roll the fork forwards and check that the env block number is updated + let local_evm = LocalEvm::new().await; + let block_number = local_evm.provider.get_block_number().await.unwrap() - 2; let args = NewForkedEvm { - fork_url: POLYGON_FORK_URL.to_owned(), - fork_block_number: Some(POLYGON_FORK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: Some(block_number), }; let mut forker = Forker::new_with_fork(args, None, None).await.unwrap(); // check the env block number is the same as the fork block number - assert_eq!( - forker.executor.env().block.number, - U256::from(POLYGON_FORK_NUMBER) - ); + assert_eq!(forker.executor.env().block.number, U256::from(block_number)); // roll the fork forwards by 1 block - forker - .roll_fork(Some(POLYGON_FORK_NUMBER + 1), None) - .unwrap(); + forker.roll_fork(Some(block_number + 1), None).unwrap(); // check the env block number is updated assert_eq!( forker.executor.env().block.number, - U256::from(POLYGON_FORK_NUMBER + 1) + U256::from(block_number + 1) ); } #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_fork_replay() { + let local_evm = LocalEvm::new().await; + let block_number = local_evm.provider.get_block_number().await.unwrap(); + let tx_hash = local_evm + .provider + .get_block_by_number(BlockNumberOrTag::Number(block_number - 2), false) + .await + .unwrap() + .unwrap() + .transactions + .as_hashes() + .unwrap()[0]; let mut forker = Forker::new_with_fork( NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), + fork_url: local_evm.url(), fork_block_number: None, }, None, @@ -783,18 +775,9 @@ mod tests { .await .unwrap(); - let tx_hash = "0xcbfff7d9369afcc7a851dff42ca2769f32d77c3b9066023b887583ee9cd0809d" - .parse::() - .unwrap(); - let replay_result = forker.replay_transaction(tx_hash).await.unwrap(); - assert!( - replay_result.env.tx.caller - == "0x8924274F5304277FFDdd29fad5181D98D5F65eF6" - .parse::
() - .unwrap() - ); + assert!(replay_result.env.tx.caller == local_evm.anvil.addresses()[0]); assert!(replay_result.exit_reason.is_ok()); } } diff --git a/crates/eval/src/trace.rs b/crates/eval/src/trace.rs index 31c4999a..8341aff4 100644 --- a/crates/eval/src/trace.rs +++ b/crates/eval/src/trace.rs @@ -315,16 +315,15 @@ mod tests { use crate::fork::{Forker, NewForkedEvm}; use alloy::primitives::utils::parse_ether; use rain_interpreter_bindings::IInterpreterStoreV1::FullyQualifiedNamespace; - use rain_interpreter_env::{ - CI_DEPLOY_SEPOLIA_RPC_URL, CI_FORK_SEPOLIA_BLOCK_NUMBER, CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, - }; + use rain_interpreter_test_fixtures::LocalEvm; #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_fork_trace() { - let deployer_address: Address = *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS; + let local_evm = LocalEvm::new().await; + let deployer = *local_evm.deployer.address(); let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let fork = Forker::new_with_fork(args, None, None).await.unwrap(); @@ -345,7 +344,7 @@ mod tests { " .into(), source_index: 0, - deployer: deployer_address, + deployer, namespace: FullyQualifiedNamespace::default(), context: vec![], decode_errors: true, @@ -391,9 +390,11 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_search_trace_by_path() { + let local_evm = LocalEvm::new().await; + let deployer = *local_evm.deployer.address(); let args = NewForkedEvm { - fork_url: CI_DEPLOY_SEPOLIA_RPC_URL.to_string(), - fork_block_number: Some(*CI_FORK_SEPOLIA_BLOCK_NUMBER), + fork_url: local_evm.url(), + fork_block_number: None, }; let fork = Forker::new_with_fork(args, None, None).await.unwrap(); @@ -412,7 +413,7 @@ mod tests { " .into(), source_index: 0, - deployer: *CI_FORK_SEPOLIA_DEPLOYER_ADDRESS, + deployer, namespace: FullyQualifiedNamespace::default(), context: vec![], decode_errors: true, diff --git a/crates/parser/Cargo.toml b/crates/parser/Cargo.toml index 36e834c4..8c5c9197 100644 --- a/crates/parser/Cargo.toml +++ b/crates/parser/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "rain_interpreter_parser" -version = "0.1.0" -edition = "2021" -license = "CAL-1.0" description = "Rain Interpreter Parser Rust Crate." -homepage = "https://github.com/rainlanguage/rain.interpreter" +version.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true [dependencies] alloy-ethers-typecast = { workspace = true } diff --git a/crates/test_fixtures/Cargo.toml b/crates/test_fixtures/Cargo.toml new file mode 100644 index 00000000..f8c2999d --- /dev/null +++ b/crates/test_fixtures/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "rain_interpreter_test_fixtures" +version.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +publish = false + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde_json = { workspace = true } +alloy = { workspace = true, features = ["node-bindings", "sol-types", "rpc-types", "provider-http", "network", "contract", "signer-local"] } + +[target.'cfg(target_family = "wasm")'.dependencies] +getrandom = { version = "0", features = ["js", "js-sys"] } \ No newline at end of file diff --git a/crates/test_fixtures/src/lib.rs b/crates/test_fixtures/src/lib.rs new file mode 100644 index 00000000..23cb495f --- /dev/null +++ b/crates/test_fixtures/src/lib.rs @@ -0,0 +1,236 @@ +use alloy::{ + contract::CallBuilder, + network::{Ethereum, EthereumWallet}, + node_bindings::{Anvil, AnvilInstance}, + primitives::{utils::parse_units, Address, Bytes, U256}, + providers::{ + fillers::{FillProvider, JoinFill, RecommendedFiller, WalletFiller}, + Provider, ProviderBuilder, RootProvider, + }, + rpc::types::{TransactionReceipt, TransactionRequest}, + signers::local::PrivateKeySigner, + sol, + sol_types::SolCall, + transports::{ + http::{Client, Http}, + RpcError, TransportErrorKind, + }, +}; +use serde_json::value::RawValue; +use std::marker::PhantomData; + +sol!( + #![sol(all_derives = true, rpc = true)] + ERC20, "../../out/TestERC20.sol/TestERC20.json" +); + +sol!( + #![sol(all_derives = true, rpc = true)] + Interpreter, + "../../out/RainterpreterNPE2.sol/RainterpreterNPE2.json" +); + +sol!( + #![sol(all_derives = true, rpc = true)] + Store, + "../../out/RainterpreterStoreNPE2.sol/RainterpreterStoreNPE2.json" +); + +sol!( + #![sol(all_derives = true, rpc = true)] + Parser, + "../../out/RainterpreterParserNPE2.sol/RainterpreterParserNPE2.json" +); + +sol!( + #![sol(all_derives = true, rpc = true)] + Deployer, + "../../out/RainterpreterExpressionDeployerNPE2.sol/RainterpreterExpressionDeployerNPE2.json" +); + +// type aliases for LocalEvm provider type +pub type LocalEvmFillers = JoinFill>; +pub type LocalEvmProvider = + FillProvider>, Http, Ethereum>; + +/// A local evm instance that wraps an Anvil instance and provider with +/// its signers, and with rain contracts already deployed on it. +/// The first signer wallet is the main wallet that would sign any transactions +/// that dont specify a sender ('to' field) +pub struct LocalEvm { + /// The Anvil instance, ie the local blockchain + pub anvil: AnvilInstance, + + /// The alloy provider instance of this local blockchain + pub provider: LocalEvmProvider, + + /// Alloy interpreter contract instance deployed on this blockchain + pub interpreter: Interpreter::InterpreterInstance, LocalEvmProvider>, + + /// Alloy store contract instance deployed on this blockchain + pub store: Store::StoreInstance, LocalEvmProvider>, + + /// Alloy parser contract instance deployed on this blockchain + pub parser: Parser::ParserInstance, LocalEvmProvider>, + + /// Alloy expression deployer contract instance deployed on this blockchain + pub deployer: Deployer::DeployerInstance, LocalEvmProvider>, + + /// Array of alloy ERC20 contract instances deployed on this blockchain + pub tokens: Vec, LocalEvmProvider>>, + + /// All wallets of this local blockchain that can be used to perform transactions + /// the first wallet is the blockchain's default wallet, ie transactions that dont + /// explicitly specify a sender address will use this as the sender + pub signer_wallets: Vec, +} + +impl LocalEvm { + /// Instantiates this struct with rain contracts deployed and no ERC20 tokens + pub async fn new() -> Self { + let anvil = Anvil::new().try_spawn().unwrap(); + + // set up signers from anvil accounts + let mut signer_wallets = vec![]; + let mut default_signer = + EthereumWallet::from(PrivateKeySigner::from(anvil.keys()[0].clone())); + let other_signer_wallets: Vec = anvil.keys()[1..] + .iter() + .map(|v| EthereumWallet::from(PrivateKeySigner::from(v.clone()))) + .collect(); + + for s in &other_signer_wallets { + default_signer.register_signer(s.default_signer()) + } + signer_wallets.push(default_signer); + signer_wallets.extend(other_signer_wallets); + + // Create a provider with the wallet and fillers + let provider = ProviderBuilder::new() + .with_recommended_fillers() + .wallet(signer_wallets[0].clone()) + .on_http(anvil.endpoint_url()); + + // provider.wallet_mut().register_signer(signer) + + // deploy rain contracts + let interpreter = Interpreter::deploy(provider.clone()).await.unwrap(); + let store = Store::deploy(provider.clone()).await.unwrap(); + let parser = Parser::deploy(provider.clone()).await.unwrap(); + let config = Deployer::RainterpreterExpressionDeployerNPE2ConstructionConfigV2 { + interpreter: *interpreter.address(), + parser: *parser.address(), + store: *store.address(), + }; + let deployer = Deployer::deploy(provider.clone(), config).await.unwrap(); + + Self { + anvil, + provider, + interpreter, + store, + parser, + deployer, + tokens: vec![], + signer_wallets, + } + } + + /// Instantiates with number of ERC20 tokens with 18 decimals. + /// Each token after being deployed will mint 1 milion tokens to the + /// default address, which is the first signer wallet of this instance + pub async fn new_with_tokens(tokens_count: u8) -> Self { + let mut local_evm = Self::new().await; + + // deploy tokens contracts and mint 1 milion of each for the default address (first signer wallet) + for i in 1..=tokens_count { + local_evm + .deploy_new_token( + &format!("Token{}", i), + &format!("Token{}", i), + 18, + parse_units("1_000_000", 18).unwrap().into(), + local_evm.anvil.addresses()[0], + ) + .await; + } + local_evm + } + + /// Get the local rpc url of the underlying anvil instance + pub fn url(&self) -> String { + self.anvil.endpoint() + } + + /// Deploys a new ERC20 token with the given arguments + pub async fn deploy_new_token( + &mut self, + name: &str, + symbol: &str, + decimals: u8, + supply: U256, + recipient: Address, + ) -> ERC20::ERC20Instance, LocalEvmProvider> { + let token = ERC20::deploy( + self.provider.clone(), + name.to_string(), + symbol.to_string(), + decimals, + recipient, + supply, + ) + .await + .unwrap(); + self.tokens.push(token.clone()); + token + } + + /// Sends a contract write transaction to the blockchain and returns the tx receipt + pub async fn send_contract_transaction( + &self, + contract_call: CallBuilder, &LocalEvmProvider, PhantomData>, + ) -> Result>> { + self.provider + .send_transaction(contract_call.into_transaction_request()) + .await? + .get_receipt() + .await + } + + /// Sends (write call) a raw transaction request to the blockchain and returns the tx receipt + pub async fn send_transaction( + &self, + tx: TransactionRequest, + ) -> Result>> { + self.provider + .send_transaction(tx) + .await? + .get_receipt() + .await + } + + /// Calls (readonly call) contract method and returns the decoded result + pub async fn call_contract( + &self, + contract_call: CallBuilder, &LocalEvmProvider, PhantomData>, + ) -> Result< + Result, + RpcError>, + > { + Ok(T::abi_decode_returns( + &self + .provider + .call(&contract_call.into_transaction_request()) + .await?, + true, + )) + } + + /// Calls (readonly call) a raw transaction and returns the result + pub async fn call( + &self, + tx: &TransactionRequest, + ) -> Result>> { + self.provider.call(tx).await + } +} diff --git a/test/utils/TestERC20.sol b/test/utils/TestERC20.sol new file mode 100644 index 00000000..dfd880f0 --- /dev/null +++ b/test/utils/TestERC20.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: CAL +pragma solidity =0.8.25; + +import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; + +contract TestERC20 is ERC20 { + uint8 private _decimals; + + constructor(string memory name_, string memory symbol_, uint8 decimals_, address recipient_, uint256 supply_) + ERC20(name_, symbol_) + { + _decimals = decimals_; + _mint(recipient_, supply_); + } + + function decimals() public view virtual override returns (uint8) { + return _decimals; + } +}