From cf7150925f9ffae41c719b9b27941f06c98d4afa Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Thu, 28 Nov 2024 10:34:35 -0500 Subject: [PATCH 1/2] build: import firehose-client repo as dependency --- Cargo.lock | 559 +++++++++--------- crates/firehose-client/CHANGELOG.md | 8 - crates/firehose-client/Cargo.toml | 27 - crates/firehose-client/README.md | 80 --- .../firehose-client/examples/fetch_beacon.rs | 61 -- .../examples/fetch_ethereum.rs | 24 - .../firehose-client/examples/stream_beacon.rs | 35 -- .../examples/stream_ethereum.rs | 34 -- crates/firehose-client/src/client.rs | 293 --------- crates/firehose-client/src/error.rs | 20 - crates/firehose-client/src/lib.rs | 58 -- crates/firehose-client/src/tls.rs | 20 - crates/firehose-protos-examples/Cargo.toml | 2 +- crates/forrestrie-examples/Cargo.toml | 2 +- 14 files changed, 296 insertions(+), 927 deletions(-) delete mode 100644 crates/firehose-client/CHANGELOG.md delete mode 100644 crates/firehose-client/Cargo.toml delete mode 100644 crates/firehose-client/README.md delete mode 100644 crates/firehose-client/examples/fetch_beacon.rs delete mode 100644 crates/firehose-client/examples/fetch_ethereum.rs delete mode 100644 crates/firehose-client/examples/stream_beacon.rs delete mode 100644 crates/firehose-client/examples/stream_ethereum.rs delete mode 100644 crates/firehose-client/src/client.rs delete mode 100644 crates/firehose-client/src/error.rs delete mode 100644 crates/firehose-client/src/lib.rs delete mode 100644 crates/firehose-client/src/tls.rs diff --git a/Cargo.lock b/Cargo.lock index 051a2ed9..549131c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,9 +76,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "alloy" @@ -100,7 +100,7 @@ version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18c5c520273946ecf715c0010b4e3503d7eba9893cd9ce6b7fff5654c4a3c470" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "num_enum", "serde", "strum", @@ -113,7 +113,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "705687d5bfd019fee57cf9e206b27b30a9a9617535d5590a02b171e813208f8e" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-serde", "auto_impl", @@ -124,25 +124,25 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47ef9e96462d0b9fee9008c53c1f3d017b9498fcdef3ad8d728db98afef47955" +checksum = "e8d22df68fa7d9744be0b1a9be3260e9aa089fbf41903ab182328333061ed186" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-sol-types", ] [[package]] name = "alloy-dyn-abi" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85132f2698b520fab3f54beed55a44389f7006a7b557a0261e1e69439dcc1572" +checksum = "1cf633ae9a1f0c82fdb9e559ed2be1c8e415c3e48fc47e1feaf32c6078ec0cdd" dependencies = [ "alloy-json-abi", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-sol-type-parser", "alloy-sol-types", "const-hex", @@ -158,7 +158,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "serde", ] @@ -169,7 +169,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea59dc42102bc9a1905dc57901edc6dd48b9f38115df86c7d252acba70d71d04" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "k256", "serde", @@ -183,7 +183,7 @@ checksum = "6ffb906284a1e1f63c4607da2068c8197458a352d0b3e9796e67353d72a9be85" dependencies = [ "alloy-eip2930", "alloy-eip7702", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-serde", "c-kzg", @@ -199,18 +199,18 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8429cf4554eed9b40feec7f4451113e76596086447550275e3def933faf47ce3" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-serde", "serde", ] [[package]] name = "alloy-json-abi" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded610181f3dad5810f6ff12d1a99994cf9b42d2fcb7709029352398a5da5ae6" +checksum = "1a500037938085feed8a20dbfc8fce58c599db68c948cfae711147175dee392c" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-sol-type-parser", "serde", "serde_json", @@ -224,7 +224,7 @@ checksum = "801492711d4392b2ccf5fc0bc69e299fa1aab15167d74dcaa9aab96a54f684bd" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-serde", "serde", ] @@ -253,9 +253,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd58d377699e6cfeab52c4a9d28bdc4ef37e2bd235ff2db525071fe37a2e9af5" +checksum = "3aeeb5825c2fc8c2662167058347cd0cafc3cb15bcb5cdb1758a63c2dca0409e" dependencies = [ "alloy-rlp", "bytes", @@ -264,7 +264,7 @@ dependencies = [ "derive_more 1.0.0", "foldhash", "getrandom", - "hashbrown 0.15.1", + "hashbrown 0.15.2", "hex-literal", "indexmap 2.6.0", "itoa", @@ -299,7 +299,7 @@ checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -308,7 +308,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ffc534b7919e18f35e3aa1f507b6f3d9d92ec298463a9f6beaac112809d8d06" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -323,7 +323,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-serde", "alloy-sol-types", @@ -339,30 +339,30 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dff0ab1cdd43ca001e324dc27ee0e8606bd2161d6623c63e0e0b8c4dfc13600" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "serde", "serde_json", ] [[package]] name = "alloy-sol-macro" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a1b42ac8f45e2f49f4bcdd72cbfde0bb148f5481d403774ffa546e48b83efc1" +checksum = "5c0279d09463a4695788a3622fd95443625f7be307422deba4b55dd491a9c7a1" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06318f1778e57f36333e850aa71bd1bb5e560c10279e236622faae0470c50412" +checksum = "4feea540fc8233df2ad1156efd744b2075372f43a8f942a68b3b19c8a00e2c12" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -371,31 +371,31 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaebb9b0ad61a41345a22c9279975c0cdd231b97947b10d7aad1cf0a7181e4a5" +checksum = "2a0ad281f3d1b613af814b66977ee698e443d4644a1510962d0241f26e0e53ae" dependencies = [ "const-hex", "dunce", "heck", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12c71028bfbfec210e24106a542aad3def7caf1a70e2c05710e92a98481980d3" +checksum = "96eff16c797438add6c37bb335839d015b186c5421ee5626f5559a7bfeb38ef5" dependencies = [ "serde", "winnow", @@ -403,12 +403,12 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d7fb042d68ddfe79ccb23359de3007f6d4d53c13f703b64fb0db422132111" +checksum = "cff34e0682d6665da243a3e81da96f07a2dd50f7e64073e382b1a141f5a2a2f6" dependencies = [ "alloy-json-abi", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-sol-macro", "const-hex", "serde", @@ -420,7 +420,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9703ce68b97f8faae6f7739d1e003fc97621b856953cbcdbb2b515743f23288" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "derive_more 1.0.0", "nybbles", @@ -675,7 +675,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -686,7 +686,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -714,7 +714,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -725,21 +725,20 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "aws-lc-rs" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd82dba44d209fddb11c190e0a94b78651f95299598e472215667417a03ff1d" +checksum = "f47bb8cc16b669d267eeccf585aea077d0882f4777b1c1f740217885d6e6e5a3" dependencies = [ "aws-lc-sys", - "mirai-annotations", "paste", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7a4168111d7eb622a31b214057b8509c0a7e1794f44c546d742330dc793972" +checksum = "a2101df3813227bbaaaa0b04cd61c534c7954b22bd68d399b440be937dc63ff7" dependencies = [ "bindgen", "cc", @@ -752,9 +751,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", @@ -771,7 +770,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tower 0.5.1", "tower-layer", "tower-service", @@ -792,7 +791,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", ] @@ -876,7 +875,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.87", + "syn 2.0.89", "which", ] @@ -992,9 +991,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" [[package]] name = "byteorder" @@ -1004,9 +1003,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" dependencies = [ "serde", ] @@ -1034,9 +1033,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.36" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baee610e9452a8f6f0a1b6194ec09ff9e2d85dea54432acdae41aa0761c95d70" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "jobserver", "libc", @@ -1123,9 +1122,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -1133,9 +1132,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -1152,20 +1151,20 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "cmake" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" dependencies = [ "cc", ] @@ -1217,9 +1216,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" +checksum = "487981fa1af147182687064d0a2c336586d337a606595ced9ffb0c685c250c73" dependencies = [ "cfg-if", "cpufeatures", @@ -1286,6 +1285,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1294,9 +1303,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -1456,7 +1465,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1504,7 +1513,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1526,7 +1535,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1577,7 +1586,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1590,7 +1599,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1611,7 +1620,7 @@ dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "unicode-xid", ] @@ -1700,7 +1709,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1827,7 +1836,7 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1867,12 +1876,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1894,7 +1903,7 @@ name = "eth_trie" version = "0.4.0" source = "git+https://github.com/ethereum/eth-trie.rs?tag=v0.1.0-alpha.2#46da867d8a7eace0a9e912271b236b2007e4cd41" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "hashbrown 0.14.5", "keccak-hash", @@ -1971,7 +1980,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70cbccfccf81d67bff0ab36e591fa536c8a935b078a7b0e58c1d00d418332fc9" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "hex", "serde", "serde_derive", @@ -1995,7 +2004,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e999563461faea0ab9bc0024e5e66adcee35881f3d5062f52f31a4070fe1522" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "itertools 0.13.0", "smallvec", ] @@ -2021,7 +2030,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2063,7 +2072,7 @@ dependencies = [ "sha3 0.9.1", "ssz_types 0.8.0", "superstruct 0.7.0", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tree_hash 0.8.0", "tree_hash_derive 0.8.0", @@ -2097,9 +2106,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fastrlp" @@ -2131,18 +2140,17 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "firehose-client" version = "0.1.1" +source = "git+https://github.com/semiotic-ai/firehose-client.git?branch=main#035980e6817eee5c3d40678dd0e1bfa6bb8da594" dependencies = [ "dotenvy", - "firehose-protos", - "forrestrie", + "firehose-rs", "futures", - "hex", "http", "once_cell", "rustls", "serde", "serde_derive", - "thiserror 2.0.0", + "thiserror 2.0.3", "tokio", "tokio-stream", "tonic", @@ -2155,7 +2163,7 @@ version = "0.1.0" dependencies = [ "alloy-consensus", "alloy-eip2930", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "ethportal-api", "hex", @@ -2168,7 +2176,7 @@ dependencies = [ "reth-trie-common", "serde", "serde_json", - "thiserror 2.0.0", + "thiserror 2.0.3", "tokio", "tonic", "tonic-build", @@ -2179,12 +2187,26 @@ dependencies = [ name = "firehose-protos-examples" version = "0.1.1" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "firehose-client", "firehose-protos", "tokio", ] +[[package]] +name = "firehose-rs" +version = "0.1.0" +source = "git+https://github.com/semiotic-ai/firehose-rs.git?branch=main#be85002a5a1d3d298704b0465d531d14cff51caf" +dependencies = [ + "prost", + "prost-build", + "prost-wkt", + "prost-wkt-types", + "serde", + "tonic", + "tonic-build", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -2210,7 +2232,7 @@ version = "0.1.1" dependencies = [ "alloy-consensus", "alloy-eip2930", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "bincode", "clap", "criterion", @@ -2220,7 +2242,7 @@ dependencies = [ "reth-primitives", "serde", "serde_json", - "thiserror 2.0.0", + "thiserror 2.0.3", "tracing", "tracing-subscriber", "zstd", @@ -2228,9 +2250,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -2276,7 +2298,7 @@ dependencies = [ name = "forrestrie" version = "0.1.1" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "bls", "ethportal-api", @@ -2402,7 +2424,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2517,7 +2539,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror 1.0.68", + "thiserror 1.0.69", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2561,9 +2583,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ "atomic-waker", "bytes", @@ -2606,9 +2628,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", "equivalent", @@ -2629,7 +2651,7 @@ dependencies = [ name = "header-accumulator" version = "0.1.0" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "base64 0.21.7", "clap", "ethportal-api", @@ -2641,7 +2663,7 @@ dependencies = [ "serde", "serde_json", "tempfile", - "thiserror 2.0.0", + "thiserror 2.0.3", "tree_hash 0.8.0", "trin-validation", ] @@ -2763,9 +2785,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", @@ -2842,7 +2864,7 @@ dependencies = [ "http-body", "hyper", "pin-project-lite", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -2986,7 +3008,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3062,13 +3084,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] @@ -3088,7 +3110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.2", "serde", ] @@ -3185,9 +3207,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jni" @@ -3199,7 +3221,7 @@ dependencies = [ "combine", "jni-sys", "log", - "thiserror 1.0.68", + "thiserror 1.0.69", "walkdir", ] @@ -3262,7 +3284,7 @@ dependencies = [ "rustls-pki-types", "rustls-platform-verifier", "soketto", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tokio-rustls", "tokio-util", @@ -3290,7 +3312,7 @@ dependencies = [ "rustc-hash 2.0.0", "serde", "serde_json", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", @@ -3315,7 +3337,7 @@ dependencies = [ "rustls-platform-verifier", "serde", "serde_json", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tower 0.4.13", "tracing", @@ -3332,7 +3354,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3354,7 +3376,7 @@ dependencies = [ "serde", "serde_json", "soketto", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tokio-stream", "tokio-util", @@ -3371,7 +3393,7 @@ dependencies = [ "http", "serde", "serde_json", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] @@ -3487,9 +3509,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" [[package]] name = "libgit2-sys" @@ -3566,9 +3588,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -3592,7 +3614,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] @@ -3641,18 +3663,18 @@ dependencies = [ [[package]] name = "metastruct" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00a5ba4a0f3453c31c397b214e1675d95b697c33763aa58add57ea833424384" +checksum = "d74f54f231f9a18d77393ecc5cc7ab96709b2a61ee326c2b2b291009b0cc5a07" dependencies = [ "metastruct_macro", ] [[package]] name = "metastruct_macro" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a991d4536c933306e52f0e8ab303757185ec13a09d1f3e1cbde5a0d8410bf" +checksum = "985e7225f3a4dfbec47a0c6a730a874185fda840d365d7bbd6ba199dd81796d5" dependencies = [ "darling 0.13.4", "itertools 0.10.5", @@ -3718,12 +3740,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "mirai-annotations" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" - [[package]] name = "modular-bitfield" version = "0.11.2" @@ -3775,7 +3791,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] @@ -3862,7 +3878,7 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3916,7 +3932,7 @@ checksum = "7ea7162170c6f3cad8f67f4dd7108e3f78349fd553da5b8bebff1e7ef8f38896" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-serde", "derive_more 1.0.0", @@ -3933,7 +3949,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rpc-types-eth", "alloy-serde", "op-alloy-consensus", @@ -3970,7 +3986,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -3999,28 +4015,29 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parity-scale-codec" -version = "3.6.12" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +checksum = "8be4817d39f3272f69c59fe05d0535ae6456c2dc2fa1ba02910296c7e0a5c590" dependencies = [ "arrayvec", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive", + "rustversion", "serde", ] [[package]] name = "parity-scale-codec-derive" -version = "3.6.12" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] @@ -4090,7 +4107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror 1.0.68", + "thiserror 1.0.69", "ucd-trie", ] @@ -4121,7 +4138,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4214,7 +4231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4282,14 +4299,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -4341,7 +4358,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.87", + "syn 2.0.89", "tempfile", ] @@ -4355,7 +4372,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4531,7 +4548,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] @@ -4542,7 +4559,7 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "regex-syntax 0.8.5", ] @@ -4557,9 +4574,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -4609,7 +4626,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "system-configuration", "tokio", "tokio-native-tls", @@ -4629,7 +4646,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-trie", "bytes", "modular-bitfield", @@ -4644,7 +4661,7 @@ dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -4653,7 +4670,7 @@ version = "1.1.0" source = "git+https://github.com/paradigmxyz/reth?tag=v1.1.0#1ba631ba9581973e7c6cadeea92cfe1802aceb4a" dependencies = [ "alloy-chains", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "auto_impl", "crc", @@ -4671,7 +4688,7 @@ source = "git+https://github.com/paradigmxyz/reth?tag=v1.1.0#1ba631ba9581973e7c6 dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-rpc-types", "alloy-serde", @@ -4702,7 +4719,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "byteorder", "bytes", @@ -4719,7 +4736,7 @@ name = "reth-static-file-types" version = "1.1.0" source = "git+https://github.com/paradigmxyz/reth?tag=v1.1.0#1ba631ba9581973e7c6cadeea92cfe1802aceb4a" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "derive_more 1.0.0", "serde", "strum", @@ -4732,7 +4749,7 @@ source = "git+https://github.com/paradigmxyz/reth?tag=v1.1.0#1ba631ba9581973e7c6 dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "alloy-rlp", "alloy-trie", "bytes", @@ -4753,7 +4770,7 @@ checksum = "6f1525851a03aff9a9d6a1d018b414d76252d6802ab54695b27093ecd7e7a101" dependencies = [ "alloy-eip2930", "alloy-eip7702", - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "auto_impl", "bitflags 2.6.0", "bitvec", @@ -4802,9 +4819,9 @@ dependencies = [ [[package]] name = "roaring" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" +checksum = "f81dc953b2244ddd5e7860cb0bb2a790494b898ef321d4aff8e260efab60cc88" dependencies = [ "bytemuck", "byteorder", @@ -4898,7 +4915,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.87", + "syn 2.0.89", "walkdir", ] @@ -4959,9 +4976,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.39" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -4972,9 +4989,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "aws-lc-rs", "log", @@ -4996,20 +5013,19 @@ dependencies = [ "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 2.11.1", ] [[package]] name = "rustls-native-certs" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.0.1", ] [[package]] @@ -5033,7 +5049,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" dependencies = [ - "core-foundation", + "core-foundation 0.9.4", "core-foundation-sys", "jni", "log", @@ -5042,7 +5058,7 @@ dependencies = [ "rustls-native-certs 0.7.3", "rustls-platform-verifier-android", "rustls-webpki", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "webpki-roots", "winapi", @@ -5106,9 +5122,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -5159,18 +5175,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "core-foundation-sys", "libc", "num-bigint", "security-framework-sys", ] +[[package]] +name = "security-framework" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -5193,9 +5222,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "semver-parser" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" dependencies = [ "pest", ] @@ -5208,9 +5237,9 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -5226,20 +5255,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -5425,9 +5454,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -5546,7 +5575,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -5605,9 +5634,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -5616,14 +5645,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edf42e81491fb8871b74df3d222c64ae8cbc1269ea509fa768a3ed3e1b0ac8cb" +checksum = "6bdaa7b9e815582ba343a20c66627437cf45f1c6fba7f69772cbfd1358c7e197" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -5634,9 +5663,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -5649,7 +5678,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -5659,7 +5688,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -5681,9 +5710,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -5703,42 +5732,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.68", + "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" -version = "2.0.0" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15291287e9bff1bc6f9ff3409ed9af665bec7a5fc8ac079ea96be07bca0e2668" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" dependencies = [ - "thiserror-impl 2.0.0", + "thiserror-impl 2.0.3", ] [[package]] name = "thiserror-impl" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "thiserror-impl" -version = "2.0.0" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22efd00f33f93fa62848a7cab956c3d38c8d43095efda1decfc2b3a5dc0b8972" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -5859,9 +5888,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -5870,7 +5899,7 @@ dependencies = [ "parking_lot 0.12.3", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.7", + "socket2 0.5.8", "tokio-macros", "windows-sys 0.52.0", ] @@ -5883,7 +5912,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -5972,9 +6001,9 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "rustls-native-certs 0.8.0", + "rustls-native-certs 0.8.1", "rustls-pemfile", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tokio-rustls", "tokio-stream", @@ -5995,7 +6024,7 @@ dependencies = [ "prost-build", "prost-types", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -6046,9 +6075,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -6058,20 +6087,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -6136,7 +6165,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "373495c23db675a5192de8b610395e1bec324d596f9e6111192ce903dc11403a" dependencies = [ - "alloy-primitives 0.8.11", + "alloy-primitives 0.8.13", "ethereum_hashing 0.7.0", "smallvec", ] @@ -6161,7 +6190,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -6299,7 +6328,7 @@ checksum = "70b20a22c42c8f1cd23ce5e34f165d4d37038f5b663ad20fb6adbdf029172483" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -6364,9 +6393,9 @@ checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" @@ -6431,9 +6460,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna 1.0.3", @@ -6577,7 +6606,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "wasm-bindgen-shared", ] @@ -6611,7 +6640,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6634,9 +6663,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -6837,9 +6866,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -6849,13 +6878,13 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "synstructure", ] @@ -6877,27 +6906,27 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "synstructure", ] @@ -6918,7 +6947,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -6940,7 +6969,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] diff --git a/crates/firehose-client/CHANGELOG.md b/crates/firehose-client/CHANGELOG.md deleted file mode 100644 index 2e302c2f..00000000 --- a/crates/firehose-client/CHANGELOG.md +++ /dev/null @@ -1,8 +0,0 @@ -# Changelog - -## [0.1.1](https://github.com/semiotic-ai/veemon/compare/firehose-client-v0.1.0...firehose-client-v0.1.1) (2024-10-22) - - -### Bug Fixes - -* **firehose-client:** fix chain specification in client ([a37c8e8](https://github.com/semiotic-ai/veemon/commit/a37c8e81d20075c0980e50a039cb580bcaaa85d1)) diff --git a/crates/firehose-client/Cargo.toml b/crates/firehose-client/Cargo.toml deleted file mode 100644 index d0fa4f11..00000000 --- a/crates/firehose-client/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "firehose-client" -version = "0.1.1" -edition = "2021" - -[lib] -name = "firehose_client" -path = "src/lib.rs" - -[dependencies] -dotenvy.workspace = true -forrestrie = { path = "../forrestrie" } -firehose-protos = { path = "../firehose-protos" } -futures.workspace = true -http.workspace = true -once_cell.workspace = true -rustls.workspace = true -serde = { workspace = true, features = ["derive"] } -serde_derive.workspace = true -thiserror.workspace = true -tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } -tokio-stream.workspace = true -tonic = { workspace = true, features = ["tls-roots"] } -tracing.workspace = true - -[dev-dependencies] -hex.workspace = true diff --git a/crates/firehose-client/README.md b/crates/firehose-client/README.md deleted file mode 100644 index d860b723..00000000 --- a/crates/firehose-client/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# Firehose Rust Client - -Extract blocks from [StreamingFast Firehose](https://firehose.streamingfast.io/) -programatically in Rust. - -## gRPC Endpoints - -### Env Vars - -Use environment variables to provide Firehose Ethereum and Firehose -Beacon providers of your choice. - -To do this, place a `.env` file in the root of the `veemon` repository. -See the `.env.example` file, also in the root of this repository, for what -you'll need, depending on your requirements. You may have access to a -Firehose provider and/or may need to use a provider. For example, you can -use [Pinax](https://app.pinax.network/) as an endpoint provider. - -## firehose-ethereum and firehose-beacon gRPC - -### proto files - -We use the following protobuffers developed by Streamingfast via our -[`firehose-protos` crate](./../firehose-protos/README.md): - -See the [`firehose-protos` docs](./../firehose-protos/README.md) for information -on these protobuffers and links to the different repos that they've come from. - -Also check out [`forrestrie`](./../forrestrie/protos/README.md) for -Rust-compiled protobuffer Beacon block implementations. - -### gRPC Service Examples - -If you're looking to quickly explore what the Firehose API offers, -you can use the `grpcurl` tool to test your connection, verify your -API token, and get a list of available gRPC services. This is a great -way to interact with the API without writing any code. - -To get started, you can run the following command to retrieve the -service descriptions from the Firehose gRPC server: - -```bash -grpcurl -plaintext : describe -``` - -Below is an example of the service descriptions you might see when -querying the Firehose server: - -```terminal -grpc.health.v1.Health is a service: -service Health { - rpc Check ( .grpc.health.v1.HealthCheckRequest ) returns ( .grpc.health.v1.HealthCheckResponse ); - rpc Watch ( .grpc.health.v1.HealthCheckRequest ) returns ( stream .grpc.health.v1.HealthCheckResponse ); -} - -grpc.reflection.v1.ServerReflection is a service: -service ServerReflection { - rpc ServerReflectionInfo ( stream .grpc.reflection.v1.ServerReflectionRequest ) returns ( stream .grpc.reflection.v1.ServerReflectionResponse ); -} - -grpc.reflection.v1alpha.ServerReflection is a service: -service ServerReflection { - rpc ServerReflectionInfo ( stream .grpc.reflection.v1alpha.ServerReflectionRequest ) returns ( stream .grpc.reflection.v1alpha.ServerReflectionResponse ); -} - -sf.firehose.v1.Stream is a service: -service Stream { - rpc Blocks ( .sf.firehose.v1.Request ) returns ( stream .sf.firehose.v1.Response ); -} - -sf.firehose.v2.Fetch is a service: -service Fetch { - rpc Block ( .sf.firehose.v2.SingleBlockRequest ) returns ( .sf.firehose.v2.SingleBlockResponse ); -} - -sf.firehose.v2.Stream is a service: -service Stream { - rpc Blocks ( .sf.firehose.v2.Request ) returns ( stream .sf.firehose.v2.Response ); -} -``` diff --git a/crates/firehose-client/examples/fetch_beacon.rs b/crates/firehose-client/examples/fetch_beacon.rs deleted file mode 100644 index 41585298..00000000 --- a/crates/firehose-client/examples/fetch_beacon.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -//! # Fetch Beacon Block -//! -//! Demonstrates how to fetch a single block from Beacon Firehose, using the `Fetch` API. - -use firehose_client::{Chain, FirehoseClient}; -use firehose_protos::EthBlock; -use forrestrie::beacon_v1::{block::Body, Block as BeaconBlock}; - -#[tokio::main] -async fn main() { - // Show matching data from execution layer and beacon chain - let mut execution_layer_client = FirehoseClient::new(Chain::Ethereum); - - let response = execution_layer_client - .fetch_block(20672593) - .await - .unwrap() - .unwrap(); - - let block = EthBlock::try_from(response.into_inner()).unwrap(); - - assert_eq!(block.number, 20672593); - assert_eq!( - format!("0x{}", hex::encode(block.hash)).as_str(), - "0xea48ba1c8e38ea586239e9c5ec62949ddd79404c6006c099bb02a8b22ddd18e4" - ); - - let mut beacon_client = FirehoseClient::new(Chain::Beacon); - // This is the slot number for the Beacon block we want to fetch, but right now - // we don't have a way to map the block number of the execution block to the slot number - // of the Beacon block. - let response = beacon_client.fetch_block(9881091).await.unwrap().unwrap(); - let block = BeaconBlock::try_from(response.into_inner()).unwrap(); - - assert_eq!(block.slot, 9881091); - - let body = block.body.as_ref().unwrap(); - - match body { - Body::Deneb(body) => { - let execution_payload = body.execution_payload.as_ref().unwrap(); - - let block_hash = &execution_payload.block_hash; - - assert_eq!( - format!("0x{}", hex::encode(block_hash)).as_str(), - "0xea48ba1c8e38ea586239e9c5ec62949ddd79404c6006c099bb02a8b22ddd18e4" - ); - - let block_number = execution_payload.block_number; - - assert_eq!(block_number, 20672593); - } - _ => unimplemented!(), - }; - - println!("fetch_beacon ran to completion!"); -} diff --git a/crates/firehose-client/examples/fetch_ethereum.rs b/crates/firehose-client/examples/fetch_ethereum.rs deleted file mode 100644 index 09a7fd33..00000000 --- a/crates/firehose-client/examples/fetch_ethereum.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -//! # Fetch Ethereum Block -//! -//! Demonstrates how to fetch a single block from Ethereum firehose. - -use firehose_client::{Chain, FirehoseClient}; -use firehose_protos::EthBlock as Block; - -#[tokio::main] -async fn main() { - let mut client = FirehoseClient::new(Chain::Ethereum); - let response = client.fetch_block(20672593).await.unwrap().unwrap(); - let block = Block::try_from(response.into_inner()).unwrap(); - - assert_eq!(block.number, 20672593); - assert_eq!( - format!("0x{}", hex::encode(block.hash)).as_str(), - "0xea48ba1c8e38ea586239e9c5ec62949ddd79404c6006c099bb02a8b22ddd18e4" - ); - - println!("fetch_beacon completed successfully!"); -} diff --git a/crates/firehose-client/examples/stream_beacon.rs b/crates/firehose-client/examples/stream_beacon.rs deleted file mode 100644 index 1d03b7f3..00000000 --- a/crates/firehose-client/examples/stream_beacon.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -//! # Example: Stream Beacon Blocks -//! -//! Demonstrates how to stream a range of blocks from Firehose Beacon - -use firehose_client::{Chain, FirehoseClient}; -use forrestrie::beacon_v1::Block as FirehoseBeaconBlock; -use futures::StreamExt; - -#[tokio::main] -async fn main() { - // Testing this so far without proper benchmarking, the time taken to fetch the blocks - // grows linearly with the number of TOTAL_BLOCKS requested, to around 20 minutes for 8192 blocks! - const TOTAL_SLOTS: u64 = 100; - const START_SLOT: u64 = 9968872; - - let mut client = FirehoseClient::new(Chain::Beacon); - let mut stream = client - .stream_beacon_with_retry(START_SLOT, TOTAL_SLOTS) - .await - .unwrap(); - - let mut blocks: Vec = Vec::with_capacity(TOTAL_SLOTS as usize); - - while let Some(block) = stream.next().await { - blocks.push(block); - } - - // For now, just using this to signal that the test has completed - assert_eq!(blocks.len(), TOTAL_SLOTS as usize); - - println!("stream_beacon ran to completion!"); -} diff --git a/crates/firehose-client/examples/stream_ethereum.rs b/crates/firehose-client/examples/stream_ethereum.rs deleted file mode 100644 index 03c09f94..00000000 --- a/crates/firehose-client/examples/stream_ethereum.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -//! # Example: Stream Ethereum Blocks -//! -//! This example demonstrates how to stream Ethereum blocks using the Firehose client. -use firehose_client::{Chain, FirehoseClient}; -use firehose_protos::EthBlock as Block; -use futures::StreamExt; - -#[tokio::main] -async fn main() { - // Testing this so far without proper benchmarking, the time taken to fetch the blocks - // grows linearly with the number of TOTAL_BLOCKS requested, to around 20 minutes for 8192 blocks! - const TOTAL_BLOCKS: u64 = 100; - const START_BLOCK: u64 = 19581798; - - let mut client = FirehoseClient::new(Chain::Ethereum); - let mut stream = client - .stream_blocks(START_BLOCK, TOTAL_BLOCKS) - .await - .unwrap(); - - let mut blocks: Vec = Vec::with_capacity(TOTAL_BLOCKS as usize); - - while let Some(block) = stream.next().await { - blocks.push(block); - } - - // For now, just using this to signal that the test has completed - assert_eq!(blocks.len(), TOTAL_BLOCKS as usize); - - println!("stream_ethereum ran successfully"); -} diff --git a/crates/firehose-client/src/client.rs b/crates/firehose-client/src/client.rs deleted file mode 100644 index 5a3ea566..00000000 --- a/crates/firehose-client/src/client.rs +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use std::str::FromStr; - -use crate::error::ClientError; -use dotenvy::{dotenv, var}; -use firehose_protos::{ - EthBlock as Block, FetchClient, Request, SingleBlockRequest, SingleBlockResponse, StreamClient, -}; -use forrestrie::beacon_v1::Block as FirehoseBeaconBlock; -use tokio_stream::wrappers::ReceiverStream; -use tonic::{ - transport::{Channel, Uri}, - Response, Status, -}; -use tracing::{error, info, trace}; - -/// Work with the fetch and streaming APIs supported by [StreamingFast Firehose](https://firehose.streamingfast.io/). -pub struct FirehoseClient { - chain: Chain, - fetch_client: Option>, - stream_client: Option>, -} - -impl FirehoseClient { - pub fn new(chain: Chain) -> Self { - Self { - chain, - fetch_client: None, - stream_client: None, - } - } - - /// The inner [`Result`] is the Firehose response, which can be either a [`Response`] or a [`Status`], - /// which is needed for handling empty slots on the Beacon chain. - pub async fn fetch_block( - &mut self, - number: u64, - ) -> Result, Status>, ClientError> { - if self.fetch_client.is_none() { - self.fetch_client = Some(fetch_client(self.chain).await?); - } - let mut request = create_single_block_fetch_request(number); - - request.insert_api_key_if_provided(self.chain); - - info!("Requesting block number:\n\t{}", number); - Ok(self.fetch_client.as_mut().unwrap().block(request).await) - } - - /// The tonic docs encourage cloning the client. - pub async fn get_streaming_client(&mut self) -> Result, ClientError> { - let client = if let Some(client) = self.stream_client.clone() { - client - } else { - self.stream_client = Some(stream_client(self.chain).await?); - self.stream_client.clone().unwrap() - }; - Ok(client) - } - - /// Stream a block range of Beacon blocks, with a retry mechanism if the stream cuts off - /// before the total number of blocks requested is reached, and accounting for missed slots. - pub async fn stream_beacon_with_retry( - &mut self, - start: u64, - total: u64, - ) -> Result, ClientError> { - let (tx, rx) = tokio::sync::mpsc::channel::(8192); - - let chain = self.chain; - let client = self.get_streaming_client().await?; - - tokio::spawn(async move { - let mut blocks = 0; - let mut last_valid_slot: Option = None; - let mut last_valid_block: Option = None; - - while blocks < total { - let mut client = client.clone(); - let request = create_blocks_streaming_request( - chain, - start + blocks, - start + total - 1, - BlocksRequested::All, - ); - match client.blocks(request).await { - Ok(response) => { - let mut stream_inner = response.into_inner(); - while let Ok(Some(block_msg)) = stream_inner.message().await { - if blocks % 100 == 0 { - trace!("Blocks fetched: {}", blocks); - } - match FirehoseBeaconBlock::try_from(block_msg) { - Ok(block) => { - if let Some(last_slot) = last_valid_slot { - let missed_slots = block.slot.saturating_sub(last_slot + 1); - if missed_slots > 0 { - trace!("Missed block at slot: {}", start + blocks); - - let last_block = last_valid_block.take().unwrap(); - let tx = tx.clone(); - for _ in 0..missed_slots { - blocks += 1; - tx.send(last_block.clone()).await.unwrap(); - } - } - } - last_valid_slot = Some(block.slot); - last_valid_block = Some(block.clone()); - - blocks += 1; - tx.clone().send(block).await.unwrap(); - } - Err(e) => { - error!("Failed to convert block message to block: {e}"); - break; - } - } - } - } - Err(e) => { - error!("Failed to get blocks stream: {:?}", e.code()); - break; - } - }; - } - }); - - Ok(ReceiverStream::new(rx)) - } - - pub async fn stream_blocks( - &mut self, - start: u64, - total: u64, - ) -> Result, ClientError> { - let (tx, rx) = tokio::sync::mpsc::channel::(8192); - - let chain = self.chain; - let client = self.get_streaming_client().await?; - - tokio::spawn(async move { - let mut blocks = 0; - - while blocks < total { - let mut client = client.clone(); - let request = create_blocks_streaming_request( - chain, - start + blocks, - start + total - 1, - BlocksRequested::All, - ); - let response = client.blocks(request).await.unwrap(); - let mut stream_inner = response.into_inner(); - while let Ok(Some(block_msg)) = stream_inner.message().await { - if blocks % 100 == 0 && blocks != 0 { - trace!("Blocks fetched: {}", blocks); - } - match Block::try_from(block_msg) { - Ok(block) => { - blocks += 1; - tx.clone().send(block).await.unwrap(); - } - Err(e) => { - panic!("Failed to convert block message to block: {e}"); - } - } - } - } - }); - - Ok(ReceiverStream::new(rx)) - } -} - -async fn build_and_connect_channel(uri: Uri) -> Result { - if uri.scheme_str() != Some("https") { - return Channel::builder(uri).connect().await; - } - - let config = crate::tls::config(); - - Channel::builder(uri) - .tls_config(config.clone())? - .connect() - .await -} - -fn create_blocks_streaming_request( - chain: Chain, - start_block_num: u64, - stop_block_num: u64, - blocks_requested: BlocksRequested, -) -> tonic::Request { - let mut request = tonic::Request::new(Request { - start_block_num: start_block_num as i64, - stop_block_num, - final_blocks_only: blocks_requested.into(), - ..Default::default() - }); - request.insert_api_key_if_provided(chain); - request -} - -async fn fetch_client(firehose: Chain) -> Result, ClientError> { - Ok(FetchClient::new({ - let uri = firehose.uri_from_env()?; - build_and_connect_channel(uri).await? - })) -} - -async fn stream_client(firehose: Chain) -> Result, ClientError> { - Ok(StreamClient::new({ - let uri = firehose.uri_from_env()?; - build_and_connect_channel(uri).await? - })) -} - -pub enum BlocksRequested { - All, - FinalOnly, -} - -impl From for bool { - fn from(blocks_requested: BlocksRequested) -> bool { - match blocks_requested { - BlocksRequested::All => false, - BlocksRequested::FinalOnly => true, - } - } -} - -/// Create a [`SingleBlockRequest`] for the given *number*. -/// Number is slot number for beacon blocks. -fn create_single_block_fetch_request(num: u64) -> tonic::Request { - tonic::Request::new(SingleBlockRequest::new(num)) -} - -trait FirehoseRequest { - fn insert_api_key_if_provided(&mut self, endpoint: Chain); -} - -impl FirehoseRequest for tonic::Request { - fn insert_api_key_if_provided(&mut self, endpoint: Chain) { - insert_api_key_if_provided(self, endpoint); - } -} - -fn insert_api_key_if_provided(request: &mut tonic::Request, chain: Chain) { - if let Ok(api_key) = var(chain.api_key_env_var_as_str()) { - let api_key_header = - tonic::metadata::MetadataValue::from_str(&api_key).expect("Invalid API key format"); - request.metadata_mut().insert("x-api-key", api_key_header); - } -} - -/// Extract blocks with [`FirehoseClient`] from an extendable union of chain variants. -#[derive(Clone, Copy, Debug)] -pub enum Chain { - Ethereum, - Beacon, - Arbitrum, -} - -impl Chain { - fn api_key_env_var_as_str(&self) -> &str { - match self { - Self::Beacon => "BEACON_API_KEY", - Self::Ethereum => "ETHEREUM_API_KEY", - Self::Arbitrum => "ARBITRUM_API_KEY", - } - } - - fn uri_from_env(&self) -> Result { - dotenv()?; - - let (url, port) = match self { - Self::Ethereum => ( - var("FIREHOSE_ETHEREUM_URL")?, - var("FIREHOSE_ETHEREUM_PORT")?, - ), - Self::Beacon => (var("FIREHOSE_BEACON_URL")?, var("FIREHOSE_BEACON_PORT")?), - Self::Arbitrum => ( - var("FIREHOSE_ARBITRUM_URL")?, - var("FIREHOSE_ARBITRUM_PORT")?, - ), - }; - - Ok(format!("{}:{}", url, port).parse::()?) - } -} diff --git a/crates/firehose-client/src/error.rs b/crates/firehose-client/src/error.rs deleted file mode 100644 index a1a8221f..00000000 --- a/crates/firehose-client/src/error.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use http::uri::InvalidUri; -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum ClientError { - #[error("Missing environment variable: {0}")] - EnvVarMissing(#[from] dotenvy::Error), - - #[error("gRPC error: {0}")] - GRpc(#[from] tonic::transport::Error), - - #[error("{0}")] - TonicStatus(#[from] tonic::Status), - - #[error("Invalid URI: {0}")] - UriInvalid(#[from] InvalidUri), -} diff --git a/crates/firehose-client/src/lib.rs b/crates/firehose-client/src/lib.rs deleted file mode 100644 index 81710709..00000000 --- a/crates/firehose-client/src/lib.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -//! # Rust Firehose Client -//! -//! Rust implementation of a client for the [StreamingFast Firehose](https://firehose.streamingfast.io/) -//! gRPC Fetch `Block` and Stream `Block`s APIs. -//! -//! ## Fetching an Ethereum Block -//! -//! ```no_run -//! # use firehose_client::{Chain, FirehoseClient}; -//! # use firehose_protos::EthBlock as Block; -//! # #[tokio::main] -//! # async fn main() -> Result<(), firehose_protos::ProtosError> { -//! let mut client = FirehoseClient::new(Chain::Ethereum); -//! -//! if let Some(response) = client.fetch_block(20672593).await.unwrap().ok() { -//! let block = Block::try_from(response.into_inner())?; -//! assert_eq!(block.number, 20672593); -//! assert_eq!( -//! format!("0x{}", hex::encode(block.hash)).as_str(), -//! "0xea48ba1c8e38ea586239e9c5ec62949ddd79404c6006c099bb02a8b22ddd18e4" -//! ); -//! } -//! # Ok(()) -//! # } -//! ``` -//! -//! ## Streaming Ethereum Blocks -//! -//! ```no_run -//! # use firehose_client::{Chain, FirehoseClient}; -//! # use futures::StreamExt; -//! # #[tokio::main] -//! # async fn main() -> Result<(), firehose_protos::ProtosError> { -//! const TOTAL_BLOCKS: u64 = 8192; -//! const START_BLOCK: u64 = 19581798; -//! -//! let mut client = FirehoseClient::new(Chain::Ethereum); -//! let mut stream = client -//! .stream_blocks(START_BLOCK, TOTAL_BLOCKS) -//! .await -//! .unwrap(); -//! -//! while let Some(block) = stream.next().await { -//! // Do Something with the extracted stream of blocks. -//! } -//! # Ok(()) -//! # } -//! ``` -//! - -mod client; -mod error; -mod tls; - -pub use crate::client::{Chain, FirehoseClient}; diff --git a/crates/firehose-client/src/tls.rs b/crates/firehose-client/src/tls.rs deleted file mode 100644 index 3faa2f66..00000000 --- a/crates/firehose-client/src/tls.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use once_cell::sync::Lazy; - -use tonic::transport::ClientTlsConfig; - -static TLS_CONFIG: Lazy = Lazy::new(|| { - rustls::crypto::ring::default_provider() - .install_default() - .expect("Failed to install rustls crypto provider"); - - ClientTlsConfig::new() - .with_native_roots() - .assume_http2(true) -}); - -pub fn config() -> &'static ClientTlsConfig { - &TLS_CONFIG -} diff --git a/crates/firehose-protos-examples/Cargo.toml b/crates/firehose-protos-examples/Cargo.toml index 2f7af854..dc8c6400 100644 --- a/crates/firehose-protos-examples/Cargo.toml +++ b/crates/firehose-protos-examples/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" [dev-dependencies] alloy-primitives.workspace = true -firehose-client = { path = "../firehose-client" } +firehose-client = { git = "https://github.com/semiotic-ai/firehose-client.git", branch = "main" } firehose-protos = { path = "../firehose-protos" } tokio.workspace = true diff --git a/crates/forrestrie-examples/Cargo.toml b/crates/forrestrie-examples/Cargo.toml index 73c62268..0de5795b 100644 --- a/crates/forrestrie-examples/Cargo.toml +++ b/crates/forrestrie-examples/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dev-dependencies] bls.workspace = true ethportal-api.workspace = true -firehose-client = { path = "../firehose-client" } +firehose-client = { git = "https://github.com/semiotic-ai/firehose-client.git", branch = "main" } firehose-protos = { path = "../firehose-protos" } forrestrie = { path = "../forrestrie" } futures.workspace = true From 991e53a2b681fabb762f61650ee098c5a4e9b2dd Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Thu, 28 Nov 2024 11:04:24 -0500 Subject: [PATCH 2/2] chore: extract post-merge gRPC support to separate repos --- Cargo.lock | 32 +- Cargo.toml | 3 + crates/firehose-protos/Cargo.toml | 1 + crates/firehose-protos/build.rs | 6 +- crates/firehose-protos/protos/firehose.proto | 150 ----- .../src/ethereum_v2/eth_block.rs | 6 +- crates/firehose-protos/src/firehose_v2/mod.rs | 6 - .../src/firehose_v2/request.rs | 16 - crates/firehose-protos/src/lib.rs | 20 - crates/forrestrie-examples/Cargo.toml | 3 +- .../examples/fetch_and_verify_block.rs | 2 +- .../examples/match_ethereum_to_beacon.rs | 10 +- .../examples/single_execution_block.rs | 8 +- .../examples/verify-era.rs | 10 +- .../examples/verify_block_inclusion_proof.rs | 8 +- crates/forrestrie/Cargo.toml | 11 - crates/forrestrie/build.rs | 23 - crates/forrestrie/protos/README.md | 5 - crates/forrestrie/protos/type.proto | 270 --------- crates/forrestrie/src/beacon_v1.rs | 528 ------------------ crates/forrestrie/src/lib.rs | 1 - 21 files changed, 49 insertions(+), 1070 deletions(-) delete mode 100644 crates/firehose-protos/protos/firehose.proto delete mode 100644 crates/firehose-protos/src/firehose_v2/mod.rs delete mode 100644 crates/firehose-protos/src/firehose_v2/request.rs delete mode 100644 crates/forrestrie/build.rs delete mode 100644 crates/forrestrie/protos/README.md delete mode 100644 crates/forrestrie/protos/type.proto delete mode 100644 crates/forrestrie/src/beacon_v1.rs diff --git a/Cargo.lock b/Cargo.lock index 549131c4..aee83724 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -841,6 +841,27 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "beacon-protos" +version = "0.1.1" +source = "git+https://github.com/semiotic-ai/beacon-protos.git?branch=main#ce68a3b7cef376887d0583dcc9e2234ffc5abb7f" +dependencies = [ + "bls", + "firehose-rs", + "primitive-types", + "prost", + "prost-build", + "prost-wkt", + "prost-wkt-types", + "serde", + "ssz_types 0.6.0", + "thiserror 2.0.3", + "tonic", + "tonic-build", + "tree_hash 0.6.0", + "types", +] + [[package]] name = "bimap" version = "0.6.3" @@ -2166,6 +2187,7 @@ dependencies = [ "alloy-primitives 0.8.13", "alloy-rlp", "ethportal-api", + "firehose-rs", "hex", "primitive-types", "prost", @@ -2301,23 +2323,14 @@ dependencies = [ "alloy-primitives 0.8.13", "alloy-rlp", "bls", - "ethportal-api", "fake", - "firehose-protos", - "futures", "merkle_proof", "primitive-types", - "prost", - "prost-build", - "prost-wkt", - "prost-wkt-types", "rand", "reth-primitives", "reth-trie-common", "serde", "ssz_types 0.6.0", - "tonic", - "tonic-build", "tree_hash 0.6.0", "types", ] @@ -2326,6 +2339,7 @@ dependencies = [ name = "forrestrie-examples" version = "0.1.1" dependencies = [ + "beacon-protos", "bls", "ethereum_ssz 0.7.1", "ethereum_ssz_derive 0.7.1", diff --git a/Cargo.toml b/Cargo.toml index 197c9bbb..4903da96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ alloy-consensus = "0.4.2" alloy-eip2930 = "0.1.0" alloy-rlp = "0.3.9" base64 = "0.21.7" +beacon-protos = { git = "https://github.com/semiotic-ai/beacon-protos.git", branch = "main" } bincode = "1.3.3" bls = { git = "https://github.com/semiotic-ai/lighthouse.git", branch = "stable" } clap = { version = "4.4.10", features = ["derive"] } @@ -16,6 +17,8 @@ dotenvy = "0.15.7" ethereum-types = "=0.14.1" ethportal-api = { git = "https://github.com/ethereum/trin.git", version = "0.2.2", tag = "v0.1.0-alpha.51" } fake = "2.10.0" +firehose-client = { git = "https://github.com/semiotic-ai/firehose-client.git", branch = "main" } +firehose-rs = { git = "https://github.com/semiotic-ai/firehose-rs.git", branch = "main" } futures = "0.3.31" hex = "0.4.3" http = "1.1.0" diff --git a/crates/firehose-protos/Cargo.toml b/crates/firehose-protos/Cargo.toml index 14c56e28..194c7bfd 100644 --- a/crates/firehose-protos/Cargo.toml +++ b/crates/firehose-protos/Cargo.toml @@ -14,6 +14,7 @@ alloy-eip2930.workspace = true alloy-primitives.workspace = true alloy-rlp.workspace = true ethportal-api.workspace = true +firehose-rs.workspace = true primitive-types.workspace = true prost.workspace = true prost-wkt.workspace = true diff --git a/crates/firehose-protos/build.rs b/crates/firehose-protos/build.rs index 2c7ce5bd..b9691cd1 100644 --- a/crates/firehose-protos/build.rs +++ b/crates/firehose-protos/build.rs @@ -22,11 +22,7 @@ fn main() { .file_descriptor_set_path(out_dir.join("descriptors.bin")) .compile_protos_with_config( config, - &[ - "protos/block.proto", - "protos/bstream.proto", - "protos/firehose.proto", - ], + &["protos/block.proto", "protos/bstream.proto"], &["protos/"], ) .unwrap(); diff --git a/crates/firehose-protos/protos/firehose.proto b/crates/firehose-protos/protos/firehose.proto deleted file mode 100644 index 5299bd8d..00000000 --- a/crates/firehose-protos/protos/firehose.proto +++ /dev/null @@ -1,150 +0,0 @@ -syntax = "proto3"; - -package sf.firehose.v2; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/streamingfast/pbgo/sf/firehose/v2;pbfirehose"; - -service Stream { - rpc Blocks(Request) returns (stream Response); -} - -service Fetch { - rpc Block(SingleBlockRequest) returns (SingleBlockResponse); -} - -message SingleBlockRequest { - - // Get the current known canonical version of a block at with this number - message BlockNumber{ - uint64 num=1; - } - - // Get the current block with specific hash and number - message BlockHashAndNumber{ - uint64 num=1; - string hash=2; - } - - // Get the block that generated a specific cursor - message Cursor{ - string cursor=1; - } - - oneof reference{ - BlockNumber block_number=3; - BlockHashAndNumber block_hash_and_number=4; - Cursor cursor=5; - } - - repeated google.protobuf.Any transforms = 6; -} - -message SingleBlockResponse { - google.protobuf.Any block = 1; - - // Metadata about the block, added in some Firehose version, so consumer - // should be ready to handle the absence of this field. - BlockMetadata metadata = 2; -} - -message Request { - - // Controls where the stream of blocks will start. - // - // The stream will start **inclusively** at the requested block num. - // - // When not provided, starts at first streamable block of the chain. Not all - // chain starts at the same block number, so you might get an higher block than - // requested when using default value of 0. - // - // Can be negative, will be resolved relative to the chain head block, assuming - // a chain at head block #100, then using `-50` as the value will start at block - // #50. If it resolves before first streamable block of chain, we assume start - // of chain. - // - // If `start_cursor` is given, this value is ignored and the stream instead starts - // immediately after the Block pointed by the opaque `start_cursor` value. - int64 start_block_num = 1; - - // Controls where the stream of blocks will start which will be immediately after - // the Block pointed by this opaque cursor. - // - // Obtain this value from a previously received `Response.cursor`. - // - // This value takes precedence over `start_block_num`. - string cursor = 2; - - // When non-zero, controls where the stream of blocks will stop. - // - // The stream will close **after** that block has passed so the boundary is - // **inclusive**. - uint64 stop_block_num = 3; - - // With final_block_only, you only receive blocks with STEP_FINAL - // Default behavior will send blocks as STEP_NEW, with occasional STEP_UNDO - bool final_blocks_only = 4; - - repeated google.protobuf.Any transforms = 10; -} - -message Response { - // Chain specific block payload, ex: - // - sf.eosio.type.v1.Block - // - sf.ethereum.type.v1.Block - // - sf.near.type.v1.Block - google.protobuf.Any block = 1; - ForkStep step = 6; - string cursor = 10; - - // Metadata about the block, added in some Firehose version, so consumer - // should be ready to handle the absence of this field. - BlockMetadata metadata = 12; -} - -message BlockMetadata { - // Num is the block number of this response's block. - uint64 num = 1; - // ID is the block ID of this response's block. The ID actual representation is chain specific. - // - Antelope & Ethereum uses hex. - // - NEAR & Solana uses base58. - // - // Refer to the chain documentation for more details. - string id = 2; - - // ParentNum is the block number of the parent of this response's block - uint64 parent_num = 3; - - // ParentID is the block ID of the parent of this response's block. If this response is the genesis block, - // this field is empty. - // - // The ID actual representation is chain specific. - // - Antelope & Ethereum uses hex. - // - NEAR & Solana uses base58. - // - // Refer to the chain documentation for more details. - string parent_id = 4; - - // LibNum is the block number of the last irreversible block (a.k.a last finalized block) at the time of this - // response' block. It determines the finality of the block. - uint64 lib_num = 5; - - // Time is the time at which the block was produced. - google.protobuf.Timestamp time = 6; -} - -enum ForkStep { - STEP_UNSET = 0; - - // Incoming block - STEP_NEW = 1; - - // A reorg caused this specific block to be excluded from the chain - STEP_UNDO = 2; - - // Block is now final and can be committed (finality is chain specific, - // see chain documentation for more details) - STEP_FINAL = 3; -} diff --git a/crates/firehose-protos/src/ethereum_v2/eth_block.rs b/crates/firehose-protos/src/ethereum_v2/eth_block.rs index 39135f78..b806d33b 100644 --- a/crates/firehose-protos/src/ethereum_v2/eth_block.rs +++ b/crates/firehose-protos/src/ethereum_v2/eth_block.rs @@ -5,6 +5,7 @@ use super::{Block, BlockHeader, TransactionReceipt, TransactionTrace}; use alloy_primitives::{hex, Address, Bloom, FixedBytes, Uint, B256}; use alloy_rlp::{Encodable, Header as RlpHeader}; use ethportal_api::types::execution::header::Header; +use firehose_rs::{Response, SingleBlockResponse}; use prost::Message; use prost_wkt_types::Any; use reth_primitives::{ @@ -13,10 +14,7 @@ use reth_primitives::{ use reth_trie_common::root::ordered_trie_root_with_encoder; use tracing::error; -use crate::{ - error::ProtosError, - firehose_v2::{Response, SingleBlockResponse}, -}; +use crate::error::ProtosError; impl TryFrom<&Block> for Header { type Error = ProtosError; diff --git a/crates/firehose-protos/src/firehose_v2/mod.rs b/crates/firehose-protos/src/firehose_v2/mod.rs deleted file mode 100644 index 03ab512a..00000000 --- a/crates/firehose-protos/src/firehose_v2/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -pub mod request; - -tonic::include_proto!("sf.firehose.v2"); diff --git a/crates/firehose-protos/src/firehose_v2/request.rs b/crates/firehose-protos/src/firehose_v2/request.rs deleted file mode 100644 index e84e086d..00000000 --- a/crates/firehose-protos/src/firehose_v2/request.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use crate::BlockNumber; - -use super::{single_block_request::Reference, SingleBlockRequest}; - -impl SingleBlockRequest { - /// Create a Firehose [`SingleBlockRequest`] for the given *block number*. - pub fn new(num: u64) -> SingleBlockRequest { - SingleBlockRequest { - reference: Some(Reference::BlockNumber(BlockNumber { num })), - ..Default::default() - } - } -} diff --git a/crates/firehose-protos/src/lib.rs b/crates/firehose-protos/src/lib.rs index 35a96b4c..1ca3ae41 100644 --- a/crates/firehose-protos/src/lib.rs +++ b/crates/firehose-protos/src/lib.rs @@ -19,7 +19,6 @@ mod error; mod ethereum_v2; -mod firehose_v2; mod bstream { pub mod v1 { @@ -30,22 +29,3 @@ mod bstream { pub use bstream::v1::Block as BstreamBlock; pub use error::ProtosError; pub use ethereum_v2::{eth_block::FullReceipt, Block as EthBlock, BlockHeader}; -pub(crate) use firehose_v2::single_block_request::BlockNumber; - -/// Interact programatically with the Firehose v2 Fetch API. -pub use firehose_v2::fetch_client::FetchClient; - -/// Create Firehose API fetch requests. -pub use firehose_v2::Request; - -/// Work with Firehose API streaming responses. -pub use firehose_v2::Response; - -/// Create Firehose API streaming requests. -pub use firehose_v2::SingleBlockRequest; - -/// Receive Firehose API fetch responses. -pub use firehose_v2::SingleBlockResponse; - -/// Work with the Firehose v2 Stream API. -pub use firehose_v2::stream_client::StreamClient; diff --git a/crates/forrestrie-examples/Cargo.toml b/crates/forrestrie-examples/Cargo.toml index 0de5795b..faf71d80 100644 --- a/crates/forrestrie-examples/Cargo.toml +++ b/crates/forrestrie-examples/Cargo.toml @@ -4,9 +4,10 @@ version = "0.1.1" edition = "2021" [dev-dependencies] +beacon-protos.workspace = true bls.workspace = true ethportal-api.workspace = true -firehose-client = { git = "https://github.com/semiotic-ai/firehose-client.git", branch = "main" } +firehose-client.workspace = true firehose-protos = { path = "../firehose-protos" } forrestrie = { path = "../forrestrie" } futures.workspace = true diff --git a/crates/forrestrie-examples/examples/fetch_and_verify_block.rs b/crates/forrestrie-examples/examples/fetch_and_verify_block.rs index 7b2ca56d..59067700 100644 --- a/crates/forrestrie-examples/examples/fetch_and_verify_block.rs +++ b/crates/forrestrie-examples/examples/fetch_and_verify_block.rs @@ -27,8 +27,8 @@ //! assert_eq!(block_root, block_header_root); //! ``` //! +use beacon_protos::Block as FirehoseBeaconBlock; use firehose_client::{Chain, FirehoseClient}; -use forrestrie::beacon_v1::Block as FirehoseBeaconBlock; use tree_hash::TreeHash; use types::{BeaconBlock, MainnetEthSpec}; diff --git a/crates/forrestrie-examples/examples/match_ethereum_to_beacon.rs b/crates/forrestrie-examples/examples/match_ethereum_to_beacon.rs index 7fba4d71..063b8d74 100644 --- a/crates/forrestrie-examples/examples/match_ethereum_to_beacon.rs +++ b/crates/forrestrie-examples/examples/match_ethereum_to_beacon.rs @@ -32,11 +32,9 @@ //! comparison until the correct Beacon slot is found. //! +use beacon_protos::{Block as FirehoseBeaconBlock, Body}; use firehose_client::{Chain, FirehoseClient}; -use forrestrie::{ - beacon_state::ETHEREUM_BEACON_DENEB_OFFSET, - beacon_v1::{block, Block as FirehoseBeaconBlock}, -}; +use forrestrie::beacon_state::ETHEREUM_BEACON_DENEB_OFFSET; use std::cmp::Ordering::*; use tracing::info; use tracing_subscriber::FmtSubscriber; @@ -74,7 +72,7 @@ async fn main() { let response = beacon_client.fetch_block(mid).await.unwrap().unwrap(); let block = FirehoseBeaconBlock::try_from(response.into_inner()).unwrap(); - let Some(block::Body::Deneb(body)) = &block.body else { + let Some(Body::Deneb(body)) = &block.body else { panic!("Unsupported block version!"); }; @@ -113,7 +111,7 @@ async fn try_final_fetches(low: u64, high: u64, client: &mut FirehoseClient) -> let block = FirehoseBeaconBlock::try_from(response.into_inner()).unwrap(); - let Some(block::Body::Deneb(body)) = &block.body else { + let Some(Body::Deneb(body)) = &block.body else { return None; }; diff --git a/crates/forrestrie-examples/examples/single_execution_block.rs b/crates/forrestrie-examples/examples/single_execution_block.rs index 62843842..cbebc77d 100644 --- a/crates/forrestrie-examples/examples/single_execution_block.rs +++ b/crates/forrestrie-examples/examples/single_execution_block.rs @@ -25,6 +25,7 @@ //! the block roots tree hash root, which can then be compared to the tree hash root in the historical summary //! for the era. //! +use beacon_protos::{Block, BlockRoot, Body}; use ethportal_api::Header; use firehose_client::{Chain, FirehoseClient}; use firehose_protos::EthBlock; @@ -36,7 +37,6 @@ use forrestrie::{ compute_block_roots_proof_only, HeadState, CAPELLA_START_ERA, HISTORY_TREE_DEPTH, SLOTS_PER_HISTORICAL_ROOT, }, - beacon_v1::{self, BlockRoot}, }; use futures::StreamExt; use merkle_proof::verify_merkle_proof; @@ -85,7 +85,7 @@ async fn main() { .await .unwrap() .unwrap(); - let beacon_block = beacon_v1::Block::try_from(response.into_inner()).unwrap(); + let beacon_block = Block::try_from(response.into_inner()).unwrap(); assert_eq!(beacon_block.slot, BEACON_SLOT_NUMBER); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +111,7 @@ async fn main() { lighthouse_beacon_block_root.as_bytes(), beacon_block.root.as_slice() ); - let Some(beacon_v1::block::Body::Deneb(body)) = beacon_block.body else { + let Some(Body::Deneb(body)) = beacon_block.body else { panic!("Unsupported block version!"); }; let block_body: BeaconBlockBodyDeneb = body.try_into().unwrap(); @@ -155,7 +155,7 @@ async fn main() { println!("Requesting 8192 blocks for the era... (this takes a while)"); let num_blocks = SLOTS_PER_HISTORICAL_ROOT as u64; let mut stream = beacon_client - .stream_beacon_with_retry((era * SLOTS_PER_HISTORICAL_ROOT) as u64, num_blocks) + .stream_blocks::((era * SLOTS_PER_HISTORICAL_ROOT) as u64, num_blocks) .await .unwrap(); let mut block_roots: Vec = Vec::with_capacity(SLOTS_PER_HISTORICAL_ROOT); diff --git a/crates/forrestrie-examples/examples/verify-era.rs b/crates/forrestrie-examples/examples/verify-era.rs index 76d3b57b..92f29020 100644 --- a/crates/forrestrie-examples/examples/verify-era.rs +++ b/crates/forrestrie-examples/examples/verify-era.rs @@ -8,12 +8,12 @@ //! blocks using the extracted block numbers and verify the execution block data against the //! extracted block headers. +use beacon_protos::Block; use ethportal_api::Header; use firehose_client::{Chain, FirehoseClient}; use firehose_protos::EthBlock; -use forrestrie::{ - beacon_state::{HeadState, CAPELLA_START_ERA, HISTORY_TREE_DEPTH, SLOTS_PER_HISTORICAL_ROOT}, - beacon_v1::{self}, +use forrestrie::beacon_state::{ + HeadState, CAPELLA_START_ERA, HISTORY_TREE_DEPTH, SLOTS_PER_HISTORICAL_ROOT, }; use futures::StreamExt; use tree_hash::TreeHash; @@ -55,7 +55,7 @@ async fn main() { println!("Requesting 8192 blocks for the era... (this takes a while)"); let num_blocks = SLOTS_PER_HISTORICAL_ROOT as u64; let mut stream = beacon_client - .stream_beacon_with_retry((era * SLOTS_PER_HISTORICAL_ROOT) as u64, num_blocks) + .stream_blocks::((era * SLOTS_PER_HISTORICAL_ROOT) as u64, num_blocks) .await .unwrap(); @@ -72,7 +72,7 @@ async fn main() { // Get the exeuction block number and blockhash. let lighthouse_beacon_block = BeaconBlock::::try_from(block.clone()) .expect("Failed to convert Beacon block to Lighthouse BeaconBlock"); - let Some(beacon_v1::block::Body::Deneb(body)) = block.body else { + let Some(beacon_protos::Body::Deneb(body)) = block.body else { panic!("Unsupported block version!"); }; let block_body: BeaconBlockBodyDeneb = body.try_into().unwrap(); diff --git a/crates/forrestrie-examples/examples/verify_block_inclusion_proof.rs b/crates/forrestrie-examples/examples/verify_block_inclusion_proof.rs index 791e3bfe..a2ae87fd 100644 --- a/crates/forrestrie-examples/examples/verify_block_inclusion_proof.rs +++ b/crates/forrestrie-examples/examples/verify_block_inclusion_proof.rs @@ -27,12 +27,10 @@ //! let proof = body.compute_merkle_proof(EXECUTION_PAYLOAD_INDEX).unwrap(); //! ``` //! +use beacon_protos::Block as FirehoseBeaconBlock; use firehose_client::{Chain, FirehoseClient}; -use forrestrie::{ - beacon_block::{ - HistoricalDataProofs, BEACON_BLOCK_BODY_PROOF_DEPTH, EXECUTION_PAYLOAD_FIELD_INDEX, - }, - beacon_v1::Block as FirehoseBeaconBlock, +use forrestrie::beacon_block::{ + HistoricalDataProofs, BEACON_BLOCK_BODY_PROOF_DEPTH, EXECUTION_PAYLOAD_FIELD_INDEX, }; use merkle_proof::verify_merkle_proof; use tree_hash::TreeHash; diff --git a/crates/forrestrie/Cargo.toml b/crates/forrestrie/Cargo.toml index b1b22a5d..578dde6f 100644 --- a/crates/forrestrie/Cargo.toml +++ b/crates/forrestrie/Cargo.toml @@ -11,26 +11,15 @@ path = "src/lib.rs" alloy-rlp.workspace = true alloy-primitives.workspace = true bls.workspace = true -ethportal-api.workspace = true -firehose-protos = { path = "../firehose-protos" } -futures.workspace = true merkle_proof.workspace = true primitive-types.workspace = true -prost.workspace = true -prost-wkt.workspace = true -prost-wkt-types.workspace = true reth-trie-common.workspace = true reth-primitives.workspace = true serde = { workspace = true, features = ["derive"] } ssz_types.workspace = true -tonic.workspace = true tree_hash = "0.6.0" types.workspace = true [dev-dependencies] rand.workspace = true fake.workspace = true - -[build-dependencies] -prost-build.workspace = true -tonic-build.workspace = true diff --git a/crates/forrestrie/build.rs b/crates/forrestrie/build.rs deleted file mode 100644 index 0bbb1db8..00000000 --- a/crates/forrestrie/build.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use prost_build::Config; -use std::{env, path::PathBuf}; - -fn main() { - let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); - - // Configure prost to derive serde traits on specific types - let mut config = Config::new(); - config.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]"); - - // Map Google protobuf types to prost_wkt_types - config.extern_path(".google.protobuf.Any", "::prost_wkt_types::Any"); - config.extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp"); - - tonic_build::configure() - .build_client(true) - .file_descriptor_set_path(out_dir.join("descriptors.bin")) - .compile_protos_with_config(config, &["protos/type.proto"], &["protos/"]) - .unwrap(); -} diff --git a/crates/forrestrie/protos/README.md b/crates/forrestrie/protos/README.md deleted file mode 100644 index b9aa605b..00000000 --- a/crates/forrestrie/protos/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Protobuffer definitions - -## [`type.proto`](https://github.com/pinax-network/firehose-beacon/blob/main/proto/sf/beacon/type/v1/type.proto) - -Pinax's Firehose Beacon `Block` implementation. diff --git a/crates/forrestrie/protos/type.proto b/crates/forrestrie/protos/type.proto deleted file mode 100644 index 302fdb1c..00000000 --- a/crates/forrestrie/protos/type.proto +++ /dev/null @@ -1,270 +0,0 @@ -syntax = "proto3"; - -option go_package = "github.com/pinax-network/firehose-beacon/pb/sf/beacon/type/v1;pbbeacon"; - -package sf.beacon.type.v1; - -import "google/protobuf/timestamp.proto"; - -enum Spec { - UNSPECIFIED = 0; - PHASE0 = 1; - ALTAIR = 2; - BELLATRIX = 3; - CAPELLA = 4; - DENEB = 5; -} - -message Block { - - uint32 version = 1; - - Spec spec = 2; - uint64 slot = 3; - uint64 parent_slot = 4; - bytes root = 5; - bytes parent_root = 6; - bytes state_root = 7; - uint64 proposer_index = 8; - bytes body_root = 9; - - oneof Body { - Phase0Body phase0 = 20; - AltairBody altair = 21; - BellatrixBody bellatrix = 22; - CapellaBody capella = 23; - DenebBody deneb = 24; - } - - bytes signature = 30; - google.protobuf.Timestamp timestamp = 31; -} - -message Phase0Body { - bytes rando_reveal = 1; - Eth1Data eth1_data = 2; - bytes graffiti = 3; - repeated ProposerSlashing proposer_slashings = 4; - repeated AttesterSlashing attester_slashings = 5; - repeated Attestation attestations = 6; - repeated Deposit deposits = 7; - repeated SignedVoluntaryExit voluntary_exits = 8; -} - -message AltairBody { - bytes rando_reveal = 1; - Eth1Data eth1_data = 2; - bytes graffiti = 3; - repeated ProposerSlashing proposer_slashings = 4; - repeated AttesterSlashing attester_slashings = 5; - repeated Attestation attestations = 6; - repeated Deposit deposits = 7; - repeated SignedVoluntaryExit voluntary_exits = 8; - SyncAggregate sync_aggregate = 9; -} - -message BellatrixBody { - bytes rando_reveal = 1; - Eth1Data eth1_data = 2; - bytes graffiti = 3; - repeated ProposerSlashing proposer_slashings = 4; - repeated AttesterSlashing attester_slashings = 5; - repeated Attestation attestations = 6; - repeated Deposit deposits = 7; - repeated SignedVoluntaryExit voluntary_exits = 8; - SyncAggregate sync_aggregate = 9; - BellatrixExecutionPayload execution_payload = 10; -} - -message CapellaBody { - bytes rando_reveal = 1; - Eth1Data eth1_data = 2; - bytes graffiti = 3; - repeated ProposerSlashing proposer_slashings = 4; - repeated AttesterSlashing attester_slashings = 5; - repeated Attestation attestations = 6; - repeated Deposit deposits = 7; - repeated SignedVoluntaryExit voluntary_exits = 8; - SyncAggregate sync_aggregate = 9; - CapellaExecutionPayload execution_payload = 10; -} - -message DenebBody { - bytes rando_reveal = 1; - Eth1Data eth1_data = 2; - bytes graffiti = 3; - repeated ProposerSlashing proposer_slashings = 4; - repeated AttesterSlashing attester_slashings = 5; - repeated Attestation attestations = 6; - repeated Deposit deposits = 7; - repeated SignedVoluntaryExit voluntary_exits = 8; - SyncAggregate sync_aggregate = 9; - DenebExecutionPayload execution_payload = 10; - repeated SignedBLSToExecutionChange bls_to_execution_changes = 11; - repeated bytes blob_kzg_commitments = 12; - - repeated Blob embedded_blobs = 20; -} - -message Eth1Data { - bytes deposit_root = 1; - uint64 deposit_count = 2; - bytes block_hash = 3; -} - -message ProposerSlashing { - SignedBeaconBlockHeader signed_header_1 = 1; - SignedBeaconBlockHeader signed_header_2 = 2; -} - -message AttesterSlashing { - IndexedAttestation attestation_1 = 1; - IndexedAttestation attestation_2 = 2; -} - -message Attestation { - bytes aggregation_bits = 1; - AttestationData data = 2; - bytes signature = 3; -} - -message Deposit { - repeated bytes proof = 1; - DepositData data = 2; -} - -message SignedVoluntaryExit { - VoluntaryExit message = 1; - bytes signature = 2; -} - -message SyncAggregate { - bytes sync_commitee_bits = 1; - bytes sync_comittee_signature = 2; -} - -message BellatrixExecutionPayload { - bytes parent_hash = 1; - bytes fee_recipient = 2; - bytes state_root = 3; - bytes receipts_root = 4; - bytes logs_bloom = 5; - bytes prev_randao = 6; - uint64 block_number = 7; - uint64 gas_limit = 8; - uint64 gas_used = 9; - google.protobuf.Timestamp timestamp = 10; - bytes extra_data = 11; - bytes base_fee_per_gas = 12; - bytes block_hash = 13; - repeated bytes transactions = 14; -} - - -message CapellaExecutionPayload { - bytes parent_hash = 1; - bytes fee_recipient = 2; - bytes state_root = 3; - bytes receipts_root = 4; - bytes logs_bloom = 5; - bytes prev_randao = 6; - uint64 block_number = 7; - uint64 gas_limit = 8; - uint64 gas_used = 9; - google.protobuf.Timestamp timestamp = 10; - bytes extra_data = 11; - bytes base_fee_per_gas = 12; - bytes block_hash = 13; - repeated bytes transactions = 14; - repeated Withdrawal withdrawals = 15; -} - -message DenebExecutionPayload { - bytes parent_hash = 1; - bytes fee_recipient = 2; - bytes state_root = 3; - bytes receipts_root = 4; - bytes logs_bloom = 5; - bytes prev_randao = 6; - uint64 block_number = 7; - uint64 gas_limit = 8; - uint64 gas_used = 9; - google.protobuf.Timestamp timestamp = 10; - bytes extra_data = 11; - bytes base_fee_per_gas = 12; - bytes block_hash = 13; - repeated bytes transactions = 14; - repeated Withdrawal withdrawals = 15; - uint64 blob_gas_used = 16; - uint64 excess_blob_gas = 17; -} - -message SignedBLSToExecutionChange { - BLSToExecutionChange message = 1; - bytes signature = 2; -} - -message BLSToExecutionChange { - uint64 validator_index = 1; - bytes from_bls_pub_key = 2; - bytes to_execution_address = 3; -} - -message Withdrawal { - uint64 withdrawal_index = 1; - uint64 validator_index = 2; - bytes address = 3; - uint64 gwei = 4; -} - -message VoluntaryExit { - uint64 epoch = 1; - uint64 validator_index = 2; -} - -message DepositData { - bytes public_key = 1; - bytes withdrawal_credentials = 2; - uint64 gwei = 3; - bytes signature = 4; -} - -message IndexedAttestation { - repeated uint64 attesting_indices = 1; - AttestationData data = 2; - bytes signature = 3; -} - -message AttestationData { - uint64 slot = 1; - uint64 committee_index = 2; - bytes beacon_block_root = 3; - Checkpoint source = 4; - Checkpoint target = 5; -} - -message Checkpoint { - uint64 epoch = 1; - bytes root = 2; -} - -message SignedBeaconBlockHeader { - BeaconBlockHeader message = 1; - bytes Signature = 2; -} - -message BeaconBlockHeader { - uint64 slot = 1; - uint64 proposer_index = 2; - bytes parent_root = 3; - bytes state_root = 4; - bytes body_root = 5; -} - -message Blob { - uint64 index = 1; - bytes blob = 2; - bytes kzg_commitment = 3; - bytes kzg_proof = 4; - repeated bytes kzg_commitment_inclusion_proof = 5; -} \ No newline at end of file diff --git a/crates/forrestrie/src/beacon_v1.rs b/crates/forrestrie/src/beacon_v1.rs deleted file mode 100644 index 65c32d0d..00000000 --- a/crates/forrestrie/src/beacon_v1.rs +++ /dev/null @@ -1,528 +0,0 @@ -// Copyright 2024-, Semiotic AI, Inc. -// SPDX-License-Identifier: Apache-2.0 - -//! Firehose Beacon-related data structures and operations. -//! See the protobuffer definitions section of the README for more information. -//! -use firehose_protos::{ProtosError, Response, SingleBlockResponse}; -use primitive_types::{H256, U256}; -use prost::Message; -use ssz_types::{length::Fixed, Bitfield, FixedVector}; -use types::{ - Address, BeaconBlock, BeaconBlockBodyDeneb, BitList, EthSpec, ExecutionBlockHash, Graffiti, - IndexedAttestationBase, MainnetEthSpec, GRAFFITI_BYTES_LEN, -}; - -tonic::include_proto!("sf.beacon.r#type.v1"); - -impl TryFrom for types::AttestationBase { - type Error = ProtosError; - - fn try_from( - Attestation { - aggregation_bits, - data, - signature, - }: Attestation, - ) -> Result { - Ok(Self { - aggregation_bits: BitList::from_bytes(aggregation_bits.as_slice().into()) - .map_err(|e| ProtosError::SszTypesError(format!("{:?}", e)))?, - data: data - .ok_or(ProtosError::AttestationDataMissing)? - .try_into()?, - signature: bls::generics::GenericAggregateSignature::deserialize(signature.as_slice()) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - }) - } -} - -impl TryFrom for types::AttestationData { - type Error = ProtosError; - - fn try_from( - AttestationData { - slot, - committee_index, - beacon_block_root, - source, - target, - }: AttestationData, - ) -> Result { - Ok(Self { - slot: slot.into(), - index: committee_index, - beacon_block_root: H256::from_slice(beacon_block_root.as_slice()), - source: source.ok_or(ProtosError::CheckpointMissing)?.into(), - target: target.ok_or(ProtosError::CheckpointMissing)?.into(), - }) - } -} - -impl TryFrom for types::AttesterSlashingBase { - type Error = ProtosError; - - fn try_from( - AttesterSlashing { - attestation_1, - attestation_2, - }: AttesterSlashing, - ) -> Result { - let attestation_1 = attestation_1.ok_or(ProtosError::SignerMissing)?; - let attestation_2 = attestation_2.ok_or(ProtosError::SignerMissing)?; - - Ok(Self { - attestation_1: attestation_1.try_into()?, - attestation_2: attestation_2.try_into()?, - }) - } -} - -impl From for types::BeaconBlockHeader { - fn from( - BeaconBlockHeader { - slot, - proposer_index, - parent_root, - state_root, - body_root, - }: BeaconBlockHeader, - ) -> Self { - Self { - slot: slot.into(), - proposer_index, - parent_root: H256::from_slice(parent_root.as_slice()), - state_root: H256::from_slice(state_root.as_slice()), - body_root: H256::from_slice(body_root.as_slice()), - } - } -} - -impl TryFrom for types::BlsToExecutionChange { - type Error = ProtosError; - - fn try_from( - BlsToExecutionChange { - validator_index, - from_bls_pub_key, - to_execution_address, - }: BlsToExecutionChange, - ) -> Result { - Ok(Self { - validator_index, - from_bls_pubkey: bls::generics::GenericPublicKeyBytes::deserialize( - from_bls_pub_key.as_slice(), - ) - .map_err(|e| ProtosError::Bls(format!("{e:?}")))?, - to_execution_address: Address::from_slice(to_execution_address.as_slice()), - }) - } -} - -impl From for types::Checkpoint { - fn from(Checkpoint { epoch, root }: Checkpoint) -> Self { - Self { - epoch: epoch.into(), - root: H256::from_slice(root.as_slice()), - } - } -} - -impl TryFrom for types::ExecutionPayloadDeneb { - type Error = ProtosError; - - fn try_from( - DenebExecutionPayload { - parent_hash, - fee_recipient, - state_root, - receipts_root, - logs_bloom, - prev_randao, - block_number, - gas_limit, - gas_used, - timestamp, - extra_data, - base_fee_per_gas, - block_hash, - transactions, - withdrawals, - blob_gas_used, - excess_blob_gas, - }: DenebExecutionPayload, - ) -> Result { - Ok(Self { - parent_hash: ExecutionBlockHash::from_root(H256::from_slice(parent_hash.as_slice())), - fee_recipient: Address::from_slice(fee_recipient.as_slice()), - state_root: H256::from_slice(state_root.as_slice()), - receipts_root: H256::from_slice(receipts_root.as_slice()), - logs_bloom: FixedVector::from(logs_bloom), - prev_randao: H256::from_slice(prev_randao.as_slice()), - block_number, - gas_limit, - gas_used, - timestamp: timestamp - .as_ref() - .ok_or(ProtosError::BlockConversionError)? - .seconds as u64, - extra_data: extra_data.into(), - base_fee_per_gas: U256::from_big_endian(base_fee_per_gas.as_slice()), - block_hash: ExecutionBlockHash(H256::from_slice(block_hash.as_slice())), - transactions: transactions - .into_iter() - .map(Into::into) - .collect::>() - .into(), - withdrawals: withdrawals - .into_iter() - .map(Into::into) - .collect::>() - .into(), - blob_gas_used, - excess_blob_gas, - }) - } -} - -impl TryFrom for types::Deposit { - type Error = ProtosError; - - fn try_from(Deposit { proof, data }: Deposit) -> Result { - Ok(Self { - proof: proof - .into_iter() - .map(|v| H256::from_slice(v.as_slice())) - .collect::>() - .into(), - data: data.ok_or(ProtosError::DepositDataMissing)?.try_into()?, - }) - } -} - -impl TryFrom for types::DepositData { - type Error = ProtosError; - - fn try_from( - DepositData { - public_key, - withdrawal_credentials, - gwei, - signature, - }: DepositData, - ) -> Result { - Ok(Self { - pubkey: bls::generics::GenericPublicKeyBytes::deserialize(public_key.as_slice()) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - withdrawal_credentials: H256::from_slice(withdrawal_credentials.as_slice()), - amount: gwei, - signature: bls::generics::GenericSignatureBytes::deserialize(signature.as_slice()) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - }) - } -} - -impl From for types::Eth1Data { - fn from( - Eth1Data { - deposit_root, - deposit_count, - block_hash, - }: Eth1Data, - ) -> Self { - Self { - deposit_root: H256::from_slice(deposit_root.as_slice()), - deposit_count, - block_hash: H256::from_slice(block_hash.as_slice()), - } - } -} - -impl TryFrom for types::IndexedAttestationBase { - type Error = ProtosError; - - fn try_from( - IndexedAttestation { - attesting_indices, - data, - signature, - }: IndexedAttestation, - ) -> Result { - Ok(IndexedAttestationBase { - attesting_indices: attesting_indices.into(), - data: data - .ok_or(ProtosError::IndexedAttestationDataMissing)? - .try_into()?, - signature: bls::generics::GenericAggregateSignature::deserialize(signature.as_slice()) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - }) - } -} - -impl TryFrom for types::ProposerSlashing { - type Error = ProtosError; - - fn try_from( - ProposerSlashing { - signed_header_1, - signed_header_2, - }: ProposerSlashing, - ) -> Result { - Ok(Self { - signed_header_1: signed_header_1 - .ok_or(ProtosError::SignerMissing)? - .try_into()?, - signed_header_2: signed_header_2 - .ok_or(ProtosError::SignerMissing)? - .try_into()?, - }) - } -} - -impl TryFrom for types::SignedBeaconBlockHeader { - type Error = ProtosError; - - fn try_from( - SignedBeaconBlockHeader { message, signature }: SignedBeaconBlockHeader, - ) -> Result { - Ok(Self { - message: message - .ok_or(ProtosError::SignedBeaconBlockHeaderMessageMissing)? - .into(), - signature: bls::generics::GenericSignature::deserialize(signature.as_slice()) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - }) - } -} - -impl TryFrom for types::SignedBlsToExecutionChange { - type Error = ProtosError; - - fn try_from( - SignedBlsToExecutionChange { message, signature }: SignedBlsToExecutionChange, - ) -> Result { - Ok(Self { - message: message - .ok_or(ProtosError::BlsToExecutionChangeMissing)? - .try_into()?, - signature: bls::generics::GenericSignature::deserialize(signature.as_slice()) - .expect("Failed to deserialize signature"), - }) - } -} - -impl TryFrom for types::SignedVoluntaryExit { - type Error = ProtosError; - - fn try_from( - SignedVoluntaryExit { message, signature }: SignedVoluntaryExit, - ) -> Result { - Ok(Self { - message: message.ok_or(ProtosError::VoluntaryExitMissing)?.into(), - signature: bls::generics::GenericSignature::deserialize(signature.as_slice()) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - }) - } -} - -impl TryFrom for Block { - type Error = ProtosError; - - fn try_from(response: SingleBlockResponse) -> Result { - let any = response.block.ok_or(ProtosError::BlockMissingInResponse)?; - let block = Block::decode(any.value.as_ref())?; - Ok(block) - } -} - -impl TryFrom for Block { - type Error = ProtosError; - - fn try_from(response: Response) -> Result { - let any = response.block.ok_or(ProtosError::BlockMissingInResponse)?; - let block = Block::decode(any.value.as_ref())?; - Ok(block) - } -} - -impl TryFrom for types::SyncAggregate { - type Error = ProtosError; - - fn try_from( - SyncAggregate { - sync_commitee_bits, - sync_comittee_signature, - }: SyncAggregate, - ) -> Result { - Ok(Self { - sync_committee_bits: Bitfield::::SyncCommitteeSize>>::from_bytes( - sync_commitee_bits.as_slice().into(), - ) - .map_err(|e| ProtosError::SszTypesError(format!("{:?}", e)))?, - sync_committee_signature: bls::generics::GenericAggregateSignature::deserialize( - sync_comittee_signature.as_slice(), - ) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - }) - } -} - -impl From for types::VoluntaryExit { - fn from( - VoluntaryExit { - epoch, - validator_index, - }: VoluntaryExit, - ) -> Self { - Self { - epoch: epoch.into(), - validator_index, - } - } -} - -impl From for types::Withdrawal { - fn from( - Withdrawal { - withdrawal_index, - validator_index, - address, - gwei, - }: Withdrawal, - ) -> Self { - Self { - index: withdrawal_index, - validator_index, - address: Address::from_slice(address.as_slice()), - amount: gwei, - } - } -} - -impl TryFrom for types::BeaconBlockBodyDeneb { - type Error = ProtosError; - - fn try_from( - DenebBody { - rando_reveal, - eth1_data, - graffiti, - proposer_slashings, - attester_slashings, - attestations, - deposits, - voluntary_exits, - sync_aggregate, - execution_payload, - bls_to_execution_changes, - blob_kzg_commitments, - // Blobs not included. - .. - }: DenebBody, - ) -> Result { - let beacon_block_body = BeaconBlockBodyDeneb { - randao_reveal: bls::generics::GenericSignature::deserialize(&rando_reveal) - .map_err(|e| ProtosError::Bls(format!("{:?}", e)))?, - eth1_data: eth1_data - .map(|eth1_data| eth1_data.into()) - .unwrap_or_default(), - graffiti: Graffiti::from( - <[u8; GRAFFITI_BYTES_LEN]>::try_from(graffiti.as_slice()) - .map_err(|_| ProtosError::GraffitiInvalid)?, - ), - proposer_slashings: proposer_slashings - .into_iter() - .map(|proposer_slashing| proposer_slashing.try_into()) - .collect::, _>>()? - .into(), - attester_slashings: attester_slashings - .into_iter() - .map(|attester_slashing| attester_slashing.try_into()) - .collect::, _>>()? - .into(), - attestations: attestations - .into_iter() - .map(|attestation| attestation.try_into()) - .collect::, _>>()? - .into(), - deposits: deposits - .into_iter() - .map(|deposit| deposit.try_into()) - .collect::, _>>()? - .into(), - voluntary_exits: voluntary_exits - .into_iter() - .map(|voluntary_exit| voluntary_exit.try_into()) - .collect::, _>>()? - .into(), - sync_aggregate: sync_aggregate - .map(|sync_aggregate| sync_aggregate.try_into()) - .transpose()? - .unwrap_or_else(types::SyncAggregate::new), - execution_payload: execution_payload - .ok_or(ProtosError::ExecutionPayloadMissing) - .and_then(types::ExecutionPayloadDeneb::try_from)? - .into(), - bls_to_execution_changes: bls_to_execution_changes - .into_iter() - .map(|bls_to_execution_change| bls_to_execution_change.try_into()) - .collect::, _>>()? - .into(), - blob_kzg_commitments: blob_kzg_commitments - .into_iter() - .map(|blob_kzg_commitment| { - <[u8; 48]>::try_from(blob_kzg_commitment.as_slice()) - .map(types::KzgCommitment) - .map_err(|_| ProtosError::KzgCommitmentInvalid) - }) - .collect::, _>>()? - .into(), - }; - Ok(beacon_block_body) - } -} - -impl TryFrom for types::BeaconBlockBodyDeneb { - type Error = ProtosError; - - fn try_from(body: crate::beacon_v1::block::Body) -> Result { - match body { - crate::beacon_v1::block::Body::Deneb(deneb) => Ok(deneb.try_into()?), - _ => panic!("Invalid body type"), - } - } -} - -impl TryFrom for types::BeaconBlock { - type Error = ProtosError; - - fn try_from( - Block { - slot, - proposer_index, - parent_root, - state_root, - body, - .. - }: Block, - ) -> Result { - Ok(Self::Deneb(types::BeaconBlockDeneb { - slot: slot.into(), - proposer_index, - parent_root: H256::from_slice(parent_root.as_slice()), - state_root: H256::from_slice(state_root.as_slice()), - body: body.ok_or(ProtosError::BlockConversionError)?.try_into()?, - })) - } -} - -pub struct BlockRoot(pub H256); - -impl TryFrom for BlockRoot { - type Error = ProtosError; - - fn try_from(beacon_block: Block) -> Result { - let lighthouse_beacon_block = BeaconBlock::::try_from(beacon_block)?; - Ok(Self(lighthouse_beacon_block.canonical_root())) - } -} diff --git a/crates/forrestrie/src/lib.rs b/crates/forrestrie/src/lib.rs index 39c9f68e..19785755 100644 --- a/crates/forrestrie/src/lib.rs +++ b/crates/forrestrie/src/lib.rs @@ -3,5 +3,4 @@ pub mod beacon_block; pub mod beacon_state; -pub mod beacon_v1; pub mod execution_layer;