diff --git a/core/parallel_state_processor.go b/core/parallel_state_processor.go index c980e0b6e0..bd2b2ccd5a 100644 --- a/core/parallel_state_processor.go +++ b/core/parallel_state_processor.go @@ -96,21 +96,13 @@ func (p *ParallelStateProcessor) executeParallel(block *types.Block, statedb *st preStateProvider PreStateProvider workers errgroup.Group postState = statedb.Copy() - // statedbbal = statedb.Copy() - // wg sync.WaitGroup ) // leave some cpus for prefetching workers.SetLimit(runtime.NumCPU() / 2) - // Fetch prestate for each tx - - // todo: handle gp with RW lock switch preStateType { case BALPreState: { - // start := time.Now() - // statedb.PrefetchStateBAL(block.NumberU64()) - // PrefetchBALTime += time.Since(start) } case SeqPreState: @@ -195,8 +187,7 @@ func (p *ParallelStateProcessor) executeParallel(block *types.Block, statedb *st // Merge state changes // - Append receipts // - Sum usedGas - // - Collect state state changes: simple overwrite - // - Ommit preimages for now + // - TODO: validate state changes are the same with bal usedGas := uint64(0) // set it to avoid read bal post state, -2 is a magic tx number diff --git a/core/state/statedb.go b/core/state/statedb.go index e7dee7de5c..0032463f0a 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -473,56 +473,6 @@ func (s *StateDB) MergePostBal() { } } -func (s *StateDB) MergePostBalBuggy() { - if balType != BalPreblockKeysPostValues { - panic("MergePostBal is only supported with BalPreblockKeysPostValues") - } - start := time.Now() - var ( - postBal = AllBlockTxPostValues[s.blockNumber] - ) - StateLoadTime += time.Since(start) - - postState := s.Copy() - postState.prefetcher = nil - for txIndex := range len(postBal) { - postVals := postBal[txIndex] - start := time.Now() - for addr, acct := range postVals { - account := postState.getStateObject(addr) - if account == nil { - return - } - - if acct.Destruct { - account.markSelfdestructed() - continue - } - - account.SetNonce(acct.Nonce) - if acct.Balance != nil { - account.SetBalance(acct.Balance) - } - if acct.Code != nil { - account.SetCode(crypto.Keccak256Hash(acct.Code), acct.Code) - } - // Will cause failure if postState.Finalise is not called. - for k, v := range acct.StorageKV { - account.SetState(k, v) - } - } - StateSetTime += time.Since(start) - - start = time.Now() - // postState.Finalise(true) - StateFinalizeTime += time.Since(start) - - start = time.Now() - s.postStates[txIndex] = postState.Copy() - StateCopyTime += time.Since(start) - } -} - func (s *StateDB) PrestateAtIndex(txIndex int) (*StateDB, error) { if balType != BalPreblockKeysPostValues { return nil, fmt.Errorf("PreStateAtTxIndex is only supported with BalPreblockKeysPostValues")