diff --git a/chain/consensus/filcns/compute_state.go b/chain/consensus/filcns/compute_state.go index 1b652dde5..f9a93de1b 100644 --- a/chain/consensus/filcns/compute_state.go +++ b/chain/consensus/filcns/compute_state.go @@ -2,7 +2,6 @@ package filcns import ( "context" - "os" "sync/atomic" "github.com/filecoin-project/lotus/chain/rand" @@ -94,19 +93,6 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager LookbackState: stmgr.LookbackStateGetterForTipset(sm, ts), } - if os.Getenv("LOTUS_USE_FVM_EXPERIMENTAL") == "1" { - // This is needed so that the FVM does not have to duplicate the genesis vesting schedule, one - // of the components of the circ supply calc. - // This field is NOT needed by the LegacyVM, and also NOT needed by the FVM from v15 onwards. - filVested, err := sm.GetFilVested(ctx, e) - if err != nil { - return nil, err - } - - vmopt.FilVested = filVested - return vm.NewFVM(ctx, vmopt) - } - return sm.VMConstructor()(ctx, vmopt) } diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index e889e340d..fa4a0dedd 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -491,7 +491,6 @@ func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, sys vm.Sysca Actors: filcns.NewActorRegistry(), Syscalls: mkFakedSigSyscalls(sys), CircSupplyCalc: csc, - FilVested: big.Zero(), NetworkVersion: nv, BaseFee: big.Zero(), } diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 5ff499351..542111a62 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -109,7 +109,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal CircSupplyCalc: csc, NetworkVersion: nv, BaseFee: big.Zero(), - FilVested: big.Zero(), } return vm.NewVM(ctx, vmopt) diff --git a/chain/stmgr/call.go b/chain/stmgr/call.go index 888ca0254..7e011d99f 100644 --- a/chain/stmgr/call.go +++ b/chain/stmgr/call.go @@ -80,11 +80,6 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types. return nil, fmt.Errorf("failed to handle fork: %w", err) } - filVested, err := sm.GetFilVested(ctx, vmHeight) - if err != nil { - return nil, err - } - vmopt := &vm.VMOpts{ StateBase: bstate, Epoch: vmHeight, @@ -95,7 +90,6 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types. CircSupplyCalc: sm.GetVMCirculatingSupply, NetworkVersion: sm.GetNetworkVersion(ctx, pheight+1), BaseFee: types.NewInt(0), - FilVested: filVested, LookbackState: LookbackStateGetterForTipset(sm, ts), } @@ -218,11 +212,6 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri ) } - filVested, err := sm.GetFilVested(ctx, vmHeight) - if err != nil { - return nil, err - } - buffStore := blockstore.NewTieredBstore(sm.cs.StateBlockstore(), blockstore.NewMemorySync()) vmopt := &vm.VMOpts{ StateBase: stateCid, @@ -234,7 +223,6 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri CircSupplyCalc: sm.GetVMCirculatingSupply, NetworkVersion: sm.GetNetworkVersion(ctx, ts.Height()+1), BaseFee: ts.Blocks()[0].ParentBaseFee, - FilVested: filVested, LookbackState: LookbackStateGetterForTipset(sm, ts), } vmi, err := sm.newVM(ctx, vmopt) diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 49dd4700a..2a84c777b 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -79,11 +79,6 @@ func ComputeState(ctx context.Context, sm *StateManager, height abi.ChainEpoch, // future. It's not guaranteed to be accurate... but that's fine. } - filVested, err := sm.GetFilVested(ctx, height) - if err != nil { - return cid.Undef, nil, err - } - r := rand.NewStateRand(sm.cs, ts.Cids(), sm.beacon, sm.GetNetworkVersion) vmopt := &vm.VMOpts{ StateBase: base, @@ -95,7 +90,6 @@ func ComputeState(ctx context.Context, sm *StateManager, height abi.ChainEpoch, CircSupplyCalc: sm.GetVMCirculatingSupply, NetworkVersion: sm.GetNetworkVersion(ctx, height), BaseFee: ts.Blocks()[0].ParentBaseFee, - FilVested: filVested, LookbackState: LookbackStateGetterForTipset(sm, ts), } vmi, err := sm.newVM(ctx, vmopt) diff --git a/chain/vm/fvm.go b/chain/vm/fvm.go index 381f8f285..1628eb889 100644 --- a/chain/vm/fvm.go +++ b/chain/vm/fvm.go @@ -256,19 +256,14 @@ type FVM struct { } func NewFVM(ctx context.Context, opts *VMOpts) (*FVM, error) { - circToReport := opts.FilVested - // For v14 (and earlier), we perform the FilVested portion of the calculation, and let the FVM dynamically do the rest - // v15 and after, the circ supply is always constant per epoch, so we calculate the base and report it at creation - if opts.NetworkVersion >= network.Version15 { - state, err := state.LoadStateTree(cbor.NewCborStore(opts.Bstore), opts.StateBase) - if err != nil { - return nil, err - } + state, err := state.LoadStateTree(cbor.NewCborStore(opts.Bstore), opts.StateBase) + if err != nil { + return nil, err + } - circToReport, err = opts.CircSupplyCalc(ctx, opts.Epoch, state) - if err != nil { - return nil, err - } + circToReport, err := opts.CircSupplyCalc(ctx, opts.Epoch, state) + if err != nil { + return nil, err } fvmopts := &ffi.FVMOpts{ diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 683d145b3..b4c3e5820 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -227,8 +227,6 @@ type VMOpts struct { Actors *ActorRegistry Syscalls SyscallBuilder CircSupplyCalc CircSupplyCalculator - // Amount of FIL vested from genesis actors. - FilVested abi.TokenAmount NetworkVersion network.Version BaseFee abi.TokenAmount LookbackState LookbackStateGetter diff --git a/chain/vm/vmi.go b/chain/vm/vmi.go index 2e826080f..f7fc366ee 100644 --- a/chain/vm/vmi.go +++ b/chain/vm/vmi.go @@ -19,13 +19,15 @@ type Interface interface { Flush(ctx context.Context) (cid.Cid, error) } +var experimentalUseFvm = os.Getenv("LOTUS_USE_FVM_EXPERIMENTAL") == "1" + func NewVM(ctx context.Context, opts *VMOpts) (Interface, error) { if opts.NetworkVersion >= network.Version16 { return NewFVM(ctx, opts) } // Remove after v16 upgrade, this is only to support testing and validation of the FVM - if os.Getenv("LOTUS_USE_FVM_EXPERIMENTAL") == "1" { + if experimentalUseFvm && opts.NetworkVersion >= network.Version15 { return NewFVM(ctx, opts) }