Skip to content

simplify forks by passing along ClvmFlags into the operator functions#741

Open
arvidn wants to merge 1 commit intomainfrom
operator-flags
Open

simplify forks by passing along ClvmFlags into the operator functions#741
arvidn wants to merge 1 commit intomainfrom
operator-flags

Conversation

@arvidn
Copy link
Contributor

@arvidn arvidn commented Mar 11, 2026

This makes it a lot simpler and more straight forward to implement soft forks (and the upcoming hard fork) per operators.


Note

Medium Risk
Touches the core operator dispatch path and changes every operator’s function signature, so any missed callsite or subtle flag-handling difference could alter consensus/mempool behavior. Logic changes are mostly mechanical but include behavior selection for MALACHITE and relaxed BLS validation.

Overview
Refactors the CLVM operator ABI so all native ops take ClvmFlags (fn(..., max_cost, flags) -> Response), and updates dispatch (ChiaDialect, RuntimeDialect, f_table) plus fuzzers/tests to pass flags through.

Simplifies fork/variant handling by moving it inside ops: op_div/op_divmod/op_mod/op_modpow now branch on ClvmFlags::MALACHITE, large-operand limits use ClvmFlags::DISABLE_OP, and BLS g1/g2_negate strict vs relaxed behavior is controlled via ClvmFlags::RELAXED_BLS (removing separate *_strict entrypoints).

Written by Cursor Bugbot for commit 6e0b86f. This will update automatically on new commits. Configure here.

@arvidn
Copy link
Contributor Author

arvidn commented Mar 11, 2026

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

ClvmFlags::empty(),
ClvmFlags::DISABLE_OP,
ClvmFlags::MALACHITE,
];
Copy link

Choose a reason for hiding this comment

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

Fuzz target never exercises relaxed BLS code path

Medium Severity

The FLAGS array omits ClvmFlags::RELAXED_BLS, meaning the fuzzer never tests the non-strict BLS negate code path. Previously, both op_bls_g1_negate (non-strict) and op_bls_g1_negate_strict were in the FUNS array, ensuring both paths were fuzzed. Now only op_bls_g1_negate remains, and its strict behavior is controlled by RELAXED_BLS in the flags — but that flag is absent from FLAGS, so only the strict path is ever exercised.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant