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

[batcher] Cleanup batcher channel inclusion block logic #12363

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Oct 7, 2024

Description

This PR removes the confirmedTxUpdated bool, instead just calling updateInclusionBlocks eagerly rather than lazily from within the isTimedOut() and isFullySubmitted() functions. This has no performance implications as those methods are called at this point anyway. The isTimedOut() and isFullySubmitted() functions are getters so it's nice to clean up any struct mutation from these functions.

Tests

No logic changes, existing tests should provide coverage. Updated the TestChannelTimeout to better test the timeout by calling the TxConfirmed method.

Additional context

This is a small cleanup from #12337 that I wanted to cherry-pick in, even though that PR was closed.

@mdehoog mdehoog force-pushed the michael/channel-inclusion-block-cleanup branch from dba59bc to 84ea6a3 Compare October 7, 2024 23:19
@mdehoog mdehoog force-pushed the michael/channel-inclusion-block-cleanup branch from 84ea6a3 to 6c4fcb5 Compare October 7, 2024 23:19
@mdehoog mdehoog marked this pull request as ready for review October 7, 2024 23:31
@mdehoog mdehoog requested review from a team as code owners October 7, 2024 23:31
@mdehoog mdehoog requested a review from bitwiseguy October 7, 2024 23:31
@tynes tynes requested review from geoknee and removed request for bitwiseguy October 7, 2024 23:41
Copy link
Contributor

@geoknee geoknee left a comment

Choose a reason for hiding this comment

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

I'm on board with the direction of this, but I'm wondering why we need to store the inclusion blocks in the channel struct at all.

What if isTimedOut just computes these values on the fly? If they are needed at any other point (I don't think they are), we could have another getter method for them.

@mdehoog mdehoog force-pushed the michael/channel-inclusion-block-cleanup branch from 966c987 to a2e3d75 Compare October 11, 2024 20:18
@mdehoog mdehoog force-pushed the michael/channel-inclusion-block-cleanup branch from a2e3d75 to a1940c3 Compare October 11, 2024 20:23
@mdehoog mdehoog force-pushed the michael/channel-inclusion-block-cleanup branch from 2621ef8 to 746b161 Compare October 11, 2024 20:43
@mdehoog
Copy link
Contributor Author

mdehoog commented Oct 11, 2024

What if isTimedOut just computes these values on the fly? If they are needed at any other point (I don't think they are), we could have another getter method for them.

Happy to add dynamic getters for them, but note they are used in the logs in TxConfirmed and so we'd probably want to cache them on the struct (so we don't loop through the confirmedTransactions each time), which would end up looking pretty similar to what we already have

@geoknee geoknee added this pull request to the merge queue Oct 14, 2024
Merged via the queue into ethereum-optimism:develop with commit 1ac85ca Oct 14, 2024
58 checks passed
@mdehoog mdehoog deleted the michael/channel-inclusion-block-cleanup branch October 14, 2024 23:07
samlaf pushed a commit to samlaf/optimism that referenced this pull request Nov 10, 2024
…imism#12363)

* Cleanup batcher channel inclusion block logic

* Add comment to isTimedOut

* Remove updateInclusionBlocks altogether

* Revert receiver variable rename

* Fix tests

* Fix isTimedOut for ChannelTimeouts of 1 (ensure that some txs have been confirmed)

* Added comment about confirmed txs to isFullySubmitted
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