Skip to content

Conversation

@chrismaree
Copy link
Member

@chrismaree chrismaree commented Dec 4, 2024

simple PR to improve the events utils used on SVM. measurably improves performance and enables us to handle more than 1000 event limt.

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree marked this pull request as draft December 4, 2024 18:30
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
…ve-event-utils' of github.com:across-protocol/contracts into chrismaree/improve-event-utils
@chrismaree chrismaree marked this pull request as ready for review December 5, 2024 11:00
Copy link
Contributor

@Reinis-FRP Reinis-FRP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

return events;

// Fetch events for all signatures in parallel
const eventsWithSlots = await Promise.all(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be resource intensive if there are many signatures. Should we consider batching the Promise.all calls with a configurable batch size to improve efficiency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same net efficiency, right? it's the same number of requests. the bigger issue could be the RPC provider blocking this or having an issue with the number of requests but for now we can leave it like this and improve when we get there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I meant splitting in chunks and run them sequentially. Similarly to how we do it here:
https://github.com/UMAprotocol/protocol/blob/e526e5a1caf68ae7be706f6ef9c996660429282a/packages/common/src/EventUtils.ts#L36-L38

But it's ok for now I think!

Copy link
Contributor

@md0x md0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a performance observation but overall looks good!

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree merged commit 5908cfd into master Dec 6, 2024
9 checks passed
@chrismaree chrismaree deleted the chrismaree/improve-event-utils branch December 6, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants