Skip to content

Commit

Permalink
feat(sequencer)!: implement BridgeTransfer action (#1934)
Browse files Browse the repository at this point in the history
## Summary
implement `BridgeTransfer` action which transfers funds from one bridge
account to another. essentially, it atomically performs a `BridgeUnlock`
and a `BridgeLock`.

## Background
this is functionality we want and `BridgeUnlock`ing to another bridge
account wouldn't create a `Deposit` correctly. the issue is that
`BridgeUnlock` does not contain all the information needed to create a
deposit event, namely `destination_chain_address`, so `BridgeUnlock`
directly into another bridge account doesn't work as a lock.
`BridgeLock` from a bridge account to another also doesn't contain the
desired withdrawal information (eg `rollup_withdrawal_event_id`). an
atomic `BridgeUnlock`/`BridgeLock` combo would only work if the
`BridgeUnlock` unlocks the funds to itself, providing
`rollup_withdrawal_event_id`, and then `BridgeLock`s to the receiving
account. `BridgeUnlock` cannot go directly into a different account as
the bridge would no longer be able to access it. however this seems
unwieldly as opposed to just having one action which makes the intention
clear.

## Changes
- slightly refactor `BridgeUnlock` to move checks to their own function
- also slightly refactor `BridgeLock` to move execution and `Deposit`
emission to their own function
- implement `BridgeTransfer` action using existing `BridgeUnlock` checks
and `BridgeLock` execution logic.

## Testing
unit tests

## Changelogs
Changelogs updated.

## Breaking Changelist
- a new action was added, which is a breaking sequencer change.

## Related Issues

closes #1921
  • Loading branch information
noot authored Feb 11, 2025
1 parent 60eefa9 commit 456beb0
Show file tree
Hide file tree
Showing 32 changed files with 1,178 additions and 176 deletions.
1 change: 1 addition & 0 deletions crates/astria-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add method `TracePrefixed::leading_channel` to read the left-most channel of
a trace prefixed ICS20 asset [#1768](https://github.com/astriaorg/astria/pull/1768).
- Add `impl Protobuf for Address<Bech32m>` [#1802](https://github.com/astriaorg/astria/pull/1802).
- Add `BridgeTransfer` action and `BridgeTransfer` variant to `FeeChange`.

### Changed

Expand Down
15 changes: 15 additions & 0 deletions crates/astria-core/src/generated/astria.protocol.fees.v1.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 108 additions & 0 deletions crates/astria-core/src/generated/astria.protocol.fees.v1.serde.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 47 additions & 2 deletions crates/astria-core/src/generated/astria.protocol.transaction.v1.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 456beb0

Please sign in to comment.