Skip to content

Pyth Lazer for Cardano#3499

Open
matej-douro wants to merge 82 commits intomainfrom
matej/cardano-governance
Open

Pyth Lazer for Cardano#3499
matej-douro wants to merge 82 commits intomainfrom
matej/cardano-governance

Conversation

@matej-douro
Copy link
Copy Markdown
Contributor

@matej-douro matej-douro commented Feb 24, 2026

Summary

This is a big PR, merging Cardano work that was previously in a separate branch to main. There's more to do when it comes to SDK and building transactions off-chain, but contract itself should be in a place where the design is set and implemented.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Open with Devin

matej-douro and others added 23 commits February 13, 2026 19:17
@matej-douro matej-douro requested a review from a team as a code owner February 24, 2026 08:55
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-reference Error Error Mar 19, 2026 0:26am
component-library Error Error Mar 19, 2026 0:26am
developer-hub Error Error Mar 19, 2026 0:26am
entropy-explorer Error Error Mar 19, 2026 0:26am
insights Error Error Mar 19, 2026 0:26am
proposals Error Error Mar 19, 2026 0:26am
staking Error Error Mar 19, 2026 0:26am

Request Review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 13 additional findings in Devin Review.

Open in Devin Review

Comment on lines +75 to +76
pnpm tsx scripts/manage_cardano_governance.ts -c "cardano_$CARDANO_NETWORK" \
test-update-trusted-signer \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 README governance command builds an unsupported chain value for devnet

The documented workflow sets CARDANO_NETWORK="devnet" and then passes -c "cardano_$CARDANO_NETWORK", which expands to cardano_devnet. However, the governance CLI only accepts cardano_mainnet, cardano_preprod, and cardano_preview, so this command fails argument validation and users cannot follow the documented self-managed/devnet flow (contract_manager/scripts/manage_cardano_governance.ts:45-49).

Prompt for agents
Update lazer/contracts/cardano/README.md lines 52-53 and 75-76 (and the equivalent command blocks later in the file) so the documented `-c` value matches what `contract_manager/scripts/manage_cardano_governance.ts` actually accepts. Either (a) change the docs to use one of `cardano_mainnet|cardano_preprod|cardano_preview` for governance payload targeting, or (b) if devnet targeting is intended, add `cardano_devnet` support consistently in contract_manager/scripts/manage_cardano_governance.ts option choices and in governance/xc_admin/packages/xc_admin_common/src/chains.ts before keeping the current README command pattern.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@matej-douro
Copy link
Copy Markdown
Contributor Author

I've moved contract management CLI to cli/{js,rs} directory. sdk/js will now be user-facing SDK.

devin-ai-integration[bot]

This comment was marked as resolved.

matej-douro and others added 2 commits March 19, 2026 13:23
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 new potential issues.

View 16 additional findings in Devin Review.

Open in Devin Review

expect(
upgradeCardanoSpendScriptBuffer.equals(
Buffer.from([
80, 84, 71, 77, 3, 2, 234, 192, 52, 175, 120, 123, 102, 232, 177, 8,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Wrong chain ID in JS test expectations for all Cardano governance payloads

All three new Cardano-related test expectations in the GovernancePayload.test.ts use chain ID 60096 (bytes [234, 192] = 0xEAC0) instead of 60097 (bytes [234, 193] = 0xEAC1) for cardano_mainnet. The cardano_mainnet chain ID is defined as 60097 in governance/xc_admin/packages/xc_admin_common/src/chains.ts:130, so PythGovernanceHeader.encode() will produce 0xEAC1 for the chain field, but the tests assert against 0xEAC0. This affects the UpgradeCardanoSpendScript test (line 316), UpgradeCardanoWithdrawScript test (line 334), and UpdateTrustedSigner256Bit test (line 368). All three tests will fail because the actual encoded byte at the chain ID low-byte position will be 193, not 192.

Prompt for agents
In governance/xc_admin/packages/xc_admin_common/src/__tests__/GovernancePayload.test.ts, fix the chain ID byte in all three Cardano test expectations. The chain ID for cardano_mainnet is 60097 (0xEAC1), not 60096 (0xEAC0). In each Buffer.from([...]) assertion for the Cardano tests, change byte 192 to 193 in the chain ID position (the 8th byte, at index 7 in the array):

1. Line 316: Change 234, 192 to 234, 193
2. Line 334: Change 234, 192 to 234, 193
3. Line 368: Change 234, 192 to 234, 193
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

let action =
parser.run(
governance_action(),
#"5054474d0302eac034af787b66e8b108a5d7dd7f912230166079d9f5b30b68cf020f25f2",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Wrong chain ID in Aiken test data causes test failures with env/default.ak chain_id

Both Aiken governance parser tests use hex data containing chain ID eac0 (60096), but env/default.ak:1 defines chain_id: Int = 60097 (0xEAC1). The governance_action() parser at lazer/contracts/cardano/lib/pyth/governance.ak:51 checks expect u16.as_int(chain) == env.chain_id, which will fail because 60096 ≠ 60097. This causes aiken check -D to fail in CI (.github/workflows/ci-lazer-cardano-contract.yml:24). Both can_parse_upgrade_spend_script (line 84) and can_parse_update_trusted_signer (line 95) are affected.

Prompt for agents
In lazer/contracts/cardano/lib/pyth/governance.ak, fix the chain ID bytes in both test hex strings. The chain ID for env/default.ak (cardano_mainnet) is 60097 = 0xEAC1, not 60096 = 0xEAC0.

1. Line 84: In the hex literal, change 'eac0' to 'eac1' so the full string becomes:
   #"5054474d0302eac134af787b66e8b108a5d7dd7f912230166079d9f5b30b68cf020f25f2"

2. Line 95: In the hex literal, change 'eac0' to 'eac1' so the full string becomes:
   #"5054474d0301eac174313a6525edf99936aa1477e94c72bc5cc617b21745f5f03296f3154461f2140000000000002a2a"
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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