Skip to content

Warn on missing types in contract spec during contract build #2425

@leighmcculloch

Description

@leighmcculloch

What problem does your feature solve?

There are edge cases today where a type used in a contract function parameter or return value may not end up in the contract spec. Nothing prevents a user from using such a type in a contract fn, but the resulting spec will be incomplete — downstream tooling (bindings generators, explorers) won't be able to fully interpret the contract.

As the SDK evolves how it decides which specs to include (e.g. spec shaking in stellar/rs-soroban-sdk#1672), this kind of check becomes even more valuable as a way to surface bugs early in the spec inclusion logic.

What would you like to see?

Add a verification step to contract build that:

  1. Checks that every type referenced in contract function parameters or return values is defined elsewhere in the contract spec.
  2. Checks that every type referenced by event topic or data fields is defined elsewhere in the contract spec.
  3. Checks that any type in the spec that references other types can resolve those referenced types within the spec (transitive completeness).
  4. Emits a warning for any missing type, but does not stop the build.
  5. Ignores SDK built-in types that won't appear in the spec (e.g. the checkauth interface types and other types built into the SDK).

What alternatives are there?

  • Relying on downstream tooling to report missing types, but that shifts the problem later and makes root cause harder to trace.
  • A standalone contract verify subcommand, but integrating into build catches issues at the earliest point in the workflow.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions