Standardize Stellar Event IDs #1843
Replies: 5 comments 9 replies
-
Does anyone have any concerns about NOT exposing event ID to downstream users? |
Beta Was this translation helpful? Give feedback.
-
Does anyone have any concerns with these two problems? |
Beta Was this translation helpful? Give feedback.
-
What's a reasonable # bit/byte to allocate for event index given the potentially larger number of diagnostic events compared to just contract events? |
Beta Was this translation helpful? Give feedback.
-
nit: I think you're missing deterministic. |
Beta Was this translation helpful? Give feedback.
-
These can (and should) be ignored. Only the actual contract events are hashed into ledger, everything else is subject to change. Requirement for deterministic ids for the diagnostic events seems problematic to me, as it requires diagnostic events to be stable, which has never been a requirement. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal
I'd like to have standardized event IDs for Stellar events similarly to how how there is a standardized operation ID in SEP-35
Motivation
It is useful for DB system checks to have a unique ID associated with Stellar events such as for deduplication. This event ID should not be exposed to downstream users unless this discussion provides strong evidence that the event IDs should be exposed to users.
Real user cases from the ecosystem:
An ecosystem partner (Dune) has already requested some sort of event ID for their ingestion of Stellar events into the
history_contract_eventstable.@tomerweller for his mini-indexer
Requirements
The main requirement is that the event IDs are unique, ordered, and deterministic
Caveats and Concerns
Event Index
AFAIK there isn't a way to give events ordered deterministic unique IDs without the use of an event index.
For example, a smart contract may emit events that are identical but are each legitimate events. This is the case when say within the same operation
userA sends 10 XLM to userBtwice which would then create two{type:transfer, from:userA, to:userB, asset:XLM, amount:10}that would have the same operation TOIDThis could cause problems in the case the event index changes either through new events being emitted whether through a protocol upgrade that adds new historical events or in the case of the state archival incident where new events were added to cover the discrepancy between state and events.
It's not likely but not impossible for event index changes to happen in the future. But because of the requirements and user cases listed above I don't think needing to regenerate or reingest different event IDs is a problem because the purpose of the event IDs are for backend DB integrity checks and NOT for downstream users to actually use the event IDs.
Diagnostic Events and Contract Events
When diagnostic events are enabled there is a whole other stream of events. Diagnostic events also contain contract events. So contract events will in theory be located in two spots within the ledger metadata.
One problem this can cause is the exact same contract event could possibly have 2 different event IDs. One from the index within contract events and one from index of diagnostic events
The proposed fix for this is to add a
typecharacter to the event ID to signify whether the event comes from contract events or diagnostic events.Event ID Format
<TOID of ledger>refers to TOID called with (ledger sequence, 0, 0)<type>for eithercfor contract eventsdfor diagnostic eventsctype and one withdtype if diagnostic events are enabled<event index>is the correctly ordered eventsAlternative - Stellar RPC Event ID
Alternatively, we can use Stellar RPC's current event ID definition defined here
This would effectively be
<TOID>-<event index>with the following TOID definitionsBeta Was this translation helpful? Give feedback.
All reactions