Skip to content

test: Cardano Shelley pointer addresses, header/prefix mismatches and network-policy options are untested #3

Closed

Description

@Dhananjay-alt

Uncovered: cardano.ts 23, 26, 30–31, 41–44 (the pointer varint parser and the tag/HRP checks). There are also no tests for network: 'auto', allowTestnet: false, or the details returned on NETWORK_MISMATCH. tests/cardano_debug.test.ts is a single leftover debug case.

Proposed fix (PR to follow): added the CIP-19 pointer and enterprise vectors and 12 crafted rejection cases (non-minimal or unterminated varints, a cert index above 16 bits, trailing bytes, reserved header type, wrong HRP for the network tag, Bech32m). Added tests/network-policy.test.ts, merged the debug test into cardano.test.ts, and added Aptos format tests and Base58Check error-path tests.

Overall coverage: branches 91.8% → 95.4%, tests 220 → 275.

Activity

  1. Dhananjay-alt commented on Nov 21, 2026

    @Dhananjay-alt
    ContributorAuthor

    Fixed in #10.

    Added CIP-19 pointer/enterprise vectors, 12 Shelley rejection cases and tests/network-policy.test.ts (commit f0962c9). The cardano_debug test is folded into cardano.test.ts.

  2. Samarth208P commented on Nov 21, 2026

    @Samarth208P
    Owner

    I’d narrow this to the assertions we’re missing. tests/regressions.test.ts already runs all 20 CIP-19 vectors, including pointer addresses, and checks allowTestnet: false for Cardano. The differential suite also rejects malformed pointer fields and header/network prefix mismatches. Both suites passed on main.

    The useful additions are a reserved network-tag rejection in Vitest and a public-result assertion that NETWORK_MISMATCH retains the decoded Cardano network and format. An explicit network: 'auto' case can sit beside those. Another copy of the positive vectors adds little.

  3. added a commit that references this issue on Nov 21, 2026
    2a57fe6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions