Skip to content

Commit

Permalink
fix: make DealStatesEqual work properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Dec 13, 2024
1 parent 4317d1a commit fa03d36
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
25 changes: 14 additions & 11 deletions chain/actors/builtin/market/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,19 @@ type DealState interface {
}

func DealStatesEqual(a, b DealState) bool {
return DealStatesEqual(a, b)
if a.SectorNumber() != b.SectorNumber() {
return false
}
if a.SectorStartEpoch() != b.SectorStartEpoch() {
return false
}
if a.LastUpdatedEpoch() != b.LastUpdatedEpoch() {
return false
}
if a.SlashEpoch() != b.SlashEpoch() {
return false
}
return true
}

type DealStateChanges struct {
Expand Down Expand Up @@ -207,16 +219,7 @@ func (e *emptyDealState) SlashEpoch() abi.ChainEpoch {
}

func (e *emptyDealState) Equals(other DealState) bool {
if e.SectorStartEpoch() != other.SectorStartEpoch() {
return false
}
if e.LastUpdatedEpoch() != other.LastUpdatedEpoch() {
return false
}
if e.SlashEpoch() != other.SlashEpoch() {
return false
}
return true
return DealStatesEqual(e, other)
}

func EmptyDealState() DealState {
Expand Down
25 changes: 14 additions & 11 deletions chain/actors/builtin/market/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,19 @@ type DealState interface {
}

func DealStatesEqual(a, b DealState) bool {
return DealStatesEqual(a, b)
if a.SectorNumber() != b.SectorNumber() {
return false
}
if a.SectorStartEpoch() != b.SectorStartEpoch() {
return false
}
if a.LastUpdatedEpoch() != b.LastUpdatedEpoch() {
return false
}
if a.SlashEpoch() != b.SlashEpoch() {
return false
}
return true
}

type DealStateChanges struct {
Expand Down Expand Up @@ -334,16 +346,7 @@ func (e *emptyDealState) SlashEpoch() abi.ChainEpoch {
}

func (e *emptyDealState) Equals(other DealState) bool {
if e.SectorStartEpoch() != other.SectorStartEpoch() {
return false
}
if e.LastUpdatedEpoch() != other.LastUpdatedEpoch() {
return false
}
if e.SlashEpoch() != other.SlashEpoch() {
return false
}
return true
return DealStatesEqual(e, other)
}

func EmptyDealState() DealState {
Expand Down

0 comments on commit fa03d36

Please sign in to comment.