Skip to content

Commit

Permalink
only display hot key if valid, ie published after committee being ena…
Browse files Browse the repository at this point in the history
…cted.
  • Loading branch information
Scitz0 committed Aug 22, 2024
1 parent bebbfb5 commit 6d07974
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
27 changes: 21 additions & 6 deletions files/grest/rpc/governance/committee_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ RETURNS TABLE (
LANGUAGE plpgsql
AS $$
DECLARE
gap_id bigint;
gap_id bigint;
gap_enacted_tx_id bigint;
BEGIN

SELECT INTO gap_id id
FROM public.gov_action_proposal
WHERE type = 'NewCommittee'
AND enacted_epoch IS NOT NULL
ORDER BY enacted_epoch DESC
SELECT
gap.id,
CASE
WHEN gap.id IS NULL THEN NULL
ELSE (
SELECT eic.i_last_tx_id
FROM grest.epoch_info_cache AS eic
WHERE eic.epoch_no = (gap.enacted_epoch - 1)
)
END
INTO gap_id, gap_enacted_tx_id
FROM public.gov_action_proposal AS gap
WHERE gap.type = 'NewCommittee'
AND gap.enacted_epoch IS NOT NULL
ORDER BY gap.enacted_epoch DESC
LIMIT 1;

RETURN QUERY (
Expand Down Expand Up @@ -67,6 +78,10 @@ BEGIN
WHERE cdr.cold_key_id = cr.cold_key_id
AND cdr.tx_id > cr.tx_id
)
AND CASE
WHEN gap_enacted_tx_id IS NULL THEN TRUE
ELSE cr.tx_id > gap_enacted_tx_id
END
ORDER BY cr.id DESC
LIMIT 1
) AS hot_key ON TRUE
Expand Down
2 changes: 1 addition & 1 deletion specs/results/koiosapi-guild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5457,7 +5457,7 @@ components:
type:
- string
- 'null'
description: Committee member key hash from last hot key authorization certificate in hex format
description: Committee member key hash from last valid hot key authorization certificate in hex format
example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472
cc_hot_has_script:
type:
Expand Down
2 changes: 1 addition & 1 deletion specs/results/koiosapi-mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5457,7 +5457,7 @@ components:
type:
- string
- 'null'
description: Committee member key hash from last hot key authorization certificate in hex format
description: Committee member key hash from last valid hot key authorization certificate in hex format
example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472
cc_hot_has_script:
type:
Expand Down
2 changes: 1 addition & 1 deletion specs/results/koiosapi-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5457,7 +5457,7 @@ components:
type:
- string
- 'null'
description: Committee member key hash from last hot key authorization certificate in hex format
description: Committee member key hash from last valid hot key authorization certificate in hex format
example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472
cc_hot_has_script:
type:
Expand Down
2 changes: 1 addition & 1 deletion specs/results/koiosapi-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5457,7 +5457,7 @@ components:
type:
- string
- 'null'
description: Committee member key hash from last hot key authorization certificate in hex format
description: Committee member key hash from last valid hot key authorization certificate in hex format
example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472
cc_hot_has_script:
type:
Expand Down
2 changes: 1 addition & 1 deletion specs/templates/4-api-schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2667,7 +2667,7 @@ schemas:
type:
- string
- 'null'
description: Committee member key hash from last hot key authorization certificate in hex format
description: Committee member key hash from last valid hot key authorization certificate in hex format
example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472
cc_hot_has_script:
type:
Expand Down

0 comments on commit 6d07974

Please sign in to comment.