[BUG] - cardano-submit-api cannot decode Dijkstra era transactions
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza en cardano-submit-api/src/Cardano/TxSubmit/Web.hs, en readByteStringTx, donde el issue muestra que la lista de decodificadores de eras termina en Conway. Lee el arreglo de cardano-cli enlazado en el issue para tener contexto y luego revisa las pruebas de la API de submit mencionadas en el informe, especialmente los casos de Dijkstra. El trabajo estará terminado cuando las transacciones Dijkstra con codificaciones modificadas de los campos del body se decodifiquen y se envíen, en lugar de fallar con TxCmdTxReadError.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Internal/External
Internal
Area
Other (cardano-submit-api)
Summary
cardano-submit-api has no Dijkstra decoder. readByteStringTx in cardano-submit-api/src/Cardano/TxSubmit/Web.hs lists the eras by hand, and the list ends at Conway:
readByteStringTx = firstExceptT TxCmdTxReadError . hoistEither . deserialiseAnyOf
[ FromSomeType (AsTx AsShelleyEra) (InAnyShelleyBasedEra ShelleyBasedEraShelley)
, FromSomeType (AsTx AsAllegraEra) (InAnyShelleyBasedEra ShelleyBasedEraAllegra)
, FromSomeType (AsTx AsMaryEra) (InAnyShelleyBasedEra ShelleyBasedEraMary)
, FromSomeType (AsTx AsAlonzoEra) (InAnyShelleyBasedEra ShelleyBasedEraAlonzo)
, FromSomeType (AsTx AsBabbageEra) (InAnyShelleyBasedEra ShelleyBasedEraBabbage)
, FromSomeType (AsTx AsConwayEra) (InAnyShelleyBasedEra ShelleyBasedEraConway)
]
Simple Dijkstra transactions still go through, because the Conway decoder happens to accept them. That hides the bug. It shows up as soon as a transaction uses a body field whose encoding changed in Dijkstra. For example, required signers (body field 14) are now encoded as credentials ([0, keyhash]) where Conway expects plain key-hash bytes. Such a transaction is rejected with HTTP 400:
{"contents":{"contents":[
"DecoderErrorDeserialiseFailure \"Shelley Tx\" (DeserialiseFailure 3 \"expected list len or indef\")",
"DecoderErrorDeserialiseFailure \"Shelley Tx\" (DeserialiseFailure 3 \"expected list len or indef\")",
"DecoderErrorDeserialiseFailure \"Shelley Tx\" (DeserialiseFailure 3 \"expected list len or indef\")",
"DecoderErrorDeserialiseFailure \"Shelley Tx\" (DeserialiseFailure 3 \"expected list len or indef\")",
"DecoderErrorDeserialiseFailure \"Shelley Tx\" (DeserialiseFailure 3 \"expected list len or indef\")",
"DecoderErrorDeserialiseFailure \"Shelley Tx\" (DeserialiseFailure 260 \"expected bytes\")"
],"tag":"TxCmdTxReadError"},"tag":"TxSubmitFail"}
The same transactions submitted with cardano-cli transaction submit work: valid ones are accepted, and the negative test gets the expected ledger error instead of a decoding failure.
The code is unchanged on master (b05d8ef62), on leios-prototype, and on the 11.2 release prep branch koslambrou/prepare-11.2 (8ff994d2f). The pinned cardano-api (^>= 11.7) already provides AsDijkstraEra / ShelleyBasedEraDijkstra, so only cardano-submit-api needs to change.
Steps to reproduce
- Start a local testnet in the Dijkstra era (protocol version 12).
- Build and sign a transaction with a required signer, e.g.
cardano-cli dijkstra transaction build ... --required-signer-hash <keyhash>. - POST the raw CBOR to
/api/submit/txwithContent-Type: application/cbor. - The request fails with the
TxCmdTxReadErrorshown above.
Found by the cardano-node-tests tests test_mint_build.py::test_witness_redeemer[*-submit_api] and test_mint_negative_build.py::test_witness_redeemer_missing_signer[submit_api-*]. All other submit_api tests pass on Dijkstra.
Expected behavior
Dijkstra transactions are decoded and submitted.
System info
- OS Name: Fedora Linux 44
- Node version: cardano-node 11.1.0.164 - linux-x86_64 - ghc-9.6, git rev 8bb6b68d80a8a4fb1904c48805be4f3a516593ef
- CLI version: cardano-cli 11.2.2.0 - linux-x86_64 - ghc-9.6, git rev 8bb6b68d80a8a4fb1904c48805be4f3a516593ef
- cardano-submit-api 11.0.0 (same build)
Additional context
cardano-cli had the same kind of hardcoded era list when reading transaction witnesses. It was fixed in IntersectMBO/cardano-cli@6605fa151 ("Derive the accepted era list when reading transaction witnesses"), which builds the list from [minBound .. maxBound]. The same approach would work here.
- Lenguaje dominante
- Haskell
- Estrellas
- 3.2k
- Forks
- 757
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de IntersectMBO/cardano-node
-
Stale
Dificultad 1/5 1-3 horas Aptitud para principiantes 75/100
IntersectMBO/cardano-node#6597 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Stale
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
IntersectMBO/cardano-node#6578 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
IntersectMBO/cardano-node#6522 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
increase in memory usageAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
IntersectMBO/cardano-node#6718 ·
Los mantenedores suelen responder en 2 días
-
needs triage
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
IntersectMBO/cardano-node#6714 ·
Los mantenedores suelen responder en 2 días
Todos los issues de IntersectMBO/cardano-node
Issues similares
-
plutus
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
IntersectMBO/cardano-ledger#6152 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
fmidue/prolog-programming-task#55 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
objectionary/phino#1752 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día