lotus/chain/vm/syscalls.go

31 lines
1.0 KiB
Go
Raw Normal View History

package vm
import (
2020-01-13 20:47:27 +00:00
"context"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/lotus/chain/actors"
2020-01-13 20:47:27 +00:00
"github.com/filecoin-project/lotus/chain/actors/aerrors"
"github.com/filecoin-project/lotus/chain/types"
2020-02-08 02:18:32 +00:00
"github.com/filecoin-project/specs-actors/actors/abi"
2020-01-13 20:47:27 +00:00
"go.opencensus.io/trace"
)
// Actual type is defined in chain/types/vmcontext.go because the VMContext interface is there
2020-01-13 20:47:27 +00:00
func Syscalls(verifier sectorbuilder.Verifier) *types.VMSyscalls {
return &types.VMSyscalls{
2020-02-08 02:18:32 +00:00
ValidatePoRep: func(ctx context.Context, maddr address.Address, ssize abi.SectorSize, commD, commR, ticket, proof, seed []byte, sectorID abi.SectorNumber) (bool, actors.ActorError) {
2020-01-13 20:47:27 +00:00
_, span := trace.StartSpan(ctx, "ValidatePoRep")
defer span.End()
ok, err := verifier.VerifySeal(ssize, commR, commD, maddr, ticket, seed, sectorID, proof)
if err != nil {
return false, aerrors.Absorb(err, 25, "verify seal failed")
}
return ok, nil
},
2020-01-14 02:04:33 +00:00
VerifyFallbackPost: verifier.VerifyFallbackPost,
}
}