-
Notifications
You must be signed in to change notification settings - Fork 352
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
Re-enable tests in ics02_client
and foreign_client
#535
Conversation
Codecov Report
@@ Coverage Diff @@
## master #535 +/- ##
=========================================
+ Coverage 13.6% 45.5% +31.9%
=========================================
Files 69 134 +65
Lines 3752 8640 +4888
Branches 1374 0 -1374
=========================================
+ Hits 513 3938 +3425
- Misses 2618 4702 +2084
+ Partials 621 0 -621
Continue to review full report at Codecov.
|
d60a38f
to
85e7e46
Compare
res.client_state.latest_height(), | ||
res.consensus_state, | ||
)?; | ||
Ok(vec![ClientEvent::ClientCreated(client_id)]) |
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.
Events were being created both here and at the handlers. Now they're only created at the handlers.
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.
This looks better & cleaner!
Just to note that In future (or in other handlers) we may find it useful to create events both from the process
method of the handlers, as well as from the ClientKeeper. Then we would collect both of these vectors of events into a single one in ICS26::dispatch
. But that's not for now..
.collect() | ||
const CONSENSUS_HEIGHT_ATTRIBUTE_KEY: &str = "consensus_height"; | ||
|
||
pub fn try_from_tx(event: &tendermint::abci::Event) -> Option<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.
This PR touches the translation from tendermint::abci::Event
to IBCEvent
(here and in other modules) but didn't have to. This was done while generalizing the translation to not be specific to tendermint::abci::Event
. This turned out to not be necessary after removing the ibc::handler::Event
. Nevertheless, in the process of generalising this, some improvements were made and we may want to keep them.
@@ -87,7 +88,13 @@ pub(crate) fn process( | |||
connection_end: new_connection_end, | |||
}; | |||
|
|||
output.emit(ConnOpenTry(result.clone())); | |||
// TODO: move connection id decision (`next_connection_id` method) in ClientReader |
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.
This TODO was moved from modules/src/ics03_connection/handler.rs
ics02_client
and foreign_client
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.
Looking good, left a few ideas.
res.client_state.latest_height(), | ||
res.consensus_state, | ||
)?; | ||
Ok(vec![ClientEvent::ClientCreated(client_id)]) |
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.
This looks better & cleaner!
Just to note that In future (or in other handlers) we may find it useful to create events both from the process
method of the handlers, as well as from the ClientKeeper. Then we would collect both of these vectors of events into a single one in ICS26::dispatch
. But that's not for now..
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct Event { |
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.
If you wish, I suggest once we're done with this we do a follow-up PR to update ADR003 events section, making it clear that handlers are using the strongly-typed events, not these loosely-typed events.
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.
Can we open an issue for that? It's probably better if someone familiar with that ADR does the change.
Kind::ClientIdentifierConstructor(msg.client_state().client_type(), id_counter).context(e) | ||
})?; | ||
|
||
output.log("success: generated new client identifier"); |
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.
Just a heads-up: It may be a prerequisite for doing the MBT work that we use a more principled approach to emit these log lines. So maybe have a centralized place in the modules where we enumerate all the kinds of log lines; these could also be loosely coupled with IBCEvent
s (since they appear in tandem).
Thanks for the review @adizere. I've addressed your suggestions. |
…ms#535) * ClientId constructor; re-enabled ClientCreate tests * Improved ics18; Fixed cfg cargo annotation. * Prep for fixing ForeignClient tests. * Enable tests in the foreign_client module * Reuse Height parsing * More idiomatic methods in ibc::mock::context::MockContext * Improve assert in build_create_client_and_send * Remove ibc::handler::Event * Fix extract_connection_id * Check IBCEvent produced in create_client * Check IBCEvent produced in test_tm_create_client_ok * update CHANGELOG * relayer: improve tests in foreign_client Co-authored-by: Vitor Enes <[email protected]>
Closes: #469
This PR re-enables the tests in the
ics02_client
andforeign_client
modules.The
ibc::handler::Event
type was removed. Handlers now produceIBCEvent
s.For contributor use:
docs/
) and code comments.Files changed
in the Github PR explorer.