Skip to content

Commit

Permalink
add e2e test case where delayed MsgCompleteBridge fails to execute
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Oct 24, 2023
1 parent 37dcee8 commit ebf05a2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions protocol/testutil/constants/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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(),
Expand Down
17 changes: 17 additions & 0 deletions protocol/x/bridge/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ func TestBridge_Success(t *testing.T) {
blockTime: time.Now(),
expectNonEmptyBridgeTx: true,
},
"Success: 1 bridge event with 0 coin denom, 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,
Expand Down

0 comments on commit ebf05a2

Please sign in to comment.