Skip to content

test(bridge-withdrawer): add submitter tests#1133

Merged
itamarreif merged 52 commits intomainfrom
itamarreif/bridge-blackboxtests
Jun 6, 2024
Merged

test(bridge-withdrawer): add submitter tests#1133
itamarreif merged 52 commits intomainfrom
itamarreif/bridge-blackboxtests

Conversation

@itamarreif
Copy link
Contributor

@itamarreif itamarreif commented Jun 1, 2024

Summary

This adds tests for the bridge withdrawer's Submitter. The original intention was to implement these as black box tests, but due to various complications with websockets and eth contracts, decided to hold of on adding those and implemented these instead.

Background

Sequencer transaction submission logic needed to be tested.

Changes

  • test helpers for the submitter
  • sanity check that batches are submitted properly
  • tests to verify that failures during submissions causes the submitter to halt

Testing

  • helpers
    • setup
    • response mocks
      • genesis
      • get_nonce
      • broadcast_tx_commit
    • failure mocks
      • get_nonce
      • broadcast_tx_commit
  • tests
    • submit sucess
    • submit check_tx failure
    • submit deliver_tx failure

itamarreif and others added 30 commits April 19, 2024 15:58
## Summary
implement `ethereum` module for astria-bridge-withdrawer.

## Background
required to read from the astria withdrawal evm contract.

## Changes
- implement `AstriaWithdrawer.sol` contract, put inside `ethereum/` dir
as a foundry project
- implement `ethereum` module which contains a `Watcher` that watches
the contract for `Withdrawal` events
- the events are sent to a `Batcher` which batches all events by block
number and sends a batch of events to a sequencer handler (to be
implemented later)

## Testing
unit tests

## Related Issues

 #913
…er and ics20 withdrawals (#1101)

## Summary
as title says

## Changes
- update AstriaWithdrawer contract to have separate methods for
sequencer and ics20 withdrawals `withdrawToSequencer` or
`withdrawToOriginChain`
- these methods now take different parameters and emit different events

## Testing
unit tests
)

## Summary
This adds the `Submitter` and merges in the `Watcher` related logic into
a single `WithdrawService`.

`Submitter` receives batches of rollup transactions that have been
converted into sequencer `Action`s from the `Batcher` and does the
following:
1. fetch the current nonce and create the `UnsignedTransaction`
2. sign the transaction
3. `broadcast_tx_commit`

If submission to the sequencer fails for any reason (either in `CheckTx`
or `DeliverTx`), the `Submitter` will stop, instead relying on the
service's recovery process to reconstruct the batch from rollup
transaction and resubmit.

## Background
Withdrawal batches need to be submitted to the sequencer.

## Changes
- Add `Submitter`
- Add logic for converting the events reaped from rollup to `Action`s
- a lot of random cleanup

## Testing
How are these changes tested?

## Metrics
- Some metrics we use in composer already since i copied over a good
amount of submission logic:
    - NONCE_FETCH_COUNT
    - NONCE_FETCH_FAILURE_COUNT
    - NONCE_FETCH_LATENCY
    - CURRENT_NONCE
    - SEQUENCER_SUBMISSION_FAILURE_COUNT
    - SEQUENCER_SUBMISSION_LATENCY

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

closes <!-- list any issues closed here -->

---------

Co-authored-by: elizabeth <elizabethjbinks@gmail.com>
@itamarreif itamarreif self-assigned this Jun 3, 2024
@itamarreif itamarreif marked this pull request as ready for review June 3, 2024 16:54
@itamarreif itamarreif requested review from a team as code owners June 3, 2024 16:54
@itamarreif itamarreif requested review from SuperFluffy and aajimal June 3, 2024 16:54
Comment on lines 49 to 53
<<<<<<< HEAD
# Set to true to enable prometheus metrics.
=======
# Set to true to disable prometheus metrics.
>>>>>>> 106a81bb9644d7313bee8bb3946bf9d4ee5fc9d9
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like text got added during merge

@SuperFluffy
Copy link
Contributor

From what I can see these are not running the bridge as a blackbox, at least in the Rust put-it-under-tests/-sense.

Can you move the tests from inside the crate to outside, as for the other services?

@itamarreif itamarreif changed the title test(bridge-withdrawer): add black box tests test(bridge-withdrawer): add submitter tests Jun 3, 2024
Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

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

nice, these look good to me!

@itamarreif itamarreif added bridging and removed conductor pertaining to the astria-conductor crate composer pertaining to composer labels Jun 6, 2024
@itamarreif itamarreif added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 865f7d7 Jun 6, 2024
@itamarreif itamarreif deleted the itamarreif/bridge-blackboxtests branch June 6, 2024 17:33
steezeburger added a commit that referenced this pull request Jun 10, 2024
* main:
  fix: ignore RUSTSEC-2021-0139 (#1171)
  chore(sequencer-relayer)!: remove functionality to restrict relaying blocks to only those proposed by a given validator (#1168)
  chore(metrics): update `metric_name` macro to handle a collection of names (#1163)
  fix(bridge-withdrawer): skip linting generated contract code (#1172)
  fix(core, sequencer): prefix removal source non-refund ics20 packet (#1162)
  chore(docs): add sequencer-relayer doc to specs (#1126)
  feat(bridge-withdrawer): sync logic (#1165)
  chore(withdrawer): replace contracts with `astria-bridge-contracts` submodule (#1164)
  feat(sequencer)!: implement bridge sudo and withdrawer addresses (#1142)
  feat(sequencer): implement refund to rollup logic upon ics20 transfer refund (#1161)
  feat(bridge-withdrawer): bridge withdrawer startup (#1160)
  feat(core, proto)!: add bech32m addresses (#1124)
  feat(withdrawer): bridged ERC20 token withdrawals (#1149)
  feat(sequencer-relayer)!: add chain IDs for sequencer and Celestia to config env vars (#1063)
  test(bridge-withdrawer): add submitter tests (#1133)
  chore: bump penumbra deps (#1159)
  feat(sequencer): implement `bridge/account_last_tx_hash` abci query (#1158)
  fix(withdrawer): use block subscription in batcher; send to destination_chain_address (#1157)
  fix(withdrawer): update AstriaWithdrawer to check that withdrawal value is sufficient (#1148)
  chore(ci): build bridge withdrawer images (#1156)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bridging ci issues that are related to ci and github workflows sequencer-relayer pertaining to the astria-sequencer-relayer crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants