spel-cli: support account_id instruction arguments#231
Open
retraca wants to merge 1 commit into
Open
Conversation
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.
00d36f3 to
0755c2c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
spel-framework's IDL generator emits the primitive typeaccount_idforAccountIdinstruction arguments (spel-framework-core/src/account_types.rs), but the CLI's transaction-submit path has no handler for it.parse_primitivefalls through toother => Raw("account_id(<value>)"), andprimitive_to_dynamichas noaccount_idarm, so any instruction taking anAccountIdargument fails before submission with:It went unnoticed because the e2e fixture program types key-like arguments as
[u8; 32]rather thanAccountId, so the path was never exercised.nssa's
AccountIdderivesSerializeDisplay/DeserializeFromStr, i.e. it is a base58 string on the wire, not raw bytes. This PR:"account_id"arm toparse_primitivethat normalizes any input (base58,0xhex, or aPublic//Private/prefixed id) to canonical base58 viadecode_bytes_32;("account_id", ParsedValue::Str(_))arm toprimitive_to_dynamicthat 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
AccountIdargument 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 anaccount_idargument round-trip if you'd like one in this PR.