fake signatures when constructing genesis state

This commit is contained in:
Jeromy 2020-05-05 14:36:39 -07:00
parent 8a9862bdb4
commit 66cafc7c71

View File

@ -20,6 +20,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/specs-actors/actors/runtime"
"github.com/filecoin-project/lotus/chain/state"
"github.com/filecoin-project/lotus/chain/store"
@ -37,8 +38,16 @@ func MinerAddress(genesisIndex uint64) address.Address {
return maddr
}
type fakedSigSyscalls struct {
runtime.Syscalls
}
func (fss *fakedSigSyscalls) VerifySignature(signature crypto.Signature, signer address.Address, plaintext []byte) error {
return nil
}
func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid, miners []genesis.Miner) (cid.Cid, error) {
vm, err := vm.NewVM(sroot, 0, &fakeRand{}, cs.Blockstore(), cs.VMSys())
vm, err := vm.NewVM(sroot, 0, &fakeRand{}, cs.Blockstore(), &fakedSigSyscalls{cs.VMSys()})
if err != nil {
return cid.Undef, xerrors.Errorf("failed to create NewVM: %w", err)
}