Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Use lazy hashing for Signed #1987

Open
mattsse opened this issue Feb 1, 2025 · 0 comments
Open

[Feature] Use lazy hashing for Signed #1987

mattsse opened this issue Feb 1, 2025 · 0 comments
Labels
blocked This cannot move forward until something else changes discussion needs discussion enhancement New feature or request

Comments

@mattsse
Copy link
Member

mattsse commented Feb 1, 2025

Component

consensus, eips, genesis

Describe the feature you would like

currently the signed type mandates a hash:

#[doc(alias = "tx_hash", alias = "transaction_hash")]
hash: B256,

ideally we can relax this and instead compute the hash on demand if missing via a OnceLock

https://github.com/paradigmxyz/reth/blob/36807928311a91db559db228c3d25615152b4c8b/crates/ethereum/primitives/src/transaction.rs#L298-L300

https://github.com/paradigmxyz/reth/blob/36807928311a91db559db228c3d25615152b4c8b/crates/ethereum/primitives/src/transaction.rs#L355-L359

the signed value is currently just a type T, to compute the hash on demand we'd either need to introduce a new trait (basically Sealable) or we require that T: Transaction
I think we could make T: Transaction because this type is already intended for transactions:

/// A transaction with a signature and hash seal.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Signed<T, Sig = Signature> {

TODO

  • replace B256 with OnceLock

Additional context

No response

@mattsse mattsse added blocked This cannot move forward until something else changes enhancement New feature or request discussion needs discussion labels Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This cannot move forward until something else changes discussion needs discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant