fix(issue-competitions): SCALE-encode str args in _encode_args (#1375)#1544
Closed
rascalchow wants to merge 1 commit into
Closed
fix(issue-competitions): SCALE-encode str args in _encode_args (#1375)#1544rascalchow wants to merge 1 commit into
rascalchow wants to merge 1 commit into
Conversation
`register_issue` declares `github_url` and `repository_full_name` as `str`
in metadata.json, but `_encode_args` only handled u32/u64/u128/AccountId/
array32 and fell through to `raise ValueError('Unsupported type: str ...')`.
Every `register_issue` call failed during local argument encoding, before
`compose_call` was ever reached.
Add a `str` branch that SCALE-encodes strings as Vec<u8> (compact length
prefix + UTF-8 bytes), via a new `_encode_compact_len` helper covering the
single/two/four-byte compact modes. Adds regression tests for the
register_issue encoding and the compact-length boundaries.
Fixes entrius#1375
Collaborator
|
Clear PR duplication detected. @rascalchow has been added to the watchlist — further duplicate or low-effort PRs will lean toward close-on-sight until sustained legitimate activity. Closing. |
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.
Summary
_encode_argshad nostrbranch, so everyregister_issuecall raisedValueError: Unsupported type: strwhile encodinggithub_url— beforecompose_callwas reached. This adds SCALEstrencoding (Vec: compactlength prefix + UTF-8) via a new
_encode_compact_lenhelper.Testing
pytest tests/validator/test_contract_client_transactions.py→ 38 passedruff check/ruff format --checkcleanFixes #1375