diff --git a/api/src/transactions.rs b/api/src/transactions.rs index 56495de0ad2c6..24e4a1c26c87a 100644 --- a/api/src/transactions.rs +++ b/api/src/transactions.rs @@ -25,8 +25,7 @@ use aptos_api_types::{ AsConverter, EncodeSubmissionRequest, GasEstimation, GasEstimationBcs, HashValue, HexEncodedBytes, LedgerInfo, MoveType, PendingTransaction, SubmitTransactionRequest, Transaction, TransactionData, TransactionOnChainData, TransactionsBatchSingleSubmissionFailure, - TransactionsBatchSubmissionResult, UserTransaction, VerifyInput, VerifyInputWithRecursion, - MAX_RECURSIVE_TYPES_ALLOWED, U64, + TransactionsBatchSubmissionResult, UserTransaction, VerifyInput, VerifyInputWithRecursion, U64, }; use aptos_crypto::{hash::CryptoHash, signing_message}; use aptos_types::{ @@ -1041,10 +1040,12 @@ impl TransactionsApi { ledger_info: &LedgerInfo, data: SubmitTransactionPost, ) -> Result { + pub const MAX_SIGNED_TRANSACTION_DEPTH: usize = 16; + match data { SubmitTransactionPost::Bcs(data) => { let signed_transaction: SignedTransaction = - bcs::from_bytes_with_limit(&data.0, MAX_RECURSIVE_TYPES_ALLOWED as usize) + bcs::from_bytes_with_limit(&data.0, MAX_SIGNED_TRANSACTION_DEPTH) .context("Failed to deserialize input into SignedTransaction") .map_err(|err| { SubmitTransactionError::bad_request_with_code( diff --git a/api/types/src/move_types.rs b/api/types/src/move_types.rs index 45a1c0111e118..3b0efb62b9bd6 100644 --- a/api/types/src/move_types.rs +++ b/api/types/src/move_types.rs @@ -523,12 +523,7 @@ pub enum MoveType { /// Maximum number of recursive types - Same as (non-public) /// move_core_types::safe_serialize::MAX_TYPE_TAG_NESTING -/// We keep 16 for legacy tests -pub const MAX_RECURSIVE_TYPES_ALLOWED: u8 = if cfg!(test) { - 16 -} else { - 8 // = move_core_types::safe_serialize::MAX_TYPE_TAG_NESTING -}; +pub const MAX_RECURSIVE_TYPES_ALLOWED: u8 = 8; impl VerifyInputWithRecursion for MoveType { fn verify(&self, recursion_count: u8) -> anyhow::Result<()> {