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

test(bridge withdrawer): remove unit tests and add blackbox tests #1232

Merged
merged 85 commits into from
Jul 29, 2024

Conversation

itamarreif
Copy link
Contributor

@itamarreif itamarreif commented Jul 1, 2024

Summary

changes made in #1215 required adding a mock gRPC server. Moving to black box tests was the next step planned so this will replace the invalidated unit tests with valid black box tests.

Background

Brief background on why these changes were made, ie "why?"

Changes

  • Add black box tests for native and erc20 sequencer and ics20 withdrawals
  • test helpers for the mock cometbft server
  • test helpers for the mock sequencer gRPC server
  • test helpers for managing anvil & ethereum node
  • remove the "unit tests" in submitter/tests.rs
  • some logs i found useful to add while putting this together

Testing

  • native withdrawal to the sequencer works
  • native withdrawal with ics20 works
  • erc20 to the sequencer works
  • erc20 with ics20 works

Related Issues

Link any issues that are related, prefer full github links.

closes #1227

@itamarreif itamarreif self-assigned this Jul 1, 2024
@itamarreif itamarreif force-pushed the itamarreif/bridge-withdrawer/blackbox branch from 6b92b94 to 21b0ba5 Compare July 23, 2024 21:21
bharath-123 pushed a commit that referenced this pull request Jul 25, 2024
## Summary
Adds a check that waits for an empty mempool on startup and then uses
the pending nonce instead of latest finalized nonce for transaction
submission.

## Background
Before these changes we used the latest nonce, which could lead to data
races if there are batches awaiting inclusion in the mempool. See
#1228 for more context.

## Changes
- Add `ASTRIA_BRIDGE_WITHDRAWER_SEQUENCER_GRPC_ENDPOINT` config
- Wait for mempool to be empty as part of startup
- Submitter connects to the grpc service as part of its startup
- Submitter uses pending nonces for batch submission instead of latest
nonce

## Testing
Removed most testing; reworked in
#1232

## Metrics
- Punted: #1272 

## Breaking Changelist
- Adds a required env var
`ASTRIA_BRIDGE_WITHDRAWER_SEQUENCER_GRPC_ENDPOINT`

## Related Issues
closes #1228

---------

Co-authored-by: Richard Janis Goldschmidt <github@aberrat.io>
@SuperFluffy SuperFluffy added testing bridge-withdrawer code touching the bridge-withdrawer service and removed bridging labels Jul 29, 2024
Copy link
Member

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

Looks good, great to have these finally in! Thank you for the lift!

As discussed offline, instead of leaving review comments I have made a few changes to the PR, notably:

  1. added ignore attributes to the tests that require anvil - these now run if --include-ignored is specified and the normal tests no longer fail.
  2. clippy flagged the ethereum::Watcher::startup method. I replaced it by startup(self) -> FullyInitialized, which itself includes has a method FullyInitialized::run. That makes the purpose of startup clearer.
  3. I have removed a lot of tracing events from long lived tasks (they make sense when looking at the command line, but will never be observed in grafana)
  4. I have removed events that notify that a specific line of code is running. This information is redundant on a telemetry platform. If desired, https://docs.rs/tracing-subscriber/0.3.18/tracing_subscriber/fmt/struct.SubscriberBuilder.html#method.with_span_events can be used.
  5. Instead of the events in 4., I have instrumented the functions.

@SuperFluffy SuperFluffy enabled auto-merge July 29, 2024 12:50
@SuperFluffy SuperFluffy added this pull request to the merge queue Jul 29, 2024
Merged via the queue into main with commit 8fa15ce Jul 29, 2024
42 checks passed
@SuperFluffy SuperFluffy deleted the itamarreif/bridge-withdrawer/blackbox branch July 29, 2024 13:05
steezeburger added a commit that referenced this pull request Jul 29, 2024
* main:
  test(bridge withdrawer): remove unit tests and add blackbox tests (#1232)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge-withdrawer code touching the bridge-withdrawer service testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace unit tests with black box tests in bridge-withdrawer
3 participants