fix: accept native byte arrays in the bytes arg encoder - #22
Open
scarmuega wants to merge 1 commit into
Open
Conversation
Native `bytes`/`bytearray` values (and integer lists — the JSON shape other SDKs' native byte arrays serialize to) were rejected by the encoder, so byte params could only be supplied as hex strings. Canonicalize them to 0x-prefixed hex, per SDK spec §3.9 value marshalling — mirroring the rust-sdk/web-sdk change. Covers the Hydra `init` participants/parties/head_id and Asteria create_ship pilot/ship-name shapes with regression tests (TRP `(-32005) value is not bytes`). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Plan
Tx3 Trellis domain plan
plans/feedback-cba-04-sdks-imports-utxoref-signer-encoding.md(domain root not yet on a forge; plan ref by path). Executed byorg/coderunder plan dispatch — this is the python-sdk share of the fleet-wide bytes/List<Bytes>encoding fix (reference change: tx3-lang/rust-sdk#47; behavioral reference: web-sdk #36 + tx3-lang/web-sdk#38).Done criterion (python share): the encoder accepts native
bytesfor byte params and emits a tagged list of byte-strings forList<Bytes>— pinned by mirrored unit tests covering the Hydrainitparticipants/parties/head_idand Asteria pilot/ship-name shapes ((-32005) value is not bytesregression).What changed
fix(tii)— the bytes encoder previously rejected nativebytes/bytearray(the type the python codegen contract emits forBytesparams) and integer lists (the JSON shape other SDKs' native byte arrays serialize to). It now canonicalizes them to0x-prefixed hex, per SDK spec §3.9 value marshalling.Audit finding (in-scope audit, fix deferred to a follow-up plan)
Same fleet-wide gap as rust/web: the type-directed encoder runs only on the dynamic
Invocationpath; the facadeTxBuilder(used by codegen-generated bindings) sends args raw. The facade param-map wiring landed in rust-sdk#47 / web-sdk#38 and is filed as a follow-up plan in the domain root for python/go parity.Ed25519Signer.from_mnemoniccarries the same non-derivation defect removed from web-sdk in #38 — also in the follow-up.Verification
pytest tests -m "not e2e"(python:3.11, docker): 90 passed (86 baseline + 4 new).ruff checkon the touched files: clean (repo-wide ruff has 12 pre-existing findings in untouched files; ruff is not in CI).🤖 Generated with Claude Code