Skip to content

feat(nano): validate types across contracts#1334

Merged
glevco merged 4 commits intomasterfrom
feat/nano/types-across-contracts
Aug 6, 2025
Merged

feat(nano): validate types across contracts#1334
glevco merged 4 commits intomasterfrom
feat/nano/types-across-contracts

Conversation

@glevco
Copy link
Contributor

@glevco glevco commented Jul 23, 2025

Motivation

This PR adds protections for args and return types in calls across contracts. It resolves https://github.com/HathorNetwork/nano-hathor-core/issues/228, read its description for more details.

Acceptance Criteria

  • Refactor Runner to add validation of a method's args and return types when making calls across contracts.
  • Refactor method.py:
    • Add support for serializing both args and kwargs in Method, which is necessary for validating calls across contracts.
    • Implement ReturnOnly to support validating the fallback method.
    • Unify exception handling.
  • Remove kwargs from CallRecord and NCCallBeginEntry since they're now merged with 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

@glevco glevco self-assigned this Jul 23, 2025
@glevco glevco requested review from jansegre and msbrogli as code owners July 23, 2025 02:36
@github-actions
Copy link

github-actions bot commented Jul 23, 2025

🐰 Bencher Report

Branchfeat/nano/types-across-contracts
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
(+2.31%)Baseline: 1.64 m
1.48 m
(87.96%)
1.80 m
(93.01%)
🐰 View full continuous benchmarking report in Bencher

@glevco glevco force-pushed the feat/nano/types-across-contracts branch 4 times, most recently from 6cc593b to 1ef8cb4 Compare July 23, 2025 03:13
@glevco glevco moved this from Todo to In Progress (Done) in Hathor Network Jul 23, 2025
@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

❌ Patch coverage is 80.20833% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.68%. Comparing base (13b193d) to head (18e90a1).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hathor/nanocontracts/method.py 80.64% 7 Missing and 5 partials ⚠️
hathor/nanocontracts/runner/runner.py 77.41% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1334   +/-   ##
=======================================
  Coverage   85.67%   85.68%           
=======================================
  Files         425      425           
  Lines       32164    32217   +53     
  Branches     5002     5016   +14     
=======================================
+ Hits        27557    27604   +47     
+ Misses       3605     3604    -1     
- Partials     1002     1009    +7     

☔ 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 moved this from In Progress (Done) to In Review (WIP) in Hathor Network Jul 24, 2025
@glevco glevco force-pushed the feat/nano/types-across-contracts branch from 1ef8cb4 to 74f5f49 Compare July 25, 2025 19:37
jansegre
jansegre previously approved these changes Jul 28, 2025
jansegre
jansegre previously approved these changes Jul 28, 2025
@glevco glevco force-pushed the feat/nano/types-across-contracts branch from efd70a4 to 14abddb Compare July 29, 2025 16:13
msbrogli
msbrogli previously approved these changes Jul 30, 2025
@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Jul 30, 2025
@glevco glevco force-pushed the feat/nano/types-across-contracts branch from 14abddb to 19b5e1b Compare July 30, 2025 19:55
@glevco glevco dismissed stale reviews from jansegre and msbrogli via d7d3778 July 30, 2025 19:59
msbrogli
msbrogli previously approved these changes Jul 30, 2025
jansegre
jansegre previously approved these changes Jul 31, 2025
@github-project-automation github-project-automation bot moved this from In Review (Done) to In Review (WIP) in Hathor Network Jul 31, 2025
@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Jul 31, 2025
@glevco glevco force-pushed the feat/nano/types-across-contracts branch 2 times, most recently from 8efece2 to d86430e Compare July 31, 2025 18:30
@glevco glevco dismissed stale reviews from msbrogli and jansegre via c813c54 August 1, 2025 20:51
@glevco glevco force-pushed the feat/nano/types-across-contracts branch from c813c54 to 5dfea12 Compare August 4, 2025 17:22
@glevco glevco force-pushed the feat/nano/types-across-contracts branch from 5dfea12 to f9c431a Compare August 5, 2025 15:17
@glevco glevco force-pushed the feat/nano/types-across-contracts branch from f9c431a to 18e90a1 Compare August 5, 2025 19:03
@github-project-automation github-project-automation bot moved this from In Review (Done) to In Review (WIP) in Hathor Network Aug 5, 2025
@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Aug 5, 2025
@glevco glevco merged commit 3884064 into master Aug 6, 2025
10 of 14 checks passed
@glevco glevco deleted the feat/nano/types-across-contracts branch August 6, 2025 00:11
@github-project-automation github-project-automation bot moved this from In Review (Done) to Waiting to be deployed in Hathor Network Aug 6, 2025
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Aug 7, 2025
This was referenced Aug 7, 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