l1Sequence, err := ms.IncreaseNextL1Sequence(ctx, bridgeId)
if err != nil {
	return nil, err
}
finalizedL1Sequence, err := ms.GetNextL1Sequence(ctx)
if err != nil {
	return nil, err
}

if req.Sequence < finalizedL1Sequence {
	// No op instead of returning an error
	return &types.MsgFinalizeTokenDepositResponse{Result: types.NOOP}, nil
} else if req.Sequence > finalizedL1Sequence {
	return nil, types.ErrInvalidSequence
}
if req.Sequence > finalizedL1Sequence {
	return nil, types.ErrInvalidSequence
}
func Test_InitiateTokenDeposit_NonExistBridge(t *testing.T) {
	ctx, input := createDefaultTestInput(t)

	ms := keeper.NewMsgServerImpl(input.OPHostKeeper)
	config := types.BridgeConfig{
		Proposer:              addrsStr[0],
		Challenger:            addrsStr[1],
		SubmissionInterval:    time.Second * 10,
		FinalizationPeriod:    time.Second * 60,
		SubmissionStartHeight: 1,
		Metadata:              []byte{1, 2, 3},
		BatchInfo:             types.BatchInfo{Submitter: addrsStr[0], ChainType: types.BatchInfo_INITIA},
	}
	createRes, err := ms.CreateBridge(ctx, types.NewMsgCreateBridge(addrsStr[0], config))
	require.NoError(t, err)
	require.Equal(t, uint64(1), createRes.BridgeId) // Bridge with ID 1 is created

	amount := sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100))
	input.Faucet.Fund(ctx, addrs[1], amount)
	_, err = ms.InitiateTokenDeposit(
		ctx,
		types.NewMsgInitiateTokenDeposit(addrsStr[1], 100, "l2_addr", amount, []byte("messages")), // Deposit to non-exist bridge, ID 100
	)
	require.NoError(t, err)
	require.True(t, input.BankKeeper.GetBalance(ctx, addrs[1], sdk.DefaultBondDenom).IsZero())
	// Bridge with ID 100 that doesn't exist, holds some amount
	require.Equal(t, amount, input.BankKeeper.GetBalance(ctx, types.BridgeAddress(100), sdk.DefaultBondDenom))
}
	func (ms MsgServer) InitiateTokenDeposit(ctx context.Context, req *types.MsgInitiateTokenDeposit) (*types.MsgInitiateTokenDepositResponse, error) {
		// ...

		coin := req.Amount
		bridgeId := req.BridgeId
		l1Sequence, err := ms.IncreaseNextL1Sequence(ctx, bridgeId)
		if err != nil {
			return nil, err
		}

+		if nextBridgeId, err := ms.GetNextBridgeId(ctx); err != nil {
+			return nil, err
+		} else if bridgeId >= nextBridgeId {
+			return nil, types.ErrBridgeNotFound
+		}

		// transfer only positive amount
		if coin.IsPositive() {
			// send the funds to bridge address
			bridgeAddr := types.BridgeAddress(bridgeId)
			if err := ms.bankKeeper.SendCoins(ctx, sender, bridgeAddr, sdk.NewCoins(coin)); err != nil {
				return nil, err
			}
		}

		// ...
	}
