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

fix: Consider all fields in is_empty and count_bytes implementation for BatchPayload #3471

Merged
merged 6 commits into from
Jan 16, 2025

Conversation

eichhorl
Copy link
Contributor

@eichhorl eichhorl commented Jan 16, 2025

This PR fixes two minor BatchPayload bugs:

  1. The query stats payload was not considered when determining if a batch payload is empty.
  2. The canister ID of CanisterHttpResponses was not considered in count_bytes.

To prevent similar problems in the future, this PR changes implementations of is_empty and count_bytes to deconstruct self first, such that forgotten fields can be more easily spotted.

@github-actions github-actions bot added the fix label Jan 16, 2025
@eichhorl eichhorl marked this pull request as ready for review January 16, 2025 12:20
@eichhorl eichhorl requested review from a team as code owners January 16, 2025 12:20
@eichhorl eichhorl requested a review from Sawchord January 16, 2025 12:21
Copy link
Contributor

@Sawchord Sawchord left a comment

Choose a reason for hiding this comment

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

Thats a very good idea 👍

Copy link
Contributor

@kpop-dfinity kpop-dfinity left a comment

Choose a reason for hiding this comment

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

Good catch 👍

rs/types/types/src/consensus/payload.rs Outdated Show resolved Hide resolved
rs/types/types/src/consensus/payload.rs Outdated Show resolved Hide resolved
rs/bitcoin/replica_types/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@berestovskyy berestovskyy left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@eichhorl eichhorl added this pull request to the merge queue Jan 16, 2025
Merged via the queue into master with commit 80c6776 Jan 16, 2025
26 checks passed
@eichhorl eichhorl deleted the eichhorl/fix-query-stats-is-empty branch January 16, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants