feat(minibf): add /governance/proposals endpoints - #1219
Draft
slowbackspace wants to merge 3 commits into
Draft
Conversation
Add the two Blockfrost proposal lookups:
- /governance/proposals/{tx_hash}/{cert_index}
- /governance/proposals/{gov_action_id} (CIP-0129)
Map ProposalState to the openapi Proposal model. Epoch semantics
follow db-sync: expiration = ledger expiresAfter + 1, and the
ratified/enacted/dropped/expired epochs are stamped at the enactment
boundary. The governance_description JSON mirrors the ledger Aeson
encoding that db-sync stores.
Closes #1093
Closes #1098
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The official BF fixtures show detail we can not reconstruct from ProposalState: the guardrails script hash and the ledger conway pparams-update JSON names. Decode the original proposal tx from the archive and build governance_description from the submitted GovAction. Also per fixture evidence: db-sync drops an expired proposal one epoch after it marks it expired, and the CIP-0129 minimal encoding (32-byte payload, index 0) must parse.
Verified against the CIP text: hrp, 33-byte layout, single index byte, and classic bech32 all match. Clarify in the parser comment that the 32-byte form is an ecosystem shorthand, not part of the CIP.
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 #1093
Closes #1098
What
Adds the two Blockfrost governance proposal lookups to MiniBF:
GET /governance/proposals/{tx_hash}/{cert_index}GET /governance/proposals/{gov_action_id}— CIP-0129 bech32 id (gov_action1...), both the 33-byte form and the minimal 32-byte form (index 0, used by cexplorer)Both share one lookup path: parse the id, read
ProposalStatefor the lifecycle fields, and decode the original proposal tx from the archive for the action detail.Mapping notes
Blockfrost copies these columns from db-sync, so db-sync source and the official test fixtures are the reference:
expiration= ledgerexpiresAfter + 1, which equals dolosProposalState::expires_at().ratified_epochandenacted_epochwith the same enactment-boundary epoch. Dolos stores the epoch before that boundary, so both fields map toratified_epoch + 1and stay null until the boundary passes.dropped_epoch=canceled_epoch(competing action enacted), orexpired_epoch + 1— db-sync drops an expired proposal one epoch after it marks it expired (verified against the official fixtures).governance_descriptionis the ledger Aeson encoding of the submittedGovAction({"tag": ..., "contents": ...}). The endpoint decodes the archived proposal tx to reproduce it exactly: guardrails script hash, lineage parent, and the conway pparams-update JSON names (stakePoolTargetNum, ...) per the cardano-ledgerpparams-update.jsongolden. Ratios render as plain numbers when the fraction terminates, else as numerator/denominator objects, matching the ledger encoding.governance_descriptionis null and the type falls back toProposalState.Testing
ProposalState; plus unit tests for the description JSON, the ratio rendering, and the minimal CIP-0129 encoding.cargo +nightly fmt,clippy --all-targets -D warnings, full workspace tests pass.🤖 Generated with Claude Code