Repository navigation
Conversation
lisicky
force-pushed
the
feat/tx-emulator
branch
from
October 12, 2026 18:26
420e387 to
65a6f93
Compare
lisicky
force-pushed
the
feat/tx-emulator
branch
from
October 22, 2026 15:46
65a6f93 to
0c66ffb
Compare
lisicky
force-pushed
the
feat/tx-emulator
branch
from
October 29, 2026 01:06
0c66ffb to
062509c
Compare
lisicky
changed the base branch from
main
to
feat/governance-fetcher-interfaces
October 29, 2026 01:06
This branch has not been deployed
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.
Merge #864 first: this PR builds on its
IGovernanceFetcherandIStakePoolFetcherinterfaces.What
Adds
@meshsdk/tx-emulator, a local Cardano ledger for trying transactions out, alone or in chains.simulate(tx)reports what a transaction would do without changing anything.submit(tx)applies it, and every later transaction is checked against the result.@meshsdk/scalus-emulator. Transactions are validated by the validator the caller picks:"scalus"(built in) or"cquisitor"(@cardananium/cquisitor-lib, an optional peer dependency).IFetcher,IGovernanceFetcher,IStakePoolFetcher,ISubmitterandIEvaluator, so transactions are built and submitted against it with the usual Mesh tools.TxEmulator.fromChain(tx, …)builds a ledger holding the chain state a transaction reads, from providers, to check the transaction against the chain as it is now.Contents
packages/mesh-tx-emulator(new):TxEmulator.create(options)sets the starting state:validator(required) and the network (mainnet by default);simulate(tx, options?)/submit(tx, options?)take CBOR hex or aTransactionPrototypeand return:txHash,fee,isValid,redeemers(execution units each script used),consumedandproducedUTxOs (the collateral and its return for a transaction marked phase-2 invalid), script logs and warnings;errors, each with its ledgerruleandmessage; with cquisitor every problem, with ahint,locationsand thephase.{ requireSignatures: false }checks a transaction before anyone signs it: missing key witnesses are not reported, native scripts pass when they would once signed, and the fee and the size limit are checked as they will be once it is signed.submitTxsubmits like any Mesh submitter and throws aTxRejectedErrorcarrying the result.fetchAccountInfo,fetchPoolState,fetchDRepState,fetchGovernanceProposal,fetchCommitteeState, …) andutxos(filter).addUtxos/removeUtxos,setAccount/removeAccount,setPool/removePool,setDRep/removeDRep,setGovernanceAction/removeGovernanceAction,setLastEnacted,setCommitteeMember/removeCommitteeMember,setTreasury,setConstitution,setProtocolParameters. Asetmerges into an existing item (nullclears a field) and pays or refunds no deposit.fork(): an independent copy of the whole ledger, so one setup can branch into several scenarios.advanceTo({ slot } | { time } | { epoch }), forward only. Entering an epoch retires the pools due to retire (their deposits go back to their reward accounts), adds the previous epoch's donations to the treasury, and removes the governance actions past their lifetime, returning their deposits. No rewards are paid, and no governance actions are ratified or enacted.TxEmulator.fromChain(tx, { validator, fetcher, governance?, pools?, network? })reads the outputs the transaction spends and references, the protocol parameters and cost models, and the stake addresses, pools, DReps, governance actions and committee it touches, plus the treasury and the constitution. State no provider reports, or reports in a form that cannot be read, is taken to be as each transaction needs it and listed as aNotCheckedwarning, never as an error.fromChain, time and limits.packages/mesh-scalus-emulator: exports the existingtoMeshUtxo/fromMeshUtxoconverters, so the new package seeds the ledger with them instead of duplicating them. No behaviour change.Repo wiring:
build.ymlruns the new package's tests next to the scalus-emulator ones.publish.ymlgets a publish job for it.bump-version.shnow covers the package, and the@meshsdk/scalus-emulatordependency pin, which it did not rewrite before.@cardananium/cquisitor-lib; npm hoistsscalusto the root instead of keeping two nested copies.Validation
@meshsdk/tx-emulator: 122 tests.fromChainsuite run on both validators: chains of transactions, dry runs, forks, time and epoch boundaries, direct state changes, the provider interfaces, and checks against a chain read through plain and governance-capable fetchers.