Repository navigation
pset: sign an issuing input over its own outpoint and denomination - #31
Merged
GracedEternalKingCabbageMan merged 1 commit intoOct 3, 2026
Conversation
A PSET made from a transaction with an issuing input (from_tx, as a caller holding a whole transaction signs it) extracted another transaction than the one given, so the signature covered another hash: - Input::from_txin set bit 31 of the output index to mark the issuance, and extract_tx and issuance_ids read the index as the outpoint's. The transaction signed spent output 2^31 + n, and the issued asset's id was computed over it. - Input::asset_issuance() wrote denomination 8 whatever the issuance said. Sequentia serializes the denomination after the inflation keys, so it is part of the signature hash. The issuance is no longer flagged in the index (Elements Core's PSET does not flag it either), and Input::previous_outpoint() masks off any flag a PSET carries there, as upstream rust-elements 0.27 does; the extracted transaction, the asset id and the kit's readers of an input's outpoint use it. The denomination has no PSET field, so it is kept in a proprietary key (prefix "sequentia", subtype 0), written only when it is not the default 8, so existing PSETs serialize as before. The new tests fail before this change: the outpoint came back as vout 2147483648, the denomination as 8, and the kit's signature over an issuing input did not verify against the transaction's own sighash.
GracedEternalKingCabbageMan
deleted the
fix/pset-issuance-outpoint-denomination
branch
October 3, 2026 12:31
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.
A caller that holds a whole transaction signs it by making a PSET from it (
PartiallySignedTransaction::from_tx). For an input that issues an asset, that PSET extracted a different transaction from the one given, so the signature covered the wrong hash. The Arca server worked around both defects:Input::from_txinset bit 31 of the output index to mark the issuance.extract_txandissuance_idsthen read that index as the outpoint's, so the signed transaction spent output 2^31 + n, and the issued asset's id was computed over that outpoint.Input::asset_issuance()wrote denomination 8 whatever the issuance said. Sequentia serializes the denomination after the inflation keys, so it is part of the signature hash.The fix:
Input::previous_outpoint()masks off any flag a PSET carries there, as upstream rust-elements 0.27 does. The extracted transaction, the asset id and the kit's readers of an input's outpoint all use it.sequentia, subtype0x00, one byte). The key is written only when the denomination is not the default 8, so existing PSETs serialize exactly as before.Each defect has a test that fails before this change:
rust-elementsan_issuance_input_keeps_its_outpoint: the outpoint came back withvout: 2147483648instead of 0.an_issuance_input_keeps_its_denomination: the denomination came back as 8, not 0.lwk_signeran_issuing_input_is_signed_over_its_own_transaction: the kit's signature did not verify against the transaction's own sighash ("signature failed verification").On regtest (node v24.7.12,
elementsregtest,-par=1), a P2WPKH coin issued an asset and was signed through the kit's PSET signer:mempool-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)). Forced into a block withgenerateblock, it was refused again (TestBlockValidity failed: mempool-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)). This held at denominations 8 and 2.denominationas set.Suites:
rust-elements91 tests withoutsequentiaand 86 with it, plus 14 doc-tests;lwk_signer26 (27 withark);lwk_common40;lwk_wolletark::22.