diff --git a/Cargo.lock b/Cargo.lock index 4888d88c5f3..e07e774093d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,11 +97,11 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-chains" -version = "0.1.68" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4187222f4ed4bf8d0539f845249b450de318ba33dd74bac328a9a1dfbfc13ba6" +checksum = "7734aecfc58a597dde036e4c5cace2ae43e2f8bf3d406b022a1ef34da178dd49" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "num_enum", @@ -112,12 +112,12 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d301f5bcfd37e3aac727c360d8b50c33ddff9169ce0370198dedda36a9927d" +checksum = "c2179ba839ac532f50279f5da2a6c5047f791f03f6f808b4dfab11327b97902f" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-serde", "alloy-trie", @@ -136,13 +136,13 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4f97a85a45965e0e4f9f5b94bbafaa3e4ee6868bdbcf2e4a9acb4b358038fe" +checksum = "aec6f67bdc62aa277e0ec13c1b1fb396c8a62b65c8e9bd8c1d3583cc6d1a8dd3" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-serde", "arbitrary", @@ -151,16 +151,16 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f39e8b96c9e25dde7222372332489075f7e750e4fd3e81c11eec0939b78b71b8" +checksum = "5084cf42388dff75b255308194f9d3e67ae2a93ce7e24262a512cc4043ac1838" dependencies = [ "alloy-consensus", "alloy-dyn-abi", "alloy-json-abi", "alloy-network", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-provider", "alloy-rpc-types-eth", "alloy-sol-types", @@ -172,12 +172,12 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb8e762aefd39a397ff485bc86df673465c4ad3ec8819cc60833a8a3ba5cdc87" +checksum = "884a5d4560f7e5e34ec3c5e54a60223c56352677dd049b495fbb59384cf72a90" dependencies = [ "alloy-json-abi", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-sol-type-parser", "alloy-sol-types", "const-hex", @@ -190,11 +190,11 @@ dependencies = [ [[package]] name = "alloy-eip2124" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675264c957689f0fd75f5993a73123c2cc3b5c235a38f5b9037fe6c826bfb2c0" +checksum = "741bdd7499908b3aa0b159bba11e71c8cddd009a2c2eb7a06e825f1ec87900a5" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "crc", @@ -205,11 +205,11 @@ dependencies = [ [[package]] name = "alloy-eip2930" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +checksum = "dbe3e16484669964c26ac48390245d84c410b1a5f968976076c17184725ef235" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "rand 0.8.5", @@ -218,11 +218,11 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b15b13d38b366d01e818fe8e710d4d702ef7499eacd44926a06171dd9585d0c" +checksum = "804cefe429015b4244966c006d25bda5545fa9db5990e9c9079faf255052f50a" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "k256", @@ -234,14 +234,14 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b11c382ca8075128d1ae6822b60921cf484c911d9a5831797a01218f98125f" +checksum = "609515c1955b33af3d78d26357540f68c5551a90ef58fd53def04f2aa074ec43" dependencies = [ "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-serde", "arbitrary", @@ -249,22 +249,22 @@ dependencies = [ "c-kzg", "derive_more 2.0.1", "either", - "ethereum_ssz", - "ethereum_ssz_derive", + "ethereum_ssz 0.9.0", + "ethereum_ssz_derive 0.9.0", "serde", "sha2 0.10.8", ] [[package]] name = "alloy-evm" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71b0b181c956dca015b4c08b36668736013787c9dc9e743fd39a23b8b130c14" +checksum = "ee1ae7de7526aed0484be50c4cc4c01122b94d0f70fd34fcca79e2caa987e434" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-hardforks", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-sol-types", "auto_impl", "derive_more 2.0.1", @@ -276,12 +276,12 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd9e75c5dd40319ebbe807ebe9dfb10c24e4a70d9c7d638e62921d8dd093c8b" +checksum = "6dfec8348d97bd624901c6a4b22bb4c24df8a3128fc3d5e42d24f7b79dfa8588" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-serde", "alloy-trie", "serde", @@ -289,13 +289,13 @@ dependencies = [ [[package]] name = "alloy-hardforks" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473ee2ab7f5262b36e8fbc1b5327d5c9d488ab247e31ac739b929dbe2444ae79" +checksum = "c7d3b2243e2adfaea41da41982f91ecab8083fa51b240d0427955d709f65b1b4" dependencies = [ "alloy-chains", "alloy-eip2124", - "alloy-primitives", + "alloy-primitives 1.0.0", "auto_impl", "dyn-clone", "serde", @@ -303,11 +303,11 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6beff64ad0aa6ad1019a3db26fef565aefeb011736150ab73ed3366c3cfd1b" +checksum = "5189fa9a8797e92396bc4b4454c5f2073a4945f7c2b366af9af60f9536558f7a" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-sol-type-parser", "serde", "serde_json", @@ -315,11 +315,11 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbcf26d02a72e23d5bc245425ea403c93ba17d254f20f9c23556a249c6c7e143" +checksum = "3994ab6ff6bdeb5aebe65381a8f6a47534789817570111555e8ac413e242ce06" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-sol-types", "serde", "serde_json", @@ -329,16 +329,16 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b44dd4429e190f727358571175ebf323db360a303bf4e1731213f510ced1c2e6" +checksum = "0be3aa020a6d3aa7601185b4c1a7d6f3a5228cb5424352db63064b29a455c891" dependencies = [ "alloy-consensus", "alloy-consensus-any", "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-any", "alloy-rpc-types-eth", "alloy-serde", @@ -355,27 +355,27 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f736e1d1eb1b770dbd32919bdf46d4dcd4617f2eed07947dfb32649962baba" +checksum = "498f2ee2eef38a6db0fc810c7bf7daebdf5f2fa8d04adb8bd53e54e91ddbdea3" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-serde", "serde", ] [[package]] name = "alloy-node-bindings" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f33291f6b969268b04b8f96ffab5071b3c241e593dd462372288b069787375" +checksum = "60dd250ffe9514728daf5e84cac7193e221b85feffe3bea7d45f2b9fcbe6b885" dependencies = [ "alloy-genesis", "alloy-hardforks", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-signer", "alloy-signer-local", "k256", @@ -389,15 +389,15 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324cf0b3b08b4c3354460dee8208384a59245da8b0eaefe9e962d3942d919d58" +checksum = "427bfde7779a82607cc97df6c6e634dc8b25a1412d03d0e26a2ef27b83c3856a" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-evm", "alloy-op-hardforks", - "alloy-primitives", + "alloy-primitives 1.0.0", "auto_impl", "op-alloy-consensus", "op-revm", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "alloy-op-hardforks" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ef11121e0eab0e732d89b71f86b907eb23928d3c69ed453905f33a599ca89c0" +checksum = "04a45f2af91a348e5d22dbb3589d821d2e83d2e65b54c14c3f9e8e9c6903fc09" dependencies = [ "alloy-hardforks", "auto_impl", @@ -420,6 +420,33 @@ name = "alloy-primitives" version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c77490fe91a0ce933a1f219029521f20fc28c2c0ca95d53fa4da9c00b8d9d4e" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 2.0.1", + "foldhash", + "hashbrown 0.15.2", + "indexmap 2.8.0", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.8.5", + "ruint", + "rustc-hash 2.1.1", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-primitives" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70b98b99c1dcfbe74d7f0b31433ff215e7d1555e367d90e62db904f3c9d4ff53" dependencies = [ "alloy-rlp", "arbitrary", @@ -429,7 +456,7 @@ dependencies = [ "derive_arbitrary", "derive_more 2.0.1", "foldhash", - "getrandom 0.2.15", + "getrandom 0.3.2", "hashbrown 0.15.2", "indexmap 2.8.0", "itoa", @@ -438,7 +465,7 @@ dependencies = [ "paste", "proptest", "proptest-derive", - "rand 0.8.5", + "rand 0.9.0", "ruint", "rustc-hash 2.1.1", "serde", @@ -448,9 +475,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a557f9e3ec89437b06db3bfc97d20782b1f7cc55b5b602b6a82bf3f64d7efb0e" +checksum = "3d6ba76d476f475668925f858cc4db51781f12abdaa4e0274eb57a09f574e869" dependencies = [ "alloy-chains", "alloy-consensus", @@ -458,7 +485,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types-admin", @@ -492,12 +519,12 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a261caff6c2ec6fe1d6eb77ba41159024c8387d05e4138804a387d403def55" +checksum = "04135d2fd7fa1fba3afe9f79ec2967259dbc0948e02fa0cd0e33a4a812e2cb0a" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-transport", "bimap", "futures", @@ -508,6 +535,7 @@ dependencies = [ "tokio-stream", "tower 0.5.2", "tracing", + "wasmtimer", ] [[package]] @@ -534,12 +562,12 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec6dc89c4c3ef166f9fa436d1831f8142c16cf2e637647c936a6aaaabd8d898" +checksum = "1d6a6985b48a536b47aa0aece56e6a0f49240ce5d33a7f0c94f1b312eda79aa1" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -562,11 +590,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3849f8131a18cc5d7f95f301d68a6af5aa2db28ad8522fb9db1f27b3794e8b68" +checksum = "3bf27873220877cb15125eb6eec2f86c6e9b41473aca85844bd3d9d755bfc0a0" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-serde", @@ -575,23 +603,23 @@ dependencies = [ [[package]] name = "alloy-rpc-types-admin" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e905b0348666e10119d39b1ffb7ab4e000b4f4e5ffed920b57f8745b2440" +checksum = "564fbba310fbfdadf16512c973315d0fa8eaf8fd2c442f1265bfc24e51f41ddf" dependencies = [ "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "serde", "serde_json", ] [[package]] name = "alloy-rpc-types-anvil" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19051fd5e8de7e1f95ec228c9303debd776dcc7caf8d1ece3191f711f5c06541" +checksum = "8c349f7339476f13e23308111dfeb67d136c11e7b2a6b1d162f6a124ad4ffb9b" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -599,9 +627,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd6d480e4e6e456f30eeeb3aef1512aaecb68df2a35d1f78865dbc4d20dc0fd" +checksum = "d1a40595b927dfb07218459037837dbc8de8500a26024bb6ff0548dd2ccc13e0" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -610,15 +638,15 @@ dependencies = [ [[package]] name = "alloy-rpc-types-beacon" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b821fd7c93738d5ec972d4d329eb05c896721f467556fbae171294ddd9ac829" +checksum = "77c08a6f2593a8b6401e579996a887b22794543e0ff5976c5c21ddd361755dec" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", - "ethereum_ssz", - "ethereum_ssz_derive", + "ethereum_ssz 0.9.0", + "ethereum_ssz_derive 0.9.0", "serde", "serde_with", "thiserror 2.0.12", @@ -628,28 +656,28 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "805eb9fa07f92f1225253e842b5454b4b3e258813445c1a1c9d8dd0fd90817c1" +checksum = "05525519bd7f37f98875354f0b3693d3ad3c7a7f067e3b8946777920be15cb5b" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "serde", ] [[package]] name = "alloy-rpc-types-engine" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "689521777149dabe210ef122605fb00050e038f2e85b8c9897534739f1a904f8" +checksum = "4235d79af20fe5583ca26096258fe9307571a345745c433cfd8c91b41aa2611e" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-serde", "derive_more 2.0.1", - "ethereum_ssz", - "ethereum_ssz_derive", + "ethereum_ssz 0.9.0", + "ethereum_ssz_derive 0.9.0", "jsonrpsee-types", "jsonwebtoken", "rand 0.8.5", @@ -659,15 +687,15 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8b6d55bdaa0c4a08650d4b32f174494cbade56adf6f2fcfa2a4f3490cb5511" +checksum = "f2a9f64e0f69cfb6029e2a044519a1bdd44ce9fc334d5315a7b9837f7a6748e5" dependencies = [ "alloy-consensus", "alloy-consensus-any", "alloy-eips", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-serde", "alloy-sol-types", @@ -681,12 +709,12 @@ dependencies = [ [[package]] name = "alloy-rpc-types-mev" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d1e3fbbf9b2eb2509546b4e47f67ee8a3b246ef3f7eb678bcb97d399c755b4" +checksum = "96b38fc4f5a198a14b1411c27c530c95fd05800613175a4c98ae61475c41b7c5" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -695,11 +723,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6019cd6a89230d765a621a7b1bc8af46a6a9cde2d2e540e6f9ce930e0fb7c6db" +checksum = "2bccbe4594eaa2d69d21fa0b558c44e36202e599eb209da70b405415cb37a354" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -709,11 +737,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee36e5404642696af511f09991f9f54a11b90e86e55efad868f8f56350eff5b0" +checksum = "56b8de4afea88d9ca1504b9dee40ffae69a2364aed82ab6e88e4348b41f57f6b" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -721,11 +749,11 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1824791912f468a481dedc1db50feef3e85a078f6d743a62db2ee9c2ca674882" +checksum = "d4dba6ff08916bc0a9cbba121ce21f67c0b554c39cf174bc7b9df6c651bd3c3b" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "serde", "serde_json", @@ -733,11 +761,11 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d087fe5aea96a93fbe71be8aaed5c57c3caac303c09e674bc5b1647990d648b" +checksum = "0c580da7f00f3999e44e327223044d6732358627f93043e22d92c583f6583556" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "async-trait", "auto_impl", "either", @@ -748,13 +776,13 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2940353d2425bb75965cd5101075334e6271051e35610f903bf8099a52b0b1a9" +checksum = "a00f0f07862bd8f6bc66c953660693c5903062c2c9d308485b2a6eee411089e7" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-signer", "async-trait", "coins-bip32", @@ -766,9 +794,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10ae8e9a91d328ae954c22542415303919aabe976fe7a92eb06db1b68fd59f2" +checksum = "60fcfa26956bcb22f66ab13407115197f26ef23abca5b48d39a1946897382d74" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -780,9 +808,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ad5da86c127751bc607c174d6c9fe9b85ef0889a9ca0c641735d77d4f98f26" +checksum = "72a9b402f0013f1ff8c24066eeafc2207a8e52810a2b18b77776ce7fead5af41" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -798,9 +826,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3d30f0d3f9ba3b7686f3ff1de9ee312647aac705604417a2f40c604f409a9e" +checksum = "d02d61741337bb6b3f4899c2e3173fe17ffa2810e143d3b28acd953197c8dd79" dependencies = [ "const-hex", "dunce", @@ -814,9 +842,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d162f8524adfdfb0e4bd0505c734c985f3e2474eb022af32eef0d52a4f3935c" +checksum = "d2b5f5f9f561c29f78ea521ebe2e5ac1633f1b1442dae582f68ecd57c6350042" dependencies = [ "serde", "winnow", @@ -824,12 +852,12 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43d5e60466a440230c07761aa67671d4719d46f43be8ea6e7ed334d8db4a9ab" +checksum = "c02635bce18205ff8149fb752c753b0a91ea3f3c8ee04c58846448be4811a640" dependencies = [ "alloy-json-abi", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-sol-macro", "const-hex", "serde", @@ -837,9 +865,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6818b4c82a474cc01ac9e88ccfcd9f9b7bc893b2f8aea7e890a28dcd55c0a7aa" +checksum = "6e1f1a55f9ff9a48aa0b4a8c616803754620010fbb266edae2f4548f4304373b" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -859,9 +887,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc3079a33483afa1b1365a3add3ea3e21c75b10f704870198ba7846627d10f2" +checksum = "171b3d8824b6697d6c8325373ec410d230b6c59ce552edfbfabe4e7b8a26aac3" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -874,9 +902,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c6f8e20aa6b748357bed157c14e561a176d0f6cffed7f99ee37758a7d16202" +checksum = "f8a71043836f2144e1fe30f874eb2e9d71d2632d530e35b09fadbf787232f3f4" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -894,9 +922,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef7a4301e8967c1998f193755fd9429e0ca81730e2e134e30c288c43dbf96f0" +checksum = "fdde5b241745076bcbf2fcad818f2c42203bd2c5f4b50ea43b628ccbd2147ad6" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -912,11 +940,11 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.7.9" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a94854e420f07e962f7807485856cde359ab99ab6413883e15235ad996e8b" +checksum = "8f9382b4e38b126358f276b863673bc47840d3b3508dd1c9efe22f81b4e83649" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "arrayvec", @@ -3052,7 +3080,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "rayon", "reth-chainspec", @@ -3211,7 +3239,20 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70cbccfccf81d67bff0ab36e591fa536c8a935b078a7b0e58c1d00d418332fc9" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.25", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives 1.0.0", "hex", "serde", "serde_derive", @@ -3224,8 +3265,23 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86da3096d1304f5f28476ce383005385459afeaf0eea08592b65ddbc9b258d16" dependencies = [ - "alloy-primitives", - "ethereum_serde_utils", + "alloy-primitives 0.8.25", + "ethereum_serde_utils 0.7.0", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca8ba45b63c389c6e115b095ca16381534fdcc03cf58176a3f8554db2dbe19b" +dependencies = [ + "alloy-primitives 1.0.0", + "ethereum_serde_utils 0.8.0", "itertools 0.13.0", "serde", "serde_derive", @@ -3245,6 +3301,18 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd55d08012b4e0dfcc92b8d6081234df65f2986ad34cc76eeed69c5e2ce7506" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -3256,7 +3324,7 @@ name = "example-beacon-api-sidecar-fetcher" version = "0.1.0" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-beacon", "clap", "eyre", @@ -3287,7 +3355,7 @@ dependencies = [ name = "example-bsc-p2p" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types", "bytes", @@ -3335,7 +3403,7 @@ name = "example-custom-dev-node" version = "0.0.0" dependencies = [ "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "futures-util", "reth", @@ -3350,7 +3418,7 @@ version = "0.0.0" dependencies = [ "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types", "eyre", "reth", @@ -3372,7 +3440,7 @@ version = "0.0.0" dependencies = [ "alloy-evm", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "reth", "reth-ethereum", @@ -3387,7 +3455,7 @@ version = "0.0.0" dependencies = [ "alloy-eips", "alloy-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "clap", "futures-util", @@ -3404,7 +3472,7 @@ dependencies = [ "alloy-evm", "alloy-genesis", "alloy-op-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-engine", "async-trait", @@ -3458,10 +3526,9 @@ dependencies = [ name = "example-custom-rlpx-subprotocol" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "futures", - "rand 0.8.5", "reth", "reth-ethereum", "tokio", @@ -3473,7 +3540,7 @@ dependencies = [ name = "example-db-access" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "reth-ethereum", ] @@ -3576,7 +3643,7 @@ version = "0.0.0" dependencies = [ "alloy-evm", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "parking_lot", "reth", @@ -3602,7 +3669,7 @@ dependencies = [ name = "example-txpool-tracing" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-trace", "clap", "futures-util", @@ -5462,7 +5529,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc8342aaf4a3c2a1b2612bdf5cd1aa423918e0f1a0d9242aaeefbffd49457cad" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.25", "async-sse", "bytes", "futures-util", @@ -5836,14 +5903,14 @@ checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" [[package]] name = "op-alloy-consensus" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917f7a65b83e8f9cf06d5209161babf39f5e5768e226a08ad42c033386248a66" +checksum = "1a09198717ebb22b201442c12a306a62de4a5d9535993b975c6bc0e5a919e2b1" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-eth", "alloy-serde", @@ -5856,19 +5923,19 @@ dependencies = [ [[package]] name = "op-alloy-flz" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11de45c4437943b8100b0a381a5d7b50e320d6f02e7aeab841a9f45448f34366" +checksum = "4ef71f23a8caf6f2a2d5cafbdc44956d44e6014dcb9aa58abf7e4e6481c6ec34" [[package]] name = "op-alloy-network" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0bc77b1c554b40077e3a4625540a691a45a389266ff53f41acca7fdd8555b9" +checksum = "a244918cb04caafab5d53f1d78ec684295cac83e1966b4ae874220d7f070d6fe" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-signer", "op-alloy-consensus", @@ -5877,24 +5944,24 @@ dependencies = [ [[package]] name = "op-alloy-rpc-jsonrpsee" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f063674bbdae020ed568b4559bccf76c3f17421bf63ebab53bc049dd5cb059c3" +checksum = "9de601488af140dc7c981480284211262f15eb2f34a36c9d2540bc042dd26dcd" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "jsonrpsee", ] [[package]] name = "op-alloy-rpc-types" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c087949da266a53e4c24d841a68590126ecfd3631b2fe74dbcd6da45702983" +checksum = "f410c4bd213df7c4963828b45a1e201d119b5c223d12468ad8e393e655167eee" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-serde", "derive_more 2.0.1", @@ -5905,18 +5972,18 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6c57a07a8f7da6169a247c4af7cf6bb69fec3789dd41b7dcb6742fce01a232e" +checksum = "b8ec35c34f8b74f329b0a43ab462c65943cf894406126b613e65e0e4313eaadb" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "alloy-serde", "arbitrary", "derive_more 2.0.1", - "ethereum_ssz", + "ethereum_ssz 0.9.0", "op-alloy-consensus", "serde", "snap", @@ -5943,9 +6010,9 @@ dependencies = [ [[package]] name = "op-revm" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e981d234dcfd3a3de7480e5a5cf7439071af39d15b7d258188cc4c69b9d1f26e" +checksum = "ac40ce865561819210df49a6d191c452155d71d9908b4aab7ba155fff68d2ab2" dependencies = [ "auto_impl", "once_cell", @@ -6582,6 +6649,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", + "serde", "zerocopy 0.8.24", ] @@ -6640,6 +6708,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom 0.3.2", + "serde", ] [[package]] @@ -6867,7 +6936,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types", "aquamarine", @@ -6940,7 +7009,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "futures-core", "futures-util", "metrics", @@ -6963,7 +7032,7 @@ version = "1.3.8" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-provider", "alloy-pubsub", "alloy-rpc-client", @@ -7001,14 +7070,14 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-signer", "alloy-signer-local", "derive_more 2.0.1", "metrics", "parking_lot", "pin-project", - "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-errors", "reth-ethereum-primitives", @@ -7034,7 +7103,7 @@ dependencies = [ "alloy-eips", "alloy-evm", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-trie", "auto_impl", @@ -7065,7 +7134,7 @@ dependencies = [ "ahash", "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "backon", @@ -7140,11 +7209,12 @@ name = "reth-cli-util" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "cfg-if", "eyre", "libc", "rand 0.8.5", + "rand 0.9.0", "reth-fs-util", "secp256k1", "serde", @@ -7161,7 +7231,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-trie", "arbitrary", "bytes", @@ -7193,7 +7263,7 @@ dependencies = [ name = "reth-config" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "humantime-serde", "reth-network-peers", @@ -7210,7 +7280,7 @@ name = "reth-consensus" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "auto_impl", "reth-execution-types", "reth-primitives-traits", @@ -7223,8 +7293,8 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", - "rand 0.8.5", + "alloy-primitives 1.0.0", + "rand 0.9.0", "reth-chainspec", "reth-consensus", "reth-ethereum-primitives", @@ -7237,7 +7307,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-provider", "alloy-rpc-types-engine", "auto_impl", @@ -7258,7 +7328,7 @@ name = "reth-db" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "assert_matches", "codspeed-criterion-compat", @@ -7292,7 +7362,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "bytes", "derive_more 2.0.1", @@ -7301,7 +7371,7 @@ dependencies = [ "parity-scale-codec", "proptest", "proptest-arbitrary-interop", - "rand 0.8.5", + "rand 0.9.0", "reth-codecs", "reth-db-models", "reth-ethereum-primitives", @@ -7322,7 +7392,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "boyer-moore-magiclen", "eyre", "reth-chainspec", @@ -7350,7 +7420,7 @@ name = "reth-db-models" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "bytes", "modular-bitfield", @@ -7366,7 +7436,7 @@ dependencies = [ name = "reth-discv4" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "assert_matches", "discv5", @@ -7393,7 +7463,7 @@ dependencies = [ name = "reth-discv5" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "derive_more 2.0.1", "discv5", @@ -7402,6 +7472,7 @@ dependencies = [ "itertools 0.14.0", "metrics", "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-ethereum-forks", "reth-metrics", @@ -7418,14 +7489,14 @@ name = "reth-dns-discovery" version = "1.3.8" dependencies = [ "alloy-chains", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "data-encoding", "enr", "hickory-resolver", "linked_hash_set", "parking_lot", - "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-ethereum-forks", "reth-network-peers", @@ -7447,7 +7518,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "assert_matches", "futures", @@ -7455,7 +7526,7 @@ dependencies = [ "itertools 0.14.0", "metrics", "pin-project", - "rand 0.8.5", + "rand 0.9.0", "rayon", "reth-chainspec", "reth-config", @@ -7487,7 +7558,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-signer", @@ -7531,7 +7602,7 @@ name = "reth-ecies" version = "1.3.8" dependencies = [ "aes", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "block-padding", "byteorder", @@ -7561,7 +7632,7 @@ name = "reth-engine-local" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "eyre", "futures-util", @@ -7591,7 +7662,7 @@ name = "reth-engine-primitives" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "auto_impl", "futures", @@ -7646,7 +7717,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-engine", "assert_matches", @@ -7660,6 +7731,7 @@ dependencies = [ "parking_lot", "proptest", "rand 0.8.5", + "rand 0.9.0", "rayon", "reth-chain-state", "reth-chainspec", @@ -7735,10 +7807,10 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", - "ethereum_ssz", - "ethereum_ssz_derive", + "ethereum_ssz 0.8.3", + "ethereum_ssz_derive 0.8.3", "snap", "tempfile", "thiserror 2.0.12", @@ -7762,7 +7834,7 @@ dependencies = [ "alloy-chains", "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "async-stream", @@ -7773,6 +7845,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "rand 0.8.5", + "rand 0.9.0", "reth-codecs", "reth-ecies", "reth-eth-wire-types", @@ -7801,14 +7874,14 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-hardforks", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "bytes", "derive_more 2.0.1", "proptest", "proptest-arbitrary-interop", - "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-codecs-derive", "reth-ethereum-primitives", @@ -7868,7 +7941,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "reth-chainspec", "reth-consensus", "reth-consensus-common", @@ -7883,7 +7956,7 @@ name = "reth-ethereum-engine-primitives" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-engine", "reth-engine-primitives", @@ -7901,7 +7974,7 @@ version = "1.3.8" dependencies = [ "alloy-eip2124", "alloy-hardforks", - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "auto_impl", "once_cell", @@ -7914,7 +7987,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "reth-basic-payload-builder", "reth-chainspec", @@ -7942,7 +8015,7 @@ dependencies = [ "alloy-eips", "alloy-evm", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-eth", "arbitrary", @@ -7952,6 +8025,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "rand 0.8.5", + "rand 0.9.0", "reth-codecs", "reth-primitives-traits", "reth-testing-utils", @@ -7967,7 +8041,7 @@ dependencies = [ name = "reth-etl" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "rayon", "reth-db-api", "tempfile", @@ -7980,7 +8054,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "auto_impl", "derive_more 2.0.1", "futures-util", @@ -8008,7 +8082,7 @@ dependencies = [ "alloy-eips", "alloy-evm", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "reth-chainspec", "reth-ethereum-forks", "reth-ethereum-primitives", @@ -8025,7 +8099,7 @@ name = "reth-execution-errors" version = "1.3.8" dependencies = [ "alloy-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "nybbles", "reth-storage-errors", @@ -8039,11 +8113,11 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "bincode", "derive_more 2.0.1", - "rand 0.8.5", + "rand 0.9.0", "reth-ethereum-primitives", "reth-primitives-traits", "reth-trie-common", @@ -8059,13 +8133,13 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "futures", "itertools 0.14.0", "metrics", "parking_lot", - "rand 0.8.5", + "rand 0.9.0", "reth-chain-state", "reth-chainspec", "reth-config", @@ -8103,7 +8177,6 @@ dependencies = [ "alloy-eips", "eyre", "futures-util", - "rand 0.8.5", "reth-chainspec", "reth-config", "reth-consensus", @@ -8134,10 +8207,10 @@ name = "reth-exex-types" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "bincode", - "rand 0.8.5", + "rand 0.9.0", "reth-chain-state", "reth-ethereum-primitives", "reth-execution-types", @@ -8160,7 +8233,7 @@ name = "reth-invalid-block-hooks" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-debug", "eyre", @@ -8191,7 +8264,7 @@ dependencies = [ "interprocess", "jsonrpsee", "pin-project", - "rand 0.8.5", + "rand 0.9.0", "reth-tracing", "serde_json", "thiserror 2.0.12", @@ -8213,7 +8286,7 @@ dependencies = [ "derive_more 2.0.1", "indexmap 2.8.0", "parking_lot", - "rand 0.8.5", + "rand 0.9.0", "reth-mdbx-sys", "smallvec", "tempfile", @@ -8244,7 +8317,7 @@ dependencies = [ name = "reth-net-banlist" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", ] [[package]] @@ -8268,7 +8341,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-node-bindings", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-provider", "alloy-rlp", "aquamarine", @@ -8283,6 +8356,7 @@ dependencies = [ "parking_lot", "pin-project", "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-consensus", "reth-discv4", @@ -8327,7 +8401,7 @@ dependencies = [ name = "reth-network-api" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-admin", "auto_impl", "derive_more 2.0.1", @@ -8351,7 +8425,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "auto_impl", "derive_more 2.0.1", "futures", @@ -8371,10 +8445,11 @@ dependencies = [ name = "reth-network-peers" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "enr", "rand 0.8.5", + "rand 0.9.0", "secp256k1", "serde_json", "serde_with", @@ -8405,7 +8480,7 @@ dependencies = [ "derive_more 2.0.1", "lz4_flex", "memmap2", - "rand 0.8.5", + "rand 0.9.0", "reth-fs-util", "serde", "tempfile", @@ -8443,7 +8518,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types", "alloy-rpc-types-engine", "aquamarine", @@ -8506,7 +8581,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "clap", "derive_more 2.0.1", @@ -8515,7 +8590,7 @@ dependencies = [ "futures", "humantime", "proptest", - "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-cli-util", "reth-config", @@ -8558,7 +8633,7 @@ dependencies = [ "alloy-contract", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-provider", "alloy-rpc-types-beacon", "alloy-rpc-types-engine", @@ -8567,7 +8642,7 @@ dependencies = [ "alloy-sol-types", "eyre", "futures", - "rand 0.8.5", + "rand 0.9.0", "reth-chainspec", "reth-consensus", "reth-db", @@ -8609,7 +8684,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "derive_more 2.0.1", "futures", @@ -8715,7 +8790,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-hardforks", - "alloy-primitives", + "alloy-primitives 1.0.0", "derive_more 2.0.1", "op-alloy-rpc-types", "reth-chainspec", @@ -8733,7 +8808,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "clap", "derive_more 2.0.1", @@ -8782,7 +8857,7 @@ dependencies = [ "alloy-chains", "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-trie", "op-alloy-consensus", "reth-chainspec", @@ -8815,7 +8890,7 @@ dependencies = [ "alloy-evm", "alloy-genesis", "alloy-op-evm", - "alloy-primitives", + "alloy-primitives 1.0.0", "op-alloy-consensus", "op-revm", "reth-chainspec", @@ -8837,7 +8912,7 @@ name = "reth-optimism-forks" version = "1.3.8" dependencies = [ "alloy-op-hardforks", - "alloy-primitives", + "alloy-primitives 1.0.0", "once_cell", "reth-ethereum-forks", ] @@ -8850,7 +8925,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "clap", @@ -8906,7 +8981,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-debug", "alloy-rpc-types-engine", @@ -8945,7 +9020,7 @@ dependencies = [ "alloy-eips", "alloy-evm", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-eth", "alloy-serde", @@ -8959,6 +9034,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "rand 0.8.5", + "rand 0.9.0", "reth-codecs", "reth-primitives-traits", "reth-zstd-compressors", @@ -8977,7 +9053,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-client", "alloy-rpc-types-debug", "alloy-rpc-types-engine", @@ -9031,7 +9107,7 @@ name = "reth-optimism-storage" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "reth-chainspec", "reth-codecs", "reth-db-api", @@ -9050,7 +9126,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-client", "alloy-rpc-types-eth", "alloy-serde", @@ -9084,7 +9160,7 @@ name = "reth-payload-builder" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types", "futures-util", "metrics", @@ -9115,7 +9191,7 @@ name = "reth-payload-primitives" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "assert_matches", "auto_impl", @@ -9134,7 +9210,7 @@ name = "reth-payload-util" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "reth-transaction-pool", ] @@ -9154,7 +9230,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "c-kzg", @@ -9176,7 +9252,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-trie", "arbitrary", @@ -9192,6 +9268,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "rand 0.8.5", + "rand 0.9.0", "rayon", "reth-chainspec", "reth-codecs", @@ -9212,7 +9289,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "assert_matches", "auto_impl", @@ -9222,7 +9299,7 @@ dependencies = [ "metrics", "notify", "parking_lot", - "rand 0.8.5", + "rand 0.9.0", "rayon", "reth-chain-state", "reth-chainspec", @@ -9263,7 +9340,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "assert_matches", "itertools 0.14.0", "metrics", @@ -9293,7 +9370,7 @@ dependencies = [ name = "reth-prune-types" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "assert_matches", "derive_more 2.0.1", @@ -9313,7 +9390,7 @@ name = "reth-ress-protocol" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "futures", @@ -9339,7 +9416,7 @@ name = "reth-ress-provider" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "eyre", "futures", "parking_lot", @@ -9364,7 +9441,7 @@ name = "reth-revm" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "reth-ethereum-forks", "reth-primitives-traits", "reth-storage-api", @@ -9383,7 +9460,7 @@ dependencies = [ "alloy-evm", "alloy-genesis", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types", "alloy-rpc-types-admin", @@ -9408,7 +9485,7 @@ dependencies = [ "jsonwebtoken", "parking_lot", "pin-project", - "rand 0.8.5", + "rand 0.9.0", "reth-chain-state", "reth-chainspec", "reth-consensus", @@ -9456,7 +9533,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types", "alloy-rpc-types-admin", "alloy-rpc-types-anvil", @@ -9479,7 +9556,7 @@ name = "reth-rpc-api-testing-util" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "futures", @@ -9499,7 +9576,7 @@ version = "1.3.8" dependencies = [ "alloy-eips", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-provider", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -9551,7 +9628,7 @@ name = "reth-rpc-engine-api" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-engine", "assert_matches", @@ -9592,7 +9669,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-eth", "alloy-rpc-types-mev", @@ -9631,7 +9708,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-sol-types", "derive_more 2.0.1", @@ -9640,7 +9717,7 @@ dependencies = [ "jsonrpsee-core", "jsonrpsee-types", "metrics", - "rand 0.8.5", + "rand 0.9.0", "reth-chain-state", "reth-chainspec", "reth-errors", @@ -9689,7 +9766,7 @@ name = "reth-rpc-server-types" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "jsonrpsee-core", "jsonrpsee-types", @@ -9704,7 +9781,7 @@ name = "reth-rpc-types-compat" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "jsonrpsee-types", "reth-primitives-traits", @@ -9717,7 +9794,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "assert_matches", "bincode", @@ -9727,7 +9804,7 @@ dependencies = [ "itertools 0.14.0", "num-traits", "paste", - "rand 0.8.5", + "rand 0.9.0", "rayon", "reqwest", "reth-chainspec", @@ -9773,7 +9850,7 @@ name = "reth-stages-api" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "aquamarine", "assert_matches", "auto_impl", @@ -9801,13 +9878,13 @@ dependencies = [ name = "reth-stages-types" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "arbitrary", "bytes", "modular-bitfield", "proptest", "proptest-arbitrary-interop", - "rand 0.8.5", + "rand 0.9.0", "reth-codecs", "reth-trie-common", "serde", @@ -9818,7 +9895,7 @@ dependencies = [ name = "reth-static-file" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "assert_matches", "parking_lot", "rayon", @@ -9842,7 +9919,7 @@ dependencies = [ name = "reth-static-file-types" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "clap", "derive_more 2.0.1", "reth-nippy-jar", @@ -9856,7 +9933,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-engine", "auto_impl", "reth-chainspec", @@ -9878,7 +9955,7 @@ name = "reth-storage-errors" version = "1.3.8" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "derive_more 2.0.1", "reth-primitives-traits", @@ -9912,8 +9989,9 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "rand 0.8.5", + "rand 0.9.0", "reth-primitives", "reth-primitives-traits", "secp256k1", @@ -9948,7 +10026,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "aquamarine", "assert_matches", @@ -9961,7 +10039,7 @@ dependencies = [ "paste", "proptest", "proptest-arbitrary-interop", - "rand 0.8.5", + "rand 0.9.0", "reth-chain-state", "reth-chainspec", "reth-eth-wire-types", @@ -9994,7 +10072,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-trie", "auto_impl", @@ -10026,7 +10104,7 @@ version = "1.3.8" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "alloy-rpc-types-eth", "alloy-serde", @@ -10057,7 +10135,7 @@ name = "reth-trie-db" version = "1.3.8" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "proptest", "proptest-arbitrary-interop", @@ -10082,7 +10160,7 @@ dependencies = [ name = "reth-trie-parallel" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "codspeed-criterion-compat", "derive_more 2.0.1", @@ -10090,7 +10168,7 @@ dependencies = [ "metrics", "proptest", "proptest-arbitrary-interop", - "rand 0.8.5", + "rand 0.9.0", "rayon", "reth-db-api", "reth-execution-errors", @@ -10111,7 +10189,7 @@ dependencies = [ name = "reth-trie-sparse" version = "1.3.8" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rlp", "arbitrary", "assert_matches", @@ -10123,6 +10201,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "rand 0.8.5", + "rand 0.9.0", "reth-execution-errors", "reth-metrics", "reth-primitives-traits", @@ -10145,9 +10224,9 @@ dependencies = [ [[package]] name = "revm" -version = "21.0.0" +version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db41167e2a1fddb734984cc26e4bf0a0cb298829d1c488b4de37bda764e1d47" +checksum = "85eb66316c261a8ffd266e3c295991d703e810b29b57006dfea08481e81e2f56" dependencies = [ "revm-bytecode", "revm-context", @@ -10164,9 +10243,9 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc3ae92c0c071f4a5ac3ef398fed50bacf8ebd5495d2afded34c60874afa7a3" +checksum = "e63e138d520c5c5bc25ecc82506e9e4e6e85a811809fc5251c594378dccabfc6" dependencies = [ "bitvec", "phf", @@ -10176,9 +10255,9 @@ dependencies = [ [[package]] name = "revm-context" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5fd5d8a35cf33d2494e32a966ebee6bc23dea9b1fbc3477c5b58e42ddceaa5b" +checksum = "7836a0adfcb1a64427ddd314f9cb8703fbdda36348b73df86eb28977aaff1acc" dependencies = [ "cfg-if", "derive-where", @@ -10192,9 +10271,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8253163a7868c86b88dc76a193724b8c6252bf260dc1cf11d814a5f4fa7a804" +checksum = "82d74335aa1f14222cc4d3be1f62a029cc7dc03819cc8d080ff17b7e1d76375f" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -10207,12 +10286,11 @@ dependencies = [ [[package]] name = "revm-database" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb40baf1ec91bfda68a37a9be72c5d089e2b662532689209cb2e0febe1eb64c" +checksum = "2e5c80c5a2fd605f2119ee32a63fb3be941fb6a81ced8cdb3397abca28317224" dependencies = [ "alloy-eips", - "auto_impl", "revm-bytecode", "revm-database-interface", "revm-primitives", @@ -10222,9 +10300,9 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c541612673da04df1ab3a6a56127851e93a5d05539eb915a6c541d24e7c5902" +checksum = "a0e4dfbc734b1ea67b5e8f8b3c7dc4283e2210d978cdaf6c7a45e97be5ea53b3" dependencies = [ "auto_impl", "revm-primitives", @@ -10234,9 +10312,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55164c03c05eace53cf7f64df5dff14c7769956e6f2b9e4acb88301dc7537c" +checksum = "4354eacb23dda95569e9d74e25066c0ed7889683f6ff49149b5319bcb856745a" dependencies = [ "auto_impl", "revm-bytecode", @@ -10252,9 +10330,9 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f67d36e1abebe20b891b7ef57de3af2addfbc2d9cd4ea3f49ade8a67d0e79d" +checksum = "babc07c45ff2dcb62fc54d7b69cd60cf209896319905e7653c6bdbcb5152f695" dependencies = [ "auto_impl", "revm-context", @@ -10269,11 +10347,11 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee7d2bed492744ec778066909fd5da0e144ddab5e36555a78187db2378bdef8" +checksum = "4af7323cc83064900505770032be483b314f08cfd05d3c625d32d6b94f4f197b" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "alloy-sol-types", @@ -10289,9 +10367,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd45ea4fdee2c3f430df4ddb4936dc85c49dc5a7ce9838a8b9ad6861ab153c6" +checksum = "feb20260342003cfb791536e678ef5bbea1bfd1f8178b170e8885ff821985473" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -10301,9 +10379,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac48995560dd5ea15e3788106bdf8893186d945bd40d674fb63aa351cf2e58fa" +checksum = "418e95eba68c9806c74f3e36cd5d2259170b61e90ac608b17ff8c435038ddace" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -10326,20 +10404,20 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9b235b3c03299a531717ae4f9ee6bdb4c1a1755c9f8ce751298d1c99d95fc3" +checksum = "1fc2283ff87358ec7501956c5dd8724a6c2be959c619c4861395ae5e0054575f" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "enumn", "serde", ] [[package]] name = "revm-state" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfdff0435bd0cb9e1f9dcc44eaea581973b0550cb897ce368d43259922b1c241" +checksum = "09dd121f6e66d75ab111fb51b4712f129511569bc3e41e6067ae760861418bd8" dependencies = [ "bitflags 2.9.0", "revm-bytecode", @@ -10484,9 +10562,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825df406ec217a8116bd7b06897c6cc8f65ffefc15d030ae2c9540acc9ed50b6" +checksum = "78a46eb779843b2c4f21fac5773e25d6d5b7c8f0922876c91541790d2ca27eef" dependencies = [ "alloy-rlp", "arbitrary", @@ -10502,6 +10580,7 @@ dependencies = [ "primitive-types", "proptest", "rand 0.8.5", + "rand 0.9.0", "rlp", "ruint-macro", "serde", @@ -11347,9 +11426,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.25" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4560533fbd6914b94a8fb5cc803ed6801c3455668db3b810702c57612bac9412" +checksum = "34c9c96de1f835488c1501092847b522be88c9ac6fb0d4c0fbea92992324c8f4" dependencies = [ "paste", "proc-macro2", @@ -11991,22 +12070,22 @@ dependencies = [ [[package]] name = "tree_hash" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c58eb0f518840670270d90d97ffee702d8662d9c5494870c9e1e9e0fa00f668" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" dependencies = [ - "alloy-primitives", + "alloy-primitives 1.0.0", "ethereum_hashing", - "ethereum_ssz", + "ethereum_ssz 0.9.0", "smallvec", "typenum", ] [[package]] name = "tree_hash_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699e7fb6b3fdfe0c809916f251cf5132d64966858601695c3736630a87e7166a" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" dependencies = [ "darling", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 59fdf624758..9a2b7073d7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -438,69 +438,70 @@ reth-ress-protocol = { path = "crates/ress/protocol" } reth-ress-provider = { path = "crates/ress/provider" } # revm -revm = { version = "21.0.0", default-features = false } -revm-bytecode = { version = "2.0.0", default-features = false } -revm-database = { version = "2.0.0", default-features = false } -revm-state = { version = "2.0.0", default-features = false } -revm-primitives = { version = "17.0.0", default-features = false } -revm-interpreter = { version = "17.0.0", default-features = false } -revm-inspector = { version = "2.0.0", default-features = false } -revm-context = { version = "2.0.0", default-features = false } -revm-context-interface = { version = "2.0.0", default-features = false } -revm-database-interface = { version = "2.0.0", default-features = false } -op-revm = { version = "2.0.0", default-features = false } -revm-inspectors = "0.18.0" +revm = { version = "22.0.0", default-features = false } +revm-bytecode = { version = "3.0.0", default-features = false } +revm-database = { version = "3.0.0", default-features = false } +revm-state = { version = "3.0.0", default-features = false } +revm-primitives = { version = "18.0.0", default-features = false } +revm-interpreter = { version = "18.0.0", default-features = false } +revm-inspector = { version = "3.0.0", default-features = false } +revm-context = { version = "3.0.0", default-features = false } +revm-context-interface = { version = "3.0.0", default-features = false } +revm-database-interface = { version = "3.0.0", default-features = false } +op-revm = { version = "3.0.0", default-features = false } +revm-inspectors = "0.19.0" # eth -alloy-chains = { version = "0.1.68", default-features = false } -alloy-dyn-abi = "0.8.25" -alloy-eip2124 = { version = "0.1.0", default-features = false } -alloy-evm = { version = "0.3.2", default-features = false } -alloy-primitives = { version = "0.8.25", default-features = false, features = ["map-foldhash"] } +alloy-chains = { version = "0.2.0", default-features = false } +alloy-dyn-abi = "1.0.0" +alloy-eip2124 = { version = "0.2.0", default-features = false } +alloy-evm = { version = "0.4.0", default-features = false } +alloy-primitives = { version = "1.0.0", default-features = false, features = ["map-foldhash"] } alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] } -alloy-sol-types = { version = "0.8.25", default-features = false } -alloy-trie = { version = "0.7.9", default-features = false } - -alloy-hardforks = "0.1.4" - -alloy-consensus = { version = "0.13.0", default-features = false } -alloy-contract = { version = "0.13.0", default-features = false } -alloy-eips = { version = "0.13.0", default-features = false } -alloy-genesis = { version = "0.13.0", default-features = false } -alloy-json-rpc = { version = "0.13.0", default-features = false } -alloy-network = { version = "0.13.0", default-features = false } -alloy-network-primitives = { version = "0.13.0", default-features = false } -alloy-node-bindings = { version = "0.13.0", default-features = false } -alloy-provider = { version = "0.13.0", features = ["reqwest"], default-features = false } -alloy-pubsub = { version = "0.13.0", default-features = false } -alloy-rpc-client = { version = "0.13.0", default-features = false } -alloy-rpc-types = { version = "0.13.0", features = ["eth"], default-features = false } -alloy-rpc-types-admin = { version = "0.13.0", default-features = false } -alloy-rpc-types-anvil = { version = "0.13.0", default-features = false } -alloy-rpc-types-beacon = { version = "0.13.0", default-features = false } -alloy-rpc-types-debug = { version = "0.13.0", default-features = false } -alloy-rpc-types-engine = { version = "0.13.0", default-features = false } -alloy-rpc-types-eth = { version = "0.13.0", default-features = false } -alloy-rpc-types-mev = { version = "0.13.0", default-features = false } -alloy-rpc-types-trace = { version = "0.13.0", default-features = false } -alloy-rpc-types-txpool = { version = "0.13.0", default-features = false } -alloy-serde = { version = "0.13.0", default-features = false } -alloy-signer = { version = "0.13.0", default-features = false } -alloy-signer-local = { version = "0.13.0", default-features = false } -alloy-transport = { version = "0.13.0" } -alloy-transport-http = { version = "0.13.0", features = ["reqwest-rustls-tls"], default-features = false } -alloy-transport-ipc = { version = "0.13.0", default-features = false } -alloy-transport-ws = { version = "0.13.0", default-features = false } +alloy-sol-macro = "1.0.0" +alloy-sol-types = { version = "1.0.0", default-features = false } +alloy-trie = { version = "0.8.0", default-features = false } + +alloy-hardforks = "0.2.0" + +alloy-consensus = { version = "0.14.0", default-features = false } +alloy-contract = { version = "0.14.0", default-features = false } +alloy-eips = { version = "0.14.0", default-features = false } +alloy-genesis = { version = "0.14.0", default-features = false } +alloy-json-rpc = { version = "0.14.0", default-features = false } +alloy-network = { version = "0.14.0", default-features = false } +alloy-network-primitives = { version = "0.14.0", default-features = false } +alloy-node-bindings = { version = "0.14.0", default-features = false } +alloy-provider = { version = "0.14.0", features = ["reqwest"], default-features = false } +alloy-pubsub = { version = "0.14.0", default-features = false } +alloy-rpc-client = { version = "0.14.0", default-features = false } +alloy-rpc-types = { version = "0.14.0", features = ["eth"], default-features = false } +alloy-rpc-types-admin = { version = "0.14.0", default-features = false } +alloy-rpc-types-anvil = { version = "0.14.0", default-features = false } +alloy-rpc-types-beacon = { version = "0.14.0", default-features = false } +alloy-rpc-types-debug = { version = "0.14.0", default-features = false } +alloy-rpc-types-engine = { version = "0.14.0", default-features = false } +alloy-rpc-types-eth = { version = "0.14.0", default-features = false } +alloy-rpc-types-mev = { version = "0.14.0", default-features = false } +alloy-rpc-types-trace = { version = "0.14.0", default-features = false } +alloy-rpc-types-txpool = { version = "0.14.0", default-features = false } +alloy-serde = { version = "0.14.0", default-features = false } +alloy-signer = { version = "0.14.0", default-features = false } +alloy-signer-local = { version = "0.14.0", default-features = false } +alloy-transport = { version = "0.14.0" } +alloy-transport-http = { version = "0.14.0", features = ["reqwest-rustls-tls"], default-features = false } +alloy-transport-ipc = { version = "0.14.0", default-features = false } +alloy-transport-ws = { version = "0.14.0", default-features = false } # op -alloy-op-evm = { version = "0.3.2", default-features = false } -alloy-op-hardforks = "0.1.2" -op-alloy-rpc-types = { version = "0.12.2", default-features = false } -op-alloy-rpc-types-engine = { version = "0.12.2", default-features = false } -op-alloy-network = { version = "0.12.2", default-features = false } -op-alloy-consensus = { version = "0.12.2", default-features = false } -op-alloy-rpc-jsonrpsee = { version = "0.12.2", default-features = false } -op-alloy-flz = { version = "0.12.0", default-features = false } +alloy-op-evm = { version = "0.4.0", default-features = false } +alloy-op-hardforks = "0.2.0" +op-alloy-rpc-types = { version = "0.13.0", default-features = false } +op-alloy-rpc-types-engine = { version = "0.13.0", default-features = false } +op-alloy-network = { version = "0.13.0", default-features = false } +op-alloy-consensus = { version = "0.13.0", default-features = false } +op-alloy-rpc-jsonrpsee = { version = "0.13.0", default-features = false } +op-alloy-flz = { version = "0.13.0", default-features = false } # misc aquamarine = "0.6" @@ -530,7 +531,7 @@ nybbles = { version = "0.3.0", default-features = false } once_cell = { version = "1.19", default-features = false, features = ["critical-section"] } parking_lot = "0.12" paste = "1.0" -rand = "0.8.5" +rand = "0.9" rayon = "1.7" rustc-hash = { version = "2.0", default-features = false } schnellru = "0.2" @@ -603,6 +604,8 @@ proptest-arbitrary-interop = "0.1.0" enr = { version = "0.13", default-features = false } k256 = { version = "0.13", default-features = false, features = ["ecdsa"] } secp256k1 = { version = "0.30", default-features = false, features = ["global-context", "recovery"] } +# rand 8 for secp256k1 +rand_08 = { package = "rand", version = "0.8" } # for eip-4844 c-kzg = "2.1.0" @@ -639,7 +642,6 @@ snmalloc-rs = { version = "0.3.7", features = ["build_cc"] } crunchy = "=0.2.2" aes = "0.8.1" ahash = "0.8" -alloy-sol-macro = "0.8.9" anyhow = "1.0" bindgen = { version = "0.70", default-features = false } block-padding = "0.3.2" diff --git a/crates/chain-state/src/in_memory.rs b/crates/chain-state/src/in_memory.rs index 6be4450c806..6099488b244 100644 --- a/crates/chain-state/src/in_memory.rs +++ b/crates/chain-state/src/in_memory.rs @@ -1114,7 +1114,7 @@ mod tests { #[test] fn test_in_memory_state_impl_state_by_hash() { let mut state_by_hash = HashMap::default(); - let number = rand::thread_rng().gen::(); + let number = rand::rng().random::(); let mut test_block_builder: TestBlockBuilder = TestBlockBuilder::default(); let state = Arc::new(create_mock_state(&mut test_block_builder, number, B256::random())); state_by_hash.insert(state.hash(), state.clone()); @@ -1130,7 +1130,7 @@ mod tests { let mut state_by_hash = HashMap::default(); let mut hash_by_number = BTreeMap::new(); - let number = rand::thread_rng().gen::(); + let number = rand::rng().random::(); let mut test_block_builder: TestBlockBuilder = TestBlockBuilder::default(); let state = Arc::new(create_mock_state(&mut test_block_builder, number, B256::random())); let hash = state.hash(); @@ -1167,7 +1167,7 @@ mod tests { #[test] fn test_in_memory_state_impl_pending_state() { - let pending_number = rand::thread_rng().gen::(); + let pending_number = rand::rng().random::(); let mut test_block_builder: TestBlockBuilder = TestBlockBuilder::default(); let pending_state = create_mock_state(&mut test_block_builder, pending_number, B256::random()); @@ -1193,7 +1193,7 @@ mod tests { #[test] fn test_state() { - let number = rand::thread_rng().gen::(); + let number = rand::rng().random::(); let mut test_block_builder: TestBlockBuilder = TestBlockBuilder::default(); let block = test_block_builder.get_executed_block_with_number(number, B256::random()); diff --git a/crates/chain-state/src/test_utils.rs b/crates/chain-state/src/test_utils.rs index b7f5675bdbb..ae0455b9c23 100644 --- a/crates/chain-state/src/test_utils.rs +++ b/crates/chain-state/src/test_utils.rs @@ -13,7 +13,7 @@ use alloy_primitives::{Address, BlockNumber, B256, U256}; use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; use core::marker::PhantomData; -use rand::{thread_rng, Rng}; +use rand::Rng; use reth_chainspec::{ChainSpec, EthereumHardfork, MIN_TRANSACTION_GAS}; use reth_ethereum_primitives::{ Block, BlockBody, EthPrimitives, Receipt, Transaction, TransactionSigned, @@ -96,7 +96,7 @@ impl TestBlockBuilder { number: BlockNumber, parent_hash: B256, ) -> RecoveredBlock { - let mut rng = thread_rng(); + let mut rng = rand::rng(); let mock_tx = |nonce: u64| -> Recovered<_> { let tx = Transaction::Eip1559(TxEip1559 { @@ -114,7 +114,7 @@ impl TestBlockBuilder { TransactionSigned::new_unhashed(tx, signature).with_signer(self.signer) }; - let num_txs = rng.gen_range(0..5); + let num_txs = rng.random_range(0..5); let signer_balance_decrease = Self::single_tx_cost() * U256::from(num_txs); let transactions: Vec> = (0..num_txs) .map(|_| { @@ -232,7 +232,7 @@ impl TestBlockBuilder { receipts: Vec>, parent_hash: B256, ) -> ExecutedBlockWithTrieUpdates { - let number = rand::thread_rng().gen::(); + let number = rand::rng().random::(); self.get_executed_block(number, receipts, parent_hash) } diff --git a/crates/cli/commands/src/test_vectors/compact.rs b/crates/cli/commands/src/test_vectors/compact.rs index 0002361050b..d5c6ef5c411 100644 --- a/crates/cli/commands/src/test_vectors/compact.rs +++ b/crates/cli/commands/src/test_vectors/compact.rs @@ -1,5 +1,5 @@ use alloy_eips::eip4895::Withdrawals; -use alloy_primitives::{hex, private::getrandom::getrandom, PrimitiveSignature, TxKind}; +use alloy_primitives::{hex, Signature, TxKind, B256}; use arbitrary::Arbitrary; use eyre::{Context, Result}; use proptest::{ @@ -128,7 +128,7 @@ compact_types!( ], // These types require an extra identifier which is usually stored elsewhere (eg. parent type). identifier: [ - PrimitiveSignature, + Signature, Transaction, TxType, TxKind @@ -147,13 +147,12 @@ pub fn read_vectors() -> Result<()> { /// Generates a vector of type `T` to a file. pub fn generate_vectors_with(gen: &[fn(&mut TestRunner) -> eyre::Result<()>]) -> Result<()> { // Prepare random seed for test (same method as used by proptest) - let mut seed = [0u8; 32]; - getrandom(&mut seed)?; + let seed = B256::random(); println!("Seed for compact test vectors: {:?}", hex::encode_prefixed(seed)); // Start the runner with the seed let config = ProptestConfig::default(); - let rng = TestRng::from_seed(config.rng_algorithm, &seed); + let rng = TestRng::from_seed(config.rng_algorithm, &seed.0); let mut runner = TestRunner::new_with_rng(config, rng); fs::create_dir_all(VECTORS_FOLDER)?; diff --git a/crates/cli/commands/src/test_vectors/tables.rs b/crates/cli/commands/src/test_vectors/tables.rs index 709780810c1..1bbd2604f97 100644 --- a/crates/cli/commands/src/test_vectors/tables.rs +++ b/crates/cli/commands/src/test_vectors/tables.rs @@ -1,5 +1,5 @@ use alloy_consensus::Header; -use alloy_primitives::{hex, private::getrandom::getrandom}; +use alloy_primitives::{hex, B256}; use arbitrary::Arbitrary; use eyre::Result; use proptest::{ @@ -23,13 +23,12 @@ const PER_TABLE: usize = 1000; /// Generates test vectors for specified `tables`. If list is empty, then generate for all tables. pub fn generate_vectors(mut tables: Vec) -> Result<()> { // Prepare random seed for test (same method as used by proptest) - let mut seed = [0u8; 32]; - getrandom(&mut seed)?; + let seed = B256::random(); println!("Seed for table test vectors: {:?}", hex::encode_prefixed(seed)); // Start the runner with the seed let config = ProptestConfig::default(); - let rng = TestRng::from_seed(config.rng_algorithm, &seed); + let rng = TestRng::from_seed(config.rng_algorithm, &seed.0); let mut runner = TestRunner::new_with_rng(config, rng); fs::create_dir_all(VECTORS_FOLDER)?; diff --git a/crates/cli/util/Cargo.toml b/crates/cli/util/Cargo.toml index b7f0f11ff21..2ae53e18065 100644 --- a/crates/cli/util/Cargo.toml +++ b/crates/cli/util/Cargo.toml @@ -21,13 +21,16 @@ alloy-eips.workspace = true # misc cfg-if.workspace = true eyre.workspace = true -rand.workspace = true secp256k1 = { workspace = true, features = ["rand"] } +rand_08.workspace = true thiserror.workspace = true serde.workspace = true tracy-client = { workspace = true, optional = true, features = ["demangle"] } +[dev-dependencies] +rand.workspace = true + [target.'cfg(unix)'.dependencies] tikv-jemallocator = { workspace = true, optional = true } snmalloc-rs = { workspace = true, optional = true } diff --git a/crates/cli/util/src/load_secret_key.rs b/crates/cli/util/src/load_secret_key.rs index 8b3bee09c8c..0ca46398f1e 100644 --- a/crates/cli/util/src/load_secret_key.rs +++ b/crates/cli/util/src/load_secret_key.rs @@ -8,7 +8,7 @@ use thiserror::Error; /// Convenience function to create a new random [`SecretKey`] pub fn rng_secret_key() -> SecretKey { - SecretKey::new(&mut rand::thread_rng()) + SecretKey::new(&mut rand_08::thread_rng()) } /// Errors returned by loading a [`SecretKey`], including IO errors. diff --git a/crates/cli/util/src/parsers.rs b/crates/cli/util/src/parsers.rs index fb27e1420c0..b4565333bd5 100644 --- a/crates/cli/util/src/parsers.rs +++ b/crates/cli/util/src/parsers.rs @@ -107,7 +107,7 @@ mod tests { #[test] fn parse_socket_address_random() { - let port: u16 = rand::thread_rng().gen(); + let port: u16 = rand::rng().random(); for value in [format!("localhost:{port}"), format!(":{port}"), port.to_string()] { let socket_addr = parse_socket_address(&value) diff --git a/crates/consensus/common/src/validation.rs b/crates/consensus/common/src/validation.rs index cac3ebaa7ee..006d5c7279f 100644 --- a/crates/consensus/common/src/validation.rs +++ b/crates/consensus/common/src/validation.rs @@ -348,14 +348,14 @@ mod tests { use super::*; use alloy_consensus::{BlockBody, Header, TxEip4844}; use alloy_eips::eip4895::Withdrawals; - use alloy_primitives::{Address, Bytes, PrimitiveSignature as Signature, U256}; + use alloy_primitives::{Address, Bytes, Signature, U256}; use rand::Rng; use reth_chainspec::ChainSpecBuilder; use reth_ethereum_primitives::{Transaction, TransactionSigned}; use reth_primitives_traits::proofs; fn mock_blob_tx(nonce: u64, num_blobs: usize) -> TransactionSigned { - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let request = Transaction::Eip4844(TxEip4844 { chain_id: 1u64, nonce, @@ -367,7 +367,9 @@ mod tests { value: U256::from(3_u64), input: Bytes::from(vec![1, 2]), access_list: Default::default(), - blob_versioned_hashes: std::iter::repeat_with(|| rng.gen()).take(num_blobs).collect(), + blob_versioned_hashes: std::iter::repeat_with(|| rng.random()) + .take(num_blobs) + .collect(), }); let signature = Signature::new(U256::default(), U256::default(), true); diff --git a/crates/engine/invalid-block-hooks/src/witness.rs b/crates/engine/invalid-block-hooks/src/witness.rs index d5911b0fe19..99c34b440d0 100644 --- a/crates/engine/invalid-block-hooks/src/witness.rs +++ b/crates/engine/invalid-block-hooks/src/witness.rs @@ -125,7 +125,8 @@ where let state = state_provider.witness(Default::default(), hashed_state.clone())?; // Write the witness to the output directory. - let response = ExecutionWitness { state, codes, keys: state_preimages }; + let response = + ExecutionWitness { state, codes, keys: state_preimages, ..Default::default() }; let re_executed_witness_path = self.save_file( format!("{}_{}.witness.re_executed.json", block.number(), block.hash()), &response, diff --git a/crates/engine/tree/Cargo.toml b/crates/engine/tree/Cargo.toml index 8fd1efb0044..47d7d8e1ee0 100644 --- a/crates/engine/tree/Cargo.toml +++ b/crates/engine/tree/Cargo.toml @@ -98,6 +98,7 @@ criterion.workspace = true crossbeam-channel.workspace = true proptest.workspace = true rand.workspace = true +rand_08.workspace = true [[bench]] name = "channel_perf" diff --git a/crates/engine/tree/benches/channel_perf.rs b/crates/engine/tree/benches/channel_perf.rs index 18de4596407..566a327ab44 100644 --- a/crates/engine/tree/benches/channel_perf.rs +++ b/crates/engine/tree/benches/channel_perf.rs @@ -5,7 +5,7 @@ use alloy_primitives::{B256, U256}; use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion}; use proptest::test_runner::TestRunner; -use rand::Rng; +use rand_08::Rng; use revm_primitives::{Address, HashMap}; use revm_state::{Account, AccountInfo, AccountStatus, EvmState, EvmStorage, EvmStorageSlot}; use std::{hint::black_box, thread}; diff --git a/crates/engine/tree/benches/state_root_task.rs b/crates/engine/tree/benches/state_root_task.rs index aeb4fb4b131..8f10bfcc134 100644 --- a/crates/engine/tree/benches/state_root_task.rs +++ b/crates/engine/tree/benches/state_root_task.rs @@ -8,7 +8,7 @@ use alloy_evm::block::StateChangeSource; use alloy_primitives::{Address, B256}; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use proptest::test_runner::TestRunner; -use rand::Rng; +use rand_08::Rng; use reth_chain_state::EthPrimitives; use reth_chainspec::ChainSpec; use reth_db_common::init::init_genesis; @@ -41,7 +41,12 @@ struct BenchParams { fn create_bench_state_updates(params: &BenchParams) -> Vec { let mut runner = TestRunner::deterministic(); let mut rng = runner.rng().clone(); - let all_addresses: Vec
= (0..params.num_accounts).map(|_| rng.gen()).collect(); + let all_addresses: Vec
= (0..params.num_accounts) + .map(|_| { + // TODO: rand08 + Address::random() + }) + .collect(); let mut updates = Vec::new(); for _ in 0..params.updates_per_account { diff --git a/crates/engine/tree/src/tree/block_buffer.rs b/crates/engine/tree/src/tree/block_buffer.rs index 8c421430ad6..6da92818e21 100644 --- a/crates/engine/tree/src/tree/block_buffer.rs +++ b/crates/engine/tree/src/tree/block_buffer.rs @@ -236,7 +236,7 @@ mod tests { #[test] fn simple_insertion() { let mut rng = generators::rng(); - let parent = rng.gen(); + let parent = rng.random(); let block1 = create_block(&mut rng, 10, parent); let mut buffer = BlockBuffer::new(3); @@ -249,11 +249,11 @@ mod tests { fn take_entire_chain_of_children() { let mut rng = generators::rng(); - let main_parent_hash = rng.gen(); + let main_parent_hash = rng.random(); let block1 = create_block(&mut rng, 10, main_parent_hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 12, block2.hash()); - let parent4 = rng.gen(); + let parent4 = rng.random(); let block4 = create_block(&mut rng, 14, parent4); let mut buffer = BlockBuffer::new(5); @@ -282,7 +282,7 @@ mod tests { fn take_all_multi_level_children() { let mut rng = generators::rng(); - let main_parent_hash = rng.gen(); + let main_parent_hash = rng.random(); let block1 = create_block(&mut rng, 10, main_parent_hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 11, block1.hash()); @@ -316,7 +316,7 @@ mod tests { fn take_block_with_children() { let mut rng = generators::rng(); - let main_parent = BlockNumHash::new(9, rng.gen()); + let main_parent = BlockNumHash::new(9, rng.random()); let block1 = create_block(&mut rng, 10, main_parent.hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 11, block1.hash()); @@ -350,11 +350,11 @@ mod tests { fn remove_chain_of_children() { let mut rng = generators::rng(); - let main_parent = BlockNumHash::new(9, rng.gen()); + let main_parent = BlockNumHash::new(9, rng.random()); let block1 = create_block(&mut rng, 10, main_parent.hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 12, block2.hash()); - let parent4 = rng.gen(); + let parent4 = rng.random(); let block4 = create_block(&mut rng, 14, parent4); let mut buffer = BlockBuffer::new(5); @@ -373,7 +373,7 @@ mod tests { fn remove_all_multi_level_children() { let mut rng = generators::rng(); - let main_parent = BlockNumHash::new(9, rng.gen()); + let main_parent = BlockNumHash::new(9, rng.random()); let block1 = create_block(&mut rng, 10, main_parent.hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 11, block1.hash()); @@ -395,16 +395,16 @@ mod tests { fn remove_multi_chains() { let mut rng = generators::rng(); - let main_parent = BlockNumHash::new(9, rng.gen()); + let main_parent = BlockNumHash::new(9, rng.random()); let block1 = create_block(&mut rng, 10, main_parent.hash); let block1a = create_block(&mut rng, 10, main_parent.hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block2a = create_block(&mut rng, 11, block1.hash()); - let random_parent1 = rng.gen(); + let random_parent1 = rng.random(); let random_block1 = create_block(&mut rng, 10, random_parent1); - let random_parent2 = rng.gen(); + let random_parent2 = rng.random(); let random_block2 = create_block(&mut rng, 11, random_parent2); - let random_parent3 = rng.gen(); + let random_parent3 = rng.random(); let random_block3 = create_block(&mut rng, 12, random_parent3); let mut buffer = BlockBuffer::new(10); @@ -439,11 +439,11 @@ mod tests { fn evict_with_gap() { let mut rng = generators::rng(); - let main_parent = BlockNumHash::new(9, rng.gen()); + let main_parent = BlockNumHash::new(9, rng.random()); let block1 = create_block(&mut rng, 10, main_parent.hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 12, block2.hash()); - let parent4 = rng.gen(); + let parent4 = rng.random(); let block4 = create_block(&mut rng, 13, parent4); let mut buffer = BlockBuffer::new(3); @@ -476,11 +476,11 @@ mod tests { fn simple_eviction() { let mut rng = generators::rng(); - let main_parent = BlockNumHash::new(9, rng.gen()); + let main_parent = BlockNumHash::new(9, rng.random()); let block1 = create_block(&mut rng, 10, main_parent.hash); let block2 = create_block(&mut rng, 11, block1.hash()); let block3 = create_block(&mut rng, 12, block2.hash()); - let parent4 = rng.gen(); + let parent4 = rng.random(); let block4 = create_block(&mut rng, 13, parent4); let mut buffer = BlockBuffer::new(3); diff --git a/crates/engine/tree/src/tree/cached_state.rs b/crates/engine/tree/src/tree/cached_state.rs index d6a86d30c1e..1557d224747 100644 --- a/crates/engine/tree/src/tree/cached_state.rs +++ b/crates/engine/tree/src/tree/cached_state.rs @@ -639,10 +639,10 @@ mod tests { fn measure_storage_cache_overhead() { let (base_overhead, cache) = measure_allocation(|| AccountStorageCache::new(1000)); println!("Base AccountStorageCache overhead: {} bytes", base_overhead); - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let key = StorageKey::random(); - let value = StorageValue::from(rng.gen::()); + let value = StorageValue::from(rng.random::()); let (first_slot, _) = measure_allocation(|| { cache.insert_storage(key, Some(value)); }); @@ -652,7 +652,7 @@ mod tests { let (test_slots, _) = measure_allocation(|| { for _ in 0..TOTAL_SLOTS { let key = StorageKey::random(); - let value = StorageValue::from(rng.gen::()); + let value = StorageValue::from(rng.random::()); cache.insert_storage(key, Some(value)); } }); diff --git a/crates/engine/tree/src/tree/payload_processor/mod.rs b/crates/engine/tree/src/tree/payload_processor/mod.rs index 21a8501a6a0..9e7efbd7fb7 100644 --- a/crates/engine/tree/src/tree/payload_processor/mod.rs +++ b/crates/engine/tree/src/tree/payload_processor/mod.rs @@ -426,6 +426,7 @@ mod tests { StateProviderBuilder, TreeConfig, }; use alloy_evm::block::StateChangeSource; + use rand::Rng; use reth_chainspec::ChainSpec; use reth_db_common::init::init_genesis; use reth_ethereum_primitives::EthPrimitives; @@ -437,38 +438,41 @@ mod tests { test_utils::create_test_provider_factory_with_chain_spec, ChainSpecProvider, HashingWriter, }; - use reth_testing_utils::generators::{self, Rng}; + use reth_testing_utils::generators; use reth_trie::{test_utils::state_root, HashedPostState, TrieInput}; use revm_primitives::{Address, HashMap, B256, KECCAK_EMPTY, U256}; use revm_state::{AccountInfo, AccountStatus, EvmState, EvmStorageSlot}; fn create_mock_state_updates(num_accounts: usize, updates_per_account: usize) -> Vec { let mut rng = generators::rng(); - let all_addresses: Vec
= (0..num_accounts).map(|_| rng.gen()).collect(); + let all_addresses: Vec
= (0..num_accounts).map(|_| rng.random()).collect(); let mut updates = Vec::new(); for _ in 0..updates_per_account { - let num_accounts_in_update = rng.gen_range(1..=num_accounts); + let num_accounts_in_update = rng.random_range(1..=num_accounts); let mut state_update = EvmState::default(); let selected_addresses = &all_addresses[0..num_accounts_in_update]; for &address in selected_addresses { let mut storage = HashMap::default(); - if rng.gen_bool(0.7) { - for _ in 0..rng.gen_range(1..10) { - let slot = U256::from(rng.gen::()); + if rng.random_bool(0.7) { + for _ in 0..rng.random_range(1..10) { + let slot = U256::from(rng.random::()); storage.insert( slot, - EvmStorageSlot::new_changed(U256::ZERO, U256::from(rng.gen::())), + EvmStorageSlot::new_changed( + U256::ZERO, + U256::from(rng.random::()), + ), ); } } let account = revm_state::Account { info: AccountInfo { - balance: U256::from(rng.gen::()), - nonce: rng.gen::(), + balance: U256::from(rng.random::()), + nonce: rng.random::(), code_hash: KECCAK_EMPTY, code: Some(Default::default()), }, diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 41b86b3e857..b3ed93b3f5e 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -49,7 +49,6 @@ mod tests { state::{AccountInfo, Bytecode, EvmState}, Database, }; - use secp256k1::{Keypair, Secp256k1}; use std::sync::mpsc; fn create_database_with_beacon_root_contract() -> CacheDB { @@ -679,8 +678,7 @@ mod tests { let mut db = create_database_with_withdrawal_requests_contract(); - let secp = Secp256k1::new(); - let sender_key_pair = Keypair::new(&secp, &mut generators::rng()); + let sender_key_pair = generators::generate_key(&mut generators::rng()); let sender_address = public_key_to_address(sender_key_pair.public_key()); db.insert_account_info( @@ -748,10 +746,8 @@ mod tests { // Create a state provider with the withdrawal requests contract pre-deployed let mut db = create_database_with_withdrawal_requests_contract(); - // Initialize Secp256k1 for key pair generation - let secp = Secp256k1::new(); // Generate a new key pair for the sender - let sender_key_pair = Keypair::new(&secp, &mut generators::rng()); + let sender_key_pair = generators::generate_key(&mut generators::rng()); // Get the sender's address from the public key let sender_address = public_key_to_address(sender_key_pair.public_key()); diff --git a/crates/ethereum/node/tests/e2e/p2p.rs b/crates/ethereum/node/tests/e2e/p2p.rs index 41cc2b9c230..fed2c679ec4 100644 --- a/crates/ethereum/node/tests/e2e/p2p.rs +++ b/crates/ethereum/node/tests/e2e/p2p.rs @@ -53,7 +53,7 @@ async fn can_sync() -> eyre::Result<()> { async fn e2e_test_send_transactions() -> eyre::Result<()> { reth_tracing::init_test_tracing(); - let seed: [u8; 32] = rand::thread_rng().gen(); + let seed: [u8; 32] = rand::rng().random(); let mut rng = StdRng::from_seed(seed); println!("Seed: {:?}", seed); @@ -89,7 +89,7 @@ async fn e2e_test_send_transactions() -> eyre::Result<()> { async fn test_long_reorg() -> eyre::Result<()> { reth_tracing::init_test_tracing(); - let seed: [u8; 32] = rand::thread_rng().gen(); + let seed: [u8; 32] = rand::rng().random(); let mut rng = StdRng::from_seed(seed); println!("Seed: {:?}", seed); @@ -139,7 +139,7 @@ async fn test_long_reorg() -> eyre::Result<()> { async fn test_reorg_through_backfill() -> eyre::Result<()> { reth_tracing::init_test_tracing(); - let seed: [u8; 32] = rand::thread_rng().gen(); + let seed: [u8; 32] = rand::rng().random(); let mut rng = StdRng::from_seed(seed); println!("Seed: {:?}", seed); diff --git a/crates/ethereum/node/tests/e2e/rpc.rs b/crates/ethereum/node/tests/e2e/rpc.rs index 38e6c372eff..18e3b6b3d3d 100644 --- a/crates/ethereum/node/tests/e2e/rpc.rs +++ b/crates/ethereum/node/tests/e2e/rpc.rs @@ -33,7 +33,7 @@ alloy_sol_types::sol! { async fn test_fee_history() -> eyre::Result<()> { reth_tracing::init_test_tracing(); - let seed: [u8; 32] = rand::thread_rng().gen(); + let seed: [u8; 32] = rand::rng().random(); let mut rng = StdRng::from_seed(seed); println!("Seed: {:?}", seed); @@ -71,8 +71,9 @@ async fn test_fee_history() -> eyre::Result<()> { assert_eq!(block.header.base_fee_per_gas.unwrap(), expected_first_base_fee as u64); for _ in 0..100 { - let _ = - GasWaster::deploy_builder(&provider, U256::from(rng.gen_range(0..1000))).send().await?; + let _ = GasWaster::deploy_builder(&provider, U256::from(rng.random_range(0..1000))) + .send() + .await?; node.advance_block().await?; } @@ -80,8 +81,8 @@ async fn test_fee_history() -> eyre::Result<()> { let latest_block = provider.get_block_number().await?; for _ in 0..100 { - let latest_block = rng.gen_range(0..=latest_block); - let block_count = rng.gen_range(1..=(latest_block + 1)); + let latest_block = rng.random_range(0..=latest_block); + let block_count = rng.random_range(1..=(latest_block + 1)); let fee_history = provider.get_fee_history(block_count, latest_block.into(), &[]).await?; diff --git a/crates/ethereum/node/tests/e2e/utils.rs b/crates/ethereum/node/tests/e2e/utils.rs index 58749264470..ec958faebd3 100644 --- a/crates/ethereum/node/tests/e2e/utils.rs +++ b/crates/ethereum/node/tests/e2e/utils.rs @@ -9,7 +9,7 @@ use alloy_provider::{ use alloy_rpc_types_engine::PayloadAttributes; use alloy_rpc_types_eth::TransactionRequest; use alloy_signer::SignerSync; -use rand::{seq::SliceRandom, Rng}; +use rand::{seq::IndexedRandom, Rng}; use reth_e2e_test_utils::{wallet::Wallet, NodeHelperType, TmpDB}; use reth_ethereum_engine_primitives::EthPayloadBuilderAttributes; use reth_ethereum_primitives::TxType; @@ -47,12 +47,12 @@ where let mut call_destinations = signers.iter().map(|s| s.address()).collect::>(); for _ in 0..num_blocks { - let tx_count = rng.gen_range(1..20); + let tx_count = rng.random_range(1..20); let mut pending = vec![]; for _ in 0..tx_count { let signer = signers.choose(rng).unwrap(); - let tx_type = TxType::try_from(rng.gen_range(0..=4) as u64).unwrap(); + let tx_type = TxType::try_from(rng.random_range(0..=4) as u64).unwrap(); let nonce = provider .get_transaction_count(signer.address()) @@ -63,12 +63,12 @@ where TransactionRequest::default().with_from(signer.address()).with_nonce(nonce); let should_create = - rng.gen::() && tx_type != TxType::Eip4844 && tx_type != TxType::Eip7702; + rng.random::() && tx_type != TxType::Eip4844 && tx_type != TxType::Eip7702; if should_create { tx = tx.into_create().with_input(dummy_bytecode.clone()); } else { tx = tx.with_to(*call_destinations.choose(rng).unwrap()).with_input( - (0..rng.gen_range(0..10000)).map(|_| rng.gen()).collect::>(), + (0..rng.random_range(0..10000)).map(|_| rng.random()).collect::>(), ); } @@ -76,11 +76,11 @@ where tx = tx.with_gas_price(provider.get_gas_price().await?); } - if rng.gen::() || tx_type == TxType::Eip2930 { + if rng.random::() || tx_type == TxType::Eip2930 { tx = tx.with_access_list( vec![AccessListItem { address: *call_destinations.choose(rng).unwrap(), - storage_keys: (0..rng.gen_range(0..100)).map(|_| rng.gen()).collect(), + storage_keys: (0..rng.random_range(0..100)).map(|_| rng.random()).collect(), }] .into(), ); diff --git a/crates/ethereum/primitives/Cargo.toml b/crates/ethereum/primitives/Cargo.toml index bccab52aee1..d27224fb4b7 100644 --- a/crates/ethereum/primitives/Cargo.toml +++ b/crates/ethereum/primitives/Cargo.toml @@ -31,7 +31,7 @@ revm-context.workspace = true arbitrary = { workspace = true, optional = true, features = ["derive"] } derive_more.workspace = true modular-bitfield = { workspace = true, optional = true } -rand = { workspace = true, optional = true } +rand_08 = { workspace = true, optional = true } secp256k1 = { workspace = true, optional = true, features = ["rand"] } serde = { workspace = true, optional = true } serde_with = { workspace = true, optional = true } @@ -41,6 +41,7 @@ arbitrary.workspace = true bincode.workspace = true proptest.workspace = true proptest-arbitrary-interop.workspace = true +rand_08.workspace = true rand.workspace = true reth-codecs = { workspace = true, features = ["test-utils"] } reth-testing-utils.workspace = true @@ -79,7 +80,7 @@ reth-codec = [ ] arbitrary = [ "dep:arbitrary", - "dep:rand", + "dep:rand_08", "dep:secp256k1", "alloy-consensus/arbitrary", "alloy-primitives/arbitrary", @@ -100,9 +101,10 @@ serde = [ "alloy-eips/serde", "alloy-primitives/serde", "alloy-rpc-types-eth?/serde", - "rand?/serde", + "rand_08?/serde", "reth-codecs?/serde", "reth-primitives-traits/serde", "revm-context/serde", "secp256k1?/serde", + "rand/serde", ] diff --git a/crates/ethereum/primitives/src/receipt.rs b/crates/ethereum/primitives/src/receipt.rs index fafd1b8310a..bef29c4cbc1 100644 --- a/crates/ethereum/primitives/src/receipt.rs +++ b/crates/ethereum/primitives/src/receipt.rs @@ -310,7 +310,7 @@ pub(super) mod serde_bincode_compat { } let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); + rand::rng().fill(bytes.as_mut_slice()); let data = Data { reseipt: Receipt::arbitrary(&mut arbitrary::Unstructured::new(&bytes)).unwrap(), }; diff --git a/crates/ethereum/primitives/src/transaction.rs b/crates/ethereum/primitives/src/transaction.rs index 3d6d6b13cb2..f6b66790447 100644 --- a/crates/ethereum/primitives/src/transaction.rs +++ b/crates/ethereum/primitives/src/transaction.rs @@ -13,8 +13,7 @@ use alloy_eips::{ }; use alloy_evm::{FromRecoveredTx, FromTxWithEncoded}; use alloy_primitives::{ - bytes::BufMut, keccak256, Address, Bytes, ChainId, PrimitiveSignature as Signature, TxHash, - TxKind, B256, U256, + bytes::BufMut, keccak256, Address, Bytes, ChainId, Signature, TxHash, TxKind, B256, U256, }; use alloy_rlp::{Decodable, Encodable}; use core::hash::{Hash, Hasher}; @@ -621,7 +620,7 @@ impl<'a> arbitrary::Arbitrary<'a> for TransactionSigned { let mut transaction = Transaction::arbitrary(u)?; let secp = secp256k1::Secp256k1::new(); - let key_pair = secp256k1::Keypair::new(&secp, &mut rand::thread_rng()); + let key_pair = secp256k1::Keypair::new(&secp, &mut rand_08::thread_rng()); let signature = reth_primitives_traits::crypto::secp256k1::sign_message( B256::from_slice(&key_pair.secret_bytes()[..]), transaction.signature_hash(), @@ -968,7 +967,7 @@ pub(super) mod serde_bincode_compat { transaction::serde_bincode_compat::{TxEip1559, TxEip2930, TxEip7702, TxLegacy}, TxEip4844, }; - use alloy_primitives::{PrimitiveSignature as Signature, TxHash}; + use alloy_primitives::{Signature, TxHash}; use reth_primitives_traits::{serde_bincode_compat::SerdeBincodeCompat, SignedTransaction}; /// Bincode-compatible [`super::Transaction`] serde implementation. @@ -1103,8 +1102,7 @@ mod tests { eip7702::constants::SECP256K1N_HALF, }; use alloy_primitives::{ - address, b256, bytes, hex, Address, Bytes, PrimitiveSignature as Signature, TxKind, B256, - U256, + address, b256, bytes, hex, Address, Bytes, Signature, TxKind, B256, U256, }; use alloy_rlp::{Decodable, Encodable, Error as RlpError}; use proptest::proptest; diff --git a/crates/evm/execution-types/src/chain.rs b/crates/evm/execution-types/src/chain.rs index 0e21340ff8c..16d6a052c26 100644 --- a/crates/evm/execution-types/src/chain.rs +++ b/crates/evm/execution-types/src/chain.rs @@ -680,7 +680,7 @@ pub(super) mod serde_bincode_compat { } let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); + rand::rng().fill(bytes.as_mut_slice()); let data = Data { chain: Chain::new( vec![RecoveredBlock::arbitrary(&mut arbitrary::Unstructured::new(&bytes)) diff --git a/crates/evm/execution-types/src/execution_outcome.rs b/crates/evm/execution-types/src/execution_outcome.rs index 0a25384279f..ac9d69ee181 100644 --- a/crates/evm/execution-types/src/execution_outcome.rs +++ b/crates/evm/execution-types/src/execution_outcome.rs @@ -534,7 +534,7 @@ pub(super) mod serde_bincode_compat { } let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); + rand::rng().fill(bytes.as_mut_slice()); let data = Data { data: ExecutionOutcome { bundle: Default::default(), diff --git a/crates/exex/exex/src/backfill/job.rs b/crates/exex/exex/src/backfill/job.rs index 3439978a8a1..b0b5dcc4654 100644 --- a/crates/exex/exex/src/backfill/job.rs +++ b/crates/exex/exex/src/backfill/job.rs @@ -254,14 +254,13 @@ mod tests { providers::BlockchainProvider, test_utils::create_test_provider_factory_with_chain_spec, }; use reth_testing_utils::generators; - use secp256k1::Keypair; #[test] fn test_backfill() -> eyre::Result<()> { reth_tracing::init_test_tracing(); // Create a key pair for the sender - let key_pair = Keypair::new_global(&mut generators::rng()); + let key_pair = generators::generate_key(&mut generators::rng()); let address = public_key_to_address(key_pair.public_key()); let chain_spec = chain_spec(address); @@ -297,7 +296,7 @@ mod tests { reth_tracing::init_test_tracing(); // Create a key pair for the sender - let key_pair = Keypair::new_global(&mut generators::rng()); + let key_pair = generators::generate_key(&mut generators::rng()); let address = public_key_to_address(key_pair.public_key()); let chain_spec = chain_spec(address); diff --git a/crates/exex/exex/src/backfill/stream.rs b/crates/exex/exex/src/backfill/stream.rs index 3860d5c7b78..a58050bdcf5 100644 --- a/crates/exex/exex/src/backfill/stream.rs +++ b/crates/exex/exex/src/backfill/stream.rs @@ -251,14 +251,13 @@ mod tests { }; use reth_stages_api::ExecutionStageThresholds; use reth_testing_utils::generators; - use secp256k1::Keypair; #[tokio::test] async fn test_single_blocks() -> eyre::Result<()> { reth_tracing::init_test_tracing(); // Create a key pair for the sender - let key_pair = Keypair::new_global(&mut generators::rng()); + let key_pair = generators::generate_key(&mut generators::rng()); let address = public_key_to_address(key_pair.public_key()); let chain_spec = chain_spec(address); @@ -295,7 +294,7 @@ mod tests { reth_tracing::init_test_tracing(); // Create a key pair for the sender - let key_pair = Keypair::new_global(&mut generators::rng()); + let key_pair = generators::generate_key(&mut generators::rng()); let address = public_key_to_address(key_pair.public_key()); let chain_spec = chain_spec(address); diff --git a/crates/exex/exex/src/manager.rs b/crates/exex/exex/src/manager.rs index d6f871511e7..bda1f4c3d5b 100644 --- a/crates/exex/exex/src/manager.rs +++ b/crates/exex/exex/src/manager.rs @@ -1372,7 +1372,7 @@ mod tests { // Send a `FinishedHeight` event with a non-canonical block events_tx - .send(ExExEvent::FinishedHeight((rng.gen::(), rng.gen::()).into())) + .send(ExExEvent::FinishedHeight((rng.random::(), rng.random::()).into())) .unwrap(); finalized_headers_tx.send(Some(block.clone_sealed_header()))?; diff --git a/crates/exex/test-utils/Cargo.toml b/crates/exex/test-utils/Cargo.toml index 144122de027..dcfc3a16412 100644 --- a/crates/exex/test-utils/Cargo.toml +++ b/crates/exex/test-utils/Cargo.toml @@ -42,6 +42,5 @@ tokio.workspace = true ## misc eyre.workspace = true -rand.workspace = true tempfile.workspace = true thiserror.workspace = true diff --git a/crates/exex/test-utils/src/lib.rs b/crates/exex/test-utils/src/lib.rs index d55d9a25487..37472a1d400 100644 --- a/crates/exex/test-utils/src/lib.rs +++ b/crates/exex/test-utils/src/lib.rs @@ -28,7 +28,7 @@ use reth_ethereum_primitives::{EthPrimitives, TransactionSigned}; use reth_evm::test_utils::MockExecutorProvider; use reth_execution_types::Chain; use reth_exex::{ExExContext, ExExEvent, ExExNotification, ExExNotifications, Wal}; -use reth_network::{config::SecretKey, NetworkConfigBuilder, NetworkManager}; +use reth_network::{config::rng_secret_key, NetworkConfigBuilder, NetworkManager}; use reth_node_api::{ FullNodeTypes, FullNodeTypesAdapter, NodePrimitives, NodeTypes, NodeTypesWithDBAdapter, }; @@ -272,7 +272,7 @@ pub async fn test_exex_context_with_chain_spec( let provider = BlockchainProvider::new(provider_factory.clone())?; let network_manager = NetworkManager::new( - NetworkConfigBuilder::new(SecretKey::new(&mut rand::thread_rng())) + NetworkConfigBuilder::new(rng_secret_key()) .with_unused_discovery_port() .with_unused_listener_port() .build(provider_factory.clone()), diff --git a/crates/exex/types/src/notification.rs b/crates/exex/types/src/notification.rs index 85aafacc521..cf0d7580556 100644 --- a/crates/exex/types/src/notification.rs +++ b/crates/exex/types/src/notification.rs @@ -199,7 +199,7 @@ pub(super) mod serde_bincode_compat { } let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); + rand::rng().fill(bytes.as_mut_slice()); let data = Data { notification: ExExNotification::ChainReorged { old: Arc::new(Chain::new( diff --git a/crates/net/discv4/Cargo.toml b/crates/net/discv4/Cargo.toml index cd6c2187c39..20691a6d929 100644 --- a/crates/net/discv4/Cargo.toml +++ b/crates/net/discv4/Cargo.toml @@ -34,7 +34,7 @@ schnellru.workspace = true tracing.workspace = true thiserror.workspace = true parking_lot.workspace = true -rand = { workspace = true, optional = true } +rand_08 = { workspace = true, optional = true } generic-array.workspace = true serde = { workspace = true, optional = true } itertools.workspace = true @@ -42,7 +42,7 @@ itertools.workspace = true [dev-dependencies] secp256k1 = { workspace = true, features = ["rand"] } assert_matches.workspace = true -rand.workspace = true +rand_08.workspace = true tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } reth-tracing.workspace = true @@ -55,8 +55,8 @@ serde = [ "enr/serde", "generic-array/serde", "parking_lot/serde", - "rand?/serde", + "rand_08?/serde", "secp256k1/serde", "reth-ethereum-forks/serde", ] -test-utils = ["dep:rand"] +test-utils = ["dep:rand_08"] diff --git a/crates/net/discv4/src/lib.rs b/crates/net/discv4/src/lib.rs index 0c806857b40..c05df840de1 100644 --- a/crates/net/discv4/src/lib.rs +++ b/crates/net/discv4/src/lib.rs @@ -214,15 +214,13 @@ impl Discv4 { /// /// ``` /// # use std::io; - /// use rand::thread_rng; /// use reth_discv4::{Discv4, Discv4Config}; /// use reth_network_peers::{pk2id, NodeRecord, PeerId}; /// use secp256k1::SECP256K1; /// use std::{net::SocketAddr, str::FromStr}; /// # async fn t() -> io::Result<()> { /// // generate a (random) keypair - /// let mut rng = thread_rng(); - /// let (secret_key, pk) = SECP256K1.generate_keypair(&mut rng); + /// let (secret_key, pk) = SECP256K1.generate_keypair(&mut rand_08::thread_rng()); /// let id = pk2id(&pk); /// /// let socket = SocketAddr::from_str("0.0.0.0:0").unwrap(); @@ -2399,7 +2397,7 @@ mod tests { use crate::test_utils::{create_discv4, create_discv4_with_config, rng_endpoint, rng_record}; use alloy_primitives::hex; use alloy_rlp::{Decodable, Encodable}; - use rand::{thread_rng, Rng}; + use rand_08::Rng; use reth_ethereum_forks::{EnrForkIdEntry, ForkHash}; use reth_network_peers::mainnet_nodes; use std::future::poll_fn; @@ -2534,7 +2532,7 @@ mod tests { #[tokio::test] async fn test_mapped_ipv4() { reth_tracing::init_test_tracing(); - let mut rng = thread_rng(); + let mut rng = rand_08::thread_rng(); let config = Discv4Config::builder().build(); let (_discv4, mut service) = create_discv4_with_config(config).await; @@ -2549,8 +2547,8 @@ mod tests { enr_sq: Some(rng.gen()), }; - let id = PeerId::random_with(&mut rng); - service.on_ping(ping, addr, id, rng.gen()); + let id = PeerId::random(); + service.on_ping(ping, addr, id, B256::random()); let key = kad_key(id); match service.kbuckets.entry(&key) { @@ -2566,7 +2564,7 @@ mod tests { #[tokio::test] async fn test_respect_ping_expiration() { reth_tracing::init_test_tracing(); - let mut rng = thread_rng(); + let mut rng = rand_08::thread_rng(); let config = Discv4Config::builder().build(); let (_discv4, mut service) = create_discv4_with_config(config).await; @@ -2581,8 +2579,8 @@ mod tests { enr_sq: Some(rng.gen()), }; - let id = PeerId::random_with(&mut rng); - service.on_ping(ping, addr, id, rng.gen()); + let id = PeerId::random(); + service.on_ping(ping, addr, id, B256::random()); let key = kad_key(id); match service.kbuckets.entry(&key) { @@ -2979,7 +2977,7 @@ mod tests { #[test] fn test_insert() { - let local_node_record = rng_record(&mut rand::thread_rng()); + let local_node_record = rng_record(&mut rand_08::thread_rng()); let mut kbuckets: KBucketsTable = KBucketsTable::new( NodeKey::from(&local_node_record).into(), Duration::from_secs(60), @@ -2988,7 +2986,7 @@ mod tests { None, ); - let new_record = rng_record(&mut rand::thread_rng()); + let new_record = rng_record(&mut rand_08::thread_rng()); let key = kad_key(new_record.id); match kbuckets.entry(&key) { kbucket::Entry::Absent(entry) => { diff --git a/crates/net/discv4/src/proto.rs b/crates/net/discv4/src/proto.rs index b9ec6cbfa91..84d59129fb5 100644 --- a/crates/net/discv4/src/proto.rs +++ b/crates/net/discv4/src/proto.rs @@ -594,12 +594,12 @@ mod tests { use alloy_primitives::hex; use assert_matches::assert_matches; use enr::EnrPublicKey; - use rand::{thread_rng, Rng, RngCore}; + use rand_08::{thread_rng as rng, Rng, RngCore}; use reth_ethereum_forks::ForkHash; #[test] fn test_endpoint_ipv_v4() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 4]; rng.fill_bytes(&mut ip); @@ -616,7 +616,7 @@ mod tests { #[test] fn test_endpoint_ipv_64() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); @@ -633,7 +633,7 @@ mod tests { #[test] fn test_ping_message() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); @@ -651,7 +651,7 @@ mod tests { #[test] fn test_ping_message_with_enr() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); @@ -669,13 +669,13 @@ mod tests { #[test] fn test_pong_message() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); let msg = Pong { to: rng_endpoint(&mut rng), - echo: rng.gen(), + echo: B256::random(), expire: rng.gen(), enr_sq: None, }; @@ -687,13 +687,13 @@ mod tests { #[test] fn test_pong_message_with_enr() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); let msg = Pong { to: rng_endpoint(&mut rng), - echo: rng.gen(), + echo: B256::random(), expire: rng.gen(), enr_sq: Some(rng.gen()), }; @@ -705,7 +705,7 @@ mod tests { #[test] fn test_hash_mismatch() { - let mut rng = thread_rng(); + let mut rng = rng(); let msg = rng_message(&mut rng); let (secret_key, _) = SECP256K1.generate_keypair(&mut rng); let (buf, _) = msg.encode(&secret_key); @@ -722,7 +722,7 @@ mod tests { #[test] fn neighbours_max_ipv4() { - let mut rng = thread_rng(); + let mut rng = rng(); let msg = Message::Neighbours(Neighbours { nodes: std::iter::repeat_with(|| rng_ipv4_record(&mut rng)).take(16).collect(), expire: rng.gen(), @@ -736,7 +736,7 @@ mod tests { #[test] fn neighbours_max_nodes() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..1000 { let msg = Message::Neighbours(Neighbours { nodes: std::iter::repeat_with(|| rng_ipv6_record(&mut rng)) @@ -764,7 +764,7 @@ mod tests { #[test] fn test_encode_decode_message() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let msg = rng_message(&mut rng); let (secret_key, pk) = SECP256K1.generate_keypair(&mut rng); @@ -798,7 +798,7 @@ mod tests { use enr::secp256k1::SecretKey; use std::net::Ipv4Addr; - let mut rng = rand::rngs::OsRng; + let mut rng = rand_08::rngs::OsRng; let key = SecretKey::new(&mut rng); let ip = Ipv4Addr::new(127, 0, 0, 1); let tcp = 3000; @@ -816,7 +816,7 @@ mod tests { builder.build(&key).unwrap() }; - let enr_response = EnrResponse { request_hash: rng.gen(), enr }; + let enr_response = EnrResponse { request_hash: B256::random(), enr }; let mut buf = Vec::new(); enr_response.encode(&mut buf); @@ -908,7 +908,7 @@ mod tests { use enr::{secp256k1::SecretKey, EnrPublicKey}; use std::net::Ipv4Addr; - let key = SecretKey::new(&mut rand::rngs::OsRng); + let key = SecretKey::new(&mut rand_08::rngs::OsRng); let ip = Ipv4Addr::new(127, 0, 0, 1); let tcp = 3000; diff --git a/crates/net/discv4/src/test_utils.rs b/crates/net/discv4/src/test_utils.rs index 06133dba679..7739500b00e 100644 --- a/crates/net/discv4/src/test_utils.rs +++ b/crates/net/discv4/src/test_utils.rs @@ -1,12 +1,14 @@ //! Mock discovery support +// TODO(rand): update ::random calls after rand_09 migration + use crate::{ proto::{FindNode, Message, Neighbours, NodeEndpoint, Packet, Ping, Pong}, receive_loop, send_loop, Discv4, Discv4Config, Discv4Service, EgressSender, IngressEvent, IngressReceiver, PeerId, SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS, }; -use alloy_primitives::{hex, B256}; -use rand::{thread_rng, Rng, RngCore}; +use alloy_primitives::{hex, B256, B512}; +use rand_08::{thread_rng, Rng, RngCore}; use reth_ethereum_forks::{ForkHash, ForkId}; use reth_network_peers::{pk2id, NodeRecord}; use secp256k1::{SecretKey, SECP256K1}; @@ -265,7 +267,8 @@ pub fn rng_endpoint(rng: &mut impl Rng) -> NodeEndpoint { /// Generates a random [`NodeRecord`] using the provided random number generator. pub fn rng_record(rng: &mut impl RngCore) -> NodeRecord { let NodeEndpoint { address, udp_port, tcp_port } = rng_endpoint(rng); - NodeRecord { address, tcp_port, udp_port, id: rng.gen() } + // TODO(rand) + NodeRecord { address, tcp_port, udp_port, id: B512::random() } } /// Generates a random IPv6 [`NodeRecord`] using the provided random number generator. @@ -273,7 +276,8 @@ pub fn rng_ipv6_record(rng: &mut impl RngCore) -> NodeRecord { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); let address = IpAddr::V6(ip.into()); - NodeRecord { address, tcp_port: rng.gen(), udp_port: rng.gen(), id: rng.gen() } + // TODO(rand) + NodeRecord { address, tcp_port: rng.gen(), udp_port: rng.gen(), id: B512::random() } } /// Generates a random IPv4 [`NodeRecord`] using the provided random number generator. @@ -281,7 +285,8 @@ pub fn rng_ipv4_record(rng: &mut impl RngCore) -> NodeRecord { let mut ip = [0u8; 4]; rng.fill_bytes(&mut ip); let address = IpAddr::V4(ip.into()); - NodeRecord { address, tcp_port: rng.gen(), udp_port: rng.gen(), id: rng.gen() } + // TODO(rand) + NodeRecord { address, tcp_port: rng.gen(), udp_port: rng.gen(), id: B512::random() } } /// Generates a random [`Message`] using the provided random number generator. @@ -295,11 +300,11 @@ pub fn rng_message(rng: &mut impl RngCore) -> Message { }), 2 => Message::Pong(Pong { to: rng_endpoint(rng), - echo: rng.gen(), + echo: B256::random(), expire: rng.gen(), enr_sq: None, }), - 3 => Message::FindNode(FindNode { id: rng.gen(), expire: rng.gen() }), + 3 => Message::FindNode(FindNode { id: B512::random(), expire: rng.gen() }), 4 => { let num: usize = rng.gen_range(1..=SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS); Message::Neighbours(Neighbours { diff --git a/crates/net/discv5/Cargo.toml b/crates/net/discv5/Cargo.toml index 6c59f422431..7c3dfa20095 100644 --- a/crates/net/discv5/Cargo.toml +++ b/crates/net/discv5/Cargo.toml @@ -43,3 +43,4 @@ metrics.workspace = true reth-tracing.workspace = true tokio = { workspace = true, features = ["rt-multi-thread"] } secp256k1 = { workspace = true, features = ["std", "rand"] } +rand_08.workspace = true diff --git a/crates/net/discv5/src/lib.rs b/crates/net/discv5/src/lib.rs index feb7bb71227..18e17e96f59 100644 --- a/crates/net/discv5/src/lib.rs +++ b/crates/net/discv5/src/lib.rs @@ -600,7 +600,7 @@ pub fn get_lookup_target( target[byte] ^= 1 << (7 - bit); // Randomize the bits after the target. - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); // Randomize remaining bits in the byte we modified. if bit < 7 { // Compute the mask of the bits that need to be randomized. @@ -608,7 +608,7 @@ pub fn get_lookup_target( // Clear. target[byte] &= !bits_to_randomize; // Randomize. - target[byte] |= rng.gen::() & bits_to_randomize; + target[byte] |= rng.random::() & bits_to_randomize; } // Randomize remaining bytes. rng.fill_bytes(&mut target[byte + 1..]); @@ -655,7 +655,7 @@ pub async fn lookup( mod test { use super::*; use ::enr::{CombinedKey, EnrKey}; - use rand::thread_rng; + use rand_08::thread_rng; use reth_chainspec::MAINNET; use tracing::trace; diff --git a/crates/net/downloaders/src/file_client.rs b/crates/net/downloaders/src/file_client.rs index ede1c80415b..d1026954e90 100644 --- a/crates/net/downloaders/src/file_client.rs +++ b/crates/net/downloaders/src/file_client.rs @@ -707,7 +707,7 @@ mod tests { // calculate min for chunk byte length range, pick a lower bound that guarantees at least // one block will be read - let chunk_byte_len = rand::thread_rng().gen_range(2000..=10_000); + let chunk_byte_len = rand::rng().random_range(2000..=10_000); trace!(target: "downloaders::file::test", chunk_byte_len); // init reader diff --git a/crates/net/ecies/Cargo.toml b/crates/net/ecies/Cargo.toml index c692ea51ed0..a55e5fa7e8f 100644 --- a/crates/net/ecies/Cargo.toml +++ b/crates/net/ecies/Cargo.toml @@ -31,10 +31,10 @@ typenum.workspace = true byteorder.workspace = true # crypto -rand.workspace = true ctr.workspace = true digest.workspace = true secp256k1 = { workspace = true, features = ["global-context", "std", "recovery", "rand"] } +rand_08.workspace = true concat-kdf.workspace = true sha2.workspace = true sha3.workspace = true diff --git a/crates/net/ecies/src/algorithm.rs b/crates/net/ecies/src/algorithm.rs index 9d16a13bf2e..65a4181c25d 100644 --- a/crates/net/ecies/src/algorithm.rs +++ b/crates/net/ecies/src/algorithm.rs @@ -15,7 +15,7 @@ use alloy_rlp::{Encodable, Rlp, RlpEncodable, RlpMaxEncodedLen}; use byteorder::{BigEndian, ByteOrder, ReadBytesExt}; use ctr::Ctr64BE; use digest::{crypto_common::KeyIvInit, Digest}; -use rand::{thread_rng, Rng}; +use rand_08::{thread_rng as rng, Rng}; use reth_network_peers::{id2pk, pk2id}; use secp256k1::{ ecdsa::{RecoverableSignature, RecoveryId}, @@ -312,8 +312,9 @@ impl ECIES { /// Create a new ECIES client with the given static secret key and remote peer ID. pub fn new_client(secret_key: SecretKey, remote_id: PeerId) -> Result { - let mut rng = thread_rng(); - let nonce = rng.gen(); + // TODO(rand): use rng for nonce + let mut rng = rng(); + let nonce = B256::random(); let ephemeral_secret_key = SecretKey::new(&mut rng); Self::new_static_client(secret_key, remote_id, nonce, ephemeral_secret_key) } @@ -354,8 +355,8 @@ impl ECIES { /// Create a new ECIES server with the given static secret key. pub fn new_server(secret_key: SecretKey) -> Result { - let mut rng = thread_rng(); - let nonce = rng.gen(); + let mut rng = rng(); + let nonce = B256::random(); let ephemeral_secret_key = SecretKey::new(&mut rng); Self::new_static_server(secret_key, nonce, ephemeral_secret_key) } @@ -366,7 +367,7 @@ impl ECIES { } fn encrypt_message(&self, data: &[u8], out: &mut BytesMut) { - let mut rng = thread_rng(); + let mut rng = rng(); out.reserve(secp256k1::constants::UNCOMPRESSED_PUBLIC_KEY_SIZE + 16 + data.len() + 32); @@ -382,7 +383,7 @@ impl ECIES { let enc_key = B128::from_slice(&key[..16]); let mac_key = sha256(&key[16..32]); - let iv: B128 = rng.gen(); + let iv = B128::random(); let mut encryptor = Ctr64BE::::new((&enc_key.0).into(), (&iv.0).into()); let mut encrypted = data.to_vec(); @@ -442,7 +443,7 @@ impl ECIES { } .encode(&mut out); - out.resize(out.len() + thread_rng().gen_range(100..=300), 0); + out.resize(out.len() + rng().gen_range(100..=300), 0); out } @@ -763,7 +764,7 @@ mod tests { #[test] fn communicate() { - let mut rng = thread_rng(); + let mut rng = rng(); let server_secret_key = SecretKey::new(&mut rng); let server_public_key = PublicKey::from_secret_key(SECP256K1, &server_secret_key); let client_secret_key = SecretKey::new(&mut rng); diff --git a/crates/net/ecies/src/stream.rs b/crates/net/ecies/src/stream.rs index 838703958d3..9915fc42e6a 100644 --- a/crates/net/ecies/src/stream.rs +++ b/crates/net/ecies/src/stream.rs @@ -180,7 +180,7 @@ mod tests { async fn can_write_and_read() { let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let addr = listener.local_addr().unwrap(); - let server_key = SecretKey::new(&mut rand::thread_rng()); + let server_key = SecretKey::new(&mut rand_08::thread_rng()); let handle = tokio::spawn(async move { // roughly based off of the design of tokio::net::TcpListener @@ -195,7 +195,7 @@ mod tests { // create the server pubkey let server_id = pk2id(&server_key.public_key(SECP256K1)); - let client_key = SecretKey::new(&mut rand::thread_rng()); + let client_key = SecretKey::new(&mut rand_08::thread_rng()); let outgoing = TcpStream::connect(addr).await.unwrap(); let mut client_stream = ECIESStream::connect(outgoing, client_key, server_id).await.unwrap(); @@ -209,7 +209,7 @@ mod tests { async fn connection_should_timeout() { let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let addr = listener.local_addr().unwrap(); - let server_key = SecretKey::new(&mut rand::thread_rng()); + let server_key = SecretKey::new(&mut rand_08::thread_rng()); let _handle = tokio::spawn(async move { // Delay accepting the connection for longer than the client's timeout period @@ -225,7 +225,7 @@ mod tests { // create the server pubkey let server_id = pk2id(&server_key.public_key(SECP256K1)); - let client_key = SecretKey::new(&mut rand::thread_rng()); + let client_key = SecretKey::new(&mut rand_08::thread_rng()); let outgoing = TcpStream::connect(addr).await.unwrap(); // Attempt to connect, expecting a timeout due to the server's delayed response diff --git a/crates/net/eth-wire-types/src/blocks.rs b/crates/net/eth-wire-types/src/blocks.rs index ce8d9aedcc8..94258d75b83 100644 --- a/crates/net/eth-wire-types/src/blocks.rs +++ b/crates/net/eth-wire-types/src/blocks.rs @@ -97,7 +97,7 @@ mod tests { }; use alloy_consensus::{Header, TxLegacy}; use alloy_eips::BlockHashOrNumber; - use alloy_primitives::{hex, PrimitiveSignature as Signature, TxKind, U256}; + use alloy_primitives::{hex, Signature, TxKind, U256}; use alloy_rlp::{Decodable, Encodable}; use reth_ethereum_primitives::{BlockBody, Transaction, TransactionSigned}; use std::str::FromStr; diff --git a/crates/net/eth-wire-types/src/broadcast.rs b/crates/net/eth-wire-types/src/broadcast.rs index 1a8227af6b3..da08ef18d69 100644 --- a/crates/net/eth-wire-types/src/broadcast.rs +++ b/crates/net/eth-wire-types/src/broadcast.rs @@ -770,7 +770,7 @@ mod tests { use super::*; use alloy_consensus::Typed2718; use alloy_eips::eip2718::Encodable2718; - use alloy_primitives::{b256, hex, PrimitiveSignature as Signature, U256}; + use alloy_primitives::{b256, hex, Signature, U256}; use reth_ethereum_primitives::{Transaction, TransactionSigned}; use std::str::FromStr; diff --git a/crates/net/eth-wire-types/src/status.rs b/crates/net/eth-wire-types/src/status.rs index 89df2f2007f..26035c5cbe1 100644 --- a/crates/net/eth-wire-types/src/status.rs +++ b/crates/net/eth-wire-types/src/status.rs @@ -582,12 +582,12 @@ mod tests { #[test] fn init_custom_status_fields() { - let mut rng = rand::thread_rng(); - let head_hash = rng.gen(); - let total_difficulty = U256::from(rng.gen::()); + let mut rng = rand::rng(); + let head_hash = rng.random(); + let total_difficulty = U256::from(rng.random::()); // create a genesis that has a random part, so we can check that the hash is preserved - let genesis = Genesis { nonce: rng.gen(), ..Default::default() }; + let genesis = Genesis { nonce: rng.random(), ..Default::default() }; // build head let head = Head { diff --git a/crates/net/eth-wire-types/src/transactions.rs b/crates/net/eth-wire-types/src/transactions.rs index 1fa77df4da0..604117abc02 100644 --- a/crates/net/eth-wire-types/src/transactions.rs +++ b/crates/net/eth-wire-types/src/transactions.rs @@ -86,7 +86,7 @@ impl Default for PooledTransactions { mod tests { use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions}; use alloy_consensus::{transaction::PooledTransaction, TxEip1559, TxLegacy}; - use alloy_primitives::{hex, PrimitiveSignature as Signature, TxKind, U256}; + use alloy_primitives::{hex, Signature, TxKind, U256}; use alloy_rlp::{Decodable, Encodable}; use reth_chainspec::MIN_TRANSACTION_GAS; use reth_ethereum_primitives::{Transaction, TransactionSigned}; diff --git a/crates/net/eth-wire/Cargo.toml b/crates/net/eth-wire/Cargo.toml index 755db20693e..93a3ed4aa77 100644 --- a/crates/net/eth-wire/Cargo.toml +++ b/crates/net/eth-wire/Cargo.toml @@ -54,6 +54,7 @@ tokio = { workspace = true, features = ["rt", "rt-multi-thread"] } tokio-util = { workspace = true, features = ["io", "codec"] } rand.workspace = true secp256k1 = { workspace = true, features = ["global-context", "std", "recovery"] } +rand_08.workspace = true arbitrary = { workspace = true, features = ["derive"] } proptest.workspace = true @@ -87,6 +88,7 @@ serde = [ "reth-primitives-traits/serde", "reth-ethereum-forks/serde", "alloy-consensus/serde", + "rand_08/serde", ] [[test]] diff --git a/crates/net/eth-wire/src/ethstream.rs b/crates/net/eth-wire/src/ethstream.rs index e5a5522a3fc..cb592d41653 100644 --- a/crates/net/eth-wire/src/ethstream.rs +++ b/crates/net/eth-wire/src/ethstream.rs @@ -536,7 +536,7 @@ mod tests { async fn can_write_and_read_ecies() { let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let local_addr = listener.local_addr().unwrap(); - let server_key = SecretKey::new(&mut rand::thread_rng()); + let server_key = SecretKey::new(&mut rand_08::thread_rng()); let test_msg = EthMessage::::NewBlockHashes( vec![ BlockHashNumber { hash: B256::random(), number: 5 }, @@ -560,7 +560,7 @@ mod tests { // create the server pubkey let server_id = pk2id(&server_key.public_key(SECP256K1)); - let client_key = SecretKey::new(&mut rand::thread_rng()); + let client_key = SecretKey::new(&mut rand_08::thread_rng()); let outgoing = TcpStream::connect(local_addr).await.unwrap(); let outgoing = ECIESStream::connect(outgoing, client_key, server_id).await.unwrap(); @@ -578,7 +578,7 @@ mod tests { // create tcpstream let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let local_addr = listener.local_addr().unwrap(); - let server_key = SecretKey::new(&mut rand::thread_rng()); + let server_key = SecretKey::new(&mut rand_08::thread_rng()); let test_msg = EthMessage::::NewBlockHashes( vec![ BlockHashNumber { hash: B256::random(), number: 5 }, @@ -631,7 +631,7 @@ mod tests { // create the server pubkey let server_id = pk2id(&server_key.public_key(SECP256K1)); - let client_key = SecretKey::new(&mut rand::thread_rng()); + let client_key = SecretKey::new(&mut rand_08::thread_rng()); let outgoing = TcpStream::connect(local_addr).await.unwrap(); let sink = ECIESStream::connect(outgoing, client_key, server_id).await.unwrap(); diff --git a/crates/net/eth-wire/src/hello.rs b/crates/net/eth-wire/src/hello.rs index 5d7650b4b7b..58432520a2a 100644 --- a/crates/net/eth-wire/src/hello.rs +++ b/crates/net/eth-wire/src/hello.rs @@ -47,7 +47,7 @@ impl HelloMessageWithProtocols { /// use reth_eth_wire::HelloMessageWithProtocols; /// use reth_network_peers::pk2id; /// use secp256k1::{SecretKey, SECP256K1}; - /// let secret_key = SecretKey::new(&mut rand::thread_rng()); + /// let secret_key = SecretKey::new(&mut rand_08::thread_rng()); /// let id = pk2id(&secret_key.public_key(SECP256K1)); /// let status = HelloMessageWithProtocols::builder(id).build(); /// ``` @@ -130,7 +130,7 @@ impl HelloMessage { /// use reth_eth_wire::HelloMessage; /// use reth_network_peers::pk2id; /// use secp256k1::{SecretKey, SECP256K1}; - /// let secret_key = SecretKey::new(&mut rand::thread_rng()); + /// let secret_key = SecretKey::new(&mut rand_08::thread_rng()); /// let id = pk2id(&secret_key.public_key(SECP256K1)); /// let status = HelloMessage::builder(id).build(); /// ``` @@ -222,7 +222,7 @@ mod tests { #[test] fn test_hello_encoding_round_trip() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let id = pk2id(&secret_key.public_key(SECP256K1)); let hello = P2PMessage::Hello(HelloMessage { protocol_version: ProtocolVersion::V5, @@ -242,7 +242,7 @@ mod tests { #[test] fn hello_encoding_length() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let id = pk2id(&secret_key.public_key(SECP256K1)); let hello = P2PMessage::Hello(HelloMessage { protocol_version: ProtocolVersion::V5, @@ -261,7 +261,7 @@ mod tests { #[test] fn hello_message_id_prefix() { // ensure that the hello message id is prefixed - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let id = pk2id(&secret_key.public_key(SECP256K1)); let hello = P2PMessage::Hello(HelloMessage { protocol_version: ProtocolVersion::V5, diff --git a/crates/net/eth-wire/src/test_utils.rs b/crates/net/eth-wire/src/test_utils.rs index 7a2b934b477..ee989d00d54 100644 --- a/crates/net/eth-wire/src/test_utils.rs +++ b/crates/net/eth-wire/src/test_utils.rs @@ -19,7 +19,7 @@ pub type P2pPassthroughTcpStream = P2PStream (HelloMessageWithProtocols, SecretKey) { - let server_key = SecretKey::new(&mut rand::thread_rng()); + let server_key = SecretKey::new(&mut rand_08::thread_rng()); let protocols = vec![EthVersion::Eth67.into()]; let hello = HelloMessageWithProtocols { protocol_version: ProtocolVersion::V5, diff --git a/crates/net/network/Cargo.toml b/crates/net/network/Cargo.toml index 5bdc2b9e065..4b62e687a65 100644 --- a/crates/net/network/Cargo.toml +++ b/crates/net/network/Cargo.toml @@ -67,6 +67,7 @@ rustc-hash.workspace = true thiserror.workspace = true parking_lot.workspace = true rand.workspace = true +rand_08.workspace = true secp256k1 = { workspace = true, features = ["global-context", "std", "recovery"] } derive_more.workspace = true schnellru.workspace = true @@ -125,6 +126,7 @@ serde = [ "reth-transaction-pool/serde", "reth-ethereum-primitives/serde", "reth-network-api/serde", + "rand_08/serde", ] test-utils = [ "reth-transaction-pool/test-utils", diff --git a/crates/net/network/benches/broadcast.rs b/crates/net/network/benches/broadcast.rs index cf3d7436079..709a56c7258 100644 --- a/crates/net/network/benches/broadcast.rs +++ b/crates/net/network/benches/broadcast.rs @@ -1,10 +1,8 @@ #![allow(missing_docs)] -use alloy_primitives::{ - private::proptest::test_runner::{RngAlgorithm, TestRng}, - U256, -}; +use alloy_primitives::U256; use criterion::*; use futures::StreamExt; +use rand::SeedableRng; use reth_network::{test_utils::Testnet, NetworkEventListenerProvider}; use reth_network_api::Peers; use reth_provider::test_utils::{ExtendedAccount, MockEthProvider}; @@ -50,9 +48,8 @@ pub fn broadcast_ingress_bench(c: &mut Criterion) { } // prepare some transactions - let mut gen = TransactionGenerator::new(TestRng::deterministic_rng( - RngAlgorithm::ChaCha, - )); + let mut gen = + TransactionGenerator::new(rand::rngs::StdRng::seed_from_u64(0)); let num_broadcasts = 10; for _ in 0..num_broadcasts { for _ in 0..2 { diff --git a/crates/net/network/benches/tx_manager_hash_fetching.rs b/crates/net/network/benches/tx_manager_hash_fetching.rs index 3b4537cd49f..f00f5cf69db 100644 --- a/crates/net/network/benches/tx_manager_hash_fetching.rs +++ b/crates/net/network/benches/tx_manager_hash_fetching.rs @@ -1,10 +1,8 @@ #![allow(missing_docs)] -use alloy_primitives::{ - private::proptest::test_runner::{RngAlgorithm, TestRng}, - U256, -}; +use alloy_primitives::U256; use criterion::*; +use rand::SeedableRng; use reth_network::{ test_utils::Testnet, transactions::{ @@ -63,9 +61,8 @@ pub fn tx_fetch_bench(c: &mut Criterion) { let peer_pool = peer.pool().unwrap(); for _ in 0..num_tx_per_peer { - let mut gen = TransactionGenerator::new( - TestRng::deterministic_rng(RngAlgorithm::ChaCha), - ); + let mut gen = + TransactionGenerator::new(rand::rngs::StdRng::seed_from_u64(0)); let tx = gen.gen_eip1559_pooled(); let sender = tx.sender(); diff --git a/crates/net/network/src/config.rs b/crates/net/network/src/config.rs index edbe8e301bc..5df52071dae 100644 --- a/crates/net/network/src/config.rs +++ b/crates/net/network/src/config.rs @@ -28,7 +28,7 @@ pub use secp256k1::SecretKey; /// Convenience function to create a new random [`SecretKey`] pub fn rng_secret_key() -> SecretKey { - SecretKey::new(&mut rand::thread_rng()) + SecretKey::new(&mut rand_08::thread_rng()) } /// All network related initialization settings. @@ -696,14 +696,13 @@ impl NetworkMode { mod tests { use super::*; use alloy_eips::eip2124::ForkHash; - use rand::thread_rng; use reth_chainspec::{Chain, MAINNET}; use reth_dns_discovery::tree::LinkEntry; use reth_storage_api::noop::NoopProvider; use std::sync::Arc; fn builder() -> NetworkConfigBuilder { - let secret_key = SecretKey::new(&mut thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); NetworkConfigBuilder::new(secret_key) } diff --git a/crates/net/network/src/discovery.rs b/crates/net/network/src/discovery.rs index c0b9ffa7630..8ff32314abe 100644 --- a/crates/net/network/src/discovery.rs +++ b/crates/net/network/src/discovery.rs @@ -338,14 +338,12 @@ impl Discovery { #[cfg(test)] mod tests { use super::*; - use rand::thread_rng; use secp256k1::SECP256K1; use std::net::{Ipv4Addr, SocketAddrV4}; #[tokio::test(flavor = "multi_thread")] async fn test_discovery_setup() { - let mut rng = thread_rng(); - let (secret_key, _) = SECP256K1.generate_keypair(&mut rng); + let (secret_key, _) = SECP256K1.generate_keypair(&mut rand_08::thread_rng()); let discovery_addr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, 0)); let _discovery = Discovery::new( discovery_addr, @@ -364,7 +362,7 @@ mod tests { use tracing::trace; async fn start_discovery_node(udp_port_discv4: u16, udp_port_discv5: u16) -> Discovery { - let secret_key = SecretKey::new(&mut thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let discv4_addr = format!("127.0.0.1:{udp_port_discv4}").parse().unwrap(); let discv5_addr: SocketAddr = format!("127.0.0.1:{udp_port_discv5}").parse().unwrap(); diff --git a/crates/net/network/src/session/active.rs b/crates/net/network/src/session/active.rs index 45a7ec47682..0fa72a7f1b2 100644 --- a/crates/net/network/src/session/active.rs +++ b/crates/net/network/src/session/active.rs @@ -898,7 +898,7 @@ mod tests { let fork_filter = self.fork_filter.clone(); let local_peer_id = self.local_peer_id; let mut hello = self.hello.clone(); - let key = SecretKey::new(&mut rand::thread_rng()); + let key = SecretKey::new(&mut rand_08::thread_rng()); hello.id = pk2id(&key.public_key(SECP256K1)); Box::pin(async move { let outgoing = TcpStream::connect(local_addr).await.unwrap(); @@ -989,7 +989,7 @@ mod tests { fn default() -> Self { let (active_session_tx, active_session_rx) = mpsc::channel(100); - let (secret_key, pk) = SECP256K1.generate_keypair(&mut rand::thread_rng()); + let (secret_key, pk) = SECP256K1.generate_keypair(&mut rand_08::thread_rng()); let local_peer_id = pk2id(&pk); Self { diff --git a/crates/net/network/src/state.rs b/crates/net/network/src/state.rs index f244e9537c2..96338197cd0 100644 --- a/crates/net/network/src/state.rs +++ b/crates/net/network/src/state.rs @@ -195,7 +195,7 @@ impl NetworkState { // Shuffle to propagate to a random sample of peers on every block announcement let mut peers: Vec<_> = self.active_peers.iter_mut().collect(); - peers.shuffle(&mut rand::thread_rng()); + peers.shuffle(&mut rand::rng()); for (peer_id, peer) in peers { if peer.blocks.contains(&msg.hash) { diff --git a/crates/net/network/src/test_utils/testnet.rs b/crates/net/network/src/test_utils/testnet.rs index 5fc6bedb575..e1687b17bdb 100644 --- a/crates/net/network/src/test_utils/testnet.rs +++ b/crates/net/network/src/test_utils/testnet.rs @@ -638,7 +638,7 @@ where where C: ChainSpecProvider, { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = Self::network_config_builder(secret_key).build(client.clone()); Self { config, client, secret_key } } @@ -658,7 +658,7 @@ where where C: ChainSpecProvider, { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let builder = Self::network_config_builder(secret_key); let hello_message = diff --git a/crates/net/network/src/transactions/mod.rs b/crates/net/network/src/transactions/mod.rs index 5493ebc5c82..84a64648787 100644 --- a/crates/net/network/src/transactions/mod.rs +++ b/crates/net/network/src/transactions/mod.rs @@ -1911,7 +1911,7 @@ mod tests { use super::*; use crate::{test_utils::Testnet, NetworkConfigBuilder, NetworkManager}; use alloy_consensus::{transaction::PooledTransaction, TxEip1559, TxLegacy}; - use alloy_primitives::{hex, PrimitiveSignature as Signature, TxKind, U256}; + use alloy_primitives::{hex, Signature, TxKind, U256}; use alloy_rlp::Decodable; use constants::tx_fetcher::DEFAULT_MAX_COUNT_FALLBACK_PEERS; use futures::FutureExt; @@ -1940,7 +1940,7 @@ mod tests { async fn new_tx_manager( ) -> (TransactionsManager, NetworkManager) { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let config = NetworkConfigBuilder::new(secret_key) @@ -1998,7 +1998,7 @@ mod tests { let listener0 = handle0.event_listener(); handle0.add_peer(*handle1.peer_id(), handle1.local_addr()); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let pool = testing_pool(); @@ -2066,7 +2066,7 @@ mod tests { let listener0 = handle0.event_listener(); handle0.add_peer(*handle1.peer_id(), handle1.local_addr()); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let pool = testing_pool(); @@ -2131,7 +2131,7 @@ mod tests { async fn test_handle_incoming_transactions_hashes() { reth_tracing::init_test_tracing(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let config = NetworkConfigBuilder::new(secret_key) @@ -2238,7 +2238,7 @@ mod tests { let listener0 = handle0.event_listener(); handle0.add_peer(*handle1.peer_id(), handle1.local_addr()); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let pool = testing_pool(); @@ -2314,7 +2314,7 @@ mod tests { let listener0 = handle0.event_listener(); handle0.add_peer(*handle1.peer_id(), handle1.local_addr()); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let pool = testing_pool(); diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index bb5ec9d02e2..6f492c406aa 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -3,7 +3,7 @@ //! announcements. Validation and filtering of announcements is network dependent. use crate::metrics::{AnnouncedTxTypesMetrics, TxTypesCounter}; -use alloy_primitives::{PrimitiveSignature as Signature, TxHash}; +use alloy_primitives::{Signature, TxHash}; use derive_more::{Deref, DerefMut}; use reth_eth_wire::{ DedupPayload, Eth68TxMetadata, HandleMempoolData, PartiallyValidData, ValidAnnouncementData, diff --git a/crates/net/network/tests/it/big_pooled_txs_req.rs b/crates/net/network/tests/it/big_pooled_txs_req.rs index da0a8b5c543..1db378606ba 100644 --- a/crates/net/network/tests/it/big_pooled_txs_req.rs +++ b/crates/net/network/tests/it/big_pooled_txs_req.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{PrimitiveSignature as Signature, B256}; +use alloy_primitives::{Signature, B256}; use reth_eth_wire::{GetPooledTransactions, PooledTransactions}; use reth_ethereum_primitives::TransactionSigned; use reth_network::{ diff --git a/crates/net/network/tests/it/connect.rs b/crates/net/network/tests/it/connect.rs index d5a0ed5915a..cedb41f63d0 100644 --- a/crates/net/network/tests/it/connect.rs +++ b/crates/net/network/tests/it/connect.rs @@ -93,7 +93,7 @@ async fn test_already_connected() { reth_tracing::init_test_tracing(); let mut net = Testnet::default(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let p1 = PeerConfig::default(); @@ -137,8 +137,8 @@ async fn test_get_peer() { reth_tracing::init_test_tracing(); let mut net = Testnet::default(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); - let secret_key_1 = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); + let secret_key_1 = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let p1 = PeerConfig::default(); @@ -171,8 +171,8 @@ async fn test_get_peer_by_id() { reth_tracing::init_test_tracing(); let mut net = Testnet::default(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); - let secret_key_1 = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); + let secret_key_1 = SecretKey::new(&mut rand_08::thread_rng()); let client = NoopProvider::default(); let p1 = PeerConfig::default(); let p2 = PeerConfig::with_secret_key(client.clone(), secret_key); @@ -204,7 +204,7 @@ async fn test_get_peer_by_id() { #[ignore] async fn test_connect_with_boot_nodes() { reth_tracing::init_test_tracing(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let mut discv4 = Discv4Config::builder(); discv4.add_boot_nodes(mainnet_nodes()); @@ -225,7 +225,7 @@ async fn test_connect_with_boot_nodes() { #[ignore] async fn test_connect_with_builder() { reth_tracing::init_test_tracing(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let mut discv4 = Discv4Config::builder(); discv4.add_boot_nodes(mainnet_nodes()); @@ -262,7 +262,7 @@ async fn test_connect_with_builder() { #[ignore] async fn test_connect_to_trusted_peer() { reth_tracing::init_test_tracing(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let discv4 = Discv4Config::builder(); let client = NoopProvider::default(); @@ -319,7 +319,7 @@ async fn test_connect_to_trusted_peer() { async fn test_incoming_node_id_blacklist() { reth_tracing::init_test_tracing(); tokio::time::timeout(GETH_TIMEOUT, async move { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); // instantiate geth and add ourselves as a peer let temp_dir = tempfile::tempdir().unwrap().into_path(); @@ -374,7 +374,7 @@ async fn test_incoming_node_id_blacklist() { async fn test_incoming_connect_with_single_geth() { reth_tracing::init_test_tracing(); tokio::time::timeout(GETH_TIMEOUT, async move { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); // instantiate geth and add ourselves as a peer let temp_dir = tempfile::tempdir().unwrap().into_path(); @@ -419,7 +419,7 @@ async fn test_incoming_connect_with_single_geth() { async fn test_outgoing_connect_with_single_geth() { reth_tracing::init_test_tracing(); tokio::time::timeout(GETH_TIMEOUT, async move { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::new(secret_key) .listener_port(0) @@ -466,7 +466,7 @@ async fn test_outgoing_connect_with_single_geth() { async fn test_geth_disconnect() { reth_tracing::init_test_tracing(); tokio::time::timeout(GETH_TIMEOUT, async move { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .listener_port(0) @@ -587,7 +587,7 @@ async fn test_trusted_peer_only() { drop(handles); let _handle = net.spawn(); - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let peers_config = PeersConfig::default().with_trusted_nodes_only(true); let config = NetworkConfigBuilder::eth(secret_key) @@ -639,7 +639,7 @@ async fn test_trusted_peer_only() { #[tokio::test(flavor = "multi_thread")] async fn test_network_state_change() { let net = Testnet::create(1).await; - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let peers_config = PeersConfig::default().with_refill_slots_interval(Duration::from_millis(500)); @@ -681,7 +681,7 @@ async fn test_network_state_change() { #[tokio::test(flavor = "multi_thread")] async fn test_exceed_outgoing_connections() { let net = Testnet::create(2).await; - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let peers_config = PeersConfig::default().with_max_outbound(1); let config = NetworkConfigBuilder::eth(secret_key) @@ -722,7 +722,7 @@ async fn test_exceed_outgoing_connections() { #[tokio::test(flavor = "multi_thread")] async fn test_disconnect_incoming_when_exceeded_incoming_connections() { let net = Testnet::create(1).await; - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let peers_config = PeersConfig::default().with_max_inbound(0); let config = NetworkConfigBuilder::eth(secret_key) @@ -838,7 +838,7 @@ async fn new_random_peer( max_in_bound: usize, trusted_nodes: Vec, ) -> NetworkManager { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let peers_config = PeersConfig::default().with_max_inbound(max_in_bound).with_trusted_nodes(trusted_nodes); @@ -909,7 +909,7 @@ async fn test_connect_peer_in_different_network_should_fail() { tokio::task::spawn(peer); // peer in sepolia. - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); // If the remote disconnect first, then we would not get a fatal protocol error. So set // max_backoff_count to 0 to speed up the removal of the peer. let peers_config = PeersConfig::default().with_max_backoff_count(0); diff --git a/crates/net/network/tests/it/multiplex.rs b/crates/net/network/tests/it/multiplex.rs index 36951f4c78d..d081100681a 100644 --- a/crates/net/network/tests/it/multiplex.rs +++ b/crates/net/network/tests/it/multiplex.rs @@ -283,7 +283,7 @@ async fn test_connect_to_non_multiplex_peer() { let net = Testnet::create(1).await; - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .listener_port(0) diff --git a/crates/net/network/tests/it/requests.rs b/crates/net/network/tests/it/requests.rs index 91ffce8a8ad..6557f762244 100644 --- a/crates/net/network/tests/it/requests.rs +++ b/crates/net/network/tests/it/requests.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use alloy_consensus::{Header, TxEip2930}; -use alloy_primitives::{Bytes, PrimitiveSignature as Signature, TxKind, U256}; +use alloy_primitives::{Bytes, Signature, TxKind, U256}; use rand::Rng; use reth_eth_wire::HeadersDirection; use reth_ethereum_primitives::{Block, Transaction, TransactionSigned}; @@ -22,12 +22,12 @@ use reth_provider::test_utils::MockEthProvider; /// Returns a new [`TransactionSigned`] with some random parameters pub fn rng_transaction(rng: &mut impl rand::RngCore) -> TransactionSigned { let request = Transaction::Eip2930(TxEip2930 { - chain_id: rng.gen(), - nonce: rng.gen(), - gas_price: rng.gen(), - gas_limit: rng.gen(), + chain_id: rng.random(), + nonce: rng.random(), + gas_price: rng.random(), + gas_limit: rng.random(), to: TxKind::Create, - value: U256::from(rng.gen::()), + value: U256::from(rng.random::()), input: Bytes::from(vec![1, 2]), access_list: Default::default(), }); @@ -39,7 +39,7 @@ pub fn rng_transaction(rng: &mut impl rand::RngCore) -> TransactionSigned { #[tokio::test(flavor = "multi_thread")] async fn test_get_body() { reth_tracing::init_test_tracing(); - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let mock_provider = Arc::new(MockEthProvider::default()); let mut net = Testnet::create_with(2, mock_provider.clone()).await; @@ -63,7 +63,7 @@ async fn test_get_body() { // request some blocks for _ in 0..100 { // Set a new random block to the mock storage and request it via the network - let block_hash = rng.gen(); + let block_hash = rng.random(); let mut block: Block = Block::default(); block.body.transactions.push(rng_transaction(&mut rng)); @@ -81,7 +81,7 @@ async fn test_get_body() { #[tokio::test(flavor = "multi_thread")] async fn test_get_header() { reth_tracing::init_test_tracing(); - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let mock_provider = Arc::new(MockEthProvider::default()); let mut net = Testnet::create_with(2, mock_provider.clone()).await; @@ -102,13 +102,13 @@ async fn test_get_header() { let connected = events0.next_session_established().await.unwrap(); assert_eq!(connected, *handle1.peer_id()); - let start: u64 = rng.gen(); - let mut hash = rng.gen(); + let start: u64 = rng.random(); + let mut hash = rng.random(); // request some headers for idx in 0..100 { // Set a new random header to the mock storage and request it via the network let header = Header { number: start + idx, parent_hash: hash, ..Default::default() }; - hash = rng.gen(); + hash = rng.random(); mock_provider.add_header(hash, header.clone()); diff --git a/crates/net/network/tests/it/startup.rs b/crates/net/network/tests/it/startup.rs index 5ed10d80518..9b9282e3b33 100644 --- a/crates/net/network/tests/it/startup.rs +++ b/crates/net/network/tests/it/startup.rs @@ -25,7 +25,7 @@ fn is_addr_in_use_kind(err: &NetworkError, kind: ServiceKind) -> bool { #[tokio::test(flavor = "multi_thread")] async fn test_is_default_syncing() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .disable_discovery() .listener_port(0) @@ -36,7 +36,7 @@ async fn test_is_default_syncing() { #[tokio::test(flavor = "multi_thread")] async fn test_listener_addr_in_use() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .disable_discovery() .listener_port(0) @@ -55,7 +55,7 @@ async fn test_listener_addr_in_use() { #[tokio::test(flavor = "multi_thread")] async fn test_discovery_addr_in_use() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let disc_config = Discv4Config::default(); let addr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, 0)); let any_port_listener = TcpListener::bind(addr).await.unwrap(); @@ -71,7 +71,7 @@ async fn test_discovery_addr_in_use() { // #[tokio::test(flavor = "multi_thread")] async fn test_tcp_port_node_record_no_discovery() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .listener_port(0) .disable_discovery() @@ -89,7 +89,7 @@ async fn test_tcp_port_node_record_no_discovery() { // #[tokio::test(flavor = "multi_thread")] async fn test_tcp_port_node_record_discovery() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .listener_port(0) .discovery_port(0) @@ -108,7 +108,7 @@ async fn test_tcp_port_node_record_discovery() { #[tokio::test(flavor = "multi_thread")] async fn test_node_record_address_with_nat() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .add_nat(Some(NatResolver::ExternalIp("10.1.1.1".parse().unwrap()))) .disable_discv4_discovery() @@ -124,7 +124,7 @@ async fn test_node_record_address_with_nat() { #[tokio::test(flavor = "multi_thread")] async fn test_node_record_address_with_nat_disable_discovery() { - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = SecretKey::new(&mut rand_08::thread_rng()); let config = NetworkConfigBuilder::eth(secret_key) .add_nat(Some(NatResolver::ExternalIp("10.1.1.1".parse().unwrap()))) .disable_discovery() diff --git a/crates/net/network/tests/it/transaction_hash_fetching.rs b/crates/net/network/tests/it/transaction_hash_fetching.rs index 7f1d7593a22..12376a6470e 100644 --- a/crates/net/network/tests/it/transaction_hash_fetching.rs +++ b/crates/net/network/tests/it/transaction_hash_fetching.rs @@ -1,5 +1,4 @@ use alloy_primitives::U256; -use rand::thread_rng; use reth_network::{ test_utils::Testnet, transactions::{TransactionPropagationMode::Max, TransactionsManagerConfig}, @@ -40,7 +39,7 @@ async fn transaction_hash_fetching() { let peer_pool = peer.pool().unwrap(); for _ in 0..num_tx_per_peer { - let mut gen = TransactionGenerator::new(thread_rng()); + let mut gen = TransactionGenerator::new(rand::rng()); let tx = gen.gen_eip1559_pooled(); let sender = tx.sender(); provider.add_account(sender, ExtendedAccount::new(0, U256::from(100_000_000))); diff --git a/crates/net/network/tests/it/txgossip.rs b/crates/net/network/tests/it/txgossip.rs index c794d232423..bbe985beaf6 100644 --- a/crates/net/network/tests/it/txgossip.rs +++ b/crates/net/network/tests/it/txgossip.rs @@ -3,9 +3,8 @@ use std::sync::Arc; use alloy_consensus::TxLegacy; -use alloy_primitives::{PrimitiveSignature as Signature, U256}; +use alloy_primitives::{Signature, U256}; use futures::StreamExt; -use rand::thread_rng; use reth_ethereum_primitives::TransactionSigned; use reth_network::{test_utils::Testnet, NetworkEvent, NetworkEventListenerProvider}; use reth_network_api::{events::PeerEvent, PeersInfo}; @@ -33,7 +32,7 @@ async fn test_tx_gossip() { let mut peer0_tx_listener = peer0.pool().unwrap().pending_transactions_listener(); let mut peer1_tx_listener = peer1.pool().unwrap().pending_transactions_listener(); - let mut gen = TransactionGenerator::new(thread_rng()); + let mut gen = TransactionGenerator::new(rand::rng()); let tx = gen.gen_eip1559_pooled(); // ensure the sender has balance @@ -70,7 +69,7 @@ async fn test_4844_tx_gossip_penalization() { let mut peer1_tx_listener = peer1.pool().unwrap().pending_transactions_listener(); - let mut gen = TransactionGenerator::new(thread_rng()); + let mut gen = TransactionGenerator::new(rand::rng()); // peer 0 will be penalized for sending txs[0] over gossip let txs = vec![gen.gen_eip4844_pooled(), gen.gen_eip1559_pooled()]; diff --git a/crates/net/peers/Cargo.toml b/crates/net/peers/Cargo.toml index bbdb511650c..63bdb344f05 100644 --- a/crates/net/peers/Cargo.toml +++ b/crates/net/peers/Cargo.toml @@ -33,6 +33,7 @@ secp256k1 = { workspace = true, features = ["rand"] } serde_json.workspace = true enr.workspace = true tokio = { workspace = true, features = ["net", "macros", "rt"] } +rand_08.workspace = true [features] default = ["std"] diff --git a/crates/net/peers/src/lib.rs b/crates/net/peers/src/lib.rs index 02df48318af..998fab3a10f 100644 --- a/crates/net/peers/src/lib.rs +++ b/crates/net/peers/src/lib.rs @@ -327,7 +327,7 @@ mod tests { #[test] #[cfg(feature = "secp256k1")] fn pk2id2pk() { - let prikey = secp256k1::SecretKey::new(&mut rand::thread_rng()); + let prikey = secp256k1::SecretKey::new(&mut rand_08::thread_rng()); let pubkey = secp256k1::PublicKey::from_secret_key(secp256k1::SECP256K1, &prikey); assert_eq!(pubkey, id2pk(pk2id(&pubkey)).unwrap()); } diff --git a/crates/net/peers/src/node_record.rs b/crates/net/peers/src/node_record.rs index 6cf91cb9e41..d9f10ebdbe7 100644 --- a/crates/net/peers/src/node_record.rs +++ b/crates/net/peers/src/node_record.rs @@ -236,21 +236,21 @@ impl TryFrom<&Enr> for NodeRecord { mod tests { use super::*; use alloy_rlp::Decodable; - use rand::{thread_rng, Rng, RngCore}; + use rand::{rng, Rng, RngCore}; use std::net::Ipv6Addr; #[test] fn test_mapped_ipv6() { - let mut rng = thread_rng(); + let mut rng = rng(); let v4: Ipv4Addr = "0.0.0.0".parse().unwrap(); let v6 = v4.to_ipv6_mapped(); let record = NodeRecord { address: v6.into(), - tcp_port: rng.gen(), - udp_port: rng.gen(), - id: rng.gen(), + tcp_port: rng.random(), + udp_port: rng.random(), + id: rng.random(), }; assert!(record.clone().convert_ipv4_mapped()); @@ -259,14 +259,14 @@ mod tests { #[test] fn test_mapped_ipv4() { - let mut rng = thread_rng(); + let mut rng = rng(); let v4: Ipv4Addr = "0.0.0.0".parse().unwrap(); let record = NodeRecord { address: v4.into(), - tcp_port: rng.gen(), - udp_port: rng.gen(), - id: rng.gen(), + tcp_port: rng.random(), + udp_port: rng.random(), + id: rng.random(), }; assert!(!record.clone().convert_ipv4_mapped()); @@ -275,15 +275,15 @@ mod tests { #[test] fn test_noderecord_codec_ipv4() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 4]; rng.fill_bytes(&mut ip); let record = NodeRecord { address: IpAddr::V4(ip.into()), - tcp_port: rng.gen(), - udp_port: rng.gen(), - id: rng.gen(), + tcp_port: rng.random(), + udp_port: rng.random(), + id: rng.random(), }; let decoded = NodeRecord::decode(&mut alloy_rlp::encode(record).as_slice()).unwrap(); @@ -293,15 +293,15 @@ mod tests { #[test] fn test_noderecord_codec_ipv6() { - let mut rng = thread_rng(); + let mut rng = rng(); for _ in 0..100 { let mut ip = [0u8; 16]; rng.fill_bytes(&mut ip); let record = NodeRecord { address: IpAddr::V6(ip.into()), - tcp_port: rng.gen(), - udp_port: rng.gen(), - id: rng.gen(), + tcp_port: rng.random(), + udp_port: rng.random(), + id: rng.random(), }; let decoded = NodeRecord::decode(&mut alloy_rlp::encode(record).as_slice()).unwrap(); diff --git a/crates/node/core/src/args/rpc_server.rs b/crates/node/core/src/args/rpc_server.rs index aa541138aba..f83adea2082 100644 --- a/crates/node/core/src/args/rpc_server.rs +++ b/crates/node/core/src/args/rpc_server.rs @@ -282,11 +282,8 @@ impl RpcServerArgs { /// Append a random string to the ipc path, to prevent possible collisions when multiple nodes /// are being run on the same machine. pub fn with_ipc_random_path(mut self) -> Self { - let random_string: String = rand::thread_rng() - .sample_iter(rand::distributions::Alphanumeric) - .take(8) - .map(char::from) - .collect(); + let random_string: String = + rand::rng().sample_iter(rand::distr::Alphanumeric).take(8).map(char::from).collect(); self.ipcpath = format!("{}-{}", self.ipcpath, random_string); self } diff --git a/crates/optimism/cli/src/ovm_file_codec.rs b/crates/optimism/cli/src/ovm_file_codec.rs index 9de7dccd6d3..62d0b254045 100644 --- a/crates/optimism/cli/src/ovm_file_codec.rs +++ b/crates/optimism/cli/src/ovm_file_codec.rs @@ -9,7 +9,7 @@ use alloy_eips::{ }; use alloy_primitives::{ bytes::{Buf, BytesMut}, - keccak256, PrimitiveSignature as Signature, TxHash, B256, U256, + keccak256, Signature, TxHash, B256, U256, }; use alloy_rlp::{Decodable, Error as RlpError, RlpDecodable}; use derive_more::{AsRef, Deref}; diff --git a/crates/optimism/evm/src/execute.rs b/crates/optimism/evm/src/execute.rs index f4dd3b227fb..09c05cd4dec 100644 --- a/crates/optimism/evm/src/execute.rs +++ b/crates/optimism/evm/src/execute.rs @@ -24,9 +24,7 @@ mod tests { use super::*; use crate::OpChainSpec; use alloy_consensus::{Block, BlockBody, Header, TxEip1559}; - use alloy_primitives::{ - b256, Address, PrimitiveSignature as Signature, StorageKey, StorageValue, U256, - }; + use alloy_primitives::{b256, Address, Signature, StorageKey, StorageValue, U256}; use op_alloy_consensus::{OpTypedTransaction, TxDeposit}; use op_revm::constants::L1_BLOCK_CONTRACT; use reth_chainspec::MIN_TRANSACTION_GAS; diff --git a/crates/optimism/payload/src/builder.rs b/crates/optimism/payload/src/builder.rs index d8663a1e5c6..3dd7553ef55 100644 --- a/crates/optimism/payload/src/builder.rs +++ b/crates/optimism/payload/src/builder.rs @@ -384,7 +384,7 @@ impl OpBuilder<'_, Txs> { let ExecutionWitnessRecord { hashed_state, codes, keys } = ExecutionWitnessRecord::from_executed_state(&db); let state = state_provider.witness(Default::default(), hashed_state)?; - Ok(ExecutionWitness { state: state.into_iter().collect(), codes, keys }) + Ok(ExecutionWitness { state: state.into_iter().collect(), codes, keys, headers: vec![] }) } } diff --git a/crates/optimism/primitives/Cargo.toml b/crates/optimism/primitives/Cargo.toml index ec76e79f342..7850547e747 100644 --- a/crates/optimism/primitives/Cargo.toml +++ b/crates/optimism/primitives/Cargo.toml @@ -41,7 +41,7 @@ serde_with = { workspace = true, optional = true } # misc derive_more = { workspace = true, features = ["deref", "from", "into", "constructor"] } -rand = { workspace = true, optional = true } +rand_08 = { workspace = true, optional = true } # test arbitrary = { workspace = true, features = ["derive"], optional = true } @@ -52,6 +52,7 @@ arbitrary.workspace = true proptest-arbitrary-interop.workspace = true proptest.workspace = true rand.workspace = true +rand_08.workspace = true reth-codecs = { workspace = true, features = ["test-utils", "op"] } rstest.workspace = true secp256k1 = { workspace = true, features = ["rand"] } @@ -101,11 +102,12 @@ serde = [ "bytes?/serde", "reth-codecs?/serde", "op-alloy-consensus/serde", - "rand?/serde", + "rand_08?/serde", "secp256k1?/serde", "op-revm/serde", "alloy-rpc-types-eth?/serde", "revm-context/serde", + "rand/serde", ] serde-bincode-compat = [ "serde", @@ -126,7 +128,7 @@ arbitrary = [ "alloy-consensus/arbitrary", "alloy-eips/arbitrary", "alloy-primitives/arbitrary", - "rand", + "rand_08", "alloy-rpc-types-eth?/arbitrary", "alloy-serde?/arbitrary", ] diff --git a/crates/optimism/primitives/src/receipt.rs b/crates/optimism/primitives/src/receipt.rs index a44fd4de412..b96b7603e93 100644 --- a/crates/optimism/primitives/src/receipt.rs +++ b/crates/optimism/primitives/src/receipt.rs @@ -439,7 +439,7 @@ pub(super) mod serde_bincode_compat { } let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); + rand::rng().fill(bytes.as_mut_slice()); let mut data = Data { reseipt: OpReceipt::arbitrary(&mut arbitrary::Unstructured::new(&bytes)).unwrap(), }; diff --git a/crates/optimism/primitives/src/transaction/signed.rs b/crates/optimism/primitives/src/transaction/signed.rs index 8620ccbfc68..1933041d2f3 100644 --- a/crates/optimism/primitives/src/transaction/signed.rs +++ b/crates/optimism/primitives/src/transaction/signed.rs @@ -13,9 +13,7 @@ use alloy_eips::{ eip7702::SignedAuthorization, }; use alloy_evm::{FromRecoveredTx, FromTxWithEncoded}; -use alloy_primitives::{ - keccak256, Address, Bytes, PrimitiveSignature as Signature, TxHash, TxKind, Uint, B256, -}; +use alloy_primitives::{keccak256, Address, Bytes, Signature, TxHash, TxKind, Uint, B256}; use alloy_rlp::Header; use core::{ hash::{Hash, Hasher}, @@ -650,7 +648,7 @@ impl<'a> arbitrary::Arbitrary<'a> for OpTransactionSigned { let mut transaction = OpTypedTransaction::arbitrary(u)?; let secp = secp256k1::Secp256k1::new(); - let key_pair = secp256k1::Keypair::new(&secp, &mut rand::thread_rng()); + let key_pair = secp256k1::Keypair::new(&secp, &mut rand_08::thread_rng()); let signature = reth_primitives_traits::crypto::secp256k1::sign_message( B256::from_slice(&key_pair.secret_bytes()[..]), signature_hash(&transaction), @@ -730,7 +728,7 @@ pub mod serde_bincode_compat { use alloy_consensus::transaction::serde_bincode_compat::{ TxEip1559, TxEip2930, TxEip7702, TxLegacy, }; - use alloy_primitives::{PrimitiveSignature as Signature, TxHash}; + use alloy_primitives::{Signature, TxHash}; use reth_primitives_traits::{serde_bincode_compat::SerdeBincodeCompat, SignedTransaction}; use serde::{Deserialize, Serialize}; diff --git a/crates/optimism/rpc/src/eth/transaction.rs b/crates/optimism/rpc/src/eth/transaction.rs index 240b451e852..0cc7f4f46a2 100644 --- a/crates/optimism/rpc/src/eth/transaction.rs +++ b/crates/optimism/rpc/src/eth/transaction.rs @@ -1,7 +1,7 @@ //! Loads and formats OP transaction RPC response. use alloy_consensus::{transaction::Recovered, Transaction as _}; -use alloy_primitives::{Bytes, PrimitiveSignature as Signature, Sealable, Sealed, B256}; +use alloy_primitives::{Bytes, Sealable, Sealed, Signature, B256}; use alloy_rpc_types_eth::TransactionInfo; use op_alloy_consensus::OpTxEnvelope; use op_alloy_rpc_types::{OpTransactionRequest, Transaction}; diff --git a/crates/optimism/txpool/src/transaction.rs b/crates/optimism/txpool/src/transaction.rs index 4342925fc41..59b1d5dc380 100644 --- a/crates/optimism/txpool/src/transaction.rs +++ b/crates/optimism/txpool/src/transaction.rs @@ -284,7 +284,7 @@ mod tests { use crate::{OpPooledTransaction, OpTransactionValidator}; use alloy_consensus::transaction::Recovered; use alloy_eips::eip2718::Encodable2718; - use alloy_primitives::{PrimitiveSignature as Signature, TxKind, U256}; + use alloy_primitives::{Signature, TxKind, U256}; use op_alloy_consensus::{OpTypedTransaction, TxDeposit}; use reth_optimism_chainspec::OP_MAINNET; use reth_optimism_primitives::OpTransactionSigned; diff --git a/crates/primitives-traits/Cargo.toml b/crates/primitives-traits/Cargo.toml index 449e0c97715..14747109ebe 100644 --- a/crates/primitives-traits/Cargo.toml +++ b/crates/primitives-traits/Cargo.toml @@ -66,6 +66,7 @@ byteorder.workspace = true proptest-arbitrary-interop.workspace = true proptest.workspace = true rand.workspace = true +rand_08.workspace = true serde.workspace = true serde_json.workspace = true test-fuzz.workspace = true @@ -141,6 +142,7 @@ serde = [ "alloy-trie/serde", "revm-bytecode/serde", "revm-state/serde", + "rand_08/serde", ] reth-codec = [ "dep:reth-codecs", diff --git a/crates/primitives-traits/src/crypto.rs b/crates/primitives-traits/src/crypto.rs index 4afbdf42406..f80df6b4d27 100644 --- a/crates/primitives-traits/src/crypto.rs +++ b/crates/primitives-traits/src/crypto.rs @@ -167,7 +167,7 @@ mod tests { fn sanity_ecrecover_call_secp256k1() { use super::impl_secp256k1::*; - let (secret, public) = secp256k1::generate_keypair(&mut rand::thread_rng()); + let (secret, public) = secp256k1::generate_keypair(&mut rand_08::thread_rng()); let signer = public_key_to_address(public); let message = b"hello world"; @@ -210,7 +210,7 @@ mod tests { use super::{impl_k256, impl_secp256k1}; let (secp256k1_secret, secp256k1_public) = - secp256k1::generate_keypair(&mut rand::thread_rng()); + secp256k1::generate_keypair(&mut rand_08::thread_rng()); let k256_secret = k256::ecdsa::SigningKey::from_slice(&secp256k1_secret.secret_bytes()) .expect("k256 secret"); let k256_public = *k256_secret.verifying_key(); diff --git a/crates/primitives-traits/src/header/sealed.rs b/crates/primitives-traits/src/header/sealed.rs index dc59c1f06eb..eebdf5191f7 100644 --- a/crates/primitives-traits/src/header/sealed.rs +++ b/crates/primitives-traits/src/header/sealed.rs @@ -325,7 +325,7 @@ pub(super) mod serde_bincode_compat { } let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(&mut bytes[..]); + rand::rng().fill(&mut bytes[..]); let data = Data { transaction: SealedHeader::arbitrary(&mut arbitrary::Unstructured::new(&bytes)) .unwrap(), diff --git a/crates/primitives-traits/src/size.rs b/crates/primitives-traits/src/size.rs index 99471b0da80..0e3ad45aaa5 100644 --- a/crates/primitives-traits/src/size.rs +++ b/crates/primitives-traits/src/size.rs @@ -4,7 +4,7 @@ use alloy_consensus::{ TxEip4844WithSidecar, TxEip7702, TxLegacy, TxType, }; use alloy_eips::eip4895::Withdrawals; -use alloy_primitives::{PrimitiveSignature as Signature, TxHash, B256}; +use alloy_primitives::{Signature, TxHash, B256}; use revm_primitives::Log; /// Trait for calculating a heuristic for the in-memory size of a struct. diff --git a/crates/primitives-traits/src/transaction/signature.rs b/crates/primitives-traits/src/transaction/signature.rs index acc77fe4495..2e994f1e5f4 100644 --- a/crates/primitives-traits/src/transaction/signature.rs +++ b/crates/primitives-traits/src/transaction/signature.rs @@ -1,12 +1,12 @@ //! Signature types and helpers /// Re-exported signature type -pub use alloy_primitives::PrimitiveSignature as Signature; +pub use alloy_primitives::Signature; #[cfg(test)] mod tests { use crate::crypto::secp256k1::recover_signer; - use alloy_primitives::{address, PrimitiveSignature as Signature, B256, U256}; + use alloy_primitives::{address, Signature, B256, U256}; use std::str::FromStr; #[test] diff --git a/crates/primitives-traits/src/transaction/signed.rs b/crates/primitives-traits/src/transaction/signed.rs index 9e51c24a6e1..f6698ba95b1 100644 --- a/crates/primitives-traits/src/transaction/signed.rs +++ b/crates/primitives-traits/src/transaction/signed.rs @@ -10,7 +10,7 @@ use alloy_consensus::{ EthereumTxEnvelope, SignableTransaction, }; use alloy_eips::eip2718::{Decodable2718, Encodable2718}; -use alloy_primitives::{keccak256, Address, PrimitiveSignature as Signature, TxHash, B256}; +use alloy_primitives::{keccak256, Address, Signature, TxHash, B256}; use alloy_rlp::{Decodable, Encodable}; use core::hash::Hash; diff --git a/crates/rpc/ipc/src/server/mod.rs b/crates/rpc/ipc/src/server/mod.rs index 69dbcb283a4..310764b426a 100644 --- a/crates/rpc/ipc/src/server/mod.rs +++ b/crates/rpc/ipc/src/server/mod.rs @@ -792,7 +792,8 @@ impl Builder { #[cfg(test)] #[expect(missing_docs)] pub fn dummy_name() -> String { - let num: u64 = rand::Rng::gen(&mut rand::thread_rng()); + use rand::Rng; + let num: u64 = rand::rng().random(); if cfg!(windows) { format!(r"\\.\pipe\my-pipe-{}", num) } else { diff --git a/crates/rpc/rpc-engine-api/tests/it/payload.rs b/crates/rpc/rpc-engine-api/tests/it/payload.rs index c7eae89ff55..477fda2b1f5 100644 --- a/crates/rpc/rpc-engine-api/tests/it/payload.rs +++ b/crates/rpc/rpc-engine-api/tests/it/payload.rs @@ -52,7 +52,7 @@ fn payload_body_roundtrip() { #[test] fn payload_validation_conversion() { let mut rng = generators::rng(); - let parent = rng.gen(); + let parent = rng.random(); let block = random_block( &mut rng, 100, diff --git a/crates/rpc/rpc-eth-api/src/helpers/signer.rs b/crates/rpc/rpc-eth-api/src/helpers/signer.rs index 85c95414765..62f8b75b869 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/signer.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/signer.rs @@ -1,7 +1,7 @@ //! An abstraction over ethereum signers. use alloy_dyn_abi::TypedData; -use alloy_primitives::{Address, PrimitiveSignature as Signature}; +use alloy_primitives::{Address, Signature}; use alloy_rpc_types_eth::TransactionRequest; use dyn_clone::DynClone; use reth_rpc_eth_types::SignError; diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index a5a73e85423..68798b8c348 100644 --- a/crates/rpc/rpc/Cargo.toml +++ b/crates/rpc/rpc/Cargo.toml @@ -83,7 +83,6 @@ parking_lot.workspace = true tracing.workspace = true tracing-futures.workspace = true futures.workspace = true -rand.workspace = true serde.workspace = true thiserror.workspace = true derive_more.workspace = true @@ -95,6 +94,7 @@ reth-transaction-pool = { workspace = true, features = ["test-utils"] } reth-provider = { workspace = true, features = ["test-utils"] } alloy-consensus.workspace = true +rand.workspace = true jsonrpsee-types.workspace = true jsonrpsee = { workspace = true, features = ["client"] } diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index eba7e0a1981..c890318e833 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -649,7 +649,7 @@ where let state = state_provider .witness(Default::default(), hashed_state) .map_err(EthApiError::from)?; - Ok(ExecutionWitness { state, codes, keys }) + Ok(ExecutionWitness { state, codes, keys, headers: vec![] }) }) .await } diff --git a/crates/rpc/rpc/src/eth/core.rs b/crates/rpc/rpc/src/eth/core.rs index e4d7bf6ef2b..fe1f8bdcd4c 100644 --- a/crates/rpc/rpc/src/eth/core.rs +++ b/crates/rpc/rpc/src/eth/core.rs @@ -465,9 +465,10 @@ mod tests { use crate::{EthApi, EthApiBuilder}; use alloy_consensus::{Block, BlockBody, Header}; use alloy_eips::BlockNumberOrTag; - use alloy_primitives::{PrimitiveSignature as Signature, B256, U64}; + use alloy_primitives::{Signature, B256, U64}; use alloy_rpc_types::FeeHistory; use jsonrpsee_types::error::INVALID_PARAMS_CODE; + use rand::Rng; use reth_chain_state::CanonStateSubscriptions; use reth_chainspec::{BaseFeeParams, ChainSpec, ChainSpecProvider}; use reth_ethereum_primitives::TransactionSigned; @@ -476,7 +477,7 @@ mod tests { use reth_provider::test_utils::{MockEthProvider, NoopProvider}; use reth_rpc_eth_api::EthApiServer; use reth_storage_api::{BlockReader, BlockReaderIdExt, StateProviderFactory}; - use reth_testing_utils::{generators, generators::Rng}; + use reth_testing_utils::generators; use reth_transaction_pool::test_utils::{testing_pool, TestPool}; fn build_test_eth_api< @@ -519,11 +520,12 @@ mod tests { let mut parent_hash = B256::default(); for i in (0..block_count).rev() { - let hash = rng.gen(); + let hash = rng.random(); // Note: Generates saner values to avoid invalid overflows later - let gas_limit = rng.gen::() as u64; - let base_fee_per_gas: Option = rng.gen::().then(|| rng.gen::() as u64); - let gas_used = rng.gen::() as u64; + let gas_limit = rng.random::() as u64; + let base_fee_per_gas: Option = + rng.random::().then(|| rng.random::() as u64); + let gas_used = rng.random::() as u64; let header = Header { number: newest_block - i, @@ -539,7 +541,7 @@ mod tests { const TOTAL_TRANSACTIONS: usize = 100; let mut transactions = Vec::with_capacity(TOTAL_TRANSACTIONS); for _ in 0..TOTAL_TRANSACTIONS { - let random_fee: u128 = rng.gen(); + let random_fee: u128 = rng.random(); if let Some(base_fee_per_gas) = header.base_fee_per_gas { let transaction = TransactionSigned::new_unhashed( diff --git a/crates/rpc/rpc/src/eth/filter.rs b/crates/rpc/rpc/src/eth/filter.rs index 96a10b484c5..ab3ba1150fd 100644 --- a/crates/rpc/rpc/src/eth/filter.rs +++ b/crates/rpc/rpc/src/eth/filter.rs @@ -807,9 +807,9 @@ mod tests { fn test_block_range_iter() { let mut rng = generators::rng(); - let start = rng.gen::() as u64; - let end = start.saturating_add(rng.gen::() as u64); - let step = rng.gen::() as u64; + let start = rng.random::() as u64; + let end = start.saturating_add(rng.random::() as u64); + let step = rng.random::() as u64; let range = start..=end; let mut iter = BlockRangeInclusiveIter::new(range.clone(), step); let (from, mut end) = iter.next().unwrap(); diff --git a/crates/rpc/rpc/src/eth/helpers/signer.rs b/crates/rpc/rpc/src/eth/helpers/signer.rs index 4e74ccd0f5b..01a07c4436d 100644 --- a/crates/rpc/rpc/src/eth/helpers/signer.rs +++ b/crates/rpc/rpc/src/eth/helpers/signer.rs @@ -6,7 +6,7 @@ use crate::EthApi; use alloy_dyn_abi::TypedData; use alloy_eips::eip2718::Decodable2718; use alloy_network::{eip2718::Encodable2718, EthereumWallet, TransactionBuilder}; -use alloy_primitives::{eip191_hash_message, Address, PrimitiveSignature as Signature, B256}; +use alloy_primitives::{eip191_hash_message, Address, Signature, B256}; use alloy_rpc_types_eth::TransactionRequest; use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; @@ -43,7 +43,7 @@ impl DevSigner { pub fn random_signers(num: u32) -> Vec + 'static>> { let mut signers = Vec::with_capacity(num as usize); for _ in 0..num { - let sk = PrivateKeySigner::random_with(&mut rand::thread_rng()); + let sk = PrivateKeySigner::random(); let address = sk.address(); let addresses = vec![address]; diff --git a/crates/rpc/rpc/src/eth/helpers/types.rs b/crates/rpc/rpc/src/eth/helpers/types.rs index f40625e0a3f..d75116003b3 100644 --- a/crates/rpc/rpc/src/eth/helpers/types.rs +++ b/crates/rpc/rpc/src/eth/helpers/types.rs @@ -2,7 +2,7 @@ use alloy_consensus::{Transaction as _, TxEnvelope}; use alloy_network::{Ethereum, Network}; -use alloy_primitives::PrimitiveSignature as Signature; +use alloy_primitives::Signature; use alloy_rpc_types::TransactionRequest; use alloy_rpc_types_eth::{Transaction, TransactionInfo}; use reth_ethereum_primitives::TransactionSigned; diff --git a/crates/stages/stages/src/stages/hashing_storage.rs b/crates/stages/stages/src/stages/hashing_storage.rs index 9c911e1657a..23c5f6aab4d 100644 --- a/crates/stages/stages/src/stages/hashing_storage.rs +++ b/crates/stages/stages/src/stages/hashing_storage.rs @@ -362,13 +362,14 @@ mod tests { )?; tx.put::(next_tx_num, transaction.clone())?; - let (addr, _) = - accounts.get_mut(rng.gen::() % n_accounts as usize).unwrap(); + let (addr, _) = accounts + .get_mut((rng.random::() % n_accounts) as usize) + .unwrap(); for _ in 0..2 { let new_entry = StorageEntry { - key: keccak256([rng.gen::()]), - value: U256::from(rng.gen::() % 30 + 1), + key: keccak256([rng.random::()]), + value: U256::from(rng.random::() % 30 + 1), }; self.insert_storage_entry( tx, @@ -384,14 +385,14 @@ mod tests { )?; // Randomize rewards - let has_reward: bool = rng.gen(); + let has_reward: bool = rng.random(); if has_reward { self.insert_storage_entry( tx, (block_number, Address::random()).into(), StorageEntry { key: keccak256("mining"), - value: U256::from(rng.gen::()), + value: U256::from(rng.random::()), }, progress.number == stage_progress, )?; diff --git a/crates/stages/types/src/checkpoints.rs b/crates/stages/types/src/checkpoints.rs index 51dc84ad9b9..9addc6bd6af 100644 --- a/crates/stages/types/src/checkpoints.rs +++ b/crates/stages/types/src/checkpoints.rs @@ -412,13 +412,13 @@ mod tests { #[test] fn merkle_checkpoint_roundtrip() { - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let checkpoint = MerkleCheckpoint { - target_block: rng.gen(), - last_account_key: rng.gen(), + target_block: rng.random(), + last_account_key: rng.random(), walker_stack: vec![StoredSubNode { key: B256::random_with(&mut rng).to_vec(), - nibble: Some(rng.gen()), + nibble: Some(rng.random()), node: None, }], state: HashBuilderState::default(), diff --git a/crates/storage/codecs/derive/src/arbitrary.rs b/crates/storage/codecs/derive/src/arbitrary.rs index 23d9bc63ce1..5713bb9b0ff 100644 --- a/crates/storage/codecs/derive/src/arbitrary.rs +++ b/crates/storage/codecs/derive/src/arbitrary.rs @@ -68,7 +68,7 @@ pub fn maybe_generate_tests( // get random instance of type let mut raw = vec![0u8; 1024]; - rand::thread_rng().fill_bytes(&mut raw); + rand::rng().fill_bytes(&mut raw); let mut unstructured = arbitrary::Unstructured::new(&raw[..]); let val: Result = arbitrary::Arbitrary::arbitrary(&mut unstructured); if val.is_err() { diff --git a/crates/storage/codecs/src/alloy/authorization_list.rs b/crates/storage/codecs/src/alloy/authorization_list.rs index 1322cd11dc1..1816d3dc202 100644 --- a/crates/storage/codecs/src/alloy/authorization_list.rs +++ b/crates/storage/codecs/src/alloy/authorization_list.rs @@ -84,7 +84,7 @@ mod tests { address: address!("0xdac17f958d2ee523a2206206994597c13d831ec7"), nonce: 1, } - .into_signed(alloy_primitives::PrimitiveSignature::new( + .into_signed(alloy_primitives::Signature::new( b256!("0x1fd474b1f9404c0c5df43b7620119ffbc3a1c3f942c73b6e14e9f55255ed9b1d").into(), b256!("0x29aca24813279a901ec13b5f7bb53385fa1fc627b946592221417ff74a49600d").into(), false, diff --git a/crates/storage/codecs/src/alloy/signature.rs b/crates/storage/codecs/src/alloy/signature.rs index b8fd19cf35a..a7a4614c3cf 100644 --- a/crates/storage/codecs/src/alloy/signature.rs +++ b/crates/storage/codecs/src/alloy/signature.rs @@ -1,7 +1,7 @@ //! Compact implementation for [`Signature`] use crate::Compact; -use alloy_primitives::{PrimitiveSignature as Signature, U256}; +use alloy_primitives::{Signature, U256}; impl Compact for Signature { fn to_compact(&self, buf: &mut B) -> usize diff --git a/crates/storage/codecs/src/alloy/transaction/ethereum.rs b/crates/storage/codecs/src/alloy/transaction/ethereum.rs index 0c7901433c2..64317210c00 100644 --- a/crates/storage/codecs/src/alloy/transaction/ethereum.rs +++ b/crates/storage/codecs/src/alloy/transaction/ethereum.rs @@ -3,7 +3,7 @@ use alloy_consensus::{ transaction::RlpEcdsaEncodableTx, EthereumTxEnvelope, Signed, Transaction, TxEip1559, TxEip2930, TxEip7702, TxLegacy, TxType, }; -use alloy_primitives::PrimitiveSignature; +use alloy_primitives::Signature; use bytes::{Buf, BufMut}; /// A trait for extracting transaction without type and signature and serializing it using @@ -42,7 +42,7 @@ pub(super) trait FromTxCompact { fn from_tx_compact( buf: &[u8], tx_type: Self::TxType, - signature: PrimitiveSignature, + signature: Signature, ) -> (Self, &[u8]) where Self: Sized; @@ -66,7 +66,7 @@ impl FromTxCompact for EthereumTxEnvelope (Self, &[u8]) { match tx_type { TxType::Legacy => { @@ -99,14 +99,14 @@ impl FromTxCompact for EthereumTxEnvelope { - fn signature(&self) -> &PrimitiveSignature; + fn signature(&self) -> &Signature; fn tx_type(&self) -> Self::TxType; } impl Envelope for EthereumTxEnvelope { - fn signature(&self) -> &PrimitiveSignature { + fn signature(&self) -> &Signature { Self::signature(self) } @@ -184,7 +184,7 @@ impl CompactEnvelope for let tx_bits = (flags & 0b110) >> 1; let zstd_bit = flags >> 3; - let (signature, buf) = PrimitiveSignature::from_compact(buf, sig_bit); + let (signature, buf) = Signature::from_compact(buf, sig_bit); let (tx_type, buf) = T::TxType::from_compact(buf, tx_bits); let (transaction, buf) = if zstd_bit != 0 { diff --git a/crates/storage/codecs/src/alloy/transaction/optimism.rs b/crates/storage/codecs/src/alloy/transaction/optimism.rs index 8f67fe45359..f40dd76d5fc 100644 --- a/crates/storage/codecs/src/alloy/transaction/optimism.rs +++ b/crates/storage/codecs/src/alloy/transaction/optimism.rs @@ -12,7 +12,7 @@ use crate::{ use alloy_consensus::{ constants::EIP7702_TX_TYPE_ID, Signed, TxEip1559, TxEip2930, TxEip7702, TxLegacy, }; -use alloy_primitives::{Address, Bytes, PrimitiveSignature, Sealed, TxKind, B256, U256}; +use alloy_primitives::{Address, Bytes, Signature, Sealed, TxKind, B256, U256}; use bytes::BufMut; use op_alloy_consensus::{OpTxEnvelope, OpTxType, OpTypedTransaction, TxDeposit as AlloyTxDeposit}; use reth_codecs_derive::add_arbitrary_tests; @@ -186,7 +186,7 @@ impl FromTxCompact for OpTxEnvelope { fn from_tx_compact( buf: &[u8], tx_type: OpTxType, - signature: PrimitiveSignature, + signature: Signature, ) -> (Self, &[u8]) { match tx_type { OpTxType::Legacy => { @@ -218,11 +218,11 @@ impl FromTxCompact for OpTxEnvelope { } } -const DEPOSIT_SIGNATURE: PrimitiveSignature = - PrimitiveSignature::new(U256::ZERO, U256::ZERO, false); +const DEPOSIT_SIGNATURE: Signature = + Signature::new(U256::ZERO, U256::ZERO, false); impl Envelope for OpTxEnvelope { - fn signature(&self) -> &PrimitiveSignature { + fn signature(&self) -> &Signature { match self { Self::Legacy(tx) => tx.signature(), Self::Eip2930(tx) => tx.signature(), diff --git a/crates/storage/codecs/src/alloy/trie.rs b/crates/storage/codecs/src/alloy/trie.rs index cc5273dd027..4c3baf488b1 100644 --- a/crates/storage/codecs/src/alloy/trie.rs +++ b/crates/storage/codecs/src/alloy/trie.rs @@ -67,7 +67,7 @@ impl Compact for BranchNodeCompact { buf.put_slice(root_hash.as_slice()); } - for hash in &self.hashes { + for hash in self.hashes.iter() { buf_size += B256::len_bytes(); buf.put_slice(hash.as_slice()); } diff --git a/crates/storage/db-api/src/models/accounts.rs b/crates/storage/db-api/src/models/accounts.rs index 94922632129..ad6e37e0ecb 100644 --- a/crates/storage/db-api/src/models/accounts.rs +++ b/crates/storage/db-api/src/models/accounts.rs @@ -107,7 +107,7 @@ impl_fixed_arbitrary!((BlockNumberAddress, 28), (AddressStorageKey, 52)); #[cfg(test)] mod tests { use super::*; - use rand::{thread_rng, Rng}; + use rand::{rng, Rng}; use std::str::FromStr; #[test] @@ -130,7 +130,7 @@ mod tests { #[test] fn test_block_number_address_rand() { let mut bytes = [0u8; 28]; - thread_rng().fill(bytes.as_mut_slice()); + rng().fill(bytes.as_mut_slice()); let key = BlockNumberAddress::arbitrary(&mut Unstructured::new(&bytes)).unwrap(); assert_eq!(bytes, Encode::encode(key)); } @@ -155,7 +155,7 @@ mod tests { #[test] fn test_address_storage_key_rand() { let mut bytes = [0u8; 52]; - thread_rng().fill(bytes.as_mut_slice()); + rng().fill(bytes.as_mut_slice()); let key = AddressStorageKey::arbitrary(&mut Unstructured::new(&bytes)).unwrap(); assert_eq!(bytes, Encode::encode(key)); } diff --git a/crates/storage/nippy-jar/src/lib.rs b/crates/storage/nippy-jar/src/lib.rs index 9dc3913eca0..b9aa656b046 100644 --- a/crates/storage/nippy-jar/src/lib.rs +++ b/crates/storage/nippy-jar/src/lib.rs @@ -432,7 +432,7 @@ mod tests { let num_rows = 100; let mut vec: Vec = vec![0; value_length]; - let mut rng = seed.map(SmallRng::seed_from_u64).unwrap_or_else(SmallRng::from_entropy); + let mut rng = seed.map(SmallRng::seed_from_u64).unwrap_or_else(SmallRng::from_os_rng); let mut gen = || { (0..num_rows) @@ -678,7 +678,7 @@ mod tests { // Shuffled for chaos. let mut data = col1.iter().zip(col2.iter()).enumerate().collect::>(); - data.shuffle(&mut rand::thread_rng()); + data.shuffle(&mut rand::rng()); for (row_num, (v0, v1)) in data { // Simulates `by_number` queries @@ -716,7 +716,7 @@ mod tests { // Shuffled for chaos. let mut data = col1.iter().zip(col2.iter()).enumerate().collect::>(); - data.shuffle(&mut rand::thread_rng()); + data.shuffle(&mut rand::rng()); // Imagine `Blocks` static file has two columns: `Block | StoredWithdrawals` const BLOCKS_FULL_MASK: usize = 0b11; diff --git a/crates/storage/provider/src/providers/blockchain_provider.rs b/crates/storage/provider/src/providers/blockchain_provider.rs index 6c6c421a4ed..614946e6afc 100644 --- a/crates/storage/provider/src/providers/blockchain_provider.rs +++ b/crates/storage/provider/src/providers/blockchain_provider.rs @@ -1321,8 +1321,8 @@ mod tests { ); // A random block number should return None as the block is not found - let mut rng = rand::thread_rng(); - let random_block_number: u64 = rng.gen(); + let mut rng = rand::rng(); + let random_block_number: u64 = rng.random(); assert_eq!(provider.block_body_indices(random_block_number)?, None); Ok(()) diff --git a/crates/storage/provider/src/providers/database/mod.rs b/crates/storage/provider/src/providers/database/mod.rs index d1f9bdb860c..e48d4fbe409 100644 --- a/crates/storage/provider/src/providers/database/mod.rs +++ b/crates/storage/provider/src/providers/database/mod.rs @@ -797,7 +797,7 @@ mod tests { let provider = factory.provider_rw().unwrap(); let mut rng = generators::rng(); - let consensus_tip = rng.gen(); + let consensus_tip = rng.random(); let (_tip_tx, tip_rx) = watch::channel(consensus_tip); // Genesis diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 6dd4110b575..25b58a7e44f 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -7,7 +7,7 @@ use alloy_primitives::{ use alloy_consensus::Header; use alloy_eips::eip4895::{Withdrawal, Withdrawals}; -use alloy_primitives::PrimitiveSignature as Signature; +use alloy_primitives::Signature; use reth_db_api::{database::Database, models::StoredBlockBodyIndices, tables}; use reth_ethereum_primitives::{BlockBody, Receipt, Transaction, TransactionSigned, TxType}; use reth_node_types::NodeTypes; diff --git a/crates/transaction-pool/src/blobstore/disk.rs b/crates/transaction-pool/src/blobstore/disk.rs index 097b58d41c4..ca2552dd38f 100644 --- a/crates/transaction-pool/src/blobstore/disk.rs +++ b/crates/transaction-pool/src/blobstore/disk.rs @@ -495,7 +495,7 @@ mod tests { } fn rng_blobs(num: usize) -> Vec<(TxHash, BlobTransactionSidecar)> { - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); (0..num) .map(|_| { let tx = TxHash::random_with(&mut rng); diff --git a/crates/transaction-pool/src/blobstore/tracker.rs b/crates/transaction-pool/src/blobstore/tracker.rs index 72c53ce62c1..6789086abed 100644 --- a/crates/transaction-pool/src/blobstore/tracker.rs +++ b/crates/transaction-pool/src/blobstore/tracker.rs @@ -90,7 +90,7 @@ pub enum BlobStoreUpdates { mod tests { use super::*; use alloy_consensus::{Header, Signed}; - use alloy_primitives::PrimitiveSignature as Signature; + use alloy_primitives::Signature; use reth_ethereum_primitives::Transaction; use reth_execution_types::Chain; use reth_primitives_traits::{RecoveredBlock, SealedBlock, SealedHeader}; diff --git a/crates/transaction-pool/src/test_utils/gen.rs b/crates/transaction-pool/src/test_utils/gen.rs index 6c510b31810..b553fc8e55f 100644 --- a/crates/transaction-pool/src/test_utils/gen.rs +++ b/crates/transaction-pool/src/test_utils/gen.rs @@ -2,12 +2,12 @@ use crate::{EthPooledTransaction, PoolTransaction}; use alloy_consensus::{SignableTransaction, TxEip1559, TxEip4844, TxLegacy}; use alloy_eips::{eip1559::MIN_PROTOCOL_BASE_FEE, eip2718::Encodable2718, eip2930::AccessList}; use alloy_primitives::{Address, Bytes, TxKind, B256, U256}; -use rand::Rng; +use rand::{Rng, RngCore}; use reth_chainspec::MAINNET; use reth_ethereum_primitives::{Transaction, TransactionSigned}; -use reth_primitives_traits::transaction::signed::SignedTransaction; - -use reth_primitives_traits::crypto::secp256k1::sign_message; +use reth_primitives_traits::{ + crypto::secp256k1::sign_message, transaction::signed::SignedTransaction, +}; /// A generator for transactions for testing purposes. #[derive(Debug)] @@ -22,7 +22,7 @@ pub struct TransactionGenerator { pub gas_limit: u64, } -impl TransactionGenerator { +impl TransactionGenerator { /// Initializes the generator with 10 random signers pub fn new(rng: R) -> Self { Self::with_num_signers(rng, 10) @@ -76,7 +76,7 @@ impl TransactionGenerator { /// Returns a random signer from the set fn rng_signer(&mut self) -> B256 { - let idx = self.rng.gen_range(0..self.signer_keys.len()); + let idx = self.rng.random_range(0..self.signer_keys.len()); self.signer_keys[idx] } @@ -359,11 +359,11 @@ impl Default for TransactionBuilder { #[cfg(test)] mod tests { use super::*; - use rand::thread_rng; + use rand::rng; #[test] fn test_generate_transaction() { - let rng = thread_rng(); + let rng = rng(); let mut gen = TransactionGenerator::new(rng); let _tx = gen.transaction().into_legacy(); let _tx = gen.transaction().into_eip1559(); diff --git a/crates/transaction-pool/src/test_utils/mock.rs b/crates/transaction-pool/src/test_utils/mock.rs index 231d802a056..fa277cbe4b8 100644 --- a/crates/transaction-pool/src/test_utils/mock.rs +++ b/crates/transaction-pool/src/test_utils/mock.rs @@ -22,14 +22,9 @@ use alloy_eips::{ eip4844::{BlobTransactionSidecar, BlobTransactionValidationError, DATA_GAS_PER_BLOB}, eip7702::SignedAuthorization, }; -use alloy_primitives::{ - Address, Bytes, ChainId, PrimitiveSignature as Signature, TxHash, TxKind, B256, U256, -}; +use alloy_primitives::{Address, Bytes, ChainId, Signature, TxHash, TxKind, B256, U256}; use paste::paste; -use rand::{ - distributions::{Uniform, WeightedIndex}, - prelude::Distribution, -}; +use rand::{distr::Uniform, prelude::Distribution}; use reth_ethereum_primitives::{Transaction, TransactionSigned}; use reth_primitives_traits::{ transaction::error::{TransactionConversionError, TryFromRecoveredTransactionError}, @@ -37,6 +32,7 @@ use reth_primitives_traits::{ }; use alloy_eips::eip4844::env_settings::KzgSettings; +use rand::distr::weighted::WeightedIndex; use std::{ops::Range, sync::Arc, time::Instant, vec::IntoIter}; /// A transaction pool implementation using [`MockOrdering`] for transaction ordering. @@ -1443,10 +1439,10 @@ impl MockFeeRange { "max_fee_range should be strictly below the priority fee range" ); Self { - gas_price: gas_price.into(), - priority_fee: priority_fee.into(), - max_fee: max_fee.into(), - max_fee_blob: max_fee_blob.into(), + gas_price: gas_price.try_into().unwrap(), + priority_fee: priority_fee.try_into().unwrap(), + max_fee: max_fee.try_into().unwrap(), + max_fee_blob: max_fee_blob.try_into().unwrap(), } } @@ -1498,9 +1494,9 @@ impl MockTransactionDistribution { ) -> Self { Self { transaction_ratio, - gas_limit_range: gas_limit_range.into(), + gas_limit_range: gas_limit_range.try_into().unwrap(), fee_ranges, - size_range: size_range.into(), + size_range: size_range.try_into().unwrap(), } } @@ -1710,7 +1706,7 @@ impl MockTransactionSet { let mut prev_nonce = 0; for tx in &mut self.transactions { - if rng.gen_bool(gap_pct as f64 / 100.0) { + if rng.random_bool(gap_pct as f64 / 100.0) { prev_nonce += gap_range.start; } else { prev_nonce += 1; diff --git a/crates/transaction-pool/src/test_utils/pool.rs b/crates/transaction-pool/src/test_utils/pool.rs index 70b48ca2b2f..14abbda18de 100644 --- a/crates/transaction-pool/src/test_utils/pool.rs +++ b/crates/transaction-pool/src/test_utils/pool.rs @@ -84,7 +84,7 @@ impl MockTransactionSimulator { let senders = config.addresses(&mut rng); Self { base_fee: config.base_fee, - balances: senders.iter().copied().map(|a| (a, rng.gen())).collect(), + balances: senders.iter().copied().map(|a| (a, rng.random())).collect(), nonces: senders.iter().copied().map(|a| (a, 0)).collect(), senders, scenarios: config.scenarios, @@ -97,13 +97,13 @@ impl MockTransactionSimulator { /// Returns a random address from the senders set fn rng_address(&mut self) -> Address { - let idx = self.rng.gen_range(0..self.senders.len()); + let idx = self.rng.random_range(0..self.senders.len()); self.senders[idx] } /// Returns a random scenario from the scenario set fn rng_scenario(&mut self) -> ScenarioType { - let idx = self.rng.gen_range(0..self.scenarios.len()); + let idx = self.rng.random_range(0..self.scenarios.len()); self.scenarios[idx].clone() } @@ -226,10 +226,10 @@ mod tests { }; let fee_ranges = MockFeeRange { - gas_price: (10u128..100).into(), - priority_fee: (10u128..100).into(), - max_fee: (100u128..110).into(), - max_fee_blob: (1u128..100).into(), + gas_price: (10u128..100).try_into().unwrap(), + priority_fee: (10u128..100).try_into().unwrap(), + max_fee: (100u128..110).try_into().unwrap(), + max_fee_blob: (1u128..100).try_into().unwrap(), }; let config = MockSimulatorConfig { @@ -243,7 +243,7 @@ mod tests { 10..100, ), }; - let mut simulator = MockTransactionSimulator::new(rand::thread_rng(), config); + let mut simulator = MockTransactionSimulator::new(rand::rng(), config); let mut pool = MockPool::default(); simulator.next(&mut pool); diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index 12bcda01669..1e943ca285b 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -1472,7 +1472,7 @@ mod tests { TxEnvelope, TxLegacy, }; use alloy_eips::eip4844::DATA_GAS_PER_BLOB; - use alloy_primitives::PrimitiveSignature as Signature; + use alloy_primitives::Signature; #[test] fn test_pool_size_invariants() { diff --git a/crates/transaction-pool/tests/it/evict.rs b/crates/transaction-pool/tests/it/evict.rs index 9dd2a621eda..346fd3dfd77 100644 --- a/crates/transaction-pool/tests/it/evict.rs +++ b/crates/transaction-pool/tests/it/evict.rs @@ -3,7 +3,7 @@ use alloy_consensus::Transaction; use alloy_eips::eip1559::{ETHEREUM_BLOCK_GAS_LIMIT_30M, MIN_PROTOCOL_BASE_FEE}; use alloy_primitives::{Address, B256}; -use rand::distributions::Uniform; +use rand::distr::Uniform; use reth_transaction_pool::{ error::PoolErrorKind, test_utils::{ @@ -63,14 +63,17 @@ async fn only_blobs_eviction() { // start the fees at zero, some transactions will be underpriced let fee_range = MockFeeRange { - gas_price: Uniform::from(0u128..(block_info.pending_basefee as u128 + 1000)), - priority_fee: Uniform::from(0u128..(block_info.pending_basefee as u128 + 1000)), + gas_price: Uniform::try_from(0u128..(block_info.pending_basefee as u128 + 1000)) + .unwrap(), + priority_fee: Uniform::try_from(0u128..(block_info.pending_basefee as u128 + 1000)) + .unwrap(), // we need to set the max fee to at least the min protocol base fee, or transactions // generated could be rejected - max_fee: Uniform::from( + max_fee: Uniform::try_from( MIN_PROTOCOL_BASE_FEE as u128..(block_info.pending_basefee as u128 + 2000), - ), - max_fee_blob: Uniform::from(pending_blob_fee..(pending_blob_fee + 1000)), + ) + .unwrap(), + max_fee_blob: Uniform::try_from(pending_blob_fee..(pending_blob_fee + 1000)).unwrap(), }; let distribution = MockTransactionDistribution::new( @@ -83,7 +86,7 @@ async fn only_blobs_eviction() { for _ in 0..*sender_amt { // use a random sender, create the tx set let sender = Address::random(); - let set = distribution.tx_set(sender, nonce_range.clone(), &mut rand::thread_rng()); + let set = distribution.tx_set(sender, nonce_range.clone(), &mut rand::rng()); let set = set.into_vec(); @@ -173,10 +176,10 @@ async fn mixed_eviction() { let min_max_fee = block_info.pending_basefee as u128 + 10; let fee_range = MockFeeRange { - gas_price: Uniform::from(min_gas_price..(min_gas_price + 1000)), - priority_fee: Uniform::from(min_priority_fee..(min_priority_fee + 1000)), - max_fee: Uniform::from(min_max_fee..(min_max_fee + 2000)), - max_fee_blob: Uniform::from(pending_blob_fee..(pending_blob_fee + 1000)), + gas_price: Uniform::try_from(min_gas_price..(min_gas_price + 1000)).unwrap(), + priority_fee: Uniform::try_from(min_priority_fee..(min_priority_fee + 1000)).unwrap(), + max_fee: Uniform::try_from(min_max_fee..(min_max_fee + 2000)).unwrap(), + max_fee_blob: Uniform::try_from(pending_blob_fee..(pending_blob_fee + 1000)).unwrap(), }; let distribution = MockTransactionDistribution::new( @@ -191,7 +194,7 @@ async fn mixed_eviction() { let set = distribution.tx_set_non_conflicting_types( sender, nonce_range.clone(), - &mut rand::thread_rng(), + &mut rand::rng(), ); let set = set.into_inner().into_vec(); @@ -275,10 +278,10 @@ async fn nonce_gaps_eviction() { let min_max_fee = block_info.pending_basefee as u128 + 10; let fee_range = MockFeeRange { - gas_price: Uniform::from(min_gas_price..(min_gas_price + 1000)), - priority_fee: Uniform::from(min_priority_fee..(min_priority_fee + 1000)), - max_fee: Uniform::from(min_max_fee..(min_max_fee + 2000)), - max_fee_blob: Uniform::from(pending_blob_fee..(pending_blob_fee + 1000)), + gas_price: Uniform::try_from(min_gas_price..(min_gas_price + 1000)).unwrap(), + priority_fee: Uniform::try_from(min_priority_fee..(min_priority_fee + 1000)).unwrap(), + max_fee: Uniform::try_from(min_max_fee..(min_max_fee + 2000)).unwrap(), + max_fee_blob: Uniform::try_from(pending_blob_fee..(pending_blob_fee + 1000)).unwrap(), }; let distribution = MockTransactionDistribution::new( @@ -299,10 +302,10 @@ async fn nonce_gaps_eviction() { let mut set = distribution.tx_set_non_conflicting_types( sender, nonce_range.clone(), - &mut rand::thread_rng(), + &mut rand::rng(), ); - set.with_nonce_gaps(gap_pct, gap_range.clone(), &mut rand::thread_rng()); + set.with_nonce_gaps(gap_pct, gap_range.clone(), &mut rand::rng()); let set = set.into_inner().into_vec(); let results = pool.add_transactions(TransactionOrigin::External, set).await; diff --git a/crates/trie/common/src/hash_builder/state.rs b/crates/trie/common/src/hash_builder/state.rs index 7ed369491c8..76abbd42ac6 100644 --- a/crates/trie/common/src/hash_builder/state.rs +++ b/crates/trie/common/src/hash_builder/state.rs @@ -37,7 +37,7 @@ impl From for HashBuilder { key: Nibbles::from_nibbles_unchecked(state.key), stack: state.stack, value: state.value, - groups: state.groups, + state_masks: state.groups, tree_masks: state.tree_masks, hash_masks: state.hash_masks, stored_in_database: state.stored_in_database, @@ -54,7 +54,7 @@ impl From for HashBuilderState { key: state.key.into(), stack: state.stack, value: state.value, - groups: state.groups, + groups: state.state_masks, tree_masks: state.tree_masks, hash_masks: state.hash_masks, stored_in_database: state.stored_in_database, diff --git a/crates/trie/common/src/subnode.rs b/crates/trie/common/src/subnode.rs index 7ef8a349fa7..419e6e696f3 100644 --- a/crates/trie/common/src/subnode.rs +++ b/crates/trie/common/src/subnode.rs @@ -82,7 +82,7 @@ mod tests { state_mask: TrieMask::new(1), tree_mask: TrieMask::new(0), hash_mask: TrieMask::new(1), - hashes: vec![B256::ZERO], + hashes: vec![B256::ZERO].into(), root_hash: None, }), }; diff --git a/crates/trie/parallel/src/proof.rs b/crates/trie/parallel/src/proof.rs index 742795aedc1..c09eed1dedf 100644 --- a/crates/trie/parallel/src/proof.rs +++ b/crates/trie/parallel/src/proof.rs @@ -340,19 +340,19 @@ mod tests { let factory = create_test_provider_factory(); let consistent_view = ConsistentDbView::new(factory.clone(), None); - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let state = (0..100) .map(|_| { let address = Address::random(); let account = - Account { balance: U256::from(rng.gen::()), ..Default::default() }; + Account { balance: U256::from(rng.random::()), ..Default::default() }; let mut storage = HashMap::::default(); - let has_storage = rng.gen_bool(0.7); + let has_storage = rng.random_bool(0.7); if has_storage { for _ in 0..100 { storage.insert( - B256::from(U256::from(rng.gen::())), - U256::from(rng.gen::()), + B256::from(U256::from(rng.random::())), + U256::from(rng.random::()), ); } } diff --git a/crates/trie/parallel/src/root.rs b/crates/trie/parallel/src/root.rs index 06e41aac033..f184cbe9a62 100644 --- a/crates/trie/parallel/src/root.rs +++ b/crates/trie/parallel/src/root.rs @@ -265,19 +265,19 @@ mod tests { let factory = create_test_provider_factory(); let consistent_view = ConsistentDbView::new(factory.clone(), None); - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let mut state = (0..100) .map(|_| { let address = Address::random(); let account = - Account { balance: U256::from(rng.gen::()), ..Default::default() }; + Account { balance: U256::from(rng.random::()), ..Default::default() }; let mut storage = HashMap::::default(); - let has_storage = rng.gen_bool(0.7); + let has_storage = rng.random_bool(0.7); if has_storage { for _ in 0..100 { storage.insert( - B256::from(U256::from(rng.gen::())), - U256::from(rng.gen::()), + B256::from(U256::from(rng.random::())), + U256::from(rng.random::()), ); } } @@ -316,17 +316,17 @@ mod tests { for (address, (account, storage)) in &mut state { let hashed_address = keccak256(address); - let should_update_account = rng.gen_bool(0.5); + let should_update_account = rng.random_bool(0.5); if should_update_account { - *account = Account { balance: U256::from(rng.gen::()), ..*account }; + *account = Account { balance: U256::from(rng.random::()), ..*account }; hashed_state.accounts.insert(hashed_address, Some(*account)); } - let should_update_storage = rng.gen_bool(0.3); + let should_update_storage = rng.random_bool(0.3); if should_update_storage { for (slot, value) in storage.iter_mut() { let hashed_slot = keccak256(slot); - *value = U256::from(rng.gen::()); + *value = U256::from(rng.random::()); hashed_state .storages .entry(hashed_address) diff --git a/crates/trie/sparse/Cargo.toml b/crates/trie/sparse/Cargo.toml index 1ede276d656..68b06a94f4e 100644 --- a/crates/trie/sparse/Cargo.toml +++ b/crates/trie/sparse/Cargo.toml @@ -47,6 +47,7 @@ pretty_assertions.workspace = true proptest-arbitrary-interop.workspace = true proptest.workspace = true rand.workspace = true +rand_08.workspace = true [features] test-utils = [ diff --git a/crates/trie/sparse/benches/rlp_node.rs b/crates/trie/sparse/benches/rlp_node.rs index bebf1cbb989..113392fca54 100644 --- a/crates/trie/sparse/benches/rlp_node.rs +++ b/crates/trie/sparse/benches/rlp_node.rs @@ -4,7 +4,7 @@ use alloy_primitives::{B256, U256}; use criterion::{criterion_group, criterion_main, Criterion}; use prop::strategy::ValueTree; use proptest::{prelude::*, test_runner::TestRunner}; -use rand::seq::IteratorRandom; +use rand::{seq::IteratorRandom, Rng}; use reth_testing_utils::generators; use reth_trie::Nibbles; use reth_trie_sparse::RevealedSparseTrie; @@ -38,7 +38,7 @@ fn update_rlp_node_level(c: &mut Criterion) { sparse .update_leaf( Nibbles::unpack(key), - alloy_rlp::encode_fixed_size(&rng.gen::()).to_vec(), + alloy_rlp::encode_fixed_size(&rng.random::()).to_vec(), ) .unwrap(); } diff --git a/crates/trie/sparse/src/state.rs b/crates/trie/sparse/src/state.rs index 2b0bae9480e..59c3d4c2c15 100644 --- a/crates/trie/sparse/src/state.rs +++ b/crates/trie/sparse/src/state.rs @@ -1002,13 +1002,13 @@ mod tests { let slot_1 = b256!("0x1000000000000000000000000000000000000000000000000000000000000000"); let slot_path_1 = Nibbles::unpack(slot_1); - let value_1 = U256::from(rng.gen::()); + let value_1 = U256::from(rng.random::()); let slot_2 = b256!("0x1100000000000000000000000000000000000000000000000000000000000000"); let slot_path_2 = Nibbles::unpack(slot_2); - let value_2 = U256::from(rng.gen::()); + let value_2 = U256::from(rng.random::()); let slot_3 = b256!("0x2000000000000000000000000000000000000000000000000000000000000000"); let slot_path_3 = Nibbles::unpack(slot_3); - let value_3 = U256::from(rng.gen::()); + let value_3 = U256::from(rng.random::()); let mut storage_hash_builder = HashBuilder::default().with_proof_retainer(ProofRetainer::from_iter([ diff --git a/crates/trie/sparse/src/trie.rs b/crates/trie/sparse/src/trie.rs index ee44d0edd77..cc2be513ba6 100644 --- a/crates/trie/sparse/src/trie.rs +++ b/crates/trie/sparse/src/trie.rs @@ -1583,7 +1583,6 @@ mod tests { use prop::sample::SizeRange; use proptest::prelude::*; use proptest_arbitrary_interop::arb; - use rand::seq::IteratorRandom; use reth_primitives_traits::Account; use reth_provider::{test_utils::create_test_provider_factory, TrieWriter}; use reth_trie::{ @@ -2357,7 +2356,7 @@ mod tests { fn transform_updates( updates: Vec>, - mut rng: impl Rng, + mut rng: impl rand_08::Rng, ) -> Vec<(BTreeMap, BTreeSet)> { let mut keys = BTreeSet::new(); updates @@ -2368,7 +2367,9 @@ mod tests { let keys_to_delete_len = update.len() / 2; let keys_to_delete = (0..keys_to_delete_len) .map(|_| { - let key = keys.iter().choose(&mut rng).unwrap().clone(); + let key = rand_08::seq::IteratorRandom::choose(keys.iter(), &mut rng) + .unwrap() + .clone(); keys.take(&key).unwrap() }) .collect(); diff --git a/examples/custom-rlpx-subprotocol/Cargo.toml b/examples/custom-rlpx-subprotocol/Cargo.toml index 108982d43d1..d396b99eb79 100644 --- a/examples/custom-rlpx-subprotocol/Cargo.toml +++ b/examples/custom-rlpx-subprotocol/Cargo.toml @@ -12,6 +12,5 @@ reth-ethereum = { workspace = true, features = ["node", "network"] } reth.workspace = true tokio-stream.workspace = true eyre.workspace = true -rand.workspace = true tracing.workspace = true alloy-primitives.workspace = true diff --git a/examples/custom-rlpx-subprotocol/src/main.rs b/examples/custom-rlpx-subprotocol/src/main.rs index 8ba6315deb9..81036627ecf 100644 --- a/examples/custom-rlpx-subprotocol/src/main.rs +++ b/examples/custom-rlpx-subprotocol/src/main.rs @@ -14,11 +14,10 @@ mod subprotocol; use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; -use reth::builder::NodeHandle; +use reth::{builder::NodeHandle, network::config::rng_secret_key}; use reth_ethereum::{ network::{ api::{test_utils::PeersHandleProvider, NetworkInfo}, - config::SecretKey, protocol::IntoRlpxSubProtocol, NetworkConfig, NetworkManager, NetworkProtocols, }, @@ -48,7 +47,7 @@ fn main() -> eyre::Result<()> { node.network.add_rlpx_sub_protocol(custom_rlpx_handler.into_rlpx_sub_protocol()); // creates a separate network instance and adds the custom network subprotocol - let secret_key = SecretKey::new(&mut rand::thread_rng()); + let secret_key = rng_secret_key(); let (tx, mut from_peer1) = mpsc::unbounded_channel(); let custom_rlpx_handler_2 = CustomRlpxProtoHandler { state: ProtocolState { events: tx } }; let net_cfg = NetworkConfig::builder(secret_key) diff --git a/testing/testing-utils/Cargo.toml b/testing/testing-utils/Cargo.toml index 45e60b2a13b..71194c722c2 100644 --- a/testing/testing-utils/Cargo.toml +++ b/testing/testing-utils/Cargo.toml @@ -22,6 +22,7 @@ alloy-eips.workspace = true rand.workspace = true secp256k1 = { workspace = true, features = ["rand"] } +rand_08.workspace = true [dev-dependencies] alloy-eips.workspace = true diff --git a/testing/testing-utils/src/generators.rs b/testing/testing-utils/src/generators.rs index e0018d02a58..0c057cc89f0 100644 --- a/testing/testing-utils/src/generators.rs +++ b/testing/testing-utils/src/generators.rs @@ -1,21 +1,20 @@ //! Generators for different data structures like block headers, block bodies and ranges of those. +// TODO(rand): update ::random calls after rand_09 migration + use alloy_consensus::{Block, Header, SignableTransaction, Transaction as _, TxLegacy}; use alloy_eips::{ eip1898::BlockWithParent, eip4895::{Withdrawal, Withdrawals}, NumHash, }; -use alloy_primitives::{Address, BlockNumber, Bytes, TxKind, B256, U256}; +use alloy_primitives::{Address, BlockNumber, Bytes, TxKind, B256, B64, U256}; pub use rand::Rng; -use rand::{ - distributions::uniform::SampleRange, rngs::StdRng, seq::SliceRandom, thread_rng, SeedableRng, -}; +use rand::{distr::uniform::SampleRange, rngs::StdRng, SeedableRng}; use reth_primitives::{ Account, BlockBody, Log, Receipt, SealedBlock, SealedHeader, StorageEntry, Transaction, TransactionSigned, }; - use reth_primitives_traits::{crypto::secp256k1::sign_message, proofs, Block as _}; use secp256k1::{Keypair, Secp256k1}; use std::{ @@ -72,7 +71,7 @@ pub fn rng() -> StdRng { if let Ok(seed) = std::env::var("SEED") { rng_with_seed(seed.as_bytes()) } else { - StdRng::from_rng(thread_rng()).expect("could not build rng") + StdRng::from_rng(&mut rand::rng()) } } @@ -111,7 +110,10 @@ pub fn random_block_with_parent( number: u64, parent: Option, ) -> BlockWithParent { - BlockWithParent { parent: parent.unwrap_or_default(), block: NumHash::new(number, rng.gen()) } + BlockWithParent { + parent: parent.unwrap_or_default(), + block: NumHash::new(number, rng.random()), + } } /// Generate a random [`SealedHeader`]. @@ -120,8 +122,8 @@ pub fn random_block_with_parent( pub fn random_header(rng: &mut R, number: u64, parent: Option) -> SealedHeader { let header = alloy_consensus::Header { number, - nonce: rng.gen(), - difficulty: U256::from(rng.gen::()), + nonce: B64::random(), + difficulty: U256::from(rng.random::()), parent_hash: parent.unwrap_or_default(), ..Default::default() }; @@ -137,11 +139,11 @@ pub fn random_header(rng: &mut R, number: u64, parent: Option) -> pub fn random_tx(rng: &mut R) -> Transaction { Transaction::Legacy(TxLegacy { chain_id: Some(1), - nonce: rng.gen::().into(), - gas_price: rng.gen::().into(), - gas_limit: rng.gen::().into(), - to: TxKind::Call(rng.gen()), - value: U256::from(rng.gen::()), + nonce: rng.random::().into(), + gas_price: rng.random::().into(), + gas_limit: rng.random::().into(), + to: TxKind::Call(Address::random()), + value: U256::from(rng.random::()), input: Bytes::default(), }) } @@ -157,9 +159,10 @@ pub fn random_signed_tx(rng: &mut R) -> TransactionSigned { } /// Signs the [Transaction] with a random key pair. -pub fn sign_tx_with_random_key_pair(rng: &mut R, tx: Transaction) -> TransactionSigned { +pub fn sign_tx_with_random_key_pair(_rng: &mut R, tx: Transaction) -> TransactionSigned { let secp = Secp256k1::new(); - let key_pair = Keypair::new(&secp, rng); + // TODO: rand08 + let key_pair = Keypair::new(&secp, &mut rand_08::thread_rng()); sign_tx_with_key_pair(key_pair, tx) } @@ -171,10 +174,17 @@ pub fn sign_tx_with_key_pair(key_pair: Keypair, tx: Transaction) -> TransactionS TransactionSigned::new_unhashed(tx, signature) } +/// Generates a a new random [Keypair]. +pub fn generate_key(_rng: &mut R) -> Keypair { + let secp = Secp256k1::new(); + Keypair::new(&secp, &mut rand_08::thread_rng()) +} + /// Generates a set of [Keypair]s based on the desired count. -pub fn generate_keys(rng: &mut R, count: usize) -> Vec { +pub fn generate_keys(_rng: &mut R, count: usize) -> Vec { let secp = Secp256k1::new(); - (0..count).map(|_| Keypair::new(&secp, rng)).collect() + // TODO: rand08 + (0..count).map(|_| Keypair::new(&secp, &mut rand_08::thread_rng())).collect() } /// Generate a random block filled with signed transactions (generated using @@ -193,13 +203,13 @@ pub fn generate_keys(rng: &mut R, count: usize) -> Vec { /// The ommer headers are not assumed to be valid. pub fn random_block(rng: &mut R, number: u64, block_params: BlockParams) -> SealedBlock { // Generate transactions - let tx_count = block_params.tx_count.unwrap_or_else(|| rng.gen::()); + let tx_count = block_params.tx_count.unwrap_or_else(|| rng.random::()); let transactions: Vec = (0..tx_count).map(|_| random_signed_tx(rng)).collect(); let total_gas = transactions.iter().fold(0, |sum, tx| sum + tx.transaction().gas_limit()); // Generate ommers - let ommers_count = block_params.ommers_count.unwrap_or_else(|| rng.gen_range(0..2)); + let ommers_count = block_params.ommers_count.unwrap_or_else(|| rng.random_range(0..2)); let ommers = (0..ommers_count) .map(|_| random_header(rng, number, block_params.parent).unseal()) .collect::>(); @@ -211,10 +221,10 @@ pub fn random_block(rng: &mut R, number: u64, block_params: BlockParams) let withdrawals = block_params.withdrawals_count.map(|count| { (0..count) .map(|i| Withdrawal { - amount: rng.gen(), + amount: rng.random(), index: i.into(), validator_index: i.into(), - address: rng.gen(), + address: Address::random(), }) .collect::>() }); @@ -227,7 +237,7 @@ pub fn random_block(rng: &mut R, number: u64, block_params: BlockParams) gas_limit: total_gas, transactions_root, ommers_hash, - base_fee_per_gas: Some(rng.gen()), + base_fee_per_gas: Some(rng.random()), // TODO(onbjerg): Proper EIP-7685 request support requests_hash: None, withdrawals_root, @@ -255,11 +265,11 @@ pub fn random_block_range( let mut blocks = Vec::with_capacity(block_numbers.end().saturating_sub(*block_numbers.start()) as usize); for idx in block_numbers { - let tx_count = block_range_params.tx_count.clone().sample_single(rng); + let tx_count = block_range_params.tx_count.clone().sample_single(rng).unwrap(); let requests_count = - block_range_params.requests_count.clone().map(|r| r.sample_single(rng)); + block_range_params.requests_count.clone().map(|r| r.sample_single(rng).unwrap()); let withdrawals_count = - block_range_params.withdrawals_count.clone().map(|r| r.sample_single(rng)); + block_range_params.withdrawals_count.clone().map(|r| r.sample_single(rng).unwrap()); let parent = block_range_params.parent.unwrap_or_default(); blocks.push(random_block( rng, @@ -369,17 +379,18 @@ pub fn random_account_change( n_storage_changes: Range, key_range: Range, ) -> (Address, Address, U256, Vec) { + use rand::prelude::IndexedRandom; let mut addresses = valid_addresses.choose_multiple(rng, 2).copied(); let addr_from = addresses.next().unwrap_or_else(Address::random); let addr_to = addresses.next().unwrap_or_else(Address::random); - let balance_change = U256::from(rng.gen::()); + let balance_change = U256::from(rng.random::()); let storage_changes = if n_storage_changes.is_empty() { Vec::new() } else { - (0..n_storage_changes.sample_single(rng)) + (0..n_storage_changes.sample_single(rng).unwrap()) .map(|_| random_storage_entry(rng, key_range.clone())) .collect() }; @@ -390,21 +401,21 @@ pub fn random_account_change( /// Generate a random storage change. pub fn random_storage_entry(rng: &mut R, key_range: Range) -> StorageEntry { let key = B256::new({ - let n = key_range.sample_single(rng); + let n = key_range.sample_single(rng).unwrap(); let mut m = [0u8; 32]; m[24..32].copy_from_slice(&n.to_be_bytes()); m }); - let value = U256::from(rng.gen::()); + let value = U256::from(rng.random::()); StorageEntry { key, value } } /// Generate random Externally Owned Account (EOA account without contract). pub fn random_eoa_account(rng: &mut R) -> (Address, Account) { - let nonce: u64 = rng.gen(); - let balance = U256::from(rng.gen::()); - let addr = rng.gen(); + let nonce: u64 = rng.random(); + let balance = U256::from(rng.random::()); + let addr = Address::random(); (addr, Account { nonce, balance, bytecode_hash: None }) } @@ -427,7 +438,7 @@ pub fn random_contract_account_range( for _ in acc_range { let (address, eoa_account) = random_eoa_account(rng); // todo: can a non-eoa account have a nonce > 0? - let account = Account { bytecode_hash: Some(rng.gen()), ..eoa_account }; + let account = Account { bytecode_hash: Some(B256::random()), ..eoa_account }; accounts.push((address, account)) } accounts @@ -439,13 +450,13 @@ pub fn random_receipt( transaction: &TransactionSigned, logs_count: Option, ) -> Receipt { - let success = rng.gen::(); - let logs_count = logs_count.unwrap_or_else(|| rng.gen::()); + let success = rng.random::(); + let logs_count = logs_count.unwrap_or_else(|| rng.random::()); #[expect(clippy::needless_update)] // side-effect of optimism fields Receipt { tx_type: transaction.tx_type(), success, - cumulative_gas_used: rng.gen_range(0..=transaction.gas_limit()), + cumulative_gas_used: rng.random_range(0..=transaction.gas_limit()), logs: if success { (0..logs_count).map(|_| random_log(rng, None, None)).collect() } else { @@ -457,12 +468,12 @@ pub fn random_receipt( /// Generate random log pub fn random_log(rng: &mut R, address: Option
, topics_count: Option) -> Log { - let data_byte_count = rng.gen::() as usize; - let topics_count = topics_count.unwrap_or_else(|| rng.gen()) as usize; + let data_byte_count = rng.random::() as usize; + let topics_count = topics_count.unwrap_or_else(|| rng.random()) as usize; Log::new_unchecked( - address.unwrap_or_else(|| rng.gen()), - std::iter::repeat_with(|| rng.gen()).take(topics_count).collect(), - std::iter::repeat_with(|| rng.gen()).take(data_byte_count).collect::>().into(), + address.unwrap_or_else(|| Address::random()), + std::iter::repeat_with(|| B256::random()).take(topics_count).collect(), + std::iter::repeat_with(|| rng.random()).take(data_byte_count).collect::>().into(), ) } @@ -471,7 +482,7 @@ mod tests { use super::*; use alloy_consensus::TxEip1559; use alloy_eips::eip2930::AccessList; - use alloy_primitives::{hex, PrimitiveSignature as Signature}; + use alloy_primitives::{hex, Signature}; use reth_primitives_traits::{ crypto::secp256k1::{public_key_to_address, sign_message}, SignedTransaction, @@ -496,7 +507,7 @@ mod tests { let signature_hash = tx.signature_hash(); for _ in 0..100 { - let key_pair = Keypair::new(&secp, &mut rand::thread_rng()); + let key_pair = Keypair::new(&secp, &mut rand_08::thread_rng()); let signature = sign_message(B256::from_slice(&key_pair.secret_bytes()[..]), signature_hash)