Skip to content

Commit

Permalink
Merge branch '04-channel-upgrades' into charly/#3448-modify-upgrade-try
Browse files Browse the repository at this point in the history
  • Loading branch information
charleenfei authored Jun 6, 2023
2 parents 2b8cbb3 + ec1c1d8 commit 2943a8f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions testing/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,34 @@ func (endpoint *Endpoint) ChanUpgradeAck() error {
return endpoint.Chain.sendMsgs(msg)
}

// ChanUpgradeTimeout sends a MsgChannelUpgradeTimeout to the associated endpoint.
func (endpoint *Endpoint) ChanUpgradeTimeout() error {
err := endpoint.UpdateClient()
require.NoError(endpoint.Chain.TB, err)

channelKey := host.ChannelKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID)
proofChannel, height := endpoint.Counterparty.Chain.QueryProof(channelKey)

errorReceiptKey := host.ChannelUpgradeErrorKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID)
proofErrorReceipt, _ := endpoint.Counterparty.Chain.QueryProof(errorReceiptKey)

errorReceipt, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetUpgradeErrorReceipt(endpoint.Counterparty.Chain.GetContext(), endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID)
require.True(endpoint.Chain.TB, found)

msg := channeltypes.NewMsgChannelUpgradeTimeout(
endpoint.ChannelConfig.PortID,
endpoint.ChannelID,
endpoint.Counterparty.GetChannel(),
errorReceipt,
proofChannel,
proofErrorReceipt,
height,
endpoint.Chain.SenderAccount.GetAddress().String(),
)

return endpoint.Chain.sendMsgs(msg)
}

// SetChannelState sets a channel state
func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error {
channel := endpoint.GetChannel()
Expand Down

0 comments on commit 2943a8f

Please sign in to comment.