Skip to content

wip: state machine updates for tx replay #6020

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

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

hstove
Copy link
Contributor

@hstove hstove commented Apr 16, 2025

This PR implements:

  • Detecting forks in the signer state machine
  • Updating the tenure fork info API to include dropped blocks, which can be used to construct the tx replay set

This builds on top of #5994

@hstove
Copy link
Contributor Author

hstove commented Apr 23, 2025

Current state of this PR:

  • tx_replay_set, an Option<Vec<StacksTransaction>>, is added the SignerStateMachine
  • signer_state detects a bitcoin fork in bitcoin_block_arrival and fetches dropped blocks
  • The "fork info" API is updated to included dropped Nakamoto blocks
  • The signer updates their local signer state machine with the dropped tx's from this API
  • A new integration test triggers a Bitcoin fork and asserts that the state machine has the right tx replay set

"prior_state_machine.burn_block" => %prior_state_machine.burn_block,
);
// Determine the tenures that were forked
let mut sortition_info =
Copy link
Contributor

@jferrant jferrant Apr 23, 2025

Choose a reason for hiding this comment

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

I know this is a WIP so sorry about being nit picky already on eit, but I would make this into a sep function such as handle_bitcoin_fork or extract_replay_transactions as bitcoin_block_arrival is getting a bit long/hard to follow.

info!("No stacks parent ch found for sortition info";
"sortition_info" => ?sortition_info,
);
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

If no sortition occurred, this could be none, right? Does that mean we should just break from this loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, yeah, looking at the API now, it does seem like this will be None if no sortition occurred, and we don't actually want to break from the loop in that case. I'll have to re-think this a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants