Skip to content

Properly handle burn-block, stacks-block, and tenure info in simnet #1540

Closed

Description

In the simnet, we now have the possibility to advance the stacks-block height independently from the burn-block height.

This come with some more changes needing in the data stores to properly handle the block heights in the block info.
Some of these changes might not be trivial and require important changes.

  • store a new block-info in the burn data store when there a new stacks block
  • have realistic stacks block time and burn block times (Realistic block times #957)
    • 10min per bitcoin block
    • 10sec per stacks blocks when advanced independently
    • when advancing the burn chain, the produced stacks block should have the same time timestamp (can be more more than 10sec then)
  • Make sure to handle epoch 2.x and 3.x

Here is a code snippet that can be used to test it:

(define-read-only (get-info)
  {
    a_stacks_block_height: stacks-block-height,
    b_burn_block_height: burn-block-height,

    d_current_stacks_info: (get-stacks-block-info? time stacks-block-height),
    e_current_burn_info: (get-burn-block-info? header-hash burn-block-height),
    f_current_tenure_info: (get-tenure-info? time stacks-block-height),

    g_current_stacks_info: (get-stacks-block-info? time (- stacks-block-height u1)),
    h_current_burn_info: (get-burn-block-info? header-hash (- burn-block-height u1)),
    i_current_tenure_info: (get-tenure-info? time (- stacks-block-height u1)),
  }
)

And an expected output (can easily be tested on the devnet)

{
  a_stacks_block_height: u75,
  b_burn_block_height: u157,

  d_current_stacks_info: none,
  e_current_burn_info: (some 0x1d653a095...a30a79338dc9fc),
  f_current_tenure_info: none,

  g_current_stacks_info: (some u1723218111),
  h_current_burn_info: (some 0x6dcd...48955afbde),
  i_current_tenure_info: (some u1723218107)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

simnetIssue related to the simnet

Type

No type

Projects

  • Status

    ✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions