Skip to content

Handle chronological event interleaving #414

Description

@Shaptic

In CAP-67, events will occur at two cadences:

  • Operation-level: these will be present in an array of arrays, OperationMetaV2. Each array corresponds to the events generated by the respective operation in the transaction. For Soroban transactions, this will be an array of length 1.
  • Transaction-level: this will be an array with one or two events. In the Soroban case, there will be an additional "refunded fee" event when there is a refund.

In RPC, we made an assumption about the event ID that latched onto the 1:1 notion of Soroban transaction:operations. Namely, the ID / cursor that is used for pagination and querying looks like this:

<toid>-<event index>

where the <event-index> iterates directly through the DiagnosticEvent[] array. However, if we choose to enable event consumers to see a chronologically accurate picture of value movement in CAP-67, we need to process events in a particular, different order:

  • ALL tx-level fee charges
  • Per transaction operation-level events
  • ALL tx-level fee refunds

To support this, iteration order needs to change and the ID needs to support paginating in this fashion. If we want to deviate from that for the purposes of a different user experience, we should discuss that here!

Relevant discussion: stellar/stellar-protocol#1553 (reply in thread)

(cc @tamirms: please edit with any missing details!)

Metadata

Metadata

Type

No type

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions