-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
consensus/beacon,core, params, trie: verkle-compatible access list #29234
Conversation
Co-authored-by: Ignacio Hagopian <jsign.uy@gmail.com>
88689b4
to
361a1a6
Compare
if addrMod { | ||
// In practice, this should not happen, since there is no way to enter the | ||
// scope of 'address' without having the 'address' become already added | ||
// to the access list (via call-variant, create, etc). | ||
// Better safe than sorry, though | ||
s.journal.append(accessListAddAccountChange{&addr}) | ||
} |
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.
This change breaks tests. The comment itself says that this should not happen. My preference is to get rid of it and fix the tests: the reason is that in verkle, state and account are dissociated. It would be possible to link them, but it would be work done for a situation that should not occur in the first place.
Otherwise, I can add a addrMod
return
ContainsAddress(address common.Address) bool | ||
Contains(address common.Address, slot common.Hash) (addressPresent bool, slotPresent bool) | ||
Copy() AccessList | ||
AddAddress(address common.Address, items ALAccountItem, isWrite ALAccessMode) uint64 |
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.
Why is e.g. isWrite
needed?
For example
statedb.Witness().AddAddress(w.Address, state.ALAllItems, state.AccessListWrite)
Why do we need to specify state.ALAllItems
and state.AccessListWrite
?
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.
because verkle charges a different amount of gas whether you are writing or reading the state: https://eips.ethereum.org/EIPS/eip-4762#witness-gas-costs
if chain.Config().IsVerkle(header.Number, header.Time) { | ||
statedb.Witness().AddAddress(w.Address, state.ALAllItems, state.AccessListWrite) | ||
} |
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.
Couldn't the operation statedb.AddBalance(w.Address, amount)
implicitly just add it to the witness without it needing to be done explicitly here?
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.
It can be done in some (but not all) places, but the AddBalance
function then has to be modified to return gas.
|
||
type ALAccountItem uint64 | ||
|
||
const ( |
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.
pls document what these mean / do
AddSlot(address common.Address, slot common.Hash, isWrite ALAccessMode) uint64 | ||
DeleteSlot(address common.Address, slot common.Hash) | ||
DeleteAddress(address common.Address) | ||
|
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.
pls document these
I have two questions/thoughts First of all, the goal of these two things are quite different, aren't they?
And a second question
|
A short summary of my thought from our chat today.
if rules.IsBerlin{
// do things with access lists
} into if rules.Is2929Enabled{
// do things with access lists
} And make verkle-fork set Most of all witness-building can happen in the dynmic gas functions of the following functions:
All three location can be handled in Intrinsically, the witness-builder is a simpler thing than the access list, since there's no journalling. I think the implementation will be much less messy if it is not mingled with accesslist management. |
Augment the interface to
accessList
to support more use cases that are necessary for verkle, in order to merge more data.Highlights:
constantGas
is removed and the warm costs are directly returned byAddSlot
/AddAddress
when needed.AddAddress
is modified to specify which account item is accessed. This does not matter for 2929 but is necessary for verkle.https://eips.ethereum.org/EIPS/eip-4762