2019-10-17 04:53:25 +00:00
|
|
|
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"
|
2020-02-28 23:14:21 +00:00
|
|
|
acrypto "github.com/filecoin-project/specs-actors/actors/crypto"
|
2019-10-17 04:53:25 +00:00
|
|
|
)
|
|
|
|
|
2020-02-27 22:17:08 +00:00
|
|
|
type Factories struct {
|
2019-10-17 04:53:25 +00:00
|
|
|
*Applier
|
|
|
|
}
|
|
|
|
|
2020-02-27 22:17:08 +00:00
|
|
|
var _ vstate.Factories = &Factories{}
|
2019-10-17 04:53:25 +00:00
|
|
|
|
2020-02-27 22:17:08 +00:00
|
|
|
func NewFactories() *Factories {
|
2019-10-17 04:53:25 +00:00
|
|
|
applier := NewApplier()
|
2020-02-27 22:17:08 +00:00
|
|
|
return &Factories{applier}
|
2019-10-17 04:53:25 +00:00
|
|
|
}
|
|
|
|
|
2020-02-27 22:17:08 +00:00
|
|
|
func (f *Factories) NewState() vstate.VMWrapper {
|
2019-10-17 04:53:25 +00:00
|
|
|
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) {
|
2020-03-12 17:22:45 +00:00
|
|
|
return abi.Randomness("sausages"), nil
|
2020-02-27 22:17:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (f *Factories) NewRandomnessSource() vstate.RandomnessSource {
|
|
|
|
return &fakeRandSrc{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
|
2020-03-12 17:22:45 +00:00
|
|
|
trackGas := false
|
2020-03-05 18:13:49 +00:00
|
|
|
checkExit := true
|
2020-03-17 08:30:50 +00:00
|
|
|
checkRet := true
|
2020-02-28 23:18:37 +00:00
|
|
|
// ignore gas and return value assertions
|
|
|
|
return NewConfig(trackGas, checkExit, checkRet)
|
2019-10-17 04:53:25 +00:00
|
|
|
}
|