Skip to content

feat(nano): change ctx.address to ctx.caller_id and add support in NC types#1359

Merged
glevco merged 1 commit intomasterfrom
feat/nano/caller-id
Aug 14, 2025
Merged

feat(nano): change ctx.address to ctx.caller_id and add support in NC types#1359
glevco merged 1 commit intomasterfrom
feat/nano/caller-id

Conversation

@glevco
Copy link
Contributor

@glevco glevco commented Aug 14, 2025

Motivation

The ctx.address attribute can contain either an Address or a ContractId, but those types are not interchangeable and it makes it hard for blueprint devs to handle them. This PR changes it to ctx.caller_id, with added support for storing the CallerId type and sending it through methods across contracts.

Acceptance Criteria

  • Change Change.address to Context.caller_id, and add methods get_caller_address and get_caller_contract_id.
  • Add support for specific union types on NC fields.
    • Add support for CallerId = Address | ContractId.

@glevco glevco force-pushed the feat/nano/caller-id branch from 300ab2c to fc6b281 Compare August 14, 2025 20:33
@glevco glevco moved this from Todo to In Progress (Done) in Hathor Network Aug 14, 2025
@github-actions
Copy link

github-actions bot commented Aug 14, 2025

🐰 Bencher Report

Branchfeat/nano/caller-id
Testbedubuntu-22.04

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
sync-v2 (up to 20000 blocks)Latency
minutes (m)
📈 plot
🚷 threshold
🚨 alert (🔔)
1.84 m
(+11.30%)Baseline: 1.65 m
1.82 m
(101.18%)

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
🚨 view alert (🔔)
1.84 m
(+11.30%)Baseline: 1.65 m
1.49 m
(80.86%)
1.82 m
(101.18%)

🐰 View full continuous benchmarking report in Bencher

@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

❌ Patch coverage is 77.86885% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.65%. Comparing base (1aa9b2f) to head (fc6b281).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hathor/nanocontracts/nc_types/caller_id_nc_type.py 72.88% 9 Missing and 7 partials ⚠️
hathor/nanocontracts/context.py 65.21% 5 Missing and 3 partials ⚠️
...athor/serialization/compound_encoding/caller_id.py 88.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1359      +/-   ##
==========================================
- Coverage   85.65%   85.65%   -0.01%     
==========================================
  Files         427      429       +2     
  Lines       32312    32422     +110     
  Branches     5035     5063      +28     
==========================================
+ Hits        27678    27772      +94     
- Misses       3616     3623       +7     
- Partials     1018     1027       +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.

@glevco glevco moved this from In Progress (Done) to In Review (WIP) in Hathor Network Aug 14, 2025
@glevco glevco merged commit a538f91 into master Aug 14, 2025
7 of 9 checks passed
@glevco glevco deleted the feat/nano/caller-id branch August 14, 2025 21:33
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Aug 14, 2025
@jansegre jansegre mentioned this pull request Aug 14, 2025
2 tasks
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Aug 14, 2025
@jansegre jansegre mentioned this pull request Aug 14, 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.

3 participants