mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(execution): Increase cache scope, and apply block reward to cache (#793)
* bug: Apply block reward to evm cache * Move cache to all blocks * add tests * Update crates/executor/src/executor.rs Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com> Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
390
Cargo.lock
generated
390
Cargo.lock
generated
@ -109,9 +109,9 @@ checksum = "a941c39708478e8eea39243b5983f1c42d2717b3620ee91f4a52115fd02ac43f"
|
||||
dependencies = [
|
||||
"itertools 0.9.0",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -123,12 +123,6 @@ dependencies = [
|
||||
"derive_arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.2"
|
||||
@ -157,9 +151,9 @@ version = "0.1.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -212,9 +206,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a8c1df849285fbacd587de7818cc7d13be6cd2cbcd47a04fb1801b0e2706e33"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -289,12 +283,12 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"peeking_take_while",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -569,9 +563,9 @@ checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -603,10 +597,10 @@ name = "codecs-derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"parity-scale-codec",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"serde",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -842,10 +836,10 @@ dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"scratch",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -860,9 +854,9 @@ version = "1.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -893,10 +887,10 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"strsim 0.9.3",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -907,10 +901,10 @@ checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"strsim 0.10.0",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -920,8 +914,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core 0.10.2",
|
||||
"quote",
|
||||
"syn",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -931,8 +925,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e"
|
||||
dependencies = [
|
||||
"darling_core 0.14.2",
|
||||
"quote",
|
||||
"syn",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -980,9 +974,9 @@ version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8a16495aeb28047bb1185fca837baf755e7d71ed3aeed7f8504654ffa927208"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -993,9 +987,9 @@ checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0"
|
||||
dependencies = [
|
||||
"darling 0.10.2",
|
||||
"derive_builder_core",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1005,9 +999,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef"
|
||||
dependencies = [
|
||||
"darling 0.10.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1017,10 +1011,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"rustc_version",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1179,9 +1173,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb0188e3c3ba8df5753894d54461f0e39bc91741dc5b22e1c46999ec2c71f4e4"
|
||||
dependencies = [
|
||||
"enum-ordinalize",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1272,9 +1266,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "570d109b813e904becc80d8d5da38376818a143348413f7149f1340fe04754d4"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1297,10 +1291,21 @@ checksum = "a62bb1df8b45ecb7ffa78dca1c17a438fb193eb083db0b1b494d2a61bcb5096a"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-traits",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"rustc_version",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumn"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e88bcb3a067a6555d577aba299e75eff9942da276e6506fc6274327daa026132"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1395,7 +1400,7 @@ dependencies = [
|
||||
"strum",
|
||||
"thiserror",
|
||||
"tiny-keccak",
|
||||
"unicode-xid",
|
||||
"unicode-xid 0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1585,9 +1590,9 @@ version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2136,9 +2141,9 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2351,9 +2356,9 @@ checksum = "baa6da1e4199c10d7b1d0a6e5e8bd8e55f351163b6f4b3cbb044672a69bd4c1c"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2625,9 +2630,9 @@ version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "731f8ecebd9f3a4aa847dfe75455e4757a45da40a7793d2f0b1f9b6ed18b23f3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2691,9 +2696,9 @@ version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2833,16 +2838,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.16.0"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
@ -2876,9 +2881,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2940,9 +2945,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3066,9 +3071,9 @@ version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3197,9 +3202,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
@ -3209,11 +3214,20 @@ version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.49"
|
||||
@ -3243,6 +3257,17 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proptest-derive"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90b46295382dc76166cb7cf2bb4a97952464e4b7ed5a43e6cd34e1fec3349ddc"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"syn 0.15.44",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "public-ip"
|
||||
version = "0.2.2"
|
||||
@ -3292,13 +3317,22 @@ version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"proc-macro2 1.0.49",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3868,11 +3902,11 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"metrics",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"regex",
|
||||
"serial_test",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"trybuild",
|
||||
]
|
||||
|
||||
@ -4029,9 +4063,9 @@ dependencies = [
|
||||
name = "reth-rlp-derive"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4160,39 +4194,31 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm"
|
||||
version = "2.3.1"
|
||||
source = "git+https://github.com/bluealloy/revm?rev=3a13c9c8a0cda728941f1b26db0beb1025744ea9#3a13c9c8a0cda728941f1b26db0beb1025744ea9"
|
||||
source = "git+https://github.com/bluealloy/revm?rev=a05fb262d87c78ee52d400e6c0f4708d4c527f32#a05fb262d87c78ee52d400e6c0f4708d4c527f32"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"auto_impl",
|
||||
"bytes",
|
||||
"derive_more",
|
||||
"fixed-hash",
|
||||
"hashbrown 0.13.1",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"num_enum",
|
||||
"revm-interpreter",
|
||||
"revm_precompiles",
|
||||
"rlp",
|
||||
"ruint",
|
||||
"sha3",
|
||||
"revm-precompiles",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm-interpreter"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/bluealloy/revm?rev=3a13c9c8a0cda728941f1b26db0beb1025744ea9#3a13c9c8a0cda728941f1b26db0beb1025744ea9"
|
||||
version = "3.0.0"
|
||||
source = "git+https://github.com/bluealloy/revm?rev=a05fb262d87c78ee52d400e6c0f4708d4c527f32#a05fb262d87c78ee52d400e6c0f4708d4c527f32"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"arrayref",
|
||||
"auto_impl",
|
||||
"bytes",
|
||||
"derive_more",
|
||||
"enumn",
|
||||
"fixed-hash",
|
||||
"hashbrown 0.13.1",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"num_enum",
|
||||
"proptest",
|
||||
"proptest-derive",
|
||||
"rlp",
|
||||
"ruint",
|
||||
"serde",
|
||||
@ -4200,12 +4226,13 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm_precompiles"
|
||||
name = "revm-precompiles"
|
||||
version = "1.1.2"
|
||||
source = "git+https://github.com/bluealloy/revm?rev=3a13c9c8a0cda728941f1b26db0beb1025744ea9#3a13c9c8a0cda728941f1b26db0beb1025744ea9"
|
||||
source = "git+https://github.com/bluealloy/revm?rev=a05fb262d87c78ee52d400e6c0f4708d4c527f32#a05fb262d87c78ee52d400e6c0f4708d4c527f32"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hashbrown 0.13.1",
|
||||
"k256",
|
||||
"num",
|
||||
"once_cell",
|
||||
"ripemd",
|
||||
@ -4267,9 +4294,9 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4415,9 +4442,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4580,9 +4607,9 @@ version = "1.0.152"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4631,9 +4658,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3452b4c0f6c1e357f73fdb87cd1efabaa12acf328c7a528e252893baeb3f4aa"
|
||||
dependencies = [
|
||||
"darling 0.14.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4656,9 +4683,9 @@ version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b64f9e531ce97c88b4778aad0ceee079216071cffec6ac9b904277f8f92e7fe3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4889,10 +4916,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"rustversion",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4933,14 +4960,25 @@ dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"unicode-xid 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
@ -4950,10 +4988,10 @@ version = "0.12.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"unicode-xid",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
"unicode-xid 0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5004,8 +5042,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9186daca5c58cb307d09731e0ba06b13fd6c036c90672b9bfc31cecf76cf689"
|
||||
dependencies = [
|
||||
"cargo_metadata",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"serde",
|
||||
"strum_macros",
|
||||
]
|
||||
@ -5019,10 +5057,10 @@ dependencies = [
|
||||
"darling 0.14.2",
|
||||
"if_chain",
|
||||
"lazy_static",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"subprocess",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"test-fuzz-internal",
|
||||
"toolchain_find",
|
||||
"unzip-n",
|
||||
@ -5063,9 +5101,9 @@ version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5164,9 +5202,9 @@ version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5286,9 +5324,9 @@ version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5361,8 +5399,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "744324b12d69a9fc1edea4b38b7b1311295b662d161ad5deac17bb1358224a08"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"quote",
|
||||
"syn",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5537,6 +5575,12 @@ version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.4"
|
||||
@ -5565,9 +5609,9 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2e7e85a0596447f0f2ac090e16bc4c516c6fe91771fb0c0ccf7fa3dae896b9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5666,9 +5710,9 @@ dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@ -5690,7 +5734,7 @@ version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"quote 1.0.23",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
@ -5700,9 +5744,9 @@ version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@ -5966,8 +6010,8 @@ version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"proc-macro2 1.0.49",
|
||||
"quote 1.0.23",
|
||||
"syn 1.0.107",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@ -16,7 +16,7 @@ enr = { version = "0.7", default-features = false, optional = true }
|
||||
rlp = { version = "0.5.2", default-features = false, optional = true }
|
||||
ethereum-types = { version = "0.14", features = ["codec"], optional = true }
|
||||
reth-rlp-derive = { version = "0.1", path = "../rlp-derive", optional = true }
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "3a13c9c8a0cda728941f1b26db0beb1025744ea9", features = ["with-serde"] }
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32", features = ["serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
reth-rlp = { path = ".", package = "reth-rlp", features = [
|
||||
|
||||
@ -215,14 +215,14 @@ impl<Client: HeaderProvider + BlockProvider + StateProvider> ConsensusEngine
|
||||
tx.into_ecrecovered().ok_or(EngineApiError::PayloadSignerRecovery { hash: tx_hash })
|
||||
})
|
||||
.collect::<Result<Vec<_>, EngineApiError>>()?;
|
||||
let state_provider = SubState::new(State::new(&*self.client));
|
||||
let mut state_provider = SubState::new(State::new(&*self.client));
|
||||
let config = (&self.config).into();
|
||||
match executor::execute_and_verify_receipt(
|
||||
&header,
|
||||
&transactions,
|
||||
&[],
|
||||
&config,
|
||||
state_provider,
|
||||
&mut state_provider,
|
||||
) {
|
||||
Ok(_) => Ok(PayloadStatus::new(PayloadStatusEnum::Valid, header.hash())),
|
||||
Err(err) => Ok(PayloadStatus::new(
|
||||
|
||||
@ -14,7 +14,7 @@ reth-rlp = { path = "../common/rlp" }
|
||||
reth-db = { path = "../storage/db" }
|
||||
reth-provider = { path = "../storage/provider" }
|
||||
|
||||
revm = { git = "https://github.com/bluealloy/revm", rev = "3a13c9c8a0cda728941f1b26db0beb1025744ea9" }
|
||||
revm = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32" }
|
||||
|
||||
# remove from reth and reexport from revm
|
||||
hashbrown = "0.13"
|
||||
|
||||
@ -12,8 +12,8 @@ use reth_primitives::{
|
||||
};
|
||||
use reth_provider::StateProvider;
|
||||
use revm::{
|
||||
db::AccountState, Account as RevmAccount, AccountInfo, AnalysisKind, Bytecode, Database,
|
||||
Return, SpecId, EVM,
|
||||
db::AccountState, Account as RevmAccount, AccountInfo, AnalysisKind, Bytecode, Return, SpecId,
|
||||
EVM,
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
@ -251,7 +251,7 @@ pub fn execute_and_verify_receipt<DB: StateProvider>(
|
||||
transactions: &[TransactionSignedEcRecovered],
|
||||
ommers: &[Header],
|
||||
config: &Config,
|
||||
db: SubState<DB>,
|
||||
db: &mut SubState<DB>,
|
||||
) -> Result<ExecutionResult, Error> {
|
||||
let transaction_change_set = execute(header, transactions, ommers, config, db)?;
|
||||
|
||||
@ -301,7 +301,7 @@ pub fn execute<DB: StateProvider>(
|
||||
transactions: &[TransactionSignedEcRecovered],
|
||||
ommers: &[Header],
|
||||
config: &Config,
|
||||
db: SubState<DB>,
|
||||
db: &mut SubState<DB>,
|
||||
) -> Result<ExecutionResult, Error> {
|
||||
let mut evm = EVM::new();
|
||||
evm.database(db);
|
||||
@ -370,7 +370,8 @@ pub fn execute<DB: StateProvider>(
|
||||
.collect();
|
||||
|
||||
// commit state
|
||||
let (changeset, new_bytecodes) = commit_changes(evm.db().unwrap(), state);
|
||||
let (changeset, new_bytecodes) =
|
||||
commit_changes(evm.db().expect("Db to not be moved."), state);
|
||||
|
||||
// Push transaction changeset and calculte header bloom filter for receipt.
|
||||
changesets.push(TransactionChangeSet {
|
||||
@ -391,8 +392,8 @@ pub fn execute<DB: StateProvider>(
|
||||
return Err(Error::BlockGasUsed { got: cumulative_gas_used, expected: header.gas_used })
|
||||
}
|
||||
|
||||
let mut db = evm.db.expect("It is set at the start of the function");
|
||||
let block_reward = block_reward_changeset(header, ommers, &mut db, config)?;
|
||||
let db = evm.db.expect("Db is set at the start of the function");
|
||||
let block_reward = block_reward_changeset(header, ommers, db, config)?;
|
||||
|
||||
Ok(ExecutionResult { changesets, block_reward })
|
||||
}
|
||||
@ -436,24 +437,51 @@ pub fn block_reward_changeset<DB: StateProvider>(
|
||||
*reward_beneficiaries.entry(header.beneficiary).or_default() +=
|
||||
reward + (reward >> 5) * ommers.len() as u128;
|
||||
|
||||
// apply block rewards to beneficiaries (Main block and ommers);
|
||||
//
|
||||
|
||||
// create changesets for beneficiaries rewards (Main block and ommers);
|
||||
reward_beneficiaries
|
||||
.into_iter()
|
||||
.map(|(beneficiary, reward)| -> Result<_, _> {
|
||||
let changeset = db
|
||||
.basic(beneficiary)
|
||||
.map_err(|_| Error::ProviderError)?
|
||||
.load_account(beneficiary)
|
||||
.map_err(|_| Error::ProviderError)
|
||||
// if account is present append `Changed` changeset for block reward
|
||||
.map(|acc| {
|
||||
let old = to_reth_acc(&acc);
|
||||
.map(|db_acc| {
|
||||
let old = to_reth_acc(&db_acc.info);
|
||||
let mut new = old;
|
||||
new.balance += U256::from(reward);
|
||||
AccountInfoChangeSet::Changed { new, old }
|
||||
})
|
||||
// if account is not present append `Created` changeset
|
||||
.unwrap_or(AccountInfoChangeSet::Created {
|
||||
new: Account { nonce: 0, balance: U256::from(reward), bytecode_hash: None },
|
||||
});
|
||||
db_acc.info.balance = new.balance;
|
||||
match db_acc.account_state {
|
||||
AccountState::NotExisting => {
|
||||
// if account was not existing that means that storage is not
|
||||
// present.
|
||||
db_acc.account_state = AccountState::StorageCleared;
|
||||
|
||||
// if account was not present append `Created` changeset
|
||||
AccountInfoChangeSet::Created {
|
||||
new: Account {
|
||||
nonce: 0,
|
||||
balance: new.balance,
|
||||
bytecode_hash: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
AccountState::StorageCleared |
|
||||
AccountState::Touched |
|
||||
AccountState::None => {
|
||||
// If account is None that means that EVM didn't touch it.
|
||||
// we are changing the state to Touched as account can have storage
|
||||
// in db.
|
||||
if db_acc.account_state == AccountState::None {
|
||||
db_acc.account_state = AccountState::Touched;
|
||||
}
|
||||
// if account was present, append changed changeset.
|
||||
AccountInfoChangeSet::Changed { new, old }
|
||||
}
|
||||
}
|
||||
})?;
|
||||
Ok((beneficiary, changeset))
|
||||
})
|
||||
.collect::<Result<BTreeMap<_, _>, _>>()
|
||||
@ -550,9 +578,13 @@ mod tests {
|
||||
|
||||
let mut db = StateProviderTest::default();
|
||||
|
||||
let account1 = H160(hex!("1000000000000000000000000000000000000000"));
|
||||
let account2 = H160(hex!("2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"));
|
||||
let account3 = H160(hex!("a94f5374fce5edbc8e2a8697c15331677e6ebf0b"));
|
||||
|
||||
// pre staet
|
||||
db.insert_account(
|
||||
H160(hex!("1000000000000000000000000000000000000000")),
|
||||
account1,
|
||||
Account { balance: U256::ZERO, nonce: 0x00, bytecode_hash: None },
|
||||
Some(hex!("5a465a905090036002900360015500").into()),
|
||||
HashMap::new(),
|
||||
@ -565,7 +597,7 @@ mod tests {
|
||||
};
|
||||
|
||||
db.insert_account(
|
||||
H160(hex!("a94f5374fce5edbc8e2a8697c15331677e6ebf0b")),
|
||||
account3,
|
||||
Account {
|
||||
balance: U256::from(0x3635c9adc5dea00000u128),
|
||||
nonce: 0x00,
|
||||
@ -579,35 +611,58 @@ mod tests {
|
||||
// make it berlin fork
|
||||
config.spec_upgrades = SpecUpgrades::new_berlin_activated();
|
||||
|
||||
let db = SubState::new(State::new(db));
|
||||
let mut db = SubState::new(State::new(db));
|
||||
let transactions: Vec<TransactionSignedEcRecovered> =
|
||||
block.body.iter().map(|tx| tx.try_ecrecovered().unwrap()).collect();
|
||||
|
||||
// execute chain and verify receipts
|
||||
let out =
|
||||
execute_and_verify_receipt(&block.header, &transactions, &ommers, &config, db).unwrap();
|
||||
execute_and_verify_receipt(&block.header, &transactions, &ommers, &config, &mut db)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(out.changesets.len(), 1, "Should executed one transaction");
|
||||
|
||||
let changesets = out.changesets[0].clone();
|
||||
assert_eq!(changesets.new_bytecodes.len(), 0, "Should have zero new bytecodes");
|
||||
|
||||
let account1 = H160(hex!("1000000000000000000000000000000000000000"));
|
||||
let _account1_info = Account { balance: U256::ZERO, nonce: 0x00, bytecode_hash: None };
|
||||
let account2 = H160(hex!("2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"));
|
||||
let account1_info = Account { balance: U256::ZERO, nonce: 0x00, bytecode_hash: None };
|
||||
let account2_info = Account {
|
||||
balance: U256::from(0x1bc16d674ece94bau128 - 0x1bc16d674ec80000u128), /* decrease for
|
||||
* block reward */
|
||||
nonce: 0x00,
|
||||
bytecode_hash: None,
|
||||
};
|
||||
let account3 = H160(hex!("a94f5374fce5edbc8e2a8697c15331677e6ebf0b"));
|
||||
let account3_info = Account {
|
||||
balance: U256::from(0x3635c9adc5de996b46u128),
|
||||
nonce: 0x01,
|
||||
bytecode_hash: None,
|
||||
};
|
||||
|
||||
let block_reward = U256::from(WEI_2ETH + (WEI_2ETH >> 5));
|
||||
|
||||
// Check if cache is set
|
||||
// account1
|
||||
let cached_acc1 = db.accounts.get(&account1).unwrap();
|
||||
assert_eq!(cached_acc1.info.balance, account1_info.balance);
|
||||
assert_eq!(cached_acc1.info.nonce, account1_info.nonce);
|
||||
assert!(matches!(cached_acc1.account_state, AccountState::Touched));
|
||||
assert_eq!(cached_acc1.storage.len(), 1);
|
||||
assert_eq!(cached_acc1.storage.get(&U256::from(1)), Some(&U256::from(2)));
|
||||
|
||||
// account2 Block reward
|
||||
let cached_acc2 = db.accounts.get(&account2).unwrap();
|
||||
assert_eq!(cached_acc2.info.balance, account2_info.balance + block_reward);
|
||||
assert_eq!(cached_acc2.info.nonce, account2_info.nonce);
|
||||
assert_eq!(cached_acc2.account_state, AccountState::Touched);
|
||||
assert_eq!(cached_acc2.storage.len(), 0);
|
||||
|
||||
// account3
|
||||
let cached_acc3 = db.accounts.get(&account3).unwrap();
|
||||
assert_eq!(cached_acc3.info.balance, account3_info.balance);
|
||||
assert_eq!(cached_acc3.info.nonce, account3_info.nonce);
|
||||
assert!(matches!(cached_acc3.account_state, AccountState::Touched));
|
||||
assert_eq!(cached_acc3.storage.len(), 0);
|
||||
|
||||
assert_eq!(
|
||||
changesets.changeset.get(&account1).unwrap().account,
|
||||
AccountInfoChangeSet::NoChange,
|
||||
@ -627,8 +682,9 @@ mod tests {
|
||||
// check block rewards changeset.
|
||||
let mut block_rewarded_acc_info = account2_info;
|
||||
// add Blocks 2 eth reward and 2>>5 for one ommer
|
||||
block_rewarded_acc_info.balance += U256::from(WEI_2ETH + (WEI_2ETH >> 5));
|
||||
block_rewarded_acc_info.balance += block_reward;
|
||||
|
||||
// check block reward changeset
|
||||
assert_eq!(
|
||||
out.block_reward,
|
||||
Some(BTreeMap::from([
|
||||
|
||||
@ -14,7 +14,7 @@ proc-macro2 = "1.0"
|
||||
syn = { version = "1.0", features = ["extra-traits"] }
|
||||
quote = "1.0"
|
||||
regex = "1.6.0"
|
||||
once_cell = "1.15.0"
|
||||
once_cell = "1.17.0"
|
||||
|
||||
[dev-dependencies]
|
||||
metrics = "0.20.1"
|
||||
|
||||
@ -26,5 +26,5 @@ tracing = "0.1.37"
|
||||
[dev-dependencies]
|
||||
reth-interfaces = { path = "../../interfaces", features = ["test-utils"] }
|
||||
assert_matches = "1.5.0"
|
||||
once_cell = "1.15.0"
|
||||
once_cell = "1.17.0"
|
||||
tokio = { version = "1.21.2", features = ["full"] }
|
||||
|
||||
@ -17,7 +17,7 @@ reth-rlp = { path = "../common/rlp", features = [
|
||||
reth-rlp-derive = { path = "../common/rlp-derive" }
|
||||
reth-codecs = { version = "0.1.0", path = "../storage/codecs" }
|
||||
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "3a13c9c8a0cda728941f1b26db0beb1025744ea9", features = ["with-serde"] }
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32", features = ["serde"] }
|
||||
|
||||
# ethereum
|
||||
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
|
||||
@ -68,7 +68,7 @@ serde_json = "1.0"
|
||||
hex-literal = "0.3"
|
||||
test-fuzz = "3.0.4"
|
||||
rand = "0.8"
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "3a13c9c8a0cda728941f1b26db0beb1025744ea9", features = ["with-serde", "arbitrary"] }
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32", features = ["serde", "arbitrary"] }
|
||||
proptest = { version = "1.0" }
|
||||
|
||||
|
||||
|
||||
@ -131,6 +131,9 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
// Create state provider with cached state
|
||||
let mut state_provider = SubState::new(State::new(LatestStateProviderRef::new(&**tx)));
|
||||
|
||||
// Fetch transactions, execute them and generate results
|
||||
let mut block_change_patches = Vec::with_capacity(canonical_batch.len());
|
||||
for (header, body, ommers) in block_batch.iter() {
|
||||
@ -174,9 +177,6 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
})
|
||||
.collect();
|
||||
|
||||
// for now use default eth config
|
||||
let state_provider = SubState::new(State::new(LatestStateProviderRef::new(&**tx)));
|
||||
|
||||
trace!(target: "sync::stages::execution", number = header.number, txs = recovered_transactions.len(), "Executing block");
|
||||
|
||||
// For ethereum tests that has MAX gas that calls contract until max depth (1024 calls)
|
||||
@ -194,7 +194,7 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
&recovered_transactions,
|
||||
ommers,
|
||||
&self.config,
|
||||
state_provider,
|
||||
&mut state_provider,
|
||||
)
|
||||
})
|
||||
.expect("Expects that thread name is not null");
|
||||
@ -242,7 +242,7 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
"{address} setting storage:{key} ({old_value} -> {new_value})"
|
||||
);
|
||||
|
||||
// Always delete old value as duplicate table put will not override it
|
||||
// Always delete old value as duplicate table, put will not override it
|
||||
tx.delete::<tables::PlainStorageState>(
|
||||
address,
|
||||
Some(StorageEntry { key: hkey, value: old_value }),
|
||||
@ -264,8 +264,8 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
trace!(target: "sync::stages::execution", ?hash, ?bytecode, len = bytecode.len(), "Inserting bytecode");
|
||||
tx.put::<tables::Bytecodes>(hash, bytecode[..bytecode.len()].to_vec())?;
|
||||
|
||||
// NOTE: bytecode bytes are not inserted in change set and it stand in saparate
|
||||
// table
|
||||
// NOTE: bytecode bytes are not inserted in change set and can be found in
|
||||
// separate table
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,18 +297,13 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
let mut account_changeset = tx.cursor_dup_mut::<tables::AccountChangeSet>()?;
|
||||
let mut storage_changeset = tx.cursor_dup_mut::<tables::StorageChangeSet>()?;
|
||||
|
||||
let from_transition = tx.get_block_transition_by_num(input.stage_progress)?;
|
||||
let from_transition_rev = tx.get_block_transition_by_num(input.unwind_to)? + 1;
|
||||
let to_transition_rev = tx.get_block_transition_by_num(input.stage_progress)? + 1;
|
||||
|
||||
let to_transition = if input.unwind_to != 0 {
|
||||
tx.get_block_transition_by_num(input.unwind_to - 1)?
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
if to_transition > from_transition {
|
||||
panic!("Unwind transition {} (stage progress block #{}) is higher than the transition {} of (unwind block #{})", to_transition, input.stage_progress, from_transition, input.unwind_to);
|
||||
if from_transition_rev > to_transition_rev {
|
||||
panic!("Unwind transition {} (stage progress block #{}) is higher than the transition {} of (unwind block #{})", from_transition_rev, input.stage_progress, to_transition_rev, input.unwind_to);
|
||||
}
|
||||
let num_of_tx = (from_transition - to_transition) as usize;
|
||||
let num_of_tx = (to_transition_rev - from_transition_rev) as usize;
|
||||
|
||||
// if there is no transaction ids, this means blocks were empty and block reward change set
|
||||
// is not present.
|
||||
@ -318,11 +313,10 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
|
||||
// get all batches for account change
|
||||
// Check if walk and walk_dup would do the same thing
|
||||
// TODO(dragan) test walking here
|
||||
let account_changeset_batch = account_changeset
|
||||
.walk(to_transition)?
|
||||
.walk(from_transition_rev)?
|
||||
.take_while(|item| {
|
||||
item.as_ref().map(|(num, _)| *num <= from_transition).unwrap_or_default()
|
||||
item.as_ref().map(|(num, _)| *num < to_transition_rev).unwrap_or_default()
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
@ -336,19 +330,18 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(dragan) fix walking here
|
||||
// get all batches for storage change
|
||||
let storage_chageset_batch = storage_changeset
|
||||
.walk((to_transition, Address::zero()).into())?
|
||||
let storage_changeset_batch = storage_changeset
|
||||
.walk((from_transition_rev, Address::zero()).into())?
|
||||
.take_while(|item| {
|
||||
item.as_ref()
|
||||
.map(|(key, _)| key.transition_id() <= from_transition)
|
||||
.map(|(key, _)| key.transition_id() < to_transition_rev)
|
||||
.unwrap_or_default()
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
// revert all changes to PlainStorage
|
||||
for (key, storage) in storage_chageset_batch.into_iter().rev() {
|
||||
for (key, storage) in storage_changeset_batch.into_iter().rev() {
|
||||
let address = key.address();
|
||||
tx.put::<tables::PlainStorageState>(address, storage.clone())?;
|
||||
if storage.value == U256::ZERO {
|
||||
@ -360,7 +353,7 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
// Discard unwinded changesets
|
||||
let mut entry = account_changeset.last()?;
|
||||
while let Some((transition_id, _)) = entry {
|
||||
if transition_id < to_transition {
|
||||
if transition_id < from_transition_rev {
|
||||
break
|
||||
}
|
||||
account_changeset.delete_current()?;
|
||||
@ -369,7 +362,7 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
|
||||
let mut entry = storage_changeset.last()?;
|
||||
while let Some((key, _)) = entry {
|
||||
if key.transition_id() < to_transition {
|
||||
if key.transition_id() < from_transition_rev {
|
||||
break
|
||||
}
|
||||
storage_changeset.delete_current()?;
|
||||
|
||||
@ -16,7 +16,7 @@ no_codec = ["codecs-derive/no_codec"]
|
||||
[dependencies]
|
||||
bytes = "1.2.1"
|
||||
codecs-derive = { version = "0.1.0", path = "./derive", default-features = false }
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "3a13c9c8a0cda728941f1b26db0beb1025744ea9", features = ["with-serde"] }
|
||||
revm-interpreter = { git = "https://github.com/bluealloy/revm", rev = "a05fb262d87c78ee52d400e6c0f4708d4c527f32", features = ["serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serde = "1.0"
|
||||
|
||||
Reference in New Issue
Block a user