-
Notifications
You must be signed in to change notification settings - Fork 332
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
Remove height information from IbcEvent
#2542
Conversation
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.
Great work @plafer, left some minor comments inline.
Err(Error::missing_raw_header()) | ||
} | ||
|
||
#[cfg(test)] |
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.
Sweet!
pub const CONN_ID_ATTRIBUTE_KEY: &str = "connection_id"; | ||
pub const CLIENT_ID_ATTRIBUTE_KEY: &str = "client_id"; | ||
pub const COUNTERPARTY_CONN_ID_ATTRIBUTE_KEY: &str = "counterparty_connection_id"; | ||
pub const COUNTERPARTY_CLIENT_ID_ATTRIBUTE_KEY: &str = "counterparty_client_id"; | ||
|
||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
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.
Nice!
relayer/src/event.rs
Outdated
Self { event, height } | ||
} | ||
|
||
pub fn event(&self) -> &IbcEvent { |
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.
We don't need those if the fields are public imho
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.
Alternatively, we can make the the fields private.
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.
relayer/src/event.rs
Outdated
&self.event | ||
} | ||
|
||
pub fn height(&self) -> &Height { |
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.
Same here
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.
relayer/src/link/relay_path.rs
Outdated
PrettyEvents( | ||
dst_tx_events | ||
.iter() | ||
.map(|ev| ev.event.clone()) |
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.
Is there no way around cloning all the events here? Feel free to disregard
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.
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.
Thanks, @plafer! Nicely done! 🙏 Just added a question and a suggestion.
@@ -336,59 +411,6 @@ impl IbcEvent { | |||
} | |||
} | |||
|
|||
pub fn height(&self) -> Height { |
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.
👌
Co-authored-by: Romain Ruetschi <romain@informal.systems>
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.
Awesome work! Pre-approved (pending Ci fix).
* Introduce IbcEventWithHeight * Remove IbcEvent height() and set_height() * before AbciEvent -> Attributes refactor * stop using try_from_tx in favor of IbcEvent::try_from * Client TryFrom AbciEvent done * TryFrom AbciEvent for connection * AbciEvent -> IbcEvent scaffolding done * Client Abci conversion done * connection abci -> IbcEvent done * channel abci conversion done * Before TxSyncResult use IbcEventWithHeight * Remove client height * Remove height from connection * channel heights removed * Move tests to modules * move connection tests to modules * move channel tests to modules * fix bug * changelog * Update .changelog/unreleased/improvements/2542-remove-ibcevent-height Co-authored-by: Romain Ruetschi <romain@informal.systems> * fix potential regression * Remove `event()` from IbcEventWithHeight * Remove `height()` from IbcEventWithHeight * Fix PrettyEvents * fix regression - try 2 * cargo doc fix * move AbciEvent -> IbcEvent to relayer * Move abci_event -> ibc_event logic to relayer informalsystems#2 * Fix get_all_events() * fix e2e tests Co-authored-by: Romain Ruetschi <romain@informal.systems>
Closes: #2539
Description
height()
andset_height()
fromIbcEvent
IbcEvent
that needed height information with newIbcEventWithHeight
extract_attributes_from_tx()
in theTryFrom<&AbciEvent> for IbcEventStruct
temporarily. All client events don't have the same attributes, so we need a different solution. Similarly for connection and channel events.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.