mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
core/state: comment len(code) > 0 gate, drop dead OriginStorageLoadTime
- Add a comment at the code-mutation gate explaining the deliberate len(code) > 0 (vs code != nil) match against non-BAL semantics; in devnet-3 BAL access lists, an empty []byte is non-nil but encodes "no code install". - Remove BALStateTransitionMetrics.OriginStorageLoadTime: declared but never assigned anywhere in the tree. The actual state-transition read time is captured by AccountReadTime/StorageReadTime added in the prior commit.
This commit is contained in:
parent
6951ad7c50
commit
cdfad0d343
1 changed files with 9 additions and 5 deletions
|
|
@ -86,11 +86,10 @@ func (s *BALStateTransition) WriteCounts() StateCounts {
|
||||||
|
|
||||||
type BALStateTransitionMetrics struct {
|
type BALStateTransitionMetrics struct {
|
||||||
// trie hashing metrics
|
// trie hashing metrics
|
||||||
AccountUpdate time.Duration
|
AccountUpdate time.Duration
|
||||||
StatePrefetch time.Duration
|
StatePrefetch time.Duration
|
||||||
StateUpdate time.Duration
|
StateUpdate time.Duration
|
||||||
StateHash time.Duration
|
StateHash time.Duration
|
||||||
OriginStorageLoadTime time.Duration
|
|
||||||
|
|
||||||
// commit metrics
|
// commit metrics
|
||||||
AccountCommits time.Duration
|
AccountCommits time.Duration
|
||||||
|
|
@ -522,6 +521,11 @@ func (s *BALStateTransition) IntermediateRoot(_ bool) common.Hash {
|
||||||
} else {
|
} else {
|
||||||
acct, code := s.updateAccount(mutatedAddr)
|
acct, code := s.updateAccount(mutatedAddr)
|
||||||
|
|
||||||
|
// Use len(code) > 0 (not code != nil) to match the non-BAL semantic
|
||||||
|
// at statedb.go (obj.dirtyCode && len(obj.code) > 0). In devnet-3
|
||||||
|
// BAL access lists, an empty []byte is non-nil but encodes "no code
|
||||||
|
// install"; treating it as a code mutation would over-count and
|
||||||
|
// call UpdateContractCode with an empty payload.
|
||||||
if len(code) > 0 {
|
if len(code) > 0 {
|
||||||
codeHash := crypto.Keccak256Hash(code)
|
codeHash := crypto.Keccak256Hash(code)
|
||||||
acct.CodeHash = codeHash.Bytes()
|
acct.CodeHash = codeHash.Bytes()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue