optimism icon indicating copy to clipboard operation
optimism copied to clipboard

[op-batcher] submit cancellation transaction when the mempool is blocked by a transaction of incompatible type.

Open roberto-bayardo opened this issue 11 months ago • 3 comments

Description

Extend batcher to submit appropriate cancellation transactions when the mempool is blocked by a transaction of incompatible type.

Also makes the txmgr use the geth-defined AlreadyReservedErr instead of redefining it, now that op-geth has caught up to the commit that exposes it.

Tests

Extended the E2E tests to submit incompatible pending transactions to the txpool to confirm the new functionality appropriately clears them.

Metadata

  • Fixes #[ethereum-optimism/protocol-quest/issues/102]

roberto-bayardo avatar Mar 11 '24 19:03 roberto-bayardo

[!WARNING]

Rate Limit Exceeded

@roberto-bayardo has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 57 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 2541e99f212c61f4406767c2045b261dff7dddc7 and d92ee44dd1ab78551cb2282dfb28ef44c992c249.

Walkthrough

The recent updates focus on enhancing transaction management and testing in a blockchain-based system. Key changes include the introduction of new methods and constants for managing transaction pool states, improved error handling, and additional testing functionalities to simulate transaction blocking scenarios. These modifications aim to refine the system's robustness and responsiveness under different operational conditions.

Changes

File Path Change Summary
op-batcher/.../driver.go Introduced handling for transaction pool states and added methods for transaction cancellation and testing.
op-batcher/.../service.go Updated to use *txmgr.SimpleTxManager and changed return type of Driver method.
op-e2e/.../eip4844_test.go Enhanced to include new test parameters and a pre-test transaction blocking setup.
op-e2e/setup.go Added new configuration field and pre-batcher start action.
op-service/.../send_state.go Refactored error handling to use centralized error definitions from the txpool package.
op-service/.../txmgr.go Added methods for creating and handling stuck transactions in the transaction pool for test purposes.
op-service/.../txmgr_test.go Updated error handling in tests to align with new error definitions from the txpool package.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Mar 12 '24 13:03 coderabbitai[bot]

Wouldn't it be the Transaction Manager's job to handle the cancellation of old transactions? I see the TxMgr got a function to jam the pool for testing's sake, but I would have expected something like a "ReplaceTransaction" function on the TxManager which is able to black-box whatever mempool tricks need to be played.

If it's possible, could we consider an approach like that, where the driver can just ask the Transaction Manager to manage transactions' cancellation/replacement?

My thinking was only the application could really decide what the appropriate cancellation transaction is. E.g. here we're using a simple empty-tx but ideally you'd submit a replacement transaction that does something useful for the application.

roberto-bayardo avatar Mar 24 '24 23:03 roberto-bayardo

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 08 '24 01:04 github-actions[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar May 18 '24 01:05 github-actions[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jun 02 '24 01:06 github-actions[bot]

@sebastianst rebased, can you reopen?

roberto-bayardo avatar Jun 17 '24 22:06 roberto-bayardo

repoened as https://github.com/ethereum-optimism/optimism/pull/10941

roberto-bayardo avatar Jun 18 '24 19:06 roberto-bayardo