Skip to content

Commit 9b5036a

Browse files
authored
Merge pull request #292 from hyperledger-labs/fix-ibc-1127
Fix cosmos/ibc#1127 Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
2 parents 3189415 + e6a9796 commit 9b5036a

File tree

5 files changed

+223
-48
lines changed

5 files changed

+223
-48
lines changed

.gas-snapshot

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ IBCMockAppTest:testHandshakeBetweenDifferentPorts() (gas: 3339603)
99
IBCMockAppTest:testPacketRelay() (gas: 13935831)
1010
IBCMockAppTest:testPacketTimeout() (gas: 4284259)
1111
ICS24HostTest:testValidatePortIdentifier() (gas: 37060)
12-
TestICS02:testCreateClient() (gas: 36638191)
12+
TestICS02:testCreateClient() (gas: 36875161)
1313
TestICS02:testHeightToUint128((uint64,uint64)) (runs: 256, μ: 887, ~: 887)
14-
TestICS02:testInvalidCreateClient() (gas: 36535302)
15-
TestICS02:testInvalidUpdateClient() (gas: 36534318)
16-
TestICS02:testRegisterClient() (gas: 36189984)
17-
TestICS02:testRegisterClientDuplicatedClientType() (gas: 36175293)
18-
TestICS02:testRegisterClientInvalidClientType() (gas: 36204799)
19-
TestICS02:testUpdateClient() (gas: 36702518)
14+
TestICS02:testInvalidCreateClient() (gas: 36772272)
15+
TestICS02:testInvalidUpdateClient() (gas: 36771288)
16+
TestICS02:testRegisterClient() (gas: 36426954)
17+
TestICS02:testRegisterClientDuplicatedClientType() (gas: 36412263)
18+
TestICS02:testRegisterClientInvalidClientType() (gas: 36441769)
19+
TestICS02:testUpdateClient() (gas: 36939488)
2020
TestICS03Handshake:testConnOpenAck() (gas: 1858230)
2121
TestICS03Handshake:testConnOpenConfirm() (gas: 2054143)
2222
TestICS03Handshake:testConnOpenInit() (gas: 1429838)
@@ -48,24 +48,25 @@ TestICS04Packet:testRecvPacketTimeoutHeight() (gas: 3259769)
4848
TestICS04Packet:testRecvPacketTimeoutTimestamp() (gas: 3284145)
4949
TestICS04Packet:testSendPacket() (gas: 6411842)
5050
TestICS04Packet:testTimeoutOnClose() (gas: 3553375)
51-
TestICS04Upgrade:testUpgradeAuthorityCancel() (gas: 46734825)
52-
TestICS04Upgrade:testUpgradeCannotCancelWithOldErrorReceipt() (gas: 3458838)
53-
TestICS04Upgrade:testUpgradeCannotRecvNextUpgradePacket() (gas: 5258785)
54-
TestICS04Upgrade:testUpgradeCounterpartyAdvanceNextSequenceBeforeOpen() (gas: 5229663)
55-
TestICS04Upgrade:testUpgradeCrossingHelloIncompatibleProposals() (gas: 5068281)
56-
TestICS04Upgrade:testUpgradeFull() (gas: 56577477)
57-
TestICS04Upgrade:testUpgradeInit() (gas: 3074224)
58-
TestICS04Upgrade:testUpgradeNoChanges() (gas: 2473090)
59-
TestICS04Upgrade:testUpgradeNotUpgradableModule() (gas: 3648626)
60-
TestICS04Upgrade:testUpgradeOutOfSync() (gas: 3905908)
61-
TestICS04Upgrade:testUpgradeRelaySuccessAtCounterpartyFlushComplete() (gas: 5230550)
62-
TestICS04Upgrade:testUpgradeRelaySuccessAtFlushing() (gas: 5603759)
63-
TestICS04Upgrade:testUpgradeSendPacketFailAtFlushingOrFlushComplete() (gas: 4072103)
64-
TestICS04Upgrade:testUpgradeTimeoutAbortAck() (gas: 17708385)
65-
TestICS04Upgrade:testUpgradeTimeoutAbortConfirm() (gas: 21315818)
66-
TestICS04Upgrade:testUpgradeTimeoutUpgrade() (gas: 70972587)
67-
TestICS04Upgrade:testUpgradeToOrdered() (gas: 56491951)
68-
TestICS04Upgrade:testUpgradeToUnordered() (gas: 45100181)
51+
TestICS04Upgrade:testCrossingHelloInconsistentVersions() (gas: 10152794)
52+
TestICS04Upgrade:testUpgradeAuthorityCancel() (gas: 47011316)
53+
TestICS04Upgrade:testUpgradeCannotCancelWithOldErrorReceipt() (gas: 3460218)
54+
TestICS04Upgrade:testUpgradeCannotRecvNextUpgradePacket() (gas: 5325143)
55+
TestICS04Upgrade:testUpgradeCounterpartyAdvanceNextSequenceBeforeOpen() (gas: 5295126)
56+
TestICS04Upgrade:testUpgradeCrossingHelloIncompatibleProposals() (gas: 5070497)
57+
TestICS04Upgrade:testUpgradeFull() (gas: 57118740)
58+
TestICS04Upgrade:testUpgradeInit() (gas: 3075843)
59+
TestICS04Upgrade:testUpgradeNoChanges() (gas: 2473554)
60+
TestICS04Upgrade:testUpgradeNotUpgradableModule() (gas: 3649002)
61+
TestICS04Upgrade:testUpgradeOutOfSync() (gas: 3909083)
62+
TestICS04Upgrade:testUpgradeRelaySuccessAtCounterpartyFlushComplete() (gas: 5296851)
63+
TestICS04Upgrade:testUpgradeRelaySuccessAtFlushing() (gas: 5670614)
64+
TestICS04Upgrade:testUpgradeSendPacketFailAtFlushingOrFlushComplete() (gas: 4089431)
65+
TestICS04Upgrade:testUpgradeTimeoutAbortAck() (gas: 17829083)
66+
TestICS04Upgrade:testUpgradeTimeoutAbortConfirm() (gas: 21547969)
67+
TestICS04Upgrade:testUpgradeTimeoutUpgrade() (gas: 71726806)
68+
TestICS04Upgrade:testUpgradeToOrdered() (gas: 56982472)
69+
TestICS04Upgrade:testUpgradeToUnordered() (gas: 45498427)
6970
TestICS04UpgradeApp:testUpgradeAuthorizationChanneNotFound() (gas: 61690)
7071
TestICS04UpgradeApp:testUpgradeAuthorizationRePropose() (gas: 2565379)
7172
TestICS04UpgradeApp:testUpgradeAuthorizationRemove() (gas: 2475938)

contracts/core/04-channel/IBCChannelUpgrade.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,15 @@ contract IBCChannelUpgradeConfirmOpenTimeoutCancel is
614614
msg_.proofs
615615
);
616616

617+
Upgrade.Data storage existingUpgrade = upgrades[msg_.portId][msg_.channelId];
618+
if (existingUpgrade.fields.ordering == Channel.Order.ORDER_NONE_UNSPECIFIED) {
619+
revert IBCChannelUpgradeNoExistingUpgrade();
620+
}
621+
if (!isCompatibleUpgradeFields(existingUpgrade.fields, msg_.counterpartyUpgrade.fields)) {
622+
restoreChannel(msg_.portId, msg_.channelId, UpgradeHandshakeError.IncompatibleProposal);
623+
return false;
624+
}
625+
617626
// counterparty-specified timeout must not have exceeded
618627
// if it has, then restore the channel and abort upgrade handshake
619628
Timeout.Data calldata timeout = msg_.counterpartyUpgrade.timeout;

0 commit comments

Comments
 (0)