mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
fix: avoid accidentally sharing a tracer between goroutines (#768)
Avoid accidentally sharing a tracer between goroutines Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
parent
6229ef11da
commit
d0860229c2
2 changed files with 7 additions and 4 deletions
|
|
@ -521,7 +521,7 @@ func (w *worker) startNewPipeline(timestamp int64) {
|
||||||
if !w.isRunning() {
|
if !w.isRunning() {
|
||||||
pipelineCCC = nil
|
pipelineCCC = nil
|
||||||
}
|
}
|
||||||
w.currentPipeline = pipeline.NewPipeline(w.chain, w.chain.GetVMConfig(), parentState, header, nextL1MsgIndex, pipelineCCC).WithBeforeTxHook(w.beforeTxHook)
|
w.currentPipeline = pipeline.NewPipeline(w.chain, *w.chain.GetVMConfig(), parentState, header, nextL1MsgIndex, pipelineCCC).WithBeforeTxHook(w.beforeTxHook)
|
||||||
|
|
||||||
deadline := time.Unix(int64(header.Time), 0)
|
deadline := time.Unix(int64(header.Time), 0)
|
||||||
if w.chainConfig.Clique != nil && w.chainConfig.Clique.RelaxedPeriod {
|
if w.chainConfig.Clique != nil && w.chainConfig.Clique.RelaxedPeriod {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ var (
|
||||||
|
|
||||||
type Pipeline struct {
|
type Pipeline struct {
|
||||||
chain *core.BlockChain
|
chain *core.BlockChain
|
||||||
vmConfig *vm.Config
|
vmConfig vm.Config
|
||||||
parent *types.Block
|
parent *types.Block
|
||||||
start time.Time
|
start time.Time
|
||||||
|
|
||||||
|
|
@ -73,13 +73,16 @@ type Pipeline struct {
|
||||||
|
|
||||||
func NewPipeline(
|
func NewPipeline(
|
||||||
chain *core.BlockChain,
|
chain *core.BlockChain,
|
||||||
vmConfig *vm.Config,
|
vmConfig vm.Config,
|
||||||
state *state.StateDB,
|
state *state.StateDB,
|
||||||
|
|
||||||
header *types.Header,
|
header *types.Header,
|
||||||
nextL1MsgIndex uint64,
|
nextL1MsgIndex uint64,
|
||||||
ccc *circuitcapacitychecker.CircuitCapacityChecker,
|
ccc *circuitcapacitychecker.CircuitCapacityChecker,
|
||||||
) *Pipeline {
|
) *Pipeline {
|
||||||
|
// make sure we are not sharing a tracer with the caller and not in debug mode
|
||||||
|
vmConfig.Tracer = nil
|
||||||
|
vmConfig.Debug = false
|
||||||
return &Pipeline{
|
return &Pipeline{
|
||||||
chain: chain,
|
chain: chain,
|
||||||
vmConfig: vmConfig,
|
vmConfig: vmConfig,
|
||||||
|
|
@ -417,7 +420,7 @@ func (p *Pipeline) traceAndApply(tx *types.Transaction) (*types.Receipt, *types.
|
||||||
|
|
||||||
var receipt *types.Receipt
|
var receipt *types.Receipt
|
||||||
receipt, err = core.ApplyTransaction(p.chain.Config(), p.chain, nil /* coinbase will default to chainConfig.Scroll.FeeVaultAddress */, p.gasPool,
|
receipt, err = core.ApplyTransaction(p.chain.Config(), p.chain, nil /* coinbase will default to chainConfig.Scroll.FeeVaultAddress */, p.gasPool,
|
||||||
p.state, &p.Header, tx, &p.Header.GasUsed, *p.vmConfig)
|
p.state, &p.Header, tx, &p.Header.GasUsed, p.vmConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.state.RevertToSnapshot(snap)
|
p.state.RevertToSnapshot(snap)
|
||||||
return nil, trace, err
|
return nil, trace, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue