Skip to content

feat(cli, bridge-withdrawer)!: share code between cli and service#1270

Merged
SuperFluffy merged 6 commits intomainfrom
superfluffy/share-code-between-cli-and-service
Jul 15, 2024
Merged

feat(cli, bridge-withdrawer)!: share code between cli and service#1270
SuperFluffy merged 6 commits intomainfrom
superfluffy/share-code-between-cli-and-service

Conversation

@SuperFluffy
Copy link
Contributor

@SuperFluffy SuperFluffy commented Jul 15, 2024

Summary

Moves common code from bridge-withdrawer and cli to astria-bridge-contracts.

Background

The bridge collect-withdrawals subcommand of astria-cli and the astria-bridge-withdrawer have common logic that should use the same code. This patch ensures that both use the same codepaths to get contract withdraw events from the astria bridge contracts running on the rollup before converting them to astria Sequencer actions.

Writing this patch it was noticed that bridge-withdrawer with incorrectly set rollup asset denom would break and was fixed.

Changes

  • Define a GetWithdrawalActions::get_for_block_hash utility for fetching withdrawal events for a given block hash and converting them to astria sequencer actions in one go
  • Refactor astria-bridge-withdrawer and astria-cli in terms of it
  • Remove bridge collect-withdrawals --rollup-asset-denom
  • Add bridge collect-withdrawals --sequencer-asset-to-withdraw (to disambiguate between withdrawal kinds)
  • Add bridge collect-withdrawals --ics20-asset-to-withdraw (to disambiguate between withdrawal kinds)
  • Require ASTRIA_BRIDGE_WITHDRAWER_ROLLUP_ASSET_DENOM to always contain a trace-prefixed ics20 asset denomination (a string of form [<port>/<channel>/.../]base because withdrawing ibc/<hash> denoms does not make sense for the bridge.

Testing

Smoke tests still pass and run.

The overly heavy unit tests (which weren't really unit tests) in astria-bridge-withdrawer were removed in favor of future blackbox tests (pending in #1227, which would have removed these eventually).

Breaking Changelist

Neither of these are breaking in practice because the CLI bridge subcommand did not see a release yet, and bridge-withdrawer with ibc/<hash> rollup asset denoms was never used (and would likely not work)

  • removed an argument on the CLI
  • enforces a stricter config on the bridge-withdrawer

@github-actions github-actions bot added the cd label Jul 15, 2024
@SuperFluffy SuperFluffy marked this pull request as ready for review July 15, 2024 11:01
@SuperFluffy SuperFluffy requested review from a team as code owners July 15, 2024 11:01
@SuperFluffy SuperFluffy requested review from joroshiba and noot July 15, 2024 11:01
@SuperFluffy SuperFluffy changed the title Superfluffy/share code between cli and service feat(cli, bridge-withdrawer)!: share code between cli and service Jul 15, 2024
Copy link
Member

@joroshiba joroshiba left a comment

Choose a reason for hiding this comment

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

lgtm

@SuperFluffy SuperFluffy added this pull request to the merge queue Jul 15, 2024
Merged via the queue into main with commit 75ac37a Jul 15, 2024
@SuperFluffy SuperFluffy deleted the superfluffy/share-code-between-cli-and-service branch July 15, 2024 12:11
steezeburger added a commit that referenced this pull request Jul 16, 2024
* main:
  chore(test): use a temporary file to not pollute the workspace (#1269)
  chore(sequencer): add mempool benchmarks (#1238)
  fix(bridge-withdrawer)!: fix nonce handling (#1215)
  feat(cli, bridge-withdrawer)!: share code between cli and service (#1270)
steezeburger added a commit that referenced this pull request Jul 19, 2024
* main: (24 commits)
  chore: update `bytes` and `ics23` crates (#1279)
  fix(sequencer): improve and fix instrumentation (#1255)
  feature(charts): hermes chart fixes, bech32 updates, ibc bridge test (#1130)
  chore(cli): remove unused rollup cli code (#1275)
  chore(test): use a temporary file to not pollute the workspace (#1269)
  chore(sequencer): add mempool benchmarks (#1238)
  fix(bridge-withdrawer)!: fix nonce handling (#1215)
  feat(cli, bridge-withdrawer)!: share code between cli and service (#1270)
  feat(cli): add cmd to collect withdrawal events and submit as actions (#1261)
  fix(core, bridge, sequencer)!: dismabiguate return addresses (#1266)
  fix(withdrawer): support withdrawer address that differs from bridge address   (#1262)
  (core, sequencer)!: generate serde traits impls for all protocol protobufs (#1260)
  fix(charts): add resources for sequencer/cometbft (#1254)
  chore(sequencer)!: add metrics (#1248)
  fix(sequencer-utils): fixes issue in `parse_blob` tests (#1243)
  feat(core, proto)!: make bridge unlock memo string (#1244)
  fix(conductor): don't panic during panic (#1252)
  feat(core)!: lowerCamelCase for protobuf json mapping (#1250)
  refactor(bridge-withdrawer)!: refactor startup to a separate subtask and remove balance check from startup (#1190)
  fix: rollup archive node configurations (#1249)
  ...
bharath-123 pushed a commit that referenced this pull request Jul 25, 2024
)

## Summary
Moves common code from bridge-withdrawer and cli to
`astria-bridge-contracts`.

## Background
The `bridge collect-withdrawals` subcommand of `astria-cli` and the
`astria-bridge-withdrawer` have common logic that should use the same
code. This patch ensures that both use the same codepaths to get
contract withdraw events from the astria bridge contracts running on the
rollup before converting them to astria Sequencer actions.

Writing this patch it was noticed that bridge-withdrawer with
incorrectly set rollup asset denom would break and was fixed.

## Changes
- Define a `GetWithdrawalActions::get_for_block_hash` utility for
fetching withdrawal events for a given block hash and converting them to
astria sequencer actions in one go
- Refactor `astria-bridge-withdrawer` and `astria-cli` in terms of it
- Remove `bridge collect-withdrawals --rollup-asset-denom`
- Add `bridge collect-withdrawals --sequencer-asset-to-withdraw` (to
disambiguate between withdrawal kinds)
- Add `bridge collect-withdrawals --ics20-asset-to-withdraw` (to
disambiguate between withdrawal kinds)
- Require `ASTRIA_BRIDGE_WITHDRAWER_ROLLUP_ASSET_DENOM` to always
contain a trace-prefixed ics20 asset denomination (a string of form
`[<port>/<channel>/.../]base` because withdrawing `ibc/<hash>` denoms
does not make sense for the bridge.

## Testing
Smoke tests still pass and run.

The overly heavy unit tests (which weren't really unit tests) in
`astria-bridge-withdrawer` were removed in favor of future blackbox
tests (pending in #1227, which
would have removed these eventually).

## Breaking Changelist
Neither of these are breaking in practice because the CLI `bridge`
subcommand did not see a release yet, and `bridge-withdrawer` with
`ibc/<hash>` rollup asset denoms was never used (and would likely not
work)
- removed an argument on the CLI
- enforces a stricter config on the bridge-withdrawer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants