Skip to content

feat(katana): add chunk size limit for starknet_getEvents method #2596

@coderabbitai

Description

@coderabbitai

fn events(
&self,
from_block: BlockIdOrTag,
to_block: BlockIdOrTag,
address: Option<ContractAddress>,
keys: Option<Vec<Vec<Felt>>>,
continuation_token: Option<String>,
chunk_size: u64,
) -> StarknetApiResult<EventsPage> {
let provider = self.inner.backend.blockchain.provider();
let from = if BlockIdOrTag::Tag(BlockTag::Pending) == from_block {
EventBlockId::Pending
} else {
let num = provider.convert_block_id(from_block)?;
EventBlockId::Num(num.ok_or(StarknetApiError::BlockNotFound)?)
};
let to = if BlockIdOrTag::Tag(BlockTag::Pending) == to_block {
EventBlockId::Pending

we should limit the chunk size to avoid getting dos by giving an insanely large value. the limit should be configurable through the cli

Metadata

Metadata

Labels

enhancementNew feature or requestgood first issueGood for newcomerskatanaThis issue is related to Katana

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions