mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-10 03:47:30 +00:00
core/state: various fixes in EIP-7928 (#34641)
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
This commit is contained in:
parent
6cc0be1e93
commit
c3ad7547ce
2 changed files with 8 additions and 7 deletions
|
|
@ -102,7 +102,7 @@ func (s *BALStateTransition) Error() error {
|
|||
}
|
||||
|
||||
func (s *BALStateTransition) setError(err error) {
|
||||
if s.err != nil {
|
||||
if s.err == nil {
|
||||
s.err = err
|
||||
}
|
||||
}
|
||||
|
|
@ -169,10 +169,11 @@ func (s *BALStateTransition) commitAccount(addr common.Address) (*accountUpdate,
|
|||
)
|
||||
op := &accountUpdate{
|
||||
address: addr,
|
||||
data: types.SlimAccountRLP(*s.postStates[addr]), // TODO: cache the updated state acocunt somewhere
|
||||
data: types.SlimAccountRLP(*s.postStates[addr]), // TODO: cache the updated state account somewhere
|
||||
}
|
||||
if prestate, exist := s.prestates.Load(addr); exist {
|
||||
prestate := prestate.(*types.StateAccount)
|
||||
var prestate *types.StateAccount
|
||||
if ps, exist := s.prestates.Load(addr); exist {
|
||||
prestate = ps.(*types.StateAccount)
|
||||
op.origin = types.SlimAccountRLP(*prestate)
|
||||
}
|
||||
|
||||
|
|
@ -181,10 +182,10 @@ func (s *BALStateTransition) commitAccount(addr common.Address) (*accountUpdate,
|
|||
hash: crypto.Keccak256Hash(s.diffs[addr].Code),
|
||||
blob: s.diffs[addr].Code,
|
||||
}
|
||||
if op.origin == nil {
|
||||
if prestate == nil {
|
||||
code.originHash = types.EmptyCodeHash
|
||||
} else {
|
||||
code.originHash = crypto.Keccak256Hash(op.origin)
|
||||
code.originHash = common.BytesToHash(prestate.CodeHash)
|
||||
}
|
||||
op.code = &code
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ func (e *AccountAccess) validate(blockTxCount int) error {
|
|||
return errors.New("balance changes not in ascending order by tx index")
|
||||
}
|
||||
|
||||
if len(e.BalanceChanges) > 0 && int(e.BalanceChanges[len(e.BalanceChanges)-1].TxIdx) > blockTxCount+2 {
|
||||
if len(e.BalanceChanges) > 0 && int(e.BalanceChanges[len(e.BalanceChanges)-1].TxIdx) > blockTxCount+1 {
|
||||
return errors.New("highest balance change index beyond what is allowed")
|
||||
}
|
||||
// check that the balance values are set and there are no duplicate index entries
|
||||
|
|
|
|||
Loading…
Reference in a new issue