Skip to content

pallet-tft-bridge: expired burns/refunds never reset block on re-proposal (dead code) #1080

@sameh-farouk

Description

@sameh-farouk

Bug

propose_stellar_burn_transaction_or_add_sig has dead code that prevents burn_tx.block from being reset when a validator re-proposes an expired burn.

Location: substrate-node/pallets/pallet-tft-bridge/src/tft_bridge.rs:226-283

The function loads the burn at line 243 (BurnTransactions::get), then checks BurnTransactions::contains_key at line 263 — which is always true since line 243 already proved existence. This causes an unconditional early return into add_stellar_sig_burn_transaction, skipping the burn_tx.block = now assignment at line 274 (dead code).

add_stellar_sig_burn_transaction updates sequence_number but never updates block.

Same bug exists for refundsadd_stellar_sig_refund_transaction also never updates tx.block.

Impact

After on_finalize expires a burn (sets burn.block = B, clears signatures), the re-proposal adds signatures but block stays at B. Since on_finalize runs after extrinsics in the same block, it checks current_block - B >= RetryInterval — if the gap is ≥ 20 blocks, signatures are cleared in the same block they were added.

Burns get stuck in an infinite expire → re-propose → immediate re-expire loop. They eventually complete through lucky timing but take many cycles instead of one.

Fix

Reset tx.block to the current block in add_stellar_sig_burn_transaction and add_stellar_sig_refund_transaction when tx.signatures.is_empty() (first signature after expiry). Also remove the dead code and redundant contains_key checks.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions