Skip to content

Commit b77940d

Browse files
authored
bigquery: query for all validators (#1642)
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
1 parent 353af1c commit b77940d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Queries all validators that held Validator Licenses up to a certain record time & migration ID, along with their first and latest validator license renewals.
2+
3+
DECLARE
4+
as_of_record_time timestamp;
5+
DECLARE
6+
migration_id int64;
7+
8+
-- configuration parameters
9+
SET as_of_record_time = PARSE_TIMESTAMP('%FT%TZ', '2025-07-15T00:00:00Z');
10+
SET migration_id = 3;
11+
12+
SELECT DISTINCT
13+
JSON_VALUE(create_arguments, '$.record.fields[0].value.party') as validator_party,
14+
TIMESTAMP_MICROS(MAX(created_at) OVER (PARTITION BY JSON_VALUE(create_arguments, '$.record.fields[0].value.party'))) AS latest_validator_license,
15+
TIMESTAMP_MICROS(MIN(created_at) OVER (PARTITION BY JSON_VALUE(create_arguments, '$.record.fields[0].value.party'))) AS first_validator_license
16+
FROM `da-cn-mainnet.mainnet_da2_scan.scan_sv_1_update_history_creates` c
17+
WHERE c.package_name = "splice-amulet"
18+
AND c.template_id_module_name = "Splice.ValidatorLicense"
19+
AND c.template_id_entity_name = "ValidatorLicense"
20+
AND (c.migration_id < migration_id OR (c.migration_id = migration_id AND c.created_at <= UNIX_MICROS(as_of_record_time)));

0 commit comments

Comments
 (0)