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

nits: remove unnecessary errors, add mock upgrade version #3734

Merged
merged 4 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
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
16 changes: 7 additions & 9 deletions modules/core/04-channel/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ var (
// Perform a no-op on the current Msg
ErrNoOpMsg = errorsmod.Register(SubModuleName, 23, "message is redundant, no-op will be performed")

ErrInvalidChannelVersion = errorsmod.Register(SubModuleName, 24, "invalid channel version")
ErrPacketNotSent = errorsmod.Register(SubModuleName, 25, "packet has not been sent")
ErrInvalidTimeout = errorsmod.Register(SubModuleName, 26, "invalid packet timeout")
ErrInvalidUpgradeTimeout = errorsmod.Register(SubModuleName, 27, "either timeout height or timeout timestamp must be non-zero")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to update references used in modules/core/04-channel/types/msgs.go

ErrUpgradeSequenceNotFound = errorsmod.Register(SubModuleName, 28, "upgrade sequence not found")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

ErrUpgradeErrorNotFound = errorsmod.Register(SubModuleName, 29, "upgrade error receipt not found")
ErrInvalidUpgrade = errorsmod.Register(SubModuleName, 30, "invalid upgrade")
ErrInvalidUpgradeSequence = errorsmod.Register(SubModuleName, 31, "invalid upgrade sequence")
ErrUpgradeNotFound = errorsmod.Register(SubModuleName, 32, "upgrade not found")
ErrInvalidChannelVersion = errorsmod.Register(SubModuleName, 24, "invalid channel version")
ErrPacketNotSent = errorsmod.Register(SubModuleName, 25, "packet has not been sent")
ErrInvalidTimeout = errorsmod.Register(SubModuleName, 26, "invalid packet timeout")
ErrUpgradeErrorNotFound = errorsmod.Register(SubModuleName, 27, "upgrade error receipt not found")
ErrInvalidUpgrade = errorsmod.Register(SubModuleName, 28, "invalid upgrade")
ErrInvalidUpgradeSequence = errorsmod.Register(SubModuleName, 29, "invalid upgrade sequence")
ErrUpgradeNotFound = errorsmod.Register(SubModuleName, 30, "upgrade not found")
)
4 changes: 2 additions & 2 deletions modules/core/04-channel/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ func (msg MsgChannelUpgradeTry) ValidateBasic() error {
return errorsmod.Wrap(ErrInvalidUpgrade, "proposed connection hops cannot be empty")
}

if msg.UpgradeTimeout.Height.IsZero() && msg.UpgradeTimeout.Timestamp == 0 {
return errorsmod.Wrap(ErrInvalidUpgradeTimeout, "timeout height or timeout timestamp must be non-zero")
if !msg.UpgradeTimeout.IsValid() {
return errorsmod.Wrap(ErrInvalidTimeout, "upgrade timeout height or timeout timestamp must be non-zero")
}

if err := msg.CounterpartyProposedUpgrade.ValidateBasic(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions testing/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
MockRecvCanaryCapabilityName = "mock receive canary capability name"
MockAckCanaryCapabilityName = "mock acknowledgement canary capability name"
MockTimeoutCanaryCapabilityName = "mock timeout canary capability name"
UpgradeVersion = fmt.Sprintf("%s-v2", Version)
)

var _ porttypes.IBCModule = IBCModule{}
Expand Down