-
Notifications
You must be signed in to change notification settings - Fork 237
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
feat(network-primitives): expose more fields via block response traits #1229
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few nits
/// Difficulty of the block | ||
fn difficulty(&self) -> U256; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we don't need this, I assume this could eventually be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OP stack based L2s use block.difficulty
for generating random values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I guess block.prevrandao
serves the same purpose on L2s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, pending @klkvr
Motivation
HeaderResponse
exposed very limited fields.BlockResponse
doesn't exposeother
fields in case ofWithOtherFields<Block>
.Solution
miner, gas_limit, mix_hash, difficulty
inHeaderResponse
. Exposing these fields helps to initialize arevm::BlockEnv
like so:other_fields(&self) -> Option<OtherFields>
toBlockResponse
which returnsNone
by default unless overridden.PR Checklist