Skip to content

Commit

Permalink
MsgBatchCancel Skip sequence number validation (#1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfung-dydx authored Jun 14, 2024
1 parent cafe79f commit f3b6fd7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protocol/app/ante/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func ShouldSkipSequenceValidation(msgs []sdk.Msg) (shouldSkipValidation bool) {
}
// This is a `GoodTilBlock` message, continue to check the next message.
continue
case
*clobtypes.MsgBatchCancel:
// MsgBatchCancel only supports short term orders.
continue
default:
// Early return for messages that require sequence number validation.
return false
Expand Down
13 changes: 13 additions & 0 deletions protocol/app/ante/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ func TestSkipSequenceValidation(t *testing.T) {
},
shouldSkipValidation: true,
},
"single batch cancel message": {
msgs: []sdk.Msg{
constants.Msg_BatchCancel,
},
shouldSkipValidation: true,
},
"single transfer message": {
msgs: []sdk.Msg{
constants.Msg_Transfer,
Expand Down Expand Up @@ -86,6 +92,13 @@ func TestSkipSequenceValidation(t *testing.T) {
},
shouldSkipValidation: false,
},
"mix of conditional orders and short term batch cancel orders": {
msgs: []sdk.Msg{
constants.Msg_BatchCancel,
constants.Msg_PlaceOrder_Conditional,
},
shouldSkipValidation: false,
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
Expand Down

0 comments on commit f3b6fd7

Please sign in to comment.