diff --git a/Cargo.lock b/Cargo.lock index 9730249c..6d280dda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,7 +166,7 @@ dependencies = [ "alloy-sol-types", "auto_impl", "derive_more", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "op-alloy-rpc-types-engine", "op-revm", "revm", @@ -278,7 +278,7 @@ dependencies = [ "alloy-op-hardforks", "alloy-primitives", "auto_impl", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "op-revm", "revm", ] @@ -469,21 +469,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "alloy-rpc-types-mev" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1397926d8d06a2531578bafc3e0ec78f97a02f0e6d1631c67d80d22af6a3af02" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-primitives", - "alloy-rpc-types-eth", - "alloy-serde", - "serde", - "serde_json", -] - [[package]] name = "alloy-rpc-types-trace" version = "1.0.41" @@ -1095,15 +1080,6 @@ dependencies = [ "syn 2.0.108", ] -[[package]] -name = "atoi" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" -dependencies = [ - "num-traits", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -1875,10 +1851,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ "iana-time-zone", - "js-sys", "num-traits", "serde", - "wasm-bindgen", "windows-link", ] @@ -1948,15 +1922,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "const-hex" version = "1.17.0" @@ -2101,15 +2066,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -2258,7 +2214,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", - "pem-rfc7468", "zeroize", ] @@ -2569,17 +2524,6 @@ dependencies = [ "syn 2.0.108", ] -[[package]] -name = "event-listener" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "fastrand" version = "2.3.0" @@ -2658,17 +2602,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "flume" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" -dependencies = [ - "futures-core", - "futures-sink", - "spin", -] - [[package]] name = "fnv" version = "1.0.7" @@ -2765,17 +2698,6 @@ dependencies = [ "futures-util", ] -[[package]] -name = "futures-intrusive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" -dependencies = [ - "futures-core", - "lock_api", - "parking_lot", -] - [[package]] name = "futures-io" version = "0.3.31" @@ -2994,15 +2916,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hashlink" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" -dependencies = [ - "hashbrown 0.15.5", -] - [[package]] name = "heck" version = "0.5.0" @@ -3030,15 +2943,6 @@ dependencies = [ "arrayvec", ] -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - [[package]] name = "hmac" version = "0.12.1" @@ -3678,9 +3582,6 @@ name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin", -] [[package]] name = "libc" @@ -3761,16 +3662,6 @@ dependencies = [ "libsecp256k1-core", ] -[[package]] -name = "libsqlite3-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" -dependencies = [ - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-sys" version = "1.1.22" @@ -3999,23 +3890,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-bigint-dig" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" -dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand 0.8.5", - "smallvec", - "zeroize", -] - [[package]] name = "num-complex" version = "0.4.6" @@ -4139,6 +4013,22 @@ name = "op-alloy-consensus" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a501241474c3118833d6195312ae7eb7cc90bbb0d5f524cbb0b06619e49ff67" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "derive_more", + "serde", + "thiserror", +] + +[[package]] +name = "op-alloy-consensus" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1fc8aa0e2f5b136d101630be009e4e6dbdd1f17bc3ce670f431511600d2930" dependencies = [ "alloy-consensus", "alloy-eips", @@ -4154,9 +4044,9 @@ dependencies = [ [[package]] name = "op-alloy-network" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f80108e3b36901200a4c5df1db1ee9ef6ce685b59ea79d7be1713c845e3765da" +checksum = "7c5cca341184dbfcb49dbc124e5958e6a857499f04782907e5d969abb644e0b6" dependencies = [ "alloy-consensus", "alloy-network", @@ -4164,8 +4054,8 @@ dependencies = [ "alloy-provider", "alloy-rpc-types-eth", "alloy-signer", - "op-alloy-consensus", - "op-alloy-rpc-types", + "op-alloy-consensus 0.21.0", + "op-alloy-rpc-types 0.21.0", ] [[package]] @@ -4181,7 +4071,26 @@ dependencies = [ "alloy-rpc-types-eth", "alloy-serde", "derive_more", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "op-alloy-rpc-types" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "274972c3c5e911b6675f6794ea0476b05e0bc1ea7e464f99ec2dc01b76d2eeb6" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "derive_more", + "op-alloy-consensus 0.21.0", "serde", "serde_json", "thiserror", @@ -4201,7 +4110,7 @@ dependencies = [ "derive_more", "ethereum_ssz", "ethereum_ssz_derive", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "snap", "thiserror", ] @@ -4334,12 +4243,6 @@ dependencies = [ "syn 2.0.108", ] -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - [[package]] name = "parking_lot" version = "0.12.5" @@ -4394,15 +4297,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.2" @@ -4494,17 +4388,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs1" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" -dependencies = [ - "der 0.7.10", - "pkcs8 0.10.2", - "spki 0.7.3", -] - [[package]] name = "pkcs8" version = "0.9.0" @@ -4970,8 +4853,8 @@ dependencies = [ [[package]] name = "reth-chain-state" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -4996,8 +4879,8 @@ dependencies = [ [[package]] name = "reth-chainspec" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-chains", "alloy-consensus", @@ -5016,8 +4899,8 @@ dependencies = [ [[package]] name = "reth-codecs" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5026,7 +4909,7 @@ dependencies = [ "alloy-trie", "bytes", "modular-bitfield", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "reth-codecs-derive", "reth-zstd-compressors", "serde", @@ -5034,8 +4917,8 @@ dependencies = [ [[package]] name = "reth-codecs-derive" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "convert_case", "proc-macro2", @@ -5045,8 +4928,8 @@ dependencies = [ [[package]] name = "reth-consensus" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -5058,8 +4941,8 @@ dependencies = [ [[package]] name = "reth-consensus-common" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5070,8 +4953,8 @@ dependencies = [ [[package]] name = "reth-db-models" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-eips", "alloy-primitives", @@ -5082,8 +4965,8 @@ dependencies = [ [[package]] name = "reth-errors" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "reth-consensus", "reth-execution-errors", @@ -5093,8 +4976,8 @@ dependencies = [ [[package]] name = "reth-eth-wire-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-chains", "alloy-consensus", @@ -5114,8 +4997,8 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-eip2124", "alloy-hardforks", @@ -5127,8 +5010,8 @@ dependencies = [ [[package]] name = "reth-ethereum-primitives" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5144,8 +5027,8 @@ dependencies = [ [[package]] name = "reth-evm" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5165,8 +5048,8 @@ dependencies = [ [[package]] name = "reth-execution-errors" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-evm", "alloy-primitives", @@ -5178,8 +5061,8 @@ dependencies = [ [[package]] name = "reth-execution-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5196,8 +5079,8 @@ dependencies = [ [[package]] name = "reth-fs-util" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "serde", "serde_json", @@ -5206,8 +5089,8 @@ dependencies = [ [[package]] name = "reth-metrics" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "metrics", "metrics-derive", @@ -5215,16 +5098,16 @@ dependencies = [ [[package]] name = "reth-net-banlist" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", ] [[package]] name = "reth-network-api" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -5247,8 +5130,8 @@ dependencies = [ [[package]] name = "reth-network-p2p" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5269,8 +5152,8 @@ dependencies = [ [[package]] name = "reth-network-peers" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -5282,8 +5165,8 @@ dependencies = [ [[package]] name = "reth-network-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-eip2124", "reth-net-banlist", @@ -5294,8 +5177,8 @@ dependencies = [ [[package]] name = "reth-optimism-chainspec" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-chains", "alloy-consensus", @@ -5305,8 +5188,8 @@ dependencies = [ "alloy-primitives", "derive_more", "miniz_oxide", - "op-alloy-consensus", - "op-alloy-rpc-types", + "op-alloy-consensus 0.20.0", + "op-alloy-rpc-types 0.20.0", "reth-chainspec", "reth-ethereum-forks", "reth-network-peers", @@ -5320,8 +5203,8 @@ dependencies = [ [[package]] name = "reth-optimism-consensus" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5345,15 +5228,15 @@ dependencies = [ [[package]] name = "reth-optimism-evm" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-evm", "alloy-op-evm", "alloy-primitives", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "op-alloy-rpc-types-engine", "op-revm", "reth-chainspec", @@ -5372,8 +5255,8 @@ dependencies = [ [[package]] name = "reth-optimism-forks" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-op-hardforks", "alloy-primitives", @@ -5383,15 +5266,15 @@ dependencies = [ [[package]] name = "reth-optimism-primitives" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-primitives", "alloy-rlp", "bytes", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "reth-codecs", "reth-primitives-traits", "reth-zstd-compressors", @@ -5401,8 +5284,8 @@ dependencies = [ [[package]] name = "reth-primitives-traits" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5415,7 +5298,7 @@ dependencies = [ "bytes", "derive_more", "once_cell", - "op-alloy-consensus", + "op-alloy-consensus 0.20.0", "reth-codecs", "revm-bytecode", "revm-primitives", @@ -5428,8 +5311,8 @@ dependencies = [ [[package]] name = "reth-prune-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", "derive_more", @@ -5439,8 +5322,8 @@ dependencies = [ [[package]] name = "reth-revm" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", "reth-primitives-traits", @@ -5451,8 +5334,8 @@ dependencies = [ [[package]] name = "reth-rpc-convert" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-json-rpc", @@ -5472,8 +5355,8 @@ dependencies = [ [[package]] name = "reth-rpc-eth-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5519,8 +5402,8 @@ dependencies = [ [[package]] name = "reth-rpc-server-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-eips", "alloy-primitives", @@ -5535,8 +5418,8 @@ dependencies = [ [[package]] name = "reth-stages-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", "bytes", @@ -5546,8 +5429,8 @@ dependencies = [ [[package]] name = "reth-static-file-types" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", "derive_more", @@ -5557,8 +5440,8 @@ dependencies = [ [[package]] name = "reth-storage-api" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5579,8 +5462,8 @@ dependencies = [ [[package]] name = "reth-storage-errors" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-eips", "alloy-primitives", @@ -5595,8 +5478,8 @@ dependencies = [ [[package]] name = "reth-tasks" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "auto_impl", "dyn-clone", @@ -5611,8 +5494,8 @@ dependencies = [ [[package]] name = "reth-tokio-util" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "tokio", "tokio-stream", @@ -5621,8 +5504,8 @@ dependencies = [ [[package]] name = "reth-transaction-pool" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5660,8 +5543,8 @@ dependencies = [ [[package]] name = "reth-trie" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5682,8 +5565,8 @@ dependencies = [ [[package]] name = "reth-trie-common" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -5704,8 +5587,8 @@ dependencies = [ [[package]] name = "reth-trie-sparse" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -5720,8 +5603,8 @@ dependencies = [ [[package]] name = "reth-zstd-compressors" -version = "1.8.1" -source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.1#e6608be51ea34424b8e3693cf1f946a3eb224736" +version = "1.8.2" +source = "git+https://github.com/paradigmxyz/reth?tag=v1.8.2#9c30bf7af5e0d45deaf5917375c9922c16654b28" dependencies = [ "zstd", ] @@ -5993,26 +5876,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" -[[package]] -name = "rsa" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" -dependencies = [ - "const-oid", - "digest 0.10.7", - "num-bigint-dig", - "num-integer", - "num-traits", - "pkcs1", - "pkcs8 0.10.2", - "rand_core 0.6.4", - "signature 2.2.0", - "spki 0.7.3", - "subtle", - "zeroize", -] - [[package]] name = "rug" version = "1.28.0" @@ -6690,15 +6553,6 @@ dependencies = [ "sha1", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - [[package]] name = "spki" version = "0.6.0" @@ -6719,203 +6573,6 @@ dependencies = [ "der 0.7.10", ] -[[package]] -name = "sqlx" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" -dependencies = [ - "sqlx-core", - "sqlx-macros", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", -] - -[[package]] -name = "sqlx-core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" -dependencies = [ - "base64 0.22.1", - "bytes", - "chrono", - "crc", - "crossbeam-queue", - "either", - "event-listener", - "futures-core", - "futures-intrusive", - "futures-io", - "futures-util", - "hashbrown 0.15.5", - "hashlink", - "indexmap 2.12.0", - "log", - "memchr", - "native-tls", - "once_cell", - "percent-encoding", - "serde", - "serde_json", - "sha2 0.10.9", - "smallvec", - "thiserror", - "tokio", - "tokio-stream", - "tracing", - "url", - "uuid", -] - -[[package]] -name = "sqlx-macros" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" -dependencies = [ - "proc-macro2", - "quote", - "sqlx-core", - "sqlx-macros-core", - "syn 2.0.108", -] - -[[package]] -name = "sqlx-macros-core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" -dependencies = [ - "dotenvy", - "either", - "heck", - "hex", - "once_cell", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2 0.10.9", - "sqlx-core", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "syn 2.0.108", - "tokio", - "url", -] - -[[package]] -name = "sqlx-mysql" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" -dependencies = [ - "atoi", - "base64 0.22.1", - "bitflags 2.10.0", - "byteorder", - "bytes", - "chrono", - "crc", - "digest 0.10.7", - "dotenvy", - "either", - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "generic-array", - "hex", - "hkdf", - "hmac", - "itoa", - "log", - "md-5", - "memchr", - "once_cell", - "percent-encoding", - "rand 0.8.5", - "rsa", - "serde", - "sha1", - "sha2 0.10.9", - "smallvec", - "sqlx-core", - "stringprep", - "thiserror", - "tracing", - "uuid", - "whoami", -] - -[[package]] -name = "sqlx-postgres" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" -dependencies = [ - "atoi", - "base64 0.22.1", - "bitflags 2.10.0", - "byteorder", - "chrono", - "crc", - "dotenvy", - "etcetera", - "futures-channel", - "futures-core", - "futures-util", - "hex", - "hkdf", - "hmac", - "home", - "itoa", - "log", - "md-5", - "memchr", - "once_cell", - "rand 0.8.5", - "serde", - "serde_json", - "sha2 0.10.9", - "smallvec", - "sqlx-core", - "stringprep", - "thiserror", - "tracing", - "uuid", - "whoami", -] - -[[package]] -name = "sqlx-sqlite" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" -dependencies = [ - "atoi", - "chrono", - "flume", - "futures-channel", - "futures-core", - "futures-executor", - "futures-intrusive", - "futures-util", - "libsqlite3-sys", - "log", - "percent-encoding", - "serde", - "serde_urlencoded", - "sqlx-core", - "thiserror", - "tracing", - "url", - "uuid", -] - [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -6928,17 +6585,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stringprep" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" -dependencies = [ - "unicode-bidi", - "unicode-normalization", - "unicode-properties", -] - [[package]] name = "strsim" version = "0.11.1" @@ -7216,7 +6862,6 @@ dependencies = [ "alloy-consensus", "alloy-primitives", "alloy-provider", - "alloy-rpc-types-mev", "anyhow", "async-trait", "aws-config", @@ -7225,12 +6870,13 @@ dependencies = [ "bytes", "clap", "dotenvy", - "op-alloy-consensus", + "op-alloy-consensus 0.21.0", "rdkafka", "serde", "serde_json", "testcontainers", "testcontainers-modules", + "tips-core", "tokio", "tracing", "tracing-subscriber 0.3.20", @@ -7238,18 +6884,39 @@ dependencies = [ ] [[package]] -name = "tips-common" +name = "tips-bundle-pool" version = "0.1.0" dependencies = [ "alloy-consensus", "alloy-primitives", "alloy-provider", - "alloy-rpc-types-mev", + "alloy-signer", + "alloy-signer-local", "anyhow", - "chrono", - "op-alloy-consensus", + "async-trait", + "op-alloy-consensus 0.21.0", + "op-alloy-rpc-types 0.21.0", + "tips-audit", + "tips-core", + "tokio", + "tracing", + "uuid", +] + +[[package]] +name = "tips-core" +version = "0.1.0" +dependencies = [ + "alloy-consensus", + "alloy-primitives", + "alloy-provider", + "alloy-serde", + "alloy-signer-local", + "op-alloy-consensus 0.21.0", + "op-alloy-rpc-types 0.21.0", "serde", - "sqlx", + "tracing", + "uuid", ] [[package]] @@ -7259,7 +6926,6 @@ dependencies = [ "alloy-consensus", "alloy-primitives", "alloy-provider", - "alloy-rpc-types-mev", "alloy-signer-local", "anyhow", "async-trait", @@ -7267,7 +6933,7 @@ dependencies = [ "clap", "dotenvy", "jsonrpsee", - "op-alloy-consensus", + "op-alloy-consensus 0.21.0", "op-alloy-network", "op-revm", "rdkafka", @@ -7275,7 +6941,7 @@ dependencies = [ "reth-rpc-eth-types", "revm-context-interface", "serde_json", - "tips-common", + "tips-core", "tokio", "tracing", "tracing-subscriber 0.3.20", @@ -7462,7 +7128,6 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -7573,33 +7238,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" - [[package]] name = "unicode-ident" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-properties" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" - [[package]] name = "unicode-segmentation" version = "1.12.0" @@ -7717,12 +7361,6 @@ dependencies = [ "wit-bindgen", ] -[[package]] -name = "wasite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" - [[package]] name = "wasm-bindgen" version = "0.2.104" @@ -7829,16 +7467,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "whoami" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" -dependencies = [ - "libredox", - "wasite", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 5b0f6104..2f4008a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,18 +7,18 @@ homepage = "https://github.com/base/tips" repository = "https://github.com/base/tips" [workspace] -members = ["crates/audit", "crates/ingress-rpc", "crates/common"] +members = ["crates/audit", "crates/ingress-rpc", "crates/bundle-pool", "crates/core"] resolver = "2" [workspace.dependencies] -tips-common = { path = "crates/common" } tips-audit = { path = "crates/audit" } +tips-bundle-pool = { path = "crates/bundle-pool" } +tips-core = { path = "crates/core" } # Reth -reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.1" } -reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.1" } -reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.1" } -base-reth-flashblocks-rpc = { git = "https://github.com/base/node-reth", rev = "a1ae148a36354c88b356f80281fef12dad9f7737" } +reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } +reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } +reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } # alloy alloy-primitives = { version = "1.3.1", default-features = false, features = [ @@ -28,12 +28,11 @@ alloy-primitives = { version = "1.3.1", default-features = false, features = [ alloy-rpc-types = { version = "1.0.35", default-features = false } alloy-consensus = { version = "1.0.35" } alloy-provider = { version = "1.0.35" } -alloy-rpc-types-mev = "1.0.35" # op-alloy -op-alloy-rpc-types = { version = "0.20.0", default-features = false } -op-alloy-network = { version = "0.20.0", default-features = false } -op-alloy-consensus = { version = "0.20.0", features = ["k256"] } +op-alloy-network = { version = "0.21.0", default-features = false } +op-alloy-consensus = { version = "0.21.0", features = ["k256"] } +op-alloy-rpc-types = { version = "0.21.0", default-features = true} tokio = { version = "1.47.1", features = ["full"] } tracing = "0.1.41" @@ -41,16 +40,8 @@ tracing-subscriber = { version = "0.3.20", features = ["env-filter"] } anyhow = "1.0.99" clap = { version = "4.5.47", features = ["derive", "env"] } url = "2.5.7" -sqlx = { version = "0.8.6", features = [ - "runtime-tokio-native-tls", - "postgres", - "uuid", - "chrono", - "json", -]} uuid = { version = "1.18.1", features = ["v4", "serde"] } serde = { version = "1.0.219", features = ["derive"] } -eyre = "0.6.12" async-trait = "0.1.89" serde_json = "1.0.143" dotenvy = "0.15.7" diff --git a/crates/audit/Cargo.toml b/crates/audit/Cargo.toml index 0fb2ee49..5fd0ef23 100644 --- a/crates/audit/Cargo.toml +++ b/crates/audit/Cargo.toml @@ -12,6 +12,7 @@ name = "tips-audit" path = "src/bin/main.rs" [dependencies] +tips-core = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } @@ -23,7 +24,6 @@ async-trait = { workspace = true } alloy-primitives = { workspace = true } alloy-consensus = { workspace = true } alloy-provider = { workspace = true } -alloy-rpc-types-mev = { workspace = true } op-alloy-consensus = { workspace = true } clap = { workspace = true } dotenvy = { workspace = true } diff --git a/crates/audit/src/publisher.rs b/crates/audit/src/publisher.rs index 48367e74..0d31391d 100644 --- a/crates/audit/src/publisher.rs +++ b/crates/audit/src/publisher.rs @@ -3,7 +3,7 @@ use anyhow::Result; use async_trait::async_trait; use rdkafka::producer::{FutureProducer, FutureRecord}; use serde_json; -use tracing::{debug, error}; +use tracing::{debug, error, info}; #[async_trait] pub trait BundleEventPublisher: Send + Sync { @@ -70,3 +70,37 @@ impl BundleEventPublisher for KafkaBundleEventPublisher { Ok(()) } } + +#[derive(Clone)] +pub struct LoggingBundleEventPublisher; + +impl LoggingBundleEventPublisher { + pub fn new() -> Self { + Self + } +} + +impl Default for LoggingBundleEventPublisher { + fn default() -> Self { + Self::new() + } +} + +#[async_trait] +impl BundleEventPublisher for LoggingBundleEventPublisher { + async fn publish(&self, event: BundleEvent) -> Result<()> { + info!( + bundle_id = %event.bundle_id(), + event = ?event, + "Received bundle event" + ); + Ok(()) + } + + async fn publish_all(&self, events: Vec) -> Result<()> { + for event in events { + self.publish(event).await?; + } + Ok(()) + } +} diff --git a/crates/audit/src/storage.rs b/crates/audit/src/storage.rs index bb696189..ed5d9475 100644 --- a/crates/audit/src/storage.rs +++ b/crates/audit/src/storage.rs @@ -1,7 +1,6 @@ use crate::reader::Event; use crate::types::{BundleEvent, BundleId, DropReason, TransactionId}; use alloy_primitives::TxHash; -use alloy_rpc_types_mev::EthSendBundle; use anyhow::Result; use async_trait::async_trait; use aws_sdk_s3::Client as S3Client; @@ -11,6 +10,7 @@ use aws_sdk_s3::primitives::ByteStream; use serde::{Deserialize, Serialize}; use std::fmt; use std::fmt::Debug; +use tips_core::Bundle; use tracing::info; #[derive(Debug)] @@ -39,12 +39,12 @@ pub enum BundleHistoryEvent { Created { key: String, timestamp: i64, - bundle: EthSendBundle, + bundle: Bundle, }, Updated { key: String, timestamp: i64, - bundle: EthSendBundle, + bundle: Bundle, }, Cancelled { key: String, @@ -376,11 +376,11 @@ mod tests { use crate::reader::Event; use crate::types::{BundleEvent, DropReason}; use alloy_primitives::TxHash; - use alloy_rpc_types_mev::EthSendBundle; + use tips_core::Bundle; use uuid::Uuid; - fn create_test_bundle() -> EthSendBundle { - EthSendBundle::default() + fn create_test_bundle() -> Bundle { + Bundle::default() } fn create_test_event(key: &str, timestamp: i64, bundle_event: BundleEvent) -> Event { @@ -485,7 +485,7 @@ mod tests { block_number: 12345, block_hash: TxHash::from([1u8; 32]), }; - let event = create_test_event("test-key-6", 1234567890, bundle_event); + let event = create_test_event("test-key-5", 1234567890, bundle_event); let result = update_bundle_history_transform(bundle_history.clone(), &event); assert!(result.is_some()); @@ -493,7 +493,7 @@ mod tests { bundle_id, reason: DropReason::TimedOut, }; - let event = create_test_event("test-key-7", 1234567890, bundle_event); + let event = create_test_event("test-key-6", 1234567890, bundle_event); let result = update_bundle_history_transform(bundle_history, &event); assert!(result.is_some()); } diff --git a/crates/audit/src/types.rs b/crates/audit/src/types.rs index 70f96ac4..a29ac2f0 100644 --- a/crates/audit/src/types.rs +++ b/crates/audit/src/types.rs @@ -1,10 +1,10 @@ use alloy_consensus::transaction::{SignerRecoverable, Transaction as ConsensusTransaction}; use alloy_primitives::{Address, TxHash, U256}; use alloy_provider::network::eip2718::Decodable2718; -use alloy_rpc_types_mev::EthSendBundle; use bytes::Bytes; use op_alloy_consensus::OpTxEnvelope; use serde::{Deserialize, Serialize}; +use tips_core::Bundle; use uuid::Uuid; #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -19,13 +19,7 @@ pub type BundleId = Uuid; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum DropReason { TimedOut, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Bundle { - pub id: BundleId, - pub transactions: Vec, - pub metadata: serde_json::Value, + Reverted, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -39,11 +33,11 @@ pub struct Transaction { pub enum BundleEvent { Created { bundle_id: BundleId, - bundle: EthSendBundle, + bundle: Bundle, }, Updated { bundle_id: BundleId, - bundle: EthSendBundle, + bundle: Bundle, }, Cancelled { bundle_id: BundleId, diff --git a/crates/audit/tests/integration_tests.rs b/crates/audit/tests/integration_tests.rs index cd1e1e7f..d3d809c8 100644 --- a/crates/audit/tests/integration_tests.rs +++ b/crates/audit/tests/integration_tests.rs @@ -1,4 +1,3 @@ -use alloy_rpc_types_mev::EthSendBundle; use std::time::Duration; use tips_audit::{ KafkaMempoolArchiver, KafkaMempoolReader, @@ -6,6 +5,7 @@ use tips_audit::{ storage::{BundleEventS3Reader, S3EventReaderWriter}, types::{BundleEvent, DropReason}, }; +use tips_core::Bundle; use uuid::Uuid; mod common; use common::TestHarness; @@ -23,7 +23,7 @@ async fn test_kafka_publisher_s3_archiver_integration() let test_events = vec![ BundleEvent::Created { bundle_id: test_bundle_id, - bundle: EthSendBundle::default(), + bundle: Bundle::default(), }, BundleEvent::Dropped { bundle_id: test_bundle_id, diff --git a/crates/audit/tests/s3_test.rs b/crates/audit/tests/s3_test.rs index baeb30e0..f637d614 100644 --- a/crates/audit/tests/s3_test.rs +++ b/crates/audit/tests/s3_test.rs @@ -1,11 +1,11 @@ use alloy_primitives::{Bytes, TxHash, b256, bytes}; -use alloy_rpc_types_mev::EthSendBundle; use std::sync::Arc; use tips_audit::{ reader::Event, storage::{BundleEventS3Reader, EventWriter, S3EventReaderWriter}, types::BundleEvent, }; +use tips_core::Bundle; use tokio::task::JoinSet; use uuid::Uuid; @@ -19,8 +19,8 @@ const TXN_DATA: Bytes = bytes!( const TXN_HASH: TxHash = b256!("0x4f7ddfc911f5cf85dd15a413f4cbb2a0abe4f1ff275ed13581958c0bcf043c5e"); -fn create_test_bundle() -> EthSendBundle { - EthSendBundle { +fn create_test_bundle() -> Bundle { + Bundle { txs: vec![TXN_DATA.clone()], ..Default::default() } diff --git a/crates/bundle-pool/Cargo.toml b/crates/bundle-pool/Cargo.toml new file mode 100644 index 00000000..3c7bece3 --- /dev/null +++ b/crates/bundle-pool/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "tips-bundle-pool" +version.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true + +[dependencies] +tips-core = { workspace = true } +tips-audit.workspace = true +uuid.workspace = true +alloy-primitives.workspace = true + +tracing.workspace = true +tokio.workspace = true +anyhow.workspace = true +async-trait.workspace = true + +[dev-dependencies] +tips-core = { workspace = true, features = ["test-utils"] } +alloy-consensus.workspace = true +alloy-provider.workspace = true +alloy-signer = "1.0.41" +alloy-signer-local = "1.0.41" +op-alloy-consensus.workspace = true +op-alloy-rpc-types.workspace = true diff --git a/crates/bundle-pool/src/lib.rs b/crates/bundle-pool/src/lib.rs new file mode 100644 index 00000000..70065dcd --- /dev/null +++ b/crates/bundle-pool/src/lib.rs @@ -0,0 +1,4 @@ +pub mod pool; + +pub use pool::{BundleStore, InMemoryBundlePool}; +pub use tips_core::{Bundle, BundleHash, BundleWithMetadata, CancelBundle}; diff --git a/crates/bundle-pool/src/pool.rs b/crates/bundle-pool/src/pool.rs new file mode 100644 index 00000000..40abfe74 --- /dev/null +++ b/crates/bundle-pool/src/pool.rs @@ -0,0 +1,214 @@ +use alloy_primitives::map::HashMap; +use tips_audit::{BundleEvent, DropReason}; +use tips_core::BundleWithMetadata; +use tokio::sync::mpsc; +use tracing::warn; +use uuid::Uuid; + +#[derive(Debug, Clone)] +pub enum Action { + Included, + Dropped, +} + +#[derive(Debug, Clone)] +pub struct ProcessedBundle { + pub bundle_uuid: Uuid, + pub action: Action, +} + +pub trait BundleStore { + fn add_bundle(&mut self, bundle: BundleWithMetadata); + fn get_bundles(&self) -> Vec; + fn built_flashblock( + &mut self, + block_number: u64, + flashblock_index: u64, + processed: Vec, + ); +} + +pub struct InMemoryBundlePool { + bundles: HashMap, + audit_log: mpsc::UnboundedSender, + builder_id: String, +} + +impl InMemoryBundlePool { + pub fn new(audit_log: mpsc::UnboundedSender, builder_id: String) -> Self { + InMemoryBundlePool { + bundles: Default::default(), + audit_log, + builder_id, + } + } +} + +impl BundleStore for InMemoryBundlePool { + fn add_bundle(&mut self, bundle: BundleWithMetadata) { + self.bundles.insert(*bundle.uuid(), bundle); + } + + fn get_bundles(&self) -> Vec { + self.bundles.values().cloned().collect() + } + + fn built_flashblock( + &mut self, + block_number: u64, + flashblock_index: u64, + processed: Vec, + ) { + for p in &processed { + let event = match p.action { + Action::Included => BundleEvent::BuilderIncluded { + bundle_id: p.bundle_uuid, + builder: self.builder_id.clone(), + block_number, + flashblock_index, + }, + Action::Dropped => BundleEvent::Dropped { + bundle_id: p.bundle_uuid, + reason: DropReason::Reverted, + }, + }; + + if let Err(e) = self.audit_log.send(event) { + warn!(error = %e, "Failed to send event to audit log"); + } + } + + for p in processed { + self.bundles.remove(&p.bundle_uuid); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use alloy_signer_local::PrivateKeySigner; + use tips_audit::BundleEvent; + use tips_core::test_utils::{create_test_bundle, create_transaction}; + + #[tokio::test] + async fn test_operations() { + let alice = PrivateKeySigner::random(); + let bob = PrivateKeySigner::random(); + + let t1 = create_transaction(alice.clone(), 1, bob.address()); + let t2 = create_transaction(alice.clone(), 2, bob.address()); + let t3 = create_transaction(alice, 3, bob.address()); + + let (event_tx, _event_rx) = mpsc::unbounded_channel::(); + let mut pool = InMemoryBundlePool::new(event_tx, "test-builder".to_string()); + let bundle1 = create_test_bundle(vec![t1], None, None, None); + let bundle2 = create_test_bundle(vec![t2], None, None, None); + let bundle3 = create_test_bundle(vec![t3], None, None, None); + + let uuid1 = *bundle1.uuid(); + let uuid2 = *bundle2.uuid(); + let uuid3 = *bundle3.uuid(); + + pool.add_bundle(bundle1); + pool.add_bundle(bundle2); + pool.add_bundle(bundle3); + + let bundles = pool.get_bundles(); + assert_eq!(bundles.len(), 3); + + pool.built_flashblock( + 1, + 0, + vec![ + ProcessedBundle { + bundle_uuid: uuid1, + action: Action::Included, + }, + ProcessedBundle { + bundle_uuid: uuid2, + action: Action::Dropped, + }, + ], + ); + + let bundles = pool.get_bundles(); + assert_eq!(bundles.len(), 1); + assert_eq!(*bundles[0].uuid(), uuid3); + } + + #[tokio::test] + async fn test_with_audit() { + let alice = PrivateKeySigner::random(); + let bob = PrivateKeySigner::random(); + + let t1 = create_transaction(alice.clone(), 1, bob.address()); + let t2 = create_transaction(alice.clone(), 2, bob.address()); + let t3 = create_transaction(alice, 3, bob.address()); + + let (event_tx, mut event_rx) = mpsc::unbounded_channel::(); + let mut pool = InMemoryBundlePool::new(event_tx, "test-builder".to_string()); + + let bundle1 = create_test_bundle(vec![t1], None, None, None); + let bundle2 = create_test_bundle(vec![t2], None, None, None); + let bundle3 = create_test_bundle(vec![t3], None, None, None); + + let uuid1 = *bundle1.uuid(); + let uuid2 = *bundle2.uuid(); + let uuid3 = *bundle3.uuid(); + + pool.add_bundle(bundle1); + pool.add_bundle(bundle2); + pool.add_bundle(bundle3); + + let bundles = pool.get_bundles(); + assert_eq!(bundles.len(), 3); + + pool.built_flashblock( + 100, + 5, + vec![ + ProcessedBundle { + bundle_uuid: uuid1, + action: Action::Included, + }, + ProcessedBundle { + bundle_uuid: uuid2, + action: Action::Dropped, + }, + ], + ); + + let event1 = event_rx.recv().await.unwrap(); + let event2 = event_rx.recv().await.unwrap(); + + match &event1 { + BundleEvent::BuilderIncluded { + bundle_id, + builder, + block_number, + flashblock_index, + } => { + assert_eq!(*bundle_id, uuid1); + assert_eq!(builder, "test-builder"); + assert_eq!(*block_number, 100); + assert_eq!(*flashblock_index, 5); + } + _ => panic!("Expected BuilderIncluded event"), + } + + match &event2 { + BundleEvent::Dropped { + bundle_id, + reason: _, + } => { + assert_eq!(*bundle_id, uuid2); + } + _ => panic!("Expected Dropped event"), + } + + let bundles = pool.get_bundles(); + assert_eq!(bundles.len(), 1); + assert_eq!(*bundles[0].uuid(), uuid3); + } +} diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml deleted file mode 100644 index c9b76c4c..00000000 --- a/crates/common/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "tips-common" -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true - -[dependencies] -alloy-rpc-types-mev.workspace = true -alloy-primitives.workspace = true -sqlx.workspace = true -anyhow.workspace = true -op-alloy-consensus.workspace = true -alloy-provider.workspace = true -alloy-consensus.workspace = true -serde.workspace = true -chrono.workspace = true diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs deleted file mode 100644 index fc3616e3..00000000 --- a/crates/common/src/lib.rs +++ /dev/null @@ -1,64 +0,0 @@ -use alloy_consensus::Transaction; -use alloy_consensus::transaction::SignerRecoverable; -use alloy_primitives::{Address, TxHash}; -use alloy_provider::network::eip2718::Decodable2718; -use alloy_rpc_types_mev::EthSendBundle; -use anyhow::Result; -use chrono::{DateTime, Utc}; -use op_alloy_consensus::OpTxEnvelope; -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, sqlx::Type, Serialize, Deserialize)] -#[sqlx(type_name = "bundle_state", rename_all = "PascalCase")] -pub enum BundleState { - Ready, - IncludedByBuilder, -} - -/// Extended bundle data that includes the original bundle plus extracted metadata -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct BundleWithMetadata { - pub bundle: EthSendBundle, - pub txn_hashes: Vec, - pub senders: Vec
, - pub min_base_fee: i64, - pub state: BundleState, - pub state_changed_at: DateTime, -} - -impl BundleWithMetadata { - pub fn new(bundle: &EthSendBundle) -> Result { - let mut senders = Vec::new(); - let mut txn_hashes = Vec::new(); - - let mut min_base_fee = i64::MAX; - - for tx_bytes in &bundle.txs { - let envelope = OpTxEnvelope::decode_2718_exact(tx_bytes)?; - txn_hashes.push(*envelope.hash()); - - let sender = match envelope.recover_signer() { - Ok(signer) => signer, - Err(err) => return Err(err.into()), - }; - - senders.push(sender); - min_base_fee = min_base_fee.min(envelope.max_fee_per_gas() as i64); // todo type and todo not right - } - - let minimum_base_fee = if min_base_fee == i64::MAX { - 0 - } else { - min_base_fee - }; - - Ok(Self { - bundle: bundle.clone(), - txn_hashes, - senders, - min_base_fee: minimum_base_fee, - state: BundleState::Ready, - state_changed_at: Utc::now(), - }) - } -} diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml new file mode 100644 index 00000000..c0afd402 --- /dev/null +++ b/crates/core/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "tips-core" +version.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true + +[features] +test-utils = ["dep:alloy-signer-local", "dep:op-alloy-rpc-types"] + +[dependencies] +uuid.workspace = true +alloy-primitives.workspace = true +alloy-consensus.workspace = true +alloy-provider.workspace = true +op-alloy-consensus.workspace = true +serde = { version = "1.0.228", default-features = false, features = ["alloc", "derive"] } +alloy-serde = { version = "1.0.41", default-features = false } +alloy-signer-local = { workspace = true, optional = true } +op-alloy-rpc-types = { workspace = true, optional = true } +tracing.workspace = true + +[dev-dependencies] +alloy-signer-local.workspace = true +op-alloy-rpc-types.workspace = true diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs new file mode 100644 index 00000000..3b737b7c --- /dev/null +++ b/crates/core/src/lib.rs @@ -0,0 +1,6 @@ +pub mod types; + +#[cfg(any(test, feature = "test-utils"))] +pub mod test_utils; + +pub use types::{Bundle, BundleHash, BundleWithMetadata, CancelBundle}; diff --git a/crates/core/src/test_utils.rs b/crates/core/src/test_utils.rs new file mode 100644 index 00000000..a5763548 --- /dev/null +++ b/crates/core/src/test_utils.rs @@ -0,0 +1,43 @@ +use crate::{Bundle, BundleWithMetadata}; +use alloy_consensus::SignableTransaction; +use alloy_primitives::{Address, U256}; +use alloy_provider::network::TxSignerSync; +use alloy_provider::network::eip2718::Encodable2718; +use alloy_signer_local::PrivateKeySigner; +use op_alloy_consensus::OpTxEnvelope; +use op_alloy_rpc_types::OpTransactionRequest; + +pub fn create_transaction(from: PrivateKeySigner, nonce: u64, to: Address) -> OpTxEnvelope { + let mut txn = OpTransactionRequest::default() + .value(U256::from(10_000)) + .gas_limit(21_000) + .max_fee_per_gas(200) + .max_priority_fee_per_gas(100) + .from(from.address()) + .to(to) + .nonce(nonce) + .build_typed_tx() + .unwrap(); + + let sig = from.sign_transaction_sync(&mut txn).unwrap(); + OpTxEnvelope::Eip1559(txn.eip1559().cloned().unwrap().into_signed(sig).clone()) +} + +pub fn create_test_bundle( + txns: Vec, + block_number: Option, + min_timestamp: Option, + max_timestamp: Option, +) -> BundleWithMetadata { + let txs = txns.iter().map(|t| t.encoded_2718().into()).collect(); + + let bundle = Bundle { + txs, + block_number: block_number.unwrap_or(0), + min_timestamp, + max_timestamp, + ..Default::default() + }; + + BundleWithMetadata::load(bundle).unwrap() +} diff --git a/crates/core/src/types.rs b/crates/core/src/types.rs new file mode 100644 index 00000000..9e6e645d --- /dev/null +++ b/crates/core/src/types.rs @@ -0,0 +1,205 @@ +use alloy_consensus::transaction::SignerRecoverable; +use alloy_primitives::{Address, B256, Bytes, TxHash, keccak256}; +use alloy_provider::network::eip2718::Decodable2718; +use op_alloy_consensus::OpTxEnvelope; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +#[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct Bundle { + pub txs: Vec, + + #[serde(with = "alloy_serde::quantity")] + pub block_number: u64, + + #[serde( + default, + deserialize_with = "alloy_serde::quantity::opt::deserialize", + skip_serializing_if = "Option::is_none" + )] + pub flashblock_number_min: Option, + + #[serde( + default, + deserialize_with = "alloy_serde::quantity::opt::deserialize", + skip_serializing_if = "Option::is_none" + )] + pub flashblock_number_max: Option, + + #[serde( + default, + deserialize_with = "alloy_serde::quantity::opt::deserialize", + skip_serializing_if = "Option::is_none" + )] + pub min_timestamp: Option, + + #[serde( + default, + deserialize_with = "alloy_serde::quantity::opt::deserialize", + skip_serializing_if = "Option::is_none" + )] + pub max_timestamp: Option, + + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub reverting_tx_hashes: Vec, + + #[serde(default, skip_serializing_if = "Option::is_none")] + pub replacement_uuid: Option, + + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dropping_tx_hashes: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct BundleHash { + pub bundle_hash: B256, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CancelBundle { + pub replacement_uuid: String, +} + +#[derive(Debug, Clone)] +pub struct BundleWithMetadata { + bundle: Bundle, + uuid: Uuid, + transactions: Vec, +} + +impl BundleWithMetadata { + pub fn load(mut bundle: Bundle) -> Result { + let uuid = bundle + .replacement_uuid + .clone() + .unwrap_or_else(|| Uuid::new_v4().to_string()); + + let uuid = Uuid::parse_str(uuid.as_str()).map_err(|_| format!("Invalid UUID: {uuid}"))?; + + bundle.replacement_uuid = Some(uuid.to_string()); + + let transactions: Vec = bundle + .txs + .iter() + .map(|b| { + OpTxEnvelope::decode_2718_exact(b) + .map_err(|e| format!("failed to decode transaction: {e}")) + }) + .collect::, _>>()?; + + Ok(BundleWithMetadata { + bundle, + transactions, + uuid, + }) + } + + pub fn transactions(&self) -> &[OpTxEnvelope] { + self.transactions.as_slice() + } + + pub fn uuid(&self) -> &Uuid { + &self.uuid + } + + pub fn bundle_hash(&self) -> B256 { + let mut concatenated = Vec::new(); + for tx in self.transactions() { + concatenated.extend_from_slice(tx.tx_hash().as_slice()); + } + keccak256(&concatenated) + } + + pub fn txn_hashes(&self) -> Vec { + self.transactions().iter().map(|t| t.tx_hash()).collect() + } + + pub fn bundle(&self) -> &Bundle { + &self.bundle + } + + pub fn senders(&self) -> Vec
{ + self.transactions() + .iter() + .map(|t| t.recover_signer().unwrap()) + .collect() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::test_utils::create_transaction; + use alloy_primitives::Keccak256; + use alloy_provider::network::eip2718::Encodable2718; + use alloy_signer_local::PrivateKeySigner; + + #[test] + fn test_bundle_types() { + let alice = PrivateKeySigner::random(); + let bob = PrivateKeySigner::random(); + + let tx1 = create_transaction(alice.clone(), 1, bob.address()); + let tx2 = create_transaction(alice.clone(), 2, bob.address()); + + let tx1_bytes = tx1.encoded_2718(); + let tx2_bytes = tx2.encoded_2718(); + + let bundle = BundleWithMetadata::load(Bundle { + replacement_uuid: None, + txs: vec![tx1_bytes.clone().into()], + block_number: 1, + ..Default::default() + }) + .unwrap(); + + assert!(!bundle.uuid().is_nil()); + assert_eq!( + bundle.bundle.replacement_uuid, + Some(bundle.uuid().to_string()) + ); + assert_eq!(bundle.txn_hashes().len(), 1); + assert_eq!(bundle.txn_hashes()[0], tx1.tx_hash()); + assert_eq!(bundle.senders().len(), 1); + assert_eq!(bundle.senders()[0], alice.address()); + + // Bundle hashes are keccack256(...txnHashes) + let expected_bundle_hash_single = { + let mut hasher = Keccak256::default(); + hasher.update(keccak256(&tx1_bytes)); + hasher.finalize() + }; + + assert_eq!(bundle.bundle_hash(), expected_bundle_hash_single); + + let uuid = Uuid::new_v4(); + let bundle = BundleWithMetadata::load(Bundle { + replacement_uuid: Some(uuid.to_string()), + txs: vec![tx1_bytes.clone().into(), tx2_bytes.clone().into()], + block_number: 1, + ..Default::default() + }) + .unwrap(); + + assert_eq!(*bundle.uuid(), uuid); + assert_eq!(bundle.bundle.replacement_uuid, Some(uuid.to_string())); + assert_eq!(bundle.txn_hashes().len(), 2); + assert_eq!(bundle.txn_hashes()[0], tx1.tx_hash()); + assert_eq!(bundle.txn_hashes()[1], tx2.tx_hash()); + assert_eq!(bundle.senders().len(), 2); + assert_eq!(bundle.senders()[0], alice.address()); + assert_eq!(bundle.senders()[1], alice.address()); + + let expected_bundle_hash_double = { + let mut hasher = Keccak256::default(); + hasher.update(keccak256(&tx1_bytes)); + hasher.update(keccak256(&tx2_bytes)); + hasher.finalize() + }; + + assert_eq!(bundle.bundle_hash(), expected_bundle_hash_double); + } +} diff --git a/crates/ingress-rpc/Cargo.toml b/crates/ingress-rpc/Cargo.toml index e4ce0fa2..e1c0e2fb 100644 --- a/crates/ingress-rpc/Cargo.toml +++ b/crates/ingress-rpc/Cargo.toml @@ -9,11 +9,11 @@ edition.workspace = true [[bin]] name = "tips-ingress-rpc" -path = "src/main.rs" +path = "src/bin/main.rs" [dependencies] +tips-core.workspace = true jsonrpsee.workspace = true -alloy-rpc-types-mev.workspace = true alloy-primitives.workspace = true op-alloy-network.workspace = true alloy-provider.workspace = true @@ -35,4 +35,3 @@ op-revm.workspace = true revm-context-interface.workspace = true alloy-signer-local.workspace = true reth-optimism-evm.workspace = true -tips-common.workspace = true diff --git a/crates/ingress-rpc/src/main.rs b/crates/ingress-rpc/src/bin/main.rs similarity index 97% rename from crates/ingress-rpc/src/main.rs rename to crates/ingress-rpc/src/bin/main.rs index 6400bc02..ecf43c14 100644 --- a/crates/ingress-rpc/src/main.rs +++ b/crates/ingress-rpc/src/bin/main.rs @@ -6,16 +6,12 @@ use rdkafka::ClientConfig; use rdkafka::producer::FutureProducer; use std::fs; use std::net::IpAddr; +use tips_ingress_rpc::queue::KafkaQueuePublisher; +use tips_ingress_rpc::service::{IngressApiServer, IngressService}; use tracing::{info, warn}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; use url::Url; -mod queue; -mod service; -mod validation; -use queue::KafkaQueuePublisher; -use service::{IngressApiServer, IngressService}; - #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] struct Config { diff --git a/crates/ingress-rpc/src/lib.rs b/crates/ingress-rpc/src/lib.rs new file mode 100644 index 00000000..f3f3c927 --- /dev/null +++ b/crates/ingress-rpc/src/lib.rs @@ -0,0 +1,3 @@ +pub mod queue; +pub mod service; +pub mod validation; diff --git a/crates/ingress-rpc/src/queue.rs b/crates/ingress-rpc/src/queue.rs index a02a3e21..e470e3fe 100644 --- a/crates/ingress-rpc/src/queue.rs +++ b/crates/ingress-rpc/src/queue.rs @@ -3,14 +3,14 @@ use anyhow::Result; use async_trait::async_trait; use backon::{ExponentialBuilder, Retryable}; use rdkafka::producer::{FutureProducer, FutureRecord}; -use tips_common::BundleWithMetadata; +use tips_core::Bundle; use tokio::time::Duration; use tracing::{error, info}; /// A queue to buffer transactions #[async_trait] pub trait QueuePublisher: Send + Sync { - async fn publish(&self, bundle: &BundleWithMetadata, bundle_hash: &B256) -> Result<()>; + async fn publish(&self, bundle: &Bundle, bundle_hash: &B256) -> Result<()>; } /// A queue to buffer transactions @@ -27,7 +27,7 @@ impl KafkaQueuePublisher { #[async_trait] impl QueuePublisher for KafkaQueuePublisher { - async fn publish(&self, bundle: &BundleWithMetadata, bundle_hash: &B256) -> Result<()> { + async fn publish(&self, bundle: &Bundle, bundle_hash: &B256) -> Result<()> { let key = bundle_hash.to_string(); let payload = serde_json::to_vec(&bundle)?; @@ -74,12 +74,12 @@ impl QueuePublisher for KafkaQueuePublisher { #[cfg(test)] mod tests { use super::*; - use alloy_rpc_types_mev::EthSendBundle; use rdkafka::config::ClientConfig; + use tips_core::BundleWithMetadata; use tokio::time::{Duration, Instant}; - fn create_test_bundle() -> BundleWithMetadata { - BundleWithMetadata::new(&EthSendBundle::default()).unwrap() + fn create_test_bundle() -> Bundle { + Bundle::default() } #[tokio::test] @@ -93,7 +93,8 @@ mod tests { let publisher = KafkaQueuePublisher::new(producer, "tips-ingress-rpc".to_string()); let bundle = create_test_bundle(); - let bundle_hash = bundle.bundle.bundle_hash(); + let bundle_with_metadata = BundleWithMetadata::load(bundle.clone()).unwrap(); + let bundle_hash = bundle_with_metadata.bundle_hash(); let start = Instant::now(); let result = publisher.publish(&bundle, &bundle_hash).await; diff --git a/crates/ingress-rpc/src/service.rs b/crates/ingress-rpc/src/service.rs index 789bf9d7..44c46d00 100644 --- a/crates/ingress-rpc/src/service.rs +++ b/crates/ingress-rpc/src/service.rs @@ -2,7 +2,6 @@ use alloy_consensus::transaction::Recovered; use alloy_consensus::{Transaction, transaction::SignerRecoverable}; use alloy_primitives::{B256, Bytes}; use alloy_provider::{Provider, RootProvider, network::eip2718::Decodable2718}; -use alloy_rpc_types_mev::{EthBundleHash, EthCancelBundle, EthSendBundle}; use jsonrpsee::{ core::{RpcResult, async_trait}, proc_macros::rpc, @@ -11,7 +10,7 @@ use op_alloy_consensus::OpTxEnvelope; use op_alloy_network::Optimism; use reth_rpc_eth_types::EthApiError; use std::time::{SystemTime, UNIX_EPOCH}; -use tips_common::BundleWithMetadata; +use tips_core::{Bundle, BundleHash, BundleWithMetadata, CancelBundle}; use tracing::{info, warn}; use crate::queue::QueuePublisher; @@ -21,11 +20,11 @@ use crate::validation::{AccountInfoLookup, L1BlockInfoLookup, validate_bundle, v pub trait IngressApi { /// `eth_sendBundle` can be used to send your bundles to the builder. #[method(name = "sendBundle")] - async fn send_bundle(&self, bundle: EthSendBundle) -> RpcResult; + async fn send_bundle(&self, bundle: Bundle) -> RpcResult; /// `eth_cancelBundle` is used to prevent a submitted bundle from being included on-chain. #[method(name = "cancelBundle")] - async fn cancel_bundle(&self, request: EthCancelBundle) -> RpcResult<()>; + async fn cancel_bundle(&self, request: CancelBundle) -> RpcResult<()>; /// Handler for: `eth_sendRawTransaction` #[method(name = "sendRawTransaction")] @@ -60,14 +59,13 @@ impl IngressApiServer for IngressService where Queue: QueuePublisher + Sync + Send + 'static, { - async fn send_bundle(&self, bundle: EthSendBundle) -> RpcResult { - let bundle_with_metadata = self.validate_bundle(&bundle).await?; + async fn send_bundle(&self, bundle: Bundle) -> RpcResult { + let bundle_with_metadata = self.validate_bundle(bundle).await?; - // Queue the bundle - let bundle_hash = bundle.bundle_hash(); + let bundle_hash = bundle_with_metadata.bundle_hash(); if let Err(e) = self .queue - .publish(&bundle_with_metadata, &bundle_hash) + .publish(bundle_with_metadata.bundle(), &bundle_hash) .await { warn!(message = "Failed to publish bundle to queue", bundle_hash = %bundle_hash, error = %e); @@ -77,15 +75,13 @@ where info!( message = "queued bundle", bundle_hash = %bundle_hash, - tx_count = bundle.txs.len(), + tx_count = bundle_with_metadata.transactions().len(), ); - Ok(EthBundleHash { - bundle_hash: bundle.bundle_hash(), - }) + Ok(BundleHash { bundle_hash }) } - async fn cancel_bundle(&self, _request: EthCancelBundle) -> RpcResult<()> { + async fn cancel_bundle(&self, _request: CancelBundle) -> RpcResult<()> { warn!( message = "TODO: implement cancel_bundle", method = "cancel_bundle" @@ -102,22 +98,19 @@ where .as_secs() + self.send_transaction_default_lifetime_seconds; - let bundle = EthSendBundle { + let bundle = Bundle { txs: vec![data.clone()], - block_number: 0, - min_timestamp: None, max_timestamp: Some(expiry_timestamp), reverting_tx_hashes: vec![transaction.tx_hash()], ..Default::default() }; - // queue the bundle - let bundle_with_metadata = BundleWithMetadata::new(&bundle) + let bundle_with_metadata = BundleWithMetadata::load(bundle) .map_err(|e| EthApiError::InvalidParams(e.to_string()).into_rpc_err())?; - let bundle_hash = bundle.bundle_hash(); + let bundle_hash = bundle_with_metadata.bundle_hash(); if let Err(e) = self .queue - .publish(&bundle_with_metadata, &bundle_hash) + .publish(bundle_with_metadata.bundle(), &bundle_hash) .await { warn!(message = "Failed to publish Queue::enqueue_bundle", bundle_hash = %bundle_hash, error = %e); @@ -175,7 +168,7 @@ where Ok(transaction) } - async fn validate_bundle(&self, bundle: &EthSendBundle) -> RpcResult { + async fn validate_bundle(&self, bundle: Bundle) -> RpcResult { if bundle.txs.is_empty() { return Err( EthApiError::InvalidParams("Bundle cannot have empty transactions".into()) @@ -188,10 +181,11 @@ where let transaction = self.validate_tx(tx_data).await?; total_gas = total_gas.saturating_add(transaction.gas_limit()); } - validate_bundle(bundle, total_gas)?; + validate_bundle(&bundle, total_gas)?; - let bundle_with_metadata = BundleWithMetadata::new(bundle) + let bundle_with_metadata = BundleWithMetadata::load(bundle) .map_err(|e| EthApiError::InvalidParams(e.to_string()).into_rpc_err())?; + Ok(bundle_with_metadata) } } diff --git a/crates/ingress-rpc/src/validation.rs b/crates/ingress-rpc/src/validation.rs index b9d1d2e4..9d5f4ba5 100644 --- a/crates/ingress-rpc/src/validation.rs +++ b/crates/ingress-rpc/src/validation.rs @@ -2,7 +2,6 @@ use alloy_consensus::private::alloy_eips::{BlockId, BlockNumberOrTag}; use alloy_consensus::{Transaction, Typed2718, constants::KECCAK_EMPTY, transaction::Recovered}; use alloy_primitives::{Address, B256, U256}; use alloy_provider::{Provider, RootProvider}; -use alloy_rpc_types_mev::EthSendBundle; use async_trait::async_trait; use jsonrpsee::core::RpcResult; use op_alloy_consensus::interop::CROSS_L2_INBOX_ADDRESS; @@ -11,6 +10,7 @@ use op_revm::{OpSpecId, l1block::L1BlockInfo}; use reth_optimism_evm::extract_l1_info_from_tx; use reth_rpc_eth_types::{EthApiError, RpcInvalidTransactionError, SignError}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; +use tips_core::Bundle; use tracing::warn; // TODO: make this configurable @@ -166,7 +166,7 @@ pub async fn validate_tx( /// Helper function to validate propeties of a bundle. A bundle is valid if it satisfies the following criteria: /// - The bundle's max_timestamp is not more than 1 hour in the future /// - The bundle's gas limit is not greater than the maximum allowed gas limit -pub fn validate_bundle(bundle: &EthSendBundle, bundle_gas: u64) -> RpcResult<()> { +pub fn validate_bundle(bundle: &Bundle, bundle_gas: u64) -> RpcResult<()> { // Don't allow bundles to be submitted over 1 hour into the future // TODO: make the window configurable let valid_timestamp_window = SystemTime::now() @@ -499,7 +499,7 @@ mod tests { .unwrap() .as_secs(); let too_far_in_the_future = current_time + 3601; - let bundle = EthSendBundle { + let bundle = Bundle { txs: vec![], max_timestamp: Some(too_far_in_the_future), ..Default::default() @@ -545,7 +545,7 @@ mod tests { encoded_txs.push(Bytes::from(encoded)); } - let bundle = EthSendBundle { + let bundle = Bundle { txs: encoded_txs, block_number: 0, min_timestamp: None,