Skip to content

Commit

Permalink
fix seq typo
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Apr 29, 2024
1 parent c464ac9 commit d1618ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions x/fbridge/keeper/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func (k Keeper) handleBridgeTransfer(ctx sdk.Context, sender sdk.AccAddress, amo
panic(fmt.Errorf("cannot burn coins after a successful send to a module account: %v", err))

Check warning on line 25 in x/fbridge/keeper/transfer.go

View check run for this annotation

Codecov / codecov/patch

x/fbridge/keeper/transfer.go#L25

Added line #L25 was not covered by tests
}

nextSeq := k.GetNextSequence(ctx) + 1
k.setNextSequence(ctx, nextSeq)
seq := k.GetNextSequence(ctx)
k.setNextSequence(ctx, seq+1)

return nextSeq, nil
return seq, nil
}

func (k Keeper) GetNextSequence(ctx sdk.Context) uint64 {
Expand Down
10 changes: 6 additions & 4 deletions x/fbridge/keeper/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ func TestHandleBridgeTransfer(t *testing.T) {
bankKeeper.EXPECT().BurnCoins(ctx, types.ModuleName, token).Return(nil)

k := NewKeeper(encCfg.Codec, key, authKeeper, bankKeeper, denom, "gov")
beforeSeq := uint64(2)
targetSeq := uint64(2)
bz := make([]byte, 8)
binary.BigEndian.PutUint64(bz, beforeSeq)
binary.BigEndian.PutUint64(bz, targetSeq)
ctx.KVStore(key).Set(types.KeyNextSeqSend, bz)

afterSeq, err := k.handleBridgeTransfer(ctx, sender, amt)
handledSeq, err := k.handleBridgeTransfer(ctx, sender, amt)
require.NoError(t, err)
require.Equal(t, beforeSeq+1, afterSeq)
require.Equal(t, targetSeq, handledSeq)
afterSeq := k.GetNextSequence(ctx)
require.Equal(t, targetSeq+1, afterSeq)
}

func TestIsValidEthereumAddress(t *testing.T) {
Expand Down

0 comments on commit d1618ce

Please sign in to comment.