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

Add Channel Upgrade ACK and CONFIRM steps #3462

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d76404a
Add test for ChannelUpgradeInit step
ljoss17 Apr 17, 2023
b22164f
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 17, 2023
8da9f9d
Add conditional check 'channel-upgrade' to channel upgradability tests
ljoss17 Apr 17, 2023
74c0cd2
Improve info message
ljoss17 Apr 17, 2023
40679f2
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 18, 2023
5c81105
Update event processing for UpgradeInit
ljoss17 Apr 18, 2023
291d782
Update UpgradeInit step test
ljoss17 Apr 18, 2023
1b633a9
Rename ChannelUpgradeInit test
ljoss17 Apr 18, 2023
68d1a8d
Add ChanUpgradeTry test
ljoss17 Apr 18, 2023
105a531
Improve channel upgrade steps assertion
ljoss17 Apr 18, 2023
cea437d
Add ChannelUpgradeAssertionAttributes struct for tests
ljoss17 Apr 18, 2023
54f3290
Merge branch 'luca_joss/integration-tests-channel-upgradability' into…
ljoss17 Apr 18, 2023
898409a
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 19, 2023
b81107e
Update naming for modifiable channel attributes in tests
ljoss17 Apr 19, 2023
01a5fb5
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 19, 2023
643abaf
Add test for 'ChanUpgradeAck' step
ljoss17 Apr 19, 2023
e155cb7
Fix test doc string
ljoss17 Apr 19, 2023
564eab9
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 20, 2023
fbff293
Restore commented lines for channel upgrade TRY step
ljoss17 Apr 20, 2023
8d7a78f
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 21, 2023
0081a47
Improve channel upgrade tests
ljoss17 Apr 21, 2023
639c38d
Merge branch 'luca_joss/integration-tests-channel-upgradability-upgra…
ljoss17 Apr 21, 2023
36c2292
Fix after merge
ljoss17 Apr 21, 2023
d0a3242
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Apr 24, 2023
eb4e68e
Disable TRY assert in test
ljoss17 Apr 24, 2023
b4c92d3
Remove unnecessary test configuration for channel upgrade
ljoss17 Apr 24, 2023
de6f8c2
Merge channel upgrade Init and Try tests into a single test
ljoss17 Apr 24, 2023
6bdb64b
Improve channel upgrade test
ljoss17 Apr 24, 2023
782cdd0
Use 'CountingAndCachingChainHandle' in integration tests and 'Include…
ljoss17 Apr 26, 2023
73ac38c
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jun 21, 2023
35e8ed2
Updated channel upgrade TRY step tests
ljoss17 Jun 21, 2023
6567e84
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jun 21, 2023
22d5a50
Fix and improve channel upgrade TRY step test
ljoss17 Jun 23, 2023
e8299a7
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jun 23, 2023
1d58e9f
Updated nix flake
ljoss17 Jun 23, 2023
89ffd64
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jun 23, 2023
25b362e
Fix test-stable
ljoss17 Jun 23, 2023
c7fa884
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jul 3, 2023
03f489d
Update nix flake and TRY step test
ljoss17 Jul 3, 2023
785f530
Merge branch 'luca_joss/integration-tests-channel-upgradability-upgra…
ljoss17 Jul 3, 2023
8620841
Update ACK step assert function
ljoss17 Jul 3, 2023
8ced70d
Fix interchain-security CI. Add domain type FlushStatus
ljoss17 Jul 3, 2023
1806f26
Merge branch 'luca_joss/integration-tests-channel-upgradability-upgra…
ljoss17 Jul 3, 2023
b22801b
Fix FlushStatus display errors
ljoss17 Jul 3, 2023
4fc0d53
Merge branch 'luca_joss/integration-tests-channel-upgradability-upgra…
ljoss17 Jul 3, 2023
2e6dff6
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jul 4, 2023
6afe27f
Add build and send MsgChannelUpgradeAck
ljoss17 Jul 4, 2023
2363939
Add ACK step to Channel Upgrade test
ljoss17 Jul 4, 2023
8fedf54
Implement Channel Upgrade OPEN step
ljoss17 Jul 7, 2023
dd2418f
Update flake.lock to use latest simapp for channel upgrade
ljoss17 Jul 7, 2023
659a223
Fix channel upgrade test OPEN step
ljoss17 Jul 10, 2023
8c5a695
Fix assertion after channelupgradeopen
ljoss17 Jul 13, 2023
e014b51
Update nix flake
ljoss17 Jul 19, 2023
ccfa026
Merge branch 'sean/channel-upgradability' into luca_joss/integration-…
ljoss17 Jul 19, 2023
60ede2b
Fix comments
ljoss17 Jul 19, 2023
523c72c
Implement PartialEq for Version
ljoss17 Jul 19, 2023
e17be0d
Apply suggestions and improve documentation
ljoss17 Jul 24, 2023
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
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions crates/relayer-types/src/core/ics04_channel/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,30 +248,30 @@ impl ChannelEnd {

/// Helper function to compare the state of this end with another state.
pub fn state_matches(&self, other: &State) -> bool {
self.state.eq(other)
self.state() == other
}

/// Helper function to compare the flush status of this end with another flush status.
pub fn flush_status_matches(&self, other: &FlushStatus) -> bool {
self.flush_status.eq(other)
self.flush_status() == other
}

/// Helper function to compare the order of this end with another order.
pub fn order_matches(&self, other: &Ordering) -> bool {
self.ordering.eq(other)
self.ordering() == other
}

#[allow(clippy::ptr_arg)]
pub fn connection_hops_matches(&self, other: &Vec<ConnectionId>) -> bool {
self.connection_hops.eq(other)
self.connection_hops() == other
}

pub fn counterparty_matches(&self, other: &Counterparty) -> bool {
self.counterparty().eq(other)
self.counterparty() == other
}

pub fn version_matches(&self, other: &Version) -> bool {
self.version().eq(other)
self.version() == other
}
}

