Skip to content

feat(serialization): add Exponential-Continuation Varint implementation#1405

Merged
jansegre merged 1 commit intomasterfrom
feat/ecv-serialization
Sep 24, 2025
Merged

feat(serialization): add Exponential-Continuation Varint implementation#1405
jansegre merged 1 commit intomasterfrom
feat/ecv-serialization

Conversation

@jansegre
Copy link
Member

Motivation

We've previously discussed about using an encoding that takes less bits for larger numbers. This PR introduces such encoding, that is based on LEB128 but uses a continuation bit every time the size doubles, not every time it increases by one byte, so it was named Exponential Continuation Varint (ECV) for the lack of a better name.

This PR purely introduces the new encoding and does not use it anywhere, so it is not a breaking change.

Acceptance Criteria

  • Add ECV serialization encoder/decoder
  • Add tests for both LEB128 and ECV

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@jansegre jansegre requested review from glevco and msbrogli September 11, 2025 15:33
@jansegre jansegre self-assigned this Sep 11, 2025
@jansegre jansegre moved this from Todo to In Progress (Done) in Hathor Network Sep 11, 2025
@github-actions
Copy link

github-actions bot commented Sep 11, 2025

🐰 Bencher Report

Branchfeat/ecv-serialization
Testbedubuntu-22.04
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
minutes (m)
(Result Δ%)
Lower Boundary
minutes (m)
(Limit %)
Upper Boundary
minutes (m)
(Limit %)
sync-v2 (up to 20000 blocks)📈 view plot
🚷 view threshold
1.95 m
(+14.50%)Baseline: 1.70 m
1.53 m
(78.60%)
2.04 m
(95.42%)
🐰 View full continuous benchmarking report in Bencher

@codecov
Copy link

codecov bot commented Sep 11, 2025

Codecov Report

❌ Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.80%. Comparing base (a9a0fb7) to head (c6eddd3).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
hathor/serialization/encoding/ecv.py 94.87% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1405      +/-   ##
==========================================
+ Coverage   85.76%   85.80%   +0.03%     
==========================================
  Files         430      431       +1     
  Lines       33054    33093      +39     
  Branches     5172     5179       +7     
==========================================
+ Hits        28349    28394      +45     
+ Misses       3667     3663       -4     
+ Partials     1038     1036       -2     

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

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

@jansegre jansegre force-pushed the feat/ecv-serialization branch from e7bac00 to c6eddd3 Compare September 24, 2025 17:09
@jansegre jansegre merged commit 7318c45 into master Sep 24, 2025
8 checks passed
@jansegre jansegre deleted the feat/ecv-serialization branch September 24, 2025 18:00
@github-project-automation github-project-automation bot moved this from In Progress (Done) to Waiting to be deployed in Hathor Network Sep 24, 2025
@jansegre jansegre mentioned this pull request Sep 26, 2025
2 tasks
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Sep 26, 2025
@jansegre jansegre mentioned this pull request Oct 16, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants