contracts: optimize L1Block.setL1BlockValues#2596
Conversation
|
|
This PR changes implementation code, but doesn't include a changeset. Did you forget to add one? |
|
Recusing myself from review because I don't have enough Solidity knowledge to be helpful. |
|
Hey @tynes! This PR has merge conflicts. Please fix them before continuing review. |
f358735 to
98e1bb6
Compare
|
I have a preference for this implementation because it is much more clear that the underlying storage slots are being packed |
Inphi
left a comment
There was a problem hiding this comment.
kinda annoying that solc cannot perform such a basic optimization.
Looks good. But I wanna make sure that we have sufficient testing such that things doesn't break if the storage layout changes.
|
|
trianglesphere
left a comment
There was a problem hiding this comment.
lgtm. I did look into how solidity does slot packing and I'm happy with the how the yul is storing into the slot.
|
Hey @tynes! This PR has merge conflicts. Please fix them before continuing review. |
The amount of gas required to update the L1 block values can be reduced by ~5000 gas by tightly packing the `uint64`s into a single storage slot. This is important because there will be a single transaction at the beginning of each block that will be updating these values. ~100 gas is saved by using yul instead of straight solidity. I don't feel like the yul is particularly difficult to read in this context, and saving 100 gas per block will add up to a lot over the history of the chain. This logic is covered by foundry fuzzing.
98e1bb6 to
f53fd07
Compare
|
This PR has been added to the merge queue, and will be merged soon. |
|
This PR is next in line to be merged, and will be merged as soon as checks pass. |
### Description Introduces a `CLAUDE.md` file to give Claude Code better context when using the `kona` repository.
Description
The amount of gas required to update the
L1 block values can be reduced by ~5000 gas by tightly
packing the
uint64s into a single storage slot.This is important because there will be a single
transaction at the beginning of each block that will
be updating these values. ~100 gas is saved by using
yul instead of straight solidity. I don't feel like the
yul is particularly difficult to read in this context,
and saving 100 gas per block will add up to a lot over
the history of the chain. This logic is covered by foundry
fuzzing.