cometa-0.2.0.0: test/Fixtures/TRANSACTIONS.md
# Transaction fixture provenance
These fixtures test the private P03 transaction representation. They do not
establish ledger validity, balancing, signing support, or a public transaction API.
The ordinary test suite needs no Python packages and no network access.
## Native baseline and notices
Native source: `Biglup/cardano-c`, revision
`8dc0c55f4132fcaa2e7961b6cfbfea96a6d93b5d`, the original fixture baseline.
The current build revision is recorded in `native/cardano-c.ref`. Imported transaction bytes are from
`lib/tests/transaction/transaction.cpp`, symbol `CBOR_NULLIFY_ENTROPY`, and its
exported counterpart in
`lib/tests/vectors/bindings/v1/serialization.json`, case
`transaction-transaction-cbor-nullify-entropy`.
The original test source is Copyright 2024 Biglup Labs, licensed under Apache-2.0.
The repository's `LICENSE` contains that license. The Haskell fixture file keeps
the project's Apache-2.0 notice; this provenance preserves attribution for the
copied bytes. No native generator or property implementation was copied.
## Historical signed transaction
`Fixtures.Transaction.historical` copies the original 1175-byte transaction,
its exact body, and its exact witness set. It has the older three-element frame
`[body, witnesses, auxiliaryData]`, a fee of 217553, and eight verification-key
witnesses. The body contains historical transaction update data, rather than
being a minimal synthetic envelope.
Independent BLAKE2b-256 of the exact body:
```text
fc863a441b55acceebb7d25c81ff7259e4fc9b92fbdf6d594118fb8f1110a78c
```
All eight original verification-key signatures were independently checked over
that exact digest using Python `cryptography` 48.0.0's
`Ed25519PublicKey.verify`. The body was extracted by a `cbor2` 6.1.2 decoder
tracking byte-stream positions, without re-encoding it, and the digest was
computed with Python's `hashlib.blake2b(body, digest_size=32)`. The digest also
matches the native corpus's `expected.hash`.
The other native `CBOR` and `CBOR2` constants contain verification-key witness
bytes that do not verify over their original body digests. They were deliberately
not used as evidence of valid signed identity.
## Synthetic noncanonical transaction
`noncanonical` uses an explicitly constructed body with reordered keys and a
non-shortest integer encoding for fee 10:
```text
a30219000a018000d9010280
```
Its fields are fee (key 2), empty outputs (key 1), and a tagged empty input set
(key 0), in that order. The empty collections make this an encoding fixture,
not a spendable transaction. Its independently computed body digest is:
```text
6715bbd7c4477c3cc6dd32e3f8e3c513c136dd4cef9d58a275fe1e3b04a6e50b
```
The fixture's Ed25519 signature was generated and verified independently using
`cryptography` 48.0.0 over this digest. Construction uses the public deterministic
native-corpus test seed consisting of bytes 0 through 31; no operational wallet
key is present. Its public key is:
```text
03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8
```
The enclosing frame is `[body, witnesses, true, null]`. The signature and public
key are literal fixture bytes, not values generated by the Haskell code under
test. Equality of the retained witness bytes and exact signed digest establishes
signature preservation; the test-only native oracle also verifies the signature.
`rich` uses the same signed body and vkey witness, adding a bootstrap witness,
a native signature script, noncanonical auxiliary metadata, datum 42, and one
redeemer with execution units
`[10, 20]`. The bootstrap witness reuses the public test key and signature, has a
32-byte chain code consisting of `0x22`, and attributes containing encoded `{}`.
The native script's key hash is 28 bytes of `0x11`. These auxiliary witnesses are
serialization fixtures; no script execution or bootstrap address validation is
claimed. The auxiliary metadata is label 1 with text `aux`, encoded as
`a1017803617578` using a non-shortest text-length encoding. Fee edits preserve
those exact auxiliary bytes. Counts are pinned independently as one vkey, one
bootstrap, one native script, one datum, and one redeemer.
Changing the synthetic fee to 42 produces this expected body:
```text
a300d9010280018002182a
```
Its independent BLAKE2b-256 digest is:
```text
a5412fe55fd15ed71f2e55fdb9c4f8a3105f8e41cb770e2ed848f73f0382a38b
```
The fee-edit policy strips vkey and bootstrap signatures, while preserving native
scripts, datums and redeemers. Setting the original fee is an exact no-op,
including the noncanonical encoding and original signatures.
## Independent native oracle
`test/cbits/transaction_oracle.c` calls native transaction, body, witness and
Ed25519 APIs directly, independently of the production transaction adapter. It
reports fee, body hash, witness-kind counts and the count of valid vkey
signatures. All retained getter references are released on every exit.
The oracle is compiled against the same installed headers and native revision
as the library. Agreement establishes binding consistency; the independent
hash/signature checks above supply evidence beyond native self-agreement.
## CBOR scalar and collection cases
`test/Cbor.hs` contains handwritten primitive major-type examples following
RFC 8949: integer encoding boundaries, byte strings, UTF-8 text, Booleans,
arrays, ordered maps, duplicate keys, tags, and indefinite/non-shortest forms.
The tests distinguish exact raw-item preservation from scalar and collection
marshaling. They do not claim semantic validation of arbitrary tags or ledger
schemas. Tagged bignums are preserved as raw items; primitive integer codecs
cover only `[-2^64, 2^64 - 1]`.
The new Hedgehog generators are written for this project. They exercise 300
cases per law, including deliberately repeated map keys and 64-bit fee edits.
Lifecycle cases repeatedly decode and edit historical transactions, then check
that retained snapshots survive native cleanup and garbage collection. The same
tests can run under Valgrind without any additional fixture dependencies.