Skip to content

fix(nano): improve error handling#1468

Merged
jansegre merged 1 commit intomasterfrom
fix/error-handling
Oct 15, 2025
Merged

fix(nano): improve error handling#1468
jansegre merged 1 commit intomasterfrom
fix/error-handling

Conversation

@glevco
Copy link
Contributor

@glevco glevco commented Oct 15, 2025

Motivation

Nano error handling relies on catching NCFail after nano execution and making the transaction fail. Any other exceptions bubble up and will crash the full node. Also, any exception that inherits from Exception and is thrown by user code, is converted to NCFail.

The old PR #1321 tried to address error handling but it was unnecessarily complex. This PR replaces #1321 by extracting only the necessary changes from it, most notably, it ensures all nano-related exceptions do inherit from NCFail. This is necessary because any exception that is thrown by the runner before user code is called, must inherit from NCFail to fail the transaction instead of crashing the full node, because such exception will not be converted.

Acceptance Criteria

  • Refactor nano exceptions, removing NCError and making ALL exceptions inherit from NCFail.
  • Move the user code try-except block closer to the actual call to user code, that is, from the runner to the metered_exec.

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 Oct 15, 2025
@glevco glevco mentioned this pull request Oct 15, 2025
1 task
@glevco glevco moved this from Todo to In Progress (WIP) in Hathor Network Oct 15, 2025
@glevco glevco moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Oct 15, 2025
@glevco glevco mentioned this pull request Oct 15, 2025
2 tasks
jansegre
jansegre previously approved these changes Oct 15, 2025
@glevco glevco moved this from In Progress (Done) to In Review (WIP) in Hathor Network Oct 15, 2025
msbrogli
msbrogli previously approved these changes Oct 15, 2025
@glevco glevco force-pushed the fix/error-handling branch from 98bceb1 to 0f0c9ae Compare October 15, 2025 16:04
@glevco glevco dismissed stale reviews from msbrogli and jansegre via 678bcca October 15, 2025 16:16
@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Oct 15, 2025
msbrogli
msbrogli previously approved these changes Oct 15, 2025
jansegre
jansegre previously approved these changes Oct 15, 2025
@github-project-automation github-project-automation bot moved this from In Review (Done) to In Review (WIP) in Hathor Network Oct 15, 2025
@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Oct 15, 2025
@glevco glevco force-pushed the fix/error-handling branch from 678bcca to 8b9bc87 Compare October 15, 2025 16:33
@glevco glevco dismissed stale reviews from msbrogli and jansegre via d6a1e22 October 15, 2025 17:36
@glevco glevco force-pushed the fix/error-handling branch from 8b9bc87 to d6a1e22 Compare October 15, 2025 17:36
@github-project-automation github-project-automation bot moved this from In Review (Done) to In Review (WIP) in Hathor Network Oct 15, 2025
# Conflicts:
#	tests/nanocontracts/test_fallback_method.py
@glevco glevco force-pushed the fix/error-handling branch from d6a1e22 to d124790 Compare October 15, 2025 18:10
@jansegre jansegre merged commit a9cf795 into master Oct 15, 2025
1 of 2 checks passed
@jansegre jansegre deleted the fix/error-handling branch October 15, 2025 18:12
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Oct 15, 2025
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Oct 16, 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.

3 participants