2019-10-17 04:53:25 +00:00
|
|
|
package validation
|
|
|
|
|
|
|
|
import (
|
2020-07-18 13:46:47 +00:00
|
|
|
"context"
|
|
|
|
"github.com/filecoin-project/lotus/chain/state"
|
2020-05-21 18:17:34 +00:00
|
|
|
"github.com/filecoin-project/specs-actors/actors/runtime"
|
2020-07-18 13:46:47 +00:00
|
|
|
cbor "github.com/ipfs/go-ipld-cbor"
|
2020-02-27 22:17:08 +00:00
|
|
|
|
|
|
|
vstate "github.com/filecoin-project/chain-validation/state"
|
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 {
|
2020-04-24 22:08:16 +00:00
|
|
|
return &Factories{}
|
2019-10-17 04:53:25 +00:00
|
|
|
}
|
|
|
|
|
2020-05-21 18:17:34 +00:00
|
|
|
func (f *Factories) NewStateAndApplier(syscalls runtime.Syscalls) (vstate.VMWrapper, vstate.Applier) {
|
2020-04-24 22:08:16 +00:00
|
|
|
st := NewState()
|
2020-07-18 13:46:47 +00:00
|
|
|
return st, NewApplier(st, func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime.Syscalls {
|
|
|
|
return syscalls
|
|
|
|
})
|
2019-10-17 04:53:25 +00:00
|
|
|
}
|
|
|
|
|
2020-02-27 22:17:08 +00:00
|
|
|
func (f *Factories) NewKeyManager() vstate.KeyManager {
|
|
|
|
return newKeyManager()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *Factories) NewValidationConfig() vstate.ValidationConfig {
|
2020-03-24 21:30:27 +00:00
|
|
|
trackGas := true
|
2020-03-05 18:13:49 +00:00
|
|
|
checkExit := true
|
2020-03-17 08:30:50 +00:00
|
|
|
checkRet := true
|
2020-03-27 22:26:34 +00:00
|
|
|
checkState := true
|
|
|
|
return NewConfig(trackGas, checkExit, checkRet, checkState)
|
2019-10-17 04:53:25 +00:00
|
|
|
}
|