Skip to content

Implement ValidateTx query for LocalStateQuery protocol#2052

Draft
palas wants to merge 3 commits into
mainfrom
tx-validation
Draft

Implement ValidateTx query for LocalStateQuery protocol#2052
palas wants to merge 3 commits into
mainfrom
tx-validation

Conversation

@palas
Copy link
Copy Markdown

@palas palas commented May 27, 2026

Description

Implements the ValidateTx query in the Shelley ledger query infrastructure, allowing clients to validate transactions against the node's real ledger state and UTxO via the LocalStateQuery protocol.

Part of IntersectMBO/cardano-cli#1380.

Big picture: transaction validate currently applies applyTx client-side with an empty UTxO set, making it unable to properly validate transactions. This cross-repo change adds a new ValidateTx query to the LocalStateQuery protocol so the node validates transactions against its real ledger state and UTxO set.

transaction validate PR list:

What this PR does

  • Adds ValidateTx constructor to BlockQuery (ShelleyBlock proto era) with QFLookupTables footprint, so the query has access to the on-disk UTxO via a ReadOnlyForker
  • Implements the ValidateTx handler in answerShelleyLookupQueries: reads the ledger state from the forker, looks up the transaction's UTxO inputs, injects them into the ledger state, and runs applyShelleyBasedTx
  • Threads a getShelleyLedgerState action through answerShelleyLookupQueries so lookup queries can access the Shelley ledger state regardless of whether the block type is ShelleyBlock or HardForkBlock
  • Adds ShelleyNodeToClientVersion16 gating ValidateTx to NodeToClientV_24
  • Adds CardanoNodeToClientVersion20 pattern mapping all eras to ShelleyNodeToClientVersion16
  • Maps NodeToClientV_24 to CardanoNodeToClientVersion20 in supportedNodeToClientVersions and updates latestReleasedNodeVersion
  • Maps NodeToClientV_24 -> QueryVersion3 in nodeToClientVersionToQueryVersion
  • Updates serialisation, Show, and Eq instances for the new query and version constructors across Shelley, Cardano, and HFC layers

Also note that:

  • New code should be properly tested (even if it does not add new features).
  • The fix for a regression should include a test that reproduces said regression.

WARNING

To update your feature branch if it's stale, please rebase it manually on top of main. Don't update your feature branch by merging main into it. Your pull request will not pass CI if you do.

palas added 3 commits May 27, 2026 03:57
Adds a new BlockQuery constructor `ValidateTx` that validates a
transaction against the current ledger state without submitting it.
Gated behind ShelleyNodeToClientVersion16 / NodeToClientV_24.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant