Skip to content

Commit

Permalink
Build a WindowPoSt disputer
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Jan 22, 2021
1 parent d412ccd commit c256572
Show file tree
Hide file tree
Showing 8 changed files with 487 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,8 @@ const (
)

type Deadline struct {
PostSubmissions bitfield.BitField
PostSubmissions bitfield.BitField
OptimisticPoStSubmissionsSnapshotLength uint64
}

type Partition struct {
Expand Down
1 change: 1 addition & 0 deletions chain/actors/builtin/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type Deadline interface {
PartitionsPoSted() (bitfield.BitField, error)

PartitionsChanged(Deadline) (bool, error)
OptimisticPoStSubmissionsSnapshotLength() (uint64, error)
}

type Partition interface {
Expand Down
5 changes: 5 additions & 0 deletions chain/actors/builtin/miner/v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ func (d *deadline0) PartitionsPoSted() (bitfield.BitField, error) {
return d.Deadline.PostSubmissions, nil
}

func (d *deadline0) OptimisticPoStSubmissionsSnapshotLength() (uint64, error) {
// field doesn't exist until v3
return 0, nil
}

func (p *partition0) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
Expand Down
5 changes: 5 additions & 0 deletions chain/actors/builtin/miner/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ func (d *deadline2) PartitionsPoSted() (bitfield.BitField, error) {
return d.Deadline.PostSubmissions, nil
}

func (d *deadline2) OptimisticPoStSubmissionsSnapshotLength() (uint64, error) {
// field doesn't exist until v3
return 0, nil
}

func (p *partition2) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
Expand Down
9 changes: 9 additions & 0 deletions chain/actors/builtin/miner/v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ func (d *deadline3) PartitionsPoSted() (bitfield.BitField, error) {
return d.Deadline.PartitionsPoSted, nil
}

func (d *deadline3) OptimisticPoStSubmissionsSnapshotLength() (uint64, error) {
ops, err := d.OptimisticProofsSnapshotArray(d.store)
if err != nil {
return 0, err
}

return ops.Length(), nil
}

func (p *partition3) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
Expand Down
1 change: 1 addition & 0 deletions cli/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var chainCmd = &cli.Command{
chainInspectUsage,
chainDecodeCmd,
chainEncodeCmd,
chainDisputeSetCmd,
},
}

Expand Down
Loading

0 comments on commit c256572

Please sign in to comment.