Repository navigation
chore: drop @meshsdk/core-csl and implement TxParser on core-cst - #868
Merged
Merged
Conversation
Replace the throwing `parser` stub of CardanoSDKSerializer with CardanoSDKTxParser, built on the cardano-sdk Serialization layer, so that TxParser and TxTester no longer need @meshsdk/core-csl. The parser rebuilds a MeshTxBuilderBody from a transaction and its resolved UTxOs: - inputs (pub key / Plutus / native script; provided or reference scripts; inline, witness-set and hash-only datums; spend redeemers by ledger order), collaterals and reference inputs with script sizes - outputs with hash / inline / embedded datums and Plutus or native reference scripts; change address = last output - mints (Plutus and native, grouped by policy), withdrawals (reward account order), certificates incl. pool registration and the deposit stated by certificates 7 and 8, votes and proposals of every governance action kind incl. protocol parameter updates (a cost model of a language Mesh has no version for, PlutusV4, is left out) - metadata (nested maps, integer keys, byte strings, big integers), script metadata, validity range, required signers, total collateral, collateral return address and donation - getRequiredInputs lists inputs, collateral and reference inputs Switch the TxParser and TxTester tests to CardanoSDKSerializer.
Remove the core-csl package (CSLSerializer, the whisky OfflineEvaluator and the whisky-based TxParser) now that core-cst covers everything it provided: CardanoSDKSerializer is the only IMeshTxSerializer, OfflineEvaluatorScalus the only offline evaluator and CardanoSDKTxParser backs TxParser/TxTester. - delete packages/mesh-core-csl and its lockfile entries (@sidan-lab/whisky-js-browser, @sidan-lab/whisky-js-nodejs, whisky-evaluator) - MeshTxBuilder: its serializer option names CardanoSDKSerializer only - tests: migrate to CardanoSDKSerializer / OfflineEvaluatorScalus, drop the duplicated CSL-vs-CST builds and the CSL-only cases; the serializeData helper and the serializer-utils test use core-cst (fromBuilderToPlutusData, normalizePlutusScript) - CI: remove the publish-meshsdk-core-csl job and the bump-version entry - docs: README package table and diagram, core README, transaction README, PR template, copilot instructions, tx-prototype design note, code comments validateTx (unused) is removed without a replacement.
The ledger runs a voter's script once for all of its votes and indexes the voting redeemer by the position of the voter in the ordering of the voting procedures (committee members, then DReps, then pools; script credentials before key hashes). serializeTxBody declared one redeemer per vote, indexed by the vote's position, so a script DRep voting on two actions produced redeemers 0 and 1 and an invalid transaction. - serializer: collect one redeemer per voter, reject conflicting redeemers for the same voter, index by the sorted voters of the body - MeshTxBuilder: refuse votes of one voter that give different redeemers (WITNESS_MISMATCH) instead of keeping the first - parser: reuse the voter ordering helpers now in `utils/vote.ts`
`toCardanoOutput`, which `serializeTxBody` uses for every output, only handled Plutus reference scripts and silently dropped a native one; `serializeOutput` already treated any other version marker as a native script. Do the same in the core path.
lisicky
force-pushed
the
chore/drop-core-csl
branch
from
November 28, 2026 13:52
d2c9e39 to
f82a4c7
Compare
twwu123
approved these changes
Nov 28, 2026
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
@meshsdk/core-cstbecomes the only serializer backend:@meshsdk/core-csl(CSLSerializer, the whiskyOfflineEvaluatorand the whisky-basedTxParser) is removed from the monorepo. The one thing core-csl still did that cst could not, parsing a transaction back into aMeshTxBuilderBodyforTxParser/TxTester, is implemented on the cardano-sdk Serialization layer asCardanoSDKTxParser, soCardanoSDKSerializer.parserworks instead of throwing. Reviewing that work turned up two serializer bugs, which are fixed here as well.Five commits, meant to be read in order:
feat(core-cst): implement ITxParser for CardanoSDKSerializer—packages/mesh-core-cst/src/parser/. Inputs (key / Plutus / native, provided or reference scripts; inline, witness-set and hash-only datums), collaterals, reference inputs with script sizes, outputs with datums and reference scripts, mints grouped by policy, withdrawals, certificates incl. pool registration and the deposit that certificates 7 and 8 state, votes and proposals of every governance action kind (incl. protocol parameter updates), metadata, validity range, required signers, total collateral, collateral return and donation. Redeemers are matched to their targets in ledger order (inputs by(txid, index), mints by policy id, withdrawals by reward accountOrd, votes by voter), whatever order the transaction encodes them in. TheTxParser/TxTestertests run on cst.chore: drop @meshsdk/core-csl— the package, its lockfile entries (whisky), the publish job,bump-version.sh, docs; tests migrated toCardanoSDKSerializer/OfflineEvaluatorScalus, duplicated CSL-vs-CST cases dropped. Theserializeroption ofMeshTxBuildernamesCardanoSDKSerializeronly.@meshsdk/corenever depended on core-csl; only a doc comment changes there.fix: index voting redeemers by voter in ledger orderfix(core-cst): keep native reference scripts on outputstest(core-cst): cover an invalid scriptRef on a resolved reference inputThe two fixes
Voting redeemers were indexed per vote. The ledger runs a voter's script once for all of its votes and indexes the redeemer by the voter's position among the voting procedures (committee members, then DReps, then pools; script credentials before key hashes).
serializeTxBodypushed one redeemer perScriptVote, indexed by the vote's position in the body, so a script DRep voting on two governance actions produced redeemers0and1and an invalid transaction. The serializer now keeps one redeemer per voter, indexes it by the sorted voters of the body and rejects different redeemers for one voter (The same voter must have the same redeemer).MeshTxBuilder, which builds onTxBuilderand already declares one redeemer per voter, kept the redeemer of a voter's first vote and dropped the others; it now refuses votes of one voter that give different redeemers (WITNESS_MISMATCH). The voter ordering helpers live incore-cst/src/utils/vote.tsand are used by the parser too.toCardanoOutputdropped native reference scripts.serializeTxBodybuilds every output through it, and it only handledV1/V2/V3;serializeOutputalready treated any other version marker as a native script. The core path now does the same.Affect components
@meshsdk/common— a doc comment, theTxTestertests@meshsdk/contract@meshsdk/core— doc comment only@meshsdk/core-cst— parser and serializer changes@meshsdk/hydra@meshsdk/provider@meshsdk/react@meshsdk/svelte@meshsdk/transaction—MeshTxBuilder: theserializeroption, the votes of one voter@meshsdk/walletType of Change
CardanoSDKTxParser@meshsdk/core-cslis no longer part of the monorepo and is not published from it any more;validateTxgoes without a replacement. Consumers importCardanoSDKSerializer,OfflineEvaluatorScalusandCardanoSDKTxParserfrom@meshsdk/core-cst.Behaviour changes to be aware of
serializeTxBodyof a body with a script voter casting several votes declares one voting redeemer (it used to declare one per vote, which the ledger rejects). TwoScriptVotes of one voter with different redeemer data or budgets are rejected at serialization.MeshTxBuilderrefuses votes of one voter that give different redeemers (WITNESS_MISMATCH): different data, or different budgets when it keeps the declared ones (evaluator: null); it used to build with the first one's.serializeTxBody(they were silently dropped).OfflineEvaluatorScalusis the only offline evaluator.Parser limitations
Documented on
parseTxBuilderBody:feeof the parsed body is left at the body default"0".MeshTxBuilder.complete()takes any non-empty fee as fixed, so drop or override it before rebuilding (the round-trip tests do).coin; built again, it becomes certificate 7 or 8 with the protocolkeyDeposit.{ type: "Hash", data: { type: "CBOR", content: <hash> } }, sinceOutput.datumhas no hash-only form.Output.referenceScriptis typedPlutusScript; a native reference script comes back as{ code, version: "Native" }behind a cast, which is what the serializer expects.serializeTxBodystill follow the order of the body's withdrawals.Related Issues
None.
Checklist
test/parser/tx-parser.test.ts(43 cases: every parsed part, ledger-order redeemer matching, round trips),vote-redeemers.test.tsin both core-cst and mesh-transaction, the native reference script case inref-script-output.test.tsnpm run test)npm run build:mesh)Verification
Run locally after
npm run build:mesh:Root
npm test(turbo): 9 of 9 tasks successful.npm run lint,build:docs,build:apps,build:scripts, thetest:packagechecks of core-cst and scalus-emulator andtest:scalus-packagespass too.The tests added with the fixes fail on the code before them (4 in core-cst, 1 in mesh-transaction); each commit builds on its own.
Additional Information
_backup/apps/**still mentionsCSLSerializer; it is not built and is left alone.tx-prototype-to-cbor/*that cite whisky's Rust sources as the reference for the port are kept.