Merge pull request #795 from filecoin-project/fix/proofs-print-log

don't print giant long proof in error message
This commit is contained in:
Łukasz Magiera 2019-12-08 19:38:45 +01:00 committed by GitHub
commit 850030908a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,7 +343,7 @@ func (sma StorageMinerActor) ProveCommitSector(act *types.Actor, vmctx types.VMC
if ok, err := ValidatePoRep(ctx, maddr, mi.SectorSize, commD, us.Info.CommR, ticket, params.Proof, seed, params.SectorID); err != nil {
return nil, err
} else if !ok {
return nil, aerrors.Newf(2, "porep proof was invalid (t:%x; s:%x(%d); p:%x)", ticket, seed, us.ReceivedEpoch+build.InteractivePoRepDelay, params.Proof)
return nil, aerrors.Newf(2, "porep proof was invalid (t:%x; s:%x(%d); p:%s)", ticket, seed, us.ReceivedEpoch+build.InteractivePoRepDelay, truncateHexPrint(params.Proof))
}
// Note: There must exist a unique index in the miner's sector set for each
@ -394,6 +394,14 @@ func (sma StorageMinerActor) ProveCommitSector(act *types.Actor, vmctx types.VMC
return nil, err
}
func truncateHexPrint(b []byte) string {
s := fmt.Sprintf("%x", b)
if len(s) > 60 {
return s[:20] + "..." + s[len(s)-20:]
}
return s
}
type SubmitFallbackPoStParams struct {
Proof []byte
Candidates []types.EPostTicket