Skip to content

cardano-cli transaction build fails with CBOR element count mismatch (V21+ PParams encoding) #336

@michaeljfazio

Description

@michaeljfazio

Problem

cardano-cli latest transaction build fails when connecting to the torsten N2C server:

DeserialiseFailure 2073729 "Final number of elements: 41315 does not match the total count that was decoded: 41319"

While query tip, query protocol-parameters (JSON output), and query utxo all work correctly, transaction build fails when deserializing the protocol parameters response from a different code path.

Environment

  • cardano-cli 10.15.0.0
  • Negotiated N2C version: V23 (likely)

Root cause

N2C V21 (ShelleyNtCv13) introduced new codecs for PParams. Our PParams CBOR encoding likely uses the pre-V21 format but is served to a V21+ client. The element count mismatch (41319 decoded vs 41315 declared) suggests 4 extra elements in a cost model or parameter array.

Workaround

Use transaction build-raw with calculate-min-fee and a locally-saved protocol-parameters JSON file instead of transaction build (which queries the node internally).

Investigation needed

  1. Compare our PParams CBOR array encoding against the V21+ spec
  2. Check cost model array lengths (PlutusV1=166, PlutusV2=175, PlutusV3=233)
  3. Consider limiting advertised N2C versions to V20 until the encoding is fixed
  4. May need version-aware PParams encoding in the query response path

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmediumMedium severity - monitor and improveprotocolCardano protocol compliance

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions