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 25, 2021
1 parent 735d30a commit cd6ed9d
Show file tree
Hide file tree
Showing 8 changed files with 463 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
DisputableProofCount 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 @@ -107,6 +107,7 @@ type Deadline interface {
PartitionsPoSted() (bitfield.BitField, error)

PartitionsChanged(Deadline) (bool, error)
DisputableProofCount() (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) DisputableProofCount() (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) DisputableProofCount() (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) DisputableProofCount() (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 cd6ed9d

Please sign in to comment.