chore: alloy 0.4 (#11334)

This commit is contained in:
Matthias Seitz
2024-09-30 14:48:37 +02:00
committed by GitHub
parent e8153e5e2c
commit a5538bc041
80 changed files with 425 additions and 518 deletions

156
Cargo.lock generated
View File

@ -111,16 +111,18 @@ dependencies = [
[[package]]
name = "alloy-consensus"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "629b62e38d471cc15fea534eb7283d2f8a4e8bdb1811bcc5d66dda6cfce6fae1"
checksum = "fa2d9df04dce5c4a8d46783fa18d687b946a9f7d61166cdc35b0631dfc50b810"
dependencies = [
"alloy-eips",
"alloy-primitives",
"alloy-rlp",
"alloy-serde",
"arbitrary",
"auto_impl",
"c-kzg",
"derive_more",
"serde",
]
@ -171,9 +173,9 @@ dependencies = [
[[package]]
name = "alloy-eips"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f923dd5fca5f67a43d81ed3ebad0880bd41f6dd0ada930030353ac356c54cd0f"
checksum = "2717a756c33fe935751d8963b5898d406c8846199660c9d6c6eeb41a18a15697"
dependencies = [
"alloy-eip2930",
"alloy-eip7702",
@ -190,9 +192,9 @@ dependencies = [
[[package]]
name = "alloy-genesis"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a7a18afb0b318616b6b2b0e2e7ac5529d32a966c673b48091c9919e284e6aca"
checksum = "fe9162561c17566bf289a5d0aad07831b7c07d5412108ce533689d379940ba70"
dependencies = [
"alloy-primitives",
"alloy-serde",
@ -213,9 +215,9 @@ dependencies = [
[[package]]
name = "alloy-json-rpc"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3c717b5298fad078cd3a418335b266eba91b511383ca9bd497f742d5975d5ab"
checksum = "0c4f3797fbb22b3312d6cb63fcce9a1f921e567074f9dc2c012de5200342ebe8"
dependencies = [
"alloy-primitives",
"alloy-sol-types",
@ -227,9 +229,9 @@ dependencies = [
[[package]]
name = "alloy-network"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb3705ce7d8602132bcf5ac7a1dd293a42adc2f183abf5907c30ac535ceca049"
checksum = "ad95873a12c4e0a45575c66fcabe7ccc31fcf4c946a7d30c7cc38a115c59004e"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -248,10 +250,11 @@ dependencies = [
[[package]]
name = "alloy-network-primitives"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94ad40869867ed2d9cd3842b1e800889e5b49e6b92da346e93862b4a741bedf3"
checksum = "8416e4e9ceee8014d2f89fc3dde331da392b26d14226a0d5cbc207ae7799fb2f"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-serde",
@ -260,9 +263,9 @@ dependencies = [
[[package]]
name = "alloy-node-bindings"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5988a227293f949525f0a1b3e1ef728d2ef24afa96bad2b7788c6c9617fa3eec"
checksum = "60d32daf9f95aa04cd7cad47f9de58ab91a3a039fa51979637787f14f13a8292"
dependencies = [
"alloy-genesis",
"alloy-primitives",
@ -308,9 +311,9 @@ dependencies = [
[[package]]
name = "alloy-provider"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927f708dd457ed63420400ee5f06945df9632d5d101851952056840426a10dc5"
checksum = "e82c0e8ebddbcce9450431680dc1576b380e1a781c2f8033321bef805272644b"
dependencies = [
"alloy-chains",
"alloy-consensus",
@ -346,9 +349,9 @@ dependencies = [
[[package]]
name = "alloy-pubsub"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d05f63677e210d758cd5d6d1ce10f20c980c3560ccfbe79ba1997791862a04f"
checksum = "bc6a4b128a96b1974f6d44d1eff70ae0b12a963258d7a8646fefeaeafc5e3b4c"
dependencies = [
"alloy-json-rpc",
"alloy-primitives",
@ -387,9 +390,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-client"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d82952dca71173813d4e5733e2c986d8b04aea9e0f3b0a576664c232ad050a5"
checksum = "424516469135db9d385a1f9a51bc0d198e226bf3ff29843fde799a39b5507e12"
dependencies = [
"alloy-json-rpc",
"alloy-primitives",
@ -411,10 +414,11 @@ dependencies = [
[[package]]
name = "alloy-rpc-types"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64333d639f2a0cf73491813c629a405744e16343a4bc5640931be707c345ecc5"
checksum = "da0d2d760a666acdcaed038164bef0d179ee10790ba68e39b18361faac7eb6e7"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-engine",
"alloy-rpc-types-eth",
"alloy-serde",
@ -423,9 +427,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-admin"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fefd12e99dd6b7de387ed13ad047ce2c90d8950ca62fc48b8a457ebb8f936c61"
checksum = "54b96b09813494a6f62fb16e8ac1a85a1b866e39f03ddc25ce780f27d2799969"
dependencies = [
"alloy-genesis",
"alloy-primitives",
@ -435,9 +439,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-anvil"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25cb45ad7c0930dd62eecf164d2afe4c3d2dd2c82af85680ad1f118e1e5cb83"
checksum = "142f6fb21ef1857b3d175dc16b73d67f4b70914e6898610da3c0b65a1281fe7b"
dependencies = [
"alloy-primitives",
"alloy-serde",
@ -446,9 +450,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-beacon"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7081d2206dca51ce23a06338d78d9b536931cc3f15134fc1c6535eb2b77f18"
checksum = "f6af459ebc4b52f9885bf7210c917641eecc2b73665415f74cadcfed7b3a476d"
dependencies = [
"alloy-eips",
"alloy-primitives",
@ -460,9 +464,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-debug"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f9f9033796bb3078d11cc9c839f00e277431ef997db2849a46045fcffee3835"
checksum = "5e8225153cc67c878753163aa6c24ab07895dfb1c9b7d7368a0e00a2e686a86f"
dependencies = [
"alloy-primitives",
"serde",
@ -470,9 +474,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-engine"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1464c4dd646e1bdfde86ae65ce5ba168dbb29180b478011fe87117ae46b1629b"
checksum = "c032e9b725a990be03cc0ddd9fa73c21f61d1449b328083aa22fbfafb03eda1b"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -484,13 +488,14 @@ dependencies = [
"jsonwebtoken",
"rand 0.8.5",
"serde",
"strum",
]
[[package]]
name = "alloy-rpc-types-eth"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83aa984386deda02482660aa31cb8ca1e63d533f1c31a52d7d181ac5ec68e9b8"
checksum = "3e1f655dcd5e9ccf215cbffb69272698ef6b3ec76907e8937345f2a82ae04ed4"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -499,9 +504,7 @@ dependencies = [
"alloy-rlp",
"alloy-serde",
"alloy-sol-types",
"cfg-if",
"derive_more",
"hashbrown 0.14.5",
"itertools 0.13.0",
"jsonrpsee-types",
"serde",
@ -510,9 +513,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-mev"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922d92389e5022650c4c60ffd2f9b2467c3f853764f0f74ff16a23106f9017d5"
checksum = "a967cddf24a0f80fb6450f7fbed63d5608c61158896ba163523c552ea882bc29"
dependencies = [
"alloy-eips",
"alloy-primitives",
@ -523,9 +526,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-trace"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98db35cd42c90b484377e6bc44d95377a7a38a5ebee996e67754ac0446d542ab"
checksum = "6900c7d94528217465f6b619f03adb2eecc9682f9083d49ad7d40ec6eda0ed04"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-eth",
@ -537,9 +540,9 @@ dependencies = [
[[package]]
name = "alloy-rpc-types-txpool"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bac37082c3b21283b3faf5cc0e08974272aee2f756ce1adeb26db56a5fce0d5"
checksum = "954781be5ca2e15db08d753712f494504a04771ee4296de1e834e65c105b8ec3"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-eth",
@ -549,9 +552,9 @@ dependencies = [
[[package]]
name = "alloy-serde"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "731f75ec5d383107fd745d781619bd9cedf145836c51ecb991623d41278e71fa"
checksum = "5c1b34ed2d54f2db4ec4f38bcd78d9913f9b2deb065254d3541cc350ba660c0d"
dependencies = [
"alloy-primitives",
"arbitrary",
@ -561,9 +564,9 @@ dependencies = [
[[package]]
name = "alloy-signer"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "307324cca94354cd654d6713629f0383ec037e1ff9e3e3d547212471209860c0"
checksum = "672b6462295502a7eb24e76e16dc8664ece33d168a2cade3bf4dac6a858e054e"
dependencies = [
"alloy-primitives",
"async-trait",
@ -575,9 +578,9 @@ dependencies = [
[[package]]
name = "alloy-signer-local"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fabe917ab1778e760b4701628d1cae8e028ee9d52ac6307de4e1e9286ab6b5f"
checksum = "3da5e8aceb8acfb9c057442622494a101511f564863b8cddc734a4c8f05de797"
dependencies = [
"alloy-consensus",
"alloy-network",
@ -663,9 +666,9 @@ dependencies = [
[[package]]
name = "alloy-transport"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33616b2edf7454302a1d48084db185e52c309f73f6c10be99b0fe39354b3f1e9"
checksum = "5c99b41f0ea73dbbb1f0c970dd7c5150db9040d6201c07daf1ee0bfd74f5fb60"
dependencies = [
"alloy-json-rpc",
"base64 0.22.1",
@ -682,9 +685,9 @@ dependencies = [
[[package]]
name = "alloy-transport-http"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a944f5310c690b62bbb3e7e5ce34527cbd36b2d18532a797af123271ce595a49"
checksum = "e8915d70b52abcefa0d9e463a3d85de82f3dd7d14a0caa94f6ec3802cb462be9"
dependencies = [
"alloy-json-rpc",
"alloy-transport",
@ -697,9 +700,9 @@ dependencies = [
[[package]]
name = "alloy-transport-ipc"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09fd8491249f74d16ec979b1f5672377b12ebb818e6056478ffa386954dbd350"
checksum = "76a02e59183525c052188e82d4c0b746c6725a0f65f3c50a567aca3884c3b21a"
dependencies = [
"alloy-json-rpc",
"alloy-pubsub",
@ -716,9 +719,9 @@ dependencies = [
[[package]]
name = "alloy-transport-ws"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9704761f6297fe482276bee7f77a93cb42bd541c2bd6c1c560b6f3a9ece672e"
checksum = "d90c05fea129762d1ebe8080ea2512fd5bbd4f0fe4a253e4da06656fc801683d"
dependencies = [
"alloy-pubsub",
"alloy-transport",
@ -5097,9 +5100,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
[[package]]
name = "op-alloy-consensus"
version = "0.2.12"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21aad1fbf80d2bcd7406880efc7ba109365f44bbb72896758ddcbfa46bf1592c"
checksum = "274ce39752bdd16614292484839eb3e62139724c15087d9175a5838dab8d6317"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -5114,9 +5117,9 @@ dependencies = [
[[package]]
name = "op-alloy-genesis"
version = "0.2.12"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e1b8a9b70da0e027242ec1762f0f3a386278b6291d00d12ff5a64929dc19f68"
checksum = "b1691c004810c0cda7e429866a8c561f21a26649f4143db61b1ce4e390493ce2"
dependencies = [
"alloy-consensus",
"alloy-eips",
@ -5128,9 +5131,9 @@ dependencies = [
[[package]]
name = "op-alloy-network"
version = "0.2.12"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "783ce4ebc0a994eee2188431511b16692b704e1e8fff0c77d8c0354d3c2b1fc8"
checksum = "f08eccaddff3ecf46c7c9850e4842ef6218481c6829b4135ce230610d0a8f679"
dependencies = [
"alloy-consensus",
"alloy-network",
@ -5142,16 +5145,16 @@ dependencies = [
[[package]]
name = "op-alloy-protocol"
version = "0.2.12"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf300a82ae2d30e2255bfea87a2259da49f63a25a44db561ae64cc9e3084139f"
checksum = "20ca8f42c59b06ed0267e39279c3426576979b9e217db1d0f3f2e8f0c913fc01"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-rlp",
"alloy-serde",
"hashbrown 0.14.5",
"derive_more",
"op-alloy-consensus",
"op-alloy-genesis",
"serde",
@ -5159,17 +5162,16 @@ dependencies = [
[[package]]
name = "op-alloy-rpc-types"
version = "0.2.12"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e281fbfc2198b7c0c16457d6524f83d192662bc9f3df70f24c3038d4521616df"
checksum = "118f7e47fa822356fe4529bfa3b5d828308c1b53769d2e268337fa5b7d357929"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-network-primitives",
"alloy-primitives",
"alloy-rpc-types-eth",
"alloy-serde",
"cfg-if",
"hashbrown 0.14.5",
"op-alloy-consensus",
"serde",
"serde_json",
@ -5177,9 +5179,9 @@ dependencies = [
[[package]]
name = "op-alloy-rpc-types-engine"
version = "0.2.12"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2947272a81ebf988f4804b6f0f6a7c0b2f6f89a908cb410e36f8f3828f81c778"
checksum = "10a5cbbffe83cbec46f19b184b63270c2090ce72c200cff19bc29e1f47519952"
dependencies = [
"alloy-eips",
"alloy-primitives",
@ -9129,9 +9131,9 @@ dependencies = [
[[package]]
name = "revm-inspectors"
version = "0.7.7"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8e3bae0d5c824da0ac883e2521c5e83870d6521eeeccd4ee54266aa3cc1a51"
checksum = "43c44af0bf801f48d25f7baf25cf72aff4c02d610f83b428175228162fef0246"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-eth",
@ -10506,9 +10508,9 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
version = "0.23.1"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd"
checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9"
dependencies = [
"futures-util",
"log",
@ -10852,9 +10854,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "tungstenite"
version = "0.23.0"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8"
checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a"
dependencies = [
"byteorder",
"bytes",

View File

@ -413,7 +413,7 @@ revm = { version = "14.0.3", features = [
"secp256k1",
"blst",
], default-features = false }
revm-inspectors = "0.7.6"
revm-inspectors = "0.8.1"
revm-primitives = { version = "10.0.0", features = [
"std",
], default-features = false }
@ -426,45 +426,45 @@ alloy-rlp = "0.3.4"
alloy-sol-types = "0.8.0"
alloy-trie = { version = "0.6", default-features = false }
alloy-consensus = { version = "0.3.6", default-features = false }
alloy-eips = { version = "0.3.6", default-features = false }
alloy-genesis = { version = "0.3.6", default-features = false }
alloy-json-rpc = { version = "0.3.6", default-features = false }
alloy-network = { version = "0.3.6", default-features = false }
alloy-network-primitives = { version = "0.3.6", default-features = false }
alloy-node-bindings = { version = "0.3.6", default-features = false }
alloy-provider = { version = "0.3.6", features = [
alloy-consensus = { version = "0.4.0", default-features = false }
alloy-eips = { version = "0.4.0", default-features = false }
alloy-genesis = { version = "0.4.0", default-features = false }
alloy-json-rpc = { version = "0.4.0", default-features = false }
alloy-network = { version = "0.4.0", default-features = false }
alloy-network-primitives = { version = "0.4.0", default-features = false }
alloy-node-bindings = { version = "0.4.0", default-features = false }
alloy-provider = { version = "0.4.0", features = [
"reqwest",
], default-features = false }
alloy-pubsub = { version = "0.3.6", default-features = false }
alloy-rpc-client = { version = "0.3.6", default-features = false }
alloy-rpc-types = { version = "0.3.6", features = [
alloy-pubsub = { version = "0.4.0", default-features = false }
alloy-rpc-client = { version = "0.4.0", default-features = false }
alloy-rpc-types = { version = "0.4.0", features = [
"eth",
], default-features = false }
alloy-rpc-types-admin = { version = "0.3.6", default-features = false }
alloy-rpc-types-anvil = { version = "0.3.6", default-features = false }
alloy-rpc-types-beacon = { version = "0.3.6", default-features = false }
alloy-rpc-types-debug = { version = "0.3.6", default-features = false }
alloy-rpc-types-engine = { version = "0.3.6", default-features = false }
alloy-rpc-types-eth = { version = "0.3.6", default-features = false }
alloy-rpc-types-mev = { version = "0.3.6", default-features = false }
alloy-rpc-types-trace = { version = "0.3.6", default-features = false }
alloy-rpc-types-txpool = { version = "0.3.6", default-features = false }
alloy-serde = { version = "0.3.6", default-features = false }
alloy-signer = { version = "0.3.6", default-features = false }
alloy-signer-local = { version = "0.3.6", default-features = false }
alloy-transport = { version = "0.3.6" }
alloy-transport-http = { version = "0.3.6", features = [
alloy-rpc-types-admin = { version = "0.4.0", default-features = false }
alloy-rpc-types-anvil = { version = "0.4.0", default-features = false }
alloy-rpc-types-beacon = { version = "0.4.0", default-features = false }
alloy-rpc-types-debug = { version = "0.4.0", default-features = false }
alloy-rpc-types-engine = { version = "0.4.0", default-features = false }
alloy-rpc-types-eth = { version = "0.4.0", default-features = false }
alloy-rpc-types-mev = { version = "0.4.0", default-features = false }
alloy-rpc-types-trace = { version = "0.4.0", default-features = false }
alloy-rpc-types-txpool = { version = "0.4.0", default-features = false }
alloy-serde = { version = "0.4.0", default-features = false }
alloy-signer = { version = "0.4.0", default-features = false }
alloy-signer-local = { version = "0.4.0", default-features = false }
alloy-transport = { version = "0.4.0" }
alloy-transport-http = { version = "0.4.0", features = [
"reqwest-rustls-tls",
], default-features = false }
alloy-transport-ipc = { version = "0.3.6", default-features = false }
alloy-transport-ws = { version = "0.3.6", default-features = false }
alloy-transport-ipc = { version = "0.4.0", default-features = false }
alloy-transport-ws = { version = "0.4.0", default-features = false }
# op
op-alloy-rpc-types = "0.2.12"
op-alloy-rpc-types-engine = "0.2.12"
op-alloy-network = "0.2.12"
op-alloy-consensus = "0.2.12"
op-alloy-rpc-types = "0.3.1"
op-alloy-rpc-types-engine = "0.3.1"
op-alloy-network = "0.3.1"
op-alloy-consensus = "0.3.1"
# misc
aquamarine = "0.5"

View File

@ -101,8 +101,7 @@ impl Command {
)
.await?;
let new_payload_result =
NewPayloadResult { gas_used: gas_used as u64, latency: start.elapsed() };
let new_payload_result = NewPayloadResult { gas_used, latency: start.elapsed() };
call_forkchoice_updated(&auth_provider, message_version, forkchoice_state, None)
.await?;
@ -120,8 +119,7 @@ impl Command {
info!(%combined_result);
// record the current result
let gas_row =
TotalGasRow { block_number, gas_used: gas_used as u64, time: current_duration };
let gas_row = TotalGasRow { block_number, gas_used, time: current_duration };
results.push((gas_row, combined_result));
}

View File

@ -78,16 +78,14 @@ impl Command {
call_new_payload(&auth_provider, payload, parent_beacon_block_root, versioned_hashes)
.await?;
let new_payload_result =
NewPayloadResult { gas_used: gas_used as u64, latency: start.elapsed() };
let new_payload_result = NewPayloadResult { gas_used, latency: start.elapsed() };
info!(%new_payload_result);
// current duration since the start of the benchmark
let current_duration = total_benchmark_duration.elapsed();
// record the current result
let row =
TotalGasRow { block_number, gas_used: gas_used as u64, time: current_duration };
let row = TotalGasRow { block_number, gas_used, time: current_duration };
results.push((row, new_payload_result));
}

View File

@ -1568,7 +1568,7 @@ mod tests {
Transaction::Eip1559(TxEip1559 {
chain_id: chain_spec.chain.id(),
nonce,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: Address::ZERO.into(),
max_fee_per_gas: EIP1559_INITIAL_BASE_FEE as u128,
..Default::default()
@ -1604,10 +1604,10 @@ mod tests {
let sealed = Header {
number,
parent_hash: parent.unwrap_or_default(),
gas_used: (body.len() as u64 * MIN_TRANSACTION_GAS) as u128,
gas_limit: chain_spec.max_gas_limit.into(),
gas_used: body.len() as u64 * MIN_TRANSACTION_GAS,
gas_limit: chain_spec.max_gas_limit,
mix_hash: B256::random(),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE.into()),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE),
transactions_root,
receipts_root,
state_root: state_root_unhashed(HashMap::from([(

View File

@ -552,18 +552,9 @@ impl CanonicalInMemoryState {
index: index as u64,
block_hash: block_state.hash(),
block_number: block_state.block().block.number,
base_fee: block_state
.block()
.block()
.header
.base_fee_per_gas
.map(|base_fee| base_fee as u64),
base_fee: block_state.block().block().header.base_fee_per_gas,
timestamp: block_state.block().block.timestamp,
excess_blob_gas: block_state
.block()
.block
.excess_blob_gas
.map(|excess_blob| excess_blob as u64),
excess_blob_gas: block_state.block().block.excess_blob_gas,
};
return Some((tx.clone(), meta))
}

View File

@ -89,7 +89,7 @@ impl TestBlockBuilder {
let tx = Transaction::Eip1559(TxEip1559 {
chain_id: self.chain_spec.chain.id(),
nonce,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: Address::random().into(),
max_fee_per_gas: EIP1559_INITIAL_BASE_FEE as u128,
max_priority_fee_per_gas: 1,
@ -132,10 +132,10 @@ impl TestBlockBuilder {
let header = Header {
number,
parent_hash,
gas_used: transactions.len() as u128 * MIN_TRANSACTION_GAS as u128,
gas_limit: self.chain_spec.max_gas_limit.into(),
gas_used: transactions.len() as u64 * MIN_TRANSACTION_GAS,
gas_limit: self.chain_spec.max_gas_limit,
mix_hash: B256::random(),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE.into()),
base_fee_per_gas: Some(EIP1559_INITIAL_BASE_FEE),
transactions_root: calculate_transaction_root(&transactions),
receipts_root: calculate_receipt_root(&receipts),
beneficiary: Address::random(),

View File

@ -2336,7 +2336,7 @@ Post-merge hard forks (timestamp based):
#[test]
fn test_paris_block_and_total_difficulty() {
let genesis = Genesis { gas_limit: 0x2fefd8u128, ..Default::default() };
let genesis = Genesis { gas_limit: 0x2fefd8u64, ..Default::default() };
let paris_chainspec = ChainSpecBuilder::default()
.chain(Chain::from_id(1337))
.genesis(genesis)
@ -2348,7 +2348,7 @@ Post-merge hard forks (timestamp based):
#[test]
fn test_default_cancun_header_forkhash() {
// set the gas limit from the hive test genesis according to the hash
let genesis = Genesis { gas_limit: 0x2fefd8u128, ..Default::default() };
let genesis = Genesis { gas_limit: 0x2fefd8u64, ..Default::default() };
let default_chainspec = ChainSpecBuilder::default()
.chain(Chain::from_id(1337))
.genesis(genesis)

View File

@ -301,7 +301,7 @@ impl StorageInner {
withdrawals_root: withdrawals.map(|w| proofs::calculate_withdrawals_root(w)),
difficulty: U256::from(2),
number: self.best_block + 1,
gas_limit: chain_spec.max_gas_limit().into(),
gas_limit: chain_spec.max_gas_limit(),
timestamp,
base_fee_per_gas,
blob_gas_used: blob_gas_used.map(Into::into),
@ -326,10 +326,8 @@ impl StorageInner {
}
_ => (0, 0),
};
header.excess_blob_gas = Some(
calc_excess_blob_gas(parent_excess_blob_gas as u64, parent_blob_gas_used as u64)
.into(),
)
header.excess_blob_gas =
Some(calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used))
}
header
@ -406,7 +404,7 @@ impl StorageInner {
// now we need to update certain header fields with the results of the execution
header.state_root = db.state_root(hashed_state)?;
header.gas_used = gas_used.into();
header.gas_used = gas_used;
let receipts = execution_outcome.receipts_by_block(header.number);
@ -594,7 +592,7 @@ mod tests {
assert_eq!(header.parent_hash, best_block_hash);
assert_eq!(header.number, best_block_number + 1);
assert_eq!(header.timestamp, timestamp);
assert_eq!(header.gas_limit, chain_spec.max_gas_limit.into());
assert_eq!(header.gas_limit, chain_spec.max_gas_limit);
}
#[test]
@ -688,7 +686,7 @@ mod tests {
withdrawals_root: None,
difficulty: U256::from(2),
number: 1,
gas_limit: chain_spec.max_gas_limit.into(),
gas_limit: chain_spec.max_gas_limit,
timestamp,
base_fee_per_gas: None,
blob_gas_used: Some(0),

View File

@ -619,7 +619,7 @@ mod tests {
let client = TestFullBlockClient::default();
let sealed = Header {
base_fee_per_gas: Some(7),
gas_limit: chain_spec.max_gas_limit.into(),
gas_limit: chain_spec.max_gas_limit,
..Default::default()
}
.seal_slow();

View File

@ -16,8 +16,8 @@ use revm_primitives::calc_excess_blob_gas;
pub const fn validate_header_gas(header: &Header) -> Result<(), ConsensusError> {
if header.gas_used > header.gas_limit {
return Err(ConsensusError::HeaderGasUsedExceedsGasLimit {
gas_used: header.gas_used as u64,
gas_limit: header.gas_limit as u64,
gas_used: header.gas_used,
gas_limit: header.gas_limit,
})
}
Ok(())
@ -66,8 +66,7 @@ pub fn validate_shanghai_withdrawals(block: &SealedBlock) -> Result<(), Consensu
pub fn validate_cancun_gas(block: &SealedBlock) -> Result<(), ConsensusError> {
// Check that the blob gas used in the header matches the sum of the blob gas used by each
// blob tx
let header_blob_gas_used =
block.blob_gas_used.ok_or(ConsensusError::BlobGasUsedMissing)? as u64;
let header_blob_gas_used = block.blob_gas_used.ok_or(ConsensusError::BlobGasUsedMissing)?;
let total_blob_gas = block.blob_gas_used();
if total_blob_gas != header_blob_gas_used {
return Err(ConsensusError::BlobGasUsedDiff(GotExpected {
@ -151,25 +150,25 @@ pub fn validate_4844_header_standalone(header: &Header) -> Result<(), ConsensusE
return Err(ConsensusError::ParentBeaconBlockRootMissing)
}
if blob_gas_used as u64 > MAX_DATA_GAS_PER_BLOCK {
if blob_gas_used > MAX_DATA_GAS_PER_BLOCK {
return Err(ConsensusError::BlobGasUsedExceedsMaxBlobGasPerBlock {
blob_gas_used: blob_gas_used as u64,
blob_gas_used,
max_blob_gas_per_block: MAX_DATA_GAS_PER_BLOCK,
})
}
if blob_gas_used as u64 % DATA_GAS_PER_BLOB != 0 {
if blob_gas_used % DATA_GAS_PER_BLOB != 0 {
return Err(ConsensusError::BlobGasUsedNotMultipleOfBlobGasPerBlob {
blob_gas_used: blob_gas_used as u64,
blob_gas_used,
blob_gas_per_blob: DATA_GAS_PER_BLOB,
})
}
// `excess_blob_gas` must also be a multiple of `DATA_GAS_PER_BLOB`. This will be checked later
// (via `calc_excess_blob_gas`), but it doesn't hurt to catch the problem sooner.
if excess_blob_gas as u64 % DATA_GAS_PER_BLOB != 0 {
if excess_blob_gas % DATA_GAS_PER_BLOB != 0 {
return Err(ConsensusError::ExcessBlobGasNotMultipleOfBlobGasPerBlob {
excess_blob_gas: excess_blob_gas as u64,
excess_blob_gas,
blob_gas_per_blob: DATA_GAS_PER_BLOB,
})
}
@ -225,7 +224,7 @@ pub fn validate_against_parent_eip1559_base_fee<ChainSpec: EthChainSpec + Ethere
chain_spec: &ChainSpec,
) -> Result<(), ConsensusError> {
if chain_spec.fork(EthereumHardfork::London).active_at_block(header.number) {
let base_fee = header.base_fee_per_gas.ok_or(ConsensusError::BaseFeeMissing)? as u64;
let base_fee = header.base_fee_per_gas.ok_or(ConsensusError::BaseFeeMissing)?;
let expected_base_fee =
if chain_spec.fork(EthereumHardfork::London).transitions_at_block(header.number) {
@ -235,7 +234,7 @@ pub fn validate_against_parent_eip1559_base_fee<ChainSpec: EthChainSpec + Ethere
// them.
parent
.next_block_base_fee(chain_spec.base_fee_params_at_timestamp(header.timestamp))
.ok_or(ConsensusError::BaseFeeMissing)? as u64
.ok_or(ConsensusError::BaseFeeMissing)?
};
if expected_base_fee != base_fee {
return Err(ConsensusError::BaseFeeDiff(GotExpected {
@ -277,14 +276,13 @@ pub fn validate_against_parent_4844(
// > are evaluated as 0.
//
// This means in the first post-fork block, calc_excess_blob_gas will return 0.
let parent_blob_gas_used = parent.blob_gas_used.unwrap_or(0) as u64;
let parent_excess_blob_gas = parent.excess_blob_gas.unwrap_or(0) as u64;
let parent_blob_gas_used = parent.blob_gas_used.unwrap_or(0);
let parent_excess_blob_gas = parent.excess_blob_gas.unwrap_or(0);
if header.blob_gas_used.is_none() {
return Err(ConsensusError::BlobGasUsedMissing)
}
let excess_blob_gas =
header.excess_blob_gas.ok_or(ConsensusError::ExcessBlobGasMissing)? as u64;
let excess_blob_gas = header.excess_blob_gas.ok_or(ConsensusError::ExcessBlobGasMissing)?;
let expected_excess_blob_gas =
calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used);
@ -540,7 +538,7 @@ mod tests {
let transaction = mock_blob_tx(1, 10);
let sealed = Header {
base_fee_per_gas: Some(1337u128),
base_fee_per_gas: Some(1337),
withdrawals_root: Some(proofs::calculate_withdrawals_root(&[])),
blob_gas_used: Some(1),
transactions_root: proofs::calculate_transaction_root(&[transaction.clone()]),

View File

@ -197,8 +197,8 @@ pub fn block_to_execution_payload_v3(block: Block) -> ExecutionNewPayload {
logs_bloom: block.header.logs_bloom,
prev_randao: block.header.mix_hash.unwrap(),
block_number: block.header.number,
gas_limit: block.header.gas_limit.try_into().unwrap(),
gas_used: block.header.gas_used.try_into().unwrap(),
gas_limit: block.header.gas_limit,
gas_used: block.header.gas_used,
timestamp: block.header.timestamp,
extra_data: block.header.extra_data.clone(),
base_fee_per_gas: block.header.base_fee_per_gas.unwrap().try_into().unwrap(),
@ -215,8 +215,8 @@ pub fn block_to_execution_payload_v3(block: Block) -> ExecutionNewPayload {
},
withdrawals: block.withdrawals.clone().unwrap_or_default(),
},
blob_gas_used: block.header.blob_gas_used.unwrap().try_into().unwrap(),
excess_blob_gas: block.header.excess_blob_gas.unwrap().try_into().unwrap(),
blob_gas_used: block.header.blob_gas_used.unwrap(),
excess_blob_gas: block.header.excess_blob_gas.unwrap(),
};
ExecutionNewPayload {

View File

@ -29,7 +29,7 @@ impl TransactionTestContext {
/// Creates a deployment transaction and signs it, returning an envelope.
pub async fn deploy_tx(
chain_id: u64,
gas: u128,
gas: u64,
init_code: Bytes,
wallet: PrivateKeySigner,
) -> TxEnvelope {
@ -40,7 +40,7 @@ impl TransactionTestContext {
/// Creates a deployment transaction and signs it, returning bytes.
pub async fn deploy_tx_bytes(
chain_id: u64,
gas: u128,
gas: u64,
init_code: Bytes,
wallet: PrivateKeySigner,
) -> Bytes {
@ -145,7 +145,7 @@ impl TransactionTestContext {
/// Creates a type 2 transaction
fn tx(
chain_id: u64,
gas: u128,
gas: u64,
data: Option<Bytes>,
delegate_to: Option<SignedAuthorization>,
nonce: u64,

View File

@ -175,7 +175,8 @@ where
// Write the witness to the output directory.
let response = ExecutionWitness {
state: std::collections::HashMap::from_iter(state),
state: HashMap::from_iter(state),
codes: Default::default(),
keys: Some(state_preimages),
};
let re_executed_witness_path = self.save_file(

View File

@ -269,7 +269,7 @@ mod tests {
let client = TestFullBlockClient::default();
let sealed = Header {
base_fee_per_gas: Some(7),
gas_limit: chain_spec.max_gas_limit.into(),
gas_limit: chain_spec.max_gas_limit,
..Default::default()
}
.seal_slow();

View File

@ -331,7 +331,7 @@ mod tests {
let client = TestFullBlockClient::default();
let sealed = Header {
base_fee_per_gas: Some(7),
gas_limit: chain_spec.max_gas_limit.into(),
gas_limit: chain_spec.max_gas_limit,
..Default::default()
}
.seal_slow();

View File

@ -302,7 +302,7 @@ where
let mut versioned_hashes = Vec::new();
for tx in candidate_transactions {
// ensure we still have capacity for this transaction
if cumulative_gas_used + tx.gas_limit() > reorg_target.gas_limit as u64 {
if cumulative_gas_used + tx.gas_limit() > reorg_target.gas_limit {
continue
}
@ -371,8 +371,8 @@ where
(
Some(sum_blob_gas_used),
Some(calc_excess_blob_gas(
reorg_target_parent.excess_blob_gas.unwrap_or_default() as u64,
reorg_target_parent.blob_gas_used.unwrap_or_default() as u64,
reorg_target_parent.excess_blob_gas.unwrap_or_default(),
reorg_target_parent.blob_gas_used.unwrap_or_default(),
)),
)
} else {
@ -401,7 +401,7 @@ where
receipts_root: outcome.receipts_root_slow(reorg_target.header.number).unwrap(),
logs_bloom: outcome.block_logs_bloom(reorg_target.header.number).unwrap(),
requests_root: None, // TODO(prague)
gas_used: cumulative_gas_used.into(),
gas_used: cumulative_gas_used,
blob_gas_used: blob_gas_used.map(Into::into),
excess_blob_gas: excess_blob_gas.map(Into::into),
state_root: state_provider.state_root(hashed_state)?,

View File

@ -56,40 +56,35 @@ impl<ChainSpec: EthChainSpec + EthereumHardforks> EthBeaconConsensus<ChainSpec>
// Determine the parent gas limit, considering elasticity multiplier on the London fork.
let parent_gas_limit =
if self.chain_spec.fork(EthereumHardfork::London).transitions_at_block(header.number) {
parent.gas_limit as u64 *
parent.gas_limit *
self.chain_spec
.base_fee_params_at_timestamp(header.timestamp)
.elasticity_multiplier as u64
} else {
parent.gas_limit as u64
parent.gas_limit
};
// Check for an increase in gas limit beyond the allowed threshold.
if header.gas_limit as u64 > parent_gas_limit {
if header.gas_limit as u64 - parent_gas_limit >=
parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR
{
if header.gas_limit > parent_gas_limit {
if header.gas_limit - parent_gas_limit >= parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR {
return Err(ConsensusError::GasLimitInvalidIncrease {
parent_gas_limit,
child_gas_limit: header.gas_limit as u64,
child_gas_limit: header.gas_limit,
})
}
}
// Check for a decrease in gas limit beyond the allowed threshold.
else if parent_gas_limit - header.gas_limit as u64 >=
parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR
else if parent_gas_limit - header.gas_limit >= parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR
{
return Err(ConsensusError::GasLimitInvalidDecrease {
parent_gas_limit,
child_gas_limit: header.gas_limit as u64,
child_gas_limit: header.gas_limit,
})
}
// Check if the self gas limit is below the minimum required limit.
else if header.gas_limit < MINIMUM_GAS_LIMIT.into() {
return Err(ConsensusError::GasLimitInvalidMinimum {
child_gas_limit: header.gas_limit as u64,
})
else if header.gas_limit < MINIMUM_GAS_LIMIT {
return Err(ConsensusError::GasLimitInvalidMinimum { child_gas_limit: header.gas_limit })
}
Ok(())
@ -238,7 +233,7 @@ mod tests {
use reth_primitives::proofs;
fn header_with_gas_limit(gas_limit: u64) -> SealedHeader {
let header = Header { gas_limit: gas_limit.into(), ..Default::default() };
let header = Header { gas_limit, ..Default::default() };
SealedHeader::new(header, B256::ZERO)
}
@ -270,15 +265,15 @@ mod tests {
fn test_invalid_gas_limit_increase_exceeding_limit() {
let parent = header_with_gas_limit(GAS_LIMIT_BOUND_DIVISOR * 10);
let child = header_with_gas_limit(
(parent.gas_limit + parent.gas_limit / GAS_LIMIT_BOUND_DIVISOR as u128 + 1) as u64,
parent.gas_limit + parent.gas_limit / GAS_LIMIT_BOUND_DIVISOR + 1,
);
assert_eq!(
EthBeaconConsensus::new(Arc::new(ChainSpec::default()))
.validate_against_parent_gas_limit(&child, &parent),
Err(ConsensusError::GasLimitInvalidIncrease {
parent_gas_limit: parent.gas_limit as u64,
child_gas_limit: child.gas_limit as u64,
parent_gas_limit: parent.gas_limit,
child_gas_limit: child.gas_limit,
})
);
}
@ -286,7 +281,7 @@ mod tests {
#[test]
fn test_valid_gas_limit_decrease_within_limit() {
let parent = header_with_gas_limit(GAS_LIMIT_BOUND_DIVISOR * 10);
let child = header_with_gas_limit(parent.gas_limit as u64 - 5);
let child = header_with_gas_limit(parent.gas_limit - 5);
assert_eq!(
EthBeaconConsensus::new(Arc::new(ChainSpec::default()))
@ -299,15 +294,15 @@ mod tests {
fn test_invalid_gas_limit_decrease_exceeding_limit() {
let parent = header_with_gas_limit(GAS_LIMIT_BOUND_DIVISOR * 10);
let child = header_with_gas_limit(
(parent.gas_limit - parent.gas_limit / GAS_LIMIT_BOUND_DIVISOR as u128 - 1) as u64,
parent.gas_limit - parent.gas_limit / GAS_LIMIT_BOUND_DIVISOR - 1,
);
assert_eq!(
EthBeaconConsensus::new(Arc::new(ChainSpec::default()))
.validate_against_parent_gas_limit(&child, &parent),
Err(ConsensusError::GasLimitInvalidDecrease {
parent_gas_limit: parent.gas_limit as u64,
child_gas_limit: child.gas_limit as u64,
parent_gas_limit: parent.gas_limit,
child_gas_limit: child.gas_limit,
})
);
}
@ -319,7 +314,7 @@ mod tests {
let chain_spec = Arc::new(ChainSpecBuilder::mainnet().shanghai_activated().build());
let sealed = Header {
base_fee_per_gas: Some(1337u128),
base_fee_per_gas: Some(1337),
withdrawals_root: Some(proofs::calculate_withdrawals_root(&[])),
..Default::default()
}

View File

@ -16,9 +16,9 @@ pub fn validate_block_post_execution<ChainSpec: EthereumHardforks>(
// Check if gas used matches the value set in header.
let cumulative_gas_used =
receipts.last().map(|receipt| receipt.cumulative_gas_used).unwrap_or(0);
if block.gas_used as u64 != cumulative_gas_used {
if block.gas_used != cumulative_gas_used {
return Err(ConsensusError::BlockGasUsed {
gas: GotExpected { got: cumulative_gas_used, expected: block.gas_used as u64 },
gas: GotExpected { got: cumulative_gas_used, expected: block.gas_used },
gas_spent_by_tx: gas_spent_by_transactions(receipts),
})
}

View File

@ -166,7 +166,7 @@ where
for (sender, transaction) in block.transactions_with_sender() {
// The sum of the transactions gas limit, Tg, and the gas utilized in this block prior,
// must be no greater than the blocks gasLimit.
let block_available_gas = (block.header.gas_limit - cumulative_gas_used) as u64;
let block_available_gas = block.header.gas_limit - cumulative_gas_used;
if transaction.gas_limit() > block_available_gas {
return Err(BlockValidationError::TransactionGasLimitMoreThanAvailableBlockGas {
transaction_gas_limit: transaction.gas_limit(),
@ -189,7 +189,7 @@ where
evm.db_mut().commit(state);
// append gas used
cumulative_gas_used += result.gas_used() as u128;
cumulative_gas_used += result.gas_used();
// Push transaction changeset and calculate header bloom filter for receipt.
receipts.push(
@ -199,7 +199,7 @@ where
// Success flag was added in `EIP-658: Embedding transaction status code in
// receipts`.
success: result.is_success(),
cumulative_gas_used: cumulative_gas_used as u64,
cumulative_gas_used,
// convert to reth log
logs: result.into_logs(),
..Default::default()
@ -225,7 +225,7 @@ where
vec![]
};
Ok(EthExecuteOutput { receipts, requests, gas_used: cumulative_gas_used as u64 })
Ok(EthExecuteOutput { receipts, requests, gas_used: cumulative_gas_used })
}
}
@ -808,7 +808,7 @@ mod tests {
timestamp: 1,
number: 1,
parent_beacon_block_root: Some(B256::with_last_byte(0x69)),
base_fee_per_gas: Some(u64::MAX.into()),
base_fee_per_gas: Some(u64::MAX),
excess_blob_gas: Some(0),
..Header::default()
};
@ -1250,7 +1250,7 @@ mod tests {
Transaction::Legacy(TxLegacy {
chain_id: Some(chain_spec.chain.id()),
nonce: 1,
gas_price: header.base_fee_per_gas.unwrap(),
gas_price: header.base_fee_per_gas.unwrap().into(),
gas_limit: 134_807,
to: TxKind::Call(WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS),
// `MIN_WITHDRAWAL_REQUEST_FEE`
@ -1337,7 +1337,7 @@ mod tests {
Transaction::Legacy(TxLegacy {
chain_id: Some(chain_spec.chain.id()),
nonce: 1,
gas_price: header.base_fee_per_gas.unwrap(),
gas_price: header.base_fee_per_gas.unwrap().into(),
gas_limit: 2_500_000, // higher than block gas limit
to: TxKind::Call(WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS),
value: U256::from(1),

View File

@ -145,7 +145,7 @@ impl ConfigureEvmEnv for EthEvmConfig {
None
}
})
.map(|excess_blob_gas| BlobExcessGasAndPrice::new(excess_blob_gas as u64));
.map(BlobExcessGasAndPrice::new);
let mut basefee = parent.next_block_base_fee(
self.chain_spec.base_fee_params_at_timestamp(attributes.timestamp),
@ -165,7 +165,7 @@ impl ConfigureEvmEnv for EthEvmConfig {
gas_limit *= U256::from(elasticity_multiplier);
// set the base fee to the initial base fee from the EIP-1559 spec
basefee = Some(EIP1559_INITIAL_BASE_FEE.into())
basefee = Some(EIP1559_INITIAL_BASE_FEE)
}
let block_env = BlockEnv {

View File

@ -390,7 +390,7 @@ where
excess_blob_gas = if chain_spec.is_cancun_active_at_timestamp(parent_block.timestamp) {
let parent_excess_blob_gas = parent_block.excess_blob_gas.unwrap_or_default();
let parent_blob_gas_used = parent_block.blob_gas_used.unwrap_or_default();
Some(calc_excess_blob_gas(parent_excess_blob_gas as u64, parent_blob_gas_used as u64))
Some(calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used))
} else {
// for the first post-fork block, both parent.blob_gas_used and
// parent.excess_blob_gas are evaluated as 0
@ -412,11 +412,11 @@ where
timestamp: attributes.timestamp,
mix_hash: attributes.prev_randao,
nonce: BEACON_NONCE.into(),
base_fee_per_gas: Some(base_fee.into()),
base_fee_per_gas: Some(base_fee),
number: parent_block.number + 1,
gas_limit: block_gas_limit.into(),
gas_limit: block_gas_limit,
difficulty: U256::ZERO,
gas_used: cumulative_gas_used.into(),
gas_used: cumulative_gas_used,
extra_data,
parent_beacon_block_root: attributes.parent_beacon_block_root,
blob_gas_used: blob_gas_used.map(Into::into),

View File

@ -30,7 +30,7 @@ impl ExecutorMetrics {
where
F: FnOnce(BlockExecutionInput<'_, BlockWithSenders>) -> R,
{
let gas_used = input.block.gas_used as u64;
let gas_used = input.block.gas_used;
// Execute the block and record the elapsed time.
let execute_start = Instant::now();

View File

@ -127,7 +127,7 @@ where
if self.thresholds.is_end_of_batch(
block_number - *self.range.start(),
bundle_size_hint,
cumulative_gas as u64,
cumulative_gas,
batch_start.elapsed(),
) {
break
@ -140,7 +140,7 @@ where
range = ?*self.range.start()..=last_block_number,
block_fetch = ?fetch_block_duration,
execution = ?execution_duration,
throughput = format_gas_throughput(cumulative_gas as u64, execution_duration),
throughput = format_gas_throughput(cumulative_gas, execution_duration),
"Finished executing block range"
);
self.range = last_block_number + 1..=*self.range.end();

View File

@ -101,8 +101,8 @@ fn blocks(
),
difficulty: chain_spec.fork(EthereumHardfork::Paris).ttd().expect("Paris TTD"),
number: 1,
gas_limit: MIN_TRANSACTION_GAS.into(),
gas_used: MIN_TRANSACTION_GAS.into(),
gas_limit: MIN_TRANSACTION_GAS,
gas_used: MIN_TRANSACTION_GAS,
..Default::default()
},
body: BlockBody {
@ -111,7 +111,7 @@ fn blocks(
Transaction::Eip2930(TxEip2930 {
chain_id: chain_spec.chain.id(),
nonce: 0,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
gas_price: 1_500_000_000,
to: TxKind::Call(Address::ZERO),
value: U256::from(0.1 * ETH_TO_WEI as f64),
@ -133,8 +133,8 @@ fn blocks(
),
difficulty: chain_spec.fork(EthereumHardfork::Paris).ttd().expect("Paris TTD"),
number: 2,
gas_limit: MIN_TRANSACTION_GAS.into(),
gas_used: MIN_TRANSACTION_GAS.into(),
gas_limit: MIN_TRANSACTION_GAS,
gas_used: MIN_TRANSACTION_GAS,
..Default::default()
},
body: BlockBody {
@ -143,7 +143,7 @@ fn blocks(
Transaction::Eip2930(TxEip2930 {
chain_id: chain_spec.chain.id(),
nonce: 1,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
gas_price: 1_500_000_000,
to: TxKind::Call(Address::ZERO),
value: U256::from(0.1 * ETH_TO_WEI as f64),

View File

@ -266,8 +266,8 @@ mod tests {
logs_bloom: hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into(),
difficulty: U256::from(0x8aeu64),
number: 0xd05u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
gas_limit: 0x115c,
gas_used: 0x15b3,
timestamp: 0x1a0au64,
extra_data: hex!("7788")[..].into(),
mix_hash: hex!("0000000000000000000000000000000000000000000000000000000000000000").into(),
@ -301,8 +301,8 @@ mod tests {
logs_bloom: hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into(),
difficulty: U256::from(0x8aeu64),
number: 0xd05u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
gas_limit: 0x115c,
gas_used: 0x15b3,
timestamp: 0x1a0au64,
extra_data: hex!("7788")[..].into(),
mix_hash: hex!("0000000000000000000000000000000000000000000000000000000000000000").into(),
@ -401,8 +401,8 @@ mod tests {
logs_bloom: hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into(),
difficulty: U256::from(0x8aeu64),
number: 0xd05u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
gas_limit: 0x115c,
gas_used: 0x15b3,
timestamp: 0x1a0au64,
extra_data: hex!("7788")[..].into(),
mix_hash: hex!("0000000000000000000000000000000000000000000000000000000000000000").into(),
@ -477,8 +477,8 @@ mod tests {
logs_bloom: hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into(),
difficulty: U256::from(0x8aeu64),
number: 0xd05u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
gas_limit: 0x115c,
gas_used: 0x15b3,
timestamp: 0x1a0au64,
extra_data: hex!("7788")[..].into(),
mix_hash: hex!("0000000000000000000000000000000000000000000000000000000000000000").into(),

View File

@ -99,8 +99,8 @@ mod tests {
let header = Header {
difficulty: U256::from(0x8ae_u64),
number: 0xd05_u64,
gas_limit: 0x115c_u128,
gas_used: 0x15b3_u128,
gas_limit: 0x115c,
gas_used: 0x15b3,
timestamp: 0x1a0a_u64,
extra_data: Bytes::from_str("7788").unwrap(),
ommers_hash: B256::ZERO,
@ -131,13 +131,13 @@ mod tests {
logs_bloom: bloom!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
difficulty: U256::from(0x020000),
number: 0x01_u64,
gas_limit: 0x016345785d8a0000_u128,
gas_used: 0x015534_u128,
gas_limit: 0x016345785d8a0000,
gas_used: 0x015534,
timestamp: 0x079e,
extra_data: bytes!("42"),
mix_hash: b256!("0000000000000000000000000000000000000000000000000000000000000000"),
nonce: 0u64.into() ,
base_fee_per_gas: Some(0x036b_u128),
base_fee_per_gas: Some(0x036b),
withdrawals_root: None,
blob_gas_used: None,
excess_blob_gas: None,
@ -154,8 +154,8 @@ mod tests {
let expected = Header {
difficulty: U256::from(0x8aeu64),
number: 0xd05u64,
gas_limit: 0x115cu128,
gas_used: 0x15b3u128,
gas_limit: 0x115c,
gas_used: 0x15b3,
timestamp: 0x1a0au64,
extra_data: Bytes::from_str("7788").unwrap(),
ommers_hash: B256::ZERO,

View File

@ -284,7 +284,7 @@ mod tests {
nonce: 26u64,
max_priority_fee_per_gas: 1500000000,
max_fee_per_gas: 1500000013,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: TxKind::Call(hex!("61815774383099e24810ab832a5b2a5425c154d5").into()),
value: U256::from(3000000000000000000u64),
input: Default::default(),
@ -423,7 +423,7 @@ mod tests {
nonce: 26u64,
max_priority_fee_per_gas: 1500000000,
max_fee_per_gas: 1500000013,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: TxKind::Call(hex!("61815774383099e24810ab832a5b2a5425c154d5").into()),
value: U256::from(3000000000000000000u64),
input: Default::default(),

View File

@ -260,12 +260,12 @@ impl NodeState {
hash=?block.hash(),
peers=self.num_connected_peers(),
txs=block.body.transactions.len(),
gas=%format_gas(block.header.gas_used as u64),
gas_throughput=%format_gas_throughput(block.header.gas_used as u64, elapsed),
gas=%format_gas(block.header.gas_used),
gas_throughput=%format_gas_throughput(block.header.gas_used, elapsed),
full=%format!("{:.1}%", block.header.gas_used as f64 * 100.0 / block.header.gas_limit as f64),
base_fee=%format!("{:.2}gwei", block.header.base_fee_per_gas.unwrap_or(0) as f64 / constants::GWEI_TO_WEI as f64),
blobs=block.header.blob_gas_used.unwrap_or(0) as u64 / constants::eip4844::DATA_GAS_PER_BLOB,
excess_blobs=block.header.excess_blob_gas.unwrap_or(0) as u64 / constants::eip4844::DATA_GAS_PER_BLOB,
blobs=block.header.blob_gas_used.unwrap_or(0) / constants::eip4844::DATA_GAS_PER_BLOB,
excess_blobs=block.header.excess_blob_gas.unwrap_or(0) / constants::eip4844::DATA_GAS_PER_BLOB,
?elapsed,
"Block added to canonical chain"
);

View File

@ -33,9 +33,9 @@ pub fn validate_block_post_execution(
// Check if gas used matches the value set in header.
let cumulative_gas_used =
receipts.last().map(|receipt| receipt.cumulative_gas_used).unwrap_or(0);
if block.gas_used != cumulative_gas_used.into() {
if block.gas_used != cumulative_gas_used {
return Err(ConsensusError::BlockGasUsed {
gas: GotExpected { got: cumulative_gas_used, expected: block.gas_used as u64 },
gas: GotExpected { got: cumulative_gas_used, expected: block.gas_used },
gas_spent_by_tx: gas_spent_by_transactions(receipts),
})
}

View File

@ -146,12 +146,12 @@ where
// The sum of the transactions gas limit, Tg, and the gas utilized in this block prior,
// must be no greater than the blocks gasLimit.
let block_available_gas = block.header.gas_limit - cumulative_gas_used;
if transaction.gas_limit() > block_available_gas as u64 &&
if transaction.gas_limit() > block_available_gas &&
(is_regolith || !transaction.is_system_transaction())
{
return Err(BlockValidationError::TransactionGasLimitMoreThanAvailableBlockGas {
transaction_gas_limit: transaction.gas_limit(),
block_available_gas: block_available_gas as u64,
block_available_gas,
}
.into())
}
@ -196,7 +196,7 @@ where
evm.db_mut().commit(state);
// append gas used
cumulative_gas_used += result.gas_used() as u128;
cumulative_gas_used += result.gas_used();
// Push transaction changeset and calculate header bloom filter for receipt.
receipts.push(Receipt {
@ -204,7 +204,7 @@ where
// Success flag was added in `EIP-658: Embedding transaction status code in
// receipts`.
success: result.is_success(),
cumulative_gas_used: cumulative_gas_used as u64,
cumulative_gas_used,
logs: result.into_logs(),
deposit_nonce: depositor.map(|account| account.nonce),
// The deposit receipt version was introduced in Canyon to indicate an update to how
@ -218,7 +218,7 @@ where
}
drop(evm);
Ok((receipts, cumulative_gas_used as u64))
Ok((receipts, cumulative_gas_used))
}
}
@ -538,7 +538,7 @@ mod tests {
Transaction::Eip1559(TxEip1559 {
chain_id: chain_spec.chain.id(),
nonce: 0,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: addr.into(),
..Default::default()
}),
@ -549,7 +549,7 @@ mod tests {
Transaction::Deposit(reth_primitives::TxDeposit {
from: addr,
to: addr.into(),
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
..Default::default()
}),
Signature::test_signature(),
@ -622,7 +622,7 @@ mod tests {
Transaction::Eip1559(TxEip1559 {
chain_id: chain_spec.chain.id(),
nonce: 0,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: addr.into(),
..Default::default()
}),
@ -633,7 +633,7 @@ mod tests {
Transaction::Deposit(reth_primitives::TxDeposit {
from: addr,
to: addr.into(),
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
..Default::default()
}),
optimism_deposit_tx_signature(),

View File

@ -150,7 +150,7 @@ impl ConfigureEvmEnv for OptimismEvmConfig {
None
}
})
.map(|excess_blob_gas| BlobExcessGasAndPrice::new(excess_blob_gas as u64));
.map(BlobExcessGasAndPrice::new);
let block_env = BlockEnv {
number: U256::from(parent.number + 1),

View File

@ -477,7 +477,7 @@ where
excess_blob_gas = if chain_spec.is_cancun_active_at_timestamp(parent_block.timestamp) {
let parent_excess_blob_gas = parent_block.excess_blob_gas.unwrap_or_default();
let parent_blob_gas_used = parent_block.blob_gas_used.unwrap_or_default();
Some(calc_excess_blob_gas(parent_excess_blob_gas as u64, parent_blob_gas_used as u64))
Some(calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used))
} else {
// for the first post-fork block, both parent.blob_gas_used and
// parent.excess_blob_gas are evaluated as 0
@ -499,11 +499,11 @@ where
timestamp: attributes.payload_attributes.timestamp,
mix_hash: attributes.payload_attributes.prev_randao,
nonce: BEACON_NONCE.into(),
base_fee_per_gas: Some(base_fee.into()),
base_fee_per_gas: Some(base_fee),
number: parent_block.number + 1,
gas_limit: block_gas_limit.into(),
gas_limit: block_gas_limit,
difficulty: U256::ZERO,
gas_used: cumulative_gas_used.into(),
gas_used: cumulative_gas_used,
extra_data,
parent_beacon_block_root: attributes.payload_attributes.parent_beacon_block_root,
blob_gas_used,

View File

@ -59,9 +59,8 @@ where
index: idx as u64,
block_hash,
block_number,
base_fee: base_fee.map(|base_fee| base_fee as u64),
excess_blob_gas: excess_blob_gas
.map(|excess_blob_gas| excess_blob_gas as u64),
base_fee,
excess_blob_gas,
timestamp,
};

View File

@ -86,10 +86,7 @@ where
#[allow(clippy::needless_update)]
let env = TxEnv {
gas_limit: gas_limit
.try_into()
.map_err(|_| RpcInvalidTransactionError::GasUintOverflow)
.map_err(Self::Error::from_eth_err)?,
gas_limit,
nonce,
caller: from.unwrap_or_default(),
gas_price,

View File

@ -52,7 +52,7 @@ impl BlockHeader for Header {
}
fn gas_limit(&self) -> u64 {
self.gas_limit as u64
self.gas_limit
}
fn timestamp(&self) -> u64 {
@ -64,10 +64,10 @@ impl BlockHeader for Header {
}
fn base_fee_per_gas(&self) -> Option<u64> {
self.base_fee_per_gas.map(|base_fee| base_fee as u64)
self.base_fee_per_gas
}
fn excess_blob_gas(&self) -> Option<u64> {
self.excess_blob_gas.map(|excess_blob_gas| excess_blob_gas as u64)
self.excess_blob_gas
}
}

View File

@ -133,15 +133,7 @@ impl SealedHeader {
#[cfg(any(test, feature = "arbitrary"))]
impl<'a> arbitrary::Arbitrary<'a> for SealedHeader {
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
let mut header = Header::arbitrary(u)?;
header.gas_limit = (header.gas_limit as u64).into();
header.gas_used = (header.gas_used as u64).into();
header.base_fee_per_gas =
header.base_fee_per_gas.map(|base_fee_per_gas| (base_fee_per_gas as u64).into());
header.blob_gas_used =
header.blob_gas_used.map(|blob_gas_used| (blob_gas_used as u64).into());
header.excess_blob_gas =
header.excess_blob_gas.map(|excess_blob_gas| (excess_blob_gas as u64).into());
let header = Header::arbitrary(u)?;
let sealed = header.seal_slow();
let (header, seal) = sealed.into_parts();

View File

@ -27,8 +27,8 @@ pub const fn generate_valid_header(
// Set fields based on EIP-4844 being active
if eip_4844_active {
header.blob_gas_used = Some(blob_gas_used as u128);
header.excess_blob_gas = Some(excess_blob_gas as u128);
header.blob_gas_used = Some(blob_gas_used);
header.excess_blob_gas = Some(excess_blob_gas);
header.parent_beacon_block_root = Some(parent_beacon_block_root);
} else {
header.blob_gas_used = None;

View File

@ -212,22 +212,7 @@ impl<'a> arbitrary::Arbitrary<'a> for Block {
.collect::<arbitrary::Result<Vec<_>>>()?;
// then generate up to 2 ommers
let ommers = (0..2)
.map(|_| {
let mut header = Header::arbitrary(u)?;
header.gas_limit = (header.gas_limit as u64).into();
header.gas_used = (header.gas_used as u64).into();
header.base_fee_per_gas = header
.base_fee_per_gas
.map(|base_fee_per_gas| (base_fee_per_gas as u64).into());
header.blob_gas_used =
header.blob_gas_used.map(|blob_gas_used| (blob_gas_used as u64).into());
header.excess_blob_gas =
header.excess_blob_gas.map(|excess_blob_gas| (excess_blob_gas as u64).into());
Ok(header)
})
.collect::<arbitrary::Result<Vec<_>>>()?;
let ommers = (0..2).map(|_| Header::arbitrary(u)).collect::<arbitrary::Result<Vec<_>>>()?;
Ok(Self {
header: u.arbitrary()?,
@ -685,16 +670,7 @@ impl<'a> arbitrary::Arbitrary<'a> for BlockBody {
// then generate up to 2 ommers
let ommers = (0..2)
.map(|_| {
let mut header = Header::arbitrary(u)?;
header.gas_limit = (header.gas_limit as u64).into();
header.gas_used = (header.gas_used as u64).into();
header.base_fee_per_gas = header
.base_fee_per_gas
.map(|base_fee_per_gas| (base_fee_per_gas as u64).into());
header.blob_gas_used =
header.blob_gas_used.map(|blob_gas_used| (blob_gas_used as u64).into());
header.excess_blob_gas =
header.excess_blob_gas.map(|excess_blob_gas| (excess_blob_gas as u64).into());
let header = Header::arbitrary(u)?;
Ok(header)
})

View File

@ -20,7 +20,7 @@ impl FillTxEnv for TransactionSigned {
tx_env.caller = sender;
match self.as_ref() {
Transaction::Legacy(tx) => {
tx_env.gas_limit = tx.gas_limit as u64;
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::from(tx.gas_price);
tx_env.gas_priority_fee = None;
tx_env.transact_to = tx.to;
@ -34,7 +34,7 @@ impl FillTxEnv for TransactionSigned {
tx_env.authorization_list = None;
}
Transaction::Eip2930(tx) => {
tx_env.gas_limit = tx.gas_limit as u64;
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::from(tx.gas_price);
tx_env.gas_priority_fee = None;
tx_env.transact_to = tx.to;
@ -48,7 +48,7 @@ impl FillTxEnv for TransactionSigned {
tx_env.authorization_list = None;
}
Transaction::Eip1559(tx) => {
tx_env.gas_limit = tx.gas_limit as u64;
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::from(tx.max_fee_per_gas);
tx_env.gas_priority_fee = Some(U256::from(tx.max_priority_fee_per_gas));
tx_env.transact_to = tx.to;
@ -62,7 +62,7 @@ impl FillTxEnv for TransactionSigned {
tx_env.authorization_list = None;
}
Transaction::Eip4844(tx) => {
tx_env.gas_limit = tx.gas_limit as u64;
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::from(tx.max_fee_per_gas);
tx_env.gas_priority_fee = Some(U256::from(tx.max_priority_fee_per_gas));
tx_env.transact_to = TxKind::Call(tx.to);
@ -76,7 +76,7 @@ impl FillTxEnv for TransactionSigned {
tx_env.authorization_list = None;
}
Transaction::Eip7702(tx) => {
tx_env.gas_limit = tx.gas_limit as u64;
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::from(tx.max_fee_per_gas);
tx_env.gas_priority_fee = Some(U256::from(tx.max_priority_fee_per_gas));
tx_env.transact_to = tx.to.into();
@ -93,7 +93,7 @@ impl FillTxEnv for TransactionSigned {
#[cfg(feature = "optimism")]
Transaction::Deposit(tx) => {
tx_env.access_list.clear();
tx_env.gas_limit = tx.gas_limit as u64;
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::ZERO;
tx_env.gas_priority_fee = None;
tx_env.transact_to = tx.to;

View File

@ -140,35 +140,29 @@ impl<'a> arbitrary::Arbitrary<'a> for Transaction {
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
let mut tx = match TxType::arbitrary(u)? {
TxType::Legacy => {
let mut tx = TxLegacy::arbitrary(u)?;
tx.gas_limit = (tx.gas_limit as u64).into();
let tx = TxLegacy::arbitrary(u)?;
Self::Legacy(tx)
}
TxType::Eip2930 => {
let mut tx = TxEip2930::arbitrary(u)?;
tx.gas_limit = (tx.gas_limit as u64).into();
let tx = TxEip2930::arbitrary(u)?;
Self::Eip2930(tx)
}
TxType::Eip1559 => {
let mut tx = TxEip1559::arbitrary(u)?;
tx.gas_limit = (tx.gas_limit as u64).into();
let tx = TxEip1559::arbitrary(u)?;
Self::Eip1559(tx)
}
TxType::Eip4844 => {
let mut tx = TxEip4844::arbitrary(u)?;
tx.gas_limit = (tx.gas_limit as u64).into();
let tx = TxEip4844::arbitrary(u)?;
Self::Eip4844(tx)
}
TxType::Eip7702 => {
let mut tx = TxEip7702::arbitrary(u)?;
tx.gas_limit = (tx.gas_limit as u64).into();
let tx = TxEip7702::arbitrary(u)?;
Self::Eip7702(tx)
}
#[cfg(feature = "optimism")]
TxType::Deposit => {
let mut tx = TxDeposit::arbitrary(u)?;
tx.gas_limit = (tx.gas_limit as u64).into();
let tx = TxDeposit::arbitrary(u)?;
Self::Deposit(tx)
}
};
@ -320,9 +314,9 @@ impl Transaction {
Self::Eip1559(TxEip1559 { gas_limit, .. }) |
Self::Eip4844(TxEip4844 { gas_limit, .. }) |
Self::Eip7702(TxEip7702 { gas_limit, .. }) |
Self::Eip2930(TxEip2930 { gas_limit, .. }) => *gas_limit as u64,
Self::Eip2930(TxEip2930 { gas_limit, .. }) => *gas_limit,
#[cfg(feature = "optimism")]
Self::Deposit(TxDeposit { gas_limit, .. }) => *gas_limit as u64,
Self::Deposit(TxDeposit { gas_limit, .. }) => *gas_limit,
}
}
@ -560,13 +554,13 @@ impl Transaction {
/// This sets the transaction's gas limit.
pub fn set_gas_limit(&mut self, gas_limit: u64) {
match self {
Self::Legacy(tx) => tx.gas_limit = gas_limit.into(),
Self::Eip2930(tx) => tx.gas_limit = gas_limit.into(),
Self::Eip1559(tx) => tx.gas_limit = gas_limit.into(),
Self::Eip4844(tx) => tx.gas_limit = gas_limit.into(),
Self::Eip7702(tx) => tx.gas_limit = gas_limit.into(),
Self::Legacy(tx) => tx.gas_limit = gas_limit,
Self::Eip2930(tx) => tx.gas_limit = gas_limit,
Self::Eip1559(tx) => tx.gas_limit = gas_limit,
Self::Eip4844(tx) => tx.gas_limit = gas_limit,
Self::Eip7702(tx) => tx.gas_limit = gas_limit,
#[cfg(feature = "optimism")]
Self::Deposit(tx) => tx.gas_limit = gas_limit.into(),
Self::Deposit(tx) => tx.gas_limit = gas_limit,
}
}
@ -1865,7 +1859,7 @@ mod tests {
nonce: 26,
max_priority_fee_per_gas: 1500000000,
max_fee_per_gas: 1500000013,
gas_limit: MIN_TRANSACTION_GAS as u128,
gas_limit: MIN_TRANSACTION_GAS,
to: Address::from_slice(&hex!("61815774383099e24810ab832a5b2a5425c154d5")[..]).into(),
value: U256::from(3000000000000000000u64),
input: Default::default(),

View File

@ -1,4 +1,4 @@
use alloy_primitives::{Bytes, B256};
use alloy_primitives::{map::HashSet, Bytes, B256};
use alloy_rpc_types::{state::StateOverride, BlockOverrides, Index};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use alloy_rpc_types_trace::{
@ -8,7 +8,6 @@ use alloy_rpc_types_trace::{
};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockId;
use std::collections::HashSet;
/// Ethereum trace API
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "trace"))]

View File

@ -88,7 +88,7 @@ pub trait EthCall: Call + LoadPendingBlock {
self.evm_env_at(block.unwrap_or_default()).await?;
// Gas cap for entire operation
let total_gas_limit = self.call_gas_limit() as u128;
let total_gas_limit = self.call_gas_limit();
let base_block = self.block(block).await?.ok_or(EthApiError::HeaderNotFound(block))?;
let mut parent_hash = base_block.header.hash();
@ -1042,10 +1042,7 @@ pub trait Call: LoadState + SpawnBlocking {
#[allow(clippy::needless_update)]
let env = TxEnv {
gas_limit: gas_limit
.try_into()
.map_err(|_| RpcInvalidTransactionError::GasUintOverflow)
.map_err(Self::Error::from_eth_err)?,
gas_limit,
nonce,
caller: from.unwrap_or_default(),
gas_price,

View File

@ -162,7 +162,7 @@ pub trait EthFees: LoadFee {
for header in &headers {
base_fee_per_gas.push(header.base_fee_per_gas.unwrap_or_default());
base_fee_per_gas.push(header.base_fee_per_gas.unwrap_or_default() as u128);
gas_used_ratio.push(header.gas_used as f64 / header.gas_limit as f64);
base_fee_per_blob_gas.push(header.blob_fee().unwrap_or_default());
blob_gas_used_ratio.push(
@ -180,8 +180,8 @@ pub trait EthFees: LoadFee {
rewards.push(
calculate_reward_percentiles_for_block(
percentiles,
header.gas_used as u64,
header.base_fee_per_gas.unwrap_or_default() as u64,
header.gas_used,
header.base_fee_per_gas.unwrap_or_default(),
&transactions,
&receipts,
)
@ -204,7 +204,7 @@ pub trait EthFees: LoadFee {
last_header.gas_used ,
last_header.gas_limit,
last_header.base_fee_per_gas.unwrap_or_default() ,
),
) as u128,
);
// Same goes for the `base_fee_per_blob_gas`:

View File

@ -444,11 +444,11 @@ pub trait LoadPendingBlock: EthApiTypes {
timestamp: block_env.timestamp.to::<u64>(),
mix_hash: block_env.prevrandao.unwrap_or_default(),
nonce: BEACON_NONCE.into(),
base_fee_per_gas: Some(base_fee.into()),
base_fee_per_gas: Some(base_fee),
number: block_number,
gas_limit: block_gas_limit.into(),
gas_limit: block_gas_limit,
difficulty: U256::ZERO,
gas_used: cumulative_gas_used.into(),
gas_used: cumulative_gas_used,
blob_gas_used: blob_gas_used.map(Into::into),
excess_blob_gas: block_env.get_blob_excess_gas().map(Into::into),
extra_data: Default::default(),

View File

@ -359,16 +359,16 @@ pub trait EthTransactions: LoadTransaction {
if request.nonce.is_none() {
let nonce = self.transaction_count(from, Some(BlockId::pending())).await?;
// note: `.to()` can't panic because the nonce is constructed from a `u64`
request.nonce = Some(nonce.to::<u64>());
request.nonce = Some(nonce.to());
}
let chain_id = self.chain_id();
request.chain_id = Some(chain_id.to::<u64>());
request.chain_id = Some(chain_id.to());
let estimated_gas =
self.estimate_gas_at(request.clone(), BlockId::pending(), None).await?;
let gas_limit = estimated_gas;
request.set_gas_limit(gas_limit.to::<u128>());
request.set_gas_limit(gas_limit.to());
let signed_tx = self.sign_request(&from, request).await?;

View File

@ -359,16 +359,16 @@ impl FeeHistoryEntry {
/// Note: This does not calculate the rewards for the block.
pub fn new(block: &SealedBlock) -> Self {
Self {
base_fee_per_gas: block.base_fee_per_gas.unwrap_or_default() as u64,
base_fee_per_gas: block.base_fee_per_gas.unwrap_or_default(),
gas_used_ratio: block.gas_used as f64 / block.gas_limit as f64,
base_fee_per_blob_gas: block.blob_fee(),
blob_gas_used_ratio: block.blob_gas_used() as f64 /
reth_primitives::constants::eip4844::MAX_DATA_GAS_PER_BLOCK as f64,
excess_blob_gas: block.excess_blob_gas.map(|excess_blob| excess_blob as u64),
blob_gas_used: block.blob_gas_used.map(|block_gas| block_gas as u64),
gas_used: block.gas_used as u64,
excess_blob_gas: block.excess_blob_gas,
blob_gas_used: block.blob_gas_used,
gas_used: block.gas_used,
header_hash: block.hash(),
gas_limit: block.gas_limit as u64,
gas_limit: block.gas_limit,
rewards: Vec::new(),
timestamp: block.timestamp,
}
@ -377,11 +377,11 @@ impl FeeHistoryEntry {
/// Returns the base fee for the next block according to the EIP-1559 spec.
pub fn next_block_base_fee(&self, chain_spec: impl EthChainSpec) -> u64 {
calc_next_block_base_fee(
self.gas_used as u128,
self.gas_limit as u128,
self.base_fee_per_gas as u128,
self.gas_used,
self.gas_limit,
self.base_fee_per_gas,
chain_spec.base_fee_params_at_timestamp(self.timestamp),
) as u64
)
}
/// Returns the blob fee for the next block according to the EIP-4844 spec.

View File

@ -221,9 +221,7 @@ where
let parent_hash = block.parent_hash;
// sort the functions by ascending effective tip first
block.body.transactions.sort_by_cached_key(|tx| {
tx.effective_tip_per_gas(base_fee_per_gas.map(|base_fee| base_fee as u64))
});
block.body.transactions.sort_by_cached_key(|tx| tx.effective_tip_per_gas(base_fee_per_gas));
let mut prices = Vec::with_capacity(limit);
@ -231,8 +229,7 @@ where
let mut effective_gas_tip = None;
// ignore transactions with a tip under the configured threshold
if let Some(ignore_under) = self.ignore_price {
let tip =
tx.effective_tip_per_gas(base_fee_per_gas.map(|base_fee| base_fee as u64));
let tip = tx.effective_tip_per_gas(base_fee_per_gas);
effective_gas_tip = Some(tip);
if tip < Some(ignore_under) {
continue
@ -249,9 +246,7 @@ where
// a `None` effective_gas_tip represents a transaction where the max_fee_per_gas is
// less than the base fee which would be invalid
let effective_gas_tip = effective_gas_tip
.unwrap_or_else(|| {
tx.effective_tip_per_gas(base_fee_per_gas.map(|base_fee| base_fee as u64))
})
.unwrap_or_else(|| tx.effective_tip_per_gas(base_fee_per_gas))
.ok_or(RpcInvalidTransactionError::FeeCapTooLow)?;
prices.push(U256::from(effective_gas_tip));

View File

@ -61,7 +61,7 @@ impl ToRpcError for EthSimulateError {
pub fn resolve_transactions<DB: Database>(
txs: &mut [TransactionRequest],
validation: bool,
block_gas_limit: u128,
block_gas_limit: u64,
chain_id: u64,
db: &mut DB,
) -> Result<Vec<TransactionSigned>, EthApiError>
@ -71,7 +71,7 @@ where
let mut transactions = Vec::with_capacity(txs.len());
let default_gas_limit = {
let total_specified_gas = txs.iter().filter_map(|tx| tx.gas).sum::<u128>();
let total_specified_gas = txs.iter().filter_map(|tx| tx.gas).sum::<u64>();
let txs_without_gas_limit = txs.iter().filter(|tx| tx.gas.is_none()).count();
if total_specified_gas > block_gas_limit {
@ -79,7 +79,7 @@ where
}
if txs_without_gas_limit > 0 {
(block_gas_limit - total_specified_gas) / txs_without_gas_limit as u128
(block_gas_limit - total_specified_gas) / txs_without_gas_limit as u64
} else {
0
}
@ -195,7 +195,7 @@ pub fn build_block<T: TransactionCompat>(
ExecutionResult::Halt { reason, gas_used } => {
let error = RpcInvalidTransactionError::halt(reason, tx.gas_limit());
SimCallResult {
return_value: Bytes::new(),
return_data: Bytes::new(),
error: Some(SimulateError {
code: error.error_code(),
message: error.to_string(),
@ -208,7 +208,7 @@ pub fn build_block<T: TransactionCompat>(
ExecutionResult::Revert { output, gas_used } => {
let error = RevertError::new(output.clone());
SimCallResult {
return_value: output,
return_data: output,
error: Some(SimulateError {
code: error.error_code(),
message: error.to_string(),
@ -219,7 +219,7 @@ pub fn build_block<T: TransactionCompat>(
}
}
ExecutionResult::Success { output, gas_used, logs, .. } => SimCallResult {
return_value: output.into_data(),
return_data: output.into_data(),
error: None,
gas_used,
logs: logs
@ -282,7 +282,7 @@ pub fn build_block<T: TransactionCompat>(
timestamp: block_env.timestamp.to(),
base_fee_per_gas: Some(block_env.basefee.to()),
gas_limit: block_env.gas_limit.to(),
gas_used: calls.iter().map(|c| c.gas_used).sum::<u64>() as u128,
gas_used: calls.iter().map(|c| c.gas_used).sum::<u64>(),
blob_gas_used: Some(0),
parent_hash,
receipts_root: calculate_receipt_root(&receipts),

View File

@ -1,6 +1,6 @@
//! Helpers for testing trace calls.
use alloy_primitives::{Bytes, TxHash, B256};
use alloy_primitives::{map::HashSet, Bytes, TxHash, B256};
use alloy_rpc_types::Index;
use alloy_rpc_types_eth::transaction::TransactionRequest;
use alloy_rpc_types_trace::{
@ -13,7 +13,6 @@ use jsonrpsee::core::client::Error as RpcError;
use reth_primitives::BlockId;
use reth_rpc_api::clients::TraceApiClient;
use std::{
collections::HashSet,
pin::Pin,
task::{Context, Poll},
};
@ -540,7 +539,7 @@ mod tests {
"0xea2817f1aeeb587b82f4ab87a6dbd3560fc35ed28de1be280cb40b2a24ab48bb".parse().unwrap(),
];
let trace_types = HashSet::from([TraceType::StateDiff, TraceType::VmTrace]);
let trace_types = HashSet::from_iter([TraceType::StateDiff, TraceType::VmTrace]);
let mut stream = client.replay_transactions(transactions, trace_types);
let mut successes = 0;
@ -572,7 +571,7 @@ mod tests {
let call_request_1 = TransactionRequest::default();
let call_request_2 = TransactionRequest::default();
let trace_types = HashSet::from([TraceType::StateDiff, TraceType::VmTrace]);
let trace_types = HashSet::from_iter([TraceType::StateDiff, TraceType::VmTrace]);
let calls = vec![(call_request_1, trace_types.clone()), (call_request_2, trace_types)];
let mut stream = client.trace_call_many_stream(calls, None);

View File

@ -1,5 +1,6 @@
//! Integration tests for the trace API.
use alloy_primitives::map::HashSet;
use alloy_rpc_types::{Block, Transaction};
use alloy_rpc_types_trace::{
filter::TraceFilter, parity::TraceType, tracerequest::TraceCallRequest,
@ -10,7 +11,7 @@ use jsonrpsee_http_client::HttpClient;
use reth_primitives::Receipt;
use reth_rpc_api_testing_util::{debug::DebugApiExt, trace::TraceApiExt, utils::parse_env_url};
use reth_rpc_eth_api::EthApiClient;
use std::{collections::HashSet, time::Instant};
use std::time::Instant;
/// This is intended to be run locally against a running node.
///
@ -44,7 +45,7 @@ async fn replay_transactions() {
"0xea2817f1aeeb587b82f4ab87a6dbd3560fc35ed28de1be280cb40b2a24ab48bb".parse().unwrap(),
];
let trace_types = HashSet::from([TraceType::StateDiff, TraceType::VmTrace]);
let trace_types = HashSet::from_iter([TraceType::StateDiff, TraceType::VmTrace]);
let mut stream = client.replay_transactions(tx_hashes, trace_types);
let now = Instant::now();

View File

@ -145,9 +145,9 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader)
difficulty,
mix_hash: Some(mix_hash),
nonce: Some(nonce),
base_fee_per_gas: base_fee_per_gas.map(u128::from),
blob_gas_used: blob_gas_used.map(u128::from),
excess_blob_gas: excess_blob_gas.map(u128::from),
base_fee_per_gas,
blob_gas_used,
excess_blob_gas,
parent_beacon_block_root,
total_difficulty: None,
requests_root,

View File

@ -39,8 +39,8 @@ pub fn try_payload_v1_to_block(payload: ExecutionPayloadV1) -> Result<Block, Pay
withdrawals_root: None,
logs_bloom: payload.logs_bloom,
number: payload.block_number,
gas_limit: payload.gas_limit.into(),
gas_used: payload.gas_used.into(),
gas_limit: payload.gas_limit,
gas_used: payload.gas_used,
timestamp: payload.timestamp,
mix_hash: payload.prev_randao,
// WARNING: Its allowed for a base fee in EIP1559 to increase unbounded. We assume that
@ -84,8 +84,8 @@ pub fn try_payload_v3_to_block(payload: ExecutionPayloadV3) -> Result<Block, Pay
// used and excess blob gas
let mut base_block = try_payload_v2_to_block(payload.payload_inner)?;
base_block.header.blob_gas_used = Some(payload.blob_gas_used.into());
base_block.header.excess_blob_gas = Some(payload.excess_blob_gas.into());
base_block.header.blob_gas_used = Some(payload.blob_gas_used);
base_block.header.excess_blob_gas = Some(payload.excess_blob_gas);
Ok(base_block)
}
@ -143,8 +143,8 @@ pub fn block_to_payload_v1(value: SealedBlock) -> ExecutionPayloadV1 {
logs_bloom: value.logs_bloom,
prev_randao: value.mix_hash,
block_number: value.number,
gas_limit: value.gas_limit as u64,
gas_used: value.gas_used as u64,
gas_limit: value.gas_limit,
gas_used: value.gas_used,
timestamp: value.timestamp,
extra_data: value.extra_data.clone(),
base_fee_per_gas: U256::from(value.base_fee_per_gas.unwrap_or_default()),
@ -166,8 +166,8 @@ pub fn block_to_payload_v2(value: SealedBlock) -> ExecutionPayloadV2 {
logs_bloom: value.logs_bloom,
prev_randao: value.mix_hash,
block_number: value.number,
gas_limit: value.gas_limit as u64,
gas_used: value.gas_used as u64,
gas_limit: value.gas_limit,
gas_used: value.gas_used,
timestamp: value.timestamp,
extra_data: value.extra_data.clone(),
base_fee_per_gas: U256::from(value.base_fee_per_gas.unwrap_or_default()),
@ -182,8 +182,8 @@ pub fn block_to_payload_v2(value: SealedBlock) -> ExecutionPayloadV2 {
pub fn block_to_payload_v3(value: SealedBlock) -> ExecutionPayloadV3 {
let transactions = value.raw_transactions();
ExecutionPayloadV3 {
blob_gas_used: value.blob_gas_used.unwrap_or_default() as u64,
excess_blob_gas: value.excess_blob_gas.unwrap_or_default() as u64,
blob_gas_used: value.blob_gas_used.unwrap_or_default(),
excess_blob_gas: value.excess_blob_gas.unwrap_or_default(),
payload_inner: ExecutionPayloadV2 {
payload_inner: ExecutionPayloadV1 {
parent_hash: value.parent_hash,
@ -193,8 +193,8 @@ pub fn block_to_payload_v3(value: SealedBlock) -> ExecutionPayloadV3 {
logs_bloom: value.logs_bloom,
prev_randao: value.mix_hash,
block_number: value.number,
gas_limit: value.gas_limit as u64,
gas_used: value.gas_used as u64,
gas_limit: value.gas_limit,
gas_used: value.gas_used,
timestamp: value.timestamp,
extra_data: value.extra_data.clone(),
base_fee_per_gas: U256::from(value.base_fee_per_gas.unwrap_or_default()),
@ -426,8 +426,8 @@ pub fn execution_payload_from_sealed_block(value: SealedBlock) -> ExecutionPaylo
logs_bloom: value.logs_bloom,
prev_randao: value.mix_hash,
block_number: value.number,
gas_limit: value.gas_limit as u64,
gas_used: value.gas_used as u64,
gas_limit: value.gas_limit,
gas_used: value.gas_used,
timestamp: value.timestamp,
extra_data: value.extra_data.clone(),
base_fee_per_gas: U256::from(value.base_fee_per_gas.unwrap_or_default()),

View File

@ -129,7 +129,7 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> Transact
gas_price,
max_fee_per_gas,
max_priority_fee_per_gas,
gas: Some(gas as u128),
gas: Some(gas),
value: Some(value),
input: TransactionInput::new(input),
nonce: Some(nonce),

View File

@ -417,9 +417,7 @@ where
let frame: FlatCallFrame = inspector
.with_transaction_gas_limit(env.tx.gas_limit)
.into_parity_builder()
.into_localized_transaction_traces(tx_info)
.pop()
.unwrap();
.into_localized_transaction_traces(tx_info);
Ok(frame)
})
.await?;
@ -667,7 +665,8 @@ where
let state =
state_provider.witness(Default::default(), hashed_state).map_err(Into::into)?;
Ok(ExecutionWitness {
state: std::collections::HashMap::from_iter(state.into_iter()),
state: HashMap::from_iter(state.into_iter()),
codes: Default::default(),
keys: include_preimages.then_some(keys),
})
})
@ -772,9 +771,7 @@ where
let frame: FlatCallFrame = inspector
.with_transaction_gas_limit(env.tx.gas_limit)
.into_parity_builder()
.into_localized_transaction_traces(tx_info)
.pop()
.unwrap();
.into_localized_transaction_traces(tx_info);
return Ok((frame.into(), res.state));
}

View File

@ -448,15 +448,15 @@ mod tests {
for i in (0..block_count).rev() {
let hash = rng.gen();
let gas_limit: u64 = rng.gen();
let gas_used: u64 = rng.gen();
// Note: Generates a u32 to avoid overflows later
// Note: Generates saner values to avoid invalid overflows later
let gas_limit = rng.gen::<u32>() as u64;
let base_fee_per_gas: Option<u64> = rng.gen::<bool>().then(|| rng.gen::<u32>() as u64);
let gas_used = rng.gen::<u32>() as u64;
let header = Header {
number: newest_block - i,
gas_limit: gas_limit.into(),
gas_used: gas_used.into(),
gas_limit,
gas_used,
base_fee_per_gas: base_fee_per_gas.map(Into::into),
parent_hash,
..Default::default()
@ -473,7 +473,7 @@ mod tests {
transaction: reth_primitives::Transaction::Eip1559(
alloy_consensus::TxEip1559 {
max_priority_fee_per_gas: random_fee,
max_fee_per_gas: random_fee + base_fee_per_gas,
max_fee_per_gas: random_fee + base_fee_per_gas as u128,
..Default::default()
},
),
@ -511,7 +511,7 @@ mod tests {
last_header.gas_used,
last_header.gas_limit,
last_header.base_fee_per_gas.unwrap_or_default(),
));
) as u128);
let eth_api = build_test_eth_api(mock_provider);

View File

@ -51,9 +51,8 @@ where
index: idx as u64,
block_hash,
block_number,
base_fee: base_fee.map(|base_fee| base_fee as u64),
excess_blob_gas: excess_blob_gas
.map(|excess_blob_gas| excess_blob_gas as u64),
base_fee,
excess_blob_gas,
timestamp,
};

View File

@ -241,7 +241,7 @@ mod tests {
chain_id: Some(1u64),
from: Some(from),
to: Some(TxKind::Create),
gas: Some(1000u128),
gas: Some(1000),
gas_price: Some(1000u128),
value: Some(U256::from(1000)),
input: TransactionInput {

View File

@ -58,7 +58,7 @@ where
max_fee_per_gas,
max_priority_fee_per_gas: signed_tx.max_priority_fee_per_gas(),
signature: Some(signature),
gas: signed_tx.gas_limit() as u128,
gas: signed_tx.gas_limit(),
input: signed_tx.input().clone(),
chain_id,
access_list,

View File

@ -1,3 +1,4 @@
use alloy_consensus::Transaction;
use alloy_network::{ReceiptResponse, TransactionResponse};
use alloy_primitives::{Address, Bytes, TxHash, B256, U256};
use alloy_rpc_types::{BlockTransactions, Header, TransactionReceipt};

View File

@ -1,7 +1,8 @@
use alloy_primitives::map::HashMap;
use alloy_rpc_types::RpcModules;
use jsonrpsee::core::RpcResult;
use reth_rpc_api::RpcApiServer;
use std::{collections::HashMap, sync::Arc};
use std::sync::Arc;
/// `rpc` API implementation.
///

View File

@ -1,6 +1,6 @@
use std::{collections::HashSet, sync::Arc};
use std::sync::Arc;
use alloy_primitives::{Bytes, B256, U256};
use alloy_primitives::{map::HashSet, Bytes, B256, U256};
use alloy_rpc_types::{
state::{EvmOverrides, StateOverride},
BlockOverrides, Index,

View File

@ -293,7 +293,7 @@ where
target: "sync::stages::execution",
start = last_block,
end = block_number,
throughput = format_gas_throughput((cumulative_gas - last_cumulative_gas) as u64, execution_duration - last_execution_duration),
throughput = format_gas_throughput(cumulative_gas - last_cumulative_gas, execution_duration - last_execution_duration),
"Executed block range"
);
@ -304,7 +304,7 @@ where
}
stage_progress = block_number;
stage_checkpoint.progress.processed += block.gas_used as u64;
stage_checkpoint.progress.processed += block.gas_used;
// If we have ExExes we need to save the block in memory for later
if self.exex_manager_handle.has_exexs() {
@ -316,7 +316,7 @@ where
if self.thresholds.is_end_of_batch(
block_number - start_block,
bundle_size_hint,
cumulative_gas as u64,
cumulative_gas,
batch_start.elapsed(),
) {
break
@ -334,7 +334,7 @@ where
target: "sync::stages::execution",
start = start_block,
end = stage_progress,
throughput = format_gas_throughput(cumulative_gas as u64, execution_duration),
throughput = format_gas_throughput(cumulative_gas, execution_duration),
"Finished executing block range"
);
@ -459,7 +459,7 @@ where
stage_checkpoint.progress.processed -= provider
.block_by_number(block_number)?
.ok_or_else(|| ProviderError::HeaderNotFound(block_number.into()))?
.gas_used as u64;
.gas_used;
}
}
let checkpoint = if let Some(stage_checkpoint) = stage_checkpoint {
@ -572,7 +572,7 @@ fn calculate_gas_used_from_headers(
let duration = start.elapsed();
debug!(target: "sync::stages::execution", ?range, ?duration, "Finished calculating gas used from headers");
Ok(gas_total as u64)
Ok(gas_total)
}
/// Returns a `StaticFileProviderRWRefMut` static file producer after performing a consistency
@ -760,7 +760,7 @@ mod tests {
total
}
}) if processed == previous_stage_checkpoint.progress.processed &&
total == previous_stage_checkpoint.progress.total + block.gas_used as u64);
total == previous_stage_checkpoint.progress.total + block.gas_used);
}
#[test]
@ -801,7 +801,7 @@ mod tests {
total
}
}) if processed == previous_stage_checkpoint.progress.processed &&
total == previous_stage_checkpoint.progress.total + block.gas_used as u64);
total == previous_stage_checkpoint.progress.total + block.gas_used);
}
#[test]
@ -834,7 +834,7 @@ mod tests {
processed: 0,
total
}
}) if total == block.gas_used as u64);
}) if total == block.gas_used);
}
#[tokio::test]
@ -925,7 +925,7 @@ mod tests {
}))
},
done: true
} if processed == total && total == block.gas_used as u64);
} if processed == total && total == block.gas_used);
let provider = factory.provider().unwrap();
@ -1077,7 +1077,7 @@ mod tests {
}
}))
}
} if total == block.gas_used as u64);
} if total == block.gas_used);
// assert unwind stage
assert_eq!(

View File

@ -79,14 +79,14 @@ impl Compact for AlloyHeader {
logs_bloom: self.logs_bloom,
difficulty: self.difficulty,
number: self.number,
gas_limit: self.gas_limit as u64,
gas_used: self.gas_used as u64,
gas_limit: self.gas_limit,
gas_used: self.gas_used,
timestamp: self.timestamp,
mix_hash: self.mix_hash,
nonce: self.nonce.into(),
base_fee_per_gas: self.base_fee_per_gas.map(|base_fee| base_fee as u64),
blob_gas_used: self.blob_gas_used.map(|blob_gas| blob_gas as u64),
excess_blob_gas: self.excess_blob_gas.map(|excess_blob| excess_blob as u64),
base_fee_per_gas: self.base_fee_per_gas,
blob_gas_used: self.blob_gas_used,
excess_blob_gas: self.excess_blob_gas,
parent_beacon_block_root: self.parent_beacon_block_root,
extra_fields: extra_fields.into_option(),
extra_data: self.extra_data.clone(),
@ -107,14 +107,14 @@ impl Compact for AlloyHeader {
logs_bloom: header.logs_bloom,
difficulty: header.difficulty,
number: header.number,
gas_limit: header.gas_limit.into(),
gas_used: header.gas_used.into(),
gas_limit: header.gas_limit,
gas_used: header.gas_used,
timestamp: header.timestamp,
mix_hash: header.mix_hash,
nonce: header.nonce.into(),
base_fee_per_gas: header.base_fee_per_gas.map(Into::into),
blob_gas_used: header.blob_gas_used.map(Into::into),
excess_blob_gas: header.excess_blob_gas.map(Into::into),
base_fee_per_gas: header.base_fee_per_gas,
blob_gas_used: header.blob_gas_used,
excess_blob_gas: header.excess_blob_gas,
parent_beacon_block_root: header.parent_beacon_block_root,
requests_root: header.extra_fields.and_then(|h| h.requests_root),
extra_data: header.extra_data,

View File

@ -33,7 +33,7 @@ impl Compact for AlloyTxEip1559 {
let tx = TxEip1559 {
chain_id: self.chain_id,
nonce: self.nonce,
gas_limit: self.gas_limit as u64,
gas_limit: self.gas_limit,
max_fee_per_gas: self.max_fee_per_gas,
max_priority_fee_per_gas: self.max_priority_fee_per_gas,
to: self.to,
@ -51,7 +51,7 @@ impl Compact for AlloyTxEip1559 {
let alloy_tx = Self {
chain_id: tx.chain_id,
nonce: tx.nonce,
gas_limit: tx.gas_limit.into(),
gas_limit: tx.gas_limit,
max_fee_per_gas: tx.max_fee_per_gas,
max_priority_fee_per_gas: tx.max_priority_fee_per_gas,
to: tx.to,

View File

@ -35,7 +35,7 @@ impl Compact for AlloyTxEip2930 {
chain_id: self.chain_id,
nonce: self.nonce,
gas_price: self.gas_price,
gas_limit: self.gas_limit as u64,
gas_limit: self.gas_limit,
to: self.to,
value: self.value,
access_list: self.access_list.clone(),
@ -50,7 +50,7 @@ impl Compact for AlloyTxEip2930 {
chain_id: tx.chain_id,
nonce: tx.nonce,
gas_price: tx.gas_price,
gas_limit: tx.gas_limit as u128,
gas_limit: tx.gas_limit,
to: tx.to,
value: tx.value,
access_list: tx.access_list,

View File

@ -42,7 +42,7 @@ impl Compact for AlloyTxEip4844 {
let tx = TxEip4844 {
chain_id: self.chain_id,
nonce: self.nonce,
gas_limit: self.gas_limit as u64,
gas_limit: self.gas_limit,
max_fee_per_gas: self.max_fee_per_gas,
max_priority_fee_per_gas: self.max_priority_fee_per_gas,
placeholder: Some(()),
@ -61,7 +61,7 @@ impl Compact for AlloyTxEip4844 {
let alloy_tx = Self {
chain_id: tx.chain_id,
nonce: tx.nonce,
gas_limit: tx.gas_limit as u128,
gas_limit: tx.gas_limit,
max_fee_per_gas: tx.max_fee_per_gas,
max_priority_fee_per_gas: tx.max_priority_fee_per_gas,
to: tx.to,

View File

@ -39,7 +39,7 @@ impl Compact for AlloyTxEip7702 {
nonce: self.nonce,
max_fee_per_gas: self.max_fee_per_gas,
max_priority_fee_per_gas: self.max_priority_fee_per_gas,
gas_limit: self.gas_limit as u64,
gas_limit: self.gas_limit,
to: self.to,
value: self.value,
input: self.input.clone(),
@ -56,7 +56,7 @@ impl Compact for AlloyTxEip7702 {
nonce: tx.nonce,
max_fee_per_gas: tx.max_fee_per_gas,
max_priority_fee_per_gas: tx.max_priority_fee_per_gas,
gas_limit: tx.gas_limit as u128,
gas_limit: tx.gas_limit,
to: tx.to,
value: tx.value,
input: tx.input,

View File

@ -50,7 +50,7 @@ impl Compact for AlloyTxLegacy {
chain_id: self.chain_id,
nonce: self.nonce,
gas_price: self.gas_price,
gas_limit: self.gas_limit as u64,
gas_limit: self.gas_limit,
to: self.to,
value: self.value,
input: self.input.clone(),
@ -66,7 +66,7 @@ impl Compact for AlloyTxLegacy {
chain_id: tx.chain_id,
nonce: tx.nonce,
gas_price: tx.gas_price,
gas_limit: tx.gas_limit.into(),
gas_limit: tx.gas_limit,
to: tx.to,
value: tx.value,
input: tx.input,

View File

@ -36,7 +36,7 @@ impl Compact for AlloyTxDeposit {
to: self.to,
mint: self.mint,
value: self.value,
gas_limit: self.gas_limit as u64,
gas_limit: self.gas_limit,
is_system_transaction: self.is_system_transaction,
input: self.input.clone(),
};
@ -51,7 +51,7 @@ impl Compact for AlloyTxDeposit {
to: tx.to,
mint: tx.mint,
value: tx.value,
gas_limit: tx.gas_limit as u128,
gas_limit: tx.gas_limit,
is_system_transaction: tx.is_system_transaction,
input: tx.input,
};

View File

@ -3766,10 +3766,7 @@ mod tests {
index: 0,
block_hash: in_memory_blocks[0].header.hash(),
block_number: in_memory_blocks[0].header.number,
base_fee: in_memory_blocks[0]
.header
.base_fee_per_gas
.map(|base_fee_per_gas| base_fee_per_gas as u64),
base_fee: in_memory_blocks[0].header.base_fee_per_gas,
excess_blob_gas: None,
timestamp: in_memory_blocks[0].header.timestamp,
};
@ -3797,10 +3794,7 @@ mod tests {
index: 0,
block_hash: database_blocks[0].header.hash(),
block_number: database_blocks[0].header.number,
base_fee: database_blocks[0]
.header
.base_fee_per_gas
.map(|base_fee_per_gas| base_fee_per_gas as u64),
base_fee: database_blocks[0].header.base_fee_per_gas,
excess_blob_gas: None,
timestamp: database_blocks[0].header.timestamp,
};

View File

@ -1958,10 +1958,8 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> TransactionsProvider
index,
block_hash,
block_number,
base_fee: header.base_fee_per_gas.map(|base_fee| base_fee as u64),
excess_blob_gas: header
.excess_blob_gas
.map(|excess_blob| excess_blob as u64),
base_fee: header.base_fee_per_gas,
excess_blob_gas: header.excess_blob_gas,
timestamp: header.timestamp,
};

View File

@ -6,6 +6,7 @@ use crate::{
StateProviderBox, StateProviderFactory, StateReader, StateRootProvider, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::constants::EMPTY_ROOT_HASH;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{
keccak256,
@ -288,14 +289,8 @@ impl TransactionsProvider for MockEthProvider {
index: index as u64,
block_hash: *block_hash,
block_number: block.header.number,
base_fee: block
.header
.base_fee_per_gas
.map(|base_fer_per_gas| base_fer_per_gas as u64),
excess_blob_gas: block
.header
.excess_blob_gas
.map(|excess_blob_gas| excess_blob_gas as u64),
base_fee: block.header.base_fee_per_gas,
excess_blob_gas: block.header.excess_blob_gas,
timestamp: block.header.timestamp,
};
return Ok(Some((tx.clone(), meta)))
@ -642,7 +637,7 @@ impl StorageRootProvider for MockEthProvider {
_address: Address,
_hashed_storage: HashedStorage,
) -> ProviderResult<B256> {
Ok(B256::default())
Ok(EMPTY_ROOT_HASH)
}
}

View File

@ -108,12 +108,12 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
let latest = SealedHeader::new(header, seal);
let chain_spec = client.chain_spec();
let info = BlockInfo {
block_gas_limit: latest.gas_limit as u64,
block_gas_limit: latest.gas_limit,
last_seen_block_hash: latest.hash(),
last_seen_block_number: latest.number,
pending_basefee: latest
.next_block_base_fee(chain_spec.base_fee_params_at_timestamp(latest.timestamp + 12))
.unwrap_or_default() as u64,
.unwrap_or_default(),
pending_blob_fee: latest.next_block_blob_fee(),
};
pool.set_block_info(info);
@ -346,7 +346,7 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
// update the pool first
let update = CanonicalStateUpdate {
new_tip: &new_tip.block,
pending_block_base_fee: pending_block_base_fee as u64,
pending_block_base_fee,
pending_block_blob_fee,
changed_accounts,
// all transactions mined in the new chain need to be removed from the pool
@ -395,10 +395,10 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
maintained_state = MaintainedPoolState::Drifted;
debug!(target: "txpool", ?depth, "skipping deep canonical update");
let info = BlockInfo {
block_gas_limit: tip.gas_limit as u64,
block_gas_limit: tip.gas_limit,
last_seen_block_hash: tip.hash(),
last_seen_block_number: tip.number,
pending_basefee: pending_block_base_fee as u64,
pending_basefee: pending_block_base_fee,
pending_blob_fee: pending_block_blob_fee,
};
pool.set_block_info(info);
@ -429,7 +429,7 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
// Canonical update
let update = CanonicalStateUpdate {
new_tip: &tip.block,
pending_block_base_fee: pending_block_base_fee as u64,
pending_block_base_fee,
pending_block_blob_fee,
changed_accounts,
mined_transactions,

View File

@ -145,7 +145,7 @@ impl TransactionBuilder {
TxLegacy {
chain_id: Some(self.chain_id),
nonce: self.nonce,
gas_limit: self.gas_limit.into(),
gas_limit: self.gas_limit,
gas_price: self.max_fee_per_gas,
to: self.to,
value: self.value,
@ -162,7 +162,7 @@ impl TransactionBuilder {
TxEip1559 {
chain_id: self.chain_id,
nonce: self.nonce,
gas_limit: self.gas_limit.into(),
gas_limit: self.gas_limit,
max_fee_per_gas: self.max_fee_per_gas,
max_priority_fee_per_gas: self.max_priority_fee_per_gas,
to: self.to,
@ -180,7 +180,7 @@ impl TransactionBuilder {
TxEip4844 {
chain_id: self.chain_id,
nonce: self.nonce,
gas_limit: self.gas_limit as u128,
gas_limit: self.gas_limit,
max_fee_per_gas: self.max_fee_per_gas,
max_priority_fee_per_gas: self.max_priority_fee_per_gas,
to: match self.to {

View File

@ -797,7 +797,7 @@ impl TryFrom<TransactionSignedEcRecovered> for MockTransaction {
sender,
nonce,
gas_price,
gas_limit: gas_limit as u64,
gas_limit,
to,
value,
input,
@ -818,7 +818,7 @@ impl TryFrom<TransactionSignedEcRecovered> for MockTransaction {
sender,
nonce,
gas_price,
gas_limit: gas_limit as u64,
gas_limit,
to,
value,
input,
@ -842,7 +842,7 @@ impl TryFrom<TransactionSignedEcRecovered> for MockTransaction {
nonce,
max_fee_per_gas,
max_priority_fee_per_gas,
gas_limit: gas_limit as u64,
gas_limit,
to,
value,
input,
@ -869,7 +869,7 @@ impl TryFrom<TransactionSignedEcRecovered> for MockTransaction {
max_fee_per_gas,
max_priority_fee_per_gas,
max_fee_per_blob_gas,
gas_limit: gas_limit as u64,
gas_limit,
to,
value,
input,
@ -916,15 +916,7 @@ impl From<MockTransaction> for Transaction {
value,
input,
size: _,
} => Self::Legacy(TxLegacy {
chain_id,
nonce,
gas_price,
gas_limit: gas_limit.into(),
to,
value,
input,
}),
} => Self::Legacy(TxLegacy { chain_id, nonce, gas_price, gas_limit, to, value, input }),
MockTransaction::Eip2930 {
chain_id,
hash: _,
@ -941,7 +933,7 @@ impl From<MockTransaction> for Transaction {
chain_id,
nonce,
gas_price,
gas_limit: gas_limit.into(),
gas_limit,
to,
value,
access_list,
@ -963,7 +955,7 @@ impl From<MockTransaction> for Transaction {
} => Self::Eip1559(TxEip1559 {
chain_id,
nonce,
gas_limit: gas_limit.into(),
gas_limit,
max_fee_per_gas,
max_priority_fee_per_gas,
to,
@ -989,7 +981,7 @@ impl From<MockTransaction> for Transaction {
} => Self::Eip4844(TxEip4844 {
chain_id,
nonce,
gas_limit: gas_limit.into(),
gas_limit,
max_fee_per_gas,
max_priority_fee_per_gas,
to,
@ -1026,7 +1018,7 @@ impl proptest::arbitrary::Arbitrary for MockTransaction {
hash: tx_hash,
nonce: *nonce,
gas_price: *gas_price,
gas_limit: *gas_limit as u64,
gas_limit: { *gas_limit },
to: *to,
value: *value,
input: input.clone(),
@ -1048,7 +1040,7 @@ impl proptest::arbitrary::Arbitrary for MockTransaction {
hash: tx_hash,
nonce: *nonce,
gas_price: *gas_price,
gas_limit: *gas_limit as u64,
gas_limit: { *gas_limit },
to: *to,
value: *value,
input: input.clone(),
@ -1072,7 +1064,7 @@ impl proptest::arbitrary::Arbitrary for MockTransaction {
nonce: *nonce,
max_fee_per_gas: *max_fee_per_gas,
max_priority_fee_per_gas: *max_priority_fee_per_gas,
gas_limit: *gas_limit as u64,
gas_limit: { *gas_limit },
to: *to,
value: *value,
input: input.clone(),
@ -1099,7 +1091,7 @@ impl proptest::arbitrary::Arbitrary for MockTransaction {
max_fee_per_gas: *max_fee_per_gas,
max_priority_fee_per_gas: *max_priority_fee_per_gas,
max_fee_per_blob_gas: *max_fee_per_blob_gas,
gas_limit: *gas_limit as u64,
gas_limit: { *gas_limit },
to: *to,
value: *value,
input: input.clone(),

View File

@ -666,7 +666,7 @@ impl<'a> CanonicalStateUpdate<'a> {
/// Returns the block info for the tip block.
pub fn block_info(&self) -> BlockInfo {
BlockInfo {
block_gas_limit: self.new_tip.gas_limit as u64,
block_gas_limit: self.new_tip.gas_limit,
last_seen_block_hash: self.hash(),
last_seen_block_number: self.number(),
pending_basefee: self.pending_block_base_fee,

View File

@ -116,7 +116,7 @@ where
let block_metadata = BlockMetadata {
block_hash: block.hash(),
block_number: block.number,
gas_used: block.gas_used as u64,
gas_used: block.gas_used,
};
actions_to_queue.push(BlobTransactionEvent::Mined(MinedBlob {
transaction,
@ -195,7 +195,7 @@ where
let block_metadata = BlockMetadata {
block_hash: new.tip().block.hash(),
block_number: new.tip().block.number,
gas_used: new.tip().block.gas_used as u64,
gas_used: new.tip().block.gas_used,
};
BlobTransactionEvent::Reorged(ReorgedBlob {
transaction_hash,
@ -268,7 +268,7 @@ async fn fetch_blobs_for_block(
let block_metadata = BlockMetadata {
block_hash: block.hash(),
block_number: block.number,
gas_used: block.gas_used as u64,
gas_used: block.gas_used,
};
BlobTransactionEvent::Mined(MinedBlob { transaction, block_metadata })
})

View File

@ -93,12 +93,12 @@ pub struct Header {
impl From<Header> for SealedHeader {
fn from(value: Header) -> Self {
let header = RethHeader {
base_fee_per_gas: value.base_fee_per_gas.map(|v| v.to::<u64>().into()),
base_fee_per_gas: value.base_fee_per_gas.map(|v| v.to::<u64>()),
beneficiary: value.coinbase,
difficulty: value.difficulty,
extra_data: value.extra_data,
gas_limit: value.gas_limit.to::<u64>().into(),
gas_used: value.gas_used.to::<u64>().into(),
gas_limit: value.gas_limit.to::<u64>(),
gas_used: value.gas_used.to::<u64>(),
mix_hash: value.mix_hash,
nonce: u64::from_be_bytes(value.nonce.0).into(),
number: value.number.to::<u64>(),
@ -110,8 +110,8 @@ impl From<Header> for SealedHeader {
parent_hash: value.parent_hash,
logs_bloom: value.bloom,
withdrawals_root: value.withdrawals_root,
blob_gas_used: value.blob_gas_used.map(|v| v.to::<u64>().into()),
excess_blob_gas: value.excess_blob_gas.map(|v| v.to::<u64>().into()),
blob_gas_used: value.blob_gas_used.map(|v| v.to::<u64>()),
excess_blob_gas: value.excess_blob_gas.map(|v| v.to::<u64>()),
parent_beacon_block_root: value.parent_beacon_block_root,
requests_root: value.requests_root,
};

View File

@ -221,11 +221,11 @@ pub fn random_block<R: Rng>(rng: &mut R, number: u64, block_params: BlockParams)
let sealed = Header {
parent_hash: block_params.parent.unwrap_or_default(),
number,
gas_used: total_gas.into(),
gas_limit: total_gas.into(),
gas_used: total_gas,
gas_limit: total_gas,
transactions_root,
ommers_hash,
base_fee_per_gas: Some(rng.gen::<u64>().into()),
base_fee_per_gas: Some(rng.gen()),
requests_root,
withdrawals_root,
..Default::default()