Repository navigation
test: assert Cardano reserved network tags and mismatch details - #15
Merged
Samarth208P merged 1 commit intoNov 21, 2026
Merged
Conversation
Add the assertions that were missing from the existing CIP-19 and differential coverage: - Shelley headers with a reserved network tag (2, 3, 7, 14, 15) are rejected; a re-encoded vector with its original header is the control - NETWORK_MISMATCH keeps the decoded network and format for Shelley mainnet/testnet and Byron - an explicit network: 'auto' accepts mainnet, testnet and Byron Vectors are re-encoded from the published fixtures with @scure/base. Closes Samarth208P#3
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.
Closes #3.
This adds only the assertions the issue says are missing. The 20 CIP-19 positive vectors already in
tests/regressions.test.tsare not duplicated. It changes no library code, so nothing changes for users.What's covered
New tests in
tests/cardano.test.ts:INVALID_FORMAT. The tag is changed by re-encoding a published fixture with@scure/base. As a valid control, the same vector re-encoded with its original header still passes.NETWORK_MISMATCHdetails: the exact public result keeps the decoded network and format. This is checked for a Shelley testnet address withnetwork: 'mainnet', a Shelley mainnet address withnetwork: 'testnet', and the existing Byron testnet example withnetwork: 'mainnet'.network: 'auto': accepts the Shelley mainnet, Shelley testnet and Byron fixtures.Results
npm ci,npm run checkandnpm audit(0 vulnerabilities) on Node 22.23.5, 24.16.0 and 26.13.1, andnpm run test:coverageon Node 24.16.0. All passed.