update chain-val syscalls interface
This commit is contained in:
parent
9089aadbbf
commit
c8f28103f3
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
"github.com/filecoin-project/specs-actors/actors/puppet"
|
"github.com/filecoin-project/specs-actors/actors/puppet"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
vtypes "github.com/filecoin-project/chain-validation/chain/types"
|
vtypes "github.com/filecoin-project/chain-validation/chain/types"
|
||||||
@ -24,12 +25,13 @@ import (
|
|||||||
// Applier applies messages to state trees and storage.
|
// Applier applies messages to state trees and storage.
|
||||||
type Applier struct {
|
type Applier struct {
|
||||||
stateWrapper *StateWrapper
|
stateWrapper *StateWrapper
|
||||||
|
syscalls runtime.Syscalls
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ vstate.Applier = &Applier{}
|
var _ vstate.Applier = &Applier{}
|
||||||
|
|
||||||
func NewApplier(sw *StateWrapper) *Applier {
|
func NewApplier(sw *StateWrapper, syscalls runtime.Syscalls) *Applier {
|
||||||
return &Applier{sw}
|
return &Applier{sw, syscalls}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Applier) ApplyMessage(epoch abi.ChainEpoch, message *vtypes.Message) (vtypes.ApplyMessageResult, error) {
|
func (a *Applier) ApplyMessage(epoch abi.ChainEpoch, message *vtypes.Message) (vtypes.ApplyMessageResult, error) {
|
||||||
@ -65,7 +67,7 @@ func (a *Applier) ApplySignedMessage(epoch abi.ChainEpoch, msg *vtypes.SignedMes
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Applier) ApplyTipSetMessages(epoch abi.ChainEpoch, blocks []vtypes.BlockMessagesInfo, rnd vstate.RandomnessSource) (vtypes.ApplyTipSetResult, error) {
|
func (a *Applier) ApplyTipSetMessages(epoch abi.ChainEpoch, blocks []vtypes.BlockMessagesInfo, rnd vstate.RandomnessSource) (vtypes.ApplyTipSetResult, error) {
|
||||||
cs := store.NewChainStore(a.stateWrapper.bs, a.stateWrapper.ds, vdrivers.NewChainValidationSyscalls())
|
cs := store.NewChainStore(a.stateWrapper.bs, a.stateWrapper.ds, a.syscalls)
|
||||||
sm := stmgr.NewStateManager(cs)
|
sm := stmgr.NewStateManager(cs)
|
||||||
|
|
||||||
var bms []stmgr.BlockMessages
|
var bms []stmgr.BlockMessages
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package validation
|
package validation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||||
|
|
||||||
vstate "github.com/filecoin-project/chain-validation/state"
|
vstate "github.com/filecoin-project/chain-validation/state"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
||||||
acrypto "github.com/filecoin-project/specs-actors/actors/crypto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Factories struct {
|
type Factories struct {
|
||||||
@ -18,26 +16,15 @@ func NewFactories() *Factories {
|
|||||||
return &Factories{}
|
return &Factories{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Factories) NewStateAndApplier() (vstate.VMWrapper, vstate.Applier) {
|
func (f *Factories) NewStateAndApplier(syscalls runtime.Syscalls) (vstate.VMWrapper, vstate.Applier) {
|
||||||
st := NewState()
|
st := NewState()
|
||||||
return st, NewApplier(st)
|
return st, NewApplier(st, syscalls)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Factories) NewKeyManager() vstate.KeyManager {
|
func (f *Factories) NewKeyManager() vstate.KeyManager {
|
||||||
return newKeyManager()
|
return newKeyManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeRandSrc struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r fakeRandSrc) Randomness(_ context.Context, _ acrypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) (abi.Randomness, error) {
|
|
||||||
return abi.Randomness("sausages"), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *Factories) NewRandomnessSource() vstate.RandomnessSource {
|
|
||||||
return &fakeRandSrc{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
|
func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
|
||||||
trackGas := true
|
trackGas := true
|
||||||
checkExit := true
|
checkExit := true
|
||||||
|
Loading…
Reference in New Issue
Block a user