feat: support decimal calldata values and prefixes (u256:, str:)#29
Merged
feat: support decimal calldata values and prefixes (u256:, str:)#29
Conversation
5a5e20e to
3629ee2
Compare
Previously, calldata values had to be in hex format (0x...). This change allows users to specify calldata as either hex (with 0x prefix) or decimal numbers. Examples that now work: --calldata "0x123,0x456" # hex (existing behavior) --calldata "1000000,200" # decimal (new) --calldata "0xDE0B6B3A7640000,100" # mixed Changes: - Add parse_felt() helper function to parse hex or decimal strings - Update execute.rs to use parse_felt() for calldata parsing - Update call.rs to use parse_felt() for calldata parsing Fixes paymaster overflow errors when using decimal amounts like 1000000000000000000 instead of 0xDE0B6B3A7640000
3629ee2 to
c793e84
Compare
Extract duplicate parse_calldata_value from execute.rs and call.rs into shared calldata module. Update README, LLM_USAGE.md, and skill files to document u256:, str:, and decimal calldata formats. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ca9919c to
258ea77
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.
Previously, calldata values had to be in hex format (0x...). This change allows users to specify calldata as either hex, decimal, or use special prefixes for common types.
New Features
Prefix Support
u256:u256:1000000000000000000[low, high]str:str:hello[felt]0x123or1000[felt]Examples
Transfer 1 STRK without manual splitting:
controller execute 0x... transfer "0xrecipient,u256:1000000000000000000"Use short strings:
controller execute 0x... set_name "str:myname"Mixed calldata:
controller execute 0x... transfer "0xrecipient,u256:1000000,str:memo,0x999"Changes
parse_calldata_value()function to handle special prefixesexecute.rsandcall.rsto use the new parser0x...) and decimal formats for all numeric inputs0Xprefix (normalize to lowercase)Testing
cargo clippy -- -D warningscleanBreaking Changes
None. All existing hex-only calldata continues to work.
Future Extensions
Could add more prefixes following starkli patterns:
selector:- auto-convert function name to selectoraddr:- address book resolutionstorage:- storage variable address calculation