Expand Down Expand Up @@ -424,7 +424,13 @@ pub enum State {
/// A channel has acknowledged the upgrade handshake step on the counterparty chain.
/// The counterparty chain that accepts the upgrade should set the channel state from
/// OPEN to TRYUPGRADE.
/// The counterparty chain blocks new packets until the channel upgrade is done or cancelled.
TryUpgrade = 6,
/// A channel has confirmed the upgrade handshake step on the counterparty chain.
/// The chain that confirmed the upgrade should set the channel state from
/// INITUPGRADE to ACKUPGRADE.
/// The chain blocks new packets until the channel upgrade is done or cancelled.
AckUpgrade = 7,
}

impl State {
Expand All @@ -438,6 +444,7 @@ impl State {
Self::Closed => "CLOSED",
Self::InitUpgrade => "INITUPGRADE",
Self::TryUpgrade => "TRYUPGRADE",
Self::AckUpgrade => "ACKUPGRADE",
}
}

Expand All @@ -451,6 +458,7 @@ impl State {
4 => Ok(Self::Closed),
5 => Ok(Self::InitUpgrade),
6 => Ok(Self::TryUpgrade),
7 => Ok(Self::AckUpgrade),
_ => Err(Error::unknown_state(s)),
}
}
Expand Down Expand Up @@ -486,6 +494,10 @@ impl State {

InitUpgrade => !matches!(other, Uninitialized | Init | TryOpen | Open),
TryUpgrade => !matches!(other, Uninitialized | Init | TryOpen | Open | InitUpgrade),
AckUpgrade => !matches!(
other,
Uninitialized | Init | TryOpen | Open | InitUpgrade | TryUpgrade
),

Closed => false,
}
Expand Down
4 changes: 4 additions & 0 deletions crates/relayer-types/src/core/ics04_channel/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ define_error! {
{ state: i32 }
| e | { format_args!("flush status unknown: {}", e.state) },

UnknownFlushStatusType
{ type_id: String }
| e | { format_args!("flush status unknown: {}", e.type_id) },

Identifier
[ ValidationError ]
| _ | { "identifier error" },
Expand Down
Loading