diff --git a/conformance/driver.go b/conformance/driver.go index 6df7b9115..a065d1530 100644 --- a/conformance/driver.go +++ b/conformance/driver.go @@ -5,6 +5,8 @@ import ( gobig "math/big" "os" + "github.com/filecoin-project/go-state-types/network" + "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/state" @@ -187,11 +189,12 @@ func (d *Driver) ExecuteTipset(bs blockstore.Blockstore, ds ds.Batching, params } type ExecuteMessageParams struct { - Preroot cid.Cid - Epoch abi.ChainEpoch - Message *types.Message - CircSupply abi.TokenAmount - BaseFee abi.TokenAmount + Preroot cid.Cid + Epoch abi.ChainEpoch + Message *types.Message + CircSupply abi.TokenAmount + BaseFee abi.TokenAmount + NetworkVersion network.Version // Rand is an optional vm.Rand implementation to use. If nil, the driver // will use a vm.Rand that returns a fixed value for all calls. @@ -210,13 +213,6 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageP params.Rand = NewFixedRand() } - // dummy state manager; only to reference the GetNetworkVersion method, - // which does not depend on state. - sm, err := stmgr.NewStateManager(nil, filcns.NewTipSetExecutor(), nil, filcns.DefaultUpgradeSchedule(), nil) - if err != nil { - return nil, cid.Cid{}, err - } - vmOpts := &vm.VMOpts{ StateBase: params.Preroot, Epoch: params.Epoch, @@ -227,7 +223,7 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageP }, Rand: params.Rand, BaseFee: params.BaseFee, - NetworkVersion: sm.GetNetworkVersion(context.Background(), params.Epoch), + NetworkVersion: params.NetworkVersion, } lvm, err := vm.NewVM(context.TODO(), vmOpts) diff --git a/conformance/runner.go b/conformance/runner.go index e597f0bbe..1f35f034c 100644 --- a/conformance/runner.go +++ b/conformance/runner.go @@ -14,6 +14,7 @@ import ( "github.com/fatih/color" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/exitcode" + "github.com/filecoin-project/go-state-types/network" "github.com/hashicorp/go-multierror" blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-blockservice" @@ -54,7 +55,8 @@ var TipsetVectorOpts struct { func ExecuteMessageVector(r Reporter, vector *schema.TestVector, variant *schema.Variant) (diffs []string, err error) { var ( ctx = context.Background() - baseEpoch = variant.Epoch + baseEpoch = abi.ChainEpoch(variant.Epoch) + nv = network.Version(variant.NetworkVersion) root = vector.Pre.StateTree.RootCID ) @@ -76,18 +78,19 @@ func ExecuteMessageVector(r Reporter, vector *schema.TestVector, variant *schema // add the epoch offset if one is set. if m.EpochOffset != nil { - baseEpoch += *m.EpochOffset + baseEpoch += abi.ChainEpoch(*m.EpochOffset) } // Execute the message. var ret *vm.ApplyRet ret, root, err = driver.ExecuteMessage(bs, ExecuteMessageParams{ - Preroot: root, - Epoch: abi.ChainEpoch(baseEpoch), - Message: msg, - BaseFee: BaseFeeOrDefault(vector.Pre.BaseFee), - CircSupply: CircSupplyOrDefault(vector.Pre.CircSupply), - Rand: NewReplayingRand(r, vector.Randomness), + Preroot: root, + Epoch: baseEpoch, + Message: msg, + BaseFee: BaseFeeOrDefault(vector.Pre.BaseFee), + CircSupply: CircSupplyOrDefault(vector.Pre.CircSupply), + Rand: NewReplayingRand(r, vector.Randomness), + NetworkVersion: nv, }) if err != nil { r.Fatalf("fatal failure when executing message: %s", err)