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

imp(types): refactor Default implementations with concrete names #1099

Merged
merged 40 commits into from
Mar 12, 2024

Conversation

tuantran1702
Copy link
Contributor

@tuantran1702 tuantran1702 commented Feb 24, 2024

Closes: #1074
Closes: #552
Closes: #373

Description


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).

Copy link

codecov bot commented Feb 24, 2024

Codecov Report

Attention: Patch coverage is 83.66013% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 66.57%. Comparing base (d0511b7) to head (46910f3).

Files Patch % Lines
ibc-core/ics03-connection/types/src/connection.rs 8.33% 11 Missing ⚠️
...s/ics721-nft-transfer/src/handler/send_transfer.rs 0.00% 5 Missing ⚠️
ibc-apps/ics721-nft-transfer/src/module.rs 0.00% 3 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/memo.rs 25.00% 3 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/class.rs 83.33% 1 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/data.rs 66.66% 1 Missing ⚠️
ibc-testkit/src/testapp/ibc/clients/mock/header.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1099      +/-   ##
==========================================
+ Coverage   66.54%   66.57%   +0.03%     
==========================================
  Files         209      209              
  Lines       20617    20636      +19     
==========================================
+ Hits        13719    13738      +19     
  Misses       6898     6898              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tuantran1702 tuantran1702 changed the title imp(types): Use concrete channel order enum imp(types): refactor Default implementations with concrete names Feb 25, 2024
@tuantran1702
Copy link
Contributor Author

Hi @rnbguy, I am working on this issue and want to ask if I am heading in the right direction or not. At what extent should I refactor/remove these Default implementation, for instance a quite big struct like ConnectionEnd default implementation, I guess we should keep this Default instead, but want to hear your opinion on this.

@rnbguy
Copy link
Collaborator

rnbguy commented Feb 26, 2024

That Default implementation shouldn't exist. Default for client_id and counterparty doesn't make sense. The implementation should use ConnectionEnd::new to initialize a new object.

@tuantran1702
Copy link
Contributor Author

@rnbguy Can you take a look at why the no_std substrate check is falling, I don't have much experience in that. Thanks!

@rnbguy
Copy link
Collaborator

rnbguy commented Feb 26, 2024

no_std tests fail because they use the latest nightly compiler that accepted RFC 3373. This should be resolved in displaydoc.

Keep working on your PR. We will take care of this in a separate issue.

@rnbguy
Copy link
Collaborator

rnbguy commented Feb 29, 2024

you can now merge main onto your branch for successful CI jobs 🙂

@tuantran1702 tuantran1702 marked this pull request as ready for review March 9, 2024 18:27
Copy link
Collaborator

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

🔥 Thanks so much for taking care of this PR. ✨

I added some suggestions. 🙏

ibc-core/ics03-connection/types/src/version.rs Outdated Show resolved Hide resolved
ibc-core/ics24-host/types/src/path.rs Outdated Show resolved Hide resolved
ibc-apps/ics721-nft-transfer/src/module.rs Outdated Show resolved Hide resolved
ibc-testkit/src/fixtures/core/channel/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@Farhad-Shabani Farhad-Shabani left a comment

Choose a reason for hiding this comment

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

Nice improvements through this PR. Thanks @tropicaldog!
I did request a couple more tweaks. Hope that's not too much of a hassle for you. Thanks!

ibc-core/ics03-connection/types/src/version.rs Outdated Show resolved Hide resolved
ibc-core/ics03-connection/types/src/version.rs Outdated Show resolved Hide resolved
ibc-core/ics24-host/types/src/identifiers/client_id.rs Outdated Show resolved Hide resolved
ibc-core/ics24-host/types/src/identifiers/connection_id.rs Outdated Show resolved Hide resolved
ibc-core/ics24-host/types/src/path.rs Outdated Show resolved Hide resolved
@Farhad-Shabani Farhad-Shabani added this to the 0.51.0 milestone Mar 12, 2024
Copy link
Collaborator

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Thanks @tropicaldog ! I gave my last PR review and then we merge 🎉

I would have resolved this by myself, but I don't have permission on your branch.

ibc-core/ics03-connection/types/src/version.rs Outdated Show resolved Hide resolved
ibc-testkit/tests/core/ics04_channel/recv_packet.rs Outdated Show resolved Hide resolved
ibc-testkit/src/testapp/ibc/core/types.rs Outdated Show resolved Hide resolved
ibc-testkit/src/fixtures/core/connection/mod.rs Outdated Show resolved Hide resolved
ibc-testkit/src/fixtures/core/connection/conn_open_try.rs Outdated Show resolved Hide resolved
ibc-testkit/src/fixtures/core/connection/conn_open_init.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Great work ! ✨

Thanks for the contribution. 🙏

@rnbguy rnbguy enabled auto-merge (squash) March 12, 2024 17:50
Copy link
Member

@Farhad-Shabani Farhad-Shabani left a comment

Choose a reason for hiding this comment

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

🎉

@rnbguy rnbguy merged commit 04520a8 into cosmos:main Mar 12, 2024
16 checks passed
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
* use concrete channel order enum

* refactor(ics04): remove Version::default()

* refactor(ics04): remove TimeoutHeight::default()

* refactor: remove channelId::default()

* fix: Version::default() to Version::empty()

* remove derive default from Timestamp

* refactor default builder

* remove Sequence::default()

* remove Memo::default()

* refactor: add ChannelId::zero()

* add From<&str> implmentation

* refactor(ibccore): remove ClientId::default()

* refactor(ibccore): remove version::Default()

* refactor(ibccore): remove ConnectionEnd::default()

* refactor(ibc-apps): remove TracePath::default()

* refactor(ibc-core): remove ProofSpecs::default()

* fix(ibc-app): remove upgrade path default

* remove trust threshold default

* refactor(ibc-testkit): remove Default from client_state initialization

* refactor(ibc-testkit): remove Default() of ClientId, ConnectionId,...

* chore: add unclog

* refactor: add Connection::zero()

* use into() instead of ::from()

* refactor: add Version::compatibles()

* refactor(ics24-host): make 07-tendermint-0 a constant in tests

* chore: remove commented out impl Default

* add dummy ClientId

* refactor(ics24-host): remove From<&str> to avoid panic on host

* remove get_compatible_versions

* fix syntax error when import Version

* chore: run cargo fmt

* revert markdown format

* various refactor

* chore: update unclog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
3 participants