Skip to content

Commit

Permalink
fix: make DealStatesEqual work properly (#12783)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg authored Dec 16, 2024
1 parent 7f2068e commit 263636b
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 263636b

Please sign in to comment.