diff --git a/api/spec/v1.yaml b/api/spec/v1.yaml index a2bb50caf..707e9284a 100644 --- a/api/spec/v1.yaml +++ b/api/spec/v1.yaml @@ -1613,6 +1613,20 @@ components: Hash of this event's originating transaction. Absent if the event did not originate from a transaction. example: *tx_hash_1 + related_runtime: + schema: + $ref: '#/components/schemas/Runtime' + description: | + The runtime to which the event relates. + Present only for events of type `roothash.*`. + related_runtime_round: + type: integer + format: int64 + description: | + When applicable, the round in the runtime to which this event + relates. + Present only for events where `type` equals `roothash.finalized` + or `roothash.executor_committed`. type: description: The type of the event. $ref: '#/components/schemas/ConsensusEventType' diff --git a/storage/client/client.go b/storage/client/client.go index 3db0733f3..3cc1e72c9 100644 --- a/storage/client/client.go +++ b/storage/client/client.go @@ -468,7 +468,7 @@ func (c *StorageClient) Events(ctx context.Context, p apiTypes.GetConsensusEvent for res.rows.Next() { var e Event - if err := res.rows.Scan(&e.Block, &e.TxIndex, &e.TxHash, &e.Type, &e.Body); err != nil { + if err := res.rows.Scan(&e.Block, &e.TxIndex, &e.TxHash, &e.RelatedRuntime, &e.RelatedRuntimeRound, &e.Type, &e.Body); err != nil { return nil, wrapError(err) } es.Events = append(es.Events, e) diff --git a/storage/client/queries/queries.go b/storage/client/queries/queries.go index e41ca3616..e88c5291d 100644 --- a/storage/client/queries/queries.go +++ b/storage/client/queries/queries.go @@ -81,7 +81,7 @@ const ( WHERE tx_hash = $1::text` Events = ` - SELECT tx_block, tx_index, tx_hash, type, body + SELECT tx_block, tx_index, tx_hash, related_runtime, related_runtime_round, type, body FROM chain.events WHERE ($1::bigint IS NULL OR tx_block = $1::bigint) AND ($2::integer IS NULL OR tx_index = $2::integer) AND