mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
Fixes to access list and state overrides (#3570)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
This commit is contained in:
parent
20452c3dd6
commit
266625f56a
@ -336,7 +336,6 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi.CallArgs,
|
|||||||
} else {
|
} else {
|
||||||
stateReader = state.NewPlainState(tx, blockNumber)
|
stateReader = state.NewPlainState(tx, blockNumber)
|
||||||
}
|
}
|
||||||
state := state.New(stateReader)
|
|
||||||
|
|
||||||
header := block.Header()
|
header := block.Header()
|
||||||
// If the gas amount is not set, extract this as it will depend on access
|
// If the gas amount is not set, extract this as it will depend on access
|
||||||
@ -373,6 +372,7 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi.CallArgs,
|
|||||||
prevTracer = logger.NewAccessListTracer(*args.AccessList, *args.From, to, precompiles)
|
prevTracer = logger.NewAccessListTracer(*args.AccessList, *args.From, to, precompiles)
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
|
state := state.New(stateReader)
|
||||||
// Retrieve the current access list to expand
|
// Retrieve the current access list to expand
|
||||||
accessList := prevTracer.AccessList()
|
accessList := prevTracer.AccessList()
|
||||||
log.Trace("Creating access list", "input", accessList)
|
log.Trace("Creating access list", "input", accessList)
|
||||||
|
@ -156,6 +156,11 @@ func (so *stateObject) touch() {
|
|||||||
|
|
||||||
// GetState returns a value from account storage.
|
// GetState returns a value from account storage.
|
||||||
func (so *stateObject) GetState(key *common.Hash, out *uint256.Int) {
|
func (so *stateObject) GetState(key *common.Hash, out *uint256.Int) {
|
||||||
|
// If the fake storage is set, only lookup the state here(in the debugging mode)
|
||||||
|
if so.fakeStorage != nil {
|
||||||
|
*out = so.fakeStorage[*key]
|
||||||
|
return
|
||||||
|
}
|
||||||
value, dirty := so.dirtyStorage[*key]
|
value, dirty := so.dirtyStorage[*key]
|
||||||
if dirty {
|
if dirty {
|
||||||
*out = value
|
*out = value
|
||||||
@ -167,6 +172,11 @@ func (so *stateObject) GetState(key *common.Hash, out *uint256.Int) {
|
|||||||
|
|
||||||
// GetCommittedState retrieves a value from the committed account storage trie.
|
// GetCommittedState retrieves a value from the committed account storage trie.
|
||||||
func (so *stateObject) GetCommittedState(key *common.Hash, out *uint256.Int) {
|
func (so *stateObject) GetCommittedState(key *common.Hash, out *uint256.Int) {
|
||||||
|
// If the fake storage is set, only lookup the state here(in the debugging mode)
|
||||||
|
if so.fakeStorage != nil {
|
||||||
|
*out = so.fakeStorage[*key]
|
||||||
|
return
|
||||||
|
}
|
||||||
// If we have the original value cached, return that
|
// If we have the original value cached, return that
|
||||||
{
|
{
|
||||||
value, cached := so.originStorage[*key]
|
value, cached := so.originStorage[*key]
|
||||||
@ -197,6 +207,11 @@ func (so *stateObject) GetCommittedState(key *common.Hash, out *uint256.Int) {
|
|||||||
|
|
||||||
// SetState updates a value in account storage.
|
// SetState updates a value in account storage.
|
||||||
func (so *stateObject) SetState(key *common.Hash, value uint256.Int) {
|
func (so *stateObject) SetState(key *common.Hash, value uint256.Int) {
|
||||||
|
// If the fake storage is set, put the temporary state update here.
|
||||||
|
if so.fakeStorage != nil {
|
||||||
|
so.fakeStorage[*key] = value
|
||||||
|
return
|
||||||
|
}
|
||||||
// If the new value is the same as old, don't set
|
// If the new value is the same as old, don't set
|
||||||
var prev uint256.Int
|
var prev uint256.Int
|
||||||
so.GetState(key, &prev)
|
so.GetState(key, &prev)
|
||||||
|
Loading…
Reference in New Issue
Block a user