lotus/chain/validation/factories.go

48 lines
1.1 KiB
Go
Raw Normal View History

package validation
import (
2020-02-27 22:17:08 +00:00
"context"
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"
)
2020-02-27 22:17:08 +00:00
type Factories struct {
*Applier
}
2020-02-27 22:17:08 +00:00
var _ vstate.Factories = &Factories{}
2020-02-27 22:17:08 +00:00
func NewFactories() *Factories {
applier := NewApplier()
2020-02-27 22:17:08 +00:00
return &Factories{applier}
}
2020-02-27 22:17:08 +00:00
func (f *Factories) NewState() vstate.VMWrapper {
return NewState()
}
2020-02-27 22:17:08 +00:00
func (f *Factories) NewKeyManager() vstate.KeyManager {
return newKeyManager()
}
type fakeRandSrc struct {
}
func (r fakeRandSrc) Randomness(_ context.Context, _ acrypto.DomainSeparationTag, _ abi.ChainEpoch, _ []byte) (abi.Randomness, error) {
panic("implement me")
}
func (f *Factories) NewRandomnessSource() vstate.RandomnessSource {
return &fakeRandSrc{}
}
func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
trackGas := true
2020-03-05 18:13:49 +00:00
checkExit := true
2020-03-05 19:19:34 +00:00
checkRet := false // TODO enable return value checking once https://github.com/filecoin-project/specs-actors/pull/230 lands
2020-02-28 23:18:37 +00:00
// ignore gas and return value assertions
return NewConfig(trackGas, checkExit, checkRet)
}