Skip to content

Commit

Permalink
Merge pull request #4403 from filecoin-project/frrist/fix-miner-shim-…
Browse files Browse the repository at this point in the history
…impls

fix: return true when deadlines changed
  • Loading branch information
magik6k authored Oct 14, 2020
2 parents 39670df + 28823fb commit d02d4bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
16 changes: 6 additions & 10 deletions chain/actors/builtin/miner/diff_deadlines.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/filecoin-project/go-state-types/exitcode"
)

type DeadlinesDiff map[uint64]*DeadlineDiff
type DeadlinesDiff map[uint64]DeadlineDiff

func DiffDeadlines(pre, cur State) (*DeadlinesDiff, error) {
func DiffDeadlines(pre, cur State) (DeadlinesDiff, error) {
changed, err := pre.DeadlinesChanged(cur)
if err != nil {
return nil, err
Expand All @@ -18,11 +18,7 @@ func DiffDeadlines(pre, cur State) (*DeadlinesDiff, error) {
return nil, nil
}

numDl, err := pre.NumDeadlines()
if err != nil {
return nil, err
}
dlDiff := make(DeadlinesDiff, numDl)
dlDiff := make(DeadlinesDiff)
if err := pre.ForEachDeadline(func(idx uint64, preDl Deadline) error {
curDl, err := cur.LoadDeadline(idx)
if err != nil {
Expand All @@ -39,12 +35,12 @@ func DiffDeadlines(pre, cur State) (*DeadlinesDiff, error) {
}); err != nil {
return nil, err
}
return &dlDiff, nil
return dlDiff, nil
}

type DeadlineDiff map[uint64]*PartitionDiff

func DiffDeadline(pre, cur Deadline) (*DeadlineDiff, error) {
func DiffDeadline(pre, cur Deadline) (DeadlineDiff, error) {
changed, err := pre.PartitionsChanged(cur)
if err != nil {
return nil, err
Expand Down Expand Up @@ -104,7 +100,7 @@ func DiffDeadline(pre, cur Deadline) (*DeadlineDiff, error) {
return nil, err
}

return &partDiff, nil
return partDiff, nil
}

type PartitionDiff struct {
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/miner/v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (s *state0) DeadlinesChanged(other State) (bool, error) {
return true, nil
}

return s.State.Deadlines.Equals(other0.Deadlines), nil
return !s.State.Deadlines.Equals(other0.Deadlines), nil
}

func (s *state0) Info() (MinerInfo, error) {
Expand Down Expand Up @@ -370,7 +370,7 @@ func (d *deadline0) PartitionsChanged(other Deadline) (bool, error) {
return true, nil
}

return d.Deadline.Partitions.Equals(other0.Deadline.Partitions), nil
return !d.Deadline.Partitions.Equals(other0.Deadline.Partitions), nil
}

func (d *deadline0) PostSubmissions() (bitfield.BitField, error) {
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/miner/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (s *state2) DeadlinesChanged(other State) (bool, error) {
return true, nil
}

return s.State.Deadlines.Equals(other2.Deadlines), nil
return !s.State.Deadlines.Equals(other2.Deadlines), nil
}

func (s *state2) Info() (MinerInfo, error) {
Expand Down Expand Up @@ -369,7 +369,7 @@ func (d *deadline2) PartitionsChanged(other Deadline) (bool, error) {
return true, nil
}

return d.Deadline.Partitions.Equals(other2.Deadline.Partitions), nil
return !d.Deadline.Partitions.Equals(other2.Deadline.Partitions), nil
}

func (d *deadline2) PostSubmissions() (bitfield.BitField, error) {
Expand Down

0 comments on commit d02d4bc

Please sign in to comment.