From 79bdda4cd7cbd1a8123f0ba8f6efaf620695b73c Mon Sep 17 00:00:00 2001 From: Warren He Date: Mon, 26 Feb 2024 13:47:36 -0800 Subject: [PATCH] floating --- api/spec/v1.yaml | 17 +++++++++++++++++ storage/client/queries/queries.go | 19 ++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/api/spec/v1.yaml b/api/spec/v1.yaml index 0c7a69ba8..8e09dcb9a 100644 --- a/api/spec/v1.yaml +++ b/api/spec/v1.yaml @@ -1357,6 +1357,12 @@ components: format: int32 description: Number of transactions in the block. example: 17 + proposer: + allOf: [$ref: '#/components/schemas/NodeInfo'] + signers: + type: array + items: + allOf: [$ref: '#/components/schemas/NodeInfo'] # TODO: Not available on backend # size: # type: integer @@ -1371,6 +1377,17 @@ components: description: | A consensus block. + NodeInfo: + type: object + properties: + node_id: + type: string + entity_id: + type: string + entity_address: + type: string + entity_metadata: {} + Delegation: type: object required: [amount, shares, validator, delegator] diff --git a/storage/client/queries/queries.go b/storage/client/queries/queries.go index 2cc74299a..b98c89869 100644 --- a/storage/client/queries/queries.go +++ b/storage/client/queries/queries.go @@ -24,13 +24,18 @@ const ( WHERE layer=$1` Blocks = ` - SELECT height, block_hash, time, num_txs - FROM chain.blocks - WHERE ($1::bigint IS NULL OR height >= $1::bigint) AND - ($2::bigint IS NULL OR height <= $2::bigint) AND - ($3::timestamptz IS NULL OR time >= $3::timestamptz) AND - ($4::timestamptz IS NULL OR time < $4::timestamptz) AND - ($5::text IS NULL OR block_hash = $5::text) + SELECT + height, + block_hash, + time, + num_txs + FROM chain.blocks + WHERE + ($1::bigint IS NULL OR height >= $1::bigint) AND + ($2::bigint IS NULL OR height <= $2::bigint) AND + ($3::timestamptz IS NULL OR time >= $3::timestamptz) AND + ($4::timestamptz IS NULL OR time < $4::timestamptz) AND + ($5::text IS NULL OR block_hash = $5::text) ORDER BY height DESC LIMIT $6::bigint OFFSET $7::bigint`