Skip to content

fix(abci): Add serde default for Event::type#1416

Merged
romac merged 4 commits intocometbft:mainfrom
penso:add-dydx-fixtures
May 29, 2024
Merged

fix(abci): Add serde default for Event::type#1416
romac merged 4 commits intocometbft:mainfrom
penso:add-dydx-fixtures

Conversation

@penso
Copy link
Copy Markdown
Contributor

@penso penso commented Apr 27, 2024

Fixes #1415

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Added entry in .changelog/

/// Tendermint calls this the `type`, but we use `kind` to avoid confusion
/// with Rust types and follow Rust conventions.
#[serde(rename = "type")]
#[serde(rename = "type", default)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is an optimal solution, because it's recreating the data format by hand rather than deriving it from the source of truth (the proto messages). See #1415 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went for the shortest fix to an immediate issue. But anyone else, please feel free to fix it differently.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's go with this fix for now since we are already re-creating the data format by hand everywhere in tendermint-rs.

Maybe we can address this whole thing at once and move to ProtoJSON in a follow-up PR or in cometbft-rs.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

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

Project coverage is 59.5%. Comparing base (99ed0b9) to head (90ddb0a).
Report is 10 commits behind head on main.

❗ Current head 90ddb0a differs from pull request most recent head 775d001. Consider uploading reports for the commit 775d001 to get more accurate results

Files Patch % Lines
rpc/tests/dydx_fixtures.rs 97.2% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1416     +/-   ##
=======================================
- Coverage   60.1%   59.5%   -0.6%     
=======================================
  Files        271     272      +1     
  Lines      26221   26795    +574     
=======================================
+ Hits       15768   15963    +195     
- Misses     10453   10832    +379     

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

@romac romac changed the title Fix optional Event.type fix(abci): Add serde default for Event::type May 29, 2024
@romac romac merged commit ec37ad2 into cometbft:main May 29, 2024
@penso penso deleted the add-dydx-fixtures branch September 24, 2024 15:07
melekes added a commit to cometbft/cometbft-rs that referenced this pull request May 28, 2025
melekes added a commit to cometbft/cometbft-rs that referenced this pull request May 28, 2025
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.

Deserialization of abci::Event fails

4 participants