Skip to content

Fix: Smart Contract Invoke excludes arguments after a Vec#1686

Merged
jeesunikim merged 2 commits intostellar:mainfrom
normalfinance:fix/getScValsFromArgs
Oct 27, 2025
Merged

Fix: Smart Contract Invoke excludes arguments after a Vec#1686
jeesunikim merged 2 commits intostellar:mainfrom
normalfinance:fix/getScValsFromArgs

Conversation

@jblewnormal
Copy link
Copy Markdown
Contributor

@jblewnormal jblewnormal commented Oct 22, 2025

fix(sorobanUtils): replace return statements with continue in getScValsFromArgs()

When invoking a smart contract function that has heterogeneous argument types, line 531 of the sorobanUtils.ts iterates through each argument, parses it, but mistakenly returns the parsed value - ending the for loop before iterating through every argument.

You can recreate the original bug that prompted this PR by using CCPHUHQYFOJJ6WQUGUYHHPJYQGFLRQHJJTRJNWQG54MHCHPRFLWQI7SE and calling the set_privileged_addrs function. Pass in any assortment of addresses and you'll notice you receive this error:

Screenshot 2025-10-22 at 1 04 06 PM

The arguments logged at the end of this error do not include the final argument system_fee_admin. This is because of this bug.

This results in function arguments being excluded from execution and the invocation/simulation therefore failing.

This commit replaces these return statements with continue so the for loop can complete iteration through all passed arguments.

When invoking a smart contract function that has heterogeneous argument types, line 531 of the `sorobanUtils.ts iterates through each argument, parses it, but mistakenly returns the parse value - ending the for loop before iterating through every argument.

This results in function arguments being excluded from execution and the invocation/simulation therefore failing.

This commit replaces these `return` statements with `continue` so the for loop can complete iteration through all passed arguments.
@quietbits
Copy link
Copy Markdown
Contributor

Thanks for the PR, @jblewnormal ! 🎉 @jeesunikim will review it next week when she's back.

@quietbits quietbits linked an issue Oct 22, 2025 that may be closed by this pull request
@jblewnormal
Copy link
Copy Markdown
Contributor Author

@quietbits @jeesunikim There's another bug I've found where contract function arguments are added in the order they are entered by the user. So if you don't enter them sequentially, the simulation will fail. I'll have a PR for this soon.

@quietbits
Copy link
Copy Markdown
Contributor

@jblewnormal, thanks for digging into this. Really appreciate the help. ❤️

@quietbits quietbits moved this from Backlog (Not Ready) to Needs Review in DevX Oct 23, 2025
Comment thread tests/e2e/signerSelector.test.ts
@jeesunikim
Copy link
Copy Markdown
Contributor

thank you so much! @jblewnormal LGTM

@jeesunikim jeesunikim merged commit c54344d into stellar:main Oct 27, 2025
3 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Oct 27, 2025
@jsmaxi
Copy link
Copy Markdown

jsmaxi commented Nov 24, 2025

There's another bug I've found where contract function arguments are added in the order they are entered by the user. So if you don't enter them sequentially, the simulation will fail. I'll have a PR for this soon.

@jblewnormal Did you have a chance to look into this issue or need any help?

@jblewnormal
Copy link
Copy Markdown
Contributor Author

There's another bug I've found where contract function arguments are added in the order they are entered by the user. So if you don't enter them sequentially, the simulation will fail. I'll have a PR for this soon.

@jblewnormal Did you have a chance to look into this issue or need any help?

Hey hey, I have not had the time yet. When I do, I will get a new issue/PR created. Basically, if smart contract function arguments are not entered in chronological order, their correct order is not maintained and the function call fails.

@jeesunikim
Copy link
Copy Markdown
Contributor

good afternoon, I will work on this tomorrow! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Contract invocation fails in Lab with certain parameter types

4 participants