Skip to content

feat: hathorlib blueprint move 5#1620

Merged
r4mmer merged 12 commits intomasterfrom
feat/hathorlib-blueprint-move-5
Mar 20, 2026
Merged

feat: hathorlib blueprint move 5#1620
r4mmer merged 12 commits intomasterfrom
feat/hathorlib-blueprint-move-5

Conversation

@r4mmer
Copy link
Copy Markdown
Member

@r4mmer r4mmer commented Mar 16, 2026

Motivation

To be able to implement the blueprint simulator on hathorlib there is a significant amount of code that needs to be moved from hathor/ to hathorlib/.
Since moving this amount of code can cause instabilities we are breaking down these changes into more manageable and reviewable PRs.

This is the fifth PR in this sequence.

Acceptance Criteria

Move Blueprint core, context, method parsing, and accessors to hathorlib.

Changes of note:

  • hathorlib/nanocontracts/rng.py : NanoRNG changed to use plain bytes instead of Hash (from hathor/difficulty.py)
  • hathorlib/nanocontracts/utils.py : Moved the utils is_nc_public_method, is_nc_view_method, is_nc_fallback_method
  • hathor/nanocontracts/context.py : Context.create_from_vertex classmethod was moved to separate utility create_context_from_vertex
  • hathor/nanocontracts/vertex_data.py : create_from_* classmethods were converted into standalone factory methods (e.g. create_vertex_data_from_vertex, create_block_data_from_block, etc.)
  • hathor/transaction/base_transaction.py : TxVersion was unified on hathorlib so it can be used in nanocontracts dataclasses.
    • The deprecated nano contract variant will be removed.

Changes of note

  • Include here all things that this PR should solve

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

@r4mmer r4mmer self-assigned this Mar 16, 2026
@r4mmer r4mmer moved this from Todo to In Progress (Done) in Hathor Network Mar 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 16, 2026

🐰 Bencher Report

Branchfeat/hathorlib-blueprint-move-5
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.61 m
(-5.48%)Baseline: 1.71 m
1.54 m
(95.21%)
2.05 m
(78.77%)
🐰 View full continuous benchmarking report in Bencher

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 93.93939% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.15%. Comparing base (2d949c7) to head (03c7f2d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hathor/transaction/base_transaction.py 81.25% 1 Missing and 2 partials ⚠️
hathor/nanocontracts/context.py 91.66% 2 Missing ⚠️
hathor/nanocontracts/vertex_data.py 96.96% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1620      +/-   ##
==========================================
- Coverage   85.42%   85.15%   -0.27%     
==========================================
  Files         464      464              
  Lines       31203    30439     -764     
  Branches     4735     4612     -123     
==========================================
- Hits        26654    25920     -734     
+ Misses       3639     3624      -15     
+ Partials      910      895      -15     
Flag Coverage Δ
test-lib 85.15% <93.93%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

msbrogli
msbrogli previously approved these changes Mar 17, 2026
jansegre
jansegre previously approved these changes Mar 17, 2026
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 17, 2026
@r4mmer r4mmer moved this from In Review (WIP) to In Review (Done) in Hathor Network Mar 18, 2026
@r4mmer r4mmer dismissed stale reviews from jansegre and msbrogli via a72ce64 March 19, 2026 16:36
@r4mmer r4mmer moved this from In Review (Done) to In Progress (Done) in Hathor Network Mar 19, 2026
@r4mmer r4mmer requested review from jansegre and msbrogli March 19, 2026 17:06
jansegre
jansegre previously approved these changes Mar 19, 2026
msbrogli
msbrogli previously approved these changes Mar 20, 2026
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 20, 2026
@r4mmer r4mmer dismissed stale reviews from msbrogli and jansegre via 03c7f2d March 20, 2026 16:35
@r4mmer r4mmer moved this from In Review (WIP) to In Progress (Done) in Hathor Network Mar 20, 2026
@r4mmer r4mmer requested a review from jansegre March 20, 2026 17:09
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 20, 2026
@r4mmer r4mmer merged commit 5b9ebbe into master Mar 20, 2026
57 of 60 checks passed
@r4mmer r4mmer deleted the feat/hathorlib-blueprint-move-5 branch March 20, 2026 20:05
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Mar 20, 2026
r4mmer added a commit that referenced this pull request Mar 27, 2026
Mark PR 6 as IMPLEMENTED (merged as #1620).
Mark PRs 7 and 8 as IMPLEMENTED (merged together in this branch).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting to be deployed

Development

Successfully merging this pull request may close these issues.

3 participants