Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: signer /info api endpoint #1251

Conversation

cylewitruk
Copy link
Member

@cylewitruk cylewitruk commented Jan 21, 2025

Description

Closes: #1017

Changes

  • Adds a new /info endpoint to the signer's API (I'm thinking we reserve /health for connectivity checks and reporting connection errors, etc.).
  • Adds getnetworkinfo and getblockchaininfo RPC methods to BitcoinInteract.
  • Some other minor tweaks

Example response from devenv:

{
    "bitcoin": {
        "signer_tip": {
            "block_hash": "4829942fe1d8a876b9550080274ae43c7c9a83517cb19a2e7b08c4163fa6018b",
            "block_height": 237
        },
        "node_tip": {
            "block_hash": "4829942fe1d8a876b9550080274ae43c7c9a83517cb19a2e7b08c4163fa6018b",
            "block_height": 237
        },
        "node_chain": "regtest",
        "node_version": 250100,
        "node_subversion": "/Satoshi:25.1.0/"
    },
    "stacks": {
        "signer_tip": {
            "block_hash": "87abe90e746124ca9df157c7e4e1b0785c3cb6a712ce466dd630fecbb90b1dbd",
            "block_height": 47
        },
        "node_tip": {
            "block_hash": "87abe90e746124ca9df157c7e4e1b0785c3cb6a712ce466dd630fecbb90b1dbd",
            "block_height": 47
        },
        "node_bitcoin_block_height": 237,
        "node_version": "stacks-node 0.0.1 (:49777d3fd73a6dbb610be80c376b7d9389c9871a, debug build, linux [aarch64])"
    },
    "dkg": {
        "rounds": 1,
        "current_aggregate_key": "03cffc8638c02dde18c99a84ebf25c6fce3faf7843ea67152a69b6dfbca80c35cc",
        "contract_aggregate_key": "03cffc8638c02dde18c99a84ebf25c6fce3faf7843ea67152a69b6dfbca80c35cc"
    },
    "config": {
        "network": "regtest",
        "deployer": "SN3R84XZYA63QS28932XQF3G1J8R9PC3W76P9CSQS",
        "bootstrap_signatures_required": 2,
        "bitcoin_processing_delay": 3,
        "context_window": 1000,
        "signer_round_max_duration": 5,
        "bitcoin_presign_request_max_duration": 5,
        "dkg_max_duration": 5,
        "sbtc_bitcoin_start_height": null,
        "dkg_begin_pause": 1,
        "max_deposits_per_bitcoin_block": 25,
        "dkg_min_bitcoin_block_height": null,
        "dkg_target_rounds": 1
    },
    "build_info": {
        "rust_version": "rustc 1.84.0 (9fc6b4312 2025-01-07)",
        "git_revision": "add5a8868d5f5d1df9b58e369e8032cc65b79c3d",
        "target_arch": "aarch64",
        "target_env_abi": null
    },
    "timestamp": "2025-01-24 11:15:22.802073 +00:00:00"
}

Values which are not available (i.e. either missing or an error occurred) are returned as null, my thinking is that this should report as much information as possible and be infallible, and we use a /health endpoint for having simple db/bitcoin/stacks connectivity checks and report errors.

Testing Information

Added additional unit tests and tested pretty extensively against devenv.

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@cylewitruk cylewitruk added the sbtc signer binary The sBTC Bootstrap Signer. label Jan 21, 2025
@cylewitruk cylewitruk added this to the sBTC: Key rotation milestone Jan 21, 2025
@cylewitruk cylewitruk self-assigned this Jan 21, 2025
@cylewitruk cylewitruk linked an issue Jan 21, 2025 that may be closed by this pull request
3 tasks
signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/bitcoin/rpc.rs Outdated Show resolved Hide resolved
signer/src/error.rs Show resolved Hide resolved
signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/api/info.rs Show resolved Hide resolved
signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/api/info.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@djordon djordon left a comment

Choose a reason for hiding this comment

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

Took a quick look, will have to circle back.

signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/api/info.rs Outdated Show resolved Hide resolved
signer/src/storage/model.rs Show resolved Hide resolved
@cylewitruk
Copy link
Member Author

cylewitruk commented Jan 24, 2025

Note: I added a config section as well which dumps some of the signer config values in add5a88.

@cylewitruk cylewitruk requested a review from djordon January 25, 2025 08:01
Copy link
Collaborator

@djordon djordon left a comment

Choose a reason for hiding this comment

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

Looks good. Left one style nit.

signer/src/api/info.rs Outdated Show resolved Hide resolved
@cylewitruk cylewitruk merged commit fac09e2 into main Jan 26, 2025
8 checks passed
@cylewitruk cylewitruk deleted the 1017-feature-add-a-more-comprehensive-health-endpoint-to-the-signer-app branch January 26, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sbtc signer binary The sBTC Bootstrap Signer.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature]: Add a more comprehensive health endpoint to the signer app
4 participants