From 063d6048fec00f7ecbeb1e42e4220a43a59f4ba8 Mon Sep 17 00:00:00 2001 From: ptrus Date: Wed, 18 Dec 2024 14:31:03 +0100 Subject: [PATCH] consensus/api/validators: Skip latest block in signed blocks info --- .changelog/835.bugfix.md | 3 +++ storage/client/queries/queries.go | 4 +++- tests/e2e_regression/damask/expected/validator.body | 8 ++++---- tests/e2e_regression/eden/expected/validator.body | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .changelog/835.bugfix.md diff --git a/.changelog/835.bugfix.md b/.changelog/835.bugfix.md new file mode 100644 index 000000000..a56d90254 --- /dev/null +++ b/.changelog/835.bugfix.md @@ -0,0 +1,3 @@ +consensus/api/validators: Skip latest block in signed blocks info + +Skip the latest block since signers are only processed in the following block. diff --git a/storage/client/queries/queries.go b/storage/client/queries/queries.go index f6fb8e7ed..19c542819 100644 --- a/storage/client/queries/queries.go +++ b/storage/client/queries/queries.go @@ -331,7 +331,9 @@ const ( SELECT height, COALESCE($1 = ANY(signer_entity_ids), FALSE) FROM chain.blocks ORDER BY height DESC - LIMIT 100` + LIMIT 100 + -- Skip the latest block since signers are only processed in the next block. + OFFSET 1` ValidatorsData = ` WITH diff --git a/tests/e2e_regression/damask/expected/validator.body b/tests/e2e_regression/damask/expected/validator.body index d569da1bc..de555225b 100644 --- a/tests/e2e_regression/damask/expected/validator.body +++ b/tests/e2e_regression/damask/expected/validator.body @@ -31,10 +31,6 @@ "node_id": "wqd9Yy3n7TWKfYRn2bI9Hd6/623CfC7NCUoRbQ5UkR8=", "rank": 92, "signed_blocks": [ - { - "height": 8049955, - "signed": false - }, { "height": 8049954, "signed": true @@ -430,6 +426,10 @@ { "height": 8049856, "signed": true + }, + { + "height": 8049855, + "signed": true } ], "start_date": "2022-04-11T09:30:00Z", diff --git a/tests/e2e_regression/eden/expected/validator.body b/tests/e2e_regression/eden/expected/validator.body index 626d35fd5..812c7f9e9 100644 --- a/tests/e2e_regression/eden/expected/validator.body +++ b/tests/e2e_regression/eden/expected/validator.body @@ -31,10 +31,6 @@ "node_id": "6wbL5/OxvFGxi55o7AxcwKmfjXbXGC1hw4lfnEZxBXA=", "rank": 1, "signed_blocks": [ - { - "height": 16818955, - "signed": false - }, { "height": 16818954, "signed": true @@ -430,6 +426,10 @@ { "height": 16818856, "signed": true + }, + { + "height": 16818855, + "signed": true } ], "start_date": "2023-11-29T10:02:19Z",