refactor(sdk): complete generic impl for PersistenceService over N::Primitives (#13044)

This commit is contained in:
Léa Narzis
2024-12-04 11:50:46 +01:00
committed by GitHub
parent c060df92af
commit 025885f2ad
5 changed files with 143 additions and 131 deletions

213
Cargo.lock generated
View File

@ -91,9 +91,9 @@ dependencies = [
[[package]] [[package]]
name = "allocator-api2" name = "allocator-api2"
version = "0.2.20" version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]] [[package]]
name = "alloy-chains" name = "alloy-chains"
@ -161,7 +161,7 @@ dependencies = [
"alloy-transport", "alloy-transport",
"futures", "futures",
"futures-util", "futures-util",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -265,7 +265,7 @@ dependencies = [
"alloy-sol-types", "alloy-sol-types",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
] ]
@ -291,7 +291,7 @@ dependencies = [
"futures-utils-wasm", "futures-utils-wasm",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -319,7 +319,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"serde_json", "serde_json",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
"url", "url",
] ]
@ -341,7 +341,7 @@ dependencies = [
"getrandom 0.2.15", "getrandom 0.2.15",
"hashbrown 0.15.2", "hashbrown 0.15.2",
"hex-literal", "hex-literal",
"indexmap 2.6.0", "indexmap 2.7.0",
"itoa", "itoa",
"k256", "k256",
"keccak-asm", "keccak-asm",
@ -390,7 +390,7 @@ dependencies = [
"schnellru", "schnellru",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
"url", "url",
@ -523,7 +523,7 @@ dependencies = [
"alloy-serde", "alloy-serde",
"serde", "serde",
"serde_with", "serde_with",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -604,7 +604,7 @@ dependencies = [
"alloy-serde", "alloy-serde",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -642,7 +642,7 @@ dependencies = [
"auto_impl", "auto_impl",
"elliptic-curve", "elliptic-curve",
"k256", "k256",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -660,7 +660,7 @@ dependencies = [
"coins-bip39", "coins-bip39",
"k256", "k256",
"rand 0.8.5", "rand 0.8.5",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -686,7 +686,7 @@ dependencies = [
"alloy-sol-macro-input", "alloy-sol-macro-input",
"const-hex", "const-hex",
"heck", "heck",
"indexmap 2.6.0", "indexmap 2.7.0",
"proc-macro-error2", "proc-macro-error2",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -745,7 +745,7 @@ dependencies = [
"futures-utils-wasm", "futures-utils-wasm",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tower 0.5.1", "tower 0.5.1",
"tracing", "tracing",
@ -897,9 +897,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.93" version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
[[package]] [[package]]
name = "aquamarine" name = "aquamarine"
@ -1385,7 +1385,7 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"boa_interner", "boa_interner",
"boa_macros", "boa_macros",
"indexmap 2.6.0", "indexmap 2.7.0",
"num-bigint", "num-bigint",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
] ]
@ -1411,7 +1411,7 @@ dependencies = [
"fast-float", "fast-float",
"hashbrown 0.14.5", "hashbrown 0.14.5",
"icu_normalizer", "icu_normalizer",
"indexmap 2.6.0", "indexmap 2.7.0",
"intrusive-collections", "intrusive-collections",
"itertools 0.13.0", "itertools 0.13.0",
"num-bigint", "num-bigint",
@ -1457,7 +1457,7 @@ dependencies = [
"boa_gc", "boa_gc",
"boa_macros", "boa_macros",
"hashbrown 0.14.5", "hashbrown 0.14.5",
"indexmap 2.6.0", "indexmap 2.7.0",
"once_cell", "once_cell",
"phf", "phf",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
@ -1783,9 +1783,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.21" version = "4.5.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -1793,9 +1793,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.21" version = "4.5.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -2655,7 +2655,7 @@ dependencies = [
"revm", "revm",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"walkdir", "walkdir",
] ]
@ -2811,7 +2811,7 @@ dependencies = [
"reth-node-ethereum", "reth-node-ethereum",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -2899,7 +2899,7 @@ dependencies = [
"reth-tracing", "reth-tracing",
"reth-trie-db", "reth-trie-db",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
] ]
@ -3538,7 +3538,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"http", "http",
"indexmap 2.6.0", "indexmap 2.7.0",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@ -3699,9 +3699,9 @@ dependencies = [
[[package]] [[package]]
name = "http" name = "http"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -4133,9 +4133,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.6.0" version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
dependencies = [ dependencies = [
"arbitrary", "arbitrary",
"equivalent", "equivalent",
@ -4162,7 +4162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88" checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88"
dependencies = [ dependencies = [
"ahash", "ahash",
"indexmap 2.6.0", "indexmap 2.7.0",
"is-terminal", "is-terminal",
"itoa", "itoa",
"log", "log",
@ -4891,7 +4891,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b6f8152da6d7892ff1b7a1c0fa3f435e92b5918ad67035c3bb432111d9a29b" checksum = "85b6f8152da6d7892ff1b7a1c0fa3f435e92b5918ad67035c3bb432111d9a29b"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"indexmap 2.6.0", "indexmap 2.7.0",
"metrics", "metrics",
"metrics-util", "metrics-util",
"quanta", "quanta",
@ -4923,7 +4923,7 @@ dependencies = [
"crossbeam-epoch", "crossbeam-epoch",
"crossbeam-utils", "crossbeam-utils",
"hashbrown 0.15.2", "hashbrown 0.15.2",
"indexmap 2.6.0", "indexmap 2.7.0",
"metrics", "metrics",
"ordered-float", "ordered-float",
"quanta", "quanta",
@ -5342,7 +5342,7 @@ dependencies = [
"derive_more 1.0.0", "derive_more 1.0.0",
"serde", "serde",
"serde_with", "serde_with",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -5357,7 +5357,7 @@ dependencies = [
"alloy-sol-types", "alloy-sol-types",
"serde", "serde",
"serde_repr", "serde_repr",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -5394,7 +5394,7 @@ dependencies = [
"op-alloy-consensus", "op-alloy-consensus",
"op-alloy-genesis", "op-alloy-genesis",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
"unsigned-varint", "unsigned-varint",
] ]
@ -5434,7 +5434,7 @@ dependencies = [
"op-alloy-protocol", "op-alloy-protocol",
"serde", "serde",
"snap", "snap",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -5514,9 +5514,9 @@ dependencies = [
[[package]] [[package]]
name = "parity-scale-codec" name = "parity-scale-codec"
version = "3.7.0" version = "3.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be4817d39f3272f69c59fe05d0535ae6456c2dc2fa1ba02910296c7e0a5c590" checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee"
dependencies = [ dependencies = [
"arbitrary", "arbitrary",
"arrayvec", "arrayvec",
@ -5525,20 +5525,19 @@ dependencies = [
"bytes", "bytes",
"impl-trait-for-tuples", "impl-trait-for-tuples",
"parity-scale-codec-derive", "parity-scale-codec-derive",
"rustversion",
"serde", "serde",
] ]
[[package]] [[package]]
name = "parity-scale-codec-derive" name = "parity-scale-codec-derive"
version = "3.7.0" version = "3.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn 1.0.109",
] ]
[[package]] [[package]]
@ -6058,7 +6057,7 @@ dependencies = [
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
"rustls", "rustls",
"socket2", "socket2",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -6077,7 +6076,7 @@ dependencies = [
"rustls", "rustls",
"rustls-pki-types", "rustls-pki-types",
"slab", "slab",
"thiserror 2.0.3", "thiserror 2.0.4",
"tinyvec", "tinyvec",
"tracing", "tracing",
"web-time", "web-time",
@ -6535,7 +6534,7 @@ dependencies = [
"reth-tokio-util", "reth-tokio-util",
"reth-tracing", "reth-tracing",
"schnellru", "schnellru",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
@ -6571,7 +6570,7 @@ dependencies = [
"reth-rpc-types-compat", "reth-rpc-types-compat",
"reth-tracing", "reth-tracing",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tower 0.4.13", "tower 0.4.13",
"tracing", "tracing",
@ -6625,7 +6624,7 @@ dependencies = [
"reth-execution-errors", "reth-execution-errors",
"reth-primitives", "reth-primitives",
"reth-storage-errors", "reth-storage-errors",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -6781,7 +6780,7 @@ dependencies = [
"reth-fs-util", "reth-fs-util",
"secp256k1", "secp256k1",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tikv-jemallocator", "tikv-jemallocator",
"tracy-client", "tracy-client",
] ]
@ -6926,7 +6925,7 @@ dependencies = [
"sysinfo", "sysinfo",
"tempfile", "tempfile",
"test-fuzz", "test-fuzz",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -6983,7 +6982,7 @@ dependencies = [
"reth-trie-db", "reth-trie-db",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
] ]
@ -7025,7 +7024,7 @@ dependencies = [
"schnellru", "schnellru",
"secp256k1", "secp256k1",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
@ -7050,7 +7049,7 @@ dependencies = [
"reth-network-peers", "reth-network-peers",
"reth-tracing", "reth-tracing",
"secp256k1", "secp256k1",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -7076,7 +7075,7 @@ dependencies = [
"secp256k1", "secp256k1",
"serde", "serde",
"serde_with", "serde_with",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
@ -7115,7 +7114,7 @@ dependencies = [
"reth-testing-utils", "reth-testing-utils",
"reth-tracing", "reth-tracing",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@ -7192,7 +7191,7 @@ dependencies = [
"secp256k1", "secp256k1",
"sha2 0.10.8", "sha2 0.10.8",
"sha3", "sha3",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@ -7248,7 +7247,7 @@ dependencies = [
"reth-primitives-traits", "reth-primitives-traits",
"reth-trie", "reth-trie",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
] ]
@ -7275,7 +7274,7 @@ dependencies = [
"reth-prune", "reth-prune",
"reth-stages-api", "reth-stages-api",
"reth-tasks", "reth-tasks",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
] ]
@ -7330,7 +7329,7 @@ dependencies = [
"reth-trie-parallel", "reth-trie-parallel",
"reth-trie-sparse", "reth-trie-sparse",
"revm-primitives", "revm-primitives",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -7376,7 +7375,7 @@ dependencies = [
"reth-execution-errors", "reth-execution-errors",
"reth-fs-util", "reth-fs-util",
"reth-storage-errors", "reth-storage-errors",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -7409,7 +7408,7 @@ dependencies = [
"serde", "serde",
"snap", "snap",
"test-fuzz", "test-fuzz",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@ -7438,7 +7437,7 @@ dependencies = [
"reth-primitives", "reth-primitives",
"reth-primitives-traits", "reth-primitives-traits",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -7504,7 +7503,7 @@ dependencies = [
"proptest-derive", "proptest-derive",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -7605,7 +7604,7 @@ dependencies = [
"reth-prune-types", "reth-prune-types",
"reth-storage-errors", "reth-storage-errors",
"revm-primitives", "revm-primitives",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -7700,7 +7699,7 @@ dependencies = [
"reth-transaction-pool", "reth-transaction-pool",
"reth-trie-db", "reth-trie-db",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
] ]
@ -7727,7 +7726,7 @@ version = "1.1.2"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -7770,7 +7769,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"reth-tracing", "reth-tracing",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@ -7787,7 +7786,7 @@ dependencies = [
"criterion", "criterion",
"dashmap 6.1.0", "dashmap 6.1.0",
"derive_more 1.0.0", "derive_more 1.0.0",
"indexmap 2.6.0", "indexmap 2.7.0",
"parking_lot", "parking_lot",
"pprof", "pprof",
"rand 0.8.5", "rand 0.8.5",
@ -7795,7 +7794,7 @@ dependencies = [
"reth-mdbx-sys", "reth-mdbx-sys",
"smallvec", "smallvec",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
] ]
@ -7834,7 +7833,7 @@ dependencies = [
"reqwest", "reqwest",
"reth-tracing", "reth-tracing",
"serde_with", "serde_with",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -7894,7 +7893,7 @@ dependencies = [
"serial_test", "serial_test",
"smallvec", "smallvec",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@ -7919,7 +7918,7 @@ dependencies = [
"reth-network-types", "reth-network-types",
"reth-tokio-util", "reth-tokio-util",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
] ]
@ -7957,7 +7956,7 @@ dependencies = [
"secp256k1", "secp256k1",
"serde_json", "serde_json",
"serde_with", "serde_with",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"url", "url",
] ]
@ -7988,7 +7987,7 @@ dependencies = [
"reth-fs-util", "reth-fs-util",
"serde", "serde",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
"zstd", "zstd",
] ]
@ -8122,7 +8121,7 @@ dependencies = [
"serde", "serde",
"shellexpand", "shellexpand",
"strum", "strum",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"toml", "toml",
"tracing", "tracing",
@ -8450,7 +8449,7 @@ dependencies = [
"reth-transaction-pool", "reth-transaction-pool",
"revm", "revm",
"sha2 0.10.8", "sha2 0.10.8",
"thiserror 2.0.3", "thiserror 2.0.4",
"tracing", "tracing",
] ]
@ -8517,7 +8516,7 @@ dependencies = [
"reth-transaction-pool", "reth-transaction-pool",
"revm", "revm",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -8582,7 +8581,7 @@ dependencies = [
"reth-primitives", "reth-primitives",
"revm-primitives", "revm-primitives",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
] ]
@ -8757,7 +8756,7 @@ dependencies = [
"reth-tokio-util", "reth-tokio-util",
"reth-tracing", "reth-tracing",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -8778,7 +8777,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"test-fuzz", "test-fuzz",
"thiserror 2.0.3", "thiserror 2.0.4",
"toml", "toml",
] ]
@ -8864,7 +8863,7 @@ dependencies = [
"revm-primitives", "revm-primitives",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tower 0.4.13", "tower 0.4.13",
@ -8958,7 +8957,7 @@ dependencies = [
"reth-transaction-pool", "reth-transaction-pool",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-util", "tokio-util",
"tower 0.4.13", "tower 0.4.13",
@ -8999,7 +8998,7 @@ dependencies = [
"reth-tokio-util", "reth-tokio-util",
"reth-transaction-pool", "reth-transaction-pool",
"serde", "serde",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -9083,7 +9082,7 @@ dependencies = [
"schnellru", "schnellru",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
@ -9183,7 +9182,7 @@ dependencies = [
"reth-trie", "reth-trie",
"reth-trie-db", "reth-trie-db",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -9210,7 +9209,7 @@ dependencies = [
"reth-static-file-types", "reth-static-file-types",
"reth-testing-utils", "reth-testing-utils",
"reth-tokio-util", "reth-tokio-util",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
@ -9316,7 +9315,7 @@ dependencies = [
"pin-project", "pin-project",
"rayon", "rayon",
"reth-metrics", "reth-metrics",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
"tracing-futures", "tracing-futures",
@ -9400,7 +9399,7 @@ dependencies = [
"serde_json", "serde_json",
"smallvec", "smallvec",
"tempfile", "tempfile",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
@ -9515,7 +9514,7 @@ dependencies = [
"reth-trie", "reth-trie",
"reth-trie-common", "reth-trie-common",
"reth-trie-db", "reth-trie-db",
"thiserror 2.0.3", "thiserror 2.0.4",
"tokio", "tokio",
"tracing", "tracing",
] ]
@ -9541,7 +9540,7 @@ dependencies = [
"reth-trie", "reth-trie",
"reth-trie-common", "reth-trie-common",
"smallvec", "smallvec",
"thiserror 2.0.3", "thiserror 2.0.4",
] ]
[[package]] [[package]]
@ -10180,7 +10179,7 @@ version = "1.0.133"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
dependencies = [ dependencies = [
"indexmap 2.6.0", "indexmap 2.7.0",
"itoa", "itoa",
"memchr", "memchr",
"ryu", "ryu",
@ -10240,7 +10239,7 @@ dependencies = [
"chrono", "chrono",
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.6.0", "indexmap 2.7.0",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -10484,9 +10483,9 @@ dependencies = [
[[package]] [[package]]
name = "soketto" name = "soketto"
version = "0.8.0" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37468c595637c10857701c990f93a40ce0e357cedb0953d1c26c8d8027f9bb53" checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"bytes", "bytes",
@ -10775,11 +10774,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.3" version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490"
dependencies = [ dependencies = [
"thiserror-impl 2.0.3", "thiserror-impl 2.0.4",
] ]
[[package]] [[package]]
@ -10795,9 +10794,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.3" version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -10856,9 +10855,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.36" version = "0.3.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa", "itoa",
@ -10880,9 +10879,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.18" version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de"
dependencies = [ dependencies = [
"num-conv", "num-conv",
"time-core", "time-core",
@ -10934,9 +10933,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.41.1" version = "1.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@ -11042,7 +11041,7 @@ version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [ dependencies = [
"indexmap 2.6.0", "indexmap 2.7.0",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",

View File

@ -88,7 +88,7 @@ where
if chain_spec.is_optimism() { EngineApiKind::OpStack } else { EngineApiKind::Ethereum }; if chain_spec.is_optimism() { EngineApiKind::OpStack } else { EngineApiKind::Ethereum };
let persistence_handle = let persistence_handle =
PersistenceHandle::spawn_service(provider, pruner, sync_metrics_tx); PersistenceHandle::<N::Primitives>::spawn_service(provider, pruner, sync_metrics_tx);
let canonical_in_memory_state = blockchain_db.canonical_in_memory_state(); let canonical_in_memory_state = blockchain_db.canonical_in_memory_state();
let (to_tree_tx, from_tree) = EngineApiTreeHandler::<N::Primitives, _, _, _, _>::spawn_new( let (to_tree_tx, from_tree) = EngineApiTreeHandler::<N::Primitives, _, _, _, _>::spawn_new(

View File

@ -18,6 +18,7 @@ reth-engine-tree.workspace = true
reth-evm.workspace = true reth-evm.workspace = true
reth-network-p2p.workspace = true reth-network-p2p.workspace = true
reth-payload-builder.workspace = true reth-payload-builder.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true reth-provider.workspace = true
reth-prune.workspace = true reth-prune.workspace = true
reth-stages-api.workspace = true reth-stages-api.workspace = true

View File

@ -19,6 +19,7 @@ use reth_evm::execute::BlockExecutorProvider;
use reth_network_p2p::EthBlockClient; use reth_network_p2p::EthBlockClient;
use reth_node_types::{BlockTy, NodeTypesWithEngine}; use reth_node_types::{BlockTy, NodeTypesWithEngine};
use reth_payload_builder::PayloadBuilderHandle; use reth_payload_builder::PayloadBuilderHandle;
use reth_primitives::EthPrimitives;
use reth_provider::{providers::BlockchainProvider2, ProviderFactory}; use reth_provider::{providers::BlockchainProvider2, ProviderFactory};
use reth_prune::PrunerWithFactory; use reth_prune::PrunerWithFactory;
use reth_stages_api::{MetricEventsSender, Pipeline}; use reth_stages_api::{MetricEventsSender, Pipeline};
@ -90,7 +91,7 @@ where
let downloader = BasicBlockDownloader::new(client, consensus.clone().as_consensus()); let downloader = BasicBlockDownloader::new(client, consensus.clone().as_consensus());
let persistence_handle = let persistence_handle =
PersistenceHandle::spawn_service(provider, pruner, sync_metrics_tx); PersistenceHandle::<EthPrimitives>::spawn_service(provider, pruner, sync_metrics_tx);
let canonical_in_memory_state = blockchain_db.canonical_in_memory_state(); let canonical_in_memory_state = blockchain_db.canonical_in_memory_state();

View File

@ -30,11 +30,14 @@ impl<T> PersistenceNodeTypes for T where T: ProviderNodeTypes<Primitives = EthPr
/// This should be spawned in its own thread with [`std::thread::spawn`], since this performs /// This should be spawned in its own thread with [`std::thread::spawn`], since this performs
/// blocking I/O operations in an endless loop. /// blocking I/O operations in an endless loop.
#[derive(Debug)] #[derive(Debug)]
pub struct PersistenceService<N: ProviderNodeTypes> { pub struct PersistenceService<N>
where
N: PersistenceNodeTypes,
{
/// The provider factory to use /// The provider factory to use
provider: ProviderFactory<N>, provider: ProviderFactory<N>,
/// Incoming requests /// Incoming requests
incoming: Receiver<PersistenceAction>, incoming: Receiver<PersistenceAction<N::Primitives>>,
/// The pruner /// The pruner
pruner: PrunerWithFactory<ProviderFactory<N>>, pruner: PrunerWithFactory<ProviderFactory<N>>,
/// metrics /// metrics
@ -43,11 +46,14 @@ pub struct PersistenceService<N: ProviderNodeTypes> {
sync_metrics_tx: MetricEventsSender, sync_metrics_tx: MetricEventsSender,
} }
impl<N: ProviderNodeTypes> PersistenceService<N> { impl<N> PersistenceService<N>
where
N: PersistenceNodeTypes,
{
/// Create a new persistence service /// Create a new persistence service
pub fn new( pub fn new(
provider: ProviderFactory<N>, provider: ProviderFactory<N>,
incoming: Receiver<PersistenceAction>, incoming: Receiver<PersistenceAction<N::Primitives>>,
pruner: PrunerWithFactory<ProviderFactory<N>>, pruner: PrunerWithFactory<ProviderFactory<N>>,
sync_metrics_tx: MetricEventsSender, sync_metrics_tx: MetricEventsSender,
) -> Self { ) -> Self {
@ -66,7 +72,10 @@ impl<N: ProviderNodeTypes> PersistenceService<N> {
} }
} }
impl<N: PersistenceNodeTypes> PersistenceService<N> { impl<N> PersistenceService<N>
where
N: PersistenceNodeTypes,
{
/// This is the main loop, that will listen to database events and perform the requested /// This is the main loop, that will listen to database events and perform the requested
/// database actions /// database actions
pub fn run(mut self) -> Result<(), PersistenceError> { pub fn run(mut self) -> Result<(), PersistenceError> {
@ -135,7 +144,7 @@ impl<N: PersistenceNodeTypes> PersistenceService<N> {
fn on_save_blocks( fn on_save_blocks(
&self, &self,
blocks: Vec<ExecutedBlock>, blocks: Vec<ExecutedBlock<N::Primitives>>,
) -> Result<Option<BlockNumHash>, PersistenceError> { ) -> Result<Option<BlockNumHash>, PersistenceError> {
debug!(target: "engine::persistence", first=?blocks.first().map(|b| b.block.num_hash()), last=?blocks.last().map(|b| b.block.num_hash()), "Saving range of blocks"); debug!(target: "engine::persistence", first=?blocks.first().map(|b| b.block.num_hash()), last=?blocks.last().map(|b| b.block.num_hash()), "Saving range of blocks");
let start_time = Instant::now(); let start_time = Instant::now();
@ -194,27 +203,29 @@ pub enum PersistenceAction<N: NodePrimitives = EthPrimitives> {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct PersistenceHandle<N: NodePrimitives = EthPrimitives> { pub struct PersistenceHandle<N: NodePrimitives = EthPrimitives> {
/// The channel used to communicate with the persistence service /// The channel used to communicate with the persistence service
sender: Sender<PersistenceAction>, sender: Sender<PersistenceAction<N>>,
_marker: std::marker::PhantomData<N>,
} }
impl<T: NodePrimitives> PersistenceHandle<T> { impl<T: NodePrimitives> PersistenceHandle<T> {
/// Create a new [`PersistenceHandle`] from a [`Sender<PersistenceAction>`]. /// Create a new [`PersistenceHandle`] from a [`Sender<PersistenceAction>`].
pub const fn new(sender: Sender<PersistenceAction>) -> Self { pub const fn new(sender: Sender<PersistenceAction<T>>) -> Self {
Self { sender, _marker: std::marker::PhantomData } Self { sender }
} }
/// Create a new [`PersistenceHandle`], and spawn the persistence service. /// Create a new [`PersistenceHandle`], and spawn the persistence service.
pub fn spawn_service<N: PersistenceNodeTypes>( pub fn spawn_service<N>(
provider_factory: ProviderFactory<N>, provider_factory: ProviderFactory<N>,
pruner: PrunerWithFactory<ProviderFactory<N>>, pruner: PrunerWithFactory<ProviderFactory<N>>,
sync_metrics_tx: MetricEventsSender, sync_metrics_tx: MetricEventsSender,
) -> Self { ) -> PersistenceHandle<N::Primitives>
where
N: PersistenceNodeTypes,
{
// create the initial channels // create the initial channels
let (db_service_tx, db_service_rx) = std::sync::mpsc::channel(); let (db_service_tx, db_service_rx) = std::sync::mpsc::channel();
// construct persistence handle // construct persistence handle
let persistence_handle = Self::new(db_service_tx); let persistence_handle = PersistenceHandle::new(db_service_tx);
// spawn the persistence service // spawn the persistence service
let db_service = let db_service =
@ -235,8 +246,8 @@ impl<T: NodePrimitives> PersistenceHandle<T> {
/// for creating any channels for the given action. /// for creating any channels for the given action.
pub fn send_action( pub fn send_action(
&self, &self,
action: PersistenceAction, action: PersistenceAction<T>,
) -> Result<(), SendError<PersistenceAction>> { ) -> Result<(), SendError<PersistenceAction<T>>> {
self.sender.send(action) self.sender.send(action)
} }
@ -250,9 +261,9 @@ impl<T: NodePrimitives> PersistenceHandle<T> {
/// If there are no blocks to persist, then `None` is sent in the sender. /// If there are no blocks to persist, then `None` is sent in the sender.
pub fn save_blocks( pub fn save_blocks(
&self, &self,
blocks: Vec<ExecutedBlock>, blocks: Vec<ExecutedBlock<T>>,
tx: oneshot::Sender<Option<BlockNumHash>>, tx: oneshot::Sender<Option<BlockNumHash>>,
) -> Result<(), SendError<PersistenceAction>> { ) -> Result<(), SendError<PersistenceAction<T>>> {
self.send_action(PersistenceAction::SaveBlocks(blocks, tx)) self.send_action(PersistenceAction::SaveBlocks(blocks, tx))
} }
@ -260,7 +271,7 @@ impl<T: NodePrimitives> PersistenceHandle<T> {
pub fn save_finalized_block_number( pub fn save_finalized_block_number(
&self, &self,
finalized_block: u64, finalized_block: u64,
) -> Result<(), SendError<PersistenceAction>> { ) -> Result<(), SendError<PersistenceAction<T>>> {
self.send_action(PersistenceAction::SaveFinalizedBlock(finalized_block)) self.send_action(PersistenceAction::SaveFinalizedBlock(finalized_block))
} }
@ -268,7 +279,7 @@ impl<T: NodePrimitives> PersistenceHandle<T> {
pub fn save_safe_block_number( pub fn save_safe_block_number(
&self, &self,
safe_block: u64, safe_block: u64,
) -> Result<(), SendError<PersistenceAction>> { ) -> Result<(), SendError<PersistenceAction<T>>> {
self.send_action(PersistenceAction::SaveSafeBlock(safe_block)) self.send_action(PersistenceAction::SaveSafeBlock(safe_block))
} }
@ -281,7 +292,7 @@ impl<T: NodePrimitives> PersistenceHandle<T> {
&self, &self,
block_num: u64, block_num: u64,
tx: oneshot::Sender<Option<BlockNumHash>>, tx: oneshot::Sender<Option<BlockNumHash>>,
) -> Result<(), SendError<PersistenceAction>> { ) -> Result<(), SendError<PersistenceAction<T>>> {
self.send_action(PersistenceAction::RemoveBlocksAbove(block_num, tx)) self.send_action(PersistenceAction::RemoveBlocksAbove(block_num, tx))
} }
} }
@ -296,7 +307,7 @@ mod tests {
use reth_prune::Pruner; use reth_prune::Pruner;
use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::unbounded_channel;
fn default_persistence_handle() -> PersistenceHandle { fn default_persistence_handle() -> PersistenceHandle<EthPrimitives> {
let provider = create_test_provider_factory(); let provider = create_test_provider_factory();
let (_finished_exex_height_tx, finished_exex_height_rx) = let (_finished_exex_height_tx, finished_exex_height_rx) =
@ -306,7 +317,7 @@ mod tests {
Pruner::new_with_factory(provider.clone(), vec![], 5, 0, None, finished_exex_height_rx); Pruner::new_with_factory(provider.clone(), vec![], 5, 0, None, finished_exex_height_rx);
let (sync_metrics_tx, _sync_metrics_rx) = unbounded_channel(); let (sync_metrics_tx, _sync_metrics_rx) = unbounded_channel();
PersistenceHandle::spawn_service(provider, pruner, sync_metrics_tx) PersistenceHandle::<EthPrimitives>::spawn_service(provider, pruner, sync_metrics_tx)
} }
#[tokio::test] #[tokio::test]