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

starknet monitoring: paginate events #506

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

augustbleeds
Copy link
Collaborator

@augustbleeds augustbleeds commented Aug 6, 2024

https://smartcontract-it.atlassian.net/browse/BCI-3958

monitor was broken because the pagination was never implemented, so for blocks with more than 10 events of the same type, it may be impossible to find the transmission event

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 75%)

See analysis details on SonarQube

chunk, err := c.r.Events(ctx, input)
events = chunk.Events

// TODO: check events.isLastPage, query more if needed
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this todo was never implemented, so this PR is doing it (basically)

t.Run("get new transmission event", func(t *testing.T) {
events, err := client.NewTransmissionsFromEventsAt(context.Background(), contractAddress, 123)
require.NoError(t, err)
assert.Len(t, events, 15)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just assert that we did in fact paginate to get 15 results. if we didn't then we'd only get 10 results


configSetSelector := starknetutils.GetSelectorFromNameFelt("ConfigSet")

if eventsReq.EventFilter.Keys[0][0].Equal(configSetSelector) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

way to distinguish what mocked result to return to the client

@augustbleeds augustbleeds merged commit 4f3cd0c into develop Aug 6, 2024
21 of 22 checks passed
@augustbleeds augustbleeds deleted the augustus.paginate-events branch August 6, 2024 21:00
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.

2 participants