refactor(l1): move hash from Block to BlockHeader#2845
Conversation
Lines of code reportTotal lines added: Detailed view |
| excess_blob_gas: val.excess_blob_gas.map(|x| x.as_u64()), | ||
| parent_beacon_block_root: val.parent_beacon_block_root, | ||
| requests_hash: val.requests_hash, | ||
| ..Default::default() |
There was a problem hiding this comment.
Initializations with ..Default::default() were used instead of hash: OnceCell::new() so we wouldn't need to import once_cell and add it to the Cargo.toml as a dependency. Maybe this is to overkill and its nicer to add it anyways. Let me know!
JereSalo
left a comment
There was a problem hiding this comment.
Cool.
One thing that caught my attention is that the issue #2841 says:
"This is not the case for BlockHeader, as we still need to compute the hash of a header once and then pass it along with the header itself which is not ideal."
Are there any actual cases in the code in which we are passing the BlockHeader alongside it's hash instead of just the BlockHeader now? (It's just a question, maybe there are no cases and it's fine)
Not right now i think. However, this issue comes from this conversation (here) where this would happen. |
…mpute_block_hash` (#2959) **Motivation** After #2845 we were still calculating the hash of headers every time instead of using the `get_or_init` version. **Description** This PR does a couple of thing - Make `hash` function public and `compute_block_hash` private in the BlockHeader - Replace all header `compute_block_hash` calls with `hash` - On blocks, replace all `block.header.hash()` for `block.hash()` instead given that it already delegates internally. - Fixed an [outstanding comment](#2658 (comment)) from #2658 - Increased the size of the DB (it was limiting Holesky syncing) Closes Status: Open. #2926
**Motivation** `Block` had the hash but the `BlockHeader` didn't so they had to be passed along together. <!-- Why does this pull request exist? What are its goals? --> **Description** Move the hash into `BlockHeader`, making it accesible to it and also to `Block` <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 --> Closes lambdaclass#2841
…mpute_block_hash` (lambdaclass#2959) **Motivation** After lambdaclass#2845 we were still calculating the hash of headers every time instead of using the `get_or_init` version. **Description** This PR does a couple of thing - Make `hash` function public and `compute_block_hash` private in the BlockHeader - Replace all header `compute_block_hash` calls with `hash` - On blocks, replace all `block.header.hash()` for `block.hash()` instead given that it already delegates internally. - Fixed an [outstanding comment](lambdaclass#2658 (comment)) from lambdaclass#2658 - Increased the size of the DB (it was limiting Holesky syncing) Closes Status: Open. lambdaclass#2926
Mirrors EELS PR #2845 (tests-bal@v7.1.0, devnets/bal/7): all SELFDESTRUCT state-gas refunds are removed from EIP-8037. Drops the apply_same_tx_selfdestruct_state_refund pass and its call site in the default hook; shared clamp-and-spill bookkeeping fields stay.
Mirrors EELS PR #2845 (tests-bal@v7.1.0, devnets/bal/7): all SELFDESTRUCT state-gas refunds are removed from EIP-8037. Drops the apply_same_tx_selfdestruct_state_refund pass and its call site in the default hook; shared clamp-and-spill bookkeeping fields stay.
**Motivation** Bring ethrex up to bal-devnet-7 (BAL fixtures `bal@v7.1.1`). Stacked on top of #bal-devnet-6-pr (now in main). **Description** Aligns EIP-8037 state-gas accounting with bal-devnet-7 spec progression (EELS PRs lambdaclass#2815 / lambdaclass#2816 / lambdaclass#2823 / lambdaclass#2827 / lambdaclass#2828 / lambdaclass#2836 / lambdaclass#2845 / lambdaclass#2848), bumps Amsterdam fixtures from `snobal-devnet-6@v1.1.0` to `bal@v7.1.1`, and bumps the pinned hive version past the ethrex `--http.api` fix. Main changes: - EIP-8037 state-gas alignment with bal-devnet-7: - System-call state-gas reservoir. - Halt refunds spilled state gas (Policy A). - Tx-level CREATE failure refunds intrinsic `NEW_ACCOUNT`; `intrinsic_state_gas_charged` preserved across the failure path. - Tx-CREATE collision refund with regular-gas burn; billing matches EELS. - Cross-frame revert leaks inline credits. - Cross-frame revert reservoir formula fix. - Block-level `state_gas_used` subtracts `state_refund`. - Remove same-tx SELFDESTRUCT state-gas refund (EELS PR lambdaclass#2845, v7.1.0). - EIP-7702: - `set_delegation` refund via dedicated `state_refund` channel. - `set_delegation` refunds `AUTH_BASE` on existing delegation (EELS PR lambdaclass#2836). - `set_delegation` refunds `AUTH_BASE` on delegation clear (EELS PR lambdaclass#2848, v7.1.1). - levm fixes pulled from main: - `revert` doesn't unmark the account as existing (lambdaclass#6592). - Account erroneously considered as existing after zero-value transfer (lambdaclass#6591). - Tooling / tests: - Per-tx gas-dimension dump on block `gas_used` mismatch. - Bump Amsterdam fixtures to `bal@v7.1.1`. - Annotate BAL balance-mismatch errors with gas-equivalent diff and recognised state-gas constant multiples. - Unskip 74 bal-devnet-6 Amsterdam fixtures now passing. - Skip 21 stale EIP-8025 fixtures pinned at `bal@v5.7.0` (zkevm@v0.3.3 bundle, pre-bal-7). - Drop stale bal-devnet-6 known-issues entries from `docs/known_issues.md` and hive `KNOWN_EXCLUDED_TESTS`. - CI: - Bump pinned hive version past the ethrex `--http.api` flag feature-detect fix (`c4d839b3`, hive lambdaclass#1485). Without this, hive starts ethrex with the default HTTP namespace allowlist (`eth,net,web3`) and tests touching `admin_*`/`debug_*`/`txpool_*` fail. **Local test run** `./run_test.sh` against `tests-bal@v7.1.1`: 2,145 / 2,145 pass. `cargo test -p ethrex-test --tests`: 453 / 453 pass. **Checklist** - [ ] Updated `STORE_SCHEMA_VERSION` (crates/storage/lib.rs) if the PR includes breaking changes to the `Store` requiring a re-sync. --------- Co-authored-by: Lucas Fiegl <iovoid@users.noreply.github.com> Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
Motivation
Blockhad the hash but theBlockHeaderdidn't so they had to be passed along together.Description
Move the hash into
BlockHeader, making it accesible to it and also toBlockCloses #2841