Skip to content

OpMeta Input allows contradictory computed/constant shapes (computation without bits, parameters with bits) #171

Description

@thedavidmeister

Unit

crates/cli/src/meta/types/op/v1.rsInput (computed vs constant inputs).

Intent oracle

OpMeta.inputs doc: "for opcodes with dynamic number of inputs, 'bits' field must be specified which determines this opcode has dynamic inputs ... with 'computation' field applied if specified". Input.bits doc: "Required only for computed (non-constant) inputs"; Input.computation doc: same.

Violated property

Cross-field consistency of the computed-input shape. Validation is per-field only, so these all validate today:

  • {"computation": "bits + 1"} with no bits — a computation over operand bits that are never allocated;
  • {"parameters": [..], "bits": [0, 3]} — constant parameters together with dynamic bits, leaving the input count ambiguous between parameters.len() and the bits value.

Verified repro

OpMeta::try_from(br#"{"name":"add","inputs":[{"computation":"bits + 1"}]}"#.to_vec()) returns Ok (verified while building the AMT suite — the new test_opmeta_input_computation_validated uses exactly this shape as its "valid" arm because the current validator accepts it).

Triage framing

The docs describe a discriminated union (constant: parameters; computed: bits [+ computation]) that the struct does not enforce. Consumers (rainlang tooling) presumably fail later or misread such metas. Possibly out of scope for schema-level validation — flagged for a human call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adversarialFound by adversarial review/mutation testingauditAudit finding; counted by the org health scan

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions