Skip to content

Commit

Permalink
nits (#477)
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
  • Loading branch information
jsign authored Aug 26, 2024
1 parent 5ef9479 commit bfd7b5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 1 addition & 4 deletions core/state/access_witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,8 @@ func (aw *AccessWitness) TouchTxOriginAndComputeGas(originAddr []byte) uint64 {
}

func (aw *AccessWitness) TouchTxExistingAndComputeGas(targetAddr []byte, sendsValue bool) uint64 {
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BasicDataLeafKey, false)
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BasicDataLeafKey, sendsValue)
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.CodeHashLeafKey, false)
if sendsValue {
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BasicDataLeafKey, true)
}

// Kaustinen note: we're currently experimenting with stop chargin gas for the origin address
// so simple transfer still take 21000 gas. This is to potentially avoid breaking existing tooling.
Expand Down
6 changes: 2 additions & 4 deletions trie/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ func (t *VerkleTrie) GetAccount(addr common.Address) (*types.StateAccount, error
return nil, nil
}

if len(values[utils.BasicDataLeafKey]) > 0 {
acc.Nonce = binary.BigEndian.Uint64(values[utils.BasicDataLeafKey][utils.BasicDataNonceOffset:])
}

// if the account has been deleted, then values[10] will be 0 and not nil. If it has
// been recreated after that, then its code keccak will NOT be 0. So return `nil` if
// the nonce, and values[10], and code keccak is 0.
Expand All @@ -142,6 +138,8 @@ func (t *VerkleTrie) GetAccount(addr common.Address) (*types.StateAccount, error
return nil, nil
}
}

acc.Nonce = binary.BigEndian.Uint64(values[utils.BasicDataLeafKey][utils.BasicDataNonceOffset:])
var balance [16]byte
copy(balance[:], values[utils.BasicDataLeafKey][utils.BasicDataBalanceOffset:])
acc.Balance = new(big.Int).SetBytes(balance[:])
Expand Down

0 comments on commit bfd7b5e

Please sign in to comment.