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 conversion from &IbcEvent to abci::Event #438

Merged
merged 6 commits into from
Mar 3, 2023

Conversation

DaviRain-Su
Copy link
Contributor

Closes: #416

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

@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

Patch coverage: 60.00% and project coverage change: -0.02 ⚠️

Comparison is base (61c33db) 71.52% compared to head (7b3b206) 71.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #438      +/-   ##
==========================================
- Coverage   71.52%   71.51%   -0.02%     
==========================================
  Files         125      125              
  Lines       15890    15897       +7     
==========================================
+ Hits        11365    11368       +3     
- Misses       4525     4529       +4     
Impacted Files Coverage Δ
...src/core/ics04_channel/events/packet_attributes.rs 10.82% <7.69%> (ø)
crates/ibc/src/events.rs 23.75% <20.00%> (-0.27%) ⬇️
crates/ibc/src/core/ics04_channel/events.rs 46.41% <45.94%> (-0.51%) ⬇️
crates/ibc/src/core/ics02_client/events.rs 74.74% <100.00%> (+0.70%) ⬆️
crates/ibc/src/core/ics03_connection/events.rs 73.30% <100.00%> (+0.09%) ⬆️
...rc/core/ics04_channel/events/channel_attributes.rs 41.55% <100.00%> (ø)

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.

crates/ibc/src/events.rs Outdated Show resolved Hide resolved
@plafer plafer added A: blocked Admin: blocked by another (internal/external) issue or PR and removed A: blocked Admin: blocked by another (internal/external) issue or PR labels Feb 16, 2023
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.

🙏

@@ -0,0 +1,2 @@
- Allow conversion from &IbcEvent to abci::Event
Copy link
Contributor

Choose a reason for hiding this comment

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

can we put this under breaking-changes instead?

@plafer plafer merged commit fd1b643 into cosmos:main Mar 3, 2023
@romac
Copy link
Member

romac commented Mar 3, 2023

Sorry I am just seeing this now which is a bit late.

Just wanted to note that it's a bit of an anti pattern to implement From on references, as it forces a clone on conversion even when the caller already has a owned value, ie. if one has a owned event, one has to take a reference to it before calling into and this will clone the data under the hood. In general in Rust it's good practice to make it clear whether or not a conversion or function will allocate or not, and let the caller allocate if necessary rather than hide allocations under "easy to use" API.

As such I would suggest reverting this PR.

@romac
Copy link
Member

romac commented Mar 3, 2023

For reference, here's what I mean, explained in code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=64d53eefc220d1a600089f08e3119ac6

plafer added a commit that referenced this pull request Mar 3, 2023
@DaviRain-Su DaviRain-Su deleted the fix-416 branch March 16, 2023 14:07
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
* impl Convert from &IbcEvent to abci::Event

* Create 416-conver-ref-ibc_event2abci_event.md

* change TryFrom IbcEvent by IbcEvent reference

* Update events.rs

* mvoe to breaking-changes fold
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
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.

Allow conversion from &IbcEvent to abci::Event
3 participants