Skip to content

Debugger should support State and State[] arguments consistently with the compiler #63

@michaelsutton

Description

@michaelsutton

Debugger support for State and State[] is currently incomplete in two ways.

  1. Argument parsing is missing
    debugger/session/src/args.rs cannot parse struct-shaped call arguments, so the debugger cannot run entrypoints that take State or State[].

Current behavior:

  • State is rejected as an unsupported type
  • State[] rejects JSON object elements with:
    • unsupported array element (expected number/bool/string)
  1. The debugger does not apply the compiler’s lowering model
    A source-level argument like:
State[] new_states

does not remain a single runtime argument. The compiler lowers struct arrays into one runtime array per field before building the sigscript.

For example, if State has:

int amount;
byte[32] owner;

then State[] new_states is lowered into runtime data equivalent to:

int[] new_amount
byte[32][] new_owner

So fixing parsing alone is not enough. The debugger also needs to lower structured arguments the same way as the compiler, or it will still build the wrong call representation.

The compiler/runtime path already handles this through:

  • CompiledContract::build_sig_script
  • push_typed_sigscript_arg

Requested behavior:

  • support State / struct object arguments in debugger CLI/session
  • support State[] / struct-array arguments in debugger CLI/session
  • ensure debugger call construction uses the compiler’s lowering rules, while debugger-visible arguments and values remain understandable in source-level State / State[] terms

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions