Skip to content

Commit

Permalink
rename Maxed to MaxReached
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Dec 18, 2024
1 parent 8fea9b0 commit fb46049
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion x/crosschain/keeper/msg_server_add_outbound_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (k msgServer) AddOutboundTracker(
}

// check if max hashes are reached
if tracker.IsMaxed() {
if tracker.MaxReached() {
return nil, types.ErrMaxTxOutTrackerHashesReached.Wrapf(
"max hashes reached for chain %d, nonce %d, hash number: %d",
msg.ChainId,
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/simulation/operation_add_outbound_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func SimulateMsgAddOutboundTracker(k keeper.Keeper) simtypes.Operation {
chainID,
uint64(nonce),
) // #nosec G115 - overflow is not an issue here
if found && tracker.IsMaxed() {
if found && tracker.MaxReached() {
return simtypes.NoOpMsg(
types.ModuleName,
types.TypeMsgAddOutboundTracker,
Expand Down
3 changes: 2 additions & 1 deletion x/crosschain/types/outbound_tracker.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package types

func (o *OutboundTracker) IsMaxed() bool {
// MaxReached returns true if the OutboundTracker has reached the maximum number of hashes it can store.
func (o *OutboundTracker) MaxReached() bool {
return len(o.HashList) >= MaxOutboundTrackerHashes
}
4 changes: 2 additions & 2 deletions x/crosschain/types/outbound_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func TestOutboundTracker_IsMaxed(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.tracker.IsMaxed(); got != tt.want {
t.Errorf("OutboundTracker.IsMaxed() = %v, want %v", got, tt.want)
if got := tt.tracker.MaxReached(); got != tt.want {
t.Errorf("OutboundTracker.MaxReached() = %v, want %v", got, tt.want)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/chains/evm/observer/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (ob *Observer) ProcessOutboundTrackers(ctx context.Context) error {
// should not happen. We can't tell which txHash is true. It might happen (e.g. bug, glitchy/hacked endpoint)
ob.Logger().Outbound.Error().Msgf("WatchOutbound: confirmed multiple (%d) outbound for chain %d nonce %d", txCount, chainID, nonce)
} else {
if tracker.IsMaxed() {
if tracker.MaxReached() {
ob.Logger().Outbound.Error().Msgf("WatchOutbound: outbound tracker is full of hashes for chain %d nonce %d", chainID, nonce)
}
}
Expand Down

0 comments on commit fb46049

Please sign in to comment.