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

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

Open
6 tasks
hugocaillard opened this issue Aug 9, 2024 · 0 comments
Open
6 tasks
Assignees
Labels
simnet Issue related to the simnet

Comments

@hugocaillard
Copy link
Collaborator

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)
}
@hugocaillard hugocaillard added the simnet Issue related to the simnet label Aug 9, 2024
@hugocaillard hugocaillard self-assigned this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simnet Issue related to the simnet
Projects
Status: 🏗 In Progress
Development

No branches or pull requests

1 participant