Skip to content

Conversation

danlaine
Copy link
Collaborator

@danlaine danlaine commented Jun 18, 2025

Replaces custom serialize/deserialize implementation.

Open questions:

  1. Is it OK to assume the number of digests will always be < u16::MAX? Or should we keep the existing assumption that there are <= 255 digests?
  2. Do we want to have a max_len field in the read config? (Maybe moot if we limit number of digests to 255).

@danlaine danlaine marked this pull request as ready for review June 18, 2025 19:32
@danlaine danlaine requested a review from patrick-ogrady June 18, 2025 19:33
@danlaine danlaine self-assigned this Jun 18, 2025
@roberto-bayardo
Copy link
Collaborator

Re:

  1. Is it OK to assume the number of digests will always be < u16::MAX? Or should we keep the existing assumption that there are <= 255 digests?

Actually that comment around "<= 255 digests" is obsolete since we actually removed explicit encoding of the length of the digests vector.

@roberto-bayardo
Copy link
Collaborator

roberto-bayardo commented Jun 18, 2025

2. Do we want to have a max_len field in the read config? (Maybe moot if we limit number of digests to 255).

I am not too familiar with codec usage, but enforcing a reasonable limit on the # of digests sounds useful to me so someone doesn't try to spam us with massive proofs.

OK with me if this requires an explicit vector length encoding to do through standard means.

@danlaine danlaine requested a review from BrendanChou June 20, 2025 14:31
}
}

impl<H: CHasher> EncodeSize for Proof<H> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not really feedback on this specific PR, but shouldn't we be able to write a macro that implements these "default" types of code serialize/deserialze implementations? This all seems very boilerplate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've advocated for manually encoding to avoid silent changes from struct modification fwiw

@patrick-ogrady patrick-ogrady merged commit b803146 into main Jun 25, 2025
18 checks passed
@patrick-ogrady patrick-ogrady deleted the danlaine/serialize-mmr branch June 25, 2025 17:46
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 95.23810% with 2 lines in your changes missing coverage. Please review.

Project coverage is 91.03%. Comparing base (4578244) to head (3ee4e2d).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
storage/src/mmr/verification.rs 95.23% 2 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1127      +/-   ##
==========================================
- Coverage   91.04%   91.03%   -0.01%     
==========================================
  Files         215      215              
  Lines       57480    57471       -9     
==========================================
- Hits        52330    52321       -9     
  Misses       5150     5150              
Files with missing lines Coverage Δ
storage/src/mmr/verification.rs 95.40% <95.23%> (-0.07%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4578244...3ee4e2d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

4 participants