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:
CPerezz 2026-04-30 13:43:37 +02:00
parent 6951ad7c50
commit cdfad0d343
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -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()