From 46a0861ee1fa15c9d1a5a8ec4095879843c75dcf Mon Sep 17 00:00:00 2001 From: error2215 Date: Fri, 29 Mar 2024 13:35:42 +0200 Subject: [PATCH] Fix/dynamic addresses (#58) * more dynamic addresses * 1337 network as default * change HEVM_ADDRESS to HEVM_ADDRESS() * fix floating test --- Cargo.lock | 381 ++++++++++-------- cli/src/cmd/probe/create2.rs | 2 +- cli/src/cmd/probe/estimate.rs | 2 +- cli/src/cmd/spark/script/build.rs | 11 +- cli/src/cmd/spark/script/mod.rs | 13 +- cli/src/cmd/spark/script/runner.rs | 5 +- cli/src/cmd/spark/script/transaction.rs | 7 +- cli/src/cmd/spark/test/mod.rs | 16 +- cli/src/opts/wallet/mod.rs | 6 +- cli/src/opts/wallet/multi_wallet.rs | 39 +- cli/tests/fixtures/ScriptVerify.sol | 2 +- cli/tests/it/script.rs | 20 +- common/src/constants.rs | 2 +- config/README.md | 4 +- config/src/lib.rs | 18 +- docs/dev/cheatcodes.md | 2 +- evm/src/executor/abi/mod.rs | 34 +- evm/src/executor/backend/mod.rs | 39 +- evm/src/executor/inspector/cheatcodes/mod.rs | 56 +-- evm/src/executor/inspector/cheatcodes/util.rs | 42 +- evm/src/executor/inspector/debugger.rs | 6 +- evm/src/executor/inspector/logs.rs | 11 +- evm/src/executor/inspector/mod.rs | 2 +- evm/src/executor/mod.rs | 40 +- evm/src/executor/opts.rs | 9 +- evm/src/fuzz/invariant/error.rs | 6 +- evm/src/fuzz/invariant/executor.rs | 48 ++- evm/src/fuzz/invariant/mod.rs | 5 +- evm/src/lib.rs | 25 +- evm/src/trace/decoder.rs | 24 +- evm/src/trace/mod.rs | 14 +- evm/src/trace/node.rs | 12 +- pilot/src/dispatcher.rs | 2 +- pilot/src/session_source.rs | 15 +- spark/README.md | 4 +- spark/src/gas_report.rs | 33 +- spark/src/runner.rs | 8 +- spark/tests/it/config.rs | 44 +- spark/tests/it/core.rs | 6 +- spark/tests/it/fork.rs | 12 +- spark/tests/it/repros.rs | 7 +- spark/tests/it/test_helpers.rs | 8 +- testdata/cheats/Addr.t.sol | 4 +- testdata/cheats/Assume.t.sol | 2 +- testdata/cheats/Bank.t.sol | 6 +- testdata/cheats/Broadcast.t.sol | 52 +-- testdata/cheats/ChainId.t.sol | 2 +- testdata/cheats/Deal.t.sol | 2 +- testdata/cheats/Derive.t.sol | 2 +- testdata/cheats/Env.t.sol | 116 +++--- testdata/cheats/Etch.t.sol | 2 +- testdata/cheats/ExpectCall.t.sol | 6 +- testdata/cheats/ExpectEmit.t.sol | 2 +- testdata/cheats/ExpectRevert.t.sol | 2 +- testdata/cheats/Ffi.t.sol | 2 +- testdata/cheats/Fork.t.sol | 2 +- testdata/cheats/Fork2.t.sol | 26 +- testdata/cheats/Fs.t.sol | 2 +- testdata/cheats/GasMetering.t.sol | 2 +- testdata/cheats/GetCode.t.sol | 2 +- testdata/cheats/GetDeployedCode.t.sol | 4 +- testdata/cheats/GetLabel.t.sol | 2 +- testdata/cheats/GetNonce.t.sol | 2 +- testdata/cheats/Json.t.sol | 12 +- testdata/cheats/Label.t.sol | 2 +- testdata/cheats/Load.t.sol | 2 +- testdata/cheats/Mapping.t.sol | 2 +- testdata/cheats/MemSafety.t.sol | 2 +- testdata/cheats/MockCall.t.sol | 4 +- testdata/cheats/Parse.t.sol | 8 +- testdata/cheats/Prank.t.sol | 4 +- testdata/cheats/ProjectRoot.t.sol | 2 +- testdata/cheats/ReadCallers.t.sol | 2 +- testdata/cheats/Record.t.sol | 2 +- testdata/cheats/RecordLogs.t.sol | 2 +- testdata/cheats/Remember.t.sol | 4 +- testdata/cheats/ResetNonce.t.sol | 2 +- testdata/cheats/Roll.t.sol | 2 +- testdata/cheats/RpcUrls.t.sol | 2 +- testdata/cheats/SetNonce.t.sol | 2 +- testdata/cheats/SetNonceUnsafe.t.sol | 2 +- testdata/cheats/Setup.t.sol | 2 +- testdata/cheats/Sign.t.sol | 2 +- testdata/cheats/Skip.t.sol | 2 +- testdata/cheats/Snapshots.t.sol | 2 +- testdata/cheats/Store.t.sol | 2 +- testdata/cheats/ToString.t.sol | 6 +- testdata/cheats/Travel.t.sol | 2 +- testdata/cheats/Warp.t.sol | 2 +- testdata/core/ContractEnvironment.t.sol | 11 +- testdata/core/PaymentFailure.t.sol | 2 +- testdata/fixtures/broadcast.log.json | 12 +- testdata/fork/ForkSame_1.t.sol | 2 +- testdata/fork/ForkSame_2.t.sol | 2 +- testdata/fork/LaunchFork.t.sol | 4 +- testdata/fork/Transact.t.sol | 2 +- testdata/foundry.toml | 6 +- testdata/fs/Default.t.sol | 2 +- testdata/fs/Disabled.t.sol | 2 +- testdata/fuzz/Fuzz.t.sol | 2 +- testdata/fuzz/FuzzCollection.t.sol | 4 +- .../storage/InvariantStorageTest.t.sol | 6 +- testdata/lib/ds-test/src/checksum.sol | 41 ++ testdata/lib/ds-test/src/test.sol | 19 +- testdata/logs/HardhatLogs.t.sol | 2 +- testdata/logs/console.sol | 6 +- testdata/repros/Issue2623.t.sol | 2 +- testdata/repros/Issue2629.t.sol | 2 +- testdata/repros/Issue2723.t.sol | 2 +- testdata/repros/Issue2898.t.sol | 7 +- testdata/repros/Issue2956.t.sol | 2 +- testdata/repros/Issue2984.t.sol | 2 +- testdata/repros/Issue3055.t.sol | 2 +- testdata/repros/Issue3077.t.sol | 2 +- testdata/repros/Issue3110.t.sol | 2 +- testdata/repros/Issue3119.t.sol | 2 +- testdata/repros/Issue3190.t.sol | 2 +- testdata/repros/Issue3192.t.sol | 2 +- testdata/repros/Issue3220.t.sol | 2 +- testdata/repros/Issue3221.sol | 2 +- testdata/repros/Issue3223.sol | 2 +- testdata/repros/Issue3596.t.sol | 2 +- testdata/repros/Issue3653.t.sol | 2 +- testdata/repros/Issue3674.t.sol | 2 +- testdata/repros/Issue3685.t.sol | 2 +- testdata/repros/Issue3703.t.sol | 2 +- testdata/repros/Issue3708.sol | 2 +- testdata/repros/Issue3753.t.sol | 2 +- testdata/repros/Issue4586.t.sol | 8 +- testdata/repros/Issue4630.t.sol | 2 +- testdata/repros/Issue4640.t.sol | 2 +- testdata/repros/Issue5038.t.sol | 2 +- .../deploy.sol/31337/run-latest.json | 6 +- testdata/script/deploy.sol | 2 +- testdata/trace/Trace.t.sol | 2 +- utils/src/lib.rs | 2 +- 136 files changed, 890 insertions(+), 672 deletions(-) create mode 100644 testdata/lib/ds-test/src/checksum.sol diff --git a/Cargo.lock b/Cargo.lock index 3262fa44..3fb3cfb0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,9 +51,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -164,9 +164,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "ariadne" @@ -328,24 +328,24 @@ dependencies = [ [[package]] name = "async-recursion" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -393,7 +393,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -456,9 +456,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "95d8e92cac0961e91dbd517496b00f7e9b92363dbe6d42c3198268323798860c" dependencies = [ "addr2line", "cc", @@ -528,9 +528,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitvec" @@ -565,9 +565,9 @@ dependencies = [ [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "sha2 0.10.8", "tinyvec", @@ -580,7 +580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "serde", ] @@ -601,9 +601,9 @@ checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" [[package]] name = "bumpalo" -version = "3.15.3" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "byte-slice-cast" @@ -613,9 +613,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.14.3" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] name = "byteorder" @@ -664,9 +664,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -699,10 +699,11 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.88" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" dependencies = [ + "jobserver", "libc", ] @@ -712,11 +713,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -778,9 +785,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.1" +version = "4.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "949626d00e063efc93b6dca932419ceb5432f99769911c0b995f7e884c778813" dependencies = [ "clap_builder", "clap_derive", @@ -788,9 +795,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", @@ -807,7 +814,7 @@ version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", ] [[package]] @@ -816,20 +823,20 @@ version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54b3e65f91fabdd23cac3d57d39d5d938b4daabd070c335c006dccb866a61110" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "clap_complete", ] [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "90239a040c80f5e14809ca132ddc4176ab33d5e17e49691793296e3fcb34d72f" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -952,9 +959,9 @@ dependencies = [ [[package]] name = "color-eyre" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" +checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" dependencies = [ "backtrace", "color-spantrace", @@ -1134,7 +1141,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.52", + "syn 2.0.53", "tokio", "toml 0.7.8", "url", @@ -1153,7 +1160,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1178,7 +1185,7 @@ dependencies = [ "serde", "serde_json", "strum 0.24.1", - "syn 2.0.52", + "syn 2.0.53", "tempfile", "thiserror", "tiny-keccak", @@ -1554,11 +1561,11 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.4.2" +version = "3.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b467862cc8610ca6fc9a1532d7777cee0804e678ab45410897b9396495994a0b" +checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345" dependencies = [ - "nix 0.27.1", + "nix 0.28.0", "windows-sys 0.52.0", ] @@ -1910,7 +1917,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1925,9 +1932,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c012a26a7f605efc424dd53697843a72be7dc86ad2d01f7814337794a12231d" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" dependencies = [ "anstream", "anstyle", @@ -2073,7 +2080,7 @@ dependencies = [ "bytes", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2118,16 +2125,16 @@ dependencies = [ [[package]] name = "figment" -version = "0.10.14" +version = "0.10.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6e5bc7bd59d60d0d45a6ccab6cf0f4ce28698fb4e81e750ddf229c9b824026" +checksum = "7270677e7067213e04f323b55084586195f18308cd7546cfac9f873344ccceb6" dependencies = [ "atomic", "parking_lot", "pear", "serde", "tempfile", - "toml 0.8.10", + "toml 0.8.12", "uncased", "version_check", ] @@ -2223,7 +2230,7 @@ dependencies = [ "corebc-providers", "eyre", "foxar-macros", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2247,7 +2254,7 @@ version = "0.2.0" dependencies = [ "async-trait", "bytes", - "clap 4.5.1", + "clap 4.5.3", "clap_complete", "clap_complete_fig", "color-eyre", @@ -2335,7 +2342,7 @@ name = "foxar-common" version = "0.1.0" dependencies = [ "auto_impl", - "clap 4.5.1", + "clap 4.5.3", "comfy-table", "corebc-blockindex", "corebc-core", @@ -2443,7 +2450,7 @@ version = "0.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2583,7 +2590,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2731,7 +2738,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e874f41437441c02991dcea76990b9058fadfc54b02ab4dd06ab2218af43897" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bstr", "gix-path", "libc", @@ -2777,7 +2784,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07c98204529ac3f24b34754540a852593d2a4c7349008df389240266627a72a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bstr", "gix-features", "gix-path", @@ -2862,7 +2869,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9615cbd6b456898aeb942cd75e5810c382fbfc48dbbff2fa23ebd2d33dcbe9c7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gix-path", "libc", "windows", @@ -2883,15 +2890,15 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" +checksum = "9b838b2db8f62c9447d483a4c28d251b67fee32741a82cb4d35e9eb4e9fdc5ab" [[package]] name = "gix-utils" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60157a15b9f14b11af1c6817ad7a93b10b50b4e5136d98a127c46a37ff16eeb6" +checksum = "0066432d4c277f9877f091279a597ea5331f68ca410efc874f0bdfb1cd348f92" dependencies = [ "fastrand", "unicode-normalization", @@ -2922,7 +2929,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -2962,9 +2969,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", @@ -3033,7 +3040,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.11", "serde", ] @@ -3082,6 +3089,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -3168,9 +3181,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -3321,7 +3334,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "same-file", "walkdir", "winapi-util", @@ -3504,11 +3517,20 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +[[package]] +name = "jobserver" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -3682,7 +3704,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall", ] @@ -3701,9 +3723,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.15" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" +checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" dependencies = [ "cc", "libc", @@ -3810,7 +3832,7 @@ dependencies = [ "ammonia", "anyhow", "chrono", - "clap 4.5.1", + "clap 4.5.3", "clap_complete", "elasticlunr-rs", "env_logger", @@ -3884,7 +3906,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -3950,9 +3972,9 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nibble_vec" @@ -3978,12 +4000,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", + "cfg_aliases", "libc", ] @@ -4150,7 +4173,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4235,7 +4258,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -4252,7 +4275,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4441,25 +4464,25 @@ dependencies = [ [[package]] name = "pear" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccca0f6c17acc81df8e242ed473ec144cbf5c98037e69aa6d144780aad103c8" +checksum = "bdeeaa00ce488657faba8ebf44ab9361f9365a97bd39ffb8a60663f57ff4b467" dependencies = [ "inlinable_string", "pear_codegen", - "yansi 1.0.0-rc.1", + "yansi 1.0.1", ] [[package]] name = "pear_codegen" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e22670e8eb757cff11d6c199ca7b987f352f0346e0be4dd23869ec72cb53c77" +checksum = "4bab5b985dc082b345f812b7df84e1bef27e7207b39e448439ba8bd69c93f147" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4499,7 +4522,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4602,7 +4625,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4628,7 +4651,7 @@ name = "pilot" version = "0.1.1" dependencies = [ "bytes", - "clap 4.5.1", + "clap 4.5.3", "corebc", "corebc-ylem", "criterion", @@ -4659,22 +4682,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4774,7 +4797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4852,9 +4875,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -4867,9 +4890,9 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "version_check", - "yansi 1.0.0-rc.1", + "yansi 1.0.1", ] [[package]] @@ -4891,7 +4914,7 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "lazy_static", "num-traits", "rand 0.8.5", @@ -4915,7 +4938,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dce76ce678ffc8e5675b22aa1405de0b7037e2fdf8913fea40d1926c6fe1e6e7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "memchr", "pulldown-cmark-escape", "unicase", @@ -5100,7 +5123,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -5115,9 +5138,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -5138,9 +5161,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", "bytes", @@ -5184,7 +5207,7 @@ dependencies = [ [[package]] name = "revm" version = "3.0.0" -source = "git+https://github.com/core-coin/cvm.git#5ce134ffdc76b02ae5dde2b600340ebc9eb6bb20" +source = "git+https://github.com/core-coin/cvm.git#54f7eec7b9efa4add3de17bfbe0cf84a3bdeb366" dependencies = [ "auto_impl", "revm-interpreter", @@ -5196,7 +5219,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.0.0" -source = "git+https://github.com/core-coin/cvm.git#5ce134ffdc76b02ae5dde2b600340ebc9eb6bb20" +source = "git+https://github.com/core-coin/cvm.git#54f7eec7b9efa4add3de17bfbe0cf84a3bdeb366" dependencies = [ "derive_more", "enumn", @@ -5208,7 +5231,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.0" -source = "git+https://github.com/core-coin/cvm.git#5ce134ffdc76b02ae5dde2b600340ebc9eb6bb20" +source = "git+https://github.com/core-coin/cvm.git#54f7eec7b9efa4add3de17bfbe0cf84a3bdeb366" dependencies = [ "k256 0.11.6", "libgoldilocks", @@ -5224,7 +5247,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.0.0" -source = "git+https://github.com/core-coin/cvm.git#5ce134ffdc76b02ae5dde2b600340ebc9eb6bb20" +source = "git+https://github.com/core-coin/cvm.git#54f7eec7b9efa4add3de17bfbe0cf84a3bdeb366" dependencies = [ "auto_impl", "bitvec", @@ -5356,9 +5379,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b1d9521f889713d1221270fdd63370feca7e5c71a18745343402fa86e4f04f" +checksum = "8f308135fef9fc398342da5472ce7c484529df23743fb7c734e0f3d472971e62" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -5509,11 +5532,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -5642,9 +5665,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +checksum = "2ef2175c2907e7c8bc0a9c3f86aeb5ec1f3b275300ad58a44d0c3ae379a5e52e" dependencies = [ "cfg-if", "derive_more", @@ -5654,9 +5677,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" +checksum = "634d9b8eb8fd61c5cdd3390d9b2132300a7e7618955b98b8416f118c1b4e144f" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -5813,7 +5836,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -5830,9 +5853,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" dependencies = [ "itoa", "serde", @@ -5891,7 +5914,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -5975,7 +5998,7 @@ dependencies = [ "axum", "bytes", "chrono", - "clap 4.5.1", + "clap 4.5.3", "clap_complete", "clap_complete_fig", "corebc", @@ -6049,7 +6072,7 @@ dependencies = [ "async-trait", "axum", "bytes", - "clap 4.5.1", + "clap 4.5.3", "futures", "hyper", "parity-tokio-ipc", @@ -6137,9 +6160,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -6212,7 +6235,7 @@ name = "spark-doc" version = "0.1.0" dependencies = [ "auto_impl", - "clap 4.5.1", + "clap 4.5.3", "corebc-core", "corebc-ylem", "derive_more", @@ -6349,7 +6372,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -6362,11 +6385,11 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6401,9 +6424,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" dependencies = [ "proc-macro2", "quote", @@ -6520,22 +6543,22 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6642,7 +6665,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6678,9 +6701,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -6742,14 +6765,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.6", + "toml_edit 0.22.9", ] [[package]] @@ -6787,9 +6810,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ "indexmap 2.2.5", "serde", @@ -6826,7 +6849,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytes", "futures-core", "futures-util", @@ -6871,7 +6894,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7175,9 +7198,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom 0.2.12", "serde", @@ -7285,9 +7308,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -7295,24 +7318,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -7322,9 +7345,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7332,22 +7355,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "watchexec" @@ -7399,9 +7422,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -7752,9 +7775,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "yansi" -version = "1.0.0-rc.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "yvm-rs" @@ -7804,7 +7827,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7824,7 +7847,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] diff --git a/cli/src/cmd/probe/create2.rs b/cli/src/cmd/probe/create2.rs index 40084471..9c3cdd90 100644 --- a/cli/src/cmd/probe/create2.rs +++ b/cli/src/cmd/probe/create2.rs @@ -40,7 +40,7 @@ pub struct Create2Args { #[clap( short, long, - default_value = "cb063edadf999cb7b8b3ebc71f5e97783176d289d640", + default_value = "cb063edadf999cb7b8b3ebc71f5e97783176d289d640", //todo:error2215 change to ce address value_name = "ADDRESS" )] deployer: Address, diff --git a/cli/src/cmd/probe/estimate.rs b/cli/src/cmd/probe/estimate.rs index a4124721..eeb976ac 100644 --- a/cli/src/cmd/probe/estimate.rs +++ b/cli/src/cmd/probe/estimate.rs @@ -28,7 +28,7 @@ pub struct EstimateArgs { short, long, value_parser = NameOrAddress::from_str, - default_value = "0xcb656dadee521bea601692312454a655a0f49051ddc9", + default_value = "0xcb656dadee521bea601692312454a655a0f49051ddc9", //todo:error2215 change to ce address env = "ETH_FROM", )] from: NameOrAddress, diff --git a/cli/src/cmd/spark/script/build.rs b/cli/src/cmd/spark/script/build.rs index 7a0bf210..b021b73e 100644 --- a/cli/src/cmd/spark/script/build.rs +++ b/cli/src/cmd/spark/script/build.rs @@ -16,7 +16,7 @@ use eyre::{Context, ContextCompat}; use foxar_common::compile; use foxar_utils::PostLinkInput; use std::{collections::BTreeMap, fs, str::FromStr}; -use tracing::{trace, warn}; +use tracing::{info, trace, warn}; impl ScriptArgs { /// Compiles the file or project and the verify metadata. @@ -110,11 +110,12 @@ impl ScriptArgs { } } - if self.evm_opts.env.network_id.is_none() { - eyre::bail!("Network is not provided. Please specify the network with `--network {{network_id}}`") + let mut network = Network::Private(1337); + if self.evm_opts.env.network_id.is_some() { + network = self.evm_opts.env.network_id.unwrap(); + } else { + info!("Running script in simulation mode with network id 1337"); }; - let network_config = self.evm_opts.env.network_id.unwrap(); - let network = network_config; foxar_utils::link_with_nonce_or_address( contracts.clone(), diff --git a/cli/src/cmd/spark/script/mod.rs b/cli/src/cmd/spark/script/mod.rs index cec7a251..649c714b 100644 --- a/cli/src/cmd/spark/script/mod.rs +++ b/cli/src/cmd/spark/script/mod.rs @@ -25,10 +25,7 @@ use foxar_common::{ use foxar_config::{figment, Config}; use probe::{ decode, - executor::inspector::{ - cheatcodes::{util::BroadcastableTransactions, BroadcastableTransaction}, - DEFAULT_CREATE2_DEPLOYER, - }, + executor::inspector::cheatcodes::{util::{default_create2_address, BroadcastableTransactions}, BroadcastableTransaction}, }; use spark::{ debug::DebugArena, @@ -209,7 +206,7 @@ impl ScriptArgs { let mut local_identifier = LocalTraceIdentifier::new(known_contracts); let mut decoder = CallTraceDecoderBuilder::new( - &script_config.evm_opts.get_remote_chain_id().unwrap_or(Network::Mainnet), + &script_config.evm_opts.get_remote_chain_id().unwrap_or(Network::Private(1337)), ) .with_labels(result.labeled_addresses.clone()) .with_verbosity(verbosity) @@ -573,7 +570,7 @@ impl ScriptArgs { // Find if it's a CREATE or CREATE2. Otherwise, skip transaction. if let Some(NameOrAddress::Address(to)) = to { - if *to == DEFAULT_CREATE2_DEPLOYER { + if *to == default_create2_address(self.evm_opts.env.network_id) { // Size of the salt prefix. offset = 32; } @@ -599,8 +596,8 @@ impl ScriptArgs { } } - if prompt_user && - !Confirm::new().with_prompt("Do you wish to continue?".to_string()).interact()? + if prompt_user + && !Confirm::new().with_prompt("Do you wish to continue?".to_string()).interact()? { eyre::bail!("User canceled the script."); } diff --git a/cli/src/cmd/spark/script/runner.rs b/cli/src/cmd/spark/script/runner.rs index 78cb72aa..53314599 100644 --- a/cli/src/cmd/spark/script/runner.rs +++ b/cli/src/cmd/spark/script/runner.rs @@ -1,7 +1,6 @@ use super::*; use corebc::types::{Address, Bytes, NameOrAddress, Network, U256}; use spark::{ - default_caller, executor::{CallResult, DeployResult, EvmError, ExecutionErr, Executor, RawCallResult}, revm::interpreter::{return_ok, InstructionResult}, trace::{TraceKind, Traces}, @@ -56,7 +55,7 @@ impl ScriptRunner { // We max out their balance so that they can deploy and make calls. self.executor.set_balance( - default_caller(&Network::from(self.executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(self.executor.env().cfg.network_id))), U256::MAX, )?; @@ -84,7 +83,7 @@ impl ScriptRunner { } = self .executor .deploy( - default_caller(&Network::from(self.executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(self.executor.env().cfg.network_id))), code.0, 0u32.into(), None, diff --git a/cli/src/cmd/spark/script/transaction.rs b/cli/src/cmd/spark/script/transaction.rs index 07905841..bca896ac 100644 --- a/cli/src/cmd/spark/script/transaction.rs +++ b/cli/src/cmd/spark/script/transaction.rs @@ -8,7 +8,10 @@ use corebc::{ }; use eyre::{ContextCompat, WrapErr}; use foxar_common::{abi::format_token_raw, RpcUrl, SELECTOR_LEN}; -use probe::{executor::inspector::DEFAULT_CREATE2_DEPLOYER, trace::CallTraceDecoder, CallKind}; +use probe::{ + executor::inspector::cheatcodes::util::default_create2_address, trace::CallTraceDecoder, + CallKind, +}; use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; use tracing::error; @@ -77,7 +80,7 @@ impl TransactionWithMetadata { // Specify if any contract was directly created with this transaction if let Some(NameOrAddress::Address(to)) = metadata.transaction.to().cloned() { - if to == DEFAULT_CREATE2_DEPLOYER { + if to == default_create2_address(Some(*network)) { let address = to_ican(&H160::from_slice(&result.returned), network); metadata.set_create(true, address, local_contracts, decoder)?; } else { diff --git a/cli/src/cmd/spark/test/mod.rs b/cli/src/cmd/spark/test/mod.rs index b2b8e828..ad3fa3a4 100644 --- a/cli/src/cmd/spark/test/mod.rs +++ b/cli/src/cmd/spark/test/mod.rs @@ -140,8 +140,8 @@ impl TestArgs { let mut project = config.project()?; // install missing dependencies - if install::install_missing_dependencies(&mut config, self.build_args().silent) && - config.auto_detect_remappings + if install::install_missing_dependencies(&mut config, self.build_args().silent) + && config.auto_detect_remappings { // need to re-configure here to also catch additional remappings config = self.load_config(); @@ -597,7 +597,7 @@ async fn test( if !result.traces.is_empty() { // Identify addresses in each trace let mut decoder = CallTraceDecoderBuilder::new( - &config.network_id.unwrap_or(Network::Mainnet), + &config.network_id.unwrap_or(Network::Private(1337)), ) .with_labels(result.labeled_addresses.clone()) .with_events(local_identifier.events().cloned()) @@ -621,12 +621,12 @@ async fn test( // tests At verbosity level 5, we display // all traces for all tests TraceKind::Setup => { - (verbosity >= 5) || - (verbosity == 4 && result.status == TestStatus::Failure) + (verbosity >= 5) + || (verbosity == 4 && result.status == TestStatus::Failure) } TraceKind::Execution => { - verbosity > 3 || - (verbosity == 3 && result.status == TestStatus::Failure) + verbosity > 3 + || (verbosity == 3 && result.status == TestStatus::Failure) } _ => false, }; @@ -648,7 +648,7 @@ async fn test( } if gas_reporting { - gas_report.analyze(&result.traces); + gas_report.analyze(&result.traces, config.network_id); } } } diff --git a/cli/src/opts/wallet/mod.rs b/cli/src/opts/wallet/mod.rs index dff9223e..9c36ae98 100644 --- a/cli/src/opts/wallet/mod.rs +++ b/cli/src/opts/wallet/mod.rs @@ -267,7 +267,7 @@ pub trait WalletTrait { let private_key = private_key.strip_prefix("0x").unwrap_or(&private_key); let mut wallet = LocalWallet::from_str(private_key)?; - wallet = wallet.with_network_id(self.network().unwrap_or(Network::Mainnet)); + wallet = wallet.with_network_id(self.network().unwrap_or(Network::Private(1337))); Ok(wallet) } @@ -276,7 +276,7 @@ pub trait WalletTrait { fn get_from_private_key(&self, private_key: &str) -> Result { let privk = private_key.trim().strip_prefix("0x").unwrap_or(private_key); match LocalWallet::from_str(privk) { - Ok(pk) => Ok(pk.with_network_id(self.network().unwrap_or(Network::Mainnet))), + Ok(pk) => Ok(pk.with_network_id(self.network().unwrap_or(Network::Private(1337)))), Err(err) => { // helper closure to check if pk was meant to be an env var, this usually happens if // `$` is missing @@ -354,7 +354,7 @@ pub trait WalletTrait { keystore_password: Option<&String>, keystore_password_file: Option<&String>, ) -> Result> { - let network = self.network().unwrap_or(Network::Mainnet); + let network = self.network().unwrap_or(Network::Private(1337)); Ok(match (keystore_path, keystore_password, keystore_password_file) { (Some(path), Some(password), _) => { diff --git a/cli/src/opts/wallet/multi_wallet.rs b/cli/src/opts/wallet/multi_wallet.rs index 22ab04c4..d33aa8f7 100644 --- a/cli/src/opts/wallet/multi_wallet.rs +++ b/cli/src/opts/wallet/multi_wallet.rs @@ -250,9 +250,9 @@ impl MultiWallet { let mut error_msg = String::new(); // This is an actual used address - if addresses - .contains(&Config::default_sender(Some(&self.network().unwrap_or(Network::Mainnet)))) - { + if addresses.contains(&Config::default_sender(Some( + &self.network().unwrap_or(Network::Private(1337)), + ))) { error_msg += "\nYou seem to be using Foxar's default sender. Be sure to set your own --sender.\n"; } @@ -458,6 +458,39 @@ mod tests { Some(vec![keystore_password_file.to_str().unwrap().to_string()]) ); + let wallets = args.keystores().unwrap().unwrap(); + assert_eq!(wallets.len(), 1); + assert_eq!( + wallets[0].address(), + "ce56e49851f010cd7d81b5b4969f3b0e8325c415359d".parse().unwrap() + ); + } + + #[test] + fn parse_keystore_password_file_mainnet() { + let keystore = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/keystore"); + let keystore_file = keystore.join( + "UTC--2023-11-17T08-49-29.100000000Z--cb65e49851f010cd7d81b5b4969f3b0e8325c415359d", + ); + + let keystore_password_file = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("tests/fixtures/keystore/password-ec554") + .into_os_string(); + + let args: MultiWallet = MultiWallet::parse_from([ + "foxar-cli", + "--keystores", + keystore_file.to_str().unwrap(), + "--password-file", + keystore_password_file.to_str().unwrap(), + "--wallet-network", + "1", + ]); + assert_eq!( + args.keystore_password_files, + Some(vec![keystore_password_file.to_str().unwrap().to_string()]) + ); + let wallets = args.keystores().unwrap().unwrap(); assert_eq!(wallets.len(), 1); assert_eq!( diff --git a/cli/tests/fixtures/ScriptVerify.sol b/cli/tests/fixtures/ScriptVerify.sol index e9237819..e6d7b0f4 100644 --- a/cli/tests/fixtures/ScriptVerify.sol +++ b/cli/tests/fixtures/ScriptVerify.sol @@ -63,7 +63,7 @@ contract InnerContracts is Unique { contract ScriptVerify { function run() public { - address vm = address(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); + address vm = address(0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); HEVM(vm).startBroadcast(); new Hello(); InnerContracts contracts = new InnerContracts(1); diff --git a/cli/tests/it/script.rs b/cli/tests/it/script.rs index b3359e2d..6ef672b8 100644 --- a/cli/tests/it/script.rs +++ b/cli/tests/it/script.rs @@ -1072,38 +1072,38 @@ contract ScriptTxOrigin is Script { ContractB contractB = new ContractB(); contractA.test(address(contractB)); - contractB.method(0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + contractB.method(0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); - require(tx.origin == 0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38); + require(tx.origin == 0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38); vm.stopBroadcast(); } } contract ContractA { function test(address _contractB) public { - require(msg.sender == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); - require(tx.origin == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + require(msg.sender == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); + require(tx.origin == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); ContractB contractB = ContractB(_contractB); ContractC contractC = new ContractC(); - require(msg.sender == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); - require(tx.origin == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + require(msg.sender == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); + require(tx.origin == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); contractB.method(address(this)); contractC.method(address(this)); - require(msg.sender == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); - require(tx.origin == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + require(msg.sender == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); + require(tx.origin == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); } } contract ContractB { function method(address sender) public view { require(msg.sender == sender); - require(tx.origin == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + require(tx.origin == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); } } contract ContractC { function method(address sender) public view { require(msg.sender == sender); - require(tx.origin == 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + require(tx.origin == 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); } } "#, diff --git a/common/src/constants.rs b/common/src/constants.rs index dbabdf25..cbc65b25 100644 --- a/common/src/constants.rs +++ b/common/src/constants.rs @@ -3,7 +3,7 @@ use std::time::Duration; /// The dev chain-id, inherited from hardhat -pub const DEV_CHAIN_ID: u64 = 1; +pub const DEV_CHAIN_ID: u64 = 1337; /// The first four bytes of the call data for a function call specifies the function to be called. pub const SELECTOR_LEN: usize = 4; diff --git a/config/README.md b/config/README.md index be05ac59..876b5fbd 100644 --- a/config/README.md +++ b/config/README.md @@ -114,8 +114,8 @@ match_path = "*/Foo*" no_match_path = "*/Bar*" ffi = false # These are the default callers, generated using `address(uint160(uint256(keccak256("foxar default caller"))))` -sender = '0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38' -tx_origin = '0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38' +sender = '0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38' +tx_origin = '0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38' initial_balance = '0xffffffffffffffffffffffff' block_number = 0 fork_block_number = 0 diff --git a/config/src/lib.rs b/config/src/lib.rs index eb582673..a2824488 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -414,7 +414,7 @@ impl Config { /// Default address for tx.origin pub fn default_sender(mut network: Option<&Network>) -> H176 { if network.is_none() { - network = Some(&Network::Mainnet) + network = Some(&Network::Private(1337)) } to_ican(&Self::DEFAULT_SENDER, network.unwrap()) } @@ -422,7 +422,7 @@ impl Config { /// Returns address for tx.origin /// Depending on network has different prefix and checksum pub fn sender(&self) -> H176 { - if self.sender == Self::default_sender(None) && self.network_id != Some(Network::Mainnet) { + if self.sender == Self::default_sender(None) && self.network_id != Some(Network::Private(1337)) && self.network_id != None { return to_ican(&Self::DEFAULT_SENDER, &self.network_id.unwrap()); } self.sender @@ -431,7 +431,7 @@ impl Config { /// Default address for block.coinbase pub fn default_block_coinbase(mut network: Option<&Network>) -> H176 { if network.is_none() { - network = Some(&Network::Mainnet) + network = Some(&Network::Private(1337)) } to_ican(&Self::DEFAULT_COINBASE, network.unwrap()) } @@ -439,7 +439,7 @@ impl Config { /// Depending on network has different prefix and checksum pub fn block_coinbase(&self) -> H176 { if self.block_coinbase == Self::default_block_coinbase(None) - && self.network_id != Some(Network::Mainnet) + && self.network_id != Some(Network::Private(1337)) && self.network_id != None { return to_ican(&Self::DEFAULT_COINBASE, &self.network_id.unwrap()); } @@ -1796,11 +1796,11 @@ impl Default for Config { initial_balance: U256::from(0xffffffffffffffffffffffffu128), block_number: 1, fork_block_number: None, - network_id: Some(Network::Mainnet), + network_id: Some(Network::Private(1337)), energy_limit: i64::MAX.into(), code_size_limit: None, energy_price: None, - block_coinbase: Config::default_block_coinbase(None), + block_coinbase: Config::default_block_coinbase(None), //todo:error2215 change to ce address block_timestamp: 1, block_difficulty: 0, block_energy_limit: None, @@ -2531,7 +2531,7 @@ mod tests { fn default_sender() { assert_eq!( Config::default_sender(None), - "cb681804c8ab1f12e6bbf3894d4083f33e07309d1f38".parse().unwrap() + "ce591804c8ab1f12e6bbf3894d4083f33e07309d1f38".parse().unwrap() ); let mut config = Config::default(); @@ -2541,10 +2541,10 @@ mod tests { "ab861804c8ab1f12e6bbf3894d4083f33e07309d1f38".parse().unwrap() ); - config.network_id = Some(Network::Private(5)); + config.network_id = Some(Network::Mainnet); assert_eq!( config.sender(), - "ce591804c8ab1f12e6bbf3894d4083f33e07309d1f38".parse().unwrap() + "cb681804c8ab1f12e6bbf3894d4083f33e07309d1f38".parse().unwrap() ); } diff --git a/docs/dev/cheatcodes.md b/docs/dev/cheatcodes.md index eab81047..39efb87f 100644 --- a/docs/dev/cheatcodes.md +++ b/docs/dev/cheatcodes.md @@ -40,7 +40,7 @@ In solidity cheat codes are calls to a specific address, the cheat code handler `address(uint160(uint256(keccak256('hevm cheat code'))))`: cb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8 -which can be initialized like `Cheats constant cheats = Cheats(cb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8);`, when +which can be initialized like `Cheats immutable cheats = Cheats(cb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8);`, when inheriting from `forge-std/Test.sol` it can be accessed via `vm.` directly. Since cheat codes are bound to a constant address, the cheat code inspector listens for that address: diff --git a/evm/src/executor/abi/mod.rs b/evm/src/executor/abi/mod.rs index d37c4afe..a9ad261d 100644 --- a/evm/src/executor/abi/mod.rs +++ b/evm/src/executor/abi/mod.rs @@ -1,4 +1,7 @@ -use corebc::types::{Address, Selector, H176}; +use corebc::{ + types::{Network, Selector, H160, H176}, + utils::to_ican, +}; use once_cell::sync::Lazy; use std::collections::HashMap; @@ -8,24 +11,39 @@ pub use foxar_abi::{ hevm::{self, HEVMCalls, HEVM_ABI}, }; -/// The cheatcode handler address (0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8). +/// The cheatcode handler address (0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8). /// /// This is the same address as the one used in DappTools's HEVM. /// `address(bytes20(uint160(uint256(sha3('hevm cheat code')))))` /// cb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8 CORETODO: Change this -pub const CHEATCODE_ADDRESS: Address = H176([ - 0xcb, 0x69, 0xfc, 0x06, 0xa1, 0x2b, 0x7a, 0x6f, 0x30, 0xe2, 0xa3, 0xc1, 0x6a, 0x3b, 0x5d, 0x50, - 0x2c, 0xd7, 0x1c, 0x20, 0xf2, 0xf8, +pub const CHEATCODE_ADDRESS: H160 = H160([ + 0xfc, 0x06, 0xa1, 0x2b, 0x7a, 0x6f, 0x30, 0xe2, 0xa3, 0xc1, 0x6a, 0x3b, 0x5d, 0x50, 0x2c, 0xd7, + 0x1c, 0x20, 0xf2, 0xf8, ]); +/// Default cheatcode address +pub fn default_cheatcode_address(mut network: Option) -> H176 { + if network.is_none() { + network = Some(Network::Private(1337)) //todo:error2215 change to ce address + } + to_ican(&CHEATCODE_ADDRESS, &network.unwrap()) +} + /// The Hardhat console address (0xcb82000000000000000000636f6e736f6c652e6c6f67). /// /// See: https://github.com/nomiclabs/hardhat/blob/master/packages/hardhat-core/console.sol -pub const HARDHAT_CONSOLE_ADDRESS: Address = H176([ - 0xcb, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x73, 0x6f, - 0x6c, 0x65, 0x2e, 0x6c, 0x6f, 0x67, +pub const HARDHAT_CONSOLE_ADDRESS: H160 = H160([ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, + 0x2e, 0x6c, 0x6f, 0x67, ]); +/// Default hardhat console address +pub fn default_hardhat_address(mut network: Option) -> H176 { + if network.is_none() { + network = Some(Network::Private(1337)) //todo:error2215 change to ce address + } + to_ican(&HARDHAT_CONSOLE_ADDRESS, &network.unwrap()) +} /// If the input starts with a known `hardhat/console.log` `uint` selector, then this will replace /// it with the selector `abigen!` bindings expect. pub fn patch_hardhat_console_selector(input: &mut [u8]) { diff --git a/evm/src/executor/backend/mod.rs b/evm/src/executor/backend/mod.rs index 485cfc0e..0fe3f811 100644 --- a/evm/src/executor/backend/mod.rs +++ b/evm/src/executor/backend/mod.rs @@ -1,20 +1,20 @@ use crate::{ - abi::CHEATCODE_ADDRESS, - default_caller, + abi::default_cheatcode_address, + default_test_contract_address, executor::{ backend::snapshot::BackendSnapshot, fork::{CreateFork, ForkId, MultiFork, SharedBackend}, - inspector::{cheatcodes::Cheatcodes, DEFAULT_CREATE2_DEPLOYER}, + inspector::cheatcodes::Cheatcodes, snapshot::Snapshots, }, utils::{b176_to_h176, h176_to_b176, h256_to_b256, ru256_to_u256, u256_to_ru256}, - TEST_CONTRACT_ADDRESS, }; use corebc::{ prelude::{Block, H176, H256, U256}, types::{Address, BlockNumber, Network as NetworkCore, Transaction, U64}, utils::sha3, }; +use foxar_config::Config; use hashbrown::HashMap as Map; pub use in_memory_db::MemDb; use revm::{ @@ -48,6 +48,8 @@ use crate::executor::{ }; pub use error::{DatabaseError, DatabaseResult}; +use super::inspector::cheatcodes::util::default_create2_address; + mod in_memory_db; // A `revm::Database` that is used in forking mode @@ -64,8 +66,11 @@ type ForkLookupIndex = usize; /// All accounts that will have persistent storage across fork swaps. See also [`clone_data()`] fn get_default_persistent_accounts(network: &NetworkCore) -> HashSet { - let default_persistent_accounts = - [CHEATCODE_ADDRESS, DEFAULT_CREATE2_DEPLOYER, default_caller(network)]; + let default_persistent_accounts = [ + default_cheatcode_address(Some(*network)), + default_create2_address(Some(*network)), + Config::default_sender(Some(network)), + ]; HashSet::from(default_persistent_accounts) } @@ -408,6 +413,12 @@ impl Backend { // Note: this will take of registering the `fork` let inner = BackendInner { persistent_accounts: get_default_persistent_accounts(network), + cheatcode_access_accounts: HashSet::from([ + default_cheatcode_address(Some(*network)), + default_test_contract_address(Some(*network)), + Config::default_sender(Some(&network)), + ]), + caller: Some(Config::default_sender(Some(&network))), ..Default::default() }; @@ -588,16 +599,6 @@ impl Backend { false } - /// In addition to the `_failed` variable, `DSTest::fail()` stores a failure - /// in "failed" - /// See - pub fn is_global_failure(&self) -> bool { - let index = U256::from(&b"failed"[..]); - self.storage(h176_to_b176(CHEATCODE_ADDRESS), u256_to_ru256(index)) - .map(|value| value == revm::primitives::U256::from(1)) - .unwrap_or_default() - } - /// When creating or switching forks, we update the AccountInfo of the contract pub(crate) fn update_fork_db( &self, @@ -1654,9 +1655,9 @@ impl Default for BackendInner { // grant the cheatcode,default test and caller address access to execute cheatcodes // itself cheatcode_access_accounts: HashSet::from([ - CHEATCODE_ADDRESS, - TEST_CONTRACT_ADDRESS, - default_caller(&NetworkCore::Mainnet), + default_cheatcode_address(Some(NetworkCore::Private(1337))), + default_test_contract_address(Some(NetworkCore::Private(1337))), + Config::default_sender(Some(&NetworkCore::Private(1337))), ]), } } diff --git a/evm/src/executor/inspector/cheatcodes/mod.rs b/evm/src/executor/inspector/cheatcodes/mod.rs index 382748b6..a42d6152 100644 --- a/evm/src/executor/inspector/cheatcodes/mod.rs +++ b/evm/src/executor/inspector/cheatcodes/mod.rs @@ -7,11 +7,8 @@ use self::{ }, }; use crate::{ - abi::HEVMCalls, - executor::{ - backend::DatabaseExt, inspector::cheatcodes::env::RecordedLogs, CHEATCODE_ADDRESS, - HARDHAT_CONSOLE_ADDRESS, - }, + abi::{default_cheatcode_address, default_hardhat_address, HEVMCalls}, + executor::{backend::DatabaseExt, inspector::cheatcodes::env::RecordedLogs}, utils::{b176_to_h176, b256_to_h256, h176_to_b176, ru256_to_u256, u256_to_ru256}, }; use corebc::{ @@ -63,7 +60,7 @@ mod mapping; mod snapshot; /// Utility cheatcodes (`sign` etc.) pub mod util; -pub use util::{BroadcastableTransaction, DEFAULT_CREATE2_DEPLOYER}; +pub use util::BroadcastableTransaction; mod config; use crate::executor::{backend::RevertDiagnostic, inspector::utils::get_create_address}; @@ -258,8 +255,8 @@ impl Cheatcodes { let created_address = get_create_address(inputs, old_nonce, &Network::from(data.env.cfg.network_id)); - if data.journaled_state.depth > 1 && - !data.db.has_cheatcode_access(b176_to_h176(inputs.caller)) + if data.journaled_state.depth > 1 + && !data.db.has_cheatcode_access(b176_to_h176(inputs.caller)) { // we only grant cheat code access for new contracts if the caller also has // cheatcode access and the new contract is created in top most call @@ -585,13 +582,17 @@ where call: &mut CallInputs, is_static: bool, ) -> (InstructionResult, Energy, bytes::Bytes) { - if call.contract == h176_to_b176(CHEATCODE_ADDRESS) { + if call.contract + == h176_to_b176(default_cheatcode_address(self.config.evm_opts.env.network_id)) + { let energy = Energy::new(call.energy_limit); match self.apply_cheatcode(data, b176_to_h176(call.context.caller), call) { Ok(retdata) => (InstructionResult::Return, energy, retdata.0), Err(err) => (InstructionResult::Revert, energy, err.encode_error().0), } - } else if call.contract != h176_to_b176(HARDHAT_CONSOLE_ADDRESS) { + } else if call.contract + != h176_to_b176(default_hardhat_address(self.config.evm_opts.env.network_id)) + { // Handle expected calls // Grab the different calldatas expected. @@ -632,9 +633,10 @@ where mock_retdata.data.clone().0, ); } else if let Some((_, mock_retdata)) = mocks.iter().find(|(mock, _)| { - mock.calldata.len() <= call.input.len() && - *mock.calldata == call.input[..mock.calldata.len()] && - mock.value + mock.calldata.len() <= call.input.len() + && *mock.calldata == call.input[..mock.calldata.len()] + && mock + .value .map_or(true, |value| value == ru256_to_u256(call.transfer.value)) }) { return ( @@ -647,8 +649,8 @@ where // Apply our prank if let Some(prank) = &self.prank { - if data.journaled_state.depth() >= prank.depth && - call.context.caller == h176_to_b176(prank.prank_caller) + if data.journaled_state.depth() >= prank.depth + && call.context.caller == h176_to_b176(prank.prank_caller) { let mut prank_applied = false; // At the target depth we set `msg.sender` @@ -679,8 +681,8 @@ where // // We do this because any subsequent contract calls *must* exist on chain and // we only want to grab *this* call, not internal ones - if data.journaled_state.depth() == broadcast.depth && - call.context.caller == h176_to_b176(broadcast.original_caller) + if data.journaled_state.depth() == broadcast.depth + && call.context.caller == h176_to_b176(broadcast.original_caller) { // At the target depth we set `msg.sender` & tx.origin. // We are simulating the caller as being an EOA, so *both* must be set to the @@ -761,8 +763,10 @@ where retdata: bytes::Bytes, _: bool, ) -> (InstructionResult, Energy, bytes::Bytes) { - if call.contract == h176_to_b176(CHEATCODE_ADDRESS) || - call.contract == h176_to_b176(HARDHAT_CONSOLE_ADDRESS) + if call.contract + == h176_to_b176(default_cheatcode_address(self.config.evm_opts.env.network_id)) + || call.contract + == h176_to_b176(default_hardhat_address(self.config.evm_opts.env.network_id)) { return (status, remaining_energy, retdata); } @@ -949,9 +953,9 @@ where if let TransactTo::Call(test_contract) = data.env.tx.transact_to { // if a call to a different contract than the original test contract returned with // `Stop` we check if the contract actually exists on the active fork - if data.db.is_forked_mode() && - status == InstructionResult::Stop && - call.contract != test_contract + if data.db.is_forked_mode() + && status == InstructionResult::Stop + && call.contract != test_contract { self.fork_revert_diagnostic = data.db.diagnose_revert(b176_to_h176(call.contract), &data.journaled_state); @@ -971,8 +975,8 @@ where // Apply our prank if let Some(prank) = &self.prank { - if data.journaled_state.depth() >= prank.depth && - call.caller == h176_to_b176(prank.prank_caller) + if data.journaled_state.depth() >= prank.depth + && call.caller == h176_to_b176(prank.prank_caller) { // At the target depth we set `msg.sender` if data.journaled_state.depth() == prank.depth { @@ -988,8 +992,8 @@ where // Apply our broadcast if let Some(broadcast) = &self.broadcast { - if data.journaled_state.depth() >= broadcast.depth && - call.caller == h176_to_b176(broadcast.original_caller) + if data.journaled_state.depth() >= broadcast.depth + && call.caller == h176_to_b176(broadcast.original_caller) { if let Err(err) = data.journaled_state.load_account(h176_to_b176(broadcast.new_origin), data.db) diff --git a/evm/src/executor/inspector/cheatcodes/util.rs b/evm/src/executor/inspector/cheatcodes/util.rs index b73e75ce..f6263983 100644 --- a/evm/src/executor/inspector/cheatcodes/util.rs +++ b/evm/src/executor/inspector/cheatcodes/util.rs @@ -20,7 +20,7 @@ use corebc::{ MnemonicBuilder, }, types::{transaction::eip2718::TypedTransaction, NameOrAddress, H256, U256}, - utils::{self, get_contract_address, get_create2_address}, + utils::{self, get_contract_address, get_create2_address, to_ican}, }; use foxar_common::{fmt::*, RpcUrl}; use revm::{ @@ -33,11 +33,19 @@ use std::{collections::VecDeque, str::FromStr}; const DEFAULT_DERIVATION_PATH_PREFIX: &str = "m/44'/60'/0'/0/"; /// Address of the default CREATE2 deployer cb063edadf999cb7b8b3ebc71f5e97783176d289d640 -pub const DEFAULT_CREATE2_DEPLOYER: H176 = H176([ - 0xcb, 0x06, 0x3e, 0xda, 0xdf, 0x99, 0x9c, 0xb7, 0xb8, 0xb3, 0xeb, 0xc7, 0x1f, 0x5e, 0x97, 0x78, - 0x31, 0x76, 0xd2, 0x89, 0xd6, 0x40, +pub const DEFAULT_CREATE2_DEPLOYER: H160 = H160([ + 0x3e, 0xda, 0xdf, 0x99, 0x9c, 0xb7, 0xb8, 0xb3, 0xeb, 0xc7, 0x1f, 0x5e, 0x97, 0x78, 0x31, 0x76, + 0xd2, 0x89, 0xd6, 0x40, ]); +/// Default CREATE2 deployer address +pub fn default_create2_address(mut network: Option) -> H176 { + if network.is_none() { + network = Some(Network::Private(1337)) //todo:error2215 change to ce address + } + to_ican(&DEFAULT_CREATE2_DEPLOYER, &network.unwrap()) +} + pub const MAGIC_SKIP_BYTES: &[u8] = b"FOXAR::SKIP"; /// Helps collecting transactions from different forks. @@ -227,7 +235,12 @@ pub fn apply( let code_hash = inner.1; let network = Network::from(data.env.cfg.network_id); - let result = get_create2_address(DEFAULT_CREATE2_DEPLOYER, salt, code_hash, network); + let result = get_create2_address( + default_create2_address(Some(network)), + salt, + code_hash, + network, + ); Ok(corebc::abi::encode(&[Token::Address(result)]).into()) } @@ -305,26 +318,29 @@ where } revm::primitives::CreateScheme::Create2 { salt } => { // Sanity checks for our CREATE2 deployer - data.journaled_state.load_account(h176_to_b176(DEFAULT_CREATE2_DEPLOYER), data.db)?; + let network = Some(Network::from(data.env.cfg.network_id)); + data.journaled_state + .load_account(h176_to_b176(default_create2_address(network)), data.db)?; - let info = &data.journaled_state.account(h176_to_b176(DEFAULT_CREATE2_DEPLOYER)).info; + let info = + &data.journaled_state.account(h176_to_b176(default_create2_address(network))).info; match &info.code { Some(code) => { if code.is_empty() { - trace!(create2=?DEFAULT_CREATE2_DEPLOYER, "Empty Create 2 deployer code"); + trace!(create2=?default_create2_address(network), "Empty Create 2 deployer code"); return Err(DatabaseError::MissingCreate2Deployer); } } None => { // forked db - trace!(create2=?DEFAULT_CREATE2_DEPLOYER, "Missing Create 2 deployer code"); + trace!(create2=?default_create2_address(network), "Missing Create 2 deployer code"); if data.db.code_by_hash(info.code_hash)?.is_empty() { return Err(DatabaseError::MissingCreate2Deployer); } } } - call.caller = h176_to_b176(DEFAULT_CREATE2_DEPLOYER); + call.caller = h176_to_b176(default_create2_address(network)); // We have to increment the nonce of the user address, since this create2 will be done // by the create2_deployer @@ -340,7 +356,11 @@ where calldata.put_slice(&salt_bytes); calldata.put(bytecode); - Ok((calldata.freeze(), Some(NameOrAddress::Address(DEFAULT_CREATE2_DEPLOYER)), nonce)) + Ok(( + calldata.freeze(), + Some(NameOrAddress::Address(default_create2_address(network))), + nonce, + )) } } } diff --git a/evm/src/executor/inspector/debugger.rs b/evm/src/executor/inspector/debugger.rs index 56922e1b..5beca52b 100644 --- a/evm/src/executor/inspector/debugger.rs +++ b/evm/src/executor/inspector/debugger.rs @@ -1,9 +1,9 @@ use crate::{ + abi::default_cheatcode_address, debug::{DebugArena, DebugNode, DebugStep, Instruction}, executor::{ backend::DatabaseExt, inspector::utils::{energy_used, get_create_address}, - CHEATCODE_ADDRESS, }, utils::{b176_to_h176, ru256_to_u256}, CallKind, @@ -122,7 +122,9 @@ where b176_to_h176(call.context.code_address), call.context.scheme.into(), ); - if CHEATCODE_ADDRESS == b176_to_h176(call.contract) { + if default_cheatcode_address(Some(Network::from(data.env.cfg.network_id))) + == b176_to_h176(call.contract) + { self.arena.arena[self.head].steps.push(DebugStep { memory: Memory::new(), instruction: Instruction::Cheatcode( diff --git a/evm/src/executor/inspector/logs.rs b/evm/src/executor/inspector/logs.rs index d8caa83d..63f1df53 100644 --- a/evm/src/executor/inspector/logs.rs +++ b/evm/src/executor/inspector/logs.rs @@ -1,11 +1,12 @@ use crate::{ - executor::{patch_hardhat_console_selector, HardhatConsoleCalls, HARDHAT_CONSOLE_ADDRESS}, + abi::default_hardhat_address, + executor::{patch_hardhat_console_selector, HardhatConsoleCalls}, utils::{b176_to_h176, b256_to_h256, h176_to_b176}, }; use bytes::Bytes; use corebc::{ abi::{AbiDecode, Token}, - types::{Log, H256}, + types::{Log, Network, H256}, }; use foxar_macros::ConsoleFmt; use revm::{ @@ -58,11 +59,13 @@ where fn call( &mut self, - _: &mut EVMData<'_, DB>, + evm: &mut EVMData<'_, DB>, call: &mut CallInputs, _: bool, ) -> (InstructionResult, Energy, Bytes) { - if call.contract == h176_to_b176(HARDHAT_CONSOLE_ADDRESS) { + if call.contract + == h176_to_b176(default_hardhat_address(Some(Network::from(evm.env.cfg.network_id)))) + { let (status, reason) = self.hardhat_log(call.input.to_vec()); (status, Energy::new(call.energy_limit), reason) } else { diff --git a/evm/src/executor/inspector/mod.rs b/evm/src/executor/inspector/mod.rs index 927791eb..8980c40b 100644 --- a/evm/src/executor/inspector/mod.rs +++ b/evm/src/executor/inspector/mod.rs @@ -22,7 +22,7 @@ mod stack; pub use stack::{InspectorData, InspectorStack}; pub mod cheatcodes; -pub use cheatcodes::{Cheatcodes, CheatsConfig, DEFAULT_CREATE2_DEPLOYER}; +pub use cheatcodes::{Cheatcodes, CheatsConfig}; mod pilot_state; pub use pilot_state::PilotState; diff --git a/evm/src/executor/mod.rs b/evm/src/executor/mod.rs index 0032837d..54b10d8d 100644 --- a/evm/src/executor/mod.rs +++ b/evm/src/executor/mod.rs @@ -1,9 +1,14 @@ -use self::inspector::{ - cheatcodes::util::BroadcastableTransactions, Cheatcodes, InspectorData, InspectorStackConfig, +use self::{ + abi::default_cheatcode_address, + inspector::{ + cheatcodes::util::BroadcastableTransactions, Cheatcodes, InspectorData, + InspectorStackConfig, + }, }; use crate::{ debug::DebugArena, - decode, default_caller, + decode, + executor::inspector::cheatcodes::util::default_create2_address, trace::CallTraceArena, utils::{ b176_to_h176, eval_to_instruction_result, h176_to_b176, halt_to_instruction_result, @@ -11,8 +16,7 @@ use crate::{ }, }; pub use abi::{ - patch_hardhat_console_selector, HardhatConsoleCalls, CHEATCODE_ADDRESS, CONSOLE_ABI, - HARDHAT_CONSOLE_ABI, HARDHAT_CONSOLE_ADDRESS, + patch_hardhat_console_selector, HardhatConsoleCalls, CONSOLE_ABI, HARDHAT_CONSOLE_ABI, }; use backend::FuzzBackendWrapper; use bytes::Bytes; @@ -20,9 +24,10 @@ use corebc::{ abi::{Abi, Contract, Detokenize, Function, Tokenize}, prelude::{decode_function_data, encode_function_data, Address, U256}, signers::LocalWallet, - types::{Log, Network}, + types::{Log, Network, H160}, utils::to_ican, }; use foxar_common::{abi::IntoFunction, evm::Breakpoints}; +use foxar_config::Config; use hashbrown::HashMap; use revm::primitives::hex_literal::hex; /// Reexport commonly used revm types @@ -59,7 +64,7 @@ use crate::{ error::{DatabaseError, DatabaseResult}, DatabaseExt, }, - inspector::{InspectorStack, DEFAULT_CREATE2_DEPLOYER}, + inspector::InspectorStack, }, }; pub use builder::ExecutorBuilder; @@ -105,7 +110,7 @@ impl Executor { // Need to create a non-empty contract on the cheatcodes address so `extcodesize` checks // does not fail backend.insert_account_info( - CHEATCODE_ADDRESS, + default_cheatcode_address(Some(Network::from(env.cfg.network_id))), revm::primitives::AccountInfo { code: Some(Bytecode::new_raw(vec![0u8].into()).to_checked()), ..Default::default() @@ -147,14 +152,18 @@ impl Executor { /// Creates the default CREATE2 Contract Deployer for local tests and scripts. pub fn deploy_create2_deployer(&mut self) -> eyre::Result<()> { trace!("deploying local create2 deployer"); + let create2_address = default_create2_address(Some(Network::from(self.env.cfg.network_id))); let create2_deployer_account = self .backend_mut() - .basic(h176_to_b176(DEFAULT_CREATE2_DEPLOYER))? - .ok_or(DatabaseError::MissingAccount(DEFAULT_CREATE2_DEPLOYER))?; + .basic(h176_to_b176(create2_address))? + .ok_or(DatabaseError::MissingAccount(create2_address))?; // if the deployer is not currently deployed, deploy the default one if create2_deployer_account.code.map_or(true, |code| code.is_empty()) { - let creator = "0xcb583fab184622dc19b6109349b94811493bf2a45362".parse().unwrap(); + let creator: H160 = H160([ + 0x3f, 0xab, 0x18, 0x46, 0x22, 0xdc, 0x19, 0xb6, 0x10, 0x93, 0x49, 0xb9, 0x48, 0x11, 0x49, 0x3b, 0xf2, 0xa4, 0x53, 0x62 + ]); + let creator = to_ican(&creator, &Network::from(self.env.cfg.network_id)); // Probably 0, but just in case. let initial_balance = self.get_balance(creator)?; @@ -230,7 +239,8 @@ impl Executor { ) -> Result, EvmError> { trace!(?from, ?to, "setting up contract"); - let from = from.unwrap_or(default_caller(&Network::from(self.env().cfg.network_id))); + let from = + from.unwrap_or(Config::default_sender(Some(&Network::from(self.env().cfg.network_id)))); self.backend_mut().set_test_contract(to).set_caller(from); let res = self.call_committing::<(), _, _>(from, to, "setUp()", (), 0.into(), None)?; @@ -555,7 +565,9 @@ impl Executor { // we only clone the test contract and cheatcode accounts, that's all we need to evaluate // success - for addr in [address, CHEATCODE_ADDRESS] { + for addr in + [address, default_cheatcode_address(Some(Network::from(self.env.cfg.network_id)))] + { let acc = self.backend().basic(h176_to_b176(addr))?.unwrap_or_default(); backend.insert_account_info(addr, acc); } @@ -575,7 +587,7 @@ impl Executor { if success { // Check if a DSTest assertion failed let call = executor.call::( - default_caller(&Network::from(self.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(self.env().cfg.network_id))), address, "failed()(bool)", (), diff --git a/evm/src/executor/opts.rs b/evm/src/executor/opts.rs index 215069c9..cb70cc6e 100644 --- a/evm/src/executor/opts.rs +++ b/evm/src/executor/opts.rs @@ -115,6 +115,7 @@ impl EvmOpts { energy_price: rU256::from(self.env.energy_price.unwrap_or_default()), energy_limit: self.energy_limit().as_u64(), caller: h176_to_b176(self.sender()), + transact_to: revm::primitives::TransactTo::Call(h176_to_b176(self.block_coinbase())), ..Default::default() }, } @@ -153,7 +154,7 @@ impl EvmOpts { if let Some(id) = self.env.network_id { return u64::from(id); } - self.get_remote_chain_id().map_or(u64::from(Network::Mainnet), u64::from) + self.get_remote_chain_id().map_or(u64::from(Network::Private(1337)), u64::from) } /// Returns the available compute units per second, which will be @@ -193,7 +194,8 @@ impl EvmOpts { /// Depending on network has different prefix and checksum pub fn sender(&self) -> Address { if self.sender == Config::default_sender(None) - && self.env.network_id != Some(Network::Mainnet) + && self.env.network_id != Some(Network::Private(1337)) + && self.env.network_id != None { return to_ican(&Config::DEFAULT_SENDER, &self.env.network_id.unwrap()); } @@ -204,7 +206,8 @@ impl EvmOpts { /// Depending on network has different prefix and checksum pub fn block_coinbase(&self) -> Address { if self.env.block_coinbase == Config::default_block_coinbase(None) - && self.env.network_id != Some(Network::Mainnet) + && self.env.network_id != Some(Network::Private(1337)) + && self.env.network_id != None { return to_ican(&Config::DEFAULT_SENDER, &self.env.network_id.unwrap()); } diff --git a/evm/src/fuzz/invariant/error.rs b/evm/src/fuzz/invariant/error.rs index 7abb0a55..5f7abad6 100644 --- a/evm/src/fuzz/invariant/error.rs +++ b/evm/src/fuzz/invariant/error.rs @@ -1,7 +1,6 @@ use super::{BasicTxDetails, InvariantContract}; use crate::{ decode::decode_revert, - default_caller, executor::{Executor, RawCallResult}, fuzz::{invariant::set_up_inner_replay, *}, trace::{load_contracts, TraceKind, Traces}, @@ -12,6 +11,7 @@ use corebc::{ }; use eyre::{Result, WrapErr}; use foxar_common::contracts::{ContractsByAddress, ContractsByArtifact}; +use foxar_config::Config; use proptest::test_runner::TestError; #[derive(Debug, Clone)] @@ -144,7 +144,7 @@ impl InvariantFuzzError { if let Some(func) = &self.func { let error_call_result = executor .call_raw( - default_caller(&Network::from(executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(executor.env().cfg.network_id))), self.addr, func.0.clone(), U256::zero(), @@ -190,7 +190,7 @@ impl InvariantFuzzError { if let Some(func) = &self.func { let error_call_result = executor .call_raw( - default_caller(&Network::from(executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(executor.env().cfg.network_id))), self.addr, func.0.clone(), 0.into(), diff --git a/evm/src/fuzz/invariant/executor.rs b/evm/src/fuzz/invariant/executor.rs index 86cf1b57..8e639f43 100644 --- a/evm/src/fuzz/invariant/executor.rs +++ b/evm/src/fuzz/invariant/executor.rs @@ -5,10 +5,8 @@ use super::{ InvariantFuzzTestResult, RandomCallGenerator, TargetedContracts, }; use crate::{ - default_caller, - executor::{ - inspector::Fuzzer, Executor, RawCallResult, CHEATCODE_ADDRESS, HARDHAT_CONSOLE_ADDRESS, - }, + abi::{default_cheatcode_address, default_hardhat_address}, + executor::{inspector::Fuzzer, Executor, RawCallResult}, fuzz::{ strategies::{ build_initial_state, collect_created_contracts, collect_state_from_call, @@ -25,7 +23,7 @@ use corebc::{ }; use eyre::ContextCompat; use foxar_common::contracts::{ContractsByAddress, ContractsByArtifact}; -use foxar_config::{FuzzDictionaryConfig, InvariantConfig}; +use foxar_config::{Config, FuzzDictionaryConfig, InvariantConfig}; use hashbrown::HashMap; use parking_lot::{Mutex, RwLock}; use proptest::{ @@ -123,8 +121,8 @@ impl<'a> InvariantExecutor<'a> { return Err(TestCaseError::fail("Revert occurred.")); } - if failures.borrow().broken_invariants_count == - invariant_contract.invariant_functions.len() + if failures.borrow().broken_invariants_count + == invariant_contract.invariant_functions.len() { return Err(TestCaseError::fail("All invariants have been broken.")); } @@ -349,9 +347,9 @@ impl<'a> InvariantExecutor<'a> { corebc::abi::StateMutability::Pure | corebc::abi::StateMutability::View ) }) - .count() == - 0 && - !self.artifact_filters.excluded.contains(&artifact.identifier()) + .count() + == 0 + && !self.artifact_filters.excluded.contains(&artifact.identifier()) { self.artifact_filters.excluded.push(artifact.identifier()); } @@ -362,8 +360,8 @@ impl<'a> InvariantExecutor<'a> { for contract in selected_abi { let identifier = self.validate_selected_contract(contract, &[])?; - if !self.artifact_filters.targeted.contains_key(&identifier) && - !self.artifact_filters.excluded.contains(&identifier) + if !self.artifact_filters.targeted.contains_key(&identifier) + && !self.artifact_filters.excluded.contains(&identifier) { self.artifact_filters.targeted.insert(identifier, vec![]); } @@ -410,15 +408,21 @@ impl<'a> InvariantExecutor<'a> { .clone() .into_iter() .filter(|(addr, (identifier, _))| { - *addr != invariant_address && - *addr != CHEATCODE_ADDRESS && - *addr != HARDHAT_CONSOLE_ADDRESS && - (selected.is_empty() || selected.contains(addr)) && - (self.artifact_filters.targeted.is_empty() || - self.artifact_filters.targeted.contains_key(identifier)) && - (excluded.is_empty() || !excluded.contains(addr)) && - (self.artifact_filters.excluded.is_empty() || - !self.artifact_filters.excluded.contains(identifier)) + *addr != invariant_address + && *addr + != default_cheatcode_address(Some(Network::from( + self.executor.env().cfg.network_id, + ))) + && *addr + != default_hardhat_address(Some(Network::from( + self.executor.env().cfg.network_id, + ))) + && (selected.is_empty() || selected.contains(addr)) + && (self.artifact_filters.targeted.is_empty() + || self.artifact_filters.targeted.contains_key(identifier)) + && (excluded.is_empty() || !excluded.contains(addr)) + && (self.artifact_filters.excluded.is_empty() + || !self.artifact_filters.excluded.contains(identifier)) }) .map(|(addr, (identifier, abi))| (addr, (identifier, abi, vec![]))) .collect(); @@ -499,7 +503,7 @@ impl<'a> InvariantExecutor<'a> { { if let Some(func) = abi.functions().find(|func| func.name == method_name) { if let Ok(call_result) = self.executor.call::, _, _>( - default_caller(&Network::from(self.executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(self.executor.env().cfg.network_id))), address, func.clone(), (), diff --git a/evm/src/fuzz/invariant/mod.rs b/evm/src/fuzz/invariant/mod.rs index 3402f6f6..06a6249c 100644 --- a/evm/src/fuzz/invariant/mod.rs +++ b/evm/src/fuzz/invariant/mod.rs @@ -1,11 +1,12 @@ //! Fuzzing support abstracted over the [`Evm`](crate::Evm) used -use crate::{default_caller, fuzz::*}; +use crate::fuzz::*; mod error; pub use error::InvariantFuzzError; mod filters; pub use filters::{ArtifactFilters, SenderFilters}; mod call_override; pub use call_override::{set_up_inner_replay, RandomCallGenerator}; +use foxar_config::Config; mod executor; use crate::executor::Executor; use corebc::{ @@ -56,7 +57,7 @@ pub fn assert_invariants( for func in &invariant_contract.invariant_functions { let mut call_result = executor .call_raw( - default_caller(&Network::from(executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(executor.env().cfg.network_id))), invariant_contract.address, func.encode_input(&[]).expect("invariant should have no inputs").into(), U256::zero(), diff --git a/evm/src/lib.rs b/evm/src/lib.rs index d66c64f0..8f042906 100644 --- a/evm/src/lib.rs +++ b/evm/src/lib.rs @@ -35,7 +35,6 @@ pub use revm; use revm::interpreter::{CallScheme, CreateScheme}; use serde::{Deserialize, Serialize}; - /// Stores the caller address to be used as _sender_ account for: /// - deploying Test contracts /// - deploying Script contracts @@ -43,23 +42,19 @@ use serde::{Deserialize, Serialize}; /// The address was derived from `address(uint160(uint256(sha3("foxar default caller"))))` /// and is equal to cb681804c8ab1f12e6bbf3894d4083f33e07309d1f38. -/// Depending on network has different prefix and checksum -pub fn default_caller(network: &Network) -> H176 { - /// `0x1804c8ab1f12e6bbf3894d4083f33e07309d1f38` - const CALLER: &H160 = &H160([ - 0x18, 0x04, 0xc8, 0xAB, 0x1F, 0x12, 0xE6, 0xbb, 0xF3, 0x89, 0x4D, 0x40, 0x83, 0xF3, 0x3E, - 0x07, 0x30, 0x9D, 0x1F, 0x38, - ]); - - to_ican(CALLER, network) -} - /// Stores the default test contract address: cb04b4c79dab8f259c7aee6e5b2aa729821864227e84 -pub const TEST_CONTRACT_ADDRESS: Address = H176([ - 203, 4, 180, 199, 157, 171, 143, 37, 156, 122, 238, 110, 91, 42, 167, 41, 130, 24, 100, 34, - 126, 132, +pub const TEST_CONTRACT_ADDRESS: H160 = H160([ + 180, 199, 157, 171, 143, 37, 156, 122, 238, 110, 91, 42, 167, 41, 130, 24, 100, 34, 126, 132, ]); +/// Default test contract address +pub fn default_test_contract_address(mut network: Option) -> H176 { + if network.is_none() { + network = Some(Network::Private(1337)) //todo:error2215 change to ce address + } + to_ican(&TEST_CONTRACT_ADDRESS, &network.unwrap()) +} + #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "UPPERCASE")] #[derive(Default)] diff --git a/evm/src/trace/decoder.rs b/evm/src/trace/decoder.rs index e3497f2a..f1fd5326 100644 --- a/evm/src/trace/decoder.rs +++ b/evm/src/trace/decoder.rs @@ -3,17 +3,20 @@ use super::{ CallTraceArena, RawOrDecodedCall, RawOrDecodedLog, RawOrDecodedReturnData, }; use crate::{ - abi::{CHEATCODE_ADDRESS, CONSOLE_ABI, HARDHAT_CONSOLE_ABI, HARDHAT_CONSOLE_ADDRESS, HEVM_ABI}, - decode, default_caller, - executor::inspector::DEFAULT_CREATE2_DEPLOYER, + abi::{ + default_cheatcode_address, default_hardhat_address, CONSOLE_ABI, HARDHAT_CONSOLE_ABI, + HEVM_ABI, + }, + decode, default_test_contract_address, + executor::inspector::cheatcodes::util::{default_create2_address, DEFAULT_CREATE2_DEPLOYER}, trace::{node::CallTraceNode, utils}, - TEST_CONTRACT_ADDRESS, }; use corebc::{ abi::{Abi, Address, Event, Function, Param, ParamType, Token}, types::{Network, H176, H256}, }; use foxar_common::{abi::get_indexed_event, SELECTOR_LEN}; +use foxar_config::Config; use hashbrown::HashSet; use std::collections::{BTreeMap, HashMap}; @@ -134,11 +137,11 @@ impl CallTraceDecoder { contracts: Default::default(), labels: [ - (CHEATCODE_ADDRESS, "VM".to_string()), - (HARDHAT_CONSOLE_ADDRESS, "console".to_string()), - (DEFAULT_CREATE2_DEPLOYER, "Create2Deployer".to_string()), - (default_caller(network), "DefaultSender".to_string()), - (TEST_CONTRACT_ADDRESS, "DefaultTestContract".to_string()), + (default_cheatcode_address(Some(*network)), "VM".to_string()), + (default_hardhat_address(Some(*network)), "console".to_string()), + (default_create2_address(Some(*network)), "Create2Deployer".to_string()), + (Config::default_sender(Some(network)), "DefaultSender".to_string()), + (default_test_contract_address(Some(*network)), "DefaultTestContract".to_string()), ] .into(), @@ -230,7 +233,8 @@ impl CallTraceDecoder { if bytes.len() >= 4 { if let Some(funcs) = self.functions.get(&bytes[..SELECTOR_LEN]) { node.decode_function(funcs, &self.labels, &self.errors, self.verbosity); - } else if node.trace.address == DEFAULT_CREATE2_DEPLOYER { + // we cannot have network have but still can compare 20 bytes + } else if node.trace.address[16..] == DEFAULT_CREATE2_DEPLOYER[..] { node.trace.data = RawOrDecodedCall::Decoded("create2".to_string(), String::new(), vec![]); } else if let Some(identifier) = &self.signature_identifier { diff --git a/evm/src/trace/mod.rs b/evm/src/trace/mod.rs index 9a5e2a52..5a9968ed 100644 --- a/evm/src/trace/mod.rs +++ b/evm/src/trace/mod.rs @@ -127,12 +127,12 @@ impl CallTraceArena { Instruction::OpCode(opc) => { match opc { // If yes, descend into a child trace - opcode::CREATE | - opcode::CREATE2 | - opcode::DELEGATECALL | - opcode::CALL | - opcode::STATICCALL | - opcode::CALLCODE => { + opcode::CREATE + | opcode::CREATE2 + | opcode::DELEGATECALL + | opcode::CALL + | opcode::STATICCALL + | opcode::CALLCODE => { self.add_to_geth_trace( storage, &self.arena[trace_node.children[child_id]], @@ -568,7 +568,7 @@ pub enum TraceKind { /// Chooses the color of the trace depending on the destination address and status of the call. fn trace_color(trace: &CallTrace) -> Color { - if trace.address == CHEATCODE_ADDRESS { + if trace.address[16..] == CHEATCODE_ADDRESS[..] { // we cannot get a network there but we still can compare 20 bytes of address Color::Blue } else if trace.success { Color::Green diff --git a/evm/src/trace/node.rs b/evm/src/trace/node.rs index 75b28e2f..cb0ffc27 100644 --- a/evm/src/trace/node.rs +++ b/evm/src/trace/node.rs @@ -1,9 +1,9 @@ use crate::{ + abi::CHEATCODE_ADDRESS, decode, - executor::CHEATCODE_ADDRESS, trace::{ - utils, utils::decode_cheatcode_outputs, CallTrace, LogCallOrder, RawOrDecodedCall, - RawOrDecodedLog, RawOrDecodedReturnData, + utils::{self, decode_cheatcode_outputs}, + CallTrace, LogCallOrder, RawOrDecodedCall, RawOrDecodedLog, RawOrDecodedReturnData, }, CallKind, }; @@ -109,7 +109,8 @@ impl CallTraceNode { if let RawOrDecodedCall::Raw(ref bytes) = self.trace.data { let inputs = if bytes.len() >= SELECTOR_LEN { - if self.trace.address == CHEATCODE_ADDRESS { + if self.trace.address[16..] == CHEATCODE_ADDRESS[..] { + // we cannot get network here but still can compare 20 bytes // Try to decode cheatcode inputs in a more custom way utils::decode_cheatcode_inputs(func, bytes, errors, verbosity).unwrap_or_else( || { @@ -136,7 +137,8 @@ impl CallTraceNode { if let RawOrDecodedReturnData::Raw(bytes) = &self.trace.output { if !bytes.is_empty() && self.trace.success { - if self.trace.address == CHEATCODE_ADDRESS { + if self.trace.address[16..] == CHEATCODE_ADDRESS[..] { + // we cannot get network here but still can compare 20 bytes if let Some(decoded) = funcs .iter() .find_map(|func| decode_cheatcode_outputs(func, bytes, verbosity)) diff --git a/pilot/src/dispatcher.rs b/pilot/src/dispatcher.rs index 1f6fdaec..c846bcc7 100644 --- a/pilot/src/dispatcher.rs +++ b/pilot/src/dispatcher.rs @@ -946,7 +946,7 @@ impl PilotDispatcher { // )?; let mut decoder = CallTraceDecoderBuilder::new( - &session_config.evm_opts.get_remote_chain_id().unwrap_or(Network::Mainnet), + &session_config.evm_opts.get_remote_chain_id().unwrap_or(Network::Private(1337)), ) .with_labels(result.labeled_addresses.clone()) .build(); diff --git a/pilot/src/session_source.rs b/pilot/src/session_source.rs index ddea5085..08eca63d 100644 --- a/pilot/src/session_source.rs +++ b/pilot/src/session_source.rs @@ -4,6 +4,7 @@ //! the REPL contract's source code. It provides simple compilation, parsing, and //! execution helpers. +use corebc::types::Network; use corebc_ylem::{ artifacts::{Source, Sources}, CompilerInput, CompilerOutput, Ylem, @@ -13,7 +14,10 @@ use foxar_config::{Config, YlemReq}; use semver::Version; use serde::{Deserialize, Serialize}; use solang_parser::pt; -use spark::executor::{opts::EvmOpts, Backend}; +use spark::{ + abi::default_cheatcode_address, + executor::{opts::EvmOpts, Backend}, +}; use spark_fmt::solang_ext::SafeUnwrap; use std::{collections::HashMap, fs, path::PathBuf}; use yansi::Paint; @@ -472,6 +476,7 @@ contract {} is Script {{ let Version { major, minor, patch, .. } = self.ylem.version().unwrap(); //TODO:error2215 - find a way to build ican address here - // Cheats(address(uint176(uint256(sha3("hevm cheat code"))))); + let cheatcode_address = default_cheatcode_address(self.config.evm_opts.env.network_id); format!( r#" // SPDX-License-Identifier: UNLICENSED @@ -481,7 +486,7 @@ import {{Cheats}} from "forge-std/Vm.sol"; {} contract {} {{ - Cheats internal constant vm = Cheats(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); + Cheats internal constant vm = Cheats({cheatcode_address}); {} /// @notice REPL contract entry point @@ -509,9 +514,9 @@ contract {} {{ .into_iter() .filter_map(|sup| match sup { pt::SourceUnitPart::ImportDirective(i) => match i { - pt::Import::Plain(s, _) | - pt::Import::Rename(s, _, _) | - pt::Import::GlobalSymbol(s, _, _) => { + pt::Import::Plain(s, _) + | pt::Import::Rename(s, _, _) + | pt::Import::GlobalSymbol(s, _, _) => { let path = PathBuf::from(s.string); match fs::read_to_string(path) { diff --git a/spark/README.md b/spark/README.md index ad2aa1a9..b4296140 100644 --- a/spark/README.md +++ b/spark/README.md @@ -116,7 +116,7 @@ _The below is modified from [Dapp's README](https://github.com/dapphub/dapptools/blob/master/src/hevm/README.md#cheat-codes)_ We allow modifying blockchain state with "cheat codes". These can be accessed by -calling into a contract at address `0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8`, +calling into a contract at address `0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8`, which implements the following methods: - `function warp(uint x) public` Sets the block timestamp to `x`. @@ -197,7 +197,7 @@ contract Foo { } contract MyTest { - Vm vm = Vm(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); + Vm vm = Vm(0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); function testWarp() public { vm.warp(100); diff --git a/spark/src/gas_report.rs b/spark/src/gas_report.rs index f0fe93a4..fdc9cc2a 100644 --- a/spark/src/gas_report.rs +++ b/spark/src/gas_report.rs @@ -1,10 +1,8 @@ -use crate::{ - executor::{CHEATCODE_ADDRESS, HARDHAT_CONSOLE_ADDRESS}, - trace::{CallTraceArena, RawOrDecodedCall, TraceKind}, -}; +use crate::trace::{CallTraceArena, RawOrDecodedCall, TraceKind}; use comfy_table::{presets::ASCII_MARKDOWN, *}; -use corebc::types::U256; +use corebc::types::{Network, U256}; use foxar_common::{calc, TestFunctionExt}; +use foxar_evm::abi::{default_cheatcode_address, default_hardhat_address}; use serde::{Deserialize, Serialize}; use std::{collections::BTreeMap, fmt::Display}; @@ -36,17 +34,24 @@ impl GasReport { Self { report_for, ignore, ..Default::default() } } - pub fn analyze(&mut self, traces: &[(TraceKind, CallTraceArena)]) { + pub fn analyze(&mut self, traces: &[(TraceKind, CallTraceArena)], network: Option) { traces.iter().for_each(|(_, trace)| { - self.analyze_node(0, trace); + self.analyze_node(0, trace, network); }); } - fn analyze_node(&mut self, node_index: usize, arena: &CallTraceArena) { + fn analyze_node( + &mut self, + node_index: usize, + arena: &CallTraceArena, + network: Option, + ) { let node = &arena.arena[node_index]; let trace = &node.trace; - if trace.address == CHEATCODE_ADDRESS || trace.address == HARDHAT_CONSOLE_ADDRESS { + if trace.address == default_cheatcode_address(network) + || trace.address == default_hardhat_address(network) + { return; } @@ -64,10 +69,10 @@ impl GasReport { contract_name ); } - let report_contract = (!self.ignore.contains(&contract_name) && - self.report_for.contains(&"*".to_string())) || - (!self.ignore.contains(&contract_name) && self.report_for.is_empty()) || - (self.report_for.contains(&contract_name)); + let report_contract = (!self.ignore.contains(&contract_name) + && self.report_for.contains(&"*".to_string())) + || (!self.ignore.contains(&contract_name) && self.report_for.is_empty()) + || (self.report_for.contains(&contract_name)); if report_contract { let contract_report = self.contracts.entry(name.to_string()).or_default(); @@ -94,7 +99,7 @@ impl GasReport { } node.children.iter().for_each(|index| { - self.analyze_node(*index, arena); + self.analyze_node(*index, arena, network); }); } diff --git a/spark/src/runner.rs b/spark/src/runner.rs index 8942d752..6124993f 100644 --- a/spark/src/runner.rs +++ b/spark/src/runner.rs @@ -11,10 +11,9 @@ use foxar_common::{ contracts::{ContractsByAddress, ContractsByArtifact}, TestFunctionExt, }; -use foxar_config::{FuzzConfig, InvariantConfig}; +use foxar_config::{Config, FuzzConfig, InvariantConfig}; use foxar_evm::{ decode::decode_console_logs, - default_caller, executor::{CallResult, EvmError, ExecutionErr, Executor}, fuzz::{ invariant::{ @@ -93,7 +92,7 @@ impl<'a> ContractRunner<'a> { // We max out their balance so that they can deploy and make calls. self.executor.set_balance(self.sender, U256::MAX)?; self.executor.set_balance( - default_caller(&Network::from(self.executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(self.executor.env().cfg.network_id))), U256::MAX, )?; @@ -137,7 +136,7 @@ impl<'a> ContractRunner<'a> { self.executor.set_balance(address, self.initial_balance)?; self.executor.set_balance(self.sender, self.initial_balance)?; self.executor.set_balance( - default_caller(&Network::from(self.executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(self.executor.env().cfg.network_id))), self.initial_balance, )?; @@ -381,7 +380,6 @@ impl<'a> ContractRunner<'a> { } } }; - let success = self.executor.is_success( setup.address, reverted, diff --git a/spark/tests/it/config.rs b/spark/tests/it/config.rs index 0d3f8d87..e81889ef 100644 --- a/spark/tests/it/config.rs +++ b/spark/tests/it/config.rs @@ -3,6 +3,7 @@ use crate::test_helpers::{ filter::Filter, COMPILED, COMPILED_WITH_LIBS, EVM_OPTS, LIBS_PROJECT, PROJECT, }; +use corebc::types::H176; use foxar_config::{ fs_permissions::PathPermission, Config, FsPermissions, FuzzConfig, FuzzDictionaryConfig, InvariantConfig, RpcEndpoint, RpcEndpoints, @@ -165,6 +166,34 @@ pub async fn runner_with_config(mut config: Config) -> MultiContractRunner { .unwrap() } +/// Builds a non-tracing runner +pub async fn repros_runner(mut config: Config, sender: Option) -> MultiContractRunner { + let mut opts = EVM_OPTS.clone(); + + opts.env.tx_origin = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + opts.env.block_coinbase = Config::default_block_coinbase(Some(&corebc::types::Network::Mainnet)); + opts.sender = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + opts.env.network_id = Some(corebc::types::Network::Mainnet); + + + config.rpc_endpoints = rpc_endpoints(); + config.allow_paths.push(manifest_root()); + config.block_coinbase = Config::default_block_coinbase(Some(&corebc::types::Network::Mainnet)); + config.network_id = Some(corebc::types::Network::Mainnet); + if let Some(sender) = sender { + config.sender = sender; + } else { + config.sender = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + } + config.tx_origin = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + + base_runner() + .with_cheats_config(CheatsConfig::new(&config, &opts)) + .sender(config.sender()) + .build(&PROJECT.paths.root, (*COMPILED).clone(), opts.evm_env().await, opts.clone()) + .unwrap() +} + /// Builds a tracing runner pub async fn tracing_runner() -> MultiContractRunner { let mut opts = EVM_OPTS.clone(); @@ -178,14 +207,27 @@ pub async fn tracing_runner() -> MultiContractRunner { pub async fn forked_runner(rpc: &str) -> MultiContractRunner { let mut opts = EVM_OPTS.clone(); - opts.env.network_id = None; // clear chain id so the correct one gets fetched from the RPC + opts.env.tx_origin = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + opts.env.block_coinbase = Config::default_block_coinbase(Some(&corebc::types::Network::Mainnet)); + opts.sender = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + opts.env.network_id = Some(corebc::types::Network::Mainnet); opts.fork_url = Some(rpc.to_string()); let env = opts.evm_env().await; let fork = opts.get_fork(&Default::default(), env.clone()); + let mut cheats_config = Config::default(); + cheats_config.block_coinbase = Config::default_block_coinbase(Some(&corebc::types::Network::Mainnet)); + cheats_config.network_id = Some(corebc::types::Network::Mainnet); + cheats_config.sender = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + cheats_config.tx_origin = Config::default_sender(Some(&corebc::types::Network::Mainnet)); + cheats_config.rpc_endpoints = rpc_endpoints(); + cheats_config.allow_paths.push(manifest_root()); + base_runner() .with_fork(fork) + .sender(opts.sender()) + .with_cheats_config(CheatsConfig::new(&cheats_config, &opts)) .build(&LIBS_PROJECT.paths.root, (*COMPILED_WITH_LIBS).clone(), env, opts) .unwrap() } diff --git a/spark/tests/it/core.rs b/spark/tests/it/core.rs index 8f51d7ff..9de59579 100644 --- a/spark/tests/it/core.rs +++ b/spark/tests/it/core.rs @@ -308,7 +308,7 @@ async fn test_logs() { None, Some(vec![ "constructor".into(), - "cb270000000000000000000000000000000000000001".into(), + "ce180000000000000000000000000000000000000001".into(), ]), None, ), @@ -623,7 +623,7 @@ async fn test_logs() { None, Some(vec![ "constructor".into(), - "cb270000000000000000000000000000000000000001".into(), + "ce180000000000000000000000000000000000000001".into(), ]), None, ), @@ -647,7 +647,7 @@ async fn test_logs() { None, Some(vec![ "constructor".into(), - "formatted log addr=cb270000000000000000000000000000000000000001" + "formatted log addr=ce180000000000000000000000000000000000000001" .into(), ]), None, diff --git a/spark/tests/it/fork.rs b/spark/tests/it/fork.rs index 194d812f..3a167bc7 100644 --- a/spark/tests/it/fork.rs +++ b/spark/tests/it/fork.rs @@ -9,7 +9,8 @@ use spark::result::SuiteResult; /// Executes reverting fork test #[tokio::test(flavor = "multi_thread")] async fn test_cheats_fork_revert() { - let mut runner = runner().await; + let rpc_url: String = foxar_utils::rpc::next_http_archive_rpc_endpoint(corebc::types::Network::Mainnet); + let mut runner = forked_runner(&rpc_url).await; let suite_result = runner .test( &Filter::new( @@ -26,9 +27,8 @@ async fn test_cheats_fork_revert() { for (_, SuiteResult { test_results, .. }) in suite_result { for (_, result) in test_results { //CORETODO: check diagnostics error once we update ylem - assert_eq!( - result.reason.unwrap(), - "Contract cb73a7f8ca25d95c21655c170b365c7a8df17b888add does not exist on active fork with id `1`\n But exists on non active forks: `[0]`" + assert!( + result.reason.unwrap().contains("Contract cb73a7f8ca25d95c21655c170b365c7a8df17b888add does not exist on active fork with id `2`\n But exists on non active forks:") ); } } @@ -37,9 +37,11 @@ async fn test_cheats_fork_revert() { /// Executes all non-reverting fork cheatcodes #[tokio::test(flavor = "multi_thread")] async fn test_cheats_fork() { + let rpc_url = foxar_utils::rpc::next_http_archive_rpc_endpoint(corebc::types::Network::Mainnet); + let runner = forked_runner(&rpc_url).await; let filter = Filter::new(".*", ".*", &format!(".*cheats{RE_PATH_SEPARATOR}Fork")) .exclude_tests(".*Revert"); - TestConfig::filter(filter).await.run().await; + TestConfig::with_filter(runner, filter).run().await; } /// Tests that we can launch in forking mode diff --git a/spark/tests/it/repros.rs b/spark/tests/it/repros.rs index da9b4b1b..8b10fd26 100644 --- a/spark/tests/it/repros.rs +++ b/spark/tests/it/repros.rs @@ -19,11 +19,8 @@ macro_rules! test_repro { let mut config = Config::with_root(PROJECT.root()); config.fs_permissions = FsPermissions::new(vec![PathPermission::read("./fixtures")]); - if let Some(sender) = $sender { - config.sender = sender; - } - - let mut config = TestConfig::with_filter(runner_with_config(config).await, filter) + let runner = repros_runner(config, $sender).await; + let mut config = TestConfig::with_filter(runner, filter) .set_should_fail($should_fail); config.run().await; }; diff --git a/spark/tests/it/test_helpers.rs b/spark/tests/it/test_helpers.rs index 9356698c..8b34de40 100644 --- a/spark/tests/it/test_helpers.rs +++ b/spark/tests/it/test_helpers.rs @@ -8,7 +8,6 @@ use corebc::{ }; use foxar_config::Config; use foxar_evm::{ - default_caller, executor::{ backend::Backend, opts::{Env, EvmOpts}, @@ -62,12 +61,11 @@ pub static COMPILED_WITH_LIBS: Lazy = Lazy::new(|| { pub static EVM_OPTS: Lazy = Lazy::new(|| EvmOpts { env: Env { energy_limit: 18446744073709551615, - network_id: Some(corebc::types::Network::Mainnet), + network_id: Some(corebc::types::Network::Private(1337)), tx_origin: Config::default_sender(None), block_number: 1, block_timestamp: 1, - block_coinbase: Address::from_str("0xcb540000000000000000000000000000000000000000") - .unwrap(), + block_coinbase: Config::default_block_coinbase(None), ..Default::default() }, sender: Config::default_sender(None), @@ -83,7 +81,7 @@ pub fn fuzz_executor(executor: &Executor) -> FuzzedExecutor { FuzzedExecutor::new( executor, proptest::test_runner::TestRunner::new(cfg), - default_caller(&Network::from(executor.env().cfg.network_id)), + Config::default_sender(Some(&Network::from(executor.env().cfg.network_id))), config::test_opts().fuzz, ) } diff --git a/testdata/cheats/Addr.t.sol b/testdata/cheats/Addr.t.sol index c1226925..7ef90982 100644 --- a/testdata/cheats/Addr.t.sol +++ b/testdata/cheats/Addr.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract AddrTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testFailPrivKeyZero() public { cheats.addr(0); @@ -13,7 +13,7 @@ contract AddrTest is DSTest { function testAddr() public { uint256 pk = 77814517325470205911140941194401928579557062014761831930645393041380819009408; - address expected = 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c; + address expected = 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c; assertEq(cheats.addr(pk), expected, "expected address did not match"); } diff --git a/testdata/cheats/Assume.t.sol b/testdata/cheats/Assume.t.sol index fb769050..c54420bc 100644 --- a/testdata/cheats/Assume.t.sol +++ b/testdata/cheats/Assume.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract AssumeTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testAssume(uint8 x) public { cheats.assume(x < 2 ** 7); diff --git a/testdata/cheats/Bank.t.sol b/testdata/cheats/Bank.t.sol index 3eb20fca..03c01726 100644 --- a/testdata/cheats/Bank.t.sol +++ b/testdata/cheats/Bank.t.sol @@ -5,11 +5,11 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract CoinbaseTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testCoinbase() public { - cheats.coinbase(0xcb95ea674fdde714fd979de3edf0f56aa9716b898ec8); - assertEq(block.coinbase, 0xcb95ea674fdde714fd979de3edf0f56aa9716b898ec8, "coinbase failed"); + cheats.coinbase(0xce86ea674fdde714fd979de3edf0f56aa9716b898ec8); + assertEq(block.coinbase, 0xce86ea674fdde714fd979de3edf0f56aa9716b898ec8, "coinbase failed"); } function testCoinbaseFuzzed(address who) public { diff --git a/testdata/cheats/Broadcast.t.sol b/testdata/cheats/Broadcast.t.sol index f6028e65..040c32df 100644 --- a/testdata/cheats/Broadcast.t.sol +++ b/testdata/cheats/Broadcast.t.sol @@ -38,12 +38,12 @@ library F { } contract BroadcastTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); // 1st shuttle account - address public ACCOUNT_A = 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c; + address public ACCOUNT_A = 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c; // 2nd shuttle account - address public ACCOUNT_B = 0xcb732536ad1a311f40a2f2cd1871246685d572afe700; + address public ACCOUNT_B = 0xce642536ad1a311f40a2f2cd1871246685d572afe700; function deploy() public { cheats.broadcast(ACCOUNT_A); @@ -86,7 +86,7 @@ contract BroadcastTest is DSTest { ); address thisAddress = cheats.rememberKey(privateKey); - assertEq(thisAddress, 0xcb6690f79bf6eb2c4f870365e785982e1f101e93b906); + assertEq(thisAddress, 0xce5790f79bf6eb2c4f870365e785982e1f101e93b906); cheats.broadcast(thisAddress); Test test = new Test(); @@ -194,13 +194,13 @@ interface INoLink { } contract BroadcastTestNoLinking is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); // ganache-cli -d 1st - address public ACCOUNT_A = 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c; + address public ACCOUNT_A = 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c; // ganache-cli -d 2nd - address public ACCOUNT_B = 0xcb732536ad1a311f40a2f2cd1871246685d572afe700; + address public ACCOUNT_B = 0xce642536ad1a311f40a2f2cd1871246685d572afe700; function deployDoesntPanic() public { cheats.broadcast(address(ACCOUNT_A)); @@ -243,13 +243,13 @@ contract BroadcastTestNoLinking is DSTest { } contract BroadcastMix is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); // ganache-cli -d 1st - address public ACCOUNT_A = 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c; + address public ACCOUNT_A = 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c; // ganache-cli -d 2nd - address public ACCOUNT_B = 0xcb732536ad1a311f40a2f2cd1871246685d572afe700; + address public ACCOUNT_B = 0xce642536ad1a311f40a2f2cd1871246685d572afe700; function more() internal { cheats.broadcast(); @@ -258,7 +258,7 @@ contract BroadcastMix is DSTest { function deployMix() public { address user = msg.sender; - assert(user == address(0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c)); + assert(user == address(0xce49e5dd06163a480c22d540ec763325a0b5860fb56c)); NoLink no = new NoLink(); @@ -301,7 +301,7 @@ contract BroadcastMix is DSTest { } contract BroadcastTestSetup is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function setUp() public { // It predeployed a library first @@ -327,7 +327,7 @@ contract BroadcastTestSetup is DSTest { } contract BroadcastTestLog is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function run() public { uint256[] memory arr = new uint256[](2); @@ -350,13 +350,13 @@ contract BroadcastTestLog is DSTest { } contract TestInitialBalance is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function runCustomSender() public { // Make sure we're testing a different caller than the default one. assert( msg.sender != - address(0xcb5400a329c0648769a73afac7f9381e08fb43dbea72) + address(0xce4500a329c0648769a73afac7f9381e08fb43dbea72) ); // NodeConfig::test() sets the balance of the address used in this test to 100 ether. @@ -370,7 +370,7 @@ contract TestInitialBalance is DSTest { // Make sure we're testing with the default caller. assert( msg.sender == - address(0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38) + address(0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38) ); assert(msg.sender.balance == type(uint256).max); @@ -381,13 +381,13 @@ contract TestInitialBalance is DSTest { } contract MultiChainBroadcastNoLink is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); // ganache-cli -d 1st - address public ACCOUNT_A = 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c; + address public ACCOUNT_A = 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c; // ganache-cli -d 2nd - address public ACCOUNT_B = 0xcb732536ad1a311f40a2f2cd1871246685d572afe700; + address public ACCOUNT_B = 0xce642536ad1a311f40a2f2cd1871246685d572afe700; function deploy(string memory sforkA, string memory sforkB) public { uint256 forkA = cheats.createFork(sforkA); @@ -426,13 +426,13 @@ contract MultiChainBroadcastNoLink is DSTest { } contract MultiChainBroadcastLink is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); // ganache-cli -d 1st - address public ACCOUNT_A = 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c; + address public ACCOUNT_A = 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c; // ganache-cli -d 2nd - address public ACCOUNT_B = 0xcb732536ad1a311f40a2f2cd1871246685d572afe700; + address public ACCOUNT_B = 0xce642536ad1a311f40a2f2cd1871246685d572afe700; function deploy(string memory sforkA, string memory sforkB) public { uint256 forkA = cheats.createFork(sforkA); @@ -449,7 +449,7 @@ contract MultiChainBroadcastLink is DSTest { } contract BroadcastEmptySetUp is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function setUp() public {} @@ -490,14 +490,14 @@ contract ContractB { } contract CheckOverrides is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function run() external { // `script_caller` can be set by `--private-key ...` or `--sender ...` - // Otherwise it will take the default value of 0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38 + // Otherwise it will take the default value of 0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38 address script_caller = msg.sender; require( - script_caller == 0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38 + script_caller == 0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38 ); require(tx.origin == script_caller); diff --git a/testdata/cheats/ChainId.t.sol b/testdata/cheats/ChainId.t.sol index 19bc94e3..ce88a50e 100644 --- a/testdata/cheats/ChainId.t.sol +++ b/testdata/cheats/ChainId.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract DealTest is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testChainId() public { uint256 newChainId = 99; diff --git a/testdata/cheats/Deal.t.sol b/testdata/cheats/Deal.t.sol index d8db1913..c7a8f39c 100644 --- a/testdata/cheats/Deal.t.sol +++ b/testdata/cheats/Deal.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract DealTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testDeal(uint256 amount) public { address target = address(10); diff --git a/testdata/cheats/Derive.t.sol b/testdata/cheats/Derive.t.sol index acb6f7c8..982008fa 100644 --- a/testdata/cheats/Derive.t.sol +++ b/testdata/cheats/Derive.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract DeriveTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testDerive() public { string memory mnemonic = "test test test test test test test test test test test junk"; diff --git a/testdata/cheats/Env.t.sol b/testdata/cheats/Env.t.sol index 546d529a..7dd81f36 100644 --- a/testdata/cheats/Env.t.sol +++ b/testdata/cheats/Env.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract EnvTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testSetEnv() public { string memory key = "_foxarCheatcodeSetEnvTestKey"; @@ -86,12 +86,12 @@ contract EnvTest is DSTest { function testEnvAddress() public { string memory key = "_foxarCheatcodeEnvAddressTestKey"; string[numEnvAddressTests] memory values = [ - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", - "0xcb540000000000000000000000000000000000000000" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", + "0xce450000000000000000000000000000000000000000" ]; address[numEnvAddressTests] memory expected = [ - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, - 0xcb540000000000000000000000000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce450000000000000000000000000000000000000000 ]; for (uint256 i = 0; i < numEnvAddressTests; ++i) { cheats.setEnv(key, values[i]); @@ -105,12 +105,12 @@ contract EnvTest is DSTest { function testEnvBytes32() public { string memory key = "_foxarCheatcodeEnvBytes32TestKey"; string[numEnvBytes32Tests] memory values = [ - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", "0x00" ]; bytes32[numEnvBytes32Tests] memory expected = [ bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ), bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -129,11 +129,11 @@ contract EnvTest is DSTest { string memory key = "_foxarCheatcodeEnvStringTestKey"; string[numEnvStringTests] memory values = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; string[numEnvStringTests] memory expected = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; for (uint256 i = 0; i < numEnvStringTests; ++i) { cheats.setEnv(key, values[i]); @@ -147,7 +147,7 @@ contract EnvTest is DSTest { function testEnvBytes() public { string memory key = "_foxarCheatcodeEnvBytesTestKey"; string[numEnvBytesTests] memory values = [ - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", "0x00" ]; bytes[] memory expected = new bytes[](numEnvBytesTests); @@ -227,11 +227,11 @@ contract EnvTest is DSTest { function testEnvAddressArr() public { string memory key = "_foxarCheatcodeEnvAddressArrTestKey"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," - "0xcb540000000000000000000000000000000000000000"; + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + "0xce450000000000000000000000000000000000000000"; address[2] memory expected = [ - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, - 0xcb540000000000000000000000000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce450000000000000000000000000000000000000000 ]; cheats.setEnv(key, value); @@ -246,11 +246,11 @@ contract EnvTest is DSTest { function testEnvBytes32Arr() public { string memory key = "_foxarCheatcodeEnvBytes32ArrTestKey"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," "0x00"; bytes32[2] memory expected = [ bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ), bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -270,10 +270,10 @@ contract EnvTest is DSTest { function testEnvStringArr() public { string memory key = "_foxarCheatcodeEnvStringArrTestKey"; string memory value = "hello, world!|" - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; string[2] memory expected = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; cheats.setEnv(key, value); @@ -290,7 +290,7 @@ contract EnvTest is DSTest { function testEnvBytesArr() public { string memory key = "_foxarCheatcodeEnvBytesArrTestKey"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," "0x00"; bytes[] memory expected = new bytes[](numEnvBytesTests); expected[0] = hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D"; @@ -521,12 +521,12 @@ contract EnvTest is DSTest { function testEnvOrAddressKey() public { string memory key = "_foxarCheatcodeEnvOrAddressTestKey"; string[numEnvAddressTests] memory values = [ - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", - "0xcb540000000000000000000000000000000000000000" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", + "0xce450000000000000000000000000000000000000000" ]; address[numEnvAddressTests] memory expected = [ - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, - 0xcb540000000000000000000000000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce450000000000000000000000000000000000000000 ]; for (uint256 i = 0; i < numEnvAddressTests; ++i) { cheats.setEnv(key, values[i]); @@ -538,8 +538,8 @@ contract EnvTest is DSTest { function testEnvOrAddressDefault() public { string memory key = "_foxarCheatcodeEnvOrAddressTestDefault"; address[numEnvAddressTests] memory expected = [ - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, - 0xcb540000000000000000000000000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce450000000000000000000000000000000000000000 ]; for (uint256 i = 0; i < numEnvAddressTests; ++i) { address output = cheats.envOr(key, expected[i]); @@ -550,12 +550,12 @@ contract EnvTest is DSTest { function testEnvOrBytes32Key() public { string memory key = "_foxarCheatcodeEnvOrBytes32TestKey"; string[numEnvBytes32Tests] memory values = [ - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", "0x00" ]; bytes32[numEnvBytes32Tests] memory expected = [ bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ), bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -572,7 +572,7 @@ contract EnvTest is DSTest { string memory key = "_foxarCheatcodeEnvOrBytes32TestDefault"; bytes32[numEnvBytes32Tests] memory expected = [ bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ), bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -588,11 +588,11 @@ contract EnvTest is DSTest { string memory key = "_foxarCheatcodeEnvOrStringTestKey"; string[numEnvStringTests] memory values = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; string[numEnvStringTests] memory expected = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; for (uint256 i = 0; i < numEnvStringTests; ++i) { cheats.setEnv(key, values[i]); @@ -605,7 +605,7 @@ contract EnvTest is DSTest { string memory key = "_foxarCheatcodeEnvOrStringTestDefault"; string[numEnvStringTests] memory expected = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; for (uint256 i = 0; i < numEnvStringTests; ++i) { string memory output = cheats.envOr(key, expected[i]); @@ -616,7 +616,7 @@ contract EnvTest is DSTest { function testEnvOrBytesKey() public { string memory key = "_foxarCheatcodeEnvOrBytesTestKey"; string[numEnvBytesTests] memory values = [ - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", "0x00" ]; bytes[] memory expected = new bytes[](numEnvBytesTests); @@ -800,15 +800,15 @@ contract EnvTest is DSTest { function testEnvOrAddressArrKey() public { string memory key = "_foxarCheatcodeEnvOrAddressArrTestKey"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," - "0xcb540000000000000000000000000000000000000000"; + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + "0xce450000000000000000000000000000000000000000"; address[2] memory expected = [ - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, - 0xcb540000000000000000000000000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce450000000000000000000000000000000000000000 ]; address[] memory defaultValues = new address[](2); - defaultValues[0] = 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; - defaultValues[1] = 0xcb540000000000000000000000000000000000000000; + defaultValues[0] = 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; + defaultValues[1] = 0xce450000000000000000000000000000000000000000; cheats.setEnv(key, value); string memory delimiter = ","; @@ -822,15 +822,15 @@ contract EnvTest is DSTest { function testEnvOrAddressArrDefault() public { string memory key = "_foxarCheatcodeEnvOrAddressArrTestDefault"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," - "0xcb540000000000000000000000000000000000000000"; + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + "0xce450000000000000000000000000000000000000000"; address[2] memory expected = [ - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, - 0xcb540000000000000000000000000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce450000000000000000000000000000000000000000 ]; address[] memory defaultValues = new address[](2); - defaultValues[0] = 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; - defaultValues[1] = 0xcb540000000000000000000000000000000000000000; + defaultValues[0] = 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; + defaultValues[1] = 0xce450000000000000000000000000000000000000000; string memory delimiter = ","; address[] memory output = cheats.envOr(key, delimiter, defaultValues); @@ -843,11 +843,11 @@ contract EnvTest is DSTest { function testEnvOrBytes32ArrKey() public { string memory key = "_foxarCheatcodeEnvOrBytes32ArrTestKey"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," "0x00"; bytes32[2] memory expected = [ bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ), bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -855,7 +855,7 @@ contract EnvTest is DSTest { ]; bytes32[] memory defaultValues = new bytes32[](2); defaultValues[0] = bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ); defaultValues[1] = bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -873,11 +873,11 @@ contract EnvTest is DSTest { function testEnvOrBytes32ArrDefault() public { string memory key = "_foxarCheatcodeEnvOrBytes32ArrTestDefault"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," "0x00"; bytes32[2] memory expected = [ bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ), bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -885,7 +885,7 @@ contract EnvTest is DSTest { ]; bytes32[] memory defaultValues = new bytes32[](2); defaultValues[0] = bytes32( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f800000000000000000000 ); defaultValues[1] = bytes32( 0x0000000000000000000000000000000000000000000000000000000000000000 @@ -903,14 +903,14 @@ contract EnvTest is DSTest { function testEnvOrStringArrKey() public { string memory key = "_foxarCheatcodeEnvOrStringArrTestKey"; string memory value = "hello, world!|" - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; string[2] memory expected = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; string[] memory defaultValues = new string[](2); defaultValues[0] = "hello, world!"; - defaultValues[1] = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + defaultValues[1] = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; cheats.setEnv(key, value); string memory delimiter = "|"; @@ -927,14 +927,14 @@ contract EnvTest is DSTest { function testEnvOrStringArrDefault() public { string memory key = "_foxarCheatcodeEnvOrStringArrTestDefault"; string memory value = "hello, world!|" - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; string[2] memory expected = [ "hello, world!", - "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" + "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8" ]; string[] memory defaultValues = new string[](2); defaultValues[0] = "hello, world!"; - defaultValues[1] = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + defaultValues[1] = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; string memory delimiter = "|"; string[] memory output = cheats.envOr(key, delimiter, defaultValues); @@ -949,7 +949,7 @@ contract EnvTest is DSTest { function testEnvOrBytesArrKey() public { string memory key = "_foxarCheatcodeEnvOrBytesArrTestKey"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," "0x00"; bytes[] memory expected = new bytes[](2); expected[0] = hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D"; @@ -969,7 +969,7 @@ contract EnvTest is DSTest { function testEnvOrBytesArrDefault() public { string memory key = "_foxarCheatcodeEnvOrBytesArrTestDefault"; - string memory value = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," + string memory value = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8," "0x00"; bytes[] memory expected = new bytes[](2); expected[0] = hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D"; diff --git a/testdata/cheats/Etch.t.sol b/testdata/cheats/Etch.t.sol index 9d3ea72b..d65b4635 100644 --- a/testdata/cheats/Etch.t.sol +++ b/testdata/cheats/Etch.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract EtchTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testEtch() public { address target = address(10); diff --git a/testdata/cheats/ExpectCall.t.sol b/testdata/cheats/ExpectCall.t.sol index ccbd38cc..623ec157 100644 --- a/testdata/cheats/ExpectCall.t.sol +++ b/testdata/cheats/ExpectCall.t.sol @@ -47,7 +47,7 @@ contract NestedContract { } contract ExpectCallTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testExpectCallWithData() public { Contract target = new Contract(); @@ -197,7 +197,7 @@ contract ExpectCallTest is DSTest { } contract ExpectCallCountTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testExpectCallCountWithData() public { Contract target = new Contract(); @@ -341,7 +341,7 @@ contract ExpectCallCountTest is DSTest { } contract ExpectCallMixedTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testFailOverrideNoCountWithCount() public { Contract target = new Contract(); diff --git a/testdata/cheats/ExpectEmit.t.sol b/testdata/cheats/ExpectEmit.t.sol index b3995edd..79f4d023 100644 --- a/testdata/cheats/ExpectEmit.t.sol +++ b/testdata/cheats/ExpectEmit.t.sol @@ -76,7 +76,7 @@ contract LowLevelCaller { } contract ExpectEmitTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Emitter emitter; event Something(uint256 indexed topic1, uint256 indexed topic2, uint256 indexed topic3, uint256 data); diff --git a/testdata/cheats/ExpectRevert.t.sol b/testdata/cheats/ExpectRevert.t.sol index f2e0e156..a5617c3c 100644 --- a/testdata/cheats/ExpectRevert.t.sol +++ b/testdata/cheats/ExpectRevert.t.sol @@ -68,7 +68,7 @@ contract Dummy { } contract ExpectRevertTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testExpectRevertString() public { Reverter reverter = new Reverter(); diff --git a/testdata/cheats/Ffi.t.sol b/testdata/cheats/Ffi.t.sol index d9bf19bf..2208b199 100644 --- a/testdata/cheats/Ffi.t.sol +++ b/testdata/cheats/Ffi.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract FfiTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testFfi() public { string[] memory inputs = new string[](3); diff --git a/testdata/cheats/Fork.t.sol b/testdata/cheats/Fork.t.sol index 41cfe075..e7858c6b 100644 --- a/testdata/cheats/Fork.t.sol +++ b/testdata/cheats/Fork.t.sol @@ -15,7 +15,7 @@ contract ForkTest is DSTest { 0xcb19c7acc4c292d2943ba23c2eaa5d9c5a6652a8710c; uint256 constant mainblock = 7582885; - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); IWETH WETH = IWETH(WETH_TOKEN_ADDR); uint256 forkA; diff --git a/testdata/cheats/Fork2.t.sol b/testdata/cheats/Fork2.t.sol index db049598..8d2aa3cf 100644 --- a/testdata/cheats/Fork2.t.sol +++ b/testdata/cheats/Fork2.t.sol @@ -27,33 +27,33 @@ contract MyContract { } contract ForkTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); uint256 mainnetFork; uint256 mainnetDiffFork; - uint256 devinFork; + uint256 mainnetDiff2Fork; // this will create two _different_ forks during setup function setUp() public { mainnetFork = cheats.createFork("rpcAlias"); mainnetDiffFork = cheats.createFork("rpcAlias", block.number - 1); - devinFork = cheats.createFork("https://xcbapi-arch-devin.coreblockchain.net/"); + mainnetDiff2Fork = cheats.createFork("https://xcbapi-arch-mainnet.coreblockchain.net/", block.number - 5); } // ensures forks use different ids function testForkIdDiffer() public { - assert(mainnetFork != devinFork); + assert(mainnetFork != mainnetDiff2Fork); } // ensures forks use different ids function testCanSwitchForks() public { cheats.selectFork(mainnetFork); assertEq(mainnetFork, cheats.activeFork()); - cheats.selectFork(devinFork); - assertEq(devinFork, cheats.activeFork()); - cheats.selectFork(devinFork); - assertEq(devinFork, cheats.activeFork()); + cheats.selectFork(mainnetDiff2Fork); + assertEq(mainnetDiff2Fork, cheats.activeFork()); + cheats.selectFork(mainnetDiff2Fork); + assertEq(mainnetDiff2Fork, cheats.activeFork()); cheats.selectFork(mainnetFork); assertEq(mainnetFork, cheats.activeFork()); } @@ -68,10 +68,10 @@ contract ForkTest is DSTest { cheats.selectFork(mainnetFork); uint256 num = block.number; bytes32 mainHash = blockhash(block.number - 1); - cheats.selectFork(devinFork); + cheats.selectFork(mainnetDiff2Fork); uint256 num2 = block.number; - bytes32 devinHash = blockhash(block.number - 1); - assert(mainHash != devinHash); + bytes32 mainnetDiff2Hash = blockhash(block.number - 1); + assert(mainHash != mainnetDiff2Hash); } // test that we can switch between forks, and "roll" blocks @@ -141,14 +141,14 @@ contract ForkTest is DSTest { uint256 expectedValue = 99; dummy.set(expectedValue); - cheats.selectFork(devinFork); + cheats.selectFork(mainnetDiff2Fork); cheats.selectFork(mainnetFork); assertEq(dummy.val(), expectedValue); cheats.makePersistent(address(dummy)); assert(cheats.isPersistent(address(dummy))); - cheats.selectFork(devinFork); + cheats.selectFork(mainnetDiff2Fork); // the account is now marked as persistent and the contract is persistent across swaps dummy.hello(); assertEq(dummy.val(), expectedValue); diff --git a/testdata/cheats/Fs.t.sol b/testdata/cheats/Fs.t.sol index 1ae51c24..6b11330c 100644 --- a/testdata/cheats/Fs.t.sol +++ b/testdata/cheats/Fs.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract FsTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); bytes constant FOXAR_TOML_ACCESS_ERR = "Access to foxar.toml is not allowed."; bytes constant FOXAR_READ_ERR = diff --git a/testdata/cheats/GasMetering.t.sol b/testdata/cheats/GasMetering.t.sol index a80c0823..4926ef26 100644 --- a/testdata/cheats/GasMetering.t.sol +++ b/testdata/cheats/GasMetering.t.sol @@ -11,7 +11,7 @@ contract B { } contract GasMeteringTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testGasMetering() public { uint256 gas_start = gasleft(); diff --git a/testdata/cheats/GetCode.t.sol b/testdata/cheats/GetCode.t.sol index f05418fe..e7cf423b 100644 --- a/testdata/cheats/GetCode.t.sol +++ b/testdata/cheats/GetCode.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract GetCodeTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testGetCode() public { bytes memory fullPath = cheats.getCode("../testdata/fixtures/GetCode/WorkingContract.json"); diff --git a/testdata/cheats/GetDeployedCode.t.sol b/testdata/cheats/GetDeployedCode.t.sol index 1f2cf5b0..b42f8f03 100644 --- a/testdata/cheats/GetDeployedCode.t.sol +++ b/testdata/cheats/GetDeployedCode.t.sol @@ -5,9 +5,9 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract GetDeployedCodeTest is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); - address public constant overrideAddress = 0xcb720000000000000000000000000000000000000064; + address public constant overrideAddress = 0xce630000000000000000000000000000000000000064; event Payload(address sender, address target, bytes data); diff --git a/testdata/cheats/GetLabel.t.sol b/testdata/cheats/GetLabel.t.sol index 65557011..bb150503 100644 --- a/testdata/cheats/GetLabel.t.sol +++ b/testdata/cheats/GetLabel.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract GetLabelTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testGetLabel() public { // Label an address. diff --git a/testdata/cheats/GetNonce.t.sol b/testdata/cheats/GetNonce.t.sol index 147c9b06..0b86083f 100644 --- a/testdata/cheats/GetNonce.t.sol +++ b/testdata/cheats/GetNonce.t.sol @@ -7,7 +7,7 @@ import "./Cheats.sol"; contract Foo {} contract GetNonceTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testGetNonce() public { uint64 nonce1 = cheats.getNonce(address(this)); diff --git a/testdata/cheats/Json.t.sol b/testdata/cheats/Json.t.sol index cbac9360..ae4a49d5 100644 --- a/testdata/cheats/Json.t.sol +++ b/testdata/cheats/Json.t.sol @@ -6,7 +6,7 @@ import "./Cheats.sol"; import "../logs/console.sol"; contract ParseJson is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); string json; function setUp() public { @@ -50,18 +50,18 @@ contract ParseJson is DSTest { function test_address() public { bytes memory data = cheats.parseJson(json, ".address"); address decodedData = abi.decode(data, (address)); - assertEq(0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c, decodedData); + assertEq(0xce49e5dd06163a480c22d540ec763325a0b5860fb56c, decodedData); } function test_addressArray() public { bytes memory data = cheats.parseJson(json, ".addressArray"); address[] memory decodedData = abi.decode(data, (address[])); assertEq( - 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c, + 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c, decodedData[0] ); assertEq( - 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, + 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8, decodedData[1] ); } @@ -171,7 +171,7 @@ contract ParseJson is DSTest { } contract WriteJson is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); string json1; string json2; @@ -282,7 +282,7 @@ contract WriteJson is DSTest { assertEq(decodedData.b, "test"); // replace a single value to key b - address ex = address(0xcb92000000000000000000000000000000000000beef); + address ex = address(0xce83000000000000000000000000000000000000beef); vm.writeJson(vm.toString(ex), path, ".b"); json = vm.readFile(path); data = vm.parseJson(json, ".b"); diff --git a/testdata/cheats/Label.t.sol b/testdata/cheats/Label.t.sol index fbff7542..e8536c96 100644 --- a/testdata/cheats/Label.t.sol +++ b/testdata/cheats/Label.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract LabelTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testLabel() public { cheats.label(address(1), "Sir Address the 1st"); diff --git a/testdata/cheats/Load.t.sol b/testdata/cheats/Load.t.sol index 3acc6ea6..91df8864 100644 --- a/testdata/cheats/Load.t.sol +++ b/testdata/cheats/Load.t.sol @@ -9,7 +9,7 @@ contract Storage { } contract LoadTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); uint256 slot0 = 20; Storage store; diff --git a/testdata/cheats/Mapping.t.sol b/testdata/cheats/Mapping.t.sol index b41044df..578e9a03 100644 --- a/testdata/cheats/Mapping.t.sol +++ b/testdata/cheats/Mapping.t.sol @@ -19,7 +19,7 @@ contract RecordMapping { } contract RecordMappingTest is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testRecordMapping() public { RecordMapping target = new RecordMapping(); diff --git a/testdata/cheats/MemSafety.t.sol b/testdata/cheats/MemSafety.t.sol index 1fa05d6e..0dac5ae6 100644 --- a/testdata/cheats/MemSafety.t.sol +++ b/testdata/cheats/MemSafety.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract MemSafetyTest is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); //////////////////////////////////////////////////////////////// // MSTORE // diff --git a/testdata/cheats/MockCall.t.sol b/testdata/cheats/MockCall.t.sol index 6835a832..0385efd4 100644 --- a/testdata/cheats/MockCall.t.sol +++ b/testdata/cheats/MockCall.t.sol @@ -43,7 +43,7 @@ contract NestedMock { } contract MockCallTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testMockGetters() public { Mock target = new Mock(); @@ -158,7 +158,7 @@ contract MockCallTest is DSTest { } contract MockCallRevertTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); error TestError(bytes msg); diff --git a/testdata/cheats/Parse.t.sol b/testdata/cheats/Parse.t.sol index 5082db1c..d71e138c 100644 --- a/testdata/cheats/Parse.t.sol +++ b/testdata/cheats/Parse.t.sol @@ -5,12 +5,12 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract ParseTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testParseBytes() public { bytes memory testBytes = hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D"; - string memory stringBytes = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + string memory stringBytes = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; assertEq(testBytes, cheats.parseBytes(stringBytes)); stringBytes = "7109709ECfa91a80626fF3989D68f67F5b1DD12D"; @@ -23,9 +23,9 @@ contract ParseTest is DSTest { } function testParseAddress() public { - address testAddress = 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; + address testAddress = 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; - string memory stringAddress = "0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; + string memory stringAddress = "0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"; assertEq(testAddress, cheats.parseAddress(stringAddress)); stringAddress = "7109709ECfa91a80626fF3989D68f67F5b1DD12D"; diff --git a/testdata/cheats/Prank.t.sol b/testdata/cheats/Prank.t.sol index 3bf134f0..c3a5617e 100644 --- a/testdata/cheats/Prank.t.sol +++ b/testdata/cheats/Prank.t.sol @@ -53,7 +53,7 @@ contract NestedVictim { } contract NestedPranker { - Cheats constant cheats = Cheats(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); + Cheats immutable cheats = Cheats(0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); address newSender; address newOrigin; @@ -86,7 +86,7 @@ contract NestedPranker { } contract PrankTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testPrankSender(address sender) public { // Perform the prank diff --git a/testdata/cheats/ProjectRoot.t.sol b/testdata/cheats/ProjectRoot.t.sol index 48cbd3ee..f2900b8b 100644 --- a/testdata/cheats/ProjectRoot.t.sol +++ b/testdata/cheats/ProjectRoot.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract ProjectRootTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testProjectRoot() public { bytes memory manifestDirBytes = bytes( diff --git a/testdata/cheats/ReadCallers.t.sol b/testdata/cheats/ReadCallers.t.sol index fea05194..dae77c97 100644 --- a/testdata/cheats/ReadCallers.t.sol +++ b/testdata/cheats/ReadCallers.t.sol @@ -9,7 +9,7 @@ contract Target { } contract ReadCallersTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testReadCallersWithNoActivePrankOrBroadcast() public { address expectedSender = msg.sender; diff --git a/testdata/cheats/Record.t.sol b/testdata/cheats/Record.t.sol index a2e45d09..a7098e57 100644 --- a/testdata/cheats/Record.t.sol +++ b/testdata/cheats/Record.t.sol @@ -26,7 +26,7 @@ contract NestedRecordAccess { } contract RecordTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testRecordAccess() public { RecordAccess target = new RecordAccess(); diff --git a/testdata/cheats/RecordLogs.t.sol b/testdata/cheats/RecordLogs.t.sol index 5ed8b9aa..c471570f 100644 --- a/testdata/cheats/RecordLogs.t.sol +++ b/testdata/cheats/RecordLogs.t.sol @@ -49,7 +49,7 @@ contract Emitterv2 { } contract RecordLogsTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Emitter emitter; bytes32 internal seedTestData = keccak256(abi.encodePacked("Some data")); diff --git a/testdata/cheats/Remember.t.sol b/testdata/cheats/Remember.t.sol index 3f05ec3f..f2204f37 100644 --- a/testdata/cheats/Remember.t.sol +++ b/testdata/cheats/Remember.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract RememberTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testRememberKey() public { string memory mnemonic = "test test test test test test test test test test test junk"; @@ -14,6 +14,6 @@ contract RememberTest is DSTest { assertEq(privateKey, 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001); address thisAddress = cheats.rememberKey(privateKey); - assertEq(thisAddress, 0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c); + assertEq(thisAddress, 0xce49e5dd06163a480c22d540ec763325a0b5860fb56c); } } diff --git a/testdata/cheats/ResetNonce.t.sol b/testdata/cheats/ResetNonce.t.sol index 0181eadd..f176e050 100644 --- a/testdata/cheats/ResetNonce.t.sol +++ b/testdata/cheats/ResetNonce.t.sol @@ -11,7 +11,7 @@ contract Foo { } contract ResetNonce is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Foo public fooContract; address barEOA; diff --git a/testdata/cheats/Roll.t.sol b/testdata/cheats/Roll.t.sol index 5a966a81..ac941a4d 100644 --- a/testdata/cheats/Roll.t.sol +++ b/testdata/cheats/Roll.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract RollTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testRoll() public { cheats.roll(10); diff --git a/testdata/cheats/RpcUrls.t.sol b/testdata/cheats/RpcUrls.t.sol index 1221ab14..6ecd6997 100644 --- a/testdata/cheats/RpcUrls.t.sol +++ b/testdata/cheats/RpcUrls.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract RpcUrlTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); // returns the correct url function testCanGetRpcUrl() public { diff --git a/testdata/cheats/SetNonce.t.sol b/testdata/cheats/SetNonce.t.sol index 26ad89fd..e1548e91 100644 --- a/testdata/cheats/SetNonce.t.sol +++ b/testdata/cheats/SetNonce.t.sol @@ -11,7 +11,7 @@ contract Foo { } contract SetNonceTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Foo public foo; function setUp() public { diff --git a/testdata/cheats/SetNonceUnsafe.t.sol b/testdata/cheats/SetNonceUnsafe.t.sol index c4707ccd..7da6606a 100644 --- a/testdata/cheats/SetNonceUnsafe.t.sol +++ b/testdata/cheats/SetNonceUnsafe.t.sol @@ -11,7 +11,7 @@ contract Foo { } contract SetNonceTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Foo public foo; function setUp() public { diff --git a/testdata/cheats/Setup.t.sol b/testdata/cheats/Setup.t.sol index 6b3284a8..f9895e48 100644 --- a/testdata/cheats/Setup.t.sol +++ b/testdata/cheats/Setup.t.sol @@ -11,7 +11,7 @@ contract Victim { } contract CheatsSetupTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Victim victim; function setUp() public { diff --git a/testdata/cheats/Sign.t.sol b/testdata/cheats/Sign.t.sol index 2441e844..122a9128 100644 --- a/testdata/cheats/Sign.t.sol +++ b/testdata/cheats/Sign.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract SignTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testSignDigest(uint248 pk, bytes32 digest) public { cheats.assume(pk != 0); diff --git a/testdata/cheats/Skip.t.sol b/testdata/cheats/Skip.t.sol index b6515311..75f7e13e 100644 --- a/testdata/cheats/Skip.t.sol +++ b/testdata/cheats/Skip.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract SkipTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testSkip() public { cheats.skip(true); diff --git a/testdata/cheats/Snapshots.t.sol b/testdata/cheats/Snapshots.t.sol index 1f85fff6..e370d5e8 100644 --- a/testdata/cheats/Snapshots.t.sol +++ b/testdata/cheats/Snapshots.t.sol @@ -10,7 +10,7 @@ struct Storage { } contract SnapshotTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Storage store; diff --git a/testdata/cheats/Store.t.sol b/testdata/cheats/Store.t.sol index 538506d0..b6e213bc 100644 --- a/testdata/cheats/Store.t.sol +++ b/testdata/cheats/Store.t.sol @@ -10,7 +10,7 @@ contract Storage { } contract StoreTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Storage store; function setUp() public { diff --git a/testdata/cheats/ToString.t.sol b/testdata/cheats/ToString.t.sol index c4716a33..121712c2 100644 --- a/testdata/cheats/ToString.t.sol +++ b/testdata/cheats/ToString.t.sol @@ -5,12 +5,12 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract ToStringTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testAddressToString() public { - address testAddress = 0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; + address testAddress = 0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8; string memory stringAddress = cheats.toString(testAddress); - assertEq("0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", stringAddress); + assertEq("0xce60fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8", stringAddress); } function testBytes32ToString() public { diff --git a/testdata/cheats/Travel.t.sol b/testdata/cheats/Travel.t.sol index cb2971bf..eaadd1bb 100644 --- a/testdata/cheats/Travel.t.sol +++ b/testdata/cheats/Travel.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract ChainIdTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testChainId() public { cheats.chainId(10); diff --git a/testdata/cheats/Warp.t.sol b/testdata/cheats/Warp.t.sol index 5e12efb5..ad1be63d 100644 --- a/testdata/cheats/Warp.t.sol +++ b/testdata/cheats/Warp.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "./Cheats.sol"; contract WarpTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testWarp() public { cheats.warp(10); diff --git a/testdata/core/ContractEnvironment.t.sol b/testdata/core/ContractEnvironment.t.sol index 1cfc1702..5d8aed3a 100644 --- a/testdata/core/ContractEnvironment.t.sol +++ b/testdata/core/ContractEnvironment.t.sol @@ -11,17 +11,16 @@ contract ContractEnvironmentTest is DSTest { } function testAddresses() public { - assertEq(msg.sender, 0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38, "sender account is incorrect"); - assertEq(tx.origin, 0xcb681804c8ab1f12e6bbf3894d4083f33e07309d1f38, "origin account is incorrect"); - assertEq(address(this), 0xcb476378880e80d5d521133bef31fdd84107ee6db2eb, "test contract address is incorrect"); + assertEq(msg.sender, 0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38, "sender account is incorrect"); + assertEq(tx.origin, 0xce591804c8ab1f12e6bbf3894d4083f33e07309d1f38, "origin account is incorrect"); + assertEq(address(this), 0xce37791ef0be909181dd92373777e9ea118e63c1f68a, "test contract address is incorrect"); } function testEnvironment() public { - assertEq(chainId(), 1, "chainid is incorrect"); + assertEq(chainId(), 1337, "chainid is incorrect"); assertEq(block.number, 1, "block number is incorrect"); assertEq(blockhash(block.number), 0x0, "blockhash is incorrect"); - // TODO:error2215 - change address to ican - // assertEq(block.coinbase, address(0x00000000000000000000000000000000000000000000), "coinbase is incorrect"); + assertEq(block.coinbase, address(0xce450000000000000000000000000000000000000000), "coinbase is incorrect"); assertEq(block.timestamp, 1, "timestamp is incorrect"); } } diff --git a/testdata/core/PaymentFailure.t.sol b/testdata/core/PaymentFailure.t.sol index 90c4018f..a549eed4 100644 --- a/testdata/core/PaymentFailure.t.sol +++ b/testdata/core/PaymentFailure.t.sol @@ -9,7 +9,7 @@ contract Payable { } contract PaymentFailureTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); function testCantPay() public { Payable target = new Payable(); diff --git a/testdata/fixtures/broadcast.log.json b/testdata/fixtures/broadcast.log.json index 1b0b5599..7430b3a7 100644 --- a/testdata/fixtures/broadcast.log.json +++ b/testdata/fixtures/broadcast.log.json @@ -114,7 +114,7 @@ "transactionIndex": "0x0", "blockHash": "0x6af7524447b62d80eb4bec9e8879283aca137e9ee38fcd58a820c37885dd7114", "blockNumber": "0x1", - "from": "0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c", + "from": "0xce49e5dd06163a480c22d540ec763325a0b5860fb56c", "to": null, "cumulativeEnergyUsed": "0x140d2", "energyUsed": "0x140d2", @@ -128,7 +128,7 @@ "transactionIndex": "0x0", "blockHash": "0x6908089811f7c18d56e93693613c8fd04e11131d3ede8bf57f7a4e349a8a461a", "blockNumber": "0x2", - "from": "0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c", + "from": "0xce49e5dd06163a480c22d540ec763325a0b5860fb56c", "to": null, "cumulativeEnergyUsed": "0x5eb45", "energyUsed": "0x5eb45", @@ -142,7 +142,7 @@ "transactionIndex": "0x1", "blockHash": "0x6908089811f7c18d56e93693613c8fd04e11131d3ede8bf57f7a4e349a8a461a", "blockNumber": "0x2", - "from": "0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c", + "from": "0xce49e5dd06163a480c22d540ec763325a0b5860fb56c", "to": "0xCb16D7eB4c425440Af9E5d562267Dd707C35f40C7Fe4", "cumulativeEnergyUsed": "0x65563", "energyUsed": "0x6a1e", @@ -171,7 +171,7 @@ "transactionIndex": "0x2", "blockHash": "0x6908089811f7c18d56e93693613c8fd04e11131d3ede8bf57f7a4e349a8a461a", "blockNumber": "0x2", - "from": "0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c", + "from": "0xce49e5dd06163a480c22d540ec763325a0b5860fb56c", "to": null, "cumulativeEnergyUsed": "0xa7b19", "energyUsed": "0x425b6", @@ -185,7 +185,7 @@ "transactionIndex": "0x3", "blockHash": "0x6908089811f7c18d56e93693613c8fd04e11131d3ede8bf57f7a4e349a8a461a", "blockNumber": "0x2", - "from": "0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c", + "from": "0xce49e5dd06163a480c22d540ec763325a0b5860fb56c", "to": null, "cumulativeEnergyUsed": "0x10665e", "energyUsed": "0x5eb45", @@ -199,7 +199,7 @@ "transactionIndex": "0x4", "blockHash": "0x6908089811f7c18d56e93693613c8fd04e11131d3ede8bf57f7a4e349a8a461a", "blockNumber": "0x2", - "from": "0xcb58e5dd06163a480c22d540ec763325a0b5860fb56c", + "from": "0xce49e5dd06163a480c22d540ec763325a0b5860fb56c", "to": "0xCb497EC28Ff2AB69a1114C6433f575902b2695b950c2", "cumulativeEnergyUsed": "0x10d837", "energyUsed": "0x71d9", diff --git a/testdata/fork/ForkSame_1.t.sol b/testdata/fork/ForkSame_1.t.sol index fcd950a7..4f5ee573 100644 --- a/testdata/fork/ForkSame_1.t.sol +++ b/testdata/fork/ForkSame_1.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; contract ForkTest is DSTest { address constant WETH_TOKEN_ADDR = 0xcb19c7acc4c292d2943ba23c2eaa5d9c5a6652a8710c; - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); uint256 forkA; // this will create two _different_ forks during setup diff --git a/testdata/fork/ForkSame_2.t.sol b/testdata/fork/ForkSame_2.t.sol index fcd950a7..4f5ee573 100644 --- a/testdata/fork/ForkSame_2.t.sol +++ b/testdata/fork/ForkSame_2.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; contract ForkTest is DSTest { address constant WETH_TOKEN_ADDR = 0xcb19c7acc4c292d2943ba23c2eaa5d9c5a6652a8710c; - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); uint256 forkA; // this will create two _different_ forks during setup diff --git a/testdata/fork/LaunchFork.t.sol b/testdata/fork/LaunchFork.t.sol index 09e88a8c..84e64aae 100644 --- a/testdata/fork/LaunchFork.t.sol +++ b/testdata/fork/LaunchFork.t.sol @@ -33,7 +33,7 @@ contract ForkTest is DSTest { // checks that we can retrieve the fork we launched with function testActiveFork() public { - Cheats cheatvm = Cheats(HEVM_ADDRESS); + Cheats cheatvm = Cheats(HEVM_ADDRESS()); uint256 activeFork = cheatvm.activeFork(); // launch fork has id `0` assertEq(activeFork, 0); @@ -67,7 +67,7 @@ contract ForkTest is DSTest { ); } function testCheatcode() public { - Cheats cheatvm = Cheats(HEVM_ADDRESS); + Cheats cheatvm = Cheats(HEVM_ADDRESS()); IWETH WETH = IWETH(WETH_TOKEN_ADDR); bytes32 value = bytes32(uint256(1)); // "0xdfb571817f852d91cbe632c0bb6413b44f376a24fe4b9a2fe0b9e8135565aa65" is the slot storing the balance of zero address for the weth contract diff --git a/testdata/fork/Transact.t.sol b/testdata/fork/Transact.t.sol index e37fe970..676bd6f5 100644 --- a/testdata/fork/Transact.t.sol +++ b/testdata/fork/Transact.t.sol @@ -12,7 +12,7 @@ interface IERC20 { } contract TransactOnForkTest is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); IERC20 constant USDT = IERC20(0xcb19c7acc4c292d2943ba23c2eaa5d9c5a6652a8710c); diff --git a/testdata/foundry.toml b/testdata/foundry.toml index 0f65067a..c68a3101 100644 --- a/testdata/foundry.toml +++ b/testdata/foundry.toml @@ -1,6 +1,6 @@ [profile.default] ylem = '1.1.0' -block_coinbase = 'cb540000000000000000000000000000000000000000' +block_coinbase = '0xce450000000000000000000000000000000000000000' block_difficulty = 0 block_number = 0 block_timestamp = 0 @@ -31,12 +31,12 @@ optimizer = true optimizer_runs = 200 out = 'out' remappings = ['ds-test/=lib/ds-test/src/'] -sender = '0xcb5400a329c0648769a73afac7f9381e08fb43dbea72' +sender = '0xce4500a329c0648769a73afac7f9381e08fb43dbea72' sizes = false sparse_mode = false src = 'src' test = 'test' -tx_origin = '0xcb5400a329c0648769a73afac7f9381e08fb43dbea72' +tx_origin = '0xce4500a329c0648769a73afac7f9381e08fb43dbea72' verbosity = 0 via_ir = false fs_permissions = [{ access = "read-write", path = "./" }] diff --git a/testdata/fs/Default.t.sol b/testdata/fs/Default.t.sol index bd50fc65..fcfecf04 100644 --- a/testdata/fs/Default.t.sol +++ b/testdata/fs/Default.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "../cheats/Cheats.sol"; contract DefaultAccessTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); bytes constant FOXAR_WRITE_ERR = 'The path "../testdata/fixtures/File/write_file.txt" is not allowed to be accessed for write operations.'; diff --git a/testdata/fs/Disabled.t.sol b/testdata/fs/Disabled.t.sol index bb5c724b..25458c88 100644 --- a/testdata/fs/Disabled.t.sol +++ b/testdata/fs/Disabled.t.sol @@ -5,7 +5,7 @@ import "ds-test/test.sol"; import "../cheats/Cheats.sol"; contract DisabledTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); bytes constant FOXAR_READ_ERR = 'The path "../testdata/fixtures/File/read.txt" is not allowed to be accessed for read operations.'; bytes constant FOXAR_WRITE_ERR = diff --git a/testdata/fuzz/Fuzz.t.sol b/testdata/fuzz/Fuzz.t.sol index b56a7281..a1042ce1 100644 --- a/testdata/fuzz/Fuzz.t.sol +++ b/testdata/fuzz/Fuzz.t.sol @@ -27,7 +27,7 @@ contract FuzzTest is DSTest { } function testToStringFuzz(bytes32 data) public { - Cheats cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); cheats.toString(data); } } diff --git a/testdata/fuzz/FuzzCollection.t.sol b/testdata/fuzz/FuzzCollection.t.sol index 35def069..848b49db 100644 --- a/testdata/fuzz/FuzzCollection.t.sol +++ b/testdata/fuzz/FuzzCollection.t.sol @@ -6,7 +6,7 @@ import "ds-test/test.sol"; contract SampleContract { uint256 public counter; uint256 public counterX2; - address public owner = address(0xcb92000000000000000000000000000000000000beef); + address public owner = address(0xce83000000000000000000000000000000000000beef); bool public found_needle; event Incremented(uint256 counter); @@ -42,7 +42,7 @@ interface Cheats { } contract SampleContractTest is DSTest { - Cheats hevm = Cheats(HEVM_ADDRESS); + Cheats hevm = Cheats(HEVM_ADDRESS()); event Incremented(uint256 counter); diff --git a/testdata/fuzz/invariant/storage/InvariantStorageTest.t.sol b/testdata/fuzz/invariant/storage/InvariantStorageTest.t.sol index 0337b416..8bfa5352 100644 --- a/testdata/fuzz/invariant/storage/InvariantStorageTest.t.sol +++ b/testdata/fuzz/invariant/storage/InvariantStorageTest.t.sol @@ -3,14 +3,14 @@ pragma solidity >= 1.1.0; import "ds-test/test.sol"; contract Contract { - address public addr = address(0xcb92000000000000000000000000000000000000beef); + address public addr = address(0xce83000000000000000000000000000000000000beef); string public str = "hello"; uint256 public num = 1337; uint256 public pushNum; function changeAddress(address _addr) public { if (_addr == addr) { - addr = address(0xcb540000000000000000000000000000000000000000); + addr = address(0xce450000000000000000000000000000000000000000); } } @@ -41,7 +41,7 @@ contract InvariantStorageTest is DSTest { } function invariantChangeAddress() public { - require(c.addr() == address(0xcb92000000000000000000000000000000000000beef), "changedAddr"); + require(c.addr() == address(0xce83000000000000000000000000000000000000beef), "changedAddr"); } function invariantChangeString() public { diff --git a/testdata/lib/ds-test/src/checksum.sol b/testdata/lib/ds-test/src/checksum.sol new file mode 100644 index 00000000..05b3cee8 --- /dev/null +++ b/testdata/lib/ds-test/src/checksum.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^1.1.0; + +library Checksum { + + function _getChainId() internal view returns (uint8) { + return uint8(block.chainid); + } + + function _getChainPrefix() internal view returns (uint8) { + uint8 chainId = _getChainId(); + if (chainId == 1) { // mainnet - 'cb' + return 203; + } else if (chainId == 3) { // devin network - 'ab' + return 171; + } + return 206; // private network - 'ce' + } + + function toIcan(uint160 rawAddress) internal view returns (address) { + uint8 prefix = _getChainPrefix(); + uint176 value = uint176(rawAddress); + value = (value << 16) + (uint176(prefix) << 8); + uint176 v = value; + uint256 s = 0; + uint256 x = 1; + for (uint i = 0; i < 44; i++) { + uint256 t = v & 0x0f; + s = s + t * x; + x *= 10 + 90 * (t / 10); + v >>= 4; + } + s = s % 97; + s = 98 - s; + s = (s % 10) + (s / 10) * 16; + uint176 result; + result = uint176(rawAddress) + (uint176(s) << 160) + (uint176(prefix) << 168); + return address(result); + } +} \ No newline at end of file diff --git a/testdata/lib/ds-test/src/test.sol b/testdata/lib/ds-test/src/test.sol index b67a3bbe..b169742d 100644 --- a/testdata/lib/ds-test/src/test.sol +++ b/testdata/lib/ds-test/src/test.sol @@ -15,6 +15,8 @@ pragma solidity >=1.1.0; +import {Checksum} from "./checksum.sol"; + contract DSTest { event log(string); event logs(bytes); @@ -38,7 +40,9 @@ contract DSTest { bool public IS_TEST = true; bool public _failed; - address constant HEVM_ADDRESS = address(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); + function HEVM_ADDRESS() public returns (address) { + return Checksum.toIcan(uint160(bytes20(hex"fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"))); + } modifier mayRevert() { _; @@ -54,9 +58,9 @@ contract DSTest { } else { bool globalFailed = false; if (hasHEVMContext()) { - (, bytes memory retdata) = HEVM_ADDRESS.call( + (, bytes memory retdata) = HEVM_ADDRESS().call( abi.encodePacked( - bytes4(keccak256("load(address,bytes32)")), abi.encode(HEVM_ADDRESS, bytes32("failed")) + bytes4(keccak256("load(address,bytes32)")), abi.encode(HEVM_ADDRESS(), bytes32("failed")) ) ); globalFailed = abi.decode(retdata, (bool)); @@ -67,10 +71,10 @@ contract DSTest { function fail() internal { if (hasHEVMContext()) { - (bool status,) = HEVM_ADDRESS.call( + (bool status,) = HEVM_ADDRESS().call( abi.encodePacked( bytes4(keccak256("store(address,bytes32,bytes32)")), - abi.encode(HEVM_ADDRESS, bytes32("failed"), bytes32(uint256(0x01))) + abi.encode(HEVM_ADDRESS(), bytes32("failed"), bytes32(uint256(0x01))) ) ); status; // Silence compiler warnings @@ -78,10 +82,11 @@ contract DSTest { _failed = true; } - function hasHEVMContext() internal view returns (bool) { + function hasHEVMContext() internal returns (bool) { uint256 hevmCodeSize = 0; + address hevm = Checksum.toIcan(uint160(bytes20(hex"fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"))); assembly { - hevmCodeSize := extcodesize(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8) + hevmCodeSize := extcodesize(hevm) } return hevmCodeSize > 0; } diff --git a/testdata/logs/HardhatLogs.t.sol b/testdata/logs/HardhatLogs.t.sol index c1e278dd..f62b0e4e 100644 --- a/testdata/logs/HardhatLogs.t.sol +++ b/testdata/logs/HardhatLogs.t.sol @@ -21,7 +21,7 @@ contract HardhatLogsTest { testInt = -31337; testUint = 1; testBool = false; - testAddr = address(0xcb270000000000000000000000000000000000000001); + testAddr = address(0xce180000000000000000000000000000000000000001); testBytes = "a"; testBytes1 = "a"; } diff --git a/testdata/logs/console.sol b/testdata/logs/console.sol index 3e3b67eb..0d0b84a1 100644 --- a/testdata/logs/console.sol +++ b/testdata/logs/console.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: Unlicense pragma solidity >=1.1.0; -library console { - address constant CONSOLE_ADDRESS = address(0xcb82000000000000000000636f6e736f6c652e6c6f67); +import {Checksum} from "ds-test/checksum.sol"; +library console { function _sendLogPayload(bytes memory payload) private view { uint256 payloadLength = payload.length; - address consoleAddress = CONSOLE_ADDRESS; + address consoleAddress = Checksum.toIcan(uint160(bytes20(hex"000000000000000000636f6e736f6c652e6c6f67"))); assembly { let payloadStart := add(payload, 32) let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) diff --git a/testdata/repros/Issue2623.t.sol b/testdata/repros/Issue2623.t.sol index ff14e45b..6dab648a 100644 --- a/testdata/repros/Issue2623.t.sol +++ b/testdata/repros/Issue2623.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/2623 contract Issue2623Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testRollFork() public { uint256 fork = vm.createFork("rpcAlias", 10); diff --git a/testdata/repros/Issue2629.t.sol b/testdata/repros/Issue2629.t.sol index bf77b548..cabec6ee 100644 --- a/testdata/repros/Issue2629.t.sol +++ b/testdata/repros/Issue2629.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/2629 contract Issue2629Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testSelectFork() public { address coinbase = 0xcb580851379288d0c6b251af9f49988ccca9d6502948; diff --git a/testdata/repros/Issue2723.t.sol b/testdata/repros/Issue2723.t.sol index 81e6e463..d019d1ad 100644 --- a/testdata/repros/Issue2723.t.sol +++ b/testdata/repros/Issue2723.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/2723 contract Issue2723Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testRollFork() public { address coinbase = 0xcb580851379288d0c6b251af9f49988ccca9d6502948; diff --git a/testdata/repros/Issue2898.t.sol b/testdata/repros/Issue2898.t.sol index b120be60..15cb0f5e 100644 --- a/testdata/repros/Issue2898.t.sol +++ b/testdata/repros/Issue2898.t.sol @@ -4,12 +4,13 @@ pragma solidity >=1.1.0; import "ds-test/test.sol"; import "../cheats/Cheats.sol"; import "../logs/console.sol"; +import {Checksum} from "ds-test/checksum.sol"; // https://github.com/foxar-rs/foxar/issues/2898 contract Issue2898Test is DSTest { - address private constant BRIDGE = address(10); - address private constant BENEFICIARY = address(11); - Cheats constant vm = Cheats(HEVM_ADDRESS); + address private BRIDGE = Checksum.toIcan(uint160(bytes20(hex"0000000000000000000000000000000000000010"))); + address private BENEFICIARY = Checksum.toIcan(uint160(bytes20(hex"0000000000000000000000000000000000000011"))); + Cheats vm = Cheats(HEVM_ADDRESS()); function setUp() public { vm.deal(BRIDGE, 100); diff --git a/testdata/repros/Issue2956.t.sol b/testdata/repros/Issue2956.t.sol index 6d3cf539..504db283 100644 --- a/testdata/repros/Issue2956.t.sol +++ b/testdata/repros/Issue2956.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/2956 contract Issue2956Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork1; uint256 fork2; diff --git a/testdata/repros/Issue2984.t.sol b/testdata/repros/Issue2984.t.sol index 9df840f9..3f72553a 100644 --- a/testdata/repros/Issue2984.t.sol +++ b/testdata/repros/Issue2984.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/2984 contract Issue2984Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork; uint256 snapshot; diff --git a/testdata/repros/Issue3055.t.sol b/testdata/repros/Issue3055.t.sol index 99a3385a..89e0ab37 100644 --- a/testdata/repros/Issue3055.t.sol +++ b/testdata/repros/Issue3055.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3055 contract Issue3055Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function test_snapshot() external { uint256 snapId = vm.snapshot(); diff --git a/testdata/repros/Issue3077.t.sol b/testdata/repros/Issue3077.t.sol index 4af976d5..a2dfd858 100644 --- a/testdata/repros/Issue3077.t.sol +++ b/testdata/repros/Issue3077.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3077 abstract contract ZeroState is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); // deployer and users address public deployer = 0xcb1958b39698a44bdae37f881e68dce073823a48a631; diff --git a/testdata/repros/Issue3110.t.sol b/testdata/repros/Issue3110.t.sol index bc3a8340..0230ab34 100644 --- a/testdata/repros/Issue3110.t.sol +++ b/testdata/repros/Issue3110.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3110 abstract contract ZeroState is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); // deployer and users address public deployer = 0xcb1958b39698a44bdae37f881e68dce073823a48a631; diff --git a/testdata/repros/Issue3119.t.sol b/testdata/repros/Issue3119.t.sol index ac01135c..15158e3f 100644 --- a/testdata/repros/Issue3119.t.sol +++ b/testdata/repros/Issue3119.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3119 contract Issue3119Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); address public owner = 0xcb1958b39698a44bdae37f881e68dce073823a48a631; address public alice = 0xcb675ffbdbb79c60f695c9f5b9df2ec16fb8171ee13d; diff --git a/testdata/repros/Issue3190.t.sol b/testdata/repros/Issue3190.t.sol index 7a4f1145..14a97be4 100644 --- a/testdata/repros/Issue3190.t.sol +++ b/testdata/repros/Issue3190.t.sol @@ -7,7 +7,7 @@ import "../logs/console.sol"; // https://github.com/foxar-rs/foxar/issues/3190 contract Issue3190Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function setUp() public { vm.chainId(99); diff --git a/testdata/repros/Issue3192.t.sol b/testdata/repros/Issue3192.t.sol index 8c58f4ef..c1a1fc72 100644 --- a/testdata/repros/Issue3192.t.sol +++ b/testdata/repros/Issue3192.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3192 contract Issue3192Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork1; uint256 fork2; diff --git a/testdata/repros/Issue3220.t.sol b/testdata/repros/Issue3220.t.sol index efbe7580..c2e3cb6d 100644 --- a/testdata/repros/Issue3220.t.sol +++ b/testdata/repros/Issue3220.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3220 contract Issue3220Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork1; uint256 fork2; uint256 counter; diff --git a/testdata/repros/Issue3221.sol b/testdata/repros/Issue3221.sol index c2cad263..8ff44abf 100644 --- a/testdata/repros/Issue3221.sol +++ b/testdata/repros/Issue3221.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3221 contract Issue3221Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork1; uint256 fork2; diff --git a/testdata/repros/Issue3223.sol b/testdata/repros/Issue3223.sol index 7a609249..9fec44d3 100644 --- a/testdata/repros/Issue3223.sol +++ b/testdata/repros/Issue3223.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3223 contract Issue3223Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork1; uint256 fork2; diff --git a/testdata/repros/Issue3596.t.sol b/testdata/repros/Issue3596.t.sol index c34744d2..8e99fc20 100644 --- a/testdata/repros/Issue3596.t.sol +++ b/testdata/repros/Issue3596.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3596 contract Issue3596Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testDealTransfer() public { address addr = vm.addr(1337); diff --git a/testdata/repros/Issue3653.t.sol b/testdata/repros/Issue3653.t.sol index 44fcb8a5..3e2dbe30 100644 --- a/testdata/repros/Issue3653.t.sol +++ b/testdata/repros/Issue3653.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3653 contract Issue3653Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 fork; Token token; diff --git a/testdata/repros/Issue3674.t.sol b/testdata/repros/Issue3674.t.sol index 414fe797..195421b7 100644 --- a/testdata/repros/Issue3674.t.sol +++ b/testdata/repros/Issue3674.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3674 contract Issue3674Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testNonceCreateSelect() public { vm.createSelectFork( diff --git a/testdata/repros/Issue3685.t.sol b/testdata/repros/Issue3685.t.sol index 6347cbea..aa5f5d05 100644 --- a/testdata/repros/Issue3685.t.sol +++ b/testdata/repros/Issue3685.t.sol @@ -7,7 +7,7 @@ import "../logs/console.sol"; // https://github.com/foxar-rs/foxar/issues/3685 contract Issue3685Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); Actor a; Actor b; diff --git a/testdata/repros/Issue3703.t.sol b/testdata/repros/Issue3703.t.sol index 05e6c37a..a5f7bd16 100644 --- a/testdata/repros/Issue3703.t.sol +++ b/testdata/repros/Issue3703.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3703 contract Issue3703Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function setUp() public { uint256 fork = vm.createSelectFork( diff --git a/testdata/repros/Issue3708.sol b/testdata/repros/Issue3708.sol index 53529c7a..90a7a51e 100644 --- a/testdata/repros/Issue3708.sol +++ b/testdata/repros/Issue3708.sol @@ -9,7 +9,7 @@ contract Issue3708Test is DSTest { // https://optimistic.etherscan.io/address/0xcb063edadf999cb7b8b3ebc71f5e97783176d289d640#code address constant CREATE2_DEPLOYER = 0xcb063edadf999cb7b8b3ebc71f5e97783176d289d640; - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function setUp() public { string memory RPC_URL = "rpcAlias"; diff --git a/testdata/repros/Issue3753.t.sol b/testdata/repros/Issue3753.t.sol index 9a0e0adf..91901ad1 100644 --- a/testdata/repros/Issue3753.t.sol +++ b/testdata/repros/Issue3753.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/3753 contract Issue3753Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function test_repro() public { bool res; diff --git a/testdata/repros/Issue4586.t.sol b/testdata/repros/Issue4586.t.sol index 9297296d..5b2ce101 100644 --- a/testdata/repros/Issue4586.t.sol +++ b/testdata/repros/Issue4586.t.sol @@ -3,10 +3,11 @@ pragma solidity >=1.1.0; import "ds-test/test.sol"; import "../cheats/Cheats.sol"; +import {Checksum} from "ds-test/checksum.sol"; // https://github.com/foxar-rs/foxar/issues/4586 contract Issue4586Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); uint256 constant initialBlock = 7627734; @@ -31,9 +32,8 @@ contract Issue4586Test is DSTest { } contract InvariantHandler { - address constant HEVM_ADDRESS = - address(0xcb69fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8); - Cheats constant vm = Cheats(HEVM_ADDRESS); + address HEVM_ADDRESS = Checksum.toIcan(uint160(bytes20(hex"fc06a12b7a6f30e2a3c16a3b5d502cd71c20f2f8"))); + Cheats vm = Cheats(HEVM_ADDRESS); uint256 public calledRollFork; diff --git a/testdata/repros/Issue4630.t.sol b/testdata/repros/Issue4630.t.sol index 64d04a58..d19e1972 100644 --- a/testdata/repros/Issue4630.t.sol +++ b/testdata/repros/Issue4630.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/4630 contract Issue4630Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testExistingValue() public { string memory path = "../testdata/fixtures/Json/Issue4630.json"; diff --git a/testdata/repros/Issue4640.t.sol b/testdata/repros/Issue4640.t.sol index 2e68af4e..7a381f14 100644 --- a/testdata/repros/Issue4640.t.sol +++ b/testdata/repros/Issue4640.t.sol @@ -6,7 +6,7 @@ import "../cheats/Cheats.sol"; // https://github.com/foxar-rs/foxar/issues/4640 contract Issue4640Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testArbitrumBlockNumber() public { // diff --git a/testdata/repros/Issue5038.t.sol b/testdata/repros/Issue5038.t.sol index c5f312b9..e0e632bf 100644 --- a/testdata/repros/Issue5038.t.sol +++ b/testdata/repros/Issue5038.t.sol @@ -10,7 +10,7 @@ struct Value { // https://github.com/foxar-rs/foxar/issues/5038 contract Issue5038Test is DSTest { - Cheats constant vm = Cheats(HEVM_ADDRESS); + Cheats vm = Cheats(HEVM_ADDRESS()); function testParseMaxUint64() public { string memory json = '{"value": 18446744073709551615}'; diff --git a/testdata/script/broadcast/deploy.sol/31337/run-latest.json b/testdata/script/broadcast/deploy.sol/31337/run-latest.json index 83f814e1..63754d5a 100644 --- a/testdata/script/broadcast/deploy.sol/31337/run-latest.json +++ b/testdata/script/broadcast/deploy.sol/31337/run-latest.json @@ -9,7 +9,7 @@ "arguments": null, "transaction": { "type": "0x02", - "from": "0xcb5400a329c0648769a73afac7f9381e08fb43dbea72", + "from": "0xce4500a329c0648769a73afac7f9381e08fb43dbea72", "gas": "0x54653", "value": "0x0", "data": "0x608060405234801561001057600080fd5b506103d9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063d5dcf1271461003b578063f8194e4814610050575b600080fd5b61004e6100493660046100e9565b600155565b005b61006361005e366004610118565b610079565b60405161007091906101f9565b60405180910390f35b6060600061008783826102b5565b5060008260405160200161009b9190610375565b60405160208183030381529060405290507fefdeaaf566f7751d16a12c7fa8909eb74120f42cba334d07dd5246c48f1fba81816040516100db91906101f9565b60405180910390a192915050565b6000602082840312156100fb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561012a57600080fd5b813567ffffffffffffffff8082111561014257600080fd5b818401915084601f83011261015657600080fd5b81358181111561016857610168610102565b604051601f8201601f19908116603f0116810190838211818310171561019057610190610102565b816040528281528760208487010111156101a957600080fd5b826020860160208301376000928101602001929092525095945050505050565b60005b838110156101e45781810151838201526020016101cc565b838111156101f3576000848401525b50505050565b60208152600082518060208401526102188160408501602087016101c9565b601f01601f19169190910160400192915050565b600181811c9082168061024057607f821691505b60208210810361026057634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156102b057600081815260208120601f850160051c8101602086101561028d5750805b601f850160051c820191505b818110156102ac57828155600101610299565b5050505b505050565b815167ffffffffffffffff8111156102cf576102cf610102565b6102e3816102dd845461022c565b84610266565b602080601f83116001811461031857600084156103005750858301515b600019600386901b1c1916600185901b1785556102ac565b600085815260208120601f198616915b8281101561034757888601518255948401946001909101908401610328565b50858210156103655787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6502432b63637960d51b8152600082516103968160068501602087016101c9565b919091016006019291505056fea2646970667358221220a380cb042b6ca762a5a0f97e497c4cffa21c45dc21e2dab4107e5415921a704a64736f6c634300080f0033", @@ -26,7 +26,7 @@ "arguments": null, "transaction": { "type": "0x02", - "from": "0xcb5400a329c0648769a73afac7f9381e08fb43dbea72", + "from": "0xce4500a329c0648769a73afac7f9381e08fb43dbea72", "to": "0x731a10897d267e19b34503ad902d0a29173ba4b1", "gas": "0xef15", "value": "0x0", @@ -44,7 +44,7 @@ "arguments": null, "transaction": { "type": "0x02", - "from": "0xcb5400a329c0648769a73afac7f9381e08fb43dbea72", + "from": "0xce4500a329c0648769a73afac7f9381e08fb43dbea72", "to": "0x731a10897d267e19b34503ad902d0a29173ba4b1", "gas": "0xdcde", "value": "0x0", diff --git a/testdata/script/deploy.sol b/testdata/script/deploy.sol index d0642ed5..44a7ec0f 100644 --- a/testdata/script/deploy.sol +++ b/testdata/script/deploy.sol @@ -23,7 +23,7 @@ contract Greeter { } contract Deploy is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats cheats = Cheats(HEVM_ADDRESS()); Greeter greeter; string greeting; diff --git a/testdata/trace/Trace.t.sol b/testdata/trace/Trace.t.sol index 40ba9f35..c5902438 100644 --- a/testdata/trace/Trace.t.sol +++ b/testdata/trace/Trace.t.sol @@ -52,7 +52,7 @@ contract RecursiveCall { } contract TraceTest is DSTest { - Cheats constant cheats = Cheats(HEVM_ADDRESS); + Cheats immutable cheats = Cheats(HEVM_ADDRESS()); uint256 nodeId = 0; RecursiveCall first; diff --git a/utils/src/lib.rs b/utils/src/lib.rs index 0cca0baf..3f988cf3 100644 --- a/utils/src/lib.rs +++ b/utils/src/lib.rs @@ -561,7 +561,7 @@ mod tests { } Ok(()) }, - Network::Mainnet, + Network::Private(1337), ) .unwrap(); }