diff --git a/protocol/x/clob/types/constants.go b/protocol/x/clob/types/constants.go index c0eaf75392..069e7646e7 100644 --- a/protocol/x/clob/types/constants.go +++ b/protocol/x/clob/types/constants.go @@ -8,6 +8,10 @@ import ( // `MsgPlaceOrder` or `MsgCancelOrder` message will be considered valid by the validator. const ShortBlockWindow uint32 = 20 +// MaxMsgBatchCancelBatchSize represents the maximum number of cancels that a MsgBatchCancel +// can have in one Msg. +const MaxMsgBatchCancelBatchSize uint32 = 100 + // StatefulOrderTimeWindow represents the maximum amount of time in seconds past the current block time that a // long-term/conditional `MsgPlaceOrder` message will be considered valid by the validator. const StatefulOrderTimeWindow time.Duration = 95 * 24 * time.Hour // 95 days. diff --git a/protocol/x/clob/types/errors.go b/protocol/x/clob/types/errors.go index 5f2ec04f12..779d95fbf6 100644 --- a/protocol/x/clob/types/errors.go +++ b/protocol/x/clob/types/errors.go @@ -206,6 +206,11 @@ var ( 44, "invalid time in force", ) + ErrInvalidBatchCancel = errorsmod.Register( + ModuleName, + 45, + "Invalid Batch Cancel", + ) // Liquidations errors. ErrInvalidLiquidationsConfig = errorsmod.Register( diff --git a/protocol/x/clob/types/message_batch_cancel.go b/protocol/x/clob/types/message_batch_cancel.go index 08d0295704..39d266ef23 100644 --- a/protocol/x/clob/types/message_batch_cancel.go +++ b/protocol/x/clob/types/message_batch_cancel.go @@ -9,7 +9,7 @@ import ( var _ sdk.Msg = &MsgBatchCancel{} -// NewMsgCancelOrderShortTerm constructs a MsgBatchCancel from an `OrderId` and a `GoodTilBlock`. +// NewMsgBatchCancel constructs a MsgBatchCancel. func NewMsgBatchCancel(subaccountId types.SubaccountId, cancelBatch []OrderBatch, goodTilBlock uint32) *MsgBatchCancel { return &MsgBatchCancel{ SubaccountId: subaccountId, @@ -18,7 +18,7 @@ func NewMsgBatchCancel(subaccountId types.SubaccountId, cancelBatch []OrderBatch } } -// ValidateBasic performs stateless validation for +// ValidateBasic performs stateless validation for the `MsgBatchCancel` msg. func (msg *MsgBatchCancel) ValidateBasic() (err error) { subaccountId := msg.GetSubaccountId() if err := subaccountId.Validate(); err != nil {