Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions crates/rpc/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ impl api_server::Api for RpcService {
) -> Result<Response<proto::rpc::SyncTransactionsResponse>, Status> {
debug!(target: COMPONENT, request = ?request);

check::<QueryParamAccountIdLimit>(request.get_ref().account_ids.len())?;

self.store.clone().sync_transactions(request).await
}

Expand Down Expand Up @@ -536,14 +538,6 @@ static RPC_LIMITS: LazyLock<proto::rpc::RpcLimits> = LazyLock::new(|| {
"SyncTransactions".into(),
endpoint_limits(&[(AccountId::PARAM_NAME, AccountId::LIMIT)]),
),
(
"SyncAccountVault".into(),
endpoint_limits(&[(AccountId::PARAM_NAME, AccountId::LIMIT)]),
),
(
"SyncAccountStorageMaps".into(),
endpoint_limits(&[(AccountId::PARAM_NAME, AccountId::LIMIT)]),
),
("SyncNotes".into(), endpoint_limits(&[(NoteTag::PARAM_NAME, NoteTag::LIMIT)])),
("GetNotesById".into(), endpoint_limits(&[(NoteId::PARAM_NAME, NoteId::LIMIT)])),
(
Expand Down
27 changes: 8 additions & 19 deletions crates/rpc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,26 +512,15 @@ async fn get_limits_endpoint() {
QueryParamAccountIdLimit::LIMIT
);

let sync_account_vault =
limits.endpoints.get("SyncAccountVault").expect("SyncAccountVault should exist");
assert_eq!(
sync_account_vault.parameters.get(QueryParamAccountIdLimit::PARAM_NAME),
Some(&(QueryParamAccountIdLimit::LIMIT as u32)),
"SyncAccountVault {} limit should be {}",
QueryParamAccountIdLimit::PARAM_NAME,
QueryParamAccountIdLimit::LIMIT
// SyncAccountVault and SyncAccountStorageMaps accept a singular account_id,
// not a repeated list, so they do not have list parameter limits.
assert!(
!limits.endpoints.contains_key("SyncAccountVault"),
"SyncAccountVault should not have list parameter limits"
);

let sync_account_storage_maps = limits
.endpoints
.get("SyncAccountStorageMaps")
.expect("SyncAccountStorageMaps should exist");
assert_eq!(
sync_account_storage_maps.parameters.get(QueryParamAccountIdLimit::PARAM_NAME),
Some(&(QueryParamAccountIdLimit::LIMIT as u32)),
"SyncAccountStorageMaps {} limit should be {}",
QueryParamAccountIdLimit::PARAM_NAME,
QueryParamAccountIdLimit::LIMIT
assert!(
!limits.endpoints.contains_key("SyncAccountStorageMaps"),
"SyncAccountStorageMaps should not have list parameter limits"
);

// Verify GetNotesById endpoint
Expand Down
Loading