Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

feat: speed up transactions if they don't get included initially #636

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Dec 2, 2023

Overview

Re-queries the gas price from the network in case the transaction doesn't get including during the provided timeout and resends it with it.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

Summary by CodeRabbit

  • New Features

    • Introduced a new error notification for pending transactions to enhance user awareness.
    • Implemented improved transaction waiting logic with retry capabilities for better reliability.
  • Refactor

    • Optimized transaction processing flow for efficiency and user experience.
  • Documentation

    • Updated error documentation to reflect new error handling behavior.

@rach-id rach-id added enhancement New feature or request relayer relayer related labels Dec 2, 2023
@rach-id rach-id self-assigned this Dec 2, 2023
@rach-id rach-id requested a review from evan-forbes as a code owner December 2, 2023 12:34
Copy link
Contributor

coderabbitai bot commented Dec 2, 2023

Warning

Rate Limit Exceeded

@sweexordious has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 6 minutes and 34 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. 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 b18decf and 0100348.

Walkthrough

The changes involve updates to a Go codebase, likely part of a blockchain or cryptocurrency project interfacing with Ethereum. A new error type for pending transactions has been introduced, and the transaction waiting logic has been refactored into a new method that includes retry capabilities. Additionally, there's a new method for converting transactions to a legacy format, and an Ethereum client dependency has been added.

Changes

File Path Change Summary
evm/evm_client.go Removed an error log statement for failed transactions.
relayer/errors.go Added a new error variable ErrTransactionStillPending.
relayer/relayer.go Added ethclient import, new methods waitForTransactionAndRetryIfNeeded and toLegacyTransaction, and standard errors import.

Poem

🐇 CodeRabbit hopped along,
Refactoring code, making it strong.
With each new commit, the codebase grew,
Bugs waved goodbye, and performance flew. 🚀


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 95e2ae1 and d89c564.
Files selected for processing (3)
  • evm/evm_client.go (1 hunks)
  • relayer/errors.go (1 hunks)
  • relayer/relayer.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • evm/evm_client.go
Additional comments: 4
relayer/errors.go (1)
  • 12-12: The addition of ErrTransactionStillPending aligns with the PR objective to enhance transaction handling by introducing a specific error for pending transactions.
relayer/relayer.go (3)
  • 4-17: The addition of the ethclient import aligns with the PR's objective to enhance transaction handling by interacting with the Ethereum network.

  • 378-407: The implementation of waitForTransactionAndRetryIfNeeded method is consistent with the PR's objective to handle transactions that are not included in a block within a specified timeout period by re-querying the gas price and resending the transaction.

  • 409-421: The addition of the toLegacyTransaction method supports the PR's objective to ensure compatibility with legacy transaction formats.

relayer/relayer.go Show resolved Hide resolved
relayer/relayer.go Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2023

Codecov Report

Attention: 44 lines in your changes are missing coverage. Please review.

Comparison is base (2496504) 25.91% compared to head (0100348) 25.57%.
Report is 1 commits behind head on main.

Files Patch % Lines
relayer/relayer.go 0.00% 44 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #636      +/-   ##
==========================================
- Coverage   25.91%   25.57%   -0.35%     
==========================================
  Files          29       29              
  Lines        3044     3085      +41     
==========================================
  Hits          789      789              
- Misses       2160     2201      +41     
  Partials       95       95              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d89c564 and b18decf.
Files selected for processing (1)
  • relayer/relayer.go (3 hunks)
Additional comments: 5
relayer/relayer.go (5)
  • 4-17: The addition of the ethclient import aligns with the PR objective to enhance transaction processing flow by re-querying the gas price.

  • 378-407: The waitForTransactionAndRetryIfNeeded method implements the logic to wait for a transaction to be mined and retry with an updated gas price if necessary, which is in line with the PR objective.

  • 409-421: The toLegacyTransaction method is a new addition that supports the conversion of transactions to a legacy format, potentially for compatibility reasons as outlined in the PR summary.

  • 382-382: The previous comment about making the number of retry attempts configurable is still valid.

  • 397-397: The previous comment about returning the error when sending the speed-up transaction fails is still valid.

relayer/relayer.go Outdated Show resolved Hide resolved
@rach-id rach-id merged commit cc39d83 into celestiaorg:main Dec 4, 2023
18 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request relayer relayer related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants