Skip to content

Commit

Permalink
api: add related runtime and round fields to consensus events
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Feb 1, 2024
1 parent 3a81257 commit 2b0f121
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions api/spec/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion storage/client/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b0f121

Please sign in to comment.