diff --git a/core/state/statedb.go b/core/state/statedb.go index 0e5653f553..d14958022d 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -416,7 +416,7 @@ func (s *StateDB) ApplyMVWriteSet(writes []blockstm.WriteDescriptor) { case BalancePath: s.SetBalance(addr, sr.GetBalance(addr), tracing.BalanceChangeUnspecified) case NoncePath: - s.SetNonce(addr, sr.GetNonce(addr)) + s.SetNonce(addr, sr.GetNonce(addr), tracing.NonceChangeUnspecified) case CodePath: s.SetCode(addr, sr.GetCode(addr)) case SuicidePath: @@ -664,20 +664,13 @@ func (s *StateDB) Version() blockstm.Version { } } -func (s *StateDB) GetCode(addr common.Address) []byte { - stateObject := s.getStateObject(addr) - if stateObject != nil { - if s.witness != nil { - s.witness.AddCode(stateObject.Code()) - } - return stateObject.Code() - } -} - func (s *StateDB) GetCode(addr common.Address) []byte { return MVRead(s, blockstm.NewSubpathKey(addr, CodePath), nil, func(s *StateDB) []byte { stateObject := s.getStateObject(addr) if stateObject != nil { + if s.witness != nil { + s.witness.AddCode(stateObject.Code()) + } return stateObject.Code() } @@ -965,7 +958,7 @@ func (s *StateDB) updateStateObject(obj *stateObject) { // deleteStateObject removes the given object from the state trie. func (s *StateDB) deleteStateObject(addr common.Address) { // Track the amount of time wasted on deleting the account from the trie - if metrics.Enabled { + if metrics.Enabled() { defer func(start time.Time) { s.AccountUpdates += time.Since(start) }(time.Now()) } diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index 0165d802bb..7d95c9e817 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -1185,13 +1185,13 @@ func TestApplyMVWriteSet(t *testing.T) { // Tx1 write states[1].SetState(addr1, key2, val2) states[1].SetBalance(addr1, balance2, tracing.BalanceChangeTransfer) - states[1].SetNonce(addr1, 1) + states[1].SetNonce(addr1, 1, tracing.NonceChangeUnspecified) states[1].Finalise(true) states[1].FlushMVWriteSet() sSingleProcess.SetState(addr1, key2, val2) sSingleProcess.SetBalance(addr1, balance2, tracing.BalanceChangeTransfer) - sSingleProcess.SetNonce(addr1, 1) + sSingleProcess.SetNonce(addr1, 1, tracing.NonceChangeUnspecified) sClean.ApplyMVWriteSet(states[1].MVWriteList()) @@ -1200,13 +1200,13 @@ func TestApplyMVWriteSet(t *testing.T) { // Tx2 write states[2].SetState(addr1, key1, val2) states[2].SetBalance(addr1, balance2, tracing.BalanceChangeTransfer) - states[2].SetNonce(addr1, 2) + states[2].SetNonce(addr1, 2, tracing.NonceChangeUnspecified) states[2].Finalise(true) states[2].FlushMVWriteSet() sSingleProcess.SetState(addr1, key1, val2) sSingleProcess.SetBalance(addr1, balance2, tracing.BalanceChangeTransfer) - sSingleProcess.SetNonce(addr1, 2) + sSingleProcess.SetNonce(addr1, 2, tracing.NonceChangeUnspecified) sClean.ApplyMVWriteSet(states[2].MVWriteList()) diff --git a/core/txpool/blobpool/blobpool_test.go b/core/txpool/blobpool/blobpool_test.go index 112326b291..33631d1863 100644 --- a/core/txpool/blobpool/blobpool_test.go +++ b/core/txpool/blobpool/blobpool_test.go @@ -139,7 +139,7 @@ func (bc *testBlockChain) CurrentBlock() *types.Header { tmp := mid.Uint64() if eip4844.CalcBlobFee(bc.Config(), &types.Header{ Number: blockNumber, - Time: blockTime, + Time: uint64(blockTime), ExcessBlobGas: &tmp, }).Cmp(bc.blobfee.ToBig()) > 0 { hi = mid diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index e3a3fb20c9..f4d35fd08e 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1653,9 +1653,6 @@ func (pool *LegacyPool) demoteUnexecutables() { } pendingGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved))) - if pool.locals.contains(addr) { - localGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved))) - } // If there's a gap in front, alert (should never happen) and postpone all transactions if list.Len() > 0 && list.txs.Get(nonce) == nil { gapped := list.Cap(0) diff --git a/core/txpool/legacypool/legacypool_test.go b/core/txpool/legacypool/legacypool_test.go index dea7a58ebe..fc4a831fbc 100644 --- a/core/txpool/legacypool/legacypool_test.go +++ b/core/txpool/legacypool/legacypool_test.go @@ -3168,7 +3168,7 @@ func TestPoolMultiAccountBatchInsertRace(t *testing.T) { pending = pool.Pending(txpool.PendingFilter{}) total = len(pending) - _ = pool.Locals() + // _ = pool.Locals() if total >= n { close(done) diff --git a/core/txpool/legacypool/list.go b/core/txpool/legacypool/list.go index 69b41db539..2ab9ebe696 100644 --- a/core/txpool/legacypool/list.go +++ b/core/txpool/legacypool/list.go @@ -77,7 +77,7 @@ func (m *SortedMap) Get(nonce uint64) *types.Transaction { return m.items[nonce] } -func (m *sortedMap) Has(nonce uint64) bool { +func (m *SortedMap) Has(nonce uint64) bool { if m == nil { return false } @@ -273,7 +273,7 @@ func (m *SortedMap) flatten() types.Transactions { return m.cache } -func (m *sortedMap) lastElement() *types.Transaction { +func (m *SortedMap) lastElement() *types.Transaction { cache := m.flatten() return cache[len(cache)-1] } diff --git a/core/txpool/locals/tx_tracker_test.go b/core/txpool/locals/tx_tracker_test.go index 5585589b6c..36ac8958a9 100644 --- a/core/txpool/locals/tx_tracker_test.go +++ b/core/txpool/locals/tx_tracker_test.go @@ -66,7 +66,7 @@ func newTestEnv(t *testing.T, n int, gasTip uint64, journal string) *testEnv { }) db := rawdb.NewMemoryDatabase() - chain, _ := core.NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil) + chain, _ := core.NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil) legacyPool := legacypool.New(legacypool.DefaultConfig, chain) pool, err := txpool.New(gasTip, chain, []txpool.SubPool{legacyPool})