lotus/chain/validation/factories.go
Frrist 7371274ea7 update chain-validation: adds miner workflow test (#1403)
* update chain-validation. adds miner workflow test
* replace real sealing with mocked impl
2020-03-12 10:22:45 -07:00

48 lines
1.1 KiB
Go

package validation
import (
"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"
)
type Factories struct {
*Applier
}
var _ vstate.Factories = &Factories{}
func NewFactories() *Factories {
applier := NewApplier()
return &Factories{applier}
}
func (f *Factories) NewState() vstate.VMWrapper {
return NewState()
}
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) {
return abi.Randomness("sausages"), nil
}
func (f *Factories) NewRandomnessSource() vstate.RandomnessSource {
return &fakeRandSrc{}
}
func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
trackGas := false
checkExit := true
checkRet := false // TODO enable return value checking once https://github.com/filecoin-project/specs-actors/pull/230 lands
// ignore gas and return value assertions
return NewConfig(trackGas, checkExit, checkRet)
}