Skip to content

Commit f7bba8d

Browse files
committed
use const for max length
1 parent 5827fec commit f7bba8d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/types/messages.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ use ed25519_dalek::{PublicKey, Signature, Verifier};
1515
use serde_json::json;
1616
use solana_sdk::{pubkey::Pubkey, transaction::VersionedTransaction};
1717

18+
pub const MAX_SIGNED_MSG_BORSH_LEN: usize = SignedMsgOrderParamsDelegateMessage::INIT_SPACE + 8;
19+
pub const MAX_SIGNED_MSG_HEX_LEN: usize = MAX_SIGNED_MSG_BORSH_LEN * 2;
20+
1821
#[derive(Clone, Debug, PartialEq)]
1922
pub struct SignedOrderTypeWithLen {
2023
/// length of the signed order when borsh encoded
@@ -121,7 +124,7 @@ impl IncomingSignedMessage {
121124
pub struct OrderMetadataAndMessage {
122125
pub signing_authority: Pubkey,
123126
pub taker_authority: Pubkey,
124-
#[max_len(2*(SignedMsgOrderParamsDelegateMessage::INIT_SPACE + 8))]
127+
#[max_len(MAX_SIGNED_MSG_HEX_LEN)]
125128
pub order_message: Vec<u8>,
126129
pub deserialized_order_message: SignedOrderType,
127130
pub order_signature: [u8; 64],

0 commit comments

Comments
 (0)