Merge pull request #1436 from filecoin-project/asr/hash

Use blake2b, not SHA, for VRFs
This commit is contained in:
Whyrusleeping 2020-03-20 11:30:04 -07:00 committed by GitHub
commit 78de82158d
3 changed files with 4 additions and 6 deletions

View File

@ -3,8 +3,8 @@ package gen
import (
"bytes"
"context"
"crypto/sha256"
"fmt"
"github.com/minio/blake2b-simd"
"io/ioutil"
"sync/atomic"
@ -584,7 +584,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
})
}
hvrf := sha256.Sum256(vrfout)
hvrf := blake2b.Sum256(vrfout)
candidates, err := epp.GenerateCandidates(ctx, sinfos, hvrf[:])
if err != nil {
return nil, xerrors.Errorf("failed to generate electionPoSt candidates: %w", err)

View File

@ -2,9 +2,9 @@ package chain
import (
"context"
"crypto/sha256"
"errors"
"fmt"
"github.com/minio/blake2b-simd"
"sync"
"time"
@ -725,7 +725,7 @@ func (syncer *Syncer) VerifyElectionPoStProof(ctx context.Context, h *types.Bloc
// TODO: why do we need this here?
challengeCount := sectorbuilder.ElectionPostChallengeCount(uint64(len(sectorInfo)), 0)
hvrf := sha256.Sum256(h.EPostProof.PostRand)
hvrf := blake2b.Sum256(h.EPostProof.PostRand)
pvi := abi.PoStVerifyInfo{
Randomness: hvrf[:],
Candidates: candidates,

2
go.sum
View File

@ -133,8 +133,6 @@ github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.m
github.com/filecoin-project/specs-actors v0.0.0-20200226200336-94c9b92b2775/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
github.com/filecoin-project/specs-actors v0.0.0-20200302223606-0eaf97b10aaf/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
github.com/filecoin-project/specs-actors v0.0.0-20200306000749-99e98e61e2a0/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU=
github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888 h1:VCrkpFmZuQRyHrUpFTS3K/09cCQDMi/ZJUQ6c4zr1g4=
github.com/filecoin-project/specs-actors v0.0.0-20200311215506-e95895452888/go.mod h1:5WngRgTN5Eo4+0SjCBqLzEr2l6Mj45DrP2606gBhqI0=
github.com/filecoin-project/specs-actors v0.0.0-20200312030511-3f5510bf6130 h1:atiWEDtI/gzSm89fL+NyneLN3eHfBd1QPgOZyXPjA5M=
github.com/filecoin-project/specs-actors v0.0.0-20200312030511-3f5510bf6130/go.mod h1:5WngRgTN5Eo4+0SjCBqLzEr2l6Mj45DrP2606gBhqI0=
github.com/filecoin-project/specs-storage v0.0.0-20200303233430-1a5a408f7513 h1:okBx3lPomwDxlPmRvyP078BwivDfdxNUlpCDhDD0ia8=