Skip to content

Conversation

@JulianVentura
Copy link
Contributor

@JulianVentura JulianVentura commented Nov 27, 2024

Parse error codes from createNewTask

Description

This PR adds parsing errors on batcher from the createNewTask function on ethereum BatcherPaymentService contract
Another PR will be made to add handling of modifiers onlyWhenNotPaused whenNotPaused, as well as improve the parsing of some revert errors by parsing the returned args.

How to test

You will have to repeat this for each error:

  1. Modify functions createNewTask from BatcherPaymentService or AlignedServiceManager to revert with an error handled in this PR
  2. Build contracts into anvil state with make anvil_deploy_aligned_contracts
  3. Run anvil
  4. Start batcher
  5. Send a burst of proofs
  6. Watch it failing on the batcher logs
  7. Repeat with another error

Type of change

Please delete options that are not relevant.

  • New feature
  • Bug fix
  • Optimization
  • Refactor

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

Copy link
Member

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

I need to test it.

Comment on lines 1277 to 1286

// TODO: Here we have to match and handle the errors and flush the queue if necessary
// NoProofSubmitters
// NoFeePerProof
// InsufficientFeeForAggregator
// SubmissionInsufficientBalance
// BatchAlreadySubmitted
// InsufficientFunds
// OnlyBatcherAllowed
// Generic
Copy link
Member

Choose a reason for hiding this comment

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

I would create a separate issue here

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed! This will be handle in a future PR

Comment on lines 17 to 18
// TODO: Here we are missing the modifiers: onlyWhenNotPaused
// TODO: Parse parameters from error responses
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #1508!

Copy link
Member

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

Works as expected.

@PatStiles
Copy link
Contributor

tested on local devnet and it worked as expected.

&byte_string[..10] // Extract the error code only
} else {
"" // Not gonna match
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Try let str_code = e.to_string().get(..10).unwrap_or("");

Copy link
Contributor

Choose a reason for hiding this comment

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

It's working now. Maybe in a future refactor

Copy link
Contributor

@avilagaston9 avilagaston9 left a comment

Choose a reason for hiding this comment

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

Works in my machine!

@uri-99 uri-99 added this pull request to the merge queue Nov 27, 2024
Merged via the queue into staging with commit 89602d1 Nov 27, 2024
3 checks passed
@uri-99 uri-99 deleted the fix/batcher-flush-queue-ethereum-errors branch November 27, 2024 23:27
avilagaston9 added a commit that referenced this pull request Nov 29, 2024
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.

6 participants