-
Notifications
You must be signed in to change notification settings - Fork 579
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
chore: adding MsgChannelUpgradeTimeout
fields and sdk.Msg
interface impl
#1830
Merged
damiannolan
merged 6 commits into
04-channel-upgrades
from
damian/1626-impl-sdk-msg-upgrade-timeout
Aug 5, 2022
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
777ebc8
adding fields to MsgChannelUpgradeCancel and gen protos
damiannolan 03dc945
impl sdk.Msg interface for MsgChannelUpgradeCancel. adding tests
damiannolan 023d5e3
renaming proof arg
damiannolan 4260efd
adding upgrade timeout sdk.Msg impl
damiannolan 680532c
Merge branch '04-channel-upgrades' into damian/1626-impl-sdk-msg-upgr…
damiannolan b2b4608
Merge branch '04-channel-upgrades' into damian/1626-impl-sdk-msg-upgr…
damiannolan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -571,18 +571,64 @@ var _ sdk.Msg = &MsgChannelUpgradeTimeout{} | |
|
||
// NewMsgChannelUpgradeTimeout constructs a new MsgChannelUpgradeTimeout | ||
// nolint:interfacer | ||
func NewMsgChannelUpgradeTimeout() *MsgChannelUpgradeTimeout { | ||
return &MsgChannelUpgradeTimeout{} | ||
func NewMsgChannelUpgradeTimeout( | ||
portID, channelID string, | ||
counterpartyChannel Channel, | ||
errorReceipt ErrorReceipt, | ||
proofChannel, proofErrorReceipt []byte, | ||
proofHeight clienttypes.Height, | ||
signer string, | ||
) *MsgChannelUpgradeTimeout { | ||
return &MsgChannelUpgradeTimeout{ | ||
PortId: portID, | ||
ChannelId: channelID, | ||
CounterpartyChannel: counterpartyChannel, | ||
PreviousErrorReceipt: errorReceipt, | ||
ProofChannel: proofChannel, | ||
ProofErrorReceipt: proofErrorReceipt, | ||
ProofHeight: proofHeight, | ||
Signer: signer, | ||
} | ||
} | ||
|
||
// ValidateBasic implements sdk.Msg | ||
func (msg MsgChannelUpgradeTimeout) ValidateBasic() error { | ||
return errors.New("error method not implemented") | ||
if err := host.PortIdentifierValidator(msg.PortId); err != nil { | ||
return sdkerrors.Wrap(err, "invalid port ID") | ||
} | ||
|
||
if !IsValidChannelID(msg.ChannelId) { | ||
return ErrInvalidChannelIdentifier | ||
} | ||
|
||
if len(msg.ProofChannel) == 0 { | ||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof") | ||
} | ||
|
||
if msg.ProofHeight.IsZero() { | ||
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero") | ||
} | ||
|
||
if msg.CounterpartyChannel.State != OPEN { | ||
return sdkerrors.Wrapf(ErrInvalidChannelState, "expected: %s, got: %s", OPEN, msg.CounterpartyChannel.State) | ||
} | ||
Comment on lines
+804
to
+806
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AdityaSripal do you think there's any additional checks we need to perform on the counterparty channel? |
||
|
||
_, err := sdk.AccAddressFromBech32(msg.Signer) | ||
if err != nil { | ||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// GetSigners implements sdk.Msg | ||
func (msg MsgChannelUpgradeTimeout) GetSigners() []sdk.AccAddress { | ||
return []sdk.AccAddress{} | ||
signer, err := sdk.AccAddressFromBech32(msg.Signer) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return []sdk.AccAddress{signer} | ||
} | ||
|
||
var _ sdk.Msg = &MsgChannelUpgradeCancel{} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could the counterparty channel state be in INITUPGRADE (crossing hellos?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know crossing hellos are no longer supported, and won't be for channel upgrades?
cc. @AdityaSripal