Skip to content

spel-cli: support account_id instruction arguments#231

Open
retraca wants to merge 1 commit into
logos-co:mainfrom
retraca:fix/account-id-instruction-args
Open

spel-cli: support account_id instruction arguments#231
retraca wants to merge 1 commit into
logos-co:mainfrom
retraca:fix/account-id-instruction-args

Conversation

@retraca

@retraca retraca commented Jun 3, 2026

Copy link
Copy Markdown

spel-framework's IDL generator emits the primitive type account_id for AccountId instruction arguments (spel-framework-core/src/account_types.rs), but the CLI's transaction-submit path has no handler for it. parse_primitive falls through to other => Raw("account_id(<value>)"), and primitive_to_dynamic has no account_id arm, so any instruction taking an AccountId argument fails before submission with:

type mismatch: expected account_id, got Raw("account_id(<value>)")

It went unnoticed because the e2e fixture program types key-like arguments as [u8; 32] rather than AccountId, so the path was never exercised.

nssa's AccountId derives SerializeDisplay / DeserializeFromStr, i.e. it is a base58 string on the wire, not raw bytes. This PR:

  • adds an "account_id" arm to parse_primitive that normalizes any input (base58, 0xhex, or a Public/ / Private/ prefixed id) to canonical base58 via decode_bytes_32;
  • adds a matching ("account_id", ParsedValue::Str(_)) arm to primitive_to_dynamic that serializes it as a string.

Existing programs that typed key arguments as [u8; 32] are unaffected.

Testing. Verified on a locally-run standalone sequencer: an instruction taking an AccountId argument now builds, signs, submits, and lands, checked against on-chain account state. Without the change the same command fails as above. Happy to add a CLI unit test covering an account_id argument round-trip if you'd like one in this PR.

spel-framework's IDL generator emits the primitive type "account_id" for AccountId
arguments (account_types.rs), but the CLI's submit path (parse_primitive /
primitive_to_dynamic) has no account_id arm, so any instruction with an AccountId
argument fails with "type mismatch: expected account_id". The path went untested
because the e2e fixture types key arguments as [u8; 32].

nssa's AccountId is SerializeDisplay / DeserializeFromStr, i.e. a base58 string on the
wire, so this normalizes the input (base58 / 0xhex / Public-prefixed) to canonical
base58 and serializes it as a string. Verified on a locally-run standalone sequencer:
an instruction taking an AccountId argument now builds, signs, submits, and lands,
checked against on-chain state. Existing programs that typed key args as [u8; 32] are
unaffected.
@retraca retraca force-pushed the fix/account-id-instruction-args branch from 00d36f3 to 0755c2c Compare June 3, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant