Skip to content

Conversation

@avilagaston9
Copy link
Contributor

@avilagaston9 avilagaston9 commented Dec 19, 2024

Add Batcher Cost Metric

Description

This PR adds four panels showing the accumulated spending costs by the Batcher for creating and canceling tasks.

  • One for the total accumulated cost (CreateTask + cancel transaction) over a specified a time range.
  • One for the accumulated cost of cancel transactions only, over a specified a time range.
image
  • Two more, with the historical versions of the previous ones:
image

How to test

To easily send a cancel transaction, you can go to batcher/aligned-batcher/src/retry/batcher_retryables.rs:165 and edit the code to return an error:

// timeout to prevent a deadlock while waiting for the transaction to be included in a block.
    let _result = timeout(Duration::from_millis(transaction_wait_timeout), pending_tx)
        .await
        .map_err(|e| {
            warn!("Error while waiting for batch inclusion: {e}");
            RetryError::Permanent(BatcherError::ReceiptNotFoundError)
        })?
        .map_err(|e| {
            warn!("Error while waiting for batch inclusion: {e}");
            RetryError::Permanent(BatcherError::ReceiptNotFoundError)
        })?
        .ok_or(RetryError::Permanent(BatcherError::ReceiptNotFoundError));
    Err(RetryError::Permanent(BatcherError::ReceiptNotFoundError))

Type of change

  • New feature

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@avilagaston9 avilagaston9 marked this pull request as ready for review December 19, 2024 21:11
@avilagaston9 avilagaston9 self-assigned this Dec 20, 2024
Copy link
Contributor

@JulianVentura JulianVentura left a comment

Choose a reason for hiding this comment

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

I think we are not converting to gwei properly, I left you a comment pointing were I think the problem is.
Other than that, everything seems to be working fine.

Copy link
Contributor

@JulianVentura JulianVentura left a comment

Choose a reason for hiding this comment

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

Works fine, but the cost measurement has some error close to 0.7%, probably due to the usage of floating point.
Anyways, I think this is low priority so we can merge it.

@JuArce JuArce added this pull request to the merge queue Dec 30, 2024
Merged via the queue into staging with commit ee2db4f Dec 30, 2024
3 checks passed
@JuArce JuArce deleted the batcher-gas-cost-metric branch December 30, 2024 23:43
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.

7 participants