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

upgrade_client: Make TYPE_URL public #588

Closed
wants to merge 1 commit into from
Closed

upgrade_client: Make TYPE_URL public #588

wants to merge 1 commit into from

Conversation

kevinji
Copy link
Contributor

@kevinji kevinji commented Mar 31, 2023

Closes: #XXX

Description

This makes upgrade_client::TYPE_URL public to match the visibility of all other TYPE_URL constants, and makes it easier to access outside of the crate.


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 Mar 31, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (20d682f) 72.85% compared to head (45f158b) 72.85%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #588   +/-   ##
=======================================
  Coverage   72.85%   72.85%           
=======================================
  Files         126      126           
  Lines       15705    15705           
=======================================
  Hits        11442    11442           
  Misses       4263     4263           
Impacted Files Coverage Δ
...s/ibc/src/core/ics02_client/msgs/upgrade_client.rs 84.53% <ø> (ø)

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Farhad-Shabani
Copy link
Member

Thanks for pointing out this discrepancy.

Considering the existing type_url interface for each message type, it sounds like we should take the opposite approach and make others pub(crate) to improve encapsulation and prevents confusion for callers, as some use type_url() and others might import TYPE_URL const.

Based on a previous review, it appears that TYPE_URL is typically used for converting a domain message to Any, which accepts a String type. For this usage as well, calling the type_url() method is better.

@plafer
Copy link
Contributor

plafer commented Mar 31, 2023

@kevinji do you have a use case for needing the TYPE_URL? As Farhad mentioned, we were instead going to move in the direction of making all the other TYPE_URL private.

@kevinji
Copy link
Contributor Author

kevinji commented Mar 31, 2023

Nope I didn't know that tx_msg::Msg existed, so closing in favor of using that interface.

@kevinji kevinji closed this Mar 31, 2023
@kevinji kevinji deleted the upgrade-client-type-url-public branch March 31, 2023 21:01
@Farhad-Shabani
Copy link
Member

Nope I didn't know that tx_msg::Msg existed, so closing in favor of using that interface.

👍🏻
by the way, I opened #597 to deal with it at the appropriate time

@plafer
Copy link
Contributor

plafer commented Apr 5, 2023

Nope I didn't know that tx_msg::Msg existed, so closing in favor of using that interface.

Could you link to an example snippet where you need the TYPE_URL or tx_msg::Msg::type_url? I was hoping to get rid of tx_msg::Msg too.

@kevinji
Copy link
Contributor Author

kevinji commented Apr 6, 2023

It's essentially the same use case as #586 as I'm currently directly using MsgEnvelope in one of my types:

                match msg_envelope {
                    // ICS2 messages
                    MsgEnvelope::Client(ClientMsg::CreateClient(domain_msg)) => domain_msg.to_any(),
                    MsgEnvelope::Client(ClientMsg::UpdateClient(domain_msg)) => domain_msg.to_any(),
                    MsgEnvelope::Client(ClientMsg::UpgradeClient(domain_msg)) => {
                        domain_msg.to_any()
                    }
                    // ...
                }

I do plan to switch these to be backed by the raw types instead, per the discussions we've had, but for now I'm using tx_msg::Msg to help with serialization.

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.

3 participants