addresses the four TODO comments in pallas-txbuilder/src/transaction/model.rs
and conway.rs around auxiliary_data + auxiliary_data_hash. without this the
conway builder hardcodes auxiliary_data: None, which blocks CIP-20 / CIP-25
/ CIP-68 metadata.
implementation:
- new StagingTransaction field: pub auxiliary_data: Option<Vec<u8>>.
stored as opaque cbor bytes (caller encodes alonzo::AuxiliaryData) since
AuxiliaryData itself doesn't impl Eq, which the rest of StagingTransaction
requires.
- builder methods .auxiliary_data(cbor) and .clear_auxiliary_data().
- conway::build_conway_raw now decodes the bytes back into
AuxiliaryData::decode_fragment and plugs it into pallas_tx.auxiliary_data.
the existing auxiliary_data_hash population block is unchanged — it
already computes the hash from pallas_tx.auxiliary_data after assignment.
- decode failures map to TxBuilderError::CorruptedTxBytes.
tests:
- auxiliary_data_round_trips_through_build: encodes a CIP-25-shaped
metadata, attaches, builds, decodes resulting tx, asserts both
body.auxiliary_data_hash matches expected_hash.compute_hash() and the
aux re-encodes byte-equivalent.
- no_auxiliary_data_means_no_hash: confirms the absence path still works
(no aux → hash field stays None).
both pre-existing tests (staging_json_roundtrip, built_json_roundtrip,
test_script_data_hash) continue to pass — the new field defaults to None
and rides alongside.
PR upstream pending; using as a vendored patch via [patch.crates-io] on
the Sulkta side until merge.
* Re-organize and clean-up pallas-primitives
Namely:
- Move _common_ (i.e. era-independent) types and structures up to the
`lib` module; to be shared across all eras. If any of those deviate
in a subsequent era, it is easy to bring them down and define new
types from the point of divergence onward. This simplifies the scope
of each era-specific module and make them slightly easier to
navigate.
Note that, each era module still re-export all of the common types
that's relevant to that particular era. So technically, this
reorganization doesn't really change anything for callers/users of
the library.
- Rename `Scripthash` to `ScriptHash`. Before this commit, both
actually existed as `ScriptHash` was introduced with the Conway era.
Yet, they refer to the same thing, so the duplication is simply
confusing.
- Rename `One` / `Two` constructors for `NetworkId` to `Testnet` and
`Mainnet` respectively. Also defined idiomatic `From` & `TryFrom`
implementation for conversion to and from `u8`. This is a lot let
confusing!
- Generalize `PlutusScript` with a constant generic, to avoid
repetition for each plutus script generated for specific version.
Note that a distinction is still _necessary_ if we want to provie
out-of-the-box serialisers for Plutus scripts, which are serialised
with a tag prefix depending on the language. All else apart, they
are strictly similar types.
- Rename `CostMdls` to `CostModels`. Because, common.
- Rename `plutus_script` to `plutus_v1_script` in the Alonzo's witness
set, for consistency with other eras.
* Fix ordering of ScriptHash variants.
This is an odd one. See the note.
* Bump minicbor to v0.25.1
* Add aliases with deprecation warnings to various fields and types.
* revert renaming plutus_script to plutus_v1_script in Alonzo witness
See https://github.com/txpipe/pallas/pull/523#discussion_r1807329742