Skip to content

Commit

Permalink
fix: ensure unused sol deposit channels are closed (#5312)
Browse files Browse the repository at this point in the history
* chore: fix closing of unused deposit channels

* chore: update changelog

---------

Co-authored-by: albert <allimos3@gmail.com>
  • Loading branch information
dandanlen and albert-llimos authored Oct 7, 2024
1 parent 839eb60 commit 4aa38bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes included in each Chainflip release will be documented in this file.

## [1.6.7] - 2024-09-25

### Fixes

- Add missing broker fees migration.
- Close expired Solana channels.

## [1.6.6] - 2024-09-24

### Fixes
Expand Down
8 changes: 6 additions & 2 deletions engine/src/witness/sol/sol_deposits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ where
.filter_map(move |(deposit_channel, amount)| {
let amount: SolAmount = amount.saturated_into(); // TODO: Change the DeltaBasedIngress to not use the Chains Amount type but
// instead use u256 or u128 or some generic.
let (_, current_total_ingressed) =
let (deposit_details, current_total_ingressed) =
deposit_channels.get(deposit_channel.address()).unwrap();
if amount != current_total_ingressed.amount ||
slot < current_total_ingressed.block_number
slot < current_total_ingressed.block_number ||
// We avoid submitting an extrinsic if the amount is unchanged. However, the delta_based_ingress election won't close a
// channel until at least one ingress submission reaches consensus. To ensure this happens, we submit the amount on the
// first witnessed slot after the deposit channel's close block.
slot >= deposit_details.close_block
{
Some((
*deposit_channel.address(),
Expand Down

0 comments on commit 4aa38bb

Please sign in to comment.