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

[submitter] fix metrics when out of gas #2817 #2818

Merged
merged 1 commit into from
Jun 29, 2024
Merged

[submitter] fix metrics when out of gas #2817 #2818

merged 1 commit into from
Jun 29, 2024

Conversation

trajan0x
Copy link
Contributor

@trajan0x trajan0x commented Jun 29, 2024

[goreleaser]

Description

Fixes #2817.

In #2817, what happened was we concluded here:

if tx.Cost().Cmp(gasBalance) > 0 {
span.SetAttributes(attribute.Bool("out_of_gas", true))
span.AddEvent("tx out of gas", trace.WithAttributes(txToAttributes(tx.Transaction, tx.UUID)...))
break
}

That the txes were not bumpable and as such we never recorded len(cq.reprocessQueue) since the metric was an observable, we didn't get stale data either.

I know why we use observables here, but it's possible we'll want to consider some future work for when metrics get full

Summary by CodeRabbit

  • Improvements
    • Enhanced the transaction queue by adding a function to calculate the number of pending transactions.
    • Updated metrics recording for better tracking of transaction status.

[goreleaser]
Copy link
Contributor

coderabbitai bot commented Jun 29, 2024

Walkthrough

The changes in chain_queue.go aim to enhance the calculation of pending transactions by introducing the calculatePendingTxes function. It computes the number of pending transactions based on their nonce. Additionally, the metrics recording for pending transactions has been updated within the chainPendingQueue function to reflect these calculations accurately.

Changes

File Change Summary
ethergo/submitter/chain_queue.go Added calculatePendingTxes function to calculate pending transactions and updated metrics recording in chainPendingQueue.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant chainPendingQueue
    participant calculatePendingTxes
    User ->> chainPendingQueue: Call function
    chainPendingQueue ->> calculatePendingTxes: Calculate pending txes
    calculatePendingTxes -->> chainPendingQueue: Number of pending txes
    chainPendingQueue ->> User: Updated metrics
Loading

Assessment against linked issues

Objective Addressed Explanation
Investigate pending charts not increasing due to low balance (#2817)

Poem

In the queue where transactions roam,
A count of pending txes found its home,
Nonce by nonce, they tally high,
Metrics soaring to the sky,
Calculations clear, the data shown,
Bugs now fixed, our code has grown.


Tip

Early access features
  • OpenAI gpt-4o model for reviews and chat.

Note:

  • You can disable early access features from the CodeRabbit UI or by setting early_access: false in the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.

@github-actions github-actions bot added go Pull requests that update Go code size/xs labels Jun 29, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

  • Added calculatePendingTxes function to accurately count pending transactions
  • Fixed metrics recording for pending transactions when out of gas
  • Ensured metrics are updated even if transactions are not bumpable due to gas issues
  • Adjusted logic to handle non-bumpable transactions correctly

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

codecov bot commented Jun 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.55943%. Comparing base (1777040) to head (0d8b5ce).

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2818         +/-   ##
===================================================
- Coverage   25.67420%   25.55943%   -0.11478%     
===================================================
  Files            708         765         +57     
  Lines          52025       54743       +2718     
  Branches          80          80                 
===================================================
+ Hits           13357       13992        +635     
- Misses         37299       39315       +2016     
- Partials        1369        1436         +67     
Flag Coverage Δ
cctp-relayer 31.93780% <ø> (?)
ethergo 48.42881% <100.00000%> (+0.13469%) ⬆️
explorer 4.97877% <ø> (ø)
omnirpc 33.08129% <ø> (ø)
opbot 0.21082% <ø> (ø)
promexporter 8.50242% <ø> (?)
rfq 27.12163% <ø> (-0.03912%) ⬇️
scribe 18.17597% <ø> (ø)
tools 30.55118% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d8b5ce
Status: ✅  Deploy successful!
Preview URL: https://406407a6.sanguine-fe.pages.dev
Branch Preview URL: https://fix-2817.sanguine-fe.pages.dev

View logs

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.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1777040 and 0d8b5ce.

Files selected for processing (1)
  • ethergo/submitter/chain_queue.go (3 hunks)
Additional comments not posted (1)
ethergo/submitter/chain_queue.go (1)

67-70: LGTM!

However, ensure that the new function calculatePendingTxes is correctly implemented and used.

Verification successful

The function calculatePendingTxes is correctly implemented and used.

  • The function iterates through the transactions and counts those with a nonce greater than or equal to the provided nonce.
  • It returns the count of such transactions, which is used to set the number of pending transactions.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct implementation and usage of the function `calculatePendingTxes`.

# Test: Search for the function usage. Expect: Only occurances of the new function signature.
rg --type go $'calculatePendingTxes'

Length of output: 359



Script:

#!/bin/bash
# Extract the implementation of the function `calculatePendingTxes` from the file `ethergo/submitter/chain_queue.go`.
ast-grep --lang go --pattern $'func calculatePendingTxes(txes []db.TX, nonce uint64) int {
  $$$
}' ethergo/submitter/chain_queue.go

Length of output: 939

ethergo/submitter/chain_queue.go Show resolved Hide resolved
@trajan0x trajan0x merged commit 021d351 into master Jun 29, 2024
56 checks passed
@trajan0x trajan0x deleted the fix/2817 branch June 29, 2024 16:27
@trajan0x trajan0x restored the fix/2817 branch June 29, 2024 16:27
@trajan0x trajan0x deleted the fix/2817 branch June 29, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[submitter] Investigate pending charts not increase
1 participant