Merge pull request #8293 from filecoin-project/feat/fvm

Filecoin Virtual Machine integration
This commit is contained in:
Aayush Rajasekaran
2022-03-16 15:51:56 -04:00
committed by GitHub
21 changed files with 507 additions and 99 deletions
@@ -44,7 +44,7 @@ type BlockBuilder struct {
parentTs *types.TipSet
parentSt *state.StateTree
vm *vm.VM
vm *vm.LegacyVM
sm *stmgr.StateManager
gasTotal int64
@@ -73,9 +73,9 @@ func NewBlockBuilder(ctx context.Context, logger *zap.SugaredLogger, sm *stmgr.S
parentSt: parentSt,
}
// Then we construct a VM to execute messages for gas estimation.
// Then we construct a LegacyVM to execute messages for gas estimation.
//
// Most parts of this VM are "real" except:
// Most parts of this LegacyVM are "real" except:
// 1. We don't charge a fee.
// 2. The runtime has "fake" proof logic.
// 3. We don't actually save any of the results.
@@ -92,7 +92,7 @@ func NewBlockBuilder(ctx context.Context, logger *zap.SugaredLogger, sm *stmgr.S
BaseFee: abi.NewTokenAmount(0),
LookbackState: stmgr.LookbackStateGetterForTipset(sm, parentTs),
}
bb.vm, err = vm.NewVM(bb.ctx, vmopt)
bb.vm, err = vm.NewLegacyVM(bb.ctx, vmopt)
if err != nil {
return nil, err
}
@@ -190,12 +190,12 @@ func (bb *BlockBuilder) PushMessage(msg *types.Message) (*types.MessageReceipt,
return &ret.MessageReceipt, nil
}
// ActorStore returns the VM's current (pending) blockstore.
// ActorStore returns the LegacyVM's current (pending) blockstore.
func (bb *BlockBuilder) ActorStore() adt.Store {
return bb.vm.ActorStore(bb.ctx)
}
// StateTree returns the VM's current (pending) state-tree. This includes any changes made by
// StateTree returns the LegacyVM's current (pending) state-tree. This includes any changes made by
// successfully pushed messages.
//
// You probably want ParentStateTree