diff --git a/chain/stmgr/call.go b/chain/stmgr/call.go index 307cc658f5c..4cad7375c7a 100644 --- a/chain/stmgr/call.go +++ b/chain/stmgr/call.go @@ -5,6 +5,8 @@ import ( "errors" "fmt" + "github.com/filecoin-project/go-state-types/big" + "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" "go.opencensus.io/trace" @@ -12,7 +14,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/network" @@ -125,11 +126,6 @@ func (sm *StateManager) callInternal(ctx context.Context, msg *types.Message, pr ) } - baseFee := big.Zero() - if checkGas { - baseFee = ts.Blocks()[0].ParentBaseFee - } - buffStore := blockstore.NewTieredBstore(sm.cs.StateBlockstore(), blockstore.NewMemorySync()) vmopt := &vm.VMOpts{ StateBase: stateCid, @@ -140,7 +136,7 @@ func (sm *StateManager) callInternal(ctx context.Context, msg *types.Message, pr Syscalls: sm.Syscalls, CircSupplyCalc: sm.GetVMCirculatingSupply, NetworkVersion: nvGetter(ctx, vmHeight), - BaseFee: baseFee, + BaseFee: ts.Blocks()[0].ParentBaseFee, LookbackState: LookbackStateGetterForTipset(sm, ts), Tracing: true, } @@ -174,21 +170,21 @@ func (sm *StateManager) callInternal(ctx context.Context, msg *types.Message, pr msg.Nonce = fromActor.Nonce - var ret *vm.ApplyRet - var gasInfo api.MsgGasCost - if checkGas { - // If the fee cap is set to zero, make gas free. - if msg.GasFeeCap.NilOrZero() { - // Now estimate with a new VM with no base fee. - vmopt.BaseFee = big.Zero() - vmopt.StateBase = stateCid + // If the fee cap is set to zero, make gas free. + if msg.GasFeeCap.NilOrZero() { + // Now estimate with a new VM with no base fee. + vmopt.BaseFee = big.Zero() + vmopt.StateBase = stateCid - vmi, err = sm.newVM(ctx, vmopt) - if err != nil { - return nil, xerrors.Errorf("failed to set up estimation vm: %w", err) - } + vmi, err = sm.newVM(ctx, vmopt) + if err != nil { + return nil, xerrors.Errorf("failed to set up estimation vm: %w", err) } + } + var ret *vm.ApplyRet + var gasInfo api.MsgGasCost + if checkGas { fromKey, err := sm.ResolveToKeyAddress(ctx, msg.From, ts) if err != nil { return nil, xerrors.Errorf("could not resolve key: %w", err)