Skip to content

echonet: Add echonet only reverts to resync triggers#13027

Open
ron-starkware wants to merge 1 commit intoron/echonet/sequencer-manager-revertfrom
ron/echonet/resync-echonet-only-reverts
Open

echonet: Add echonet only reverts to resync triggers#13027
ron-starkware wants to merge 1 commit intoron/echonet/sequencer-manager-revertfrom
ron/echonet/resync-echonet-only-reverts

Conversation

@ron-starkware
Copy link
Contributor

@ron-starkware ron-starkware commented Mar 4, 2026

echonet: Add echonet only reverts to resync triggers

Made-with: Cursor

echonet: log failing and rollback blocks on resync trigger

Made-with: Cursor


Note

Medium Risk
Changes core resync trigger/rollback behavior and the persisted report schema, which could cause unexpected rewind points or increased resync frequency if the new candidate selection logic is off.

Overview
Resync triggers are expanded from a single block_number to two block markers: failure_block_number (where the earliest failure was observed) and revert_target_block_number (where the resync should rewind to), and this new shape is propagated through shared_context, resync, transaction_sender, text reports, and the HTML report UI.

ResyncPolicy now evaluates Echonet-only reverts alongside gateway errors and stale pending txs when selecting the earliest failure, and resync execution uses the computed rollback target (with repeated triggers advancing past the failing block). Gateway errors are also made cumulative across resyncs for reporting instead of being reset each epoch.

Written by Cursor Bugbot for commit 39a8c8d. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

ron-starkware commented Mar 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ron-starkware ron-starkware force-pushed the ron/echonet/resync-echonet-only-reverts branch 2 times, most recently from 8ac12a1 to 528d975 Compare March 4, 2026 13:05
@ron-starkware ron-starkware self-assigned this Mar 4, 2026
@ron-starkware ron-starkware marked this pull request as ready for review March 4, 2026 13:06
@ron-starkware ron-starkware force-pushed the ron/echonet/resync-echonet-only-reverts branch from 528d975 to f7dea84 Compare March 4, 2026 13:19
@ron-starkware ron-starkware force-pushed the ron/echonet/sequencer-manager-revert branch from e8414d4 to 5b181ac Compare March 4, 2026 13:19
@ron-starkware ron-starkware force-pushed the ron/echonet/resync-echonet-only-reverts branch from f7dea84 to 3cb9436 Compare March 4, 2026 13:38
@ron-starkware ron-starkware force-pushed the ron/echonet/resync-echonet-only-reverts branch from 3cb9436 to d4ff84a Compare March 4, 2026 13:46
@ron-starkware ron-starkware force-pushed the ron/echonet/resync-echonet-only-reverts branch 2 times, most recently from 734ce83 to 888c39c Compare March 4, 2026 14:14
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Copy link
Contributor

@ayeletstarkware ayeletstarkware left a comment

Choose a reason for hiding this comment

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

@ayeletstarkware reviewed 6 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on ron-starkware).


echonet/echonet_types.py line 51 at r4 (raw file):

    tx_hash: str
    failing_block_number: int
    rollback_block_number: int

Suggestion:

    // Contains the tx...
    failure_block_number: int
    revert_target_block_number: int

echonet/reports.py line 185 at r4 (raw file):

            ):
                lines.append(
                    f"{tx_hash}: failing_bn={meta['failing_block_number']} "

Suggestion:

block_number

Copy link
Contributor

@ayeletstarkware ayeletstarkware left a comment

Choose a reason for hiding this comment

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

@ayeletstarkware made 2 comments.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on ron-starkware).


echonet/resync.py line 63 at r4 (raw file):

            candidates, key=lambda item: item[1]
        )
        rollback_block = failing_tx_block

consider move to a helper function or add a comment above

Code quote:

        for tx_hash, error in gateway_errors.items():
            candidates.append(
                (tx_hash, error["block_number"], f"Gateway error: {error['response']}")
            )

        for tx_hash, info in echonet_only_reverts.items():
            candidates.append(
                (
                    tx_hash,
                    info["block_number"],
                    f"Echonet-only revert: {info['error']}",
                )
            )

        for tx_hash, block_number in sent_tx_hashes.items():
            if block_number <= threshold_block:
                candidates.append(
                    (
                        tx_hash,
                        block_number,
                        f"Still pending after >= {self._blocks_to_wait_before_failing_tx} blocks",
                    )
                )

        if not candidates:
            return None

        tx_hash_trigger, failing_tx_block, reason_trigger = min(
            candidates, key=lambda item: item[1]
        )
        rollback_block = failing_tx_block

echonet/resync.py line 65 at r4 (raw file):

        rollback_block = failing_tx_block
        if pending_min_block is not None:
            rollback_block = min(rollback_block, pending_min_block)

Suggestion:

// did not reach cende...
pending_min_block = min(sent_tx_hashes.values(), default=None)

rollback_block = (
    min(failing_tx_block, pending_min_block)
    if pending_min_block is not None
    else failing_tx_block
)

@ron-starkware ron-starkware force-pushed the ron/echonet/resync-echonet-only-reverts branch from 888c39c to 39a8c8d Compare March 5, 2026 14:05
@ron-starkware ron-starkware force-pushed the ron/echonet/sequencer-manager-revert branch from 5b181ac to 30ba4b2 Compare March 5, 2026 14:05
Copy link
Contributor Author

@ron-starkware ron-starkware left a comment

Choose a reason for hiding this comment

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

@ron-starkware made 5 comments and resolved 3 discussions.
Reviewable status: 0 of 6 files reviewed, 1 unresolved discussion (waiting on ayeletstarkware).


echonet/resync.py line 63 at r4 (raw file):

Previously, ayeletstarkware (Ayelet Zilber) wrote…

consider move to a helper function or add a comment above

Added comments explaining the whole flow (since it's 90% of the function did not move it to a separate one)


echonet/echonet_types.py line 51 at r4 (raw file):

    tx_hash: str
    failing_block_number: int
    rollback_block_number: int

Done


echonet/reports.py line 185 at r4 (raw file):

            ):
                lines.append(
                    f"{tx_hash}: failing_bn={meta['failing_block_number']} "

Done


echonet/resync.py line 65 at r4 (raw file):

        rollback_block = failing_tx_block
        if pending_min_block is not None:
            rollback_block = min(rollback_block, pending_min_block)

Done, thanks

Copy link
Contributor

@ayeletstarkware ayeletstarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@ayeletstarkware reviewed 6 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ron-starkware).

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.

3 participants