Skip to content

Commit

Permalink
Merge pull request #465 from ComposableFi/rustninja/eth-bridge-ibc-mi…
Browse files Browse the repository at this point in the history
…n-timestamp

Introduced the validation to not allow ibc with timeout timestamp less then X nanos.
  • Loading branch information
kkast authored Mar 19, 2024
2 parents 3bcb8c6 + d662505 commit cb00202
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 31 deletions.
4 changes: 4 additions & 0 deletions custom/ibc-transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"context"
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
Expand Down Expand Up @@ -29,6 +30,9 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ
if params.ChannelFees != nil && len(params.ChannelFees) > 0 {
channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel)
if channelFee != nil {
if channelFee.MinTimeoutTimestamp > 0 && msg.TimeoutTimestamp < channelFee.MinTimeoutTimestamp {
return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer")
}
coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom)
if coin != nil {
return &types.MsgTransferResponse{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ message ChannelFee{
string channel = 1;
repeated CoinItem allowed_tokens = 2;
string fee_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint64 min_timeout_timestamp = 4;
}

message CoinItem{
Expand Down
97 changes: 67 additions & 30 deletions x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/transfermiddleware/types/parachain_token_info.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb00202

Please sign in to comment.