Skip to content

Unicity ID mint transaction is missing network id #71

Closed

Description

@martti007

We need to add network ID to unicity ID mint transaction as well.

It must be solved similar to unicitynetwork/state-transition-sdk-js#123

Activity

  1. self-assigned this
    on Jun 15, 2026
  2. added a commit that references this issue on Jun 15, 2026
  3. linked a pull request that will close this issue#71 Add network id to unicity id minting #72on Jun 15, 2026
  4. moved this to Test in Unicityon Jun 15, 2026
  5. b3y0urs3lf commented on Jun 18, 2026

    @b3y0urs3lf
    Contributor

    Closing comment — issue #71 / PR #72 test verification

    Tested on top of: origin/issue-71 @ d9c12e2 ("#71 Update CertificationStatus equals and hashcode method" — current tip), merged into bdd-phase-0 of
    state-transition-sdk-java. The full hermetic + live test suite that was already in place for #68 was re-run against this combined source state.

    Test environments verified:

    • Hermetic (in-process ForgivingTestAggregatorClient) — full BDD suite, ~25s
    • Live, 2-shard bft — aggregator-go's bft-sharding compose (haproxy-bft-shard0 on localhost:3001, haproxy-bft-shard1 on localhost:3002), trust-base networkId=3, ~2m
      end-to-end, 4-way parallel

    Result: 0 failures in both environments. Total 423 tests across the combined suite.

    Live run env vars:
    SHARD_ID_LENGTH=1
    SHARD_ROUTING_MODE=msb
    SHARD_2_URL=http://localhost:3001
    SHARD_3_URL=http://localhost:3002
    TRUST_BASE_PATH=trust-base.json

    Source changes in PR #72 — coverage map

    1. UnicityIdMintTransaction.create(networkId, lockScript, recipient, unicityId, tokenType, targetPredicate) — networkId added as first arg

    • Mode: hermetic
    • Pinned by: unicity-id-mint-transaction-envelope.feature round-trip pins networkId; 3 call sites migrated (FieldRoundtripSteps, CommonTestFlow, NametagRegistry)

    2. CBOR envelope arity 6 → 7, slot layout [version, networkId, lockScript, recipient, unicityId, tokenType, targetPredicate]

    • Mode: hermetic
    • Pinned by: unicity-id-slot-pinning.feature (6 scen, asymmetric per-slot fillers — encoder/decoder slot-swap regressions are observable); cbor-envelope-tags wrong-tag +
      wrong-version rows bumped 6 → 7

    3. Wire-level NetworkId guard (0, ≥65536 rejected at decode)

    • Mode: hermetic
    • Pinned by: unicity-id-wire-mutation.feature (2 scen — adversarial decode of arity-7 with networkId mutated to 0 / 65536)

    4. TokenId derivation rewired to TokenId.fromSalt(networkId, unicityId.toTokenSalt())

    • Mode: hermetic
    • Pinned by: unicity-id-mint-canonicalization.feature — tokenId round-trip preservation + two-build determinism (same logical inputs → byte-identical CBOR + same tokenId) +
      cross-networkId malleability (same UnicityId on different networkIds → different TokenIds)

    5. MintNetworkMatchesTrustBaseRule wired into CertifiedUnicityIdMintTransactionVerificationRule as the first check (FAIL-first short-circuit)

    • Mode: live
    • Pinned by: unicity-id-network-consistency.feature (2 live scen) — positive control + swapped-networkId trust base ⇒ rule surfaces FAIL by name

    6. Issuer-pinning branch (issuerPublicKey != null → reconstructs expected EncodedPredicate and matches against genesis lock-script)

    • Mode: live
    • Pinned by: unicity-id-issuer-pinning.feature (2 live scen) — true issuer key → OK; unrelated issuer key → FAIL with IsLockScriptValidVerificationRule in the result tree

    7. CertificationStatus refactored from enum to final class with explicit equals/hashCode

    • Mode: hermetic + live
    • Pinned by: SUCCESS reference equality still holds across full suite (10 .name() call sites migrated to .getValue())

    Live network-rule scenarios — all PASSED end-to-end

    ✅ NetworkId consistency in Token.verify (#116) — Positive control
    ✅ NetworkId consistency in Token.verify (#116) — Mint rejected against swapped-networkId trust base
    ✅ NetworkId consistency in Token.verify (#116) — Transferred token rejected against swapped trust base
    ✅ UnicitySealNetworkMatchesTrustBaseRule isolation (#116) — Mint rule passes OK while Seal rule fails
    ✅ Signature verification rule name format (#115 bug-2 regression guard) — no trailing }
    ✅ Mint re-spend tolerance (T6 under #115) — second mint at same stateId is never finalised
    ✅ UnicityIdToken network consistency (#71) — Positive control
    ✅ UnicityIdToken network consistency (#71) — Swapped-networkId trust base rejected
    ✅ UnicityIdToken issuer-pinning (#71) — True issuer key OK
    ✅ UnicityIdToken issuer-pinning (#71) — Unrelated issuer key surfaces IsLockScriptValidVerificationRule FAIL

    Coverage scope vs. cross-SDK brief

    Mirrors the JS SDK test work for state-transition-sdk-js#115/#116/#122 (sdk-js PRs #119 + #123). Required-item completion: 26 of 28.

    The 2 not done:

    • unicity-id-predicate-verifier (5 JS scen) — no Java equivalent. Java has no UnicityIdPredicate class; nametag addressing reduces to a SignaturePredicate on the nametag
      token's targetPredicate (AddressingSteps.resolveRecipientPredicate), which is already covered by the existing addressing / mixed-addressing scenarios.
    • deferred-coverage placeholder — cosmetic CI-slot warm-up; no Java need.

    Two extras added beyond the brief:

    • Issuer-pinning live coverage (exercises the second branch of CertifiedUnicityIdMintTransactionVerificationRule.verify that the brief's network-consistency feature skips via
      issuerPublicKey=null)
    • Cross-networkId malleability scenario in unicity-id-mint-canonicalization (the symmetric assertion that P1's token-id-derivation pins for the regular mint path)

    Verdict

    The functional intent of PR #72 is delivered and verified end-to-end — both hermetic and live tests confirm the new networkId slot round-trips through the envelope, the new
    MintNetworkMatchesTrustBaseRule fires on mismatch with the expected rule name, the decoder rejects out-of-range networkIds, the IsLockScriptValidVerificationRule branches behave
    correctly, and the CertificationStatus refactor doesn't regress SUCCESS reference equality across the suite. No regressions in the broader #68 work.

  6. added a commit that references this issue on Jun 18, 2026
  7. moved this from Test to Done in Unicityon Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions