Skip to content

Commit

Permalink
feat: only update sequence number if it's not zero (which indicates u…
Browse files Browse the repository at this point in the history
…sing dymension ante) (#49)
  • Loading branch information
zale144 authored Sep 18, 2024
1 parent 11dea30 commit 15cfcfd
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions relayer/chains/cosmos/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,17 @@ func (cc *CosmosProvider) buildMessages(
txf = txf.WithMemo(memo)
}

sequence = txf.Sequence()
cc.updateNextAccountSequence(sequenceGuard, sequence)
if sequence < sequenceGuard.NextAccountSequence {
sequence = sequenceGuard.NextAccountSequence
txf = txf.WithSequence(sequence)
// Dymension specific:
// Since the relayer is now able to register on the rollapp without any funds or account for its key,
// the account creation is handled in the ante handler. However, the local account sequence guard assumes that
// the account already exists at this point. This is a workaround to ensure that the sequence is not incremented when
// the account does not yet exist.
if sequence = txf.Sequence(); sequence > 0 {
cc.updateNextAccountSequence(sequenceGuard, sequence)
if sequence < sequenceGuard.NextAccountSequence {
sequence = sequenceGuard.NextAccountSequence
txf = txf.WithSequence(sequence)
}
}

// Cannot feegrant your own TX
Expand Down

0 comments on commit 15cfcfd

Please sign in to comment.