Skip to content

Commit

Permalink
fix: avoid racy memstores when estimating gas
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Mar 20, 2022
1 parent a94e47c commit 4af8b8e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions chain/stmgr/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (

"github.com/filecoin-project/lotus/chain/state"

"github.com/filecoin-project/lotus/blockstore"

"github.com/filecoin-project/lotus/chain/rand"

"github.com/filecoin-project/go-address"
Expand Down Expand Up @@ -223,12 +221,11 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
return nil, err
}

buffStore := blockstore.NewBuffered(sm.cs.StateBlockstore())
vmopt := &vm.VMOpts{
StateBase: stateCid,
Epoch: vmHeight,
Rand: r,
Bstore: buffStore,
Bstore: sm.cs.StateBlockstore(),
Actors: sm.tsExec.NewActorRegistry(),
Syscalls: sm.Syscalls,
CircSupplyCalc: sm.GetVMCirculatingSupply,
Expand All @@ -255,7 +252,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
return nil, xerrors.Errorf("flushing vm: %w", err)
}

stTree, err := state.LoadStateTree(cbor.NewCborStore(buffStore), stateCid)
stTree, err := state.LoadStateTree(cbor.NewCborStore(sm.cs.StateBlockstore()), stateCid)
if err != nil {
return nil, xerrors.Errorf("loading state tree: %w", err)
}
Expand Down

0 comments on commit 4af8b8e

Please sign in to comment.