Skip to content

CLI solc artifact prints null with exit 0 when the requested component is missing from the artifact #231

Description

@thedavidmeister

extract_artifact_component_json (crates/cli/src/solc/mod.rs:19-29 at bba50a7) indexes the parsed artifact JSON with json["abi"] / json["bytecode"] / json["deployedBytecode"] and clones the result. When the requested component is absent, indexing yields Value::Null, which is returned as Ok(Null) — the function's own doc comment notes it "does not perform any checks on the returned [Value] such as if it is null or not".

The CLI surfaces this directly:

$ printf '{"bytecode":{"object":"0x60"},"deployedBytecode":{"object":"0x60"}}' > artifact-no-abi.json
$ rain-metadata solc artifact --component abi --input-path artifact-no-abi.json
null
$ echo $?
0

A missing component prints null with exit code 0, indistinguishable from an artifact whose component legitimately serializes as null. Anything piping this output (e.g. into ABI tooling) receives null instead of an error.

Options:

  • return an error (nonzero exit) when the component key is absent from the artifact, or
  • keep the passthrough but document/flag it at the CLI layer.

Found during round-2 adversarial mutation testing (adjudication A-2).

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