Skip to content

feat: Added Cardano, Avalanche-P, Avalanche-C specs to mainnet#2263

Merged
Harraken merged 3 commits into
mainfrom
cardano-spec-to-mainnet
Apr 15, 2026
Merged

feat: Added Cardano, Avalanche-P, Avalanche-C specs to mainnet#2263
Harraken merged 3 commits into
mainfrom
cardano-spec-to-mainnet

Conversation

@sotskov-do

Copy link
Copy Markdown
Contributor

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • read the contribution guide
  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the main branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add Cardano mainnet and preprod testnet specifications

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Added comprehensive Cardano mainnet specification with 150+ REST API endpoints
• Configured Cardano preprod testnet as derived specification inheriting from mainnet
• Defined compute units, block parsing, and API categories for all endpoints
• Implemented chain verification and archive extension support
Diagram
flowchart LR
  A["Cardano Spec Config"] --> B["Mainnet Spec<br/>CARDANO"]
  A --> C["Preprod Testnet<br/>CARDANOT"]
  B --> D["150+ REST APIs<br/>GET/POST"]
  B --> E["Verification &<br/>Extensions"]
  C --> F["Inherits from<br/>Mainnet"]
  D --> G["Accounts, Addresses,<br/>Blocks, Pools, Txs"]
  E --> H["Chain-ID & Pruning<br/>Checks"]
Loading

Grey Divider

File Changes

1. specs/mainnet-1/specs/cardano.json ⚙️ Configuration changes +2191/-0

Complete Cardano mainnet and testnet specification

• Created new Cardano specification file with complete mainnet configuration
• Defined CARDANO mainnet spec with 150+ REST API endpoints covering accounts, addresses, blocks,
 assets, epochs, governance, pools, scripts, transactions, and utilities
• Added GET and POST API collections with compute units ranging from 10 to 100
• Configured chain verification (network magic 764824073) and archive extension (5x CU multiplier
 for blocks before 8192)
• Defined CARDANOT preprod testnet spec that inherits all APIs from mainnet with chain-id
 verification value of 1
• Set reliability threshold, block finalization parameters, and minimum stake requirements for both
 specs

specs/mainnet-1/specs/cardano.json


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Apr 12, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1)   📘 Rule violations (0)   📎 Requirement gaps (0)   🎨 UX Issues (0)
🐞\ ≡ Correctness (1)

Grey Divider


Action required

1. Block parsed as latest 🐞
Description
Cardano REST endpoints that take a block identifier in the path (e.g. /blocks/{hash_or_number} and
subpaths) use block_parsing DEFAULT with parser_arg ["latest"], so the requested block is always
tagged as LATEST_BLOCK even when querying a specific block number. This can break requested-block
tracking used for data reliability/QoS for historical block requests.
Code

specs/mainnet-1/specs/cardano.json[R519-525]

+                                "name": "/blocks/{hash_or_number}",
+                                "block_parsing": {
+                                    "parser_arg": [
+                                        "latest"
+                                    ],
+                                    "parser_func": "DEFAULT"
+                                },
Evidence
In the new Cardano spec, /blocks/{hash_or_number} (and related /next, /previous, /txs paths)
hardcode block_parsing to DEFAULT+"latest". The REST chain parser derives the request’s
"requestedBlock" from api.BlockParsing via ParseBlockFromParams, and the DEFAULT parser always
returns the first parser_arg value ("latest"), so requests for specific blocks will still be treated
as "latest". Other REST specs demonstrate the expected pattern: for block-height path params they
use PARSE_DICTIONARY_OR_ORDERED to extract the placeholder from RestMessage.GetParams().

specs/mainnet-1/specs/cardano.json[519-633]
protocol/chainlib/rest.go[115-152]
protocol/parser/parser.go[248-264]
protocol/parser/parser.go[509-513]
specs/mainnet-1/specs/aptos.json[212-220]
specs/mainnet-1/specs/cosmossdk.json[756-764]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Cardano block-specific REST endpoints (e.g. `/blocks/{hash_or_number}` and related endpoints) currently set `block_parsing` to `DEFAULT` with `parser_arg: ["latest"]`, which forces the requested block to always be treated as `latest`.

### Issue Context
`RestChainParser.ParseMsg()` computes `requestedBlock` using `parser.ParseBlockFromParams(restMessage, api.BlockParsing, ...)`, and `DEFAULT` parsing returns the first `parser_arg` value.

### Fix Focus Areas
Update `block_parsing` for endpoints that include `{hash_or_number}` in the spec path to extract the actual path parameter (matching how other REST specs parse `{height}`):
- specs/mainnet-1/specs/cardano.json[519-633]

Recommended config shape (example):
- set `parser_func` to `PARSE_DICTIONARY_OR_ORDERED`
- set `parser_arg` to `["hash_or_number", "=", "0"]`

Apply similarly to `/blocks/{hash_or_number}/next`, `/previous`, `/txs`, `/txs/cbor`, etc. so the placeholder is consistently parsed into `requestedBlock` when it’s numeric.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@codecov

codecov Bot commented Apr 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
consensus 8.98% <ø> (ø)
protocol 35.18% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread specs/mainnet-1/specs/cardano.json
@sotskov-do sotskov-do requested a review from Tomelia1999 April 12, 2026 09:35
@github-actions

github-actions Bot commented Apr 12, 2026

Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
7 files   ±0   0 ❌ ±0 

Results for commit 2e6fcce. ± Comparison against base commit 5741773.

♻️ This comment has been updated with latest results.

@sotskov-do sotskov-do changed the title feat: Added Cardano spec to mainnet feat: Added Cardano, Avalanche-P, Avalanche-C specs to mainnet Apr 14, 2026
@Harraken Harraken merged commit 418af78 into main Apr 15, 2026
37 of 38 checks passed
@Harraken Harraken deleted the cardano-spec-to-mainnet branch April 15, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants