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

[Access] Event streaming data issues #6442

Open
sideninja opened this issue Sep 6, 2024 · 3 comments
Open

[Access] Event streaming data issues #6442

sideninja opened this issue Sep 6, 2024 · 3 comments
Assignees
Labels
Bug Something isn't working S-Access

Comments

@sideninja
Copy link
Member

I have detected two issues on ANs using event streaming related to missing or duplicate data.

Duplicated event
An EVM block event on the Flow block with height 85991382 on the AN-008 is streamed twice but there should only be one event. I could reproduce the issue using Go SDK and validated that when I fetch the events with method 1 I get only one event and when I use streaming I get two.

method 1 (correct response)

	result, err := flowClient.GetEventsForHeightRange(ctx, "A.e467b9dd11fa00df.EVM.BlockExecuted", 85991382, 85991382)
	fmt.Println(result[0].Events)

streaming (duplicate)

	evs, errs, err := flowClient.SubscribeEventsByBlockHeight(ctx, 85991382, flow.EventFilter{
		EventTypes: []string{"A.e467b9dd11fa00df.EVM.BlockExecuted"},
	})

	for {
		select {
		case ev := <-evs:
			fmt.Println("event", ev.Height, ev.Events)

			for _, x := range ev.Events {
				b, err := events.DecodeBlockEventPayload(x.Value)
				fmt.Println(b, err)
			}
		case er := <-errs:
			fmt.Println("err", er)
		}
	}

output streaming:

// event twice
event 85991383 [A.e467b9dd11fa00df.EVM.BlockExecuted: 0x063ee1f8615cf98d53feffcad4e42a4b82f78e4c987ea7ae2725880571cdff3b A.e467b9dd11fa00df.EVM.BlockExecuted: 0x063ee1f8615cf98d53feffcad4e42a4b82f78e4c987ea7ae2725880571cdff3b]

// decoded block both are same
&{10248 0x2a83a9d4341a504de96ab5a6b0c81c162a99e47da07a66821ce8022b845213d3 1725485128 6000000010000000000 0 0xb9dd89899a1513c768a5624b7bcbcf238644e0591a9d94f17bd1e4fb15064528 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x14d4c5249af957d6d3381eb806ba6a3eb7427639cfb751d445a31205d73a6c40} <nil>

&{10248 0x2a83a9d4341a504de96ab5a6b0c81c162a99e47da07a66821ce8022b845213d3 1725485128 6000000010000000000 0 0xb9dd89899a1513c768a5624b7bcbcf238644e0591a9d94f17bd1e4fb15064528 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x14d4c5249af957d6d3381eb806ba6a3eb7427639cfb751d445a31205d73a6c40} <nil>

Missing event
The AN 003 didn't have an EVM block event using streaming but it should contain it. The flow block for the event is 86004555. After one day I believe the event appeared so I can't reproduce the issue, unfortunately.

@sideninja sideninja added the Bug Something isn't working label Sep 6, 2024
@sideninja
Copy link
Member Author

Same duplicate is true for AN 003 for Flow block height 86017687

@Guitarheroua Guitarheroua self-assigned this Sep 6, 2024
@peterargue
Copy link
Contributor

peterargue commented Sep 6, 2024

@sideninja I tried to reproduce using this script https://gist.github.com/peterargue/6bd8c235f36cc179d5605076f8b4755f

when I run it I get

 $ go run main.go
event 85991382 [A.e467b9dd11fa00df.EVM.BlockExecuted: 0x063ee1f8615cf98d53feffcad4e42a4b82f78e4c987ea7ae2725880571cdff3b]
&{10247 0xb9dd89899a1513c768a5624b7bcbcf238644e0591a9d94f17bd1e4fb15064528 1725485128 6000000010000000000 0 0xbf6e01ddb47bda56469bfa7010514f13f2eccdba14e141595b9c322b16f8f5c6 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x3e9479bced9aced986055a0f13d839f312e698f33e90741fc4b1dd2029511a96} <nil>

I think that shows it only returning one event

that script also has some code to stream all events using the vanilla grpc client, and I get this

$ go run main.go
2024/09/06 09:35:21 
2024/09/06 09:35:21 event 85991382 0 0x0e56f890392ad3f2a0dcc7a0e859b6d41f3c17556aa85a0f8831ae25a6537e39 0 A.e467b9dd11fa00df.EVM.BlockExecuted

output shows [block height] [tx index] [tx id] [event index] [event type]

What am I missing?

@peterargue
Copy link
Contributor

I also tried using the same script but swapping out with AN3 and 86004555

$ go run main.go
event 86004555 [A.e467b9dd11fa00df.EVM.BlockExecuted: 0x063ee1f8615cf98d53feffcad4e42a4b82f78e4c987ea7ae2725880571cdff3b]
&{23420 0x58e00ff4297e4063e8f87a8ceadd208d655795d58fd41b03441f12214fc9d1b9 1725495919 8489000010000000000 0 0xd784b76e238de3cfe5434048eabf0d01309ef1187f8a88aa786e62516bcd3d1f 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 0x40e3f203cf6acf38fe0744effbaf52624bc24829186841ed83518be352b83edc} <nil>
$ go run main.go
2024/09/06 09:45:52 
...
2024/09/06 09:45:52 event 86004555 2 0x0e56f890392ad3f2a0dcc7a0e859b6d41f3c17556aa85a0f8831ae25a6537e39 0 A.e467b9dd11fa00df.EVM.BlockExecuted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working S-Access
Projects
None yet
Development

No branches or pull requests

3 participants