diff --git a/protocol/testutil/constants/bridge.go b/protocol/testutil/constants/bridge.go index a33af218f9..ffd9d78c35 100644 --- a/protocol/testutil/constants/bridge.go +++ b/protocol/testutil/constants/bridge.go @@ -33,6 +33,10 @@ func init() { var ( // Private + emptyCoin = sdk.Coin{ + Denom: "adv4tnt", + Amount: sdkmath.NewInt(0), + } coin = sdk.Coin{ Denom: "adv4tnt", Amount: sdkmath.NewIntFromUint64(888), @@ -66,6 +70,12 @@ var ( Coin: coin, EthBlockHeight: 3, } + BridgeEvent_Id4_Height0_EmptyCoin = types.BridgeEvent{ + Id: 0, + Address: AliceAccAddress.String(), + Coin: emptyCoin, + EthBlockHeight: 0, + } BridgeEvent_Id55_Height15 = types.BridgeEvent{ Id: 55, Address: DaveAccAddress.String(), diff --git a/protocol/x/bridge/app_test.go b/protocol/x/bridge/app_test.go index 610a9acba1..bee2b4a49d 100644 --- a/protocol/x/bridge/app_test.go +++ b/protocol/x/bridge/app_test.go @@ -72,6 +72,23 @@ func TestBridge_Success(t *testing.T) { blockTime: time.Now(), expectNonEmptyBridgeTx: true, }, + "Success: 1 bridge event with 0 coin amount, delay 5 blocks": { + bridgeEvents: []bridgetypes.BridgeEvent{ + constants.BridgeEvent_Id4_Height0_EmptyCoin, + }, + proposeParams: bridgetypes.ProposeParams{ + MaxBridgesPerBlock: 2, + ProposeDelayDuration: 0, + SkipRatePpm: 0, // do not skip proposing bridge events. + SkipIfBlockDelayedByDuration: time.Second * 10, + }, + safetyParams: bridgetypes.SafetyParams{ + IsDisabled: false, + DelayBlocks: 5, + }, + blockTime: time.Now(), + expectNonEmptyBridgeTx: true, + }, "Success: 4 bridge events, delay 27 blocks": { bridgeEvents: []bridgetypes.BridgeEvent{ constants.BridgeEvent_Id0_Height0, diff --git a/protocol/x/delaymsg/keeper/dispatch.go b/protocol/x/delaymsg/keeper/dispatch.go index d48ca90574..9385df1092 100644 --- a/protocol/x/delaymsg/keeper/dispatch.go +++ b/protocol/x/delaymsg/keeper/dispatch.go @@ -51,7 +51,17 @@ func DispatchMessagesForBlock(k types.DelayMsgKeeper, ctx sdk.Context) { events = append(events, res.GetEvents()...) return nil }); err != nil { - k.Logger(ctx).Error("failed to execute delayed message", types.IdLogKey, id, constants.ErrorLogKey, err) + k.Logger(ctx).Error( + "failed to execute delayed message", + types.IdLogKey, + id, + constants.ErrorLogKey, + err, + types.MessageContentLogKey, + msg.String(), + types.MessageTypeUrlLogKey, + delayedMsg.Msg.TypeUrl, + ) } } diff --git a/protocol/x/delaymsg/types/keys.go b/protocol/x/delaymsg/types/keys.go index 8664648008..dcd2aa2c7c 100644 --- a/protocol/x/delaymsg/types/keys.go +++ b/protocol/x/delaymsg/types/keys.go @@ -20,8 +20,3 @@ const ( // NextDelayedMessageIdKey is the key to retrieve next delayed message id. NextDelayedMessageIdKey = "NextDelayedMessageId" ) - -// Log -const ( - IdLogKey = "id" -) diff --git a/protocol/x/delaymsg/types/logs.go b/protocol/x/delaymsg/types/logs.go new file mode 100644 index 0000000000..888531d5d3 --- /dev/null +++ b/protocol/x/delaymsg/types/logs.go @@ -0,0 +1,8 @@ +package types + +// Log +const ( + IdLogKey = "id" + MessageContentLogKey = "message_content" + MessageTypeUrlLogKey = "message_type_url" +)