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 a docstring and rename the "validate_self_client" argument for better #436

Merged
merged 7 commits into from
Feb 17, 2023

Conversation

Farhad-Shabani
Copy link
Member

Closes: #434


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Base: 62.21% // Head: 61.12% // Decreases project coverage by -1.09% ⚠️

Coverage data is based on head (1cf98a1) compared to base (0f3e03f).
Patch coverage: 10.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #436      +/-   ##
==========================================
- Coverage   62.21%   61.12%   -1.09%     
==========================================
  Files         131      131              
  Lines       17789    18114     +325     
==========================================
+ Hits        11068    11073       +5     
- Misses       6721     7041     +320     
Impacted Files Coverage Δ
...s/ibc/src/clients/ics07_tendermint/client_state.rs 45.42% <0.00%> (-0.22%) ⬇️
crates/ibc/src/clients/ics07_tendermint/mod.rs 100.00% <ø> (ø)
crates/ibc/src/core/context.rs 80.39% <ø> (ø)
crates/ibc/src/core/ics03_connection/context.rs 0.00% <ø> (-45.46%) ⬇️
crates/ibc/src/hosts/tendermint.rs 0.00% <0.00%> (ø)
crates/ibc/src/lib.rs 100.00% <ø> (ø)
crates/ibc/src/mock/context.rs 53.21% <50.00%> (-1.42%) ⬇️
crates/ibc/src/core/ics03_connection/handler.rs 46.66% <0.00%> (-40.00%) ⬇️
...rc/core/ics03_connection/handler/conn_open_init.rs 65.58% <0.00%> (-31.51%) ⬇️
... and 17 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Farhad-Shabani Farhad-Shabani self-assigned this Feb 15, 2023
@Farhad-Shabani Farhad-Shabani marked this pull request as ready for review February 15, 2023 19:54
Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great initiative

crates/ibc/src/core/context.rs Outdated Show resolved Hide resolved
Comment on lines +302 to +303
/// Additionally, implementations specific to individual chains can be found
/// in the [hosts](crate::hosts) module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@@ -0,0 +1 @@
pub mod tendermint_helper;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub mod tendermint_helper;
pub mod tendermint;

Since we're in a "hosts" module, I would find just tendermint sufficient.

Perhaps we can add a module docstring explaining that this module contains items (helpers? utils?) that hosts can use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let counterparty_client_state = TmClientState::try_from(counterparty_client_state)
.map_err(|_| ConnectionError::InvalidClientState {
reason: "client must be a tendermint client".to_string(),
pub trait ValidateSelfTendermintClientContext {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are in the tendermint_helper module, I think we should remove Tendermint from the name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// in the [hosts](crate::hosts) module.
fn validate_self_client(
&self,
host_client_state_on_counterparty: Any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
host_client_state_on_counterparty: Any,
client_state_of_host_on_counterparty: Any,

This is closer to the convention we use in the rest of the codebase

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Farhad-Shabani and others added 2 commits February 17, 2023 07:57
Co-authored-by: Philippe Laferrière <plafer@protonmail.com>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
@Farhad-Shabani
Copy link
Member Author

Thank you so much. Got better now 🙏

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@plafer plafer merged commit ba0404e into main Feb 17, 2023
@plafer plafer deleted the farhad/validate-self-client-doc branch February 17, 2023 18:42
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
…tter (#436)

* Add docstring and rename the validate_self_client argument

* Rename to host_client_state_on_counterparty

* Fix mock arg

* Rename ValidateSelfClientContext trait

* Reword validate_self_client docstring

Co-authored-by: Philippe Laferrière <plafer@protonmail.com>
Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>

* Apply comments

* Rename validate_self_tendermint_client arg

---------

Signed-off-by: Farhad Shabani <Farhad.Shabani@gmail.com>
Co-authored-by: Philippe Laferrière <plafer@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve code clarity by adding docs and renaming params around "validate_self_client" method
2 participants