Skip to content

feat: add FunctionCallDecoder for Soroban host function invocations (#342)#357

Open
JesseJohn7 wants to merge 4 commits into
Toolbox-Lab:mainfrom
JesseJohn7:feat/29-function-call-decoder
Open

feat: add FunctionCallDecoder for Soroban host function invocations (#342)#357
JesseJohn7 wants to merge 4 commits into
Toolbox-Lab:mainfrom
JesseJohn7:feat/29-function-call-decoder

Conversation

@JesseJohn7

@JesseJohn7 JesseJohn7 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Closes #342

Adds a new FunctionCallDecoder module (crates/core/src/decode/function_call_decoder.rs)
that reconstructs the exact function call a Soroban transaction initiated.

  • Extracts function_name and raw args (SCVec) from the HostFunction
    invocation
  • Resolves the contract's ContractFunction metadata via SpecParser
  • Zips the expected parameter list against the raw argument array
  • Converts each argument via the existing SCVal-to-JSON converter and
    labels it with its parameter name
  • Returns GratError::ArityMismatch (new error variant) with a
    descriptive message when the argument count doesn't match the
    expected parameter count

Also adds GratError::ArityMismatch and GratError::UnsupportedHostFunction
to the error enum, and registers the new module in decode/mod.rs.

@JesseJohn7 JesseJohn7 changed the title feat: add FunctionCallDecoder for Soroban host function invocations (#29) feat: add FunctionCallDecoder for Soroban host function invocations (#342) Jul 17, 2026
@codeZe-us
codeZe-us self-requested a review July 18, 2026 15:28
@codeZe-us

Copy link
Copy Markdown
Contributor

@JesseJohn7 please fix workflow issues

@JesseJohn7

Copy link
Copy Markdown
Contributor Author

Hi @codeZe-us thanks for the review request. I've resolved the merge conflict in error.rs (the branch now merges cleanly with main).

@codeZe-us

Copy link
Copy Markdown
Contributor

@JesseJohn7 The workflow is failing, resolve it as well

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.

Task 29: Grat Cannot Decode Which Function and Arguments a Transaction Actually Called

2 participants