Skip to content

feat(dynamic-transaction-model): nc actions fees#1406

Merged
raul-oliveira merged 1 commit intomasterfrom
raul-oliveira/charge-nc-actions-fee
Oct 9, 2025
Merged

feat(dynamic-transaction-model): nc actions fees#1406
raul-oliveira merged 1 commit intomasterfrom
raul-oliveira/charge-nc-actions-fee

Conversation

@raul-oliveira
Copy link
Contributor

@raul-oliveira raul-oliveira commented Sep 11, 2025

Depends on 1350

Motivation

According to the RFC documentation, withdraw and deposit actions involving fee tokens must pay a fee.

Actions execute before contract execution and accept a token ID, which can be generated deterministically. When an action receives a token_uid that has not yet been created (called a create_token syscall), it's not possible to determine the version of that token, and therefore calculate the fee.

Aiming to bring balance consistency during nano contract execution, we are introducing the NCFee.

Acceptance Criteria

  • Contexts should accept a NCFee array containing a token_uid and amount to inform which token will be used to pay fees.
  • validate if the amount provided in the fees is exact the same required for the operations to run
  • validate the fee amount checking if it's positive, and multiple of 100
  • implement the paid_fees dict which contains all the fees paid by inter contract calls (nc x nc)
  • validate if all the tokens present in the paid_fees are deposit based or HTR
  • should allow token creation and withdrawal in the same syscall

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

@raul-oliveira raul-oliveira changed the title feat: fee token creation in nano feat: nc actions header Sep 11, 2025
@github-actions
Copy link

github-actions bot commented Sep 11, 2025

🐰 Bencher Report

Branchraul-oliveira/charge-nc-actions-fee
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.96 m
(+13.96%)Baseline: 1.72 m
1.55 m
(78.97%)
2.07 m
(94.97%)
🐰 View full continuous benchmarking report in Bencher

@raul-oliveira raul-oliveira self-assigned this Sep 11, 2025
@raul-oliveira raul-oliveira moved this from Todo to In Progress (WIP) in Hathor Network Sep 11, 2025
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch from 8a73968 to 7927601 Compare September 12, 2025 18:02
@raul-oliveira raul-oliveira changed the title feat: nc actions header feat: nc actions fees Sep 15, 2025
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch 2 times, most recently from 5b9105b to 97b8620 Compare September 15, 2025 11:35
@raul-oliveira raul-oliveira marked this pull request as ready for review September 15, 2025 11:38
@raul-oliveira raul-oliveira changed the title feat: nc actions fees feat(dynamic-transaction-model): nc actions fees Sep 15, 2025
@raul-oliveira raul-oliveira changed the base branch from master to raul-oliveira/create-fee-tokens-in-nano September 15, 2025 15:36
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch from 97b8620 to 4020caa Compare September 15, 2025 15:57
@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 93.75000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.94%. Comparing base (d708ede) to head (b207594).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hathor/nanocontracts/runner/runner.py 93.33% 2 Missing and 1 partial ⚠️
hathor/transaction/headers/fee_header.py 50.00% 2 Missing ⚠️
hathor/transaction/base_transaction.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1406      +/-   ##
==========================================
- Coverage   85.94%   85.94%   -0.01%     
==========================================
  Files         434      434              
  Lines       33675    33739      +64     
  Branches     5278     5291      +13     
==========================================
+ Hits        28943    28996      +53     
- Misses       3686     3696      +10     
- Partials     1046     1047       +1     

☔ 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 (WIP) to In Progress (Done) in Hathor Network Sep 16, 2025
@glevco glevco requested review from glevco and removed request for jansegre September 16, 2025 21:46
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Sep 17, 2025
@jansegre jansegre mentioned this pull request Sep 17, 2025
2 tasks
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/create-fee-tokens-in-nano branch 2 times, most recently from 77e824b to d5f069d Compare September 19, 2025 16:34
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch from 4020caa to 70da0b2 Compare September 19, 2025 20:20
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/create-fee-tokens-in-nano branch 3 times, most recently from 381d3d4 to a3954f6 Compare September 26, 2025 13:32
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch 3 times, most recently from 726b60c to e50732b Compare October 8, 2025 14:17
msbrogli
msbrogli previously approved these changes Oct 8, 2025
glevco
glevco previously approved these changes Oct 8, 2025
@raul-oliveira raul-oliveira dismissed stale reviews from glevco and msbrogli via 4681b40 October 8, 2025 18:35
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch 7 times, most recently from 90a31ea to 79f329e Compare October 8, 2025 20:04
@raul-oliveira raul-oliveira force-pushed the raul-oliveira/charge-nc-actions-fee branch from 79f329e to b207594 Compare October 8, 2025 22:20
@raul-oliveira raul-oliveira requested a review from msbrogli October 8, 2025 22:33
@raul-oliveira raul-oliveira requested a review from jansegre October 9, 2025 15:23
@raul-oliveira
Copy link
Contributor Author

#1406 (comment)
@jansegre
I also don't like the syntax for the same reason. I'm OK with the first 2 arguments being positional (and maybe positional-only), the rest could be kwarg-only, with defaults that make sense.

We discussed this point and @glevco addressed it in the #1451

@raul-oliveira raul-oliveira merged commit 2387a69 into master Oct 9, 2025
8 checks passed
@raul-oliveira raul-oliveira deleted the raul-oliveira/charge-nc-actions-fee branch October 9, 2025 17:35
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Oct 9, 2025
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Oct 15, 2025
@jansegre jansegre mentioned this pull request Oct 16, 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.

4 participants