update fvm construction
This commit is contained in:
parent
10b07ecd20
commit
ddede202a8
@ -3,6 +3,7 @@ package vm
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -29,6 +30,7 @@ import (
|
|||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
ffi_cgo "github.com/filecoin-project/filecoin-ffi/cgo"
|
ffi_cgo "github.com/filecoin-project/filecoin-ffi/cgo"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -241,9 +243,15 @@ func NewFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fvmOpts := ffi.FVMOpts{
|
fvmopts := &ffi.FVMOpts{
|
||||||
FVMVersion: 0,
|
FVMVersion: 0,
|
||||||
Externs: &FvmExtern{Rand: opts.Rand, Blockstore: opts.Bstore, lbState: opts.LookbackState, base: opts.StateBase, epoch: opts.Epoch, nv: opts.NetworkVersion},
|
Externs: &FvmExtern{
|
||||||
|
Rand: opts.Rand,
|
||||||
|
Blockstore: opts.Bstore,
|
||||||
|
lbState: opts.LookbackState,
|
||||||
|
base: opts.StateBase,
|
||||||
|
epoch: opts.Epoch,
|
||||||
|
},
|
||||||
Epoch: opts.Epoch,
|
Epoch: opts.Epoch,
|
||||||
BaseFee: opts.BaseFee,
|
BaseFee: opts.BaseFee,
|
||||||
BaseCircSupply: circToReport,
|
BaseCircSupply: circToReport,
|
||||||
@ -251,7 +259,21 @@ func NewFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
|
|||||||
StateBase: opts.StateBase,
|
StateBase: opts.StateBase,
|
||||||
}
|
}
|
||||||
|
|
||||||
fvm, err := ffi.CreateFVM(&fvmOpts)
|
if os.Getenv("LOTUS_USE_FVM_CUSTOM_BUNDLE") == "1" {
|
||||||
|
av, err := actors.VersionForNetwork(opts.NetworkVersion)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("mapping network version to actors version: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := actors.ManifestCids[av]
|
||||||
|
if !ok {
|
||||||
|
return nil, xerrors.Errorf("no manifest for custom bundle (actors version %d)", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
fvmopts.Manifest = c
|
||||||
|
}
|
||||||
|
|
||||||
|
fvm, err := ffi.CreateFVM(fvmopts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user