Skip to main content
Sigvex

Trivial Constraint Remediation

How to fix constraints that are always satisfied regardless of signal values.

Trivial Constraint Remediation

Overview

Related Detector: Trivial Constraint

A trivial constraint is a === expression that is tautologically true for all signal values, such as x === x, 0 === 0, or x * 0 === 0. These constraints provide no security because any value satisfies them. If a trivial constraint is the only constraint on a signal, that signal is effectively unconstrained. The fix is to replace trivial constraints with meaningful ones that bind signal values to other determined quantities.

Before (Vulnerable)

template UnsafeIdentity() {
    signal input x;
    signal output y;

    y <-- x;
    y === y;  // TRIVIAL: always true, y is unconstrained
}

After (Fixed – Meaningful Constraint)

template SafeIdentity() {
    signal input x;
    signal output y;

    y <== x;  // Generates constraint: y === x
    // y is now constrained to equal x
}

Before (Vulnerable – Algebraic Tautology)

template UnsafeCompute() {
    signal input a;
    signal output b;

    b <-- a * 2;
    b - a * 2 === 0;  // Looks meaningful, but is b === a*2, which is correct
    // Wait -- this IS a real constraint. But consider:
    b <-- a;
    (b - a) * 0 === 0;  // TRIVIAL: multiplication by 0 makes it always true
}

After (Fixed)

template SafeCompute() {
    signal input a;
    signal output b;

    b <== a * 2;  // Real constraint: b === a * 2
}

Alternative Mitigations

1. Constraint Coverage Audit

Review each signal to verify it participates in at least one non-trivial constraint. A signal is meaningfully constrained if the constraint relates it to at least one other independently determined value.

2. Remove and Reconstruct

If you find a trivial constraint, remove it entirely and determine what the developer intended. Then write the correct constraint:

// Original trivial constraint removed: x === x
// Developer likely intended:
x === expectedValue;
// or:
x * x === input;

Common Mistakes

Adding x === x as a “sanity check”: This does nothing. Every field element equals itself. To check that a signal has been assigned, use it in a relationship with other signals.

Algebraic simplification hiding tautologies: The expression (a + b) - (b + a) === 0 simplifies to 0 === 0 and constrains nothing. Review constraints for algebraic simplification before assuming they provide security.

Confusing constraint presence with constraint strength: Having a === expression on a signal does not mean the signal is constrained. The constraint must actually restrict the set of valid values for the signal. A tautology restricts nothing.

Multiplying by zero: Any expression of the form expr * 0 === 0 is trivially true. Ensure no branch of your constraint logic multiplies by a constant zero.

References