tvx: fixup VM creation
This commit is contained in:
parent
ed83595e33
commit
14ef069ea1
@ -5,8 +5,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
blocks "github.com/ipfs/go-block-format"
|
blocks "github.com/ipfs/go-block-format"
|
||||||
"github.com/ipfs/go-blockservice"
|
"github.com/ipfs/go-blockservice"
|
||||||
@ -18,6 +16,7 @@ import (
|
|||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
format "github.com/ipfs/go-ipld-format"
|
format "github.com/ipfs/go-ipld-format"
|
||||||
"github.com/ipfs/go-merkledag"
|
"github.com/ipfs/go-merkledag"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
"github.com/filecoin-project/lotus/blockstore"
|
||||||
|
@ -256,11 +256,21 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageP
|
|||||||
lvm.SetInvoker(invoker)
|
lvm.SetInvoker(invoker)
|
||||||
vmi = lvm
|
vmi = lvm
|
||||||
} else {
|
} else {
|
||||||
fvm, err := vm.NewVM(context.TODO(), vmOpts)
|
if vmOpts.NetworkVersion >= network.Version16 {
|
||||||
|
fvm, err := vm.NewFVM(context.TODO(), vmOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, cid.Undef, err
|
return nil, cid.Undef, err
|
||||||
}
|
}
|
||||||
vmi = fvm
|
vmi = fvm
|
||||||
|
} else {
|
||||||
|
lvm, err := vm.NewLegacyVM(context.TODO(), vmOpts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, cid.Undef, err
|
||||||
|
}
|
||||||
|
invoker := filcns.NewActorRegistry()
|
||||||
|
lvm.SetInvoker(invoker)
|
||||||
|
vmi = lvm
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret, err := vmi.ApplyMessage(d.ctx, toChainMsg(params.Message))
|
ret, err := vmi.ApplyMessage(d.ctx, toChainMsg(params.Message))
|
||||||
@ -269,7 +279,13 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageP
|
|||||||
}
|
}
|
||||||
|
|
||||||
var root cid.Cid
|
var root cid.Cid
|
||||||
|
if d.vmFlush {
|
||||||
|
// flush the VM, committing the state tree changes and forcing a
|
||||||
|
// recursive copy from the temporary blockstore to the real blockstore.
|
||||||
root, err = vmi.Flush(d.ctx)
|
root, err = vmi.Flush(d.ctx)
|
||||||
|
} else {
|
||||||
|
root, err = vmi.(*vm.LegacyVM).StateTree().(*state.StateTree).Flush(d.ctx)
|
||||||
|
}
|
||||||
|
|
||||||
return ret, root, err
|
return ret, root, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user