Skip to content

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

Open
wants to merge 27 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
  • Include a Vec<StacksTransaction> in state machine updates
    • For now, this vec is cleared as soon as a new Stacks block comes in (regardless of that block's contents). This allows us to monitor state machine updates

This builds on top of #6048 (which we should merge first)

@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

@hstove hstove requested review from jferrant, kantai and obycode May 1, 2025 14:41
@hstove hstove marked this pull request as ready for review May 1, 2025 14:42
@hstove hstove requested a review from a team as a code owner May 1, 2025 14:42
@hstove hstove changed the title wip: state machine updates for tx replay state machine updates for tx replay May 1, 2025
@hstove hstove requested a review from a team as a code owner May 6, 2025 18:00
@hstove
Copy link
Contributor Author

hstove commented May 6, 2025

I've updated this PR with an additional test scenario that tests forked txs across multiple tenures, which caught an issue regarding the order of the replay set

Copy link
Contributor

@kantai kantai left a comment

Choose a reason for hiding this comment

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

This LGTM, just a few comments

@hstove hstove requested a review from a team as a code owner May 9, 2025 00:02
@hstove hstove requested review from obycode and kantai May 9, 2025 00:03
@hstove
Copy link
Contributor Author

hstove commented May 9, 2025

All comments addressed, plz re-review!

kantai
kantai previously approved these changes May 9, 2025
obycode
obycode previously approved these changes May 9, 2025
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

LGTM!

@hstove hstove dismissed stale reviews from obycode and kantai via 745ce55 May 9, 2025 19:03
@hstove hstove requested review from obycode and kantai May 9, 2025 19:03
@hstove
Copy link
Contributor Author

hstove commented May 9, 2025

Fixed a conflict, re-requesting reviews 🙏

@wileyj wileyj self-requested a review May 9, 2025 20:09
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.

Tx Replay: Signer detects forks and updates state machine with replay transactions
5 participants