Skip to content

Conversation

@glevco
Copy link
Contributor

@glevco glevco commented Jan 21, 2026

Motivation

There are unused opcodes that were once created for a cancelled implementation. This PR defines a Feature Activation to remove them.

Acceptance Criteria

  • Add .venv to ignore of yamllint. It was complaining in my local env sometimes.
  • Create new Feature.OPCODES_V2 and respective setting HathorSettings.ENABLE_OPCODES_V2, defaulting to disabled.
  • Create OpcodeVersion, removing deprecated opcodes on V2, which is configured via feature activation.
    • SignedData.checksig is set to use V2 directly, without feature activation. This is allowed since there are no blueprints with SignedData on mainnet.
    • Mempool/relayed vertices use V2directly, so we reject txs with deprecated opcodes in the mempool.

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 Jan 21, 2026
@glevco glevco moved this from Todo to In Progress (WIP) in Hathor Network Jan 21, 2026
@glevco glevco force-pushed the feat/remove-unused-opcodes branch 4 times, most recently from 6b863ed to 746d648 Compare January 22, 2026 19:42
@glevco glevco changed the base branch from master to refactor/consensus-features January 22, 2026 19:42
@github-actions
Copy link

github-actions bot commented Jan 22, 2026

🐰 Bencher Report

Branchfeat/remove-unused-opcodes
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.70 m
(-1.22%)Baseline: 1.72 m
1.55 m
(91.12%)
2.06 m
(82.31%)
🐰 View full continuous benchmarking report in Bencher

@glevco glevco force-pushed the feat/remove-unused-opcodes branch 7 times, most recently from d094ac2 to 10a4030 Compare January 22, 2026 21:01
@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 84.61538% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.76%. Comparing base (73d3e56) to head (3e32c9b).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hathor/consensus/consensus.py 55.55% 10 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1563      +/-   ##
==========================================
- Coverage   86.27%   85.76%   -0.51%     
==========================================
  Files         437      437              
  Lines       33662    33707      +45     
  Branches     5269     5268       -1     
==========================================
- Hits        29042    28909     -133     
- Misses       3611     3796     +185     
+ Partials     1009     1002       -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 force-pushed the refactor/consensus-features branch 4 times, most recently from e4b1772 to 9fe977f Compare January 23, 2026 14:01
@glevco glevco force-pushed the feat/remove-unused-opcodes branch 4 times, most recently from fba3149 to ca88671 Compare January 23, 2026 15:12
@glevco glevco moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Jan 23, 2026
@glevco glevco force-pushed the feat/remove-unused-opcodes branch from ca88671 to c7ccccb Compare January 23, 2026 18:43
msbrogli
msbrogli previously approved these changes Jan 23, 2026
count_checkdatasig_op=False,
nanocontracts=False,
fee_tokens=False,
opcodes_version=OpcodesVersion.V1,
Copy link
Member

Choose a reason for hiding this comment

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

All these settings are weird to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, they're compatible with the base PR which is compatible with what's in master. All these are unused here, as this class only calls verify_basic.



def execute_op_code(opcode: Opcode, context: ScriptContext) -> None:
def execute_op_code(opcode: Opcode, context: ScriptContext, version: OpcodesVersion) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather refactor it to a class that will be first configured and then will execute the script. Maybe it's too much for this PR.

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 agree we could do it in another PR.

"""Verify inputs signatures and ownership and all inputs actually exist"""
self._verify_inputs(self._settings, tx, params, skip_script=skip_script)

@classmethod
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this method doesn't use any instance attributes, so I can call TransactionVerifier._verify_inputs in the consensus mempool re-verification without having to inject the verifier instance there. The same structure was used for the _verify_sigops_output re-verification which is already in place.

try:
NanoHeaderVerifier._verify_nc_signature(self._settings, tx, params)
except Exception:
return False
Copy link
Member

Choose a reason for hiding this comment

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

Should we log the exception? I guess, nothing else should happen besides the tx failing the verification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 0dfe92e

@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Jan 23, 2026
@glevco glevco force-pushed the refactor/consensus-features branch from 9fe977f to 73d3e56 Compare January 24, 2026 20:20
@glevco glevco force-pushed the feat/remove-unused-opcodes branch from c7ccccb to 846a2b7 Compare January 26, 2026 14:27
@jansegre jansegre deleted the branch master January 26, 2026 14:54
@jansegre jansegre closed this Jan 26, 2026
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Jan 26, 2026
@glevco glevco moved this from Waiting to be deployed to In Review (Done) in Hathor Network Jan 26, 2026
@glevco glevco reopened this Jan 26, 2026
@glevco glevco changed the base branch from refactor/consensus-features to master January 26, 2026 14:56
@glevco glevco dismissed msbrogli’s stale review January 26, 2026 14:56

The base branch was changed.

@glevco glevco moved this from In Review (Done) to In Review (WIP) in Hathor Network Jan 26, 2026
@glevco glevco force-pushed the feat/remove-unused-opcodes branch from 0dfe92e to 3e32c9b Compare January 26, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review (WIP)

Development

Successfully merging this pull request may close these issues.

4 participants