Merge pull request #2415 from filecoin-project/feat/test/post/standard-tag

debug: standard PoSt tag
This commit is contained in:
Łukasz Magiera 2020-07-15 16:07:21 +02:00 committed by GitHub
commit 59b2908620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -632,7 +632,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
defer span.End() defer span.End()
if build.InsecurePoStValidation { if build.InsecurePoStValidation {
log.Warn("insecure test validation is enabled, if you see this outside of a test, it is a severe bug!") log.Warn("[INSECURE-POST-VALIDATION] if you see this outside of a test, it is a severe bug!")
} }
if err := blockSanityChecks(b.Header); err != nil { if err := blockSanityChecks(b.Header); err != nil {
@ -863,13 +863,13 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
func (syncer *Syncer) VerifyWinningPoStProof(ctx context.Context, h *types.BlockHeader, prevBeacon types.BeaconEntry, lbst cid.Cid, waddr address.Address) error { func (syncer *Syncer) VerifyWinningPoStProof(ctx context.Context, h *types.BlockHeader, prevBeacon types.BeaconEntry, lbst cid.Cid, waddr address.Address) error {
if build.InsecurePoStValidation { if build.InsecurePoStValidation {
if len(h.WinPoStProof) == 0 { if len(h.WinPoStProof) == 0 {
return xerrors.Errorf("[TESTING] No winning post proof given") return xerrors.Errorf("[INSECURE-POST-VALIDATION] No winning post proof given")
} }
if string(h.WinPoStProof[0].ProofBytes) == "valid proof" { if string(h.WinPoStProof[0].ProofBytes) == "valid proof" {
return nil return nil
} }
return xerrors.Errorf("[TESTING] winning post was invalid") return xerrors.Errorf("[INSECURE-POST-VALIDATION] winning post was invalid")
} }
buf := new(bytes.Buffer) buf := new(bytes.Buffer)

View File

@ -179,7 +179,7 @@ func (wpp *StorageWpp) GenerateCandidates(ctx context.Context, randomness abi.Po
func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []abi.SectorInfo, rand abi.PoStRandomness) ([]abi.PoStProof, error) { func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []abi.SectorInfo, rand abi.PoStRandomness) ([]abi.PoStProof, error) {
if build.InsecurePoStValidation { if build.InsecurePoStValidation {
log.Warn("Generating fake EPost proof! You should only see this while running tests!") log.Warn("[INSECURE-POST-VALIDATION] Generating fake PoSt proof! You should only see this while running tests!")
return []abi.PoStProof{{ProofBytes: []byte("valid proof")}}, nil return []abi.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
} }