Skip to content

L1: Move block hash cached computation from Block to BlockHeader #2841

@fmoletta

Description

@fmoletta

The Block structure has a hash: OnceCell<BlockHash> field used to cache block hash computation. This is pretty useful as it allows us to avoid computing a block's hash multiple times without having to keep track of a second hash variable.
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.
We only need the BlockHeader in order to compute the block's hash, so we can move the cached computation to BlockHeader and still be able to access the cached hash from both Block and BlockHeader

Metadata

Metadata

Assignees

Labels

L1Ethereum clienttech debtRefactors, cleanups, etc

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions