Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: remove unexpected behaviour error string #5702

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions modules/core/04-channel/keeper/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,15 @@ func (k Keeper) RecvPacket(
}

// If counterpartyUpgrade is stored we need to ensure that the
// packet sequence is < counterparty next sequence send. This is a defensive
// check and if the counterparty is implemented correctly, this should never abort.
// packet sequence is < counterparty next sequence send. If the
// counterparty is implemented correctly, this may only occur
// when we are in FLUSHCOMPLETE and the counterparty has already
// completed the channel upgrade.
counterpartyUpgrade, found := k.GetCounterpartyUpgrade(ctx, packet.GetDestPort(), packet.GetDestChannel())
if found {
// only error if the counterparty next sequence send is set (> 0)
// this error should never be reached, as under normal circumstances the counterparty
// should not send any packets after the upgrade has been started.
counterpartyNextSequenceSend := counterpartyUpgrade.NextSequenceSend
if packet.GetSequence() >= counterpartyNextSequenceSend {
return errorsmod.Wrapf(
types.ErrInvalidPacket,
"failed to receive packet, cannot flush packet at sequence greater than or equal to counterparty next sequence send (%d) ≥ (%d). UNEXPECTED BEHAVIOUR ON COUNTERPARTY, PLEASE REPORT ISSUE TO RELEVANT CHAIN DEVELOPERS",
packet.GetSequence(), counterpartyNextSequenceSend,
)
return errorsmod.Wrapf(types.ErrInvalidPacket, "cannot flush packet at sequence greater than or equal to counterparty next sequence send (%d) ≥ (%d).", packet.GetSequence(), counterpartyNextSequenceSend)
}
}

Expand Down
Loading