Skip to content

feat(nano): Improve Nano History HTTP API#1486

Merged
jansegre merged 1 commit intomasterfrom
feat/nano/history-api-improvements
Nov 26, 2025
Merged

feat(nano): Improve Nano History HTTP API#1486
jansegre merged 1 commit intomasterfrom
feat/nano/history-api-improvements

Conversation

@msbrogli
Copy link
Member

@msbrogli msbrogli commented Nov 11, 2025

Motivation

These changes are commonly used by dApp developers.

Acceptance Criteria

  1. Add TransactionMetadata.nc_events: list[tuple[bytes, bytes]].
  2. Add include_nc_logs: bool and include_nc_events: bool to the Nano History API.
  3. Add include_nc_logs: bool and include_nc_events: bool to the Transaction API.
  4. Add nc_args_decoded to the response in Nano History API.
  5. Add nc_args_decoded to the response in Transaction API.
  6. Introduce VertexHelper with method to_json(), .to_json_extended(), and decode_nc_args().

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

@msbrogli msbrogli requested a review from jansegre as a code owner November 11, 2025 21:07

# Store events in transaction metadata
if events_list:
tx_meta.nc_events = [(event.nc_id, event.data) for event in events_list]
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we add a limit to the number of stored events?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be stored in metadata since it's completely useless for most full nodes, we could either store it in files just like the nc logs, or for quicker solution, just ignore events and require blueprint devs to write logs when they write events — that is, events would not be available though the APIs, only logs

Copy link
Contributor

Choose a reason for hiding this comment

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

We can refactor this later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a limit to the number of stored events?

This is also not problematic while OCB is restricted, so we should review for unreasonably large event generation. We can also improve it after removing it from metadata.

@msbrogli msbrogli force-pushed the feat/nano/history-api-improvements branch from 9a9161b to 5d47cb3 Compare November 11, 2025 21:13
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

🐰 Bencher Report

Branchfeat/nano/history-api-improvements
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.68 m
(-3.19%)Baseline: 1.73 m
1.56 m
(92.96%)
2.08 m
(80.68%)
🐰 View full continuous benchmarking report in Bencher

@msbrogli msbrogli force-pushed the feat/nano/history-api-improvements branch 5 times, most recently from e45f9a5 to b1562d0 Compare November 11, 2025 22:15
@msbrogli msbrogli self-assigned this Nov 11, 2025
@msbrogli msbrogli moved this from Todo to In Progress (Done) in Hathor Network Nov 11, 2025
@msbrogli msbrogli force-pushed the feat/nano/history-api-improvements branch 3 times, most recently from c16bfee to 2ca0ba1 Compare November 11, 2025 22:32
@msbrogli msbrogli changed the base branch from master to refactor/large-module-split November 11, 2025 22:32
@jansegre jansegre force-pushed the refactor/large-module-split branch from 2722923 to c2c02a9 Compare November 11, 2025 23:25
@jansegre jansegre deleted the branch master November 12, 2025 19:04
@jansegre jansegre closed this Nov 12, 2025
@github-project-automation github-project-automation bot moved this from In Progress (Done) to Waiting to be deployed in Hathor Network Nov 12, 2025
@jansegre jansegre reopened this Nov 12, 2025
@jansegre jansegre changed the base branch from refactor/large-module-split to master November 12, 2025 19:10
@jansegre jansegre moved this from Waiting to be deployed to In Progress (WIP) in Hathor Network Nov 12, 2025
@msbrogli msbrogli moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Nov 12, 2025
@msbrogli msbrogli force-pushed the feat/nano/history-api-improvements branch 2 times, most recently from e1ace41 to 6c2b8d7 Compare November 20, 2025 16:58
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 77.57009% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.12%. Comparing base (9f37644) to head (e3fcf65).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
hathor/transaction/json_serializer.py 67.69% 15 Missing and 6 partials ⚠️
hathor/transaction/resources/transaction.py 80.00% 0 Missing and 2 partials ⚠️
hathor/builder/builder.py 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1486      +/-   ##
==========================================
+ Coverage   86.10%   86.12%   +0.02%     
==========================================
  Files         439      440       +1     
  Lines       33891    33993     +102     
  Branches     5296     5315      +19     
==========================================
+ Hits        29183    29278      +95     
+ Misses       3687     3685       -2     
- Partials     1021     1030       +9     

☔ 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 previously approved these changes Nov 20, 2025
@msbrogli msbrogli force-pushed the feat/nano/history-api-improvements branch 2 times, most recently from 1f41408 to 02145cf Compare November 21, 2025 05:59
glevco
glevco previously approved these changes Nov 25, 2025
jansegre
jansegre previously approved these changes Nov 25, 2025
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Nov 25, 2025
@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Nov 25, 2025
@glevco glevco dismissed stale reviews from jansegre and themself via 62f1052 November 25, 2025 21:31
@glevco glevco force-pushed the feat/nano/history-api-improvements branch from 62f1052 to 7a4e722 Compare November 25, 2025 21:31
glevco
glevco previously approved these changes Nov 25, 2025
@github-project-automation github-project-automation bot moved this from In Review (Done) to In Review (WIP) in Hathor Network Nov 25, 2025
@glevco glevco self-assigned this Nov 26, 2025
@jansegre jansegre moved this from In Review (WIP) to In Review (Done) in Hathor Network Nov 26, 2025
@glevco glevco force-pushed the feat/nano/history-api-improvements branch from 7a4e722 to 1eca2c5 Compare November 26, 2025 20:40
jansegre
jansegre previously approved these changes Nov 26, 2025
@github-project-automation github-project-automation bot moved this from In Review (Done) to In Review (WIP) in Hathor Network Nov 26, 2025
@glevco glevco dismissed stale reviews from jansegre and themself via e3fcf65 November 26, 2025 20:53
@glevco glevco force-pushed the feat/nano/history-api-improvements branch from 1eca2c5 to e3fcf65 Compare November 26, 2025 20:53
@jansegre jansegre merged commit 6ca802e into master Nov 26, 2025
7 of 8 checks passed
@jansegre jansegre deleted the feat/nano/history-api-improvements branch November 26, 2025 21:42
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Nov 26, 2025
This was referenced Dec 2, 2025
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Dec 4, 2025
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.

3 participants