From d92613b973eb2f9c71e75db6574eb95e49dd4928 Mon Sep 17 00:00:00 2001 From: Warren He Date: Tue, 2 Jan 2024 16:01:15 -0800 Subject: [PATCH] api: add related runtime and round fields to consensus events --- api/spec/v1.yaml | 5 +++++ storage/client/client.go | 2 +- storage/client/queries/queries.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/spec/v1.yaml b/api/spec/v1.yaml index 86894aeba..c21d7a9a6 100644 --- a/api/spec/v1.yaml +++ b/api/spec/v1.yaml @@ -1581,6 +1581,11 @@ components: Hash of this event's originating transaction. Absent if the event did not originate from a transaction. example: *tx_hash_1 + related_runtime: + type: string + related_runtime_round: + type: integer + format: int64 type: description: The type of the event. $ref: '#/components/schemas/ConsensusEventType' diff --git a/storage/client/client.go b/storage/client/client.go index 1a7977604..2b4147486 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 0de4b37aa..c11161241 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