Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
coderabbitai bot opened this issue Oct 30, 2024 · 8 comments · May be fixed by #2644
Open

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

coderabbitai bot opened this issue Oct 30, 2024 · 8 comments · May be fixed by #2644
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers katana This issue is related to Katana

Comments

@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2024

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

@kariy kariy changed the title Add chunk_size validation in ForkedClient's get_events method feat(katana): add chunk size limit Oct 30, 2024
@kariy kariy changed the title feat(katana): add chunk size limit feat(katana): add chunk size limit for starknet_getEvents method Oct 30, 2024
@kariy kariy removed their assignment Oct 30, 2024
@kariy kariy added enhancement New feature or request good first issue Good for newcomers katana This issue is related to Katana labels Oct 30, 2024
@sajalbnl
Copy link

Mind if I take this issue?

@kariy
Copy link
Member

kariy commented Oct 30, 2024

@sajalbnl assigned :)

@kariy kariy assigned kariy and sajalbnl and unassigned kariy Oct 30, 2024
@sajalbnl sajalbnl removed their assignment Nov 4, 2024
@jaiminRaiyani
Copy link

Can I start working on this?

@PoulavBhowmick03
Copy link

PoulavBhowmick03 commented Nov 4, 2024

@kariy
Can I work on this? I would love to start contibuting to the dojo repository and this being the first issue
I have a good experience of contributing to the Starknet ecosystem OD Profile
Thank you!

@kariy
Copy link
Member

kariy commented Nov 4, 2024

@sajalbnl do you have any progress so far? if not i will reassign the issue

@PoulavBhowmick03
Copy link

@sajalbnl do you have any progress so far? if not i will reassign the issue

Gm. I believe they have removed their assignment.. as per the logs above

@kariy
Copy link
Member

kariy commented Nov 4, 2024

@PoulavBhowmick03 ah my bad missed that. assigning it to you then

@PoulavBhowmick03
Copy link

@PoulavBhowmick03 ah my bad missed that. assigning it to you then

Thanks!

@PoulavBhowmick03 PoulavBhowmick03 linked a pull request Nov 6, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers katana This issue is related to Katana
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants