fix: facade TaggedArg encoding, native byte arrays, codegen UtxoRef/Address imports - #47
Draft
scarmuega wants to merge 3 commits into
Draft
fix: facade TaggedArg encoding, native byte arrays, codegen UtxoRef/Address imports#47scarmuega wants to merge 3 commits into
scarmuega wants to merge 3 commits into
Conversation
A codegen `Vec<u8>` param serializes to a JSON array of integers; the encoder previously rejected that shape, so byte params could only be supplied as hex strings. Canonicalize integer arrays (0..=255) to 0x-prefixed hex, per SDK spec §3.9 value marshalling. 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>
The type-directed encoder introduced for the dynamic Invocation path never ran on the facade path: `TxBuilder::resolve` sent merged args raw, so both `Tx3Client` users and codegen-generated bindings hit resolver errors for aggregate params (`(-32005) target type not supported: List` / `value is not bytes`). - `TxBuilder` carries a `ParamMap`; `build_resolve_params` marshals every matching arg (case-insensitive) via `tii::encode`, pass-through for unmapped args. - `Tx3ClientBuilder` threads per-tx param maps: populated automatically from a loaded `Protocol` (new `Protocol::tx_params`), or supplied by generated bindings through the new `with_tx_params` setter. - `tii::params_from_schema` is now public for codegen use. `Tx3ClientBuilder::from_parts` is unchanged, so existing generated clients keep compiling (their args pass through unencoded as before). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The generated `lib.rs` import block omitted `UtxoRef` and `Address`, so any protocol declaring a param of either type failed to compile (`schemaTypeFor` emits the bare names). Import both under `#[allow(unused_imports)]` since their presence is protocol-dependent. Embed each transaction's params JSON schema plus the protocol's `components.schemas` table and hand them to the new `Tx3ClientBuilder::with_tx_params`, so generated clients get type-directed TaggedArg encoding on resolve. Bump the generated crate's tx3-sdk floor to the release that carries the new API. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 30, 2026
scarmuega
marked this pull request as draft
July 30, 2026 13:05
Contributor
Author
|
Converted to draft for the same release-ordering reason flagged for web-sdk#38: the 🤖 Generated with Claude Code |
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.Done criterion (rust-sdk share) — met:
UtxoRefparam builds (cargo buildverified against a Hydra-init-shaped TII fixture withUtxoRef,Bytes,List<Bytes>, andAddressparams).init(participants: vec![vec![1,2]]) and Asteriacreate_shipbyte-name args now encode into theTaggedArgwire form instead of reaching the resolver raw ((-32005) target type not supported: List/value is not bytes), pinned by unit tests.What changed
fix(tii)— the bytes encoder accepts native byte arrays (a codegenVec<u8>serializes to a JSON integer array) and canonicalizes them to0x-prefixed hex, per SDK spec §3.9. Regression tests cover the Hydrainitparticipants/parties/head_idand Asteria pilot/ship-name shapes.fix(facade)— the root-cause trace: the type-directed encoder ran only on the dynamictii::Invocationpath; the facade path (Tx3Client/TxBuilder, used by both hand-written facade code and codegen-generated bindings) sent args raw.TxBuildernow carries aParamMapandbuild_resolve_paramsmarshals every matching arg.Tx3ClientBuilderthreads per-tx params — automatic from a loadedProtocol(newProtocol::tx_params), explicit for codegen via newwith_tx_params.tii::params_from_schemais now public.from_partsis unchanged, so existing generated clients keep compiling (args pass through unencoded, as before).fix(codegen)—.trix/client-lib/lib.rs.hbsimportsUtxoRefandAddress(same defect class:schemaTypeForemits both bare names; previously any protocol declaring either failed to compile), embeds per-tx params schemas +components.schemas, and wires them throughwith_tx_params. GeneratedCargo.tomlfloor bumped to^0.15.0(first release carrying the new API).Audit note (plan step 1): no stale
tx3_sdk::signer::path exists anywhere in this repo — the broken form lives in docs/registry snippets owned by another plan (feedback-cba-07).Verification
cargo test --lib: 32 passed (23 baseline + 9 new).cargo test --test smoke: pass.cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings: clean.tx3c codegen(built fromtx3-lang/tx3at the pinned toolchain commit) rendered.trix/client-libagainst a fixture withUtxoRef/Bytes/List<Bytes>/Addressparams; the generated crate builds against this branch's SDK.Ed25519Signer,CardanoSigner,Party::signerexamples) fail at the base commit — they use?wheretx3_sdk::ErrorlacksFrom<SignerError>. CI only runscargo test --lib, so CI is unaffected.Escalations / follow-ups
trixusers only when thecodegen-v1beta0tag is re-pointed after atx3-sdk0.15.0release publishes — ordering: merge → release 0.15.0 → re-point tag.🤖 Generated with Claude Code