Skip to content

Commit

Permalink
INTERACTIVE PROEP IS ALIVE
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Nov 2, 2019
1 parent 3e515ab commit c550e03
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chain/actors/actor_miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func (sma StorageMinerActor) ProveCommitSector(act *types.Actor, vmctx types.VMC
if ok, err := ValidatePoRep(maddr, mi.SectorSize, commD, us.CommR, ticket, params.Proof, seed, params.SectorID); err != nil {
return nil, err
} else if !ok {
return nil, aerrors.New(2, "bad proof!")
return nil, aerrors.Newf(2, "bad proof! (t:%x; s:%x(%d); p:%x)", ticket, seed, us.SubmitHeight+build.InteractivePoRepDelay, params.Proof)
}

// Note: There must exist a unique index in the miner's sector set for each
Expand Down
1 change: 1 addition & 0 deletions lib/sectorbuilder/sectorbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func VerifySeal(sectorSize uint64, commR, commD []byte, proverID address.Address
copy(commDa[:], commD)
copy(ticketa[:], ticket)
copy(seeda[:], seed)
seeda[31] = 0 // Temp Fr hack
proverIDa := addressToProverID(proverID)

return sectorbuilder.VerifySeal(sectorSize, commRa, commDa, proverIDa, ticketa, seeda, sectorID, proof)
Expand Down
2 changes: 1 addition & 1 deletion lib/sectorbuilder/sectorbuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestSealAndVerify(t *testing.T) {

seed := sectorbuilder.SealSeed{
BlockHeight: 15,
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, 8},
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, 0},
}

sco, err := sb.SealCommit(sid, seed)
Expand Down
1 change: 1 addition & 0 deletions storage/sector/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (s *Store) SealPreCommit(ctx context.Context, sectorID uint64) (sectorbuild
func (s *Store) SealComputeProof(ctx context.Context, sectorID uint64, height uint64, rand []byte) ([]byte, error) {
var tick [32]byte
copy(tick[:], rand)
tick[31] = 0

sco, err := s.sb.SealCommit(sectorID, sectorbuilder.SealSeed{
BlockHeight: height,
Expand Down
4 changes: 2 additions & 2 deletions storage/sector_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (m *Miner) preCommitted(ctx context.Context, sector SectorInfo) (func(*Sect
return nil, err
}

randHeight := mw.TipSet.Height() + build.InteractivePoRepDelay
randHeight := mw.TipSet.Height() + build.InteractivePoRepDelay - 1 // -1 because of how the messages are applied
log.Infof("precommit for sector %d made it on chain, will start post computation at height %d", sector.SectorID, randHeight)

err = m.events.ChainAt(func(ts *types.TipSet, curH uint64) error {
Expand Down Expand Up @@ -174,7 +174,7 @@ func (m *Miner) committing(ctx context.Context, sector SectorInfo) (func(*Sector
}

if mw.Receipt.ExitCode != 0 {
log.Error("UNHANDLED: submitting sector proof failed")
log.Errorf("UNHANDLED: submitting sector proof failed (t:%x; s:%x(%d); p:%x)", sector.Ticket.TicketBytes, rand, sector.RandHeight, params.Proof)
return nil, xerrors.New("UNHANDLED: submitting sector proof failed")
}

Expand Down

0 comments on commit c550e03

Please sign in to comment.