Skip to content

feat(nano): implement resources and events [part 12]#1289

Merged
jansegre merged 1 commit intomasterfrom
feat/nano/resources-and-events
Jun 18, 2025
Merged

feat(nano): implement resources and events [part 12]#1289
jansegre merged 1 commit intomasterfrom
feat/nano/resources-and-events

Conversation

@glevco
Copy link
Contributor

@glevco glevco commented Jun 3, 2025

Motivation

Continue with the nano merges, adding all resources and event handling.

Acceptance Criteria

  • Add nano resources.
  • Update event handling.

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

@glevco glevco self-assigned this Jun 3, 2025
@glevco glevco requested review from jansegre and msbrogli as code owners June 3, 2025 21:59
@glevco glevco moved this from Todo to In Progress (WIP) in Hathor Network Jun 3, 2025
@glevco glevco force-pushed the feat/nano/resources-and-events branch 3 times, most recently from 2377942 to dddde16 Compare June 3, 2025 22:15
@glevco glevco moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Jun 3, 2025
@glevco glevco force-pushed the feat/nano/runner branch from d24c55e to a1992c9 Compare June 3, 2025 22:30
@glevco glevco force-pushed the feat/nano/resources-and-events branch from dddde16 to e502727 Compare June 3, 2025 22:31
@glevco glevco force-pushed the feat/nano/runner branch from a1992c9 to 1d16e19 Compare June 3, 2025 22:32
@glevco glevco force-pushed the feat/nano/resources-and-events branch from e502727 to 010c4b9 Compare June 3, 2025 22:32
@codecov
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 44.03794% with 413 lines in your changes missing coverage. Please review.

Project coverage is 75.68%. Comparing base (8fcb384) to head (16253fa).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
hathor/nanocontracts/resources/nc_creation.py 37.39% 77 Missing ⚠️
hathor/nanocontracts/resources/blueprint.py 38.53% 67 Missing ⚠️
hathor/nanocontracts/resources/on_chain.py 37.50% 65 Missing ⚠️
hathor/nanocontracts/resources/history.py 30.68% 61 Missing ⚠️
hathor/dag_builder/vertex_exporter.py 16.17% 56 Missing and 1 partial ⚠️
hathor/nanocontracts/resources/builtin.py 53.22% 29 Missing ⚠️
...r/nanocontracts/resources/blueprint_source_code.py 41.86% 25 Missing ⚠️
hathor/nanocontracts/resources/state.py 72.41% 16 Missing ⚠️
hathor/manager.py 42.10% 11 Missing ⚠️
hathor/event/model/event_data.py 73.33% 4 Missing ⚠️
... and 1 more

❌ Your project status has failed because the head coverage (75.68%) is below the target coverage (82.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1289      +/-   ##
==========================================
- Coverage   76.42%   75.68%   -0.74%     
==========================================
  Files         417      426       +9     
  Lines       30724    31455     +731     
  Branches     4798     4873      +75     
==========================================
+ Hits        23480    23808     +328     
- Misses       6429     6835     +406     
+ Partials      815      812       -3     

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

@glevco glevco force-pushed the feat/nano/runner branch 2 times, most recently from b218b30 to fa7540e Compare June 11, 2025 20:39
@glevco glevco force-pushed the feat/nano/resources-and-events branch 2 times, most recently from 0880346 to 758f0c5 Compare June 11, 2025 20:40
@glevco glevco force-pushed the feat/nano/runner branch 3 times, most recently from ae60bb0 to fd019e7 Compare June 16, 2025 20:01
@glevco glevco moved this from In Progress (Done) to In Review (WIP) in Hathor Network Jun 16, 2025
@glevco glevco force-pushed the feat/nano/resources-and-events branch from 758f0c5 to fb7fa8f Compare June 16, 2025 20:40
jansegre
jansegre previously approved these changes Jun 17, 2025
@jansegre jansegre moved this from In Review (WIP) to In Review (Done) in Hathor Network Jun 17, 2025
@glevco glevco force-pushed the feat/nano/resources-and-events branch from fb7fa8f to fdfe8f2 Compare June 17, 2025 15:36
@glevco glevco changed the base branch from feat/nano/runner to master June 17, 2025 15:37
@glevco glevco dismissed jansegre’s stale review June 17, 2025 15:37

The base branch was changed.

@glevco glevco force-pushed the feat/nano/resources-and-events branch from fdfe8f2 to 18d0a50 Compare June 17, 2025 15:46
@github-actions
Copy link

github-actions bot commented Jun 17, 2025

🐰 Bencher Report

Branchfeat/nano/resources-and-events
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.59 m
(-2.26%)Baseline: 1.63 m
1.47 m
(92.08%)
1.79 m
(88.85%)
🐰 View full continuous benchmarking report in Bencher

Comment on lines +111 to +112
if not (is_nc_public_method(method) or is_nc_view_method(method)):
continue
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we add some info about the fallback method? At least a flag stating whether it's available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Postponed thread.

)
return response.json_dumpb()

def _get_nc_creation_item(self, nc_id: bytes) -> NCCreationItem | None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FIX: I think there's a bug when searching for a contract created by another contract, because this method assumes the nc_id is a tx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm changing this to a postponed thread. It's not critical because it only affects the search feature on the nc_creation explorer API.

Initially I thought it would be a simple fix on the resource itself, but that's not the case. The NC creation index only stores the tx's hash and timestamp, therefore it's not possible to use it to retrieve a tx via a contract id when that contract was created by another contract.

The fix is more involved and relates to other improvements in all explorer APIs. Those should be addressed in future PRs. A partial implementation (well, just a test) was started in fix/nano/nc_creation_by_another.

@glevco glevco force-pushed the feat/nano/resources-and-events branch from 18d0a50 to 4790263 Compare June 17, 2025 22:18
Co-authored-by: Marcelo Salhab Brogliato <msbrogli@gmail.com>
Co-authored-by: Jan Segre <jan@hathor.network>
@glevco glevco force-pushed the feat/nano/resources-and-events branch from 4790263 to 16253fa Compare June 17, 2025 23:30
@glevco
Copy link
Contributor Author

glevco commented Jun 17, 2025

LGTM ✅

@jansegre jansegre merged commit e1c63ed into master Jun 18, 2025
6 of 8 checks passed
@jansegre jansegre deleted the feat/nano/resources-and-events branch June 18, 2025 11:55
@github-project-automation github-project-automation bot moved this from In Review (Done) to Waiting to be deployed in Hathor Network Jun 18, 2025
@jansegre jansegre mentioned this pull request Jul 22, 2025
2 tasks
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Jul 22, 2025
@jansegre jansegre mentioned this pull request Aug 7, 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