Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions execution/exec/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ func (rw *Worker) resetTx(chainTx kv.TemporalTx) error {
case withTx:
typedWriter.SetTx(rw.chainTx)
default:
if rw.stateWriter != nil {
return fmt.Errorf("can't set tx for writer: %T", rw.stateWriter)
}
// Writers that don't implement withPutter or withTx (e.g.
// NoopWriter, LightCollector) don't need a DB transaction —
// they accumulate writes in memory only. This is not an error.
}

rw.chain = consensuschain.NewReader(rw.chainConfig, rw.chainTx, rw.blockReader, rw.logger)
Expand Down Expand Up @@ -442,6 +442,13 @@ func (rw *Worker) RunTxTaskNoLock(txTask Task) *TxResult {
result.TraceTos = callTracer.Tos()
}

// Capture collector-format writes from LightCollector (parallel workers).
// MakeWriteSet already wrote to rw.stateWriter; extract the accumulated
// writes so finalize can use them directly without IBS reconstruction.
if lc, ok := rw.stateWriter.(*state.LightCollector); ok {
result.CollectorWrites = lc.TakeWrites()
}

return result
}

Expand Down
6 changes: 6 additions & 0 deletions execution/exec/txtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ type TxResult struct {
TraceFroms map[accounts.Address]struct{}
TraceTos map[accounts.Address]struct{}
AccessedAddresses state.AccessSet

// CollectorWrites holds collector-format writes (all 4 account fields per
// address) produced by MakeWriteSet during worker execution. Used by the
// parallel finalize path to skip full IBS reconstruction: fee-calc balance
// adjustments are applied directly to these writes.
CollectorWrites state.VersionedWrites
}

func (r *TxResult) compare(other *TxResult) int {
Expand Down
Loading
Loading