WIP trying to get election post to compute
This commit is contained in:
parent
72c7ec748f
commit
871c30d2a0
@ -1 +0,0 @@
|
|||||||
/ip4/147.75.80.17/tcp/1347/p2p/12D3KooWFCkQdiJEMBVA6RrWq22ZXVFfM41YX8soQ5QVvNFjMJT8
|
|
@ -1 +0,0 @@
|
|||||||
/ip4/147.75.80.29/tcp/1347/p2p/12D3KooWSw9h3e6YrYZfRWDcir8qMV7ctZG9VmtXwSaP2ntsKXYf
|
|
@ -90,8 +90,7 @@ const SectorChallengeRatioDiv = 25
|
|||||||
const EcRandomnessLookback = 300
|
const EcRandomnessLookback = 300
|
||||||
|
|
||||||
const FallbackPoStBegin = 1000
|
const FallbackPoStBegin = 1000
|
||||||
const SlashablePowerDelay = 2000
|
const SlashablePowerDelay = 2000
|
||||||
|
|
||||||
|
|
||||||
const PowerCollateralProportion = 5
|
const PowerCollateralProportion = 5
|
||||||
const PerCapitaCollateralProportion = 1
|
const PerCapitaCollateralProportion = 1
|
||||||
|
@ -137,7 +137,7 @@ var preSealCmd = &cli.Command{
|
|||||||
|
|
||||||
pco, err := sb.SealPreCommit(i, ticket, []sectorbuilder.PublicPieceInfo{pi})
|
pco, err := sb.SealPreCommit(i, ticket, []sectorbuilder.PublicPieceInfo{pi})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return xerrors.Errorf("commit: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sealedSectors = append(sealedSectors, genesis.PreSeal{
|
sealedSectors = append(sealedSectors, genesis.PreSeal{
|
||||||
@ -145,6 +145,17 @@ var preSealCmd = &cli.Command{
|
|||||||
CommD: pco.CommD,
|
CommD: pco.CommD,
|
||||||
SectorID: i,
|
SectorID: i,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
srand := sha256.Sum256([]byte(c.String("seed-preimage")))
|
||||||
|
seed := sectorbuilder.SealSeed{
|
||||||
|
TicketBytes: srand,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = sb.SealCommit(i, ticket, seed, []sectorbuilder.PublicPieceInfo{pi}, pco)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("commit: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output := map[string]genesis.GenesisMiner{
|
output := map[string]genesis.GenesisMiner{
|
||||||
|
@ -258,7 +258,7 @@ func (sb *SectorBuilder) SealPreCommit(sectorID uint64, ticket SealTicket, piece
|
|||||||
return rspco, nil
|
return rspco, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed SealSeed, pieces []PublicPieceInfo, pieceKeys []string, rspco RawSealPreCommitOutput) (proof []byte, err error) {
|
func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed SealSeed, pieces []PublicPieceInfo, rspco RawSealPreCommitOutput) (proof []byte, err error) {
|
||||||
ret := sb.RateLimit()
|
ret := sb.RateLimit()
|
||||||
defer ret()
|
defer ret()
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const sectorSize = 1024
|
const sectorSize = 1024
|
||||||
|
|
||||||
type seal struct {
|
type seal struct {
|
||||||
sid uint64
|
sid uint64
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ func (s *seal) commit(t *testing.T, sb *sectorbuilder.SectorBuilder, done func()
|
|||||||
TicketBytes: [32]byte{0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9},
|
TicketBytes: [32]byte{0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9},
|
||||||
}
|
}
|
||||||
|
|
||||||
proof, err := sb.SealCommit(s.sid, s.ticket, seed, []sectorbuilder.PublicPieceInfo{s.ppi}, []string{"foo"}, s.pco)
|
proof, err := sb.SealCommit(s.sid, s.ticket, seed, []sectorbuilder.PublicPieceInfo{s.ppi}, s.pco)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%+v", err)
|
t.Fatalf("%+v", err)
|
||||||
}
|
}
|
||||||
@ -183,6 +184,71 @@ func TestSealAndVerify(t *testing.T) {
|
|||||||
fmt.Printf("EPoSt: %s\n", epost.Sub(genCandidiates).String())
|
fmt.Printf("EPoSt: %s\n", epost.Sub(genCandidiates).String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSealPoStNoCommit(t *testing.T) {
|
||||||
|
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||||
|
t.Skip("this is slow")
|
||||||
|
}
|
||||||
|
os.Setenv("BELLMAN_NO_GPU", "1")
|
||||||
|
os.Setenv("RUST_LOG", "info")
|
||||||
|
|
||||||
|
build.SectorSizes = []uint64{sectorSize}
|
||||||
|
|
||||||
|
if err := build.GetParams(true, true); err != nil {
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ds := datastore.NewMapDatastore()
|
||||||
|
|
||||||
|
dir, err := ioutil.TempDir("", "sbtest")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sb, err := sectorbuilder.TempSectorbuilderDir(dir, sectorSize, ds)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
|
cleanup := func() {
|
||||||
|
sb.Destroy()
|
||||||
|
if t.Failed() {
|
||||||
|
fmt.Printf("not removing %s\n", dir)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := os.RemoveAll(dir); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defer cleanup()
|
||||||
|
|
||||||
|
si, err := sb.AcquireSectorId()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
s := seal{sid: si}
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
|
s.precommit(t, sb, 1, func() {})
|
||||||
|
|
||||||
|
precommit := time.Now()
|
||||||
|
|
||||||
|
// Restart sectorbuilder, re-run post
|
||||||
|
sb.Destroy()
|
||||||
|
sb, err = sectorbuilder.TempSectorbuilderDir(dir, sectorSize, ds)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%+v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
genCandidiates := s.post(t, sb)
|
||||||
|
|
||||||
|
epost := time.Now()
|
||||||
|
|
||||||
|
fmt.Printf("PreCommit: %s\n", precommit.Sub(start).String())
|
||||||
|
fmt.Printf("GenCandidates: %s\n", genCandidiates.Sub(precommit).String())
|
||||||
|
fmt.Printf("EPoSt: %s\n", epost.Sub(genCandidiates).String())
|
||||||
|
}
|
||||||
|
|
||||||
func TestSealAndVerify2(t *testing.T) {
|
func TestSealAndVerify2(t *testing.T) {
|
||||||
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware
|
||||||
t.Skip("this is slow")
|
t.Skip("this is slow")
|
||||||
|
@ -165,7 +165,7 @@ eventLoop:
|
|||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
b, err := m.mineOne(ctx, addr, base)
|
b, err := m.mineOne(ctx, addr, base)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("mining block failed: %s", err)
|
log.Errorf("mining block failed: %+v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if b != nil {
|
if b != nil {
|
||||||
|
@ -143,7 +143,7 @@ func NewElectionPoStProver(sb *sectorbuilder.SectorBuilder) *sectorBuilderEpp {
|
|||||||
return §orBuilderEpp{sb}
|
return §orBuilderEpp{sb}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ (gen.ElectionPoStProver) = (*sectorBuilderEpp)(nil)
|
var _ gen.ElectionPoStProver = (*sectorBuilderEpp)(nil)
|
||||||
|
|
||||||
func (epp *sectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
func (epp *sectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte) ([]sectorbuilder.EPostCandidate, error) {
|
||||||
var faults []uint64 // TODO
|
var faults []uint64 // TODO
|
||||||
|
@ -176,7 +176,7 @@ func (m *Miner) preCommitted(ctx context.Context, sector SectorInfo) (func(*Sect
|
|||||||
func (m *Miner) committing(ctx context.Context, sector SectorInfo) (func(*SectorInfo), error) {
|
func (m *Miner) committing(ctx context.Context, sector SectorInfo) (func(*SectorInfo), error) {
|
||||||
log.Info("scheduling seal proof computation...")
|
log.Info("scheduling seal proof computation...")
|
||||||
|
|
||||||
proof, err := m.sb.SealCommit(sector.SectorID, sector.Ticket.SB(), sector.Seed.SB(), sector.pieceInfos(), sector.refs(), sector.rspco())
|
proof, err := m.sb.SealCommit(sector.SectorID, sector.Ticket.SB(), sector.Seed.SB(), sector.pieceInfos(), sector.rspco())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("computing seal proof failed: %w", err)
|
return nil, xerrors.Errorf("computing seal proof failed: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user