Skip to content

feat: support Cardano across both address eras - #9

Merged
oritwoen merged 4 commits into
mainfrom
feat/cardano
Aug 26, 2026
Merged

feat: support Cardano across both address eras#9
oritwoen merged 4 commits into
mainfrom
feat/cardano

Conversation

@aeitwoen

Copy link
Copy Markdown
Contributor

Adds cardano to the registry: coin type 1815, cip34:1-764824073 for CAIP-2, cardanoscan as the explorer, and a validator that takes all three shapes an ADA address actually comes in - Shelley addr1, stake stake1, and Byron base58. Every accepted vector in the tests is lifted straight from CIP-19, bounds included: the bech32 data part runs 53 to 98 characters because Cardano waives BIP-173's 90-char cap, so the limits come from the payload sizes instead. Key is the full name, not the ticker - that's the side #8 picked.

The fun part is Byron. No CBOR parser needed - the envelope is rigid enough that four fixed bytes plus the length byte tying to the total settles it, and that's what keeps Solana keys and Base58Check addresses out. One honest gap: a Byron testnet address still passes, its network hides in an attribute a format check won't open. Shelley testnet prefixes are rejected the way Bitcoin's testnet versions are.

@aeitwoen
aeitwoen requested a review from oritwoen as a code owner August 26, 2026 12:43
@aeitwoen aeitwoen self-assigned this Aug 26, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/chains/cardano.ts
Comment thread src/chains/cardano.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/chains/cardano.ts">

<violation number="1" location="src/chains/cardano.ts:26">
P2: When the Byron payload is truncated, `isByronEnvelope` accepts an inner `0x83` header without any of its three items. `Cardano.assertAddress("5xb5UCMiej")` therefore accepts a malformed Base58 value; require the minimum complete payload and validate the inner items before classifying it as Byron.</violation>
</file>

<file name="test/unit/chains.test.ts">

<violation number="1" location="test/unit/chains.test.ts:469">
P3: The new JSDoc says one of the two added vectors tests a CRC width CBOR cannot encode, but neither vector reaches the CRC-width branch. Both decode to envelopes whose byte 5 is not 0x83 (0xaa and 0x00), so isByronEnvelope returns false at the array(3) opening check and the head/crcBytes branch is never exercised. Make the comment reflect that both vectors are rejected at the payload-array check, or craft an envelope with decoded[5]===0x83 and an invalid CRC width so the claimed branch is actually covered.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread src/chains/cardano.ts Outdated
Comment thread test/unit/chains.test.ts Outdated
@oritwoen
oritwoen merged commit 088d942 into main Aug 26, 2026
4 checks passed
@oritwoen
oritwoen deleted the feat/cardano branch August 26, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants