Skip to content

hathorlib blueprint move 2#1606

Open
r4mmer wants to merge 7 commits intomasterfrom
feat/hathorlib-blueprint-move-2
Open

hathorlib blueprint move 2#1606
r4mmer wants to merge 7 commits intomasterfrom
feat/hathorlib-blueprint-move-2

Conversation

@r4mmer
Copy link
Member

@r4mmer r4mmer commented Feb 26, 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 second PR in this sequence.

Acceptance Criteria

  • Move nanocontracts exception hierarchy to hathorlib
  • Move core types, decorators, and address utilities to hathorlib

Extra context


Important note about HathorError: After analysis, except HathorError appears in 5 places in hathor-core (vertex_handler, api_catch_exceptions, p2p sync clients, hello state). However, NCFail exceptions NEVER reach these catch blocks because:

  • block_executor.py:391 catches except NCFail and wraps it in NCExecutionFailure - NC exceptions never escape the block executor.
  • nano_header_verifier.py:177,196 catches NCFail and converts to NCTxValidationError(TxValidationError, NCFail), which inherits from HathorError through TxValidationError. So by the time errors reach vertex_handler.py:214, they ARE HathorError subclasses.
  • NC REST resources catch their specific NC exceptions explicitly (e.g., except BlueprintDoesNotExist), not through HathorError.

Therefore, the simple re-export (where hathorlib's NCFail inherits from Exception only) is safe. The re-export strategy works without needing NCFail to also inherit from HathorError.


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

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

🐰 Bencher Report

Branchfeat/hathorlib-blueprint-move-2
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.60 m
(-6.61%)Baseline: 1.71 m
1.54 m
(96.37%)
2.05 m
(77.82%)
🐰 View full continuous benchmarking report in Bencher

@r4mmer r4mmer moved this from Todo to In Progress (WIP) in Hathor Network Feb 26, 2026
@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.54%. Comparing base (82ac020) to head (a2a1c31).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1606      +/-   ##
==========================================
- Coverage   85.65%   85.54%   -0.11%     
==========================================
  Files         439      439              
  Lines       33515    33171     -344     
  Branches     5264     5218      -46     
==========================================
- Hits        28707    28377     -330     
+ Misses       3797     3783      -14     
  Partials     1011     1011              
Flag Coverage Δ
test-lib 85.54% <100.00%> (-0.11%) ⬇️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress (WIP)

Development

Successfully merging this pull request may close these issues.

1 participant