-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add log_index
field to events emitted by transactions
#157
Comments
My only argument against this, is that I think this will be quite costly to implement on the node end. Event filtering and storage is already fairly complex. |
There was some discussion in Telegram about why this is desirable, so I wanted to summarize the discussion and add some clarification here. The fact that
The problem right now is that the guarantee is being made on a per-client basis. The way that one Starknet client implementation implements ordering is not necessarily the way in which another client implements ordering. a It is also important to understand why this is important. A single transaction may fire the same event (with the exact same parameters) multiple times. This means that the event type and parameters do not uniquely specify the event. Any event crawler must have a strategy to recover from failures mid-crawl. One scenario that crawlers must deal with is that they connect to a different RPC node post-crash than the one they were connected to pre-crash -- an RPC node implementing a different Starknet client. Unless there exists a protocol-level guarantee (like This certainly isn't the highest priority issue to solve, and most event crawlers build custom workarounds to this issue (e.g. Starkscan crawlers suffix To @Mirko-von-Leipzig 's point about how costly it is to implement - if it is very costly to implement, that doesn't mean that Starknet should not specify such information at protocol level. It should just mean that this is a lower priority relative to other development. |
The real tradeoff I see here is that implementing
It might be that such an increase is not acceptable. |
Adding a But the situation might be different for other clients depending on their DB schemas. |
I don't think its enough to know the index within a block -- it would need to be the global index? Otherwise the same problem of ordering remains. I feel like it should be enough to specify in the method description that the events will be returned in chronological order? i.e. block, transaction, event-in-transaction order? |
FILTERED_EVENT already has the block number IIRC, so block number and index within that block, when used together, should allow ordering events globally. Am I missing something? |
Ah no my bad; forgot it already has the block number. A further consideration though: its pretty much impossible for events to be emitted out-of-order since this would break entirely for |
Currently, there is no canonical way to order events in Starknet logs.
This is challenging when analyzing starknet data - any total ordering you impose as an analyst relies on the assumption that all nodes you could connect to emit events in the same order, and that this order is preserved by all RPC middleware.
It would be better if the
log_index
was canonically reported by all nodes as part of thestarknet_getEvents
response.The text was updated successfully, but these errors were encountered: