feat: pox-5 register-signer ingestion and staking signer endpoints#2585
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Description
As an application developer building pox-5 staking UIs, I want to look up the registered staking signers and their current signing keys through the API.
Motivation. The pox-5
register-signerevent binds a signer principal to a compressed secp256k1 signing key. The contract stores this in(define-map signers principal (buff 33))andmap-sets on re-registration, so a signer has exactly one current key (latest-wins). Until now this event was an unhandled TODO stub. This PR ingests it, materializes the registry, and exposes it.What changed:
register-signeris handled in the pox-5 event switch and upserted into a new materializedstaking_signerstable (one row per signer principal, latest-wins), mirroring the contract semantics. It's a current-state accumulator likestx_locked_balances(nocanonicalcolumn).recomputeStakingSignersruns after the reorg queue drains inmarkEntitiesCanonical: for each signer touched by a flippedregister-signerevent, it re-derives the latest canonical registration frompox5_events(the source of truth, which retains every event with full location + canonical), and upserts or deletes. A signer key is latest-wins (not additive), so it's recomputed, not delta-applied — the same approach used forstx_locked_balances./stakingnamespace, in a newstaking-signers.tsroute module):GET /extended/v3/staking/signers— cursor-paginated list of registered signers (by signer principal).GET /extended/v3/staking/signers/:principal— a single signer plus the block position of its registration transaction (joined in fromtxs).How this impacts application developers
Two new read endpoints. The list returns just
{ signer, signer_key }per signer; the detail endpoint adds the registrationtransaction(itstx_idplusblock/bitcoin_blockpositions), consistent with the bond detail endpoint.Type of Change
Does this introduce a breaking change?
No — two additive read endpoints and one new table, on the unreleased pox-5 line.
Are documentation updates required?
openapi.yamlis intentionally not regenerated here; it's produced by the release process.Testing information
tests/api/pox5/signers.test.ts(no live chain): a registration appears in the list; re-registration rotates the key (single row, latest-wins); cursor pagination; orphaning the registration block removes the signer; orphaning a re-registration reverts to the prior key; the detail endpoint returns the joined transaction block position; 404 for an unregistered principal. Full pox5 suite passes.register-signeringestion +markEntitiesCanonicalreorg recompute inpg-write-store.ts; the v3 signer read methods; the new signer route/schema/serializer.grant-signer-key/revoke-signer-grantremain TODO stubs (separate authorization layer), scoped out of this pass.staking_signersto the canonicaltxsrow for the registration's block position.staking_signersdeliberately stores onlytx_id/block_height/burn_block_height(current-state accumulator); the block hash / index hash / time / tx_index / burn block time are joined on read, andblock_height/burn_block_heightfeed theblock/bitcoin_blockheights.DB tables added
staking_signers(new) — materialized pox-5 signer registry:signer(PK),signer_key,tx_id,block_height,burn_block_height.