From 5217be4d51888ba286e76038eab2f84c85875eb3 Mon Sep 17 00:00:00 2001 From: Waylon Jepsen Date: Thu, 5 Oct 2023 11:30:14 -0600 Subject: [PATCH 1/3] migrate to arbiter pre/release --- Cargo.lock | 546 ++++++++++++++++++++++++++++++------------------- Cargo.toml | 6 +- src/main.rs | 172 +--------------- src/startup.rs | 129 ++++++++++++ 4 files changed, 470 insertions(+), 383 deletions(-) create mode 100644 src/startup.rs diff --git a/Cargo.lock b/Cargo.lock index 0b9f49e..da05be5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "RustQuant" -version = "0.0.26" +version = "0.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13294fafd173b18b3b52fd5875b8f614ad67bbdac209a0edd4fcff6e5c669504" +checksum = "84970223b57583fa73cd306e359c71d762b4fdbcd059a69af1c44b35075849ff" dependencies = [ "nalgebra 0.32.3", "ndarray", @@ -30,6 +30,7 @@ dependencies = [ "serde", "serde_json", "statrs", + "thiserror", "time 0.3.25", "yahoo_finance_api", ] @@ -80,11 +81,17 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "alloy-primitives" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e416903084d3392ebd32d94735c395d6709415b76c7728e594d3f996f2b03e65" +checksum = "6b4084879b7257d5b95b9009837c07a1868bd7d60e66418a7764b9b580ae64e0" dependencies = [ "alloy-rlp", "bytes", @@ -94,6 +101,7 @@ dependencies = [ "hex-literal", "itoa", "proptest", + "rand", "ruint", "serde", "tiny-keccak", @@ -112,10 +120,11 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7720130c58db647103587b0c39aad4e669eea261e256040301d6c7983fdbb461" +checksum = "de84480ac5979d8513164f7e668f837839cd6d5c4bdb8beecbb8cf062b61cb48" dependencies = [ + "const-hex", "dunce", "heck", "proc-macro2", @@ -127,9 +136,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaa7c9a4354b1ff9f1c85adf22802af046e20e4bb55e19b9dc6ca8cbc6f7f4e5" +checksum = "fa7e42aa2983db6676af5d762bc8d9371dd74f5948739790d3080c3d652a957b" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -169,9 +178,8 @@ dependencies = [ [[package]] name = "arbiter-core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6cfe5f6230489056bdf5377268ec3d7ed188d0f54c5d07531ad540d60235bff" +version = "0.5.3" +source = "git+https://github.com/primitivefinance/arbiter.git?branch=arbiter/version#1dbe1d855a03f77673e0073519212c0218fd5ce4" dependencies = [ "RustQuant", "async-trait", @@ -179,141 +187,21 @@ dependencies = [ "bytes", "crossbeam-channel", "ethers", + "futures-locks", "futures-timer", "futures-util", "log", "rand", "rand_distr", "revm", + "revm-primitives", "serde", "serde_json", "statrs", "thiserror", "tokio", -] - -[[package]] -name = "ark-ff" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" -dependencies = [ - "ark-ff-asm 0.3.0", - "ark-ff-macros 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", - "derivative", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.3.3", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm 0.4.2", - "ark-ff-macros 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "digest 0.10.7", - "itertools 0.10.5", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.4.0", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" -dependencies = [ - "num-bigint", - "num-traits", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-serialize" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" -dependencies = [ - "ark-std 0.3.0", - "digest 0.9.0", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-std 0.4.0", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-std" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" -dependencies = [ - "num-traits", - "rand", -] - -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand", + "tracing", + "tracing-test", ] [[package]] @@ -445,6 +333,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags 2.4.0", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.29", + "which", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -471,6 +382,9 @@ name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -490,6 +404,7 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium 0.7.0", + "serde", "tap", "wyz", ] @@ -512,6 +427,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blst" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "bs58" version = "0.4.0" @@ -547,9 +474,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" dependencies = [ "serde", ] @@ -575,6 +502,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "c-kzg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac926d808fb72fe09ebf471a091d6d72918876ccf0b4989766093d2d0d24a0ef" +dependencies = [ + "bindgen", + "blst", + "cc", + "glob", + "hex", + "libc", + "serde", +] + [[package]] name = "camino" version = "1.1.6" @@ -617,6 +559,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -648,6 +599,17 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading 0.7.4", +] + [[package]] name = "cmake" version = "0.1.50" @@ -672,7 +634,7 @@ dependencies = [ "k256", "lazy_static", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", ] @@ -689,7 +651,7 @@ dependencies = [ "once_cell", "pbkdf2 0.12.2", "rand", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", ] @@ -708,7 +670,7 @@ dependencies = [ "ripemd", "serde", "serde_derive", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "thiserror", ] @@ -927,17 +889,6 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -1044,7 +995,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.0", ] [[package]] @@ -1195,7 +1146,7 @@ dependencies = [ "scrypt", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "thiserror", "uuid", @@ -1459,7 +1410,7 @@ dependencies = [ "eth-keystore", "ethers-core", "rand", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "tracing", ] @@ -1512,17 +1463,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" -[[package]] -name = "fastrlp" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", -] - [[package]] name = "fdeflate" version = "0.3.0" @@ -1741,6 +1681,7 @@ checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" dependencies = [ "futures-channel", "futures-task", + "tokio", ] [[package]] @@ -1899,19 +1840,15 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ "ahash", + "allocator-api2", + "serde", ] -[[package]] -name = "hashbrown" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" - [[package]] name = "hashers" version = "1.0.1" @@ -1938,6 +1875,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hex-literal" @@ -2268,7 +2208,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.7", + "sha2 0.10.8", "signature", ] @@ -2318,12 +2258,28 @@ dependencies = [ "spin", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "libloading" version = "0.8.0" @@ -2342,9 +2298,9 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" [[package]] name = "lock_api" @@ -2394,6 +2350,15 @@ dependencies = [ "xml5ever", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matrixmultiply" version = "0.3.7" @@ -2440,6 +2405,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -2542,6 +2513,26 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num" version = "0.4.1" @@ -2702,6 +2693,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parity-scale-codec" version = "3.6.4" @@ -2802,7 +2799,7 @@ dependencies = [ "digest 0.10.7", "hmac", "password-hash", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -2815,6 +2812,12 @@ dependencies = [ "hmac", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "pem" version = "1.1.1" @@ -3287,10 +3290,19 @@ checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick", "memchr", - "regex-automata", + "regex-automata 0.3.6", "regex-syntax 0.7.4", ] +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + [[package]] name = "regex-automata" version = "0.3.6" @@ -3355,62 +3367,71 @@ dependencies = [ [[package]] name = "revm" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f293f351c4c203d321744e54ed7eed3d2b6eef4c140228910dde3ac9a5ea8031" +checksum = "e900c20133db0f4c3899a3e5b3cea15f2bf6bbfd1b5bf9c44951f9a1091b09e2" dependencies = [ "auto_impl", "revm-interpreter", "revm-precompile", + "serde", + "serde_json", ] [[package]] name = "revm-interpreter" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53980a26f9b5a66d13511c35074d4b53631e157850a1d7cf1af4efc2c2b72c9" +checksum = "ae1d56c862639956df08058dc54dfbccf60285997ae2ee8fcbef39de925b8e4c" dependencies = [ "derive_more", "enumn", "revm-primitives", + "serde", "sha3", ] [[package]] name = "revm-precompile" -version = "2.0.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41320af3bd6a65153d38eb1d3638ba89104cc9513c7feedb2d8510e8307dab29" +checksum = "d1db3a1151564d191af255d97e4c06dfc0b7c175dfd4b87b58a139eff99c2c12" dependencies = [ + "c-kzg", + "hex", "k256", "num", "once_cell", "revm-primitives", "ripemd", "secp256k1", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "substrate-bn", ] [[package]] name = "revm-primitives" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "304d998f466ffef72d76c7f20b05bf08a96801736a6fb1fdef47d49a292618df" +checksum = "b63c77c2dc1ff8b5de7d33085ac8836f36f6cc9ba0f8d086f2d9ecee7852dafc" dependencies = [ "auto_impl", + "bitflags 2.4.0", "bitvec 1.0.1", "bytes", + "c-kzg", "derive_more", "enumn", "fixed-hash", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "hex", "hex-literal", + "once_cell", "primitive-types", "rlp", "ruint", + "serde", "sha3", ] @@ -3476,13 +3497,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95294d6e3a6192f3aabf91c38f56505a625aa495533442744185a36d75a790c4" dependencies = [ - "alloy-rlp", - "ark-ff 0.3.0", - "ark-ff 0.4.2", - "bytes", - "fastrlp", - "num-bigint", - "parity-scale-codec", "primitive-types", "proptest", "rand", @@ -3505,6 +3519,12 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -3531,9 +3551,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" dependencies = [ "bitflags 2.4.0", "errno", @@ -3673,7 +3693,7 @@ dependencies = [ "hmac", "pbkdf2 0.11.0", "salsa20", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -3770,9 +3790,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.185" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -3790,9 +3810,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.185" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc59dfdcbad1437773485e0367fea4b090a2e0a16d9ffc46af47764536a298ec" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -3801,10 +3821,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -3857,9 +3878,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3876,6 +3897,21 @@ dependencies = [ "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -4128,7 +4164,7 @@ dependencies = [ "semver 1.0.18", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "url", "zip", @@ -4158,9 +4194,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397f229dc34c7b8231b6ef85502f9ca4e3425b8625e6d403bb74779e6b1917b5" +checksum = "1b8a5a633f1172a0c80b1516a988e7e8efa7ce9cededf56590f54e593e4513b3" dependencies = [ "paste", "proc-macro2", @@ -4211,24 +4247,43 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", "syn 2.0.29", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.1.45" @@ -4431,6 +4486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", + "valuable", ] [[package]] @@ -4443,6 +4499,58 @@ dependencies = [ "tracing", ] +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec 1.11.0", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "tracing-test" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a2c0ff408fe918a94c428a3f2ad04e4afd5c95bbc08fcf868eff750c15728a4" +dependencies = [ + "lazy_static", + "tracing-core", + "tracing-subscriber", + "tracing-test-macro", +] + +[[package]] +name = "tracing-test-macro" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bc1c4f8e2e73a977812ab339d503e6feeb92700f6d07a6de4d321522d5c08" +dependencies = [ + "lazy_static", + "quote", + "syn 1.0.109", +] + [[package]] name = "try-lock" version = "0.2.4" @@ -4714,6 +4822,18 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "wide" version = "0.7.11" diff --git a/Cargo.toml b/Cargo.toml index c511bc3..d971b75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -arbiter-core = { version = "0.5.0" } +arbiter-core = { git = "https://github.com/primitivefinance/arbiter.git", branch = "arbiter/version" } tokio = { version = "1.11.0", features = ["full"] } ethers = { version = "2.0.10" } revm = { version = "3.3.0" } @@ -15,5 +15,5 @@ num-bigint = "0.4" thiserror = "1.0" foundry-contracts = { path = "src/bindings" } -alloy-primitives = "0.3.3" -alloy-sol-types = "0.3.2" \ No newline at end of file +alloy-primitives = "0.4.0" +alloy-sol-types = "0.4.0" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index d693bc2..19d3000 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,16 @@ use alloy_primitives::U256; use alloy_sol_types::{self, sol}; use anyhow::Result; -use arbiter_core::{ - environment::EnvironmentParameters, - environment::{BlockSettings, GasSettings}, - manager::Manager, - middleware::RevmMiddleware, -}; +use arbiter_core::middleware::RevmMiddleware; use ethers::types::U256 as eU256; -use ethers::core::types::Bytes; use ethers::utils::keccak256 as ekeccak256; use foundry_contracts::{ alphabet_vm::AlphabetVM, - dispute_game_factory, + block_oracle::block_oracle::BlockOracle, l2_output_oracle::l2_output_oracle::L2OutputOracle, - proxy::proxy::Proxy, }; use std::{error::Error, sync::Arc}; +mod startup; const ENV_LABEL: &str = "OPTIMISM_FRAUD_PROOF"; const SUBMISSION_INTERVAL: f64 = 1800.0; @@ -33,168 +27,12 @@ const FINALIZATION_PERIOD_SECONDS: f64 = 7.0; #[tokio::main] pub async fn main() -> Result<(), Box> { - let (mut _manager, admin, _alice, _bob, _multisig) = set_up().await?; - - // deploy proxy from admin - let proxy = Proxy::deploy(admin.clone(), admin.address())? - .send() - .await?; - - println!("Proxy address: {}", proxy.address()); - - let sub_interval = eU256::from(SUBMISSION_INTERVAL as u64); - let l2_block_time = eU256::from(L2_BLOCK_TIME as u64); - let finalization_period = eU256::from(FINALIZATION_PERIOD_SECONDS as u64); - - println!(" {:?}", proxy.methods.values()); - // Constructor is not defined in abi - let l2_output_oracle = L2OutputOracle::deploy( - admin.clone(), - (sub_interval, l2_block_time, finalization_period), - )? - .send() - .await?; - - println!("L2OutputOracle address: {}", l2_output_oracle.address()); - - let factory = dispute_game_factory::DisputeGameFactory::deploy(admin.clone(), ())? - .send() - .await?; - println!("Factory address: {}", factory.address()); - - let game_type: u8 = 0; // replace with the actual game type - - - sol! { - type MyValueType is uint256; - } - - // UDTs are encoded as their underlying type - let mvt = MyValueType::from(U256::from(1)); - // let data: U256 = "0x0000000000000000000000000000000000000000000000000000000000000001".parse().unwrap(); - let root_claim = ekeccak256(mvt.encode_single()); // replace with the actual root claim - let _extra_data: Bytes = vec![1, 2, 3].into(); // replace with the actual extra data - - let alphabet_vm = AlphabetVM::deploy(admin.clone(), root_claim)? - .send() - .await?; - - println!("AlphabetVM address: {}", alphabet_vm.address()); - - let binding = factory - .create( - game_type, - root_claim, - _extra_data - ); - let output = binding - .send() - .await?; - println!("New game: {:?}", output); - - // let destructure = + let (mut _manager, admin, _alice, _bob, _multisig) = startup::set_up_agents().await?; + let _contracts = startup::deploy_contracts(admin).await?; Ok(()) } -async fn set_up() -> Result<( - Manager, - Arc, - Arc, - Arc, - Arc, -)> { - let mut manager = Manager::new(); - let _ = manager.add_environment(EnvironmentParameters { - label: ENV_LABEL.to_owned(), - block_settings: BlockSettings::UserControlled, - gas_settings: GasSettings::UserControlled, - }); - let _ = manager.start_environment(ENV_LABEL); - let alice = Arc::new(RevmMiddleware::new( - manager.environments.get(ENV_LABEL).unwrap(), - None, - )?); - - let bob = Arc::new(RevmMiddleware::new( - manager.environments.get(ENV_LABEL).unwrap(), - None, - )?); - - let multisig = Arc::new(RevmMiddleware::new( - manager.environments.get(ENV_LABEL).unwrap(), - None, - )?); - - let admin = Arc::new(RevmMiddleware::new( - manager.environments.get(ENV_LABEL).unwrap(), - None, - )?); - - println!("admin at address {}", admin.address()); - println!("alice at address {}", alice.address()); - println!("bob at address {}", bob.address()); - println!("multisig at address {}", multisig.address()); - - alice - .deal(alice.address(), ethers::types::U256::from(1 << 16)) - .await - .unwrap(); - bob.deal(bob.address(), ethers::types::U256::from(1 << 16)) - .await - .unwrap(); - multisig - .deal(multisig.address(), ethers::types::U256::from(1 << 16)) - .await - .unwrap(); - Ok((manager, admin, alice, bob, multisig)) -} - -// in DisputeGameFactory.t.sol -// function setUp() public virtual override { -// super.setUp(); // Calls the function below - -// Proxy proxy = new Proxy(address(this)); -// DisputeGameFactory impl = new DisputeGameFactory(); - -// proxy.upgradeToAndCall({ -// _implementation: address(impl), -// _data: abi.encodeCall(impl.initialize, (address(this))) -// }); -// factory = DisputeGameFactory(address(proxy)); -// vm.label(address(factory), "DisputeGameFactoryProxy"); - -// fakeClone = new FakeClone(); -// } - -// which is define here in L -// function setUp() public virtual override { -// super.setUp(); -// guardian = makeAddr("guardian"); - -// // By default the first block has timestamp and number zero, which will cause underflows in the -// // tests, so we'll move forward to these block values. -// initL1Time = startingTimestamp + 1; -// vm.warp(initL1Time); -// vm.roll(startingBlockNumber); -// // Deploy the L2OutputOracle and transfer owernship to the proposer -// oracleImpl = new L2OutputOracle({ -// _submissionInterval: submissionInterval, -// _l2BlockTime: l2BlockTime, -// _finalizationPeriodSeconds: finalizationPeriodSeconds -// }); -// Proxy proxy = new Proxy(multisig); -// vm.prank(multisig); -// proxy.upgradeToAndCall( -// address(oracleImpl), -// abi.encodeCall(L2OutputOracle.initialize, (startingBlockNumber, startingTimestamp, proposer, owner)) -// ); -// oracle = L2OutputOracle(address(proxy)); -// vm.label(address(oracle), "L2OutputOracle"); -// // Set the L2ToL1MessagePasser at the correct address -// vm.etch(Predeploys.L2_TO_L1_MESSAGE_PASSER, address(new L2ToL1MessagePasser()).code); -// vm.label(Predeploys.L2_TO_L1_MESSAGE_PASSER, "L2ToL1MessagePasser"); -// } diff --git a/src/startup.rs b/src/startup.rs new file mode 100644 index 0000000..91f5e54 --- /dev/null +++ b/src/startup.rs @@ -0,0 +1,129 @@ +use arbiter_core::environment::{self, builder::EnvironmentBuilder, cheatcodes::Cheatcodes, Environment}; + +use super::*; + +// pub async fn initialize() -> Result<()> { +// let (mut _manager, admin, _alice, _bob, _multisig) = startup::set_up().await?; + +// todo!() +// } + +/// All the possible contracts that this simulation will actively use, but not +/// all that are deployed! +/// Each is bound to a `Client` and can be used to interact with the contract. +/// The client in this case will be the admin. +#[derive(Clone, Debug)] +pub struct SimulationContracts { + /// The `L2OutputOracle` contract. + pub l2_output_oracle: L2OutputOracle, + + /// The `BlockOracle` contract. + pub block_oracle: BlockOracle, + + /// The `AlphabetVM` contract. + pub alphabet_vm: AlphabetVM, +} + +pub async fn set_up_agents() -> Result<( + Environment, + Arc, + Arc, + Arc, + Arc, +)> { + let environment = EnvironmentBuilder::new().build(); + + let alice = RevmMiddleware::new( + &environment, + Some(ENV_LABEL)).unwrap(); + + let bob = RevmMiddleware::new( + &environment, + Some(ENV_LABEL)).unwrap(); + + let multisig = RevmMiddleware::new( + &environment, + Some(ENV_LABEL)).unwrap(); + + let admin = RevmMiddleware::new( + &environment, + Some(ENV_LABEL)).unwrap(); + + println!("admin at address {}", admin.address()); + println!("alice at address {}", alice.address()); + println!("bob at address {}", bob.address()); + println!("multisig at address {}", multisig.address()); + + alice.apply_cheatcode(Cheatcodes::Deal { + address: alice.address(), + amount: U256::MAX.into(), + }) + .await + .unwrap(); + bob.apply_cheatcode(Cheatcodes::Deal { + address: bob.address(), + amount: U256::MAX.into(), + }) + .await + .unwrap(); + multisig.apply_cheatcode(Cheatcodes::Deal { + address: multisig.address(), + amount: U256::MAX.into(), + }) + .await + .unwrap(); + Ok((environment, admin, alice, bob, multisig)) +} + +pub async fn deploy_contracts(admin: Arc) -> Result { + let sub_interval = eU256::from(SUBMISSION_INTERVAL as u64); + let l2_block_time = eU256::from(L2_BLOCK_TIME as u64); + let finalization_period = eU256::from(FINALIZATION_PERIOD_SECONDS as u64); + + let l2_output_oracle = L2OutputOracle::deploy( + admin.clone(), + (sub_interval, l2_block_time, finalization_period), + )? + .send() + .await?; + println!("L2OutputOracle address: {}", l2_output_oracle.address()); + + + let block_oracle = BlockOracle::deploy(admin.clone(), ())? + .send() + .await?; + + println!("BlockOracle address: {}", block_oracle.address()); + + + sol! { + type MyValueType is uint256; + } + + // UDTs are encoded as their underlying type + let mvt = MyValueType::from(U256::from(1)); + // let data: U256 = "0x0000000000000000000000000000000000000000000000000000000000000001".parse().unwrap(); + let root_claim = ekeccak256(mvt.encode_single()); // replace with the actual root claim + + let alphabet_vm = AlphabetVM::deploy(admin.clone(), root_claim)? + .send() + .await?; + + println!("AlphabetVM address: {}", alphabet_vm.address()); + + // deploy the dispute game + // need: + // GameType _gameType, + // Claim _absolutePrestate, + // uint256 _maxGameDepth, + // Duration _gameDuration, + // Have: + // IBigStepper _vm, + // L2OutputOracle _l2oo, + // BlockOracle _blockOracle + + Ok(SimulationContracts { + l2_output_oracle, + block_oracle, + alphabet_vm,}) +} \ No newline at end of file From ac0565584c763dbaa29ad48050c99ce1d73f82d4 Mon Sep 17 00:00:00 2001 From: Waylon Jepsen Date: Thu, 5 Oct 2023 15:21:08 -0600 Subject: [PATCH 2/3] migrate to new version of arbtier --- src/startup.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/startup.rs b/src/startup.rs index 91f5e54..de537e1 100644 --- a/src/startup.rs +++ b/src/startup.rs @@ -31,23 +31,23 @@ pub async fn set_up_agents() -> Result<( Arc, Arc, )> { - let environment = EnvironmentBuilder::new().build(); + let environment = EnvironmentBuilder::new().label(ENV_LABEL).build(); let alice = RevmMiddleware::new( &environment, - Some(ENV_LABEL)).unwrap(); + Some("0")).unwrap(); let bob = RevmMiddleware::new( &environment, - Some(ENV_LABEL)).unwrap(); + Some("1")).unwrap(); let multisig = RevmMiddleware::new( &environment, - Some(ENV_LABEL)).unwrap(); + Some("2")).unwrap(); let admin = RevmMiddleware::new( &environment, - Some(ENV_LABEL)).unwrap(); + Some("3")).unwrap(); println!("admin at address {}", admin.address()); println!("alice at address {}", alice.address()); @@ -103,7 +103,7 @@ pub async fn deploy_contracts(admin: Arc) -> Result Date: Thu, 5 Oct 2023 16:50:51 -0600 Subject: [PATCH 3/3] game deployed --- src/main.rs | 8 ++--- src/startup.rs | 97 +++++++++++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/main.rs b/src/main.rs index 19d3000..2625f49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,11 +2,10 @@ use alloy_primitives::U256; use alloy_sol_types::{self, sol}; use anyhow::Result; use arbiter_core::middleware::RevmMiddleware; -use ethers::types::U256 as eU256; use ethers::utils::keccak256 as ekeccak256; use foundry_contracts::{ - alphabet_vm::AlphabetVM, - block_oracle::block_oracle::BlockOracle, + alphabet_vm::AlphabetVM, block_oracle::block_oracle::BlockOracle, + fault_dispute_game::fault_dispute_game::FaultDisputeGame, l2_output_oracle::l2_output_oracle::L2OutputOracle, }; use std::{error::Error, sync::Arc}; @@ -33,6 +32,3 @@ pub async fn main() -> Result<(), Box> { Ok(()) } - - - diff --git a/src/startup.rs b/src/startup.rs index de537e1..2e9cc49 100644 --- a/src/startup.rs +++ b/src/startup.rs @@ -1,4 +1,5 @@ -use arbiter_core::environment::{self, builder::EnvironmentBuilder, cheatcodes::Cheatcodes, Environment}; +use arbiter_core::environment::{builder::EnvironmentBuilder, cheatcodes::Cheatcodes, Environment}; +use ethers::types::U256 as eU256; use super::*; @@ -22,6 +23,9 @@ pub struct SimulationContracts { /// The `AlphabetVM` contract. pub alphabet_vm: AlphabetVM, + + /// The `FaultDisputeGame` contract. + pub disputegame: FaultDisputeGame, } pub async fn set_up_agents() -> Result<( @@ -33,28 +37,21 @@ pub async fn set_up_agents() -> Result<( )> { let environment = EnvironmentBuilder::new().label(ENV_LABEL).build(); - let alice = RevmMiddleware::new( - &environment, - Some("0")).unwrap(); + let alice = RevmMiddleware::new(&environment, Some("0")).unwrap(); - let bob = RevmMiddleware::new( - &environment, - Some("1")).unwrap(); + let bob = RevmMiddleware::new(&environment, Some("1")).unwrap(); - let multisig = RevmMiddleware::new( - &environment, - Some("2")).unwrap(); + let multisig = RevmMiddleware::new(&environment, Some("2")).unwrap(); - let admin = RevmMiddleware::new( - &environment, - Some("3")).unwrap(); + let admin = RevmMiddleware::new(&environment, Some("3")).unwrap(); println!("admin at address {}", admin.address()); println!("alice at address {}", alice.address()); println!("bob at address {}", bob.address()); println!("multisig at address {}", multisig.address()); - alice.apply_cheatcode(Cheatcodes::Deal { + alice + .apply_cheatcode(Cheatcodes::Deal { address: alice.address(), amount: U256::MAX.into(), }) @@ -66,12 +63,13 @@ pub async fn set_up_agents() -> Result<( }) .await .unwrap(); - multisig.apply_cheatcode(Cheatcodes::Deal { - address: multisig.address(), - amount: U256::MAX.into(), - }) - .await - .unwrap(); + multisig + .apply_cheatcode(Cheatcodes::Deal { + address: multisig.address(), + amount: U256::MAX.into(), + }) + .await + .unwrap(); Ok((environment, admin, alice, bob, multisig)) } @@ -88,42 +86,61 @@ pub async fn deploy_contracts(admin: Arc) -> Result