Repository navigation
fix(utility): validate Soroban contract method specifications (#769) - #876
Merged
Merged
Conversation
…nges (Sorokit#763) - Add automatic background timer eviction for expired SEP-10 challenge contexts - Implement O(K) early-exit pruning leveraging uniform TTL insertion monotonicity - Eagerly clean expired challenges on initiateSep10Auth and completeSep10Auth - Evaluate caller-supplied options.now in completeSep10Auth with clear error on expiry - Unreference background timer handle to prevent holding the Node.js event loop - Export pruneExpiredChallenges, getPendingChallengesCount, and clearPendingChallenges helpers - Add unit and integration tests covering idle background eviction and FIFO limits
…t#769) - Add validateContractMethodSpec to validate method names, parameters, and return types - Enforce Soroban method identifier rules (max 32 chars, no leading digits, no reserved keywords) - Validate parameter and return types against Soroban scalar and container specifications - Support container generic types (vec, map, option, result, tuple) with arity checking - Add isValidContractMethodSpec boolean helper and export types - Add 22 unit tests covering valid edge cases and malformed specs
|
@Gezziy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
closes #769
Summary of Changes
validateContractMethodSpec(method)tosrc/utility/validator.tsto validate Soroban contract method signatures prior to transaction invocation and preparation.ScSymbol:/^[a-zA-Z_][a-zA-Z0-9_]*$/."123_invalid")."foo-bar").SOROBAN_MAX_METHOD_NAME_LEN).fn,let,mut,impl,struct,__constructor, etc.).ScSpecTypeDef/ScVal):u32,i32,u64,i64,u128,i128,u256,i256,bool,void,(),unit,string,symbol,bytes,bytes32, andaddress.vec<T>,map<Key, Value>,tuple<...>,option<T>,result<Ok, Err>.u32<string>)."invalid_scval_type","int","float","decimal").inputs,parameters,params,args) and (returnType,returns,return_type), accepting string arrays or structured parameter descriptor objects.isValidContractMethodSpec(method)returning a boolean check.src/tests/validator.test.tscovering invalid method names, reserved words, invalid scalar types, container arity mismatches, void returns, and flexible input shapes (58/58 tests passing).Reason for Changes
Resolves issue #769. Previously,
validator.tsdid not validate Soroban contract method specifications, permitting callers to pass malformed method names or non-existent scalar types. These malformed specs failed with cryptic RPC or simulation errors on-chain. Early client-side validation fails fast with clear error messages citing the Soroban specification.