Skip to content

[Feature]: Only fetch headers from stacks-core #1873

@djordon

Description

@djordon

Feature - Only fetch headers from stacks-core

1. Description

Whenever the signers attempt to backfill stacks blocks headers, they fetch the actual stacks blocks. This is unnecessary since they have no need for the raw transactions confirmed by the block, they just need the part of the block headers. Fetching the transactions is usually okay, but doing so requires us to decode these transactions, and that can end up being a problem. The signers and Emily rely on the stacks core library for deserialization of our types, and this makes it so that their updates can be breaking changes for us. The solution that we're opting for is to remove the necessity to decode stacks blocks at all, and just get what we need.

It turns out that stacks core has three new endpoints to help get us what we need:

  • GET /v3/tenures/blocks/<consensus-hash>
  • GET /v3/tenures/blocks/hash/<bitcoin-block-hash>
  • GET /v3/tenures/blocks/height/<bitcoin-block-height>

We should use these endpoints to get what we need, which is the stacks block ids, and block heights.

2. Technical Details

We need to update our flow for getting all tenure block headers, which uses the stacks block ids and parent stacks block IDs. Instead we can probably just use the bitcoin block hash or height. We'd need to be careful though, since there can be gaps where there are no stacks blocks generated for a given bitcoin block height. Luckily, this kind of thing is observable even in devenv if you let it run long enough.

2.1 Acceptance Criteria

  • The signers only fetch stacks block headers for each tenure.

3. Related Issues and Pull Requests (optional)

Kinda related to #1817, but not really. It's more related to #1835.

Metadata

Metadata

Assignees

Labels

Projects

Status

In Review

Relationships

None yet

Development

No branches or pull requests

Issue actions