From 3d19763cbbb57ccb72fdf2aba8c98e1d49b7d47d Mon Sep 17 00:00:00 2001 From: weiihann Date: Fri, 17 Oct 2025 18:27:06 +0800 Subject: [PATCH 01/18] feat: add address_diffs and address_reads --- migrations/022_execution_accounts_v2.down.sql | 2 + migrations/022_execution_accounts_v2.up.sql | 35 +++++++++ models/transformations/int_address_diffs.sql | 76 +++++++++++++++++++ models/transformations/int_address_reads.sql | 66 ++++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 migrations/022_execution_accounts_v2.down.sql create mode 100644 migrations/022_execution_accounts_v2.up.sql create mode 100644 models/transformations/int_address_diffs.sql create mode 100644 models/transformations/int_address_reads.sql diff --git a/migrations/022_execution_accounts_v2.down.sql b/migrations/022_execution_accounts_v2.down.sql new file mode 100644 index 00000000..bbfa5543 --- /dev/null +++ b/migrations/022_execution_accounts_v2.down.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_diffs ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_reads ON CLUSTER '{cluster}' SYNC; \ No newline at end of file diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/022_execution_accounts_v2.up.sql new file mode 100644 index 00000000..7f984d9f --- /dev/null +++ b/migrations/022_execution_accounts_v2.up.sql @@ -0,0 +1,35 @@ +CREATE TABLE `${NETWORK_NAME}`.int_address_diffs_local on cluster '{cluster}' ( + `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), + `block_number` UInt32 COMMENT 'The block number of the diffs' CODEC(ZSTD(1)), + `tx_count` UInt32 COMMENT 'The number of transactions with diffs' CODEC(ZSTD(1)), +) ENGINE = ReplicatedMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}', +) PARTITION BY cityHash64(`address`) % 16 +ORDER BY + (address) COMMENT 'Table for accounts last access data'; + +CREATE TABLE `${NETWORK_NAME}`.int_address_diffs ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_address_diffs_local ENGINE = Distributed( + '{cluster}', + '${NETWORK_NAME}', + int_address_diffs_local, + cityHash64(`address`) +); + +CREATE TABLE `${NETWORK_NAME}`.int_address_reads_local on cluster '{cluster}' ( + `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), + `block_number` UInt32 COMMENT 'The block number of the reads' CODEC(ZSTD(1)), + `tx_count` UInt32 COMMENT 'The number of transactions with reads' CODEC(ZSTD(1)) +) ENGINE = ReplicatedMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}' +) PARTITION BY cityHash64(`address`) % 16 +ORDER BY + (address, block_number) COMMENT 'Table for accounts reads data'; + +CREATE TABLE `${NETWORK_NAME}`.int_address_reads ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_address_reads_local ENGINE = Distributed( + '{cluster}', + '${NETWORK_NAME}', + int_address_reads_local, + cityHash64(`address`) +); \ No newline at end of file diff --git a/models/transformations/int_address_diffs.sql b/models/transformations/int_address_diffs.sql new file mode 100644 index 00000000..31d69e41 --- /dev/null +++ b/models/transformations/int_address_diffs.sql @@ -0,0 +1,76 @@ +--- +table: int_address_diffs +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - address + - account +dependencies: + - "{{external}}.canonical_execution_balance_diffs" + - "{{external}}.canonical_execution_contracts" + - "{{external}}.canonical_execution_nonce_diffs" + - "{{external}}.canonical_execution_storage_diffs" + - "{{external}}.canonical_execution_transaction" +--- +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +WITH get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash, + FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true +), +all_address_diffs AS ( + SELECT + lower(address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_balance_diffs" "database" }}`.`canonical_execution_balance_diffs` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + + UNION ALL + + SELECT + lower(address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_storage_diffs" "database" }}`.`canonical_execution_storage_diffs` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + + UNION ALL + + SELECT + lower(address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "database" }}`.`canonical_execution_nonce_diffs` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + + UNION ALL + + SELECT + lower(contract_address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_contracts" "database" }}`.`canonical_execution_contracts` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +), +address_diffs AS ( + SELECT + ad.address, + ad.block_number, + ad.transaction_hash + FROM all_address_diffs ad + GLOBAL JOIN get_tx_success g ON ad.transaction_hash = g.transaction_hash +) +SELECT + address, + block_number, + countDistinct(transaction_hash) AS tx_count +FROM address_diffs +GROUP BY address, block_number; diff --git a/models/transformations/int_address_reads.sql b/models/transformations/int_address_reads.sql new file mode 100644 index 00000000..f4c66ee1 --- /dev/null +++ b/models/transformations/int_address_reads.sql @@ -0,0 +1,66 @@ +--- +table: int_address_reads +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - address + - account +dependencies: + - "{{external}}.canonical_execution_balance_reads" + - "{{external}}.canonical_execution_nonce_reads" + - "{{external}}.canonical_execution_storage_reads" + - "{{external}}.canonical_execution_transaction" +--- +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +WITH get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash, + FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true +), +all_address_reads AS ( + SELECT + lower(address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_balance_reads" "database" }}`.`canonical_execution_balance_reads` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + + UNION ALL + + SELECT + lower(contract_address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_storage_reads" "database" }}`.`canonical_execution_storage_reads` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + + UNION ALL + + SELECT + lower(address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_nonce_reads" "database" }}`.`canonical_execution_nonce_reads` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +), +address_reads AS ( + SELECT + ar.address, + ar.block_number, + ar.transaction_hash + FROM all_address_reads ar + GLOBAL JOIN get_tx_success g ON ar.transaction_hash = g.transaction_hash +) +SELECT + address, + block_number, + countDistinct(transaction_hash) AS tx_count +FROM address_reads +GROUP BY address, block_number; From e651ff1572c204601ee50f3bf742e89a4f05ad0a Mon Sep 17 00:00:00 2001 From: weiihann Date: Fri, 17 Oct 2025 18:37:38 +0800 Subject: [PATCH 02/18] refactor: filter on tx success --- .../int_address_first_access.sql | 64 +++++++++++++++---- .../int_address_last_access.sql | 63 ++++++++++++++---- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/models/transformations/int_address_first_access.sql b/models/transformations/int_address_first_access.sql index 72913ed5..99c037c6 100644 --- a/models/transformations/int_address_first_access.sql +++ b/models/transformations/int_address_first_access.sql @@ -18,52 +18,90 @@ dependencies: - "{{external}}.canonical_execution_nonce_diffs" - "{{external}}.canonical_execution_storage_diffs" - "{{external}}.canonical_execution_storage_reads" + - "{{external}}.canonical_execution_transaction" --- INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` -SELECT - address, - min(block_number) AS block_number, - null AS `version` -FROM ( - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_nonce_reads" "helpers" "from" }} FINAL +WITH get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' +), +all_addresses AS ( + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_nonce_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_balance_diffs" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_balance_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_balance_reads" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_balance_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(contract_address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL + SELECT + lower(contract_address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(contract_address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL + SELECT + lower(contract_address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' ) -GROUP BY address; +SELECT + a.address, + min(a.block_number) AS block_number, + NULL AS version +FROM all_addresses a +GLOBAL JOIN get_tx_success g ON a.transaction_hash = g.transaction_hash +GROUP BY a.address; diff --git a/models/transformations/int_address_last_access.sql b/models/transformations/int_address_last_access.sql index 57be65ee..646e8678 100644 --- a/models/transformations/int_address_last_access.sql +++ b/models/transformations/int_address_last_access.sql @@ -18,51 +18,88 @@ dependencies: - "{{external}}.canonical_execution_nonce_diffs" - "{{external}}.canonical_execution_storage_diffs" - "{{external}}.canonical_execution_storage_reads" + - "{{external}}.canonical_execution_transaction" --- INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` -SELECT - address, - max(block_number) AS block_number -FROM ( - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_nonce_reads" "helpers" "from" }} FINAL +WITH get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' +), +all_addresses AS ( + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_nonce_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_balance_diffs" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_balance_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_balance_reads" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_balance_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL + SELECT + lower(address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(contract_address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL + SELECT + lower(contract_address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL - SELECT lower(contract_address) as address, block_number FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL + SELECT + lower(contract_address) AS address, + lower(transaction_hash) AS transaction_hash, + block_number + FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND meta_network_name = '{{ .env.NETWORK }}' ) -GROUP BY address; +SELECT + a.address, + max(a.block_number) AS block_number +FROM all_addresses a +GLOBAL JOIN get_tx_success g ON a.transaction_hash = g.transaction_hash +GROUP BY a.address; \ No newline at end of file From b32e11fb7207bdcbc91690bc2c2946c69e921b2e Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 20 Oct 2025 15:27:24 +0800 Subject: [PATCH 03/18] refactor: add last_tx_index to diffs and reads --- migrations/022_execution_accounts_v2.up.sql | 6 ++++-- models/transformations/int_address_diffs.sql | 10 +++++++--- models/transformations/int_address_reads.sql | 10 +++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/022_execution_accounts_v2.up.sql index 7f984d9f..a525726c 100644 --- a/migrations/022_execution_accounts_v2.up.sql +++ b/migrations/022_execution_accounts_v2.up.sql @@ -1,7 +1,8 @@ CREATE TABLE `${NETWORK_NAME}`.int_address_diffs_local on cluster '{cluster}' ( `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), `block_number` UInt32 COMMENT 'The block number of the diffs' CODEC(ZSTD(1)), - `tx_count` UInt32 COMMENT 'The number of transactions with diffs' CODEC(ZSTD(1)), + `tx_count` UInt32 COMMENT 'The number of transactions with diffs for this address in the block' CODEC(ZSTD(1)), + `last_tx_index` UInt32 COMMENT 'The last transaction index with diffs for this address in the block' CODEC(ZSTD(1)), ) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', '{replica}', @@ -19,7 +20,8 @@ CREATE TABLE `${NETWORK_NAME}`.int_address_diffs ON CLUSTER '{cluster}' AS `${NE CREATE TABLE `${NETWORK_NAME}`.int_address_reads_local on cluster '{cluster}' ( `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), `block_number` UInt32 COMMENT 'The block number of the reads' CODEC(ZSTD(1)), - `tx_count` UInt32 COMMENT 'The number of transactions with reads' CODEC(ZSTD(1)) + `tx_count` UInt32 COMMENT 'The number of reads for this address in this block' CODEC(ZSTD(1)), + `last_tx_index` UInt32 COMMENT 'The last transaction index with diffs for this address in the block' CODEC(ZSTD(1)), ) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', '{replica}' diff --git a/models/transformations/int_address_diffs.sql b/models/transformations/int_address_diffs.sql index 31d69e41..560b57de 100644 --- a/models/transformations/int_address_diffs.sql +++ b/models/transformations/int_address_diffs.sql @@ -20,7 +20,9 @@ dependencies: INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` WITH get_tx_success AS ( - SELECT lower(transaction_hash) AS transaction_hash, + SELECT + lower(transaction_hash) AS transaction_hash, + transaction_index FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND success = true @@ -64,13 +66,15 @@ address_diffs AS ( SELECT ad.address, ad.block_number, - ad.transaction_hash + ad.transaction_hash, + g.transaction_index FROM all_address_diffs ad GLOBAL JOIN get_tx_success g ON ad.transaction_hash = g.transaction_hash ) SELECT address, block_number, - countDistinct(transaction_hash) AS tx_count + countDistinct(transaction_hash) AS tx_count, + max(transaction_index) FROM address_diffs GROUP BY address, block_number; diff --git a/models/transformations/int_address_reads.sql b/models/transformations/int_address_reads.sql index f4c66ee1..8e69d0ba 100644 --- a/models/transformations/int_address_reads.sql +++ b/models/transformations/int_address_reads.sql @@ -19,7 +19,9 @@ dependencies: INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` WITH get_tx_success AS ( - SELECT lower(transaction_hash) AS transaction_hash, + SELECT + lower(transaction_hash) AS transaction_hash, + transaction_index FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND success = true @@ -54,13 +56,15 @@ address_reads AS ( SELECT ar.address, ar.block_number, - ar.transaction_hash + ar.transaction_hash, + g.transaction_index FROM all_address_reads ar GLOBAL JOIN get_tx_success g ON ar.transaction_hash = g.transaction_hash ) SELECT address, block_number, - countDistinct(transaction_hash) AS tx_count + countDistinct(transaction_hash) AS tx_count, + max(transaction_index) FROM address_reads GROUP BY address, block_number; From 5cea6553dc2fab3fb418e44c88d89525372c69fd Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 20 Oct 2025 17:33:18 +0800 Subject: [PATCH 04/18] feat: add int_pre_6780_accounts_destructs table --- migrations/022_execution_accounts_v2.down.sql | 6 +- migrations/022_execution_accounts_v2.up.sql | 19 +++++ .../int_pre_6780_accounts_destructs.sql | 71 +++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 models/transformations/int_pre_6780_accounts_destructs.sql diff --git a/migrations/022_execution_accounts_v2.down.sql b/migrations/022_execution_accounts_v2.down.sql index bbfa5543..381a8667 100644 --- a/migrations/022_execution_accounts_v2.down.sql +++ b/migrations/022_execution_accounts_v2.down.sql @@ -1,2 +1,6 @@ DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_diffs ON CLUSTER '{cluster}' SYNC; -DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_reads ON CLUSTER '{cluster}' SYNC; \ No newline at end of file +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_diffs_local ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_reads ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_reads_local ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local ON CLUSTER '{cluster}' SYNC; \ No newline at end of file diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/022_execution_accounts_v2.up.sql index a525726c..f28ae7b4 100644 --- a/migrations/022_execution_accounts_v2.up.sql +++ b/migrations/022_execution_accounts_v2.up.sql @@ -34,4 +34,23 @@ CREATE TABLE `${NETWORK_NAME}`.int_address_reads ON CLUSTER '{cluster}' AS `${NE '${NETWORK_NAME}', int_address_reads_local, cityHash64(`address`) +); + +CREATE TABLE `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local on cluster '{cluster}' ( + `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), + `block_number` UInt32 COMMENT 'The block number of the self-destructs' CODEC(ZSTD(1)), + `transaction_hash` FixedString(66) COMMENT 'The transaction hash' CODEC(ZSTD(1)), + `transaction_index` UInt64 COMMENT 'The transaction index' CODEC(DoubleDelta, ZSTD(1)), +) ENGINE = ReplicatedMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}' +) PARTITION BY cityHash64(`address`) % 16 +ORDER BY + (address, block_number, transaction_hash) COMMENT 'Table for accounts self-destructs data pre-6780 (Dencun fork)'; + +CREATE TABLE `${NETWORK_NAME}`.int_pre_6780_accounts_destructs ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local ENGINE = Distributed( + '{cluster}', + `${NETWORK_NAME}`, + int_pre_6780_accounts_destructs_local, + cityHash64(`address`) ); \ No newline at end of file diff --git a/models/transformations/int_pre_6780_accounts_destructs.sql b/models/transformations/int_pre_6780_accounts_destructs.sql new file mode 100644 index 00000000..de287e16 --- /dev/null +++ b/models/transformations/int_pre_6780_accounts_destructs.sql @@ -0,0 +1,71 @@ +--- +table: int_pre_6780_accounts_destructs +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "off" + backfill: "@every 1m" +tags: + - address + - account + - selfdestruct +dependencies: + - "{{external}}.canonical_execution_traces" + - "{{external}}.canonical_execution_transaction" +--- +-- This model tracks self-destruct operations that occurred before EIP-6780 (Dencun fork) +-- EIP-6780 changed SELFDESTRUCT behavior at block 19426587 on mainnet +-- Pre-EIP161 (Spurious Dragon, block 2675000) empty accounts require special handling +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +WITH +get_tx_success AS ( + SELECT + lower(transaction_hash) AS transaction_hash, + transaction_index + FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + WHERE + block_number < 19426587 -- EIP-6780 block + AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true +), +-- Before EIP161 was activated, there was a DoS attack by calling SELFDESTRUCT on contracts +-- and sending 0 ETH to newly seen addresses, which results in empty accounts created. +pre_eip161_empty_accounts AS ( + SELECT + lower(action_to) AS address, + block_number, + lower(transaction_hash) AS tx_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_traces" "database" }}`.`canonical_execution_traces` FINAL + WHERE + action_type = 'suicide' + AND block_number < 2675000 -- EIP-161 block + AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND action_value = '0' +), +self_destructs AS ( + SELECT + lower(action_from) AS address, + block_number, + lower(transaction_hash) AS tx_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_traces" "database" }}`.`canonical_execution_traces` FINAL + WHERE + action_type = 'suicide' + AND block_number < 19426587 -- EIP-6780 block + AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + + UNION ALL + + SELECT address, block_number, tx_hash + FROM pre_eip161_empty_accounts +) +SELECT + s.address, + s.block_number, + s.tx_hash AS transaction_hash, + max(g.transaction_index) AS transaction_index +FROM self_destructs s +GLOBAL JOIN get_tx_success g ON s.tx_hash = g.transaction_hash +GROUP BY s.address, s.block_number, s.tx_hash; From 2e3c6b70d4797bac2d577690e0d95d3a65cdc4e6 Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 20 Oct 2025 22:59:10 +0800 Subject: [PATCH 05/18] feat: add int_post_6780_accounts_destructs table --- migrations/022_execution_accounts_v2.up.sql | 20 ++++++ .../int_post_6780_accounts_destructs.sql | 64 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 models/transformations/int_post_6780_accounts_destructs.sql diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/022_execution_accounts_v2.up.sql index f28ae7b4..7735a8ec 100644 --- a/migrations/022_execution_accounts_v2.up.sql +++ b/migrations/022_execution_accounts_v2.up.sql @@ -53,4 +53,24 @@ CREATE TABLE `${NETWORK_NAME}`.int_pre_6780_accounts_destructs ON CLUSTER '{clus `${NETWORK_NAME}`, int_pre_6780_accounts_destructs_local, cityHash64(`address`) +); + +CREATE TABLE `${NETWORK_NAME}`.int_post_6780_accounts_destructs_local on cluster '{cluster}' ( + `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), + `block_number` UInt32 COMMENT 'The block number' CODEC(ZSTD(1)), + `transaction_hash` FixedString(66) COMMENT 'The transaction hash' CODEC(ZSTD(1)), + `transaction_index` UInt64 COMMENT 'The transaction index' CODEC(DoubleDelta, ZSTD(1)), + `is_same_tx` Bool COMMENT 'Whether the self-destruct is in the same transaction as the creation' CODEC(ZSTD(1)), +) ENGINE = ReplicatedMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}' +) PARTITION BY cityHash64(`address`) % 16 +ORDER BY + (address, block_number, transaction_hash) COMMENT 'Table for accounts self-destructs data post-6780 (Dencun fork)'; + +CREATE TABLE `${NETWORK_NAME}`.int_post_6780_accounts_destructs ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_post_6780_accounts_destructs_local ENGINE = Distributed( + '{cluster}', + `${NETWORK_NAME}`, + int_post_6780_accounts_destructs_local, + cityHash64(`address`) ); \ No newline at end of file diff --git a/models/transformations/int_post_6780_accounts_destructs.sql b/models/transformations/int_post_6780_accounts_destructs.sql new file mode 100644 index 00000000..09b588a2 --- /dev/null +++ b/models/transformations/int_post_6780_accounts_destructs.sql @@ -0,0 +1,64 @@ +--- +table: int_post_6780_accounts_destructs +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - address + - account + - selfdestruct + - eip6780 +dependencies: + - "{{external}}.canonical_execution_address_appearances" + - "{{external}}.canonical_execution_transaction" +--- +-- This model tracks self-destruct operations that occurred after EIP-6780 (Dencun fork) +-- EIP-6780 changed SELFDESTRUCT behavior at block 19426587 on mainnet +-- After EIP-6780, SELFDESTRUCT only deletes the account if it was created in the same transaction +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +WITH +get_tx_success AS ( + SELECT + lower(transaction_hash) AS transaction_hash, + transaction_index + FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + WHERE + block_number >= 19426587 -- EIP-6780 block + AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true +), +address_events AS ( + SELECT + lower(address) AS address, + block_number, + lower(transaction_hash) AS transaction_hash, + max(CASE WHEN relationship = 'create' THEN 1 ELSE 0 END) AS has_create, + max(CASE WHEN relationship = 'suicide' THEN 1 ELSE 0 END) AS has_suicide + FROM `{{ index .dep "{{external}}" "canonical_execution_address_appearances" "database" }}`.`canonical_execution_address_appearances` FINAL + WHERE + block_number >= 19426587 -- EIP-6780 block + AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND relationship IN ('create', 'suicide') + GROUP BY + address, + block_number, + transaction_hash +) +SELECT + ae.address, + ae.block_number, + ae.transaction_hash, + g.transaction_index, + CASE + WHEN ae.has_create = 1 AND ae.has_suicide = 1 THEN true + ELSE false + END AS is_same_tx +FROM address_events ae +GLOBAL JOIN get_tx_success g + ON ae.transaction_hash = g.transaction_hash +WHERE ae.has_suicide = 1; From 5b94fd0519f88685a26cd476198cf0224cefde6b Mon Sep 17 00:00:00 2001 From: weiihann Date: Tue, 21 Oct 2025 13:27:41 +0800 Subject: [PATCH 06/18] feat: add int_accounts_alive --- migrations/022_execution_accounts_v2.down.sql | 6 +- migrations/022_execution_accounts_v2.up.sql | 18 +++++ models/transformations/int_accounts_alive.sql | 73 +++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 models/transformations/int_accounts_alive.sql diff --git a/migrations/022_execution_accounts_v2.down.sql b/migrations/022_execution_accounts_v2.down.sql index 381a8667..849f4962 100644 --- a/migrations/022_execution_accounts_v2.down.sql +++ b/migrations/022_execution_accounts_v2.down.sql @@ -3,4 +3,8 @@ DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_diffs_local ON CLUSTER '{clus DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_reads ON CLUSTER '{cluster}' SYNC; DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_reads_local ON CLUSTER '{cluster}' SYNC; DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs ON CLUSTER '{cluster}' SYNC; -DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local ON CLUSTER '{cluster}' SYNC; \ No newline at end of file +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_post_6780_accounts_destructs ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_post_6780_accounts_destructs_local ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_accounts_alive ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_accounts_alive_local ON CLUSTER '{cluster}' SYNC; \ No newline at end of file diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/022_execution_accounts_v2.up.sql index 7735a8ec..639632bb 100644 --- a/migrations/022_execution_accounts_v2.up.sql +++ b/migrations/022_execution_accounts_v2.up.sql @@ -73,4 +73,22 @@ CREATE TABLE `${NETWORK_NAME}`.int_post_6780_accounts_destructs ON CLUSTER '{clu `${NETWORK_NAME}`, int_post_6780_accounts_destructs_local, cityHash64(`address`) +); + +CREATE TABLE `${NETWORK_NAME}`.int_accounts_alive_local on cluster '{cluster}' ( + `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), + `block_number` UInt32 COMMENT 'The block number of the latest status of this address' CODEC(ZSTD(1)), + `is_alive` Bool COMMENT 'Whether the account is currently alive in the state' CODEC(ZSTD(1)) +) ENGINE = ReplicatedReplacingMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}', + `block_number` +) PARTITION BY cityHash64(`address`) % 16 +ORDER BY (address) COMMENT 'Table that states if an account is currently alive or not'; + +CREATE TABLE `${NETWORK_NAME}`.int_accounts_alive ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_accounts_alive_local ENGINE = Distributed( + '{cluster}', + `${NETWORK_NAME}`, + int_accounts_alive_local, + cityHash64(`address`) ); \ No newline at end of file diff --git a/models/transformations/int_accounts_alive.sql b/models/transformations/int_accounts_alive.sql new file mode 100644 index 00000000..55a6cb8f --- /dev/null +++ b/models/transformations/int_accounts_alive.sql @@ -0,0 +1,73 @@ +--- +table: int_accounts_alive +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - address + - account + - alive +dependencies: + - "{{transformation}}.int_address_diffs" + - "{{transformation}}.int_pre_6780_accounts_destructs" + - "{{transformation}}.int_post_6780_accounts_destructs" +--- +-- This model tracks whether accounts are alive or dead based on all events +-- Combines diffs and destructs to determine the latest status using argMax +-- After EIP-6780, self-destructs only kill accounts if created in same transaction +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +WITH +-- Pre-6780 destructs: always mark as dead +pre_6780_destructs AS ( + SELECT + address, + block_number AS block_num, + transaction_index, + false AS is_alive + FROM `{{ index .dep "{{transformation}}" "int_pre_6780_accounts_destructs" "database" }}`.`int_pre_6780_accounts_destructs` + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +), +-- Post-6780 destructs: dead only if is_same_tx = true +post_6780_destructs AS ( + SELECT + address, + block_number AS block_num, + transaction_index, + CASE + WHEN is_same_tx = true THEN false -- Account actually destroyed + ELSE true -- Account not destroyed, just cleared + END AS is_alive + FROM `{{ index .dep "{{transformation}}" "int_post_6780_accounts_destructs" "database" }}`.`int_post_6780_accounts_destructs` + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +), +-- Diffs: always mark as alive (use existing last_tx_index column) +diffs AS ( + SELECT + address, + block_number AS block_num, + last_tx_index AS transaction_index, + true AS is_alive + FROM `{{ index .dep "{{transformation}}" "int_address_diffs" "database" }}`.`int_address_diffs` + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +), +-- Combine all events +combined AS ( + SELECT * FROM pre_6780_destructs + UNION ALL + SELECT * FROM post_6780_destructs + UNION ALL + SELECT * FROM diffs +) +-- Get the latest status for each address +-- When there are ties (same block_number, transaction_index), pessimistically choose false +SELECT + address, + max(block_num) AS block_number, + argMax(is_alive, (block_num, transaction_index, NOT is_alive)) AS is_alive +FROM combined +GROUP BY address; From 624430c9cb015152898568010b90cec869fde145 Mon Sep 17 00:00:00 2001 From: weiihann Date: Tue, 21 Oct 2025 13:44:17 +0800 Subject: [PATCH 07/18] refactor: storage slot first and last access --- .../int_address_storage_slot_first_access.sql | 68 +++++++++++-------- .../int_address_storage_slot_last_access.sql | 67 ++++++++++-------- 2 files changed, 78 insertions(+), 57 deletions(-) diff --git a/models/transformations/int_address_storage_slot_first_access.sql b/models/transformations/int_address_storage_slot_first_access.sql index 6bc64df9..2c3882e1 100644 --- a/models/transformations/int_address_storage_slot_first_access.sql +++ b/models/transformations/int_address_storage_slot_first_access.sql @@ -11,41 +11,51 @@ tags: - address - storage dependencies: + - "{{external}}.canonical_execution_transaction" - "{{external}}.canonical_execution_storage_diffs" - "{{external}}.canonical_execution_storage_reads" --- INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` -WITH all_storage_data AS ( - SELECT - lower(address) as address, - slot AS slot_key, - block_number AS bn, - transaction_index, - internal_index, - to_value AS value - FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL - WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND meta_network_name = '{{ .env.NETWORK }}' - - UNION ALL - - SELECT - lower(contract_address) as address, - slot AS slot_key, - block_number AS bn, - transaction_index, - internal_index, - value - FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL - WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND meta_network_name = '{{ .env.NETWORK }}' +WITH +get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash + FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' +), +all_storage_data AS ( + SELECT + lower(address) AS address, + slot AS slot_key, + block_number AS bn, + transaction_index, + internal_index, + to_value AS value + FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND meta_network_name = '{{ .env.NETWORK }}' + UNION ALL + + SELECT + lower(sr.contract_address) AS address, + sr.slot AS slot_key, + sr.block_number AS bn, + 4294967295 AS transaction_index, + 4294967295 AS internal_index, + sr.value AS value + FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} sr FINAL + GLOBAL JOIN get_tx_success g + ON lower(sr.transaction_hash) = g.transaction_hash + WHERE sr.block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND meta_network_name = '{{ .env.NETWORK }}' ) SELECT - address, - slot_key AS slot, - argMin(bn, (bn, transaction_index, internal_index)) AS block_number, - argMin(value, (bn, transaction_index, internal_index)) AS value, - null AS `version` + address, + slot_key AS slot, + argMin(bn, (bn, transaction_index, internal_index)) AS block_number, + argMin(value, (bn, transaction_index, internal_index)) AS value, + null AS `version` FROM all_storage_data GROUP BY address, slot_key; diff --git a/models/transformations/int_address_storage_slot_last_access.sql b/models/transformations/int_address_storage_slot_last_access.sql index 7c0e98b0..3cf10a87 100644 --- a/models/transformations/int_address_storage_slot_last_access.sql +++ b/models/transformations/int_address_storage_slot_last_access.sql @@ -11,40 +11,51 @@ tags: - address - storage dependencies: + - "{{external}}.canonical_execution_transaction" - "{{external}}.canonical_execution_storage_diffs" - "{{external}}.canonical_execution_storage_reads" --- INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` -WITH all_storage_data AS ( - SELECT - lower(address) as address, - slot AS slot_key, - block_number AS bn, - transaction_index, - internal_index, - to_value AS value - FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL - WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND meta_network_name = '{{ .env.NETWORK }}' - - UNION ALL - - SELECT - lower(contract_address) as address, - slot AS slot_key, - block_number AS bn, - transaction_index, - internal_index, - value - FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL - WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND meta_network_name = '{{ .env.NETWORK }}' +WITH +get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' +), +all_storage_data AS ( + SELECT + lower(address) AS address, + slot AS slot_key, + block_number AS bn, + transaction_index, + internal_index, + to_value AS value + FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND meta_network_name = '{{ .env.NETWORK }}' + + UNION ALL + + SELECT + lower(sr.contract_address) AS address, + sr.slot AS slot_key, + sr.block_number AS bn, + 0 AS transaction_index, + 0 AS internal_index, + sr.value + FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} sr FINAL + GLOBAL JOIN get_tx_success g + ON lower(sr.transaction_hash) = g.transaction_hash + WHERE sr.block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND meta_network_name = '{{ .env.NETWORK }}' ) SELECT - address, - slot_key AS slot, - argMax(bn, (bn, transaction_index, internal_index)) AS block_number, - argMax(value, (bn, transaction_index, internal_index)) AS value + address, + slot_key AS slot, + argMax(bn, (bn, transaction_index, internal_index)) AS block_number, + argMax(value, (bn, transaction_index, internal_index)) AS value FROM all_storage_data GROUP BY address, slot_key; From 0c9ec51fe83af192bdd6d05601a5647719f77604 Mon Sep 17 00:00:00 2001 From: Ng Wei Han <47109095+weiihann@users.noreply.github.com> Date: Thu, 23 Oct 2025 10:21:04 +0700 Subject: [PATCH 08/18] Apply suggestions from code review chore: remove comma Co-authored-by: Andrew Davis <1709934+Savid@users.noreply.github.com> Signed-off-by: Ng Wei Han <47109095+weiihann@users.noreply.github.com> --- migrations/022_execution_accounts_v2.up.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/022_execution_accounts_v2.up.sql index 639632bb..f191009c 100644 --- a/migrations/022_execution_accounts_v2.up.sql +++ b/migrations/022_execution_accounts_v2.up.sql @@ -2,10 +2,10 @@ CREATE TABLE `${NETWORK_NAME}`.int_address_diffs_local on cluster '{cluster}' ( `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), `block_number` UInt32 COMMENT 'The block number of the diffs' CODEC(ZSTD(1)), `tx_count` UInt32 COMMENT 'The number of transactions with diffs for this address in the block' CODEC(ZSTD(1)), - `last_tx_index` UInt32 COMMENT 'The last transaction index with diffs for this address in the block' CODEC(ZSTD(1)), + `last_tx_index` UInt32 COMMENT 'The last transaction index with diffs for this address in the block' CODEC(ZSTD(1)) ) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', - '{replica}', + '{replica}' ) PARTITION BY cityHash64(`address`) % 16 ORDER BY (address) COMMENT 'Table for accounts last access data'; @@ -21,7 +21,7 @@ CREATE TABLE `${NETWORK_NAME}`.int_address_reads_local on cluster '{cluster}' ( `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), `block_number` UInt32 COMMENT 'The block number of the reads' CODEC(ZSTD(1)), `tx_count` UInt32 COMMENT 'The number of reads for this address in this block' CODEC(ZSTD(1)), - `last_tx_index` UInt32 COMMENT 'The last transaction index with diffs for this address in the block' CODEC(ZSTD(1)), + `last_tx_index` UInt32 COMMENT 'The last transaction index with diffs for this address in the block' CODEC(ZSTD(1)) ) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', '{replica}' @@ -40,7 +40,7 @@ CREATE TABLE `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local on cluster `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), `block_number` UInt32 COMMENT 'The block number of the self-destructs' CODEC(ZSTD(1)), `transaction_hash` FixedString(66) COMMENT 'The transaction hash' CODEC(ZSTD(1)), - `transaction_index` UInt64 COMMENT 'The transaction index' CODEC(DoubleDelta, ZSTD(1)), + `transaction_index` UInt64 COMMENT 'The transaction index' CODEC(DoubleDelta, ZSTD(1)) ) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', '{replica}' @@ -60,7 +60,7 @@ CREATE TABLE `${NETWORK_NAME}`.int_post_6780_accounts_destructs_local on cluster `block_number` UInt32 COMMENT 'The block number' CODEC(ZSTD(1)), `transaction_hash` FixedString(66) COMMENT 'The transaction hash' CODEC(ZSTD(1)), `transaction_index` UInt64 COMMENT 'The transaction index' CODEC(DoubleDelta, ZSTD(1)), - `is_same_tx` Bool COMMENT 'Whether the self-destruct is in the same transaction as the creation' CODEC(ZSTD(1)), + `is_same_tx` Bool COMMENT 'Whether the self-destruct is in the same transaction as the creation' CODEC(ZSTD(1)) ) ENGINE = ReplicatedMergeTree( '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', '{replica}' From b4ca9ad2affaff27da1109a189dda2d573feb84c Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 27 Oct 2025 15:25:15 +0800 Subject: [PATCH 09/18] refactor: update table placeholders --- models/transformations/int_address_diffs.sql | 20 ++++++++++--------- models/transformations/int_address_reads.sql | 16 ++++++++------- .../int_post_6780_accounts_destructs.sql | 6 ++++-- .../int_pre_6780_accounts_destructs.sql | 10 ++++++---- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/models/transformations/int_address_diffs.sql b/models/transformations/int_address_diffs.sql index 560b57de..066e345b 100644 --- a/models/transformations/int_address_diffs.sql +++ b/models/transformations/int_address_diffs.sql @@ -23,44 +23,46 @@ WITH get_tx_success AS ( SELECT lower(transaction_hash) AS transaction_hash, transaction_index - FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND success = true + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' ), all_address_diffs AS ( SELECT lower(address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_balance_diffs" "database" }}`.`canonical_execution_balance_diffs` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_balance_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - + AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL SELECT lower(address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_storage_diffs" "database" }}`.`canonical_execution_storage_diffs` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - + AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL SELECT lower(address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "database" }}`.`canonical_execution_nonce_diffs` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_nonce_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - + AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL SELECT lower(contract_address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_contracts" "database" }}`.`canonical_execution_contracts` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND meta_network_name = '{{ .env.NETWORK }}' ), address_diffs AS ( SELECT diff --git a/models/transformations/int_address_reads.sql b/models/transformations/int_address_reads.sql index 8e69d0ba..e5cd0c2e 100644 --- a/models/transformations/int_address_reads.sql +++ b/models/transformations/int_address_reads.sql @@ -22,35 +22,37 @@ WITH get_tx_success AS ( SELECT lower(transaction_hash) AS transaction_hash, transaction_index - FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - AND success = true + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' ), all_address_reads AS ( SELECT lower(address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_balance_reads" "database" }}`.`canonical_execution_balance_reads` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_balance_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - + AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL SELECT lower(contract_address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_storage_reads" "database" }}`.`canonical_execution_storage_reads` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_storage_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - + AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL SELECT lower(address) AS address, block_number, lower(transaction_hash) AS transaction_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_nonce_reads" "database" }}`.`canonical_execution_nonce_reads` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_nonce_reads" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND meta_network_name = '{{ .env.NETWORK }}' ), address_reads AS ( SELECT diff --git a/models/transformations/int_post_6780_accounts_destructs.sql b/models/transformations/int_post_6780_accounts_destructs.sql index 09b588a2..61c060aa 100644 --- a/models/transformations/int_post_6780_accounts_destructs.sql +++ b/models/transformations/int_post_6780_accounts_destructs.sql @@ -26,11 +26,12 @@ get_tx_success AS ( SELECT lower(transaction_hash) AS transaction_hash, transaction_index - FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL WHERE block_number >= 19426587 -- EIP-6780 block AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' ), address_events AS ( SELECT @@ -39,11 +40,12 @@ address_events AS ( lower(transaction_hash) AS transaction_hash, max(CASE WHEN relationship = 'create' THEN 1 ELSE 0 END) AS has_create, max(CASE WHEN relationship = 'suicide' THEN 1 ELSE 0 END) AS has_suicide - FROM `{{ index .dep "{{external}}" "canonical_execution_address_appearances" "database" }}`.`canonical_execution_address_appearances` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_address_appearances" "helpers" "from" }} FINAL WHERE block_number >= 19426587 -- EIP-6780 block AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND relationship IN ('create', 'suicide') + AND meta_network_name = '{{ .env.NETWORK }}' GROUP BY address, block_number, diff --git a/models/transformations/int_pre_6780_accounts_destructs.sql b/models/transformations/int_pre_6780_accounts_destructs.sql index de287e16..12c50e40 100644 --- a/models/transformations/int_pre_6780_accounts_destructs.sql +++ b/models/transformations/int_pre_6780_accounts_destructs.sql @@ -25,11 +25,12 @@ get_tx_success AS ( SELECT lower(transaction_hash) AS transaction_hash, transaction_index - FROM `{{ index .dep "{{external}}" "canonical_execution_transaction" "database" }}`.`canonical_execution_transaction` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL WHERE block_number < 19426587 -- EIP-6780 block AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' ), -- Before EIP161 was activated, there was a DoS attack by calling SELFDESTRUCT on contracts -- and sending 0 ETH to newly seen addresses, which results in empty accounts created. @@ -38,24 +39,25 @@ pre_eip161_empty_accounts AS ( lower(action_to) AS address, block_number, lower(transaction_hash) AS tx_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_traces" "database" }}`.`canonical_execution_traces` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_traces" "helpers" "from" }} FINAL WHERE action_type = 'suicide' AND block_number < 2675000 -- EIP-161 block AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} AND action_value = '0' + AND meta_network_name = '{{ .env.NETWORK }}' ), self_destructs AS ( SELECT lower(action_from) AS address, block_number, lower(transaction_hash) AS tx_hash - FROM `{{ index .dep "{{external}}" "canonical_execution_traces" "database" }}`.`canonical_execution_traces` FINAL + FROM {{ index .dep "{{external}}" "canonical_execution_traces" "helpers" "from" }} FINAL WHERE action_type = 'suicide' AND block_number < 19426587 -- EIP-6780 block AND block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} - + AND meta_network_name = '{{ .env.NETWORK }}' UNION ALL SELECT address, block_number, tx_hash From 1acac7e91ac64efad4791eacfabcbd0d6f8211db Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 27 Oct 2025 15:27:38 +0800 Subject: [PATCH 10/18] refactor: update int_accounts_alive --- models/transformations/int_accounts_alive.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/transformations/int_accounts_alive.sql b/models/transformations/int_accounts_alive.sql index 55a6cb8f..d646bd82 100644 --- a/models/transformations/int_accounts_alive.sql +++ b/models/transformations/int_accounts_alive.sql @@ -29,7 +29,7 @@ pre_6780_destructs AS ( block_number AS block_num, transaction_index, false AS is_alive - FROM `{{ index .dep "{{transformation}}" "int_pre_6780_accounts_destructs" "database" }}`.`int_pre_6780_accounts_destructs` + FROM {{ index .dep "{{transformation}}" "int_pre_6780_accounts_destructs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} ), -- Post-6780 destructs: dead only if is_same_tx = true @@ -42,7 +42,7 @@ post_6780_destructs AS ( WHEN is_same_tx = true THEN false -- Account actually destroyed ELSE true -- Account not destroyed, just cleared END AS is_alive - FROM `{{ index .dep "{{transformation}}" "int_post_6780_accounts_destructs" "database" }}`.`int_post_6780_accounts_destructs` + FROM {{ index .dep "{{transformation}}" "int_post_6780_accounts_destructs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} ), -- Diffs: always mark as alive (use existing last_tx_index column) @@ -52,7 +52,7 @@ diffs AS ( block_number AS block_num, last_tx_index AS transaction_index, true AS is_alive - FROM `{{ index .dep "{{transformation}}" "int_address_diffs" "database" }}`.`int_address_diffs` + FROM {{ index .dep "{{transformation}}" "int_address_diffs" "helpers" "from" }} FINAL WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} ), -- Combine all events From f89356f497c6c1b744bec143212b93a9f5c1e55c Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 27 Oct 2025 15:34:46 +0800 Subject: [PATCH 11/18] chore: update migration version --- ...on_accounts_v2.down.sql => 025_execution_accounts_v2.down.sql} | 0 ...cution_accounts_v2.up.sql => 025_execution_accounts_v2.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename migrations/{022_execution_accounts_v2.down.sql => 025_execution_accounts_v2.down.sql} (100%) rename migrations/{022_execution_accounts_v2.up.sql => 025_execution_accounts_v2.up.sql} (100%) diff --git a/migrations/022_execution_accounts_v2.down.sql b/migrations/025_execution_accounts_v2.down.sql similarity index 100% rename from migrations/022_execution_accounts_v2.down.sql rename to migrations/025_execution_accounts_v2.down.sql diff --git a/migrations/022_execution_accounts_v2.up.sql b/migrations/025_execution_accounts_v2.up.sql similarity index 100% rename from migrations/022_execution_accounts_v2.up.sql rename to migrations/025_execution_accounts_v2.up.sql From b019ec59d881ac60b4d83f81ae17a60592d63e88 Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 27 Oct 2025 15:59:01 +0800 Subject: [PATCH 12/18] chore: add protobuf files --- pkg/proto/clickhouse/int_accounts_alive.go | 152 +++++ pkg/proto/clickhouse/int_accounts_alive.pb.go | 534 ++++++++++++++++ pkg/proto/clickhouse/int_accounts_alive.proto | 68 ++ pkg/proto/clickhouse/int_address_diffs.go | 200 ++++++ pkg/proto/clickhouse/int_address_diffs.pb.go | 557 ++++++++++++++++ pkg/proto/clickhouse/int_address_diffs.proto | 72 +++ pkg/proto/clickhouse/int_address_reads.go | 200 ++++++ pkg/proto/clickhouse/int_address_reads.pb.go | 557 ++++++++++++++++ pkg/proto/clickhouse/int_address_reads.proto | 73 +++ .../int_post_6780_accounts_destructs.go | 212 +++++++ .../int_post_6780_accounts_destructs.pb.go | 598 ++++++++++++++++++ .../int_post_6780_accounts_destructs.proto | 78 +++ .../int_pre_6780_accounts_destructs.go | 200 ++++++ .../int_pre_6780_accounts_destructs.pb.go | 572 +++++++++++++++++ .../int_pre_6780_accounts_destructs.proto | 74 +++ 15 files changed, 4147 insertions(+) create mode 100644 pkg/proto/clickhouse/int_accounts_alive.go create mode 100644 pkg/proto/clickhouse/int_accounts_alive.pb.go create mode 100644 pkg/proto/clickhouse/int_accounts_alive.proto create mode 100644 pkg/proto/clickhouse/int_address_diffs.go create mode 100644 pkg/proto/clickhouse/int_address_diffs.pb.go create mode 100644 pkg/proto/clickhouse/int_address_diffs.proto create mode 100644 pkg/proto/clickhouse/int_address_reads.go create mode 100644 pkg/proto/clickhouse/int_address_reads.pb.go create mode 100644 pkg/proto/clickhouse/int_address_reads.proto create mode 100644 pkg/proto/clickhouse/int_post_6780_accounts_destructs.go create mode 100644 pkg/proto/clickhouse/int_post_6780_accounts_destructs.pb.go create mode 100644 pkg/proto/clickhouse/int_post_6780_accounts_destructs.proto create mode 100644 pkg/proto/clickhouse/int_pre_6780_accounts_destructs.go create mode 100644 pkg/proto/clickhouse/int_pre_6780_accounts_destructs.pb.go create mode 100644 pkg/proto/clickhouse/int_pre_6780_accounts_destructs.proto diff --git a/pkg/proto/clickhouse/int_accounts_alive.go b/pkg/proto/clickhouse/int_accounts_alive.go new file mode 100644 index 00000000..d43a71fd --- /dev/null +++ b/pkg/proto/clickhouse/int_accounts_alive.go @@ -0,0 +1,152 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_accounts_alive + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntAccountsAliveQuery constructs a parameterized SQL query from a ListIntAccountsAliveRequest +func BuildListIntAccountsAliveQuery(req *ListIntAccountsAliveRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Address == nil { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Address.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("address", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("address", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("address", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("address", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("address", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("address", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("address", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("address", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("address", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: block_number + if req.BlockNumber != nil { + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: is_alive + if req.IsAlive != nil { + switch filter := req.IsAlive.Filter.(type) { + case *BoolFilter_Eq: + qb.AddCondition("is_alive", "=", filter.Eq) + case *BoolFilter_Ne: + qb.AddCondition("is_alive", "!=", filter.Ne) + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"address", "block_number", "is_alive"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY address" + } + + // Build column list + columns := []string{"address", "block_number", "is_alive"} + + return BuildParameterizedQuery("int_accounts_alive", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntAccountsAliveQuery constructs a parameterized SQL query from a GetIntAccountsAliveRequest +func BuildGetIntAccountsAliveQuery(req *GetIntAccountsAliveRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Address == "" { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("address", "=", req.Address) + + // Build ORDER BY clause + orderByClause := " ORDER BY address" + + // Build column list + columns := []string{"address", "block_number", "is_alive"} + + // Return single record + return BuildParameterizedQuery("int_accounts_alive", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_accounts_alive.pb.go b/pkg/proto/clickhouse/int_accounts_alive.pb.go new file mode 100644 index 00000000..471eacb4 --- /dev/null +++ b/pkg/proto/clickhouse/int_accounts_alive.pb.go @@ -0,0 +1,534 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_accounts_alive.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntAccountsAlive struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` + // The block number of the latest status of this address + BlockNumber uint32 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Whether the account is currently alive in the state + IsAlive bool `protobuf:"varint,13,opt,name=is_alive,json=isAlive,proto3" json:"is_alive,omitempty"` +} + +func (x *IntAccountsAlive) Reset() { + *x = IntAccountsAlive{} + if protoimpl.UnsafeEnabled { + mi := &file_int_accounts_alive_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntAccountsAlive) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntAccountsAlive) ProtoMessage() {} + +func (x *IntAccountsAlive) ProtoReflect() protoreflect.Message { + mi := &file_int_accounts_alive_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntAccountsAlive.ProtoReflect.Descriptor instead. +func (*IntAccountsAlive) Descriptor() ([]byte, []int) { + return file_int_accounts_alive_proto_rawDescGZIP(), []int{0} +} + +func (x *IntAccountsAlive) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *IntAccountsAlive) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntAccountsAlive) GetIsAlive() bool { + if x != nil { + return x.IsAlive + } + return false +} + +// Request for listing int_accounts_alive records +type ListIntAccountsAliveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by address - The address of the account (PRIMARY KEY - required) + Address *StringFilter `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Filter by block_number - The block number of the latest status of this address (optional) + BlockNumber *UInt32Filter `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by is_alive - Whether the account is currently alive in the state (optional) + IsAlive *BoolFilter `protobuf:"bytes,3,opt,name=is_alive,json=isAlive,proto3" json:"is_alive,omitempty"` + // The maximum number of int_accounts_alive to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntAccountsAlive` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,6,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntAccountsAliveRequest) Reset() { + *x = ListIntAccountsAliveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_accounts_alive_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAccountsAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAccountsAliveRequest) ProtoMessage() {} + +func (x *ListIntAccountsAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_accounts_alive_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAccountsAliveRequest.ProtoReflect.Descriptor instead. +func (*ListIntAccountsAliveRequest) Descriptor() ([]byte, []int) { + return file_int_accounts_alive_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntAccountsAliveRequest) GetAddress() *StringFilter { + if x != nil { + return x.Address + } + return nil +} + +func (x *ListIntAccountsAliveRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntAccountsAliveRequest) GetIsAlive() *BoolFilter { + if x != nil { + return x.IsAlive + } + return nil +} + +func (x *ListIntAccountsAliveRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntAccountsAliveRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntAccountsAliveRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_accounts_alive records +type ListIntAccountsAliveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_accounts_alive. + IntAccountsAlive []*IntAccountsAlive `protobuf:"bytes,1,rep,name=int_accounts_alive,json=intAccountsAlive,proto3" json:"int_accounts_alive,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntAccountsAliveResponse) Reset() { + *x = ListIntAccountsAliveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_accounts_alive_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAccountsAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAccountsAliveResponse) ProtoMessage() {} + +func (x *ListIntAccountsAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_accounts_alive_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAccountsAliveResponse.ProtoReflect.Descriptor instead. +func (*ListIntAccountsAliveResponse) Descriptor() ([]byte, []int) { + return file_int_accounts_alive_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntAccountsAliveResponse) GetIntAccountsAlive() []*IntAccountsAlive { + if x != nil { + return x.IntAccountsAlive + } + return nil +} + +func (x *ListIntAccountsAliveResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_accounts_alive record by primary key +type GetIntAccountsAliveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Primary key (required) +} + +func (x *GetIntAccountsAliveRequest) Reset() { + *x = GetIntAccountsAliveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_accounts_alive_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAccountsAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAccountsAliveRequest) ProtoMessage() {} + +func (x *GetIntAccountsAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_accounts_alive_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAccountsAliveRequest.ProtoReflect.Descriptor instead. +func (*GetIntAccountsAliveRequest) Descriptor() ([]byte, []int) { + return file_int_accounts_alive_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntAccountsAliveRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Response for getting a single int_accounts_alive record +type GetIntAccountsAliveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntAccountsAlive `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntAccountsAliveResponse) Reset() { + *x = GetIntAccountsAliveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_accounts_alive_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAccountsAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAccountsAliveResponse) ProtoMessage() {} + +func (x *GetIntAccountsAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_accounts_alive_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAccountsAliveResponse.ProtoReflect.Descriptor instead. +func (*GetIntAccountsAliveResponse) Descriptor() ([]byte, []int) { + return file_int_accounts_alive_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntAccountsAliveResponse) GetItem() *IntAccountsAlive { + if x != nil { + return x.Item + } + return nil +} + +var File_int_accounts_alive_proto protoreflect.FileDescriptor + +var file_int_accounts_alive_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x61, + 0x6c, 0x69, 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, + 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, 0x0a, + 0x10, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x69, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x22, 0x83, 0x02, 0x0a, 0x1b, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, + 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x08, + 0x69, 0x73, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, + 0x07, 0x69, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, + 0x8b, 0x01, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x43, 0x0a, 0x12, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, + 0x69, 0x76, 0x65, 0x52, 0x10, 0x69, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x41, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x36, 0x0a, + 0x1a, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, + 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x48, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, + 0xb0, 0x01, 0x0a, 0x17, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, + 0x6c, 0x69, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, + 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, + 0x1f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, + 0x75, 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_int_accounts_alive_proto_rawDescOnce sync.Once + file_int_accounts_alive_proto_rawDescData = file_int_accounts_alive_proto_rawDesc +) + +func file_int_accounts_alive_proto_rawDescGZIP() []byte { + file_int_accounts_alive_proto_rawDescOnce.Do(func() { + file_int_accounts_alive_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_accounts_alive_proto_rawDescData) + }) + return file_int_accounts_alive_proto_rawDescData +} + +var file_int_accounts_alive_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_accounts_alive_proto_goTypes = []any{ + (*IntAccountsAlive)(nil), // 0: cbt.IntAccountsAlive + (*ListIntAccountsAliveRequest)(nil), // 1: cbt.ListIntAccountsAliveRequest + (*ListIntAccountsAliveResponse)(nil), // 2: cbt.ListIntAccountsAliveResponse + (*GetIntAccountsAliveRequest)(nil), // 3: cbt.GetIntAccountsAliveRequest + (*GetIntAccountsAliveResponse)(nil), // 4: cbt.GetIntAccountsAliveResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter + (*BoolFilter)(nil), // 7: cbt.BoolFilter +} +var file_int_accounts_alive_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntAccountsAliveRequest.address:type_name -> cbt.StringFilter + 6, // 1: cbt.ListIntAccountsAliveRequest.block_number:type_name -> cbt.UInt32Filter + 7, // 2: cbt.ListIntAccountsAliveRequest.is_alive:type_name -> cbt.BoolFilter + 0, // 3: cbt.ListIntAccountsAliveResponse.int_accounts_alive:type_name -> cbt.IntAccountsAlive + 0, // 4: cbt.GetIntAccountsAliveResponse.item:type_name -> cbt.IntAccountsAlive + 1, // 5: cbt.IntAccountsAliveService.List:input_type -> cbt.ListIntAccountsAliveRequest + 3, // 6: cbt.IntAccountsAliveService.Get:input_type -> cbt.GetIntAccountsAliveRequest + 2, // 7: cbt.IntAccountsAliveService.List:output_type -> cbt.ListIntAccountsAliveResponse + 4, // 8: cbt.IntAccountsAliveService.Get:output_type -> cbt.GetIntAccountsAliveResponse + 7, // [7:9] is the sub-list for method output_type + 5, // [5:7] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_int_accounts_alive_proto_init() } +func file_int_accounts_alive_proto_init() { + if File_int_accounts_alive_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_accounts_alive_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntAccountsAlive); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_accounts_alive_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAccountsAliveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_accounts_alive_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAccountsAliveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_accounts_alive_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAccountsAliveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_accounts_alive_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAccountsAliveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_accounts_alive_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_accounts_alive_proto_goTypes, + DependencyIndexes: file_int_accounts_alive_proto_depIdxs, + MessageInfos: file_int_accounts_alive_proto_msgTypes, + }.Build() + File_int_accounts_alive_proto = out.File + file_int_accounts_alive_proto_rawDesc = nil + file_int_accounts_alive_proto_goTypes = nil + file_int_accounts_alive_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_accounts_alive.proto b/pkg/proto/clickhouse/int_accounts_alive.proto new file mode 100644 index 00000000..729a45bc --- /dev/null +++ b/pkg/proto/clickhouse/int_accounts_alive.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table that states if an account is currently alive or not + +message IntAccountsAlive { + // The address of the account + string address = 11; + // The block number of the latest status of this address + uint32 block_number = 12; + // Whether the account is currently alive in the state + bool is_alive = 13; +} + +// Request for listing int_accounts_alive records +message ListIntAccountsAliveRequest { + // Filter by address - The address of the account (PRIMARY KEY - required) + StringFilter address = 1; + + // Filter by block_number - The block number of the latest status of this address (optional) + UInt32Filter block_number = 2; + // Filter by is_alive - Whether the account is currently alive in the state (optional) + BoolFilter is_alive = 3; + + // The maximum number of int_accounts_alive to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 4; + // A page token, received from a previous `ListIntAccountsAlive` call. + // Provide this to retrieve the subsequent page. + string page_token = 5; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 6; +} + +// Response for listing int_accounts_alive records +message ListIntAccountsAliveResponse { + // The list of int_accounts_alive. + repeated IntAccountsAlive int_accounts_alive = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_accounts_alive record by primary key +message GetIntAccountsAliveRequest { + // The address of the account + string address = 1; // Primary key (required) +} + +// Response for getting a single int_accounts_alive record +message GetIntAccountsAliveResponse { + IntAccountsAlive item = 1; +} + +// Query int_accounts_alive data +service IntAccountsAliveService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntAccountsAliveRequest) returns (ListIntAccountsAliveResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntAccountsAliveRequest) returns (GetIntAccountsAliveResponse); +} diff --git a/pkg/proto/clickhouse/int_address_diffs.go b/pkg/proto/clickhouse/int_address_diffs.go new file mode 100644 index 00000000..bf9e221a --- /dev/null +++ b/pkg/proto/clickhouse/int_address_diffs.go @@ -0,0 +1,200 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_address_diffs + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntAddressDiffsQuery constructs a parameterized SQL query from a ListIntAddressDiffsRequest +func BuildListIntAddressDiffsQuery(req *ListIntAddressDiffsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Address == nil { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Address.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("address", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("address", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("address", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("address", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("address", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("address", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("address", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("address", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("address", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: block_number + if req.BlockNumber != nil { + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: tx_count + if req.TxCount != nil { + switch filter := req.TxCount.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("tx_count", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("tx_count", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("tx_count", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("tx_count", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("tx_count", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("tx_count", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("tx_count", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("tx_count", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("tx_count", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: last_tx_index + if req.LastTxIndex != nil { + switch filter := req.LastTxIndex.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("last_tx_index", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("last_tx_index", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("last_tx_index", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("last_tx_index", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("last_tx_index", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("last_tx_index", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("last_tx_index", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("last_tx_index", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("last_tx_index", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"address", "block_number", "tx_count", "last_tx_index"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY address" + } + + // Build column list + columns := []string{"address", "block_number", "tx_count", "last_tx_index"} + + return BuildParameterizedQuery("int_address_diffs", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntAddressDiffsQuery constructs a parameterized SQL query from a GetIntAddressDiffsRequest +func BuildGetIntAddressDiffsQuery(req *GetIntAddressDiffsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Address == "" { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("address", "=", req.Address) + + // Build ORDER BY clause + orderByClause := " ORDER BY address" + + // Build column list + columns := []string{"address", "block_number", "tx_count", "last_tx_index"} + + // Return single record + return BuildParameterizedQuery("int_address_diffs", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_address_diffs.pb.go b/pkg/proto/clickhouse/int_address_diffs.pb.go new file mode 100644 index 00000000..bbb5bcfe --- /dev/null +++ b/pkg/proto/clickhouse/int_address_diffs.pb.go @@ -0,0 +1,557 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_address_diffs.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntAddressDiffs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` + // The block number of the diffs + BlockNumber uint32 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // The number of transactions with diffs for this address in the block + TxCount uint32 `protobuf:"varint,13,opt,name=tx_count,json=txCount,proto3" json:"tx_count,omitempty"` + // The last transaction index with diffs for this address in the block + LastTxIndex uint32 `protobuf:"varint,14,opt,name=last_tx_index,json=lastTxIndex,proto3" json:"last_tx_index,omitempty"` +} + +func (x *IntAddressDiffs) Reset() { + *x = IntAddressDiffs{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_diffs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntAddressDiffs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntAddressDiffs) ProtoMessage() {} + +func (x *IntAddressDiffs) ProtoReflect() protoreflect.Message { + mi := &file_int_address_diffs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntAddressDiffs.ProtoReflect.Descriptor instead. +func (*IntAddressDiffs) Descriptor() ([]byte, []int) { + return file_int_address_diffs_proto_rawDescGZIP(), []int{0} +} + +func (x *IntAddressDiffs) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *IntAddressDiffs) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntAddressDiffs) GetTxCount() uint32 { + if x != nil { + return x.TxCount + } + return 0 +} + +func (x *IntAddressDiffs) GetLastTxIndex() uint32 { + if x != nil { + return x.LastTxIndex + } + return 0 +} + +// Request for listing int_address_diffs records +type ListIntAddressDiffsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by address - The address of the account (PRIMARY KEY - required) + Address *StringFilter `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Filter by block_number - The block number of the diffs (optional) + BlockNumber *UInt32Filter `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by tx_count - The number of transactions with diffs for this address in the block (optional) + TxCount *UInt32Filter `protobuf:"bytes,3,opt,name=tx_count,json=txCount,proto3" json:"tx_count,omitempty"` + // Filter by last_tx_index - The last transaction index with diffs for this address in the block (optional) + LastTxIndex *UInt32Filter `protobuf:"bytes,4,opt,name=last_tx_index,json=lastTxIndex,proto3" json:"last_tx_index,omitempty"` + // The maximum number of int_address_diffs to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntAddressDiffs` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,6,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,7,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntAddressDiffsRequest) Reset() { + *x = ListIntAddressDiffsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_diffs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAddressDiffsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAddressDiffsRequest) ProtoMessage() {} + +func (x *ListIntAddressDiffsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_address_diffs_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAddressDiffsRequest.ProtoReflect.Descriptor instead. +func (*ListIntAddressDiffsRequest) Descriptor() ([]byte, []int) { + return file_int_address_diffs_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntAddressDiffsRequest) GetAddress() *StringFilter { + if x != nil { + return x.Address + } + return nil +} + +func (x *ListIntAddressDiffsRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntAddressDiffsRequest) GetTxCount() *UInt32Filter { + if x != nil { + return x.TxCount + } + return nil +} + +func (x *ListIntAddressDiffsRequest) GetLastTxIndex() *UInt32Filter { + if x != nil { + return x.LastTxIndex + } + return nil +} + +func (x *ListIntAddressDiffsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntAddressDiffsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntAddressDiffsRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_address_diffs records +type ListIntAddressDiffsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_address_diffs. + IntAddressDiffs []*IntAddressDiffs `protobuf:"bytes,1,rep,name=int_address_diffs,json=intAddressDiffs,proto3" json:"int_address_diffs,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntAddressDiffsResponse) Reset() { + *x = ListIntAddressDiffsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_diffs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAddressDiffsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAddressDiffsResponse) ProtoMessage() {} + +func (x *ListIntAddressDiffsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_address_diffs_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAddressDiffsResponse.ProtoReflect.Descriptor instead. +func (*ListIntAddressDiffsResponse) Descriptor() ([]byte, []int) { + return file_int_address_diffs_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntAddressDiffsResponse) GetIntAddressDiffs() []*IntAddressDiffs { + if x != nil { + return x.IntAddressDiffs + } + return nil +} + +func (x *ListIntAddressDiffsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_address_diffs record by primary key +type GetIntAddressDiffsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Primary key (required) +} + +func (x *GetIntAddressDiffsRequest) Reset() { + *x = GetIntAddressDiffsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_diffs_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAddressDiffsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAddressDiffsRequest) ProtoMessage() {} + +func (x *GetIntAddressDiffsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_address_diffs_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAddressDiffsRequest.ProtoReflect.Descriptor instead. +func (*GetIntAddressDiffsRequest) Descriptor() ([]byte, []int) { + return file_int_address_diffs_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntAddressDiffsRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Response for getting a single int_address_diffs record +type GetIntAddressDiffsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntAddressDiffs `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntAddressDiffsResponse) Reset() { + *x = GetIntAddressDiffsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_diffs_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAddressDiffsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAddressDiffsResponse) ProtoMessage() {} + +func (x *GetIntAddressDiffsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_address_diffs_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAddressDiffsResponse.ProtoReflect.Descriptor instead. +func (*GetIntAddressDiffsResponse) Descriptor() ([]byte, []int) { + return file_int_address_diffs_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntAddressDiffsResponse) GetItem() *IntAddressDiffs { + if x != nil { + return x.Item + } + return nil +} + +var File_int_address_diffs_proto protoreflect.FileDescriptor + +var file_int_address_diffs_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x64, 0x69, + 0x66, 0x66, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, + 0x0f, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x08, 0x74, 0x78, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x07, 0x74, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, + 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x78, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xbb, 0x02, 0x0a, + 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, + 0x69, 0x66, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2c, + 0x0a, 0x08, 0x74, 0x78, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x52, 0x07, 0x74, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x0d, + 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x78, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0x87, 0x01, 0x0a, 0x1b, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, + 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, + 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x52, 0x0f, 0x69, 0x6e, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x35, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x46, 0x0a, 0x1a, 0x47, + 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x32, 0xab, 0x01, 0x0a, 0x16, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, + 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x03, 0x47, 0x65, 0x74, + 0x12, 0x1e, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x44, 0x69, 0x66, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, + 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, + 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_int_address_diffs_proto_rawDescOnce sync.Once + file_int_address_diffs_proto_rawDescData = file_int_address_diffs_proto_rawDesc +) + +func file_int_address_diffs_proto_rawDescGZIP() []byte { + file_int_address_diffs_proto_rawDescOnce.Do(func() { + file_int_address_diffs_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_address_diffs_proto_rawDescData) + }) + return file_int_address_diffs_proto_rawDescData +} + +var file_int_address_diffs_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_address_diffs_proto_goTypes = []any{ + (*IntAddressDiffs)(nil), // 0: cbt.IntAddressDiffs + (*ListIntAddressDiffsRequest)(nil), // 1: cbt.ListIntAddressDiffsRequest + (*ListIntAddressDiffsResponse)(nil), // 2: cbt.ListIntAddressDiffsResponse + (*GetIntAddressDiffsRequest)(nil), // 3: cbt.GetIntAddressDiffsRequest + (*GetIntAddressDiffsResponse)(nil), // 4: cbt.GetIntAddressDiffsResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter +} +var file_int_address_diffs_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntAddressDiffsRequest.address:type_name -> cbt.StringFilter + 6, // 1: cbt.ListIntAddressDiffsRequest.block_number:type_name -> cbt.UInt32Filter + 6, // 2: cbt.ListIntAddressDiffsRequest.tx_count:type_name -> cbt.UInt32Filter + 6, // 3: cbt.ListIntAddressDiffsRequest.last_tx_index:type_name -> cbt.UInt32Filter + 0, // 4: cbt.ListIntAddressDiffsResponse.int_address_diffs:type_name -> cbt.IntAddressDiffs + 0, // 5: cbt.GetIntAddressDiffsResponse.item:type_name -> cbt.IntAddressDiffs + 1, // 6: cbt.IntAddressDiffsService.List:input_type -> cbt.ListIntAddressDiffsRequest + 3, // 7: cbt.IntAddressDiffsService.Get:input_type -> cbt.GetIntAddressDiffsRequest + 2, // 8: cbt.IntAddressDiffsService.List:output_type -> cbt.ListIntAddressDiffsResponse + 4, // 9: cbt.IntAddressDiffsService.Get:output_type -> cbt.GetIntAddressDiffsResponse + 8, // [8:10] is the sub-list for method output_type + 6, // [6:8] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_int_address_diffs_proto_init() } +func file_int_address_diffs_proto_init() { + if File_int_address_diffs_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_address_diffs_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntAddressDiffs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_diffs_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAddressDiffsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_diffs_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAddressDiffsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_diffs_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAddressDiffsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_diffs_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAddressDiffsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_address_diffs_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_address_diffs_proto_goTypes, + DependencyIndexes: file_int_address_diffs_proto_depIdxs, + MessageInfos: file_int_address_diffs_proto_msgTypes, + }.Build() + File_int_address_diffs_proto = out.File + file_int_address_diffs_proto_rawDesc = nil + file_int_address_diffs_proto_goTypes = nil + file_int_address_diffs_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_address_diffs.proto b/pkg/proto/clickhouse/int_address_diffs.proto new file mode 100644 index 00000000..9716db8e --- /dev/null +++ b/pkg/proto/clickhouse/int_address_diffs.proto @@ -0,0 +1,72 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table for accounts last access data + +message IntAddressDiffs { + // The address of the account + string address = 11; + // The block number of the diffs + uint32 block_number = 12; + // The number of transactions with diffs for this address in the block + uint32 tx_count = 13; + // The last transaction index with diffs for this address in the block + uint32 last_tx_index = 14; +} + +// Request for listing int_address_diffs records +message ListIntAddressDiffsRequest { + // Filter by address - The address of the account (PRIMARY KEY - required) + StringFilter address = 1; + + // Filter by block_number - The block number of the diffs (optional) + UInt32Filter block_number = 2; + // Filter by tx_count - The number of transactions with diffs for this address in the block (optional) + UInt32Filter tx_count = 3; + // Filter by last_tx_index - The last transaction index with diffs for this address in the block (optional) + UInt32Filter last_tx_index = 4; + + // The maximum number of int_address_diffs to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 5; + // A page token, received from a previous `ListIntAddressDiffs` call. + // Provide this to retrieve the subsequent page. + string page_token = 6; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 7; +} + +// Response for listing int_address_diffs records +message ListIntAddressDiffsResponse { + // The list of int_address_diffs. + repeated IntAddressDiffs int_address_diffs = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_address_diffs record by primary key +message GetIntAddressDiffsRequest { + // The address of the account + string address = 1; // Primary key (required) +} + +// Response for getting a single int_address_diffs record +message GetIntAddressDiffsResponse { + IntAddressDiffs item = 1; +} + +// Query int_address_diffs data +service IntAddressDiffsService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntAddressDiffsRequest) returns (ListIntAddressDiffsResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntAddressDiffsRequest) returns (GetIntAddressDiffsResponse); +} diff --git a/pkg/proto/clickhouse/int_address_reads.go b/pkg/proto/clickhouse/int_address_reads.go new file mode 100644 index 00000000..1d0595ca --- /dev/null +++ b/pkg/proto/clickhouse/int_address_reads.go @@ -0,0 +1,200 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_address_reads + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntAddressReadsQuery constructs a parameterized SQL query from a ListIntAddressReadsRequest +func BuildListIntAddressReadsQuery(req *ListIntAddressReadsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Address == nil { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Address.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("address", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("address", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("address", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("address", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("address", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("address", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("address", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("address", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("address", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: block_number + if req.BlockNumber != nil { + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: tx_count + if req.TxCount != nil { + switch filter := req.TxCount.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("tx_count", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("tx_count", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("tx_count", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("tx_count", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("tx_count", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("tx_count", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("tx_count", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("tx_count", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("tx_count", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: last_tx_index + if req.LastTxIndex != nil { + switch filter := req.LastTxIndex.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("last_tx_index", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("last_tx_index", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("last_tx_index", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("last_tx_index", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("last_tx_index", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("last_tx_index", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("last_tx_index", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("last_tx_index", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("last_tx_index", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"address", "block_number", "tx_count", "last_tx_index"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY address" + ", block_number" + } + + // Build column list + columns := []string{"address", "block_number", "tx_count", "last_tx_index"} + + return BuildParameterizedQuery("int_address_reads", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntAddressReadsQuery constructs a parameterized SQL query from a GetIntAddressReadsRequest +func BuildGetIntAddressReadsQuery(req *GetIntAddressReadsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Address == "" { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("address", "=", req.Address) + + // Build ORDER BY clause + orderByClause := " ORDER BY address, block_number" + + // Build column list + columns := []string{"address", "block_number", "tx_count", "last_tx_index"} + + // Return single record + return BuildParameterizedQuery("int_address_reads", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_address_reads.pb.go b/pkg/proto/clickhouse/int_address_reads.pb.go new file mode 100644 index 00000000..4fe8129a --- /dev/null +++ b/pkg/proto/clickhouse/int_address_reads.pb.go @@ -0,0 +1,557 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_address_reads.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntAddressReads struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` + // The block number of the reads + BlockNumber uint32 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // The number of reads for this address in this block + TxCount uint32 `protobuf:"varint,13,opt,name=tx_count,json=txCount,proto3" json:"tx_count,omitempty"` + // The last transaction index with diffs for this address in the block + LastTxIndex uint32 `protobuf:"varint,14,opt,name=last_tx_index,json=lastTxIndex,proto3" json:"last_tx_index,omitempty"` +} + +func (x *IntAddressReads) Reset() { + *x = IntAddressReads{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_reads_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntAddressReads) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntAddressReads) ProtoMessage() {} + +func (x *IntAddressReads) ProtoReflect() protoreflect.Message { + mi := &file_int_address_reads_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntAddressReads.ProtoReflect.Descriptor instead. +func (*IntAddressReads) Descriptor() ([]byte, []int) { + return file_int_address_reads_proto_rawDescGZIP(), []int{0} +} + +func (x *IntAddressReads) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *IntAddressReads) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntAddressReads) GetTxCount() uint32 { + if x != nil { + return x.TxCount + } + return 0 +} + +func (x *IntAddressReads) GetLastTxIndex() uint32 { + if x != nil { + return x.LastTxIndex + } + return 0 +} + +// Request for listing int_address_reads records +type ListIntAddressReadsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by address - The address of the account (PRIMARY KEY - required) + Address *StringFilter `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Filter by block_number - The block number of the reads (ORDER BY column 2 - optional) + BlockNumber *UInt32Filter `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by tx_count - The number of reads for this address in this block (optional) + TxCount *UInt32Filter `protobuf:"bytes,3,opt,name=tx_count,json=txCount,proto3" json:"tx_count,omitempty"` + // Filter by last_tx_index - The last transaction index with diffs for this address in the block (optional) + LastTxIndex *UInt32Filter `protobuf:"bytes,4,opt,name=last_tx_index,json=lastTxIndex,proto3" json:"last_tx_index,omitempty"` + // The maximum number of int_address_reads to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntAddressReads` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,6,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,7,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntAddressReadsRequest) Reset() { + *x = ListIntAddressReadsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_reads_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAddressReadsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAddressReadsRequest) ProtoMessage() {} + +func (x *ListIntAddressReadsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_address_reads_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAddressReadsRequest.ProtoReflect.Descriptor instead. +func (*ListIntAddressReadsRequest) Descriptor() ([]byte, []int) { + return file_int_address_reads_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntAddressReadsRequest) GetAddress() *StringFilter { + if x != nil { + return x.Address + } + return nil +} + +func (x *ListIntAddressReadsRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntAddressReadsRequest) GetTxCount() *UInt32Filter { + if x != nil { + return x.TxCount + } + return nil +} + +func (x *ListIntAddressReadsRequest) GetLastTxIndex() *UInt32Filter { + if x != nil { + return x.LastTxIndex + } + return nil +} + +func (x *ListIntAddressReadsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntAddressReadsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntAddressReadsRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_address_reads records +type ListIntAddressReadsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_address_reads. + IntAddressReads []*IntAddressReads `protobuf:"bytes,1,rep,name=int_address_reads,json=intAddressReads,proto3" json:"int_address_reads,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntAddressReadsResponse) Reset() { + *x = ListIntAddressReadsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_reads_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAddressReadsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAddressReadsResponse) ProtoMessage() {} + +func (x *ListIntAddressReadsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_address_reads_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAddressReadsResponse.ProtoReflect.Descriptor instead. +func (*ListIntAddressReadsResponse) Descriptor() ([]byte, []int) { + return file_int_address_reads_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntAddressReadsResponse) GetIntAddressReads() []*IntAddressReads { + if x != nil { + return x.IntAddressReads + } + return nil +} + +func (x *ListIntAddressReadsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_address_reads record by primary key +type GetIntAddressReadsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Primary key (required) +} + +func (x *GetIntAddressReadsRequest) Reset() { + *x = GetIntAddressReadsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_reads_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAddressReadsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAddressReadsRequest) ProtoMessage() {} + +func (x *GetIntAddressReadsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_address_reads_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAddressReadsRequest.ProtoReflect.Descriptor instead. +func (*GetIntAddressReadsRequest) Descriptor() ([]byte, []int) { + return file_int_address_reads_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntAddressReadsRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Response for getting a single int_address_reads record +type GetIntAddressReadsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntAddressReads `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntAddressReadsResponse) Reset() { + *x = GetIntAddressReadsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_reads_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAddressReadsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAddressReadsResponse) ProtoMessage() {} + +func (x *GetIntAddressReadsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_address_reads_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAddressReadsResponse.ProtoReflect.Descriptor instead. +func (*GetIntAddressReadsResponse) Descriptor() ([]byte, []int) { + return file_int_address_reads_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntAddressReadsResponse) GetItem() *IntAddressReads { + if x != nil { + return x.Item + } + return nil +} + +var File_int_address_reads_proto protoreflect.FileDescriptor + +var file_int_address_reads_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, + 0x61, 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, + 0x0f, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x08, 0x74, 0x78, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x07, 0x74, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, + 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x78, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0xbb, 0x02, 0x0a, + 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, + 0x65, 0x61, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2c, + 0x0a, 0x08, 0x74, 0x78, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x52, 0x07, 0x74, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x0d, + 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x78, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0x87, 0x01, 0x0a, 0x1b, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, + 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, + 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x52, 0x0f, 0x69, 0x6e, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x35, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x46, 0x0a, 0x1a, 0x47, + 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x32, 0xab, 0x01, 0x0a, 0x16, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, + 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x03, 0x47, 0x65, 0x74, + 0x12, 0x1e, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x61, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, + 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, + 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_int_address_reads_proto_rawDescOnce sync.Once + file_int_address_reads_proto_rawDescData = file_int_address_reads_proto_rawDesc +) + +func file_int_address_reads_proto_rawDescGZIP() []byte { + file_int_address_reads_proto_rawDescOnce.Do(func() { + file_int_address_reads_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_address_reads_proto_rawDescData) + }) + return file_int_address_reads_proto_rawDescData +} + +var file_int_address_reads_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_address_reads_proto_goTypes = []any{ + (*IntAddressReads)(nil), // 0: cbt.IntAddressReads + (*ListIntAddressReadsRequest)(nil), // 1: cbt.ListIntAddressReadsRequest + (*ListIntAddressReadsResponse)(nil), // 2: cbt.ListIntAddressReadsResponse + (*GetIntAddressReadsRequest)(nil), // 3: cbt.GetIntAddressReadsRequest + (*GetIntAddressReadsResponse)(nil), // 4: cbt.GetIntAddressReadsResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter +} +var file_int_address_reads_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntAddressReadsRequest.address:type_name -> cbt.StringFilter + 6, // 1: cbt.ListIntAddressReadsRequest.block_number:type_name -> cbt.UInt32Filter + 6, // 2: cbt.ListIntAddressReadsRequest.tx_count:type_name -> cbt.UInt32Filter + 6, // 3: cbt.ListIntAddressReadsRequest.last_tx_index:type_name -> cbt.UInt32Filter + 0, // 4: cbt.ListIntAddressReadsResponse.int_address_reads:type_name -> cbt.IntAddressReads + 0, // 5: cbt.GetIntAddressReadsResponse.item:type_name -> cbt.IntAddressReads + 1, // 6: cbt.IntAddressReadsService.List:input_type -> cbt.ListIntAddressReadsRequest + 3, // 7: cbt.IntAddressReadsService.Get:input_type -> cbt.GetIntAddressReadsRequest + 2, // 8: cbt.IntAddressReadsService.List:output_type -> cbt.ListIntAddressReadsResponse + 4, // 9: cbt.IntAddressReadsService.Get:output_type -> cbt.GetIntAddressReadsResponse + 8, // [8:10] is the sub-list for method output_type + 6, // [6:8] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_int_address_reads_proto_init() } +func file_int_address_reads_proto_init() { + if File_int_address_reads_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_address_reads_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntAddressReads); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_reads_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAddressReadsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_reads_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAddressReadsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_reads_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAddressReadsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_reads_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAddressReadsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_address_reads_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_address_reads_proto_goTypes, + DependencyIndexes: file_int_address_reads_proto_depIdxs, + MessageInfos: file_int_address_reads_proto_msgTypes, + }.Build() + File_int_address_reads_proto = out.File + file_int_address_reads_proto_rawDesc = nil + file_int_address_reads_proto_goTypes = nil + file_int_address_reads_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_address_reads.proto b/pkg/proto/clickhouse/int_address_reads.proto new file mode 100644 index 00000000..02305455 --- /dev/null +++ b/pkg/proto/clickhouse/int_address_reads.proto @@ -0,0 +1,73 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table for accounts reads data + +message IntAddressReads { + // The address of the account + string address = 11; + // The block number of the reads + uint32 block_number = 12; + // The number of reads for this address in this block + uint32 tx_count = 13; + // The last transaction index with diffs for this address in the block + uint32 last_tx_index = 14; +} + +// Request for listing int_address_reads records +message ListIntAddressReadsRequest { + // Filter by address - The address of the account (PRIMARY KEY - required) + StringFilter address = 1; + + // Filter by block_number - The block number of the reads (ORDER BY column 2 - optional) + UInt32Filter block_number = 2; + + // Filter by tx_count - The number of reads for this address in this block (optional) + UInt32Filter tx_count = 3; + // Filter by last_tx_index - The last transaction index with diffs for this address in the block (optional) + UInt32Filter last_tx_index = 4; + + // The maximum number of int_address_reads to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 5; + // A page token, received from a previous `ListIntAddressReads` call. + // Provide this to retrieve the subsequent page. + string page_token = 6; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 7; +} + +// Response for listing int_address_reads records +message ListIntAddressReadsResponse { + // The list of int_address_reads. + repeated IntAddressReads int_address_reads = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_address_reads record by primary key +message GetIntAddressReadsRequest { + // The address of the account + string address = 1; // Primary key (required) +} + +// Response for getting a single int_address_reads record +message GetIntAddressReadsResponse { + IntAddressReads item = 1; +} + +// Query int_address_reads data +service IntAddressReadsService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntAddressReadsRequest) returns (ListIntAddressReadsResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntAddressReadsRequest) returns (GetIntAddressReadsResponse); +} diff --git a/pkg/proto/clickhouse/int_post_6780_accounts_destructs.go b/pkg/proto/clickhouse/int_post_6780_accounts_destructs.go new file mode 100644 index 00000000..f0f62996 --- /dev/null +++ b/pkg/proto/clickhouse/int_post_6780_accounts_destructs.go @@ -0,0 +1,212 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_post_6780_accounts_destructs + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntPost6780AccountsDestructsQuery constructs a parameterized SQL query from a ListIntPost6780AccountsDestructsRequest +func BuildListIntPost6780AccountsDestructsQuery(req *ListIntPost6780AccountsDestructsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Address == nil { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Address.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("address", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("address", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("address", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("address", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("address", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("address", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("address", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("address", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("address", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: block_number + if req.BlockNumber != nil { + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: transaction_hash + if req.TransactionHash != nil { + switch filter := req.TransactionHash.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("transaction_hash", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("transaction_hash", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("transaction_hash", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("transaction_hash", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("transaction_hash", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("transaction_hash", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("transaction_hash", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("transaction_hash", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("transaction_hash", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: transaction_index + if req.TransactionIndex != nil { + switch filter := req.TransactionIndex.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("transaction_index", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("transaction_index", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("transaction_index", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("transaction_index", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("transaction_index", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("transaction_index", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("transaction_index", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("transaction_index", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("transaction_index", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: is_same_tx + if req.IsSameTx != nil { + switch filter := req.IsSameTx.Filter.(type) { + case *BoolFilter_Eq: + qb.AddCondition("is_same_tx", "=", filter.Eq) + case *BoolFilter_Ne: + qb.AddCondition("is_same_tx", "!=", filter.Ne) + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"address", "block_number", "transaction_hash", "transaction_index", "is_same_tx"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY address" + ", block_number" + ", transaction_hash" + } + + // Build column list + columns := []string{"address", "block_number", "NULLIF(`transaction_hash`, repeat('\x00', 66)) AS `transaction_hash`", "transaction_index", "is_same_tx"} + + return BuildParameterizedQuery("int_post_6780_accounts_destructs", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntPost6780AccountsDestructsQuery constructs a parameterized SQL query from a GetIntPost6780AccountsDestructsRequest +func BuildGetIntPost6780AccountsDestructsQuery(req *GetIntPost6780AccountsDestructsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Address == "" { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("address", "=", req.Address) + + // Build ORDER BY clause + orderByClause := " ORDER BY address, block_number, transaction_hash" + + // Build column list + columns := []string{"address", "block_number", "NULLIF(`transaction_hash`, repeat('\x00', 66)) AS `transaction_hash`", "transaction_index", "is_same_tx"} + + // Return single record + return BuildParameterizedQuery("int_post_6780_accounts_destructs", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_post_6780_accounts_destructs.pb.go b/pkg/proto/clickhouse/int_post_6780_accounts_destructs.pb.go new file mode 100644 index 00000000..936862b1 --- /dev/null +++ b/pkg/proto/clickhouse/int_post_6780_accounts_destructs.pb.go @@ -0,0 +1,598 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_post_6780_accounts_destructs.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntPost6780AccountsDestructs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` + // The block number + BlockNumber uint32 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // The transaction hash + TransactionHash string `protobuf:"bytes,13,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` + // The transaction index + TransactionIndex uint64 `protobuf:"varint,14,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` + // Whether the self-destruct is in the same transaction as the creation + IsSameTx bool `protobuf:"varint,15,opt,name=is_same_tx,json=isSameTx,proto3" json:"is_same_tx,omitempty"` +} + +func (x *IntPost6780AccountsDestructs) Reset() { + *x = IntPost6780AccountsDestructs{} + if protoimpl.UnsafeEnabled { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntPost6780AccountsDestructs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntPost6780AccountsDestructs) ProtoMessage() {} + +func (x *IntPost6780AccountsDestructs) ProtoReflect() protoreflect.Message { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntPost6780AccountsDestructs.ProtoReflect.Descriptor instead. +func (*IntPost6780AccountsDestructs) Descriptor() ([]byte, []int) { + return file_int_post_6780_accounts_destructs_proto_rawDescGZIP(), []int{0} +} + +func (x *IntPost6780AccountsDestructs) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *IntPost6780AccountsDestructs) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntPost6780AccountsDestructs) GetTransactionHash() string { + if x != nil { + return x.TransactionHash + } + return "" +} + +func (x *IntPost6780AccountsDestructs) GetTransactionIndex() uint64 { + if x != nil { + return x.TransactionIndex + } + return 0 +} + +func (x *IntPost6780AccountsDestructs) GetIsSameTx() bool { + if x != nil { + return x.IsSameTx + } + return false +} + +// Request for listing int_post_6780_accounts_destructs records +type ListIntPost6780AccountsDestructsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by address - The address of the account (PRIMARY KEY - required) + Address *StringFilter `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Filter by block_number - The block number (ORDER BY column 2 - optional) + BlockNumber *UInt32Filter `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by transaction_hash - The transaction hash (ORDER BY column 3 - optional) + TransactionHash *StringFilter `protobuf:"bytes,3,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` + // Filter by transaction_index - The transaction index (optional) + TransactionIndex *UInt64Filter `protobuf:"bytes,4,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` + // Filter by is_same_tx - Whether the self-destruct is in the same transaction as the creation (optional) + IsSameTx *BoolFilter `protobuf:"bytes,5,opt,name=is_same_tx,json=isSameTx,proto3" json:"is_same_tx,omitempty"` + // The maximum number of int_post_6780_accounts_destructs to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,6,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntPost6780AccountsDestructs` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,7,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,8,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntPost6780AccountsDestructsRequest) Reset() { + *x = ListIntPost6780AccountsDestructsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntPost6780AccountsDestructsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntPost6780AccountsDestructsRequest) ProtoMessage() {} + +func (x *ListIntPost6780AccountsDestructsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntPost6780AccountsDestructsRequest.ProtoReflect.Descriptor instead. +func (*ListIntPost6780AccountsDestructsRequest) Descriptor() ([]byte, []int) { + return file_int_post_6780_accounts_destructs_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetAddress() *StringFilter { + if x != nil { + return x.Address + } + return nil +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetTransactionHash() *StringFilter { + if x != nil { + return x.TransactionHash + } + return nil +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetTransactionIndex() *UInt64Filter { + if x != nil { + return x.TransactionIndex + } + return nil +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetIsSameTx() *BoolFilter { + if x != nil { + return x.IsSameTx + } + return nil +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntPost6780AccountsDestructsRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_post_6780_accounts_destructs records +type ListIntPost6780AccountsDestructsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_post_6780_accounts_destructs. + IntPost_6780AccountsDestructs []*IntPost6780AccountsDestructs `protobuf:"bytes,1,rep,name=int_post_6780_accounts_destructs,json=intPost6780AccountsDestructs,proto3" json:"int_post_6780_accounts_destructs,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntPost6780AccountsDestructsResponse) Reset() { + *x = ListIntPost6780AccountsDestructsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntPost6780AccountsDestructsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntPost6780AccountsDestructsResponse) ProtoMessage() {} + +func (x *ListIntPost6780AccountsDestructsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntPost6780AccountsDestructsResponse.ProtoReflect.Descriptor instead. +func (*ListIntPost6780AccountsDestructsResponse) Descriptor() ([]byte, []int) { + return file_int_post_6780_accounts_destructs_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntPost6780AccountsDestructsResponse) GetIntPost_6780AccountsDestructs() []*IntPost6780AccountsDestructs { + if x != nil { + return x.IntPost_6780AccountsDestructs + } + return nil +} + +func (x *ListIntPost6780AccountsDestructsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_post_6780_accounts_destructs record by primary key +type GetIntPost6780AccountsDestructsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Primary key (required) +} + +func (x *GetIntPost6780AccountsDestructsRequest) Reset() { + *x = GetIntPost6780AccountsDestructsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntPost6780AccountsDestructsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntPost6780AccountsDestructsRequest) ProtoMessage() {} + +func (x *GetIntPost6780AccountsDestructsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntPost6780AccountsDestructsRequest.ProtoReflect.Descriptor instead. +func (*GetIntPost6780AccountsDestructsRequest) Descriptor() ([]byte, []int) { + return file_int_post_6780_accounts_destructs_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntPost6780AccountsDestructsRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Response for getting a single int_post_6780_accounts_destructs record +type GetIntPost6780AccountsDestructsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntPost6780AccountsDestructs `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntPost6780AccountsDestructsResponse) Reset() { + *x = GetIntPost6780AccountsDestructsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntPost6780AccountsDestructsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntPost6780AccountsDestructsResponse) ProtoMessage() {} + +func (x *GetIntPost6780AccountsDestructsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_post_6780_accounts_destructs_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntPost6780AccountsDestructsResponse.ProtoReflect.Descriptor instead. +func (*GetIntPost6780AccountsDestructsResponse) Descriptor() ([]byte, []int) { + return file_int_post_6780_accounts_destructs_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntPost6780AccountsDestructsResponse) GetItem() *IntPost6780AccountsDestructs { + if x != nil { + return x.Item + } + return nil +} + +var File_int_post_6780_accounts_destructs_proto protoreflect.FileDescriptor + +var file_int_post_6780_accounts_destructs_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x69, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x36, 0x37, 0x38, 0x30, 0x5f, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x01, 0x0a, 0x1c, + 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x12, 0x1c, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x61, 0x6d, 0x65, 0x5f, 0x74, 0x78, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x53, 0x61, 0x6d, 0x65, 0x54, 0x78, 0x22, + 0x90, 0x03, 0x0a, 0x27, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, + 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3c, + 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3e, 0x0a, 0x11, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x10, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x2d, 0x0a, 0x0a, + 0x69, 0x73, 0x5f, 0x73, 0x61, 0x6d, 0x65, 0x5f, 0x74, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x52, 0x08, 0x69, 0x73, 0x53, 0x61, 0x6d, 0x65, 0x54, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, + 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x5f, 0x62, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x42, 0x79, 0x22, 0xbd, 0x01, 0x0a, 0x28, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, + 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x69, 0x0a, 0x20, 0x69, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x36, 0x37, 0x38, 0x30, + 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x1c, 0x69, 0x6e, + 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x42, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, + 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x60, 0x0a, 0x27, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, + 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, + 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x73, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xec, 0x01, 0x0a, 0x23, 0x49, 0x6e, 0x74, + 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x63, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x2b, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, + 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, + 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_int_post_6780_accounts_destructs_proto_rawDescOnce sync.Once + file_int_post_6780_accounts_destructs_proto_rawDescData = file_int_post_6780_accounts_destructs_proto_rawDesc +) + +func file_int_post_6780_accounts_destructs_proto_rawDescGZIP() []byte { + file_int_post_6780_accounts_destructs_proto_rawDescOnce.Do(func() { + file_int_post_6780_accounts_destructs_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_post_6780_accounts_destructs_proto_rawDescData) + }) + return file_int_post_6780_accounts_destructs_proto_rawDescData +} + +var file_int_post_6780_accounts_destructs_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_post_6780_accounts_destructs_proto_goTypes = []any{ + (*IntPost6780AccountsDestructs)(nil), // 0: cbt.IntPost6780AccountsDestructs + (*ListIntPost6780AccountsDestructsRequest)(nil), // 1: cbt.ListIntPost6780AccountsDestructsRequest + (*ListIntPost6780AccountsDestructsResponse)(nil), // 2: cbt.ListIntPost6780AccountsDestructsResponse + (*GetIntPost6780AccountsDestructsRequest)(nil), // 3: cbt.GetIntPost6780AccountsDestructsRequest + (*GetIntPost6780AccountsDestructsResponse)(nil), // 4: cbt.GetIntPost6780AccountsDestructsResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter + (*UInt64Filter)(nil), // 7: cbt.UInt64Filter + (*BoolFilter)(nil), // 8: cbt.BoolFilter +} +var file_int_post_6780_accounts_destructs_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntPost6780AccountsDestructsRequest.address:type_name -> cbt.StringFilter + 6, // 1: cbt.ListIntPost6780AccountsDestructsRequest.block_number:type_name -> cbt.UInt32Filter + 5, // 2: cbt.ListIntPost6780AccountsDestructsRequest.transaction_hash:type_name -> cbt.StringFilter + 7, // 3: cbt.ListIntPost6780AccountsDestructsRequest.transaction_index:type_name -> cbt.UInt64Filter + 8, // 4: cbt.ListIntPost6780AccountsDestructsRequest.is_same_tx:type_name -> cbt.BoolFilter + 0, // 5: cbt.ListIntPost6780AccountsDestructsResponse.int_post_6780_accounts_destructs:type_name -> cbt.IntPost6780AccountsDestructs + 0, // 6: cbt.GetIntPost6780AccountsDestructsResponse.item:type_name -> cbt.IntPost6780AccountsDestructs + 1, // 7: cbt.IntPost6780AccountsDestructsService.List:input_type -> cbt.ListIntPost6780AccountsDestructsRequest + 3, // 8: cbt.IntPost6780AccountsDestructsService.Get:input_type -> cbt.GetIntPost6780AccountsDestructsRequest + 2, // 9: cbt.IntPost6780AccountsDestructsService.List:output_type -> cbt.ListIntPost6780AccountsDestructsResponse + 4, // 10: cbt.IntPost6780AccountsDestructsService.Get:output_type -> cbt.GetIntPost6780AccountsDestructsResponse + 9, // [9:11] is the sub-list for method output_type + 7, // [7:9] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_int_post_6780_accounts_destructs_proto_init() } +func file_int_post_6780_accounts_destructs_proto_init() { + if File_int_post_6780_accounts_destructs_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_post_6780_accounts_destructs_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntPost6780AccountsDestructs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_post_6780_accounts_destructs_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntPost6780AccountsDestructsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_post_6780_accounts_destructs_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntPost6780AccountsDestructsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_post_6780_accounts_destructs_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntPost6780AccountsDestructsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_post_6780_accounts_destructs_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntPost6780AccountsDestructsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_post_6780_accounts_destructs_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_post_6780_accounts_destructs_proto_goTypes, + DependencyIndexes: file_int_post_6780_accounts_destructs_proto_depIdxs, + MessageInfos: file_int_post_6780_accounts_destructs_proto_msgTypes, + }.Build() + File_int_post_6780_accounts_destructs_proto = out.File + file_int_post_6780_accounts_destructs_proto_rawDesc = nil + file_int_post_6780_accounts_destructs_proto_goTypes = nil + file_int_post_6780_accounts_destructs_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_post_6780_accounts_destructs.proto b/pkg/proto/clickhouse/int_post_6780_accounts_destructs.proto new file mode 100644 index 00000000..c1d07314 --- /dev/null +++ b/pkg/proto/clickhouse/int_post_6780_accounts_destructs.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table for accounts self-destructs data post-6780 (Dencun fork) + +message IntPost6780AccountsDestructs { + // The address of the account + string address = 11; + // The block number + uint32 block_number = 12; + // The transaction hash + string transaction_hash = 13; + // The transaction index + uint64 transaction_index = 14; + // Whether the self-destruct is in the same transaction as the creation + bool is_same_tx = 15; +} + +// Request for listing int_post_6780_accounts_destructs records +message ListIntPost6780AccountsDestructsRequest { + // Filter by address - The address of the account (PRIMARY KEY - required) + StringFilter address = 1; + + // Filter by block_number - The block number (ORDER BY column 2 - optional) + UInt32Filter block_number = 2; + + // Filter by transaction_hash - The transaction hash (ORDER BY column 3 - optional) + StringFilter transaction_hash = 3; + + // Filter by transaction_index - The transaction index (optional) + UInt64Filter transaction_index = 4; + // Filter by is_same_tx - Whether the self-destruct is in the same transaction as the creation (optional) + BoolFilter is_same_tx = 5; + + // The maximum number of int_post_6780_accounts_destructs to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 6; + // A page token, received from a previous `ListIntPost6780AccountsDestructs` call. + // Provide this to retrieve the subsequent page. + string page_token = 7; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 8; +} + +// Response for listing int_post_6780_accounts_destructs records +message ListIntPost6780AccountsDestructsResponse { + // The list of int_post_6780_accounts_destructs. + repeated IntPost6780AccountsDestructs int_post_6780_accounts_destructs = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_post_6780_accounts_destructs record by primary key +message GetIntPost6780AccountsDestructsRequest { + // The address of the account + string address = 1; // Primary key (required) +} + +// Response for getting a single int_post_6780_accounts_destructs record +message GetIntPost6780AccountsDestructsResponse { + IntPost6780AccountsDestructs item = 1; +} + +// Query int_post_6780_accounts_destructs data +service IntPost6780AccountsDestructsService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntPost6780AccountsDestructsRequest) returns (ListIntPost6780AccountsDestructsResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntPost6780AccountsDestructsRequest) returns (GetIntPost6780AccountsDestructsResponse); +} diff --git a/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.go b/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.go new file mode 100644 index 00000000..def88037 --- /dev/null +++ b/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.go @@ -0,0 +1,200 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_pre_6780_accounts_destructs + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntPre6780AccountsDestructsQuery constructs a parameterized SQL query from a ListIntPre6780AccountsDestructsRequest +func BuildListIntPre6780AccountsDestructsQuery(req *ListIntPre6780AccountsDestructsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Address == nil { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Address.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("address", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("address", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("address", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("address", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("address", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("address", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("address", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("address", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("address", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: block_number + if req.BlockNumber != nil { + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: transaction_hash + if req.TransactionHash != nil { + switch filter := req.TransactionHash.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("transaction_hash", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("transaction_hash", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("transaction_hash", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("transaction_hash", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("transaction_hash", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("transaction_hash", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("transaction_hash", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("transaction_hash", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("transaction_hash", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: transaction_index + if req.TransactionIndex != nil { + switch filter := req.TransactionIndex.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("transaction_index", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("transaction_index", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("transaction_index", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("transaction_index", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("transaction_index", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("transaction_index", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("transaction_index", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("transaction_index", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("transaction_index", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"address", "block_number", "transaction_hash", "transaction_index"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY address" + ", block_number" + ", transaction_hash" + } + + // Build column list + columns := []string{"address", "block_number", "NULLIF(`transaction_hash`, repeat('\x00', 66)) AS `transaction_hash`", "transaction_index"} + + return BuildParameterizedQuery("int_pre_6780_accounts_destructs", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntPre6780AccountsDestructsQuery constructs a parameterized SQL query from a GetIntPre6780AccountsDestructsRequest +func BuildGetIntPre6780AccountsDestructsQuery(req *GetIntPre6780AccountsDestructsRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Address == "" { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("address", "=", req.Address) + + // Build ORDER BY clause + orderByClause := " ORDER BY address, block_number, transaction_hash" + + // Build column list + columns := []string{"address", "block_number", "NULLIF(`transaction_hash`, repeat('\x00', 66)) AS `transaction_hash`", "transaction_index"} + + // Return single record + return BuildParameterizedQuery("int_pre_6780_accounts_destructs", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.pb.go b/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.pb.go new file mode 100644 index 00000000..9267a24d --- /dev/null +++ b/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.pb.go @@ -0,0 +1,572 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_pre_6780_accounts_destructs.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntPre6780AccountsDestructs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` + // The block number of the self-destructs + BlockNumber uint32 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // The transaction hash + TransactionHash string `protobuf:"bytes,13,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` + // The transaction index + TransactionIndex uint64 `protobuf:"varint,14,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` +} + +func (x *IntPre6780AccountsDestructs) Reset() { + *x = IntPre6780AccountsDestructs{} + if protoimpl.UnsafeEnabled { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntPre6780AccountsDestructs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntPre6780AccountsDestructs) ProtoMessage() {} + +func (x *IntPre6780AccountsDestructs) ProtoReflect() protoreflect.Message { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntPre6780AccountsDestructs.ProtoReflect.Descriptor instead. +func (*IntPre6780AccountsDestructs) Descriptor() ([]byte, []int) { + return file_int_pre_6780_accounts_destructs_proto_rawDescGZIP(), []int{0} +} + +func (x *IntPre6780AccountsDestructs) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *IntPre6780AccountsDestructs) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntPre6780AccountsDestructs) GetTransactionHash() string { + if x != nil { + return x.TransactionHash + } + return "" +} + +func (x *IntPre6780AccountsDestructs) GetTransactionIndex() uint64 { + if x != nil { + return x.TransactionIndex + } + return 0 +} + +// Request for listing int_pre_6780_accounts_destructs records +type ListIntPre6780AccountsDestructsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by address - The address of the account (PRIMARY KEY - required) + Address *StringFilter `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Filter by block_number - The block number of the self-destructs (ORDER BY column 2 - optional) + BlockNumber *UInt32Filter `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by transaction_hash - The transaction hash (ORDER BY column 3 - optional) + TransactionHash *StringFilter `protobuf:"bytes,3,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` + // Filter by transaction_index - The transaction index (optional) + TransactionIndex *UInt64Filter `protobuf:"bytes,4,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"` + // The maximum number of int_pre_6780_accounts_destructs to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntPre6780AccountsDestructs` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,6,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,7,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntPre6780AccountsDestructsRequest) Reset() { + *x = ListIntPre6780AccountsDestructsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntPre6780AccountsDestructsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntPre6780AccountsDestructsRequest) ProtoMessage() {} + +func (x *ListIntPre6780AccountsDestructsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntPre6780AccountsDestructsRequest.ProtoReflect.Descriptor instead. +func (*ListIntPre6780AccountsDestructsRequest) Descriptor() ([]byte, []int) { + return file_int_pre_6780_accounts_destructs_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetAddress() *StringFilter { + if x != nil { + return x.Address + } + return nil +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetTransactionHash() *StringFilter { + if x != nil { + return x.TransactionHash + } + return nil +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetTransactionIndex() *UInt64Filter { + if x != nil { + return x.TransactionIndex + } + return nil +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntPre6780AccountsDestructsRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_pre_6780_accounts_destructs records +type ListIntPre6780AccountsDestructsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_pre_6780_accounts_destructs. + IntPre_6780AccountsDestructs []*IntPre6780AccountsDestructs `protobuf:"bytes,1,rep,name=int_pre_6780_accounts_destructs,json=intPre6780AccountsDestructs,proto3" json:"int_pre_6780_accounts_destructs,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntPre6780AccountsDestructsResponse) Reset() { + *x = ListIntPre6780AccountsDestructsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntPre6780AccountsDestructsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntPre6780AccountsDestructsResponse) ProtoMessage() {} + +func (x *ListIntPre6780AccountsDestructsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntPre6780AccountsDestructsResponse.ProtoReflect.Descriptor instead. +func (*ListIntPre6780AccountsDestructsResponse) Descriptor() ([]byte, []int) { + return file_int_pre_6780_accounts_destructs_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntPre6780AccountsDestructsResponse) GetIntPre_6780AccountsDestructs() []*IntPre6780AccountsDestructs { + if x != nil { + return x.IntPre_6780AccountsDestructs + } + return nil +} + +func (x *ListIntPre6780AccountsDestructsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_pre_6780_accounts_destructs record by primary key +type GetIntPre6780AccountsDestructsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Primary key (required) +} + +func (x *GetIntPre6780AccountsDestructsRequest) Reset() { + *x = GetIntPre6780AccountsDestructsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntPre6780AccountsDestructsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntPre6780AccountsDestructsRequest) ProtoMessage() {} + +func (x *GetIntPre6780AccountsDestructsRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntPre6780AccountsDestructsRequest.ProtoReflect.Descriptor instead. +func (*GetIntPre6780AccountsDestructsRequest) Descriptor() ([]byte, []int) { + return file_int_pre_6780_accounts_destructs_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntPre6780AccountsDestructsRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Response for getting a single int_pre_6780_accounts_destructs record +type GetIntPre6780AccountsDestructsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntPre6780AccountsDestructs `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntPre6780AccountsDestructsResponse) Reset() { + *x = GetIntPre6780AccountsDestructsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntPre6780AccountsDestructsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntPre6780AccountsDestructsResponse) ProtoMessage() {} + +func (x *GetIntPre6780AccountsDestructsResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_pre_6780_accounts_destructs_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntPre6780AccountsDestructsResponse.ProtoReflect.Descriptor instead. +func (*GetIntPre6780AccountsDestructsResponse) Descriptor() ([]byte, []int) { + return file_int_pre_6780_accounts_destructs_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntPre6780AccountsDestructsResponse) GetItem() *IntPre6780AccountsDestructs { + if x != nil { + return x.Item + } + return nil +} + +var File_int_pre_6780_accounts_destructs_proto protoreflect.FileDescriptor + +var file_int_pre_6780_accounts_destructs_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x69, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x5f, 0x36, 0x37, 0x38, 0x30, 0x5f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x01, 0x0a, 0x1b, 0x49, + 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, + 0xe0, 0x02, 0x0a, 0x26, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, + 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3c, 0x0a, + 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3e, 0x0a, 0x11, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, + 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x5f, 0x62, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x42, 0x79, 0x22, 0xb9, 0x01, 0x0a, 0x27, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, + 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, + 0x0a, 0x1f, 0x69, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x5f, 0x36, 0x37, 0x38, 0x30, 0x5f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, + 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x1b, 0x69, 0x6e, 0x74, 0x50, 0x72, + 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x41, + 0x0a, 0x25, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x5e, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, + 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x32, 0xe7, 0x01, 0x0a, 0x22, 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, 0x38, 0x30, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, + 0x12, 0x2b, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, + 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, + 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x03, 0x47, + 0x65, 0x74, 0x12, 0x2a, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, + 0x72, 0x65, 0x36, 0x37, 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x50, 0x72, 0x65, 0x36, 0x37, + 0x38, 0x30, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, + 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, + 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_int_pre_6780_accounts_destructs_proto_rawDescOnce sync.Once + file_int_pre_6780_accounts_destructs_proto_rawDescData = file_int_pre_6780_accounts_destructs_proto_rawDesc +) + +func file_int_pre_6780_accounts_destructs_proto_rawDescGZIP() []byte { + file_int_pre_6780_accounts_destructs_proto_rawDescOnce.Do(func() { + file_int_pre_6780_accounts_destructs_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_pre_6780_accounts_destructs_proto_rawDescData) + }) + return file_int_pre_6780_accounts_destructs_proto_rawDescData +} + +var file_int_pre_6780_accounts_destructs_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_pre_6780_accounts_destructs_proto_goTypes = []any{ + (*IntPre6780AccountsDestructs)(nil), // 0: cbt.IntPre6780AccountsDestructs + (*ListIntPre6780AccountsDestructsRequest)(nil), // 1: cbt.ListIntPre6780AccountsDestructsRequest + (*ListIntPre6780AccountsDestructsResponse)(nil), // 2: cbt.ListIntPre6780AccountsDestructsResponse + (*GetIntPre6780AccountsDestructsRequest)(nil), // 3: cbt.GetIntPre6780AccountsDestructsRequest + (*GetIntPre6780AccountsDestructsResponse)(nil), // 4: cbt.GetIntPre6780AccountsDestructsResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter + (*UInt64Filter)(nil), // 7: cbt.UInt64Filter +} +var file_int_pre_6780_accounts_destructs_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntPre6780AccountsDestructsRequest.address:type_name -> cbt.StringFilter + 6, // 1: cbt.ListIntPre6780AccountsDestructsRequest.block_number:type_name -> cbt.UInt32Filter + 5, // 2: cbt.ListIntPre6780AccountsDestructsRequest.transaction_hash:type_name -> cbt.StringFilter + 7, // 3: cbt.ListIntPre6780AccountsDestructsRequest.transaction_index:type_name -> cbt.UInt64Filter + 0, // 4: cbt.ListIntPre6780AccountsDestructsResponse.int_pre_6780_accounts_destructs:type_name -> cbt.IntPre6780AccountsDestructs + 0, // 5: cbt.GetIntPre6780AccountsDestructsResponse.item:type_name -> cbt.IntPre6780AccountsDestructs + 1, // 6: cbt.IntPre6780AccountsDestructsService.List:input_type -> cbt.ListIntPre6780AccountsDestructsRequest + 3, // 7: cbt.IntPre6780AccountsDestructsService.Get:input_type -> cbt.GetIntPre6780AccountsDestructsRequest + 2, // 8: cbt.IntPre6780AccountsDestructsService.List:output_type -> cbt.ListIntPre6780AccountsDestructsResponse + 4, // 9: cbt.IntPre6780AccountsDestructsService.Get:output_type -> cbt.GetIntPre6780AccountsDestructsResponse + 8, // [8:10] is the sub-list for method output_type + 6, // [6:8] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_int_pre_6780_accounts_destructs_proto_init() } +func file_int_pre_6780_accounts_destructs_proto_init() { + if File_int_pre_6780_accounts_destructs_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_pre_6780_accounts_destructs_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntPre6780AccountsDestructs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_pre_6780_accounts_destructs_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntPre6780AccountsDestructsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_pre_6780_accounts_destructs_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntPre6780AccountsDestructsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_pre_6780_accounts_destructs_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntPre6780AccountsDestructsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_pre_6780_accounts_destructs_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntPre6780AccountsDestructsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_pre_6780_accounts_destructs_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_pre_6780_accounts_destructs_proto_goTypes, + DependencyIndexes: file_int_pre_6780_accounts_destructs_proto_depIdxs, + MessageInfos: file_int_pre_6780_accounts_destructs_proto_msgTypes, + }.Build() + File_int_pre_6780_accounts_destructs_proto = out.File + file_int_pre_6780_accounts_destructs_proto_rawDesc = nil + file_int_pre_6780_accounts_destructs_proto_goTypes = nil + file_int_pre_6780_accounts_destructs_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.proto b/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.proto new file mode 100644 index 00000000..5d743ebc --- /dev/null +++ b/pkg/proto/clickhouse/int_pre_6780_accounts_destructs.proto @@ -0,0 +1,74 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table for accounts self-destructs data pre-6780 (Dencun fork) + +message IntPre6780AccountsDestructs { + // The address of the account + string address = 11; + // The block number of the self-destructs + uint32 block_number = 12; + // The transaction hash + string transaction_hash = 13; + // The transaction index + uint64 transaction_index = 14; +} + +// Request for listing int_pre_6780_accounts_destructs records +message ListIntPre6780AccountsDestructsRequest { + // Filter by address - The address of the account (PRIMARY KEY - required) + StringFilter address = 1; + + // Filter by block_number - The block number of the self-destructs (ORDER BY column 2 - optional) + UInt32Filter block_number = 2; + + // Filter by transaction_hash - The transaction hash (ORDER BY column 3 - optional) + StringFilter transaction_hash = 3; + + // Filter by transaction_index - The transaction index (optional) + UInt64Filter transaction_index = 4; + + // The maximum number of int_pre_6780_accounts_destructs to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 5; + // A page token, received from a previous `ListIntPre6780AccountsDestructs` call. + // Provide this to retrieve the subsequent page. + string page_token = 6; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 7; +} + +// Response for listing int_pre_6780_accounts_destructs records +message ListIntPre6780AccountsDestructsResponse { + // The list of int_pre_6780_accounts_destructs. + repeated IntPre6780AccountsDestructs int_pre_6780_accounts_destructs = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_pre_6780_accounts_destructs record by primary key +message GetIntPre6780AccountsDestructsRequest { + // The address of the account + string address = 1; // Primary key (required) +} + +// Response for getting a single int_pre_6780_accounts_destructs record +message GetIntPre6780AccountsDestructsResponse { + IntPre6780AccountsDestructs item = 1; +} + +// Query int_pre_6780_accounts_destructs data +service IntPre6780AccountsDestructsService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntPre6780AccountsDestructsRequest) returns (ListIntPre6780AccountsDestructsResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntPre6780AccountsDestructsRequest) returns (GetIntPre6780AccountsDestructsResponse); +} From 94c074cc7923088649c91270653e983e7d446e61 Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 27 Oct 2025 18:24:33 +0800 Subject: [PATCH 13/18] refactor: update fact tables --- .../fct_address_access_total.sql | 20 +++++++++++++------ ...orage_slot_expired_top_100_by_contract.sql | 1 + ...dress_storage_slot_top_100_by_contract.sql | 1 + .../fct_address_storage_slot_total.sql | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/models/transformations/fct_address_access_total.sql b/models/transformations/fct_address_access_total.sql index 7472ffd7..da4f6760 100644 --- a/models/transformations/fct_address_access_total.sql +++ b/models/transformations/fct_address_access_total.sql @@ -28,9 +28,15 @@ block_range AS ( AND execution_payload_block_number IS NOT NULL AND slot_start_date_time >= (SELECT slot_start_date_time - INTERVAL 365 DAY FROM latest_block) ), +accounts_alive AS ( + SELECT address + FROM `{{ .self.database }}`.`int_accounts_alive` FINAL + WHERE is_alive = true +), total_contracts AS ( - SELECT COUNT(DISTINCT contract_address) AS count + SELECT COUNT(DISTINCT c.contract_address) AS count FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL + GLOBAL INNER JOIN accounts_alive a ON lower(c.contract_address) = a.address WHERE meta_network_name = '{{ .env.NETWORK }}' ), total_accounts AS ( @@ -40,17 +46,19 @@ total_accounts AS ( expired_accounts AS ( -- Expired accounts (not accessed in last 365 days) SELECT COUNT(*) AS count - FROM {{ index .dep "{{transformation}}" "int_address_last_access" "helpers" "from" }} FINAL - WHERE block_number < (SELECT min_block_number FROM block_range) + FROM {{ index .dep "{{transformation}}" "int_address_last_access" "helpers" "from" }} al FINAL + GLOBAL INNER JOIN accounts_alive a ON a.address = al.address + WHERE al.block_number < (SELECT min_block_number FROM block_range) ), expired_contracts AS ( -- Expired contracts (not accessed in last 365 days) SELECT COUNT(*) AS count FROM {{ index .dep "{{transformation}}" "int_address_last_access" "helpers" "from" }} AS a FINAL GLOBAL INNER JOIN ( - SELECT DISTINCT lower(contract_address) AS contract_address - FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} FINAL - WHERE meta_network_name = '{{ .env.NETWORK }}' + SELECT DISTINCT lower(c.contract_address) AS contract_address + FROM {{ index .dep "{{external}}" "canonical_execution_contracts" "helpers" "from" }} c FINAL + GLOBAL INNER JOIN accounts_alive a ON lower(c.contract_address) = a.address + WHERE meta_network_name = '{{ .env.NETWORK }}' ) AS c ON a.address = c.contract_address WHERE a.block_number < (SELECT min_block_number FROM block_range) diff --git a/models/transformations/fct_address_storage_slot_expired_top_100_by_contract.sql b/models/transformations/fct_address_storage_slot_expired_top_100_by_contract.sql index 54d04949..6730fcab 100644 --- a/models/transformations/fct_address_storage_slot_expired_top_100_by_contract.sql +++ b/models/transformations/fct_address_storage_slot_expired_top_100_by_contract.sql @@ -34,6 +34,7 @@ SELECT count(*) AS expired_slots FROM {{ index .dep "{{transformation}}" "int_address_storage_slot_last_access" "helpers" "from" }} FINAL WHERE block_number < (SELECT min_block_number FROM block_range) + AND value != '0x0000000000000000000000000000000000000000000000000000000000000000' GROUP BY address ORDER BY expired_slots DESC LIMIT 100; diff --git a/models/transformations/fct_address_storage_slot_top_100_by_contract.sql b/models/transformations/fct_address_storage_slot_top_100_by_contract.sql index a1b54980..68e7b404 100644 --- a/models/transformations/fct_address_storage_slot_top_100_by_contract.sql +++ b/models/transformations/fct_address_storage_slot_top_100_by_contract.sql @@ -18,6 +18,7 @@ SELECT address AS contract_address, count(*) AS total_storage_slots FROM {{ index .dep "{{transformation}}" "int_address_storage_slot_last_access" "helpers" "from" }} FINAL +WHERE value != '0x0000000000000000000000000000000000000000000000000000000000000000' GROUP BY address ORDER BY rank ASC LIMIT 100; diff --git a/models/transformations/fct_address_storage_slot_total.sql b/models/transformations/fct_address_storage_slot_total.sql index 498586fc..19faab15 100644 --- a/models/transformations/fct_address_storage_slot_total.sql +++ b/models/transformations/fct_address_storage_slot_total.sql @@ -30,12 +30,14 @@ block_range AS ( total_storage_slots AS ( SELECT COUNT(*) AS count FROM {{ index .dep "{{transformation}}" "int_address_storage_slot_last_access" "helpers" "from" }} FINAL + WHERE value != '0x0000000000000000000000000000000000000000000000000000000000000000' ), expired_storage_slots AS ( -- Expired storage slots (not accessed in last 365 days) SELECT COUNT(*) AS count FROM {{ index .dep "{{transformation}}" "int_address_storage_slot_last_access" "helpers" "from" }} FINAL WHERE block_number < (SELECT min_block_number FROM block_range) + AND value != '0x0000000000000000000000000000000000000000000000000000000000000000' ) SELECT fromUnixTimestamp({{ .task.start }}) as updated_date_time, From 237b0bf1105aa3aefeab76a2fdb4acbd7c6e5a55 Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 10 Nov 2025 12:24:13 +0800 Subject: [PATCH 14/18] chore --- ...on_accounts_v2.down.sql => 030_execution_accounts_v2.down.sql} | 0 ...cution_accounts_v2.up.sql => 030_execution_accounts_v2.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename migrations/{025_execution_accounts_v2.down.sql => 030_execution_accounts_v2.down.sql} (100%) rename migrations/{025_execution_accounts_v2.up.sql => 030_execution_accounts_v2.up.sql} (100%) diff --git a/migrations/025_execution_accounts_v2.down.sql b/migrations/030_execution_accounts_v2.down.sql similarity index 100% rename from migrations/025_execution_accounts_v2.down.sql rename to migrations/030_execution_accounts_v2.down.sql diff --git a/migrations/025_execution_accounts_v2.up.sql b/migrations/030_execution_accounts_v2.up.sql similarity index 100% rename from migrations/025_execution_accounts_v2.up.sql rename to migrations/030_execution_accounts_v2.up.sql From 4907c49157c4b26dcc55eecb066098fa1c6be804 Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 10 Nov 2025 13:54:08 +0800 Subject: [PATCH 15/18] feat: add address_slots_stat_per_block and block_slots_stat --- ...sql => 032_execution_accounts_v2.down.sql} | 6 +- ...p.sql => 032_execution_accounts_v2.up.sql} | 39 +++++++++++++ .../int_address_slots_stat_per_block.sql | 58 +++++++++++++++++++ .../transformations/int_block_slots_stat.sql | 27 +++++++++ 4 files changed, 129 insertions(+), 1 deletion(-) rename migrations/{030_execution_accounts_v2.down.sql => 032_execution_accounts_v2.down.sql} (68%) rename migrations/{030_execution_accounts_v2.up.sql => 032_execution_accounts_v2.up.sql} (68%) create mode 100644 models/transformations/int_address_slots_stat_per_block.sql create mode 100644 models/transformations/int_block_slots_stat.sql diff --git a/migrations/030_execution_accounts_v2.down.sql b/migrations/032_execution_accounts_v2.down.sql similarity index 68% rename from migrations/030_execution_accounts_v2.down.sql rename to migrations/032_execution_accounts_v2.down.sql index 849f4962..a00ff888 100644 --- a/migrations/030_execution_accounts_v2.down.sql +++ b/migrations/032_execution_accounts_v2.down.sql @@ -7,4 +7,8 @@ DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_pre_6780_accounts_destructs_local ON DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_post_6780_accounts_destructs ON CLUSTER '{cluster}' SYNC; DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_post_6780_accounts_destructs_local ON CLUSTER '{cluster}' SYNC; DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_accounts_alive ON CLUSTER '{cluster}' SYNC; -DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_accounts_alive_local ON CLUSTER '{cluster}' SYNC; \ No newline at end of file +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_accounts_alive_local ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_slots_stat_per_block ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_address_slots_stat_per_block_local ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_block_slots_stat ON CLUSTER '{cluster}' SYNC; +DROP TABLE IF EXISTS `${NETWORK_NAME}`.int_block_slots_stat_local ON CLUSTER '{cluster}' SYNC; \ No newline at end of file diff --git a/migrations/030_execution_accounts_v2.up.sql b/migrations/032_execution_accounts_v2.up.sql similarity index 68% rename from migrations/030_execution_accounts_v2.up.sql rename to migrations/032_execution_accounts_v2.up.sql index f191009c..4a45d702 100644 --- a/migrations/030_execution_accounts_v2.up.sql +++ b/migrations/032_execution_accounts_v2.up.sql @@ -91,4 +91,43 @@ CREATE TABLE `${NETWORK_NAME}`.int_accounts_alive ON CLUSTER '{cluster}' AS `${N `${NETWORK_NAME}`, int_accounts_alive_local, cityHash64(`address`) +); + +CREATE TABLE `${NETWORK_NAME}`.int_address_slots_stat_per_block_local on cluster '{cluster}' ( + `address` String COMMENT 'The address of the account' CODEC(ZSTD(1)), + `block_number` UInt32 COMMENT 'The block number' CODEC(ZSTD(1)), + `slots_cleared` UInt16 COMMENT 'The number of slots cleared' CODEC(ZSTD(1)), + `slots_set` UInt16 COMMENT 'The number of slots set' CODEC(ZSTD(1)), + `net_slots` Int32 DEFAULT slots_set - slots_cleared COMMENT 'The net number of slots' CODEC(ZSTD(1)), + `net_slots_bytes` Int32 DEFAULT (slots_set - slots_cleared) * 64 COMMENT 'The net number of raw slot bytes (slot key + value)' CODEC(ZSTD(1)), +) ENGINE = ReplicatedMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}' +) PARTITION BY cityHash64(`address`) % 16 +ORDER BY (address, block_number) COMMENT 'Table that states the stats of the slots for an account per block'; + +CREATE TABLE `${NETWORK_NAME}`.int_address_slots_stat_per_block ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_address_slots_stat_per_block_local ENGINE = Distributed( + '{cluster}', + `${NETWORK_NAME}`, + int_address_slots_stat_per_block_local, + cityHash64(`address`) +); + +CREATE TABLE `${NETWORK_NAME}`.int_block_slots_stat_local on cluster '{cluster}' ( + `block_number` UInt32 COMMENT 'The block number' CODEC(ZSTD(1)), + `slots_cleared` UInt16 COMMENT 'The number of slots cleared' CODEC(ZSTD(1)), + `slots_set` UInt16 COMMENT 'The number of slots set' CODEC(ZSTD(1)), + `net_slots` Int32 DEFAULT slots_set - slots_cleared COMMENT 'The net number of slots' CODEC(ZSTD(1)), + `net_slots_bytes` Int32 DEFAULT (slots_set - slots_cleared) * 64 COMMENT 'The net number of raw slot bytes (slot key + value)' CODEC(ZSTD(1)), +) ENGINE = ReplicatedMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}' +) PARTITION BY intDiv(block_number, 5000000) +ORDER BY (block_number) COMMENT 'Table that states the stats of the slots per block'; + +CREATE TABLE `${NETWORK_NAME}`.int_block_slots_stat ON CLUSTER '{cluster}' AS `${NETWORK_NAME}`.int_block_slots_stat_local ENGINE = Distributed( + '{cluster}', + `${NETWORK_NAME}`, + int_block_slots_stat_local, + rand() ); \ No newline at end of file diff --git a/models/transformations/int_address_slots_stat_per_block.sql b/models/transformations/int_address_slots_stat_per_block.sql new file mode 100644 index 00000000..f7649da8 --- /dev/null +++ b/models/transformations/int_address_slots_stat_per_block.sql @@ -0,0 +1,58 @@ +--- +table: int_address_slots_stat_per_block +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - address + - storage + - slots +dependencies: + - "{{external}}.canonical_execution_transaction" + - "{{external}}.canonical_execution_storage_diffs" +--- +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +WITH +get_tx_success AS ( + SELECT lower(transaction_hash) AS transaction_hash + FROM {{ index .dep "{{external}}" "canonical_execution_transaction" "helpers" "from" }} FINAL + WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND success = true + AND meta_network_name = '{{ .env.NETWORK }}' +), +storage_changes AS ( + SELECT + lower(sd.address) AS address, + sd.block_number, + sd.from_value, + sd.to_value + FROM {{ index .dep "{{external}}" "canonical_execution_storage_diffs" "helpers" "from" }} sd FINAL + GLOBAL JOIN get_tx_success g + ON lower(sd.transaction_hash) = g.transaction_hash + WHERE sd.block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} + AND sd.meta_network_name = '{{ .env.NETWORK }}' +), +address_slot_stats AS ( + SELECT + address, + block_number, + countIf(from_value != '0x0000000000000000000000000000000000000000000000000000000000000000' + AND to_value = '0x0000000000000000000000000000000000000000000000000000000000000000') AS slots_cleared, + countIf(from_value = '0x0000000000000000000000000000000000000000000000000000000000000000' + AND to_value != '0x0000000000000000000000000000000000000000000000000000000000000000') AS slots_set + FROM storage_changes + GROUP BY address, block_number +) +SELECT + address, + block_number, + slots_cleared, + slots_set, + NULL AS net_slots, + NULL AS net_slots_bytes +FROM address_slot_stats; diff --git a/models/transformations/int_block_slots_stat.sql b/models/transformations/int_block_slots_stat.sql new file mode 100644 index 00000000..39e369fe --- /dev/null +++ b/models/transformations/int_block_slots_stat.sql @@ -0,0 +1,27 @@ +--- +table: int_block_slots_stat +type: incremental +interval: + type: block + max: 10000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - storage + - slots + - block +dependencies: + - "{{transformation}}.int_address_slots_stat_per_block" +--- +INSERT INTO + `{{ .self.database }}`.`{{ .self.table }}` +SELECT + block_number, + sum(slots_cleared) AS slots_cleared, + sum(slots_set) AS slots_set, + NULL AS net_slots, + NULL AS net_slots_bytes +FROM {{ index .dep "{{transformation}}" "int_address_slots_stat_per_block" "helpers" "from" }} +WHERE block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +GROUP BY block_number; From 689fa10f826f8f59c9c1c14e0edebf9e1ddcdcd9 Mon Sep 17 00:00:00 2001 From: weiihann Date: Mon, 10 Nov 2025 14:16:20 +0800 Subject: [PATCH 16/18] chore: add protobuf files --- .../int_address_slots_stat_per_block.go | 260 ++++++++ .../int_address_slots_stat_per_block.pb.go | 618 ++++++++++++++++++ .../int_address_slots_stat_per_block.proto | 81 +++ pkg/proto/clickhouse/int_block_slots_stat.go | 230 +++++++ .../clickhouse/int_block_slots_stat.pb.go | 585 +++++++++++++++++ .../clickhouse/int_block_slots_stat.proto | 76 +++ 6 files changed, 1850 insertions(+) create mode 100644 pkg/proto/clickhouse/int_address_slots_stat_per_block.go create mode 100644 pkg/proto/clickhouse/int_address_slots_stat_per_block.pb.go create mode 100644 pkg/proto/clickhouse/int_address_slots_stat_per_block.proto create mode 100644 pkg/proto/clickhouse/int_block_slots_stat.go create mode 100644 pkg/proto/clickhouse/int_block_slots_stat.pb.go create mode 100644 pkg/proto/clickhouse/int_block_slots_stat.proto diff --git a/pkg/proto/clickhouse/int_address_slots_stat_per_block.go b/pkg/proto/clickhouse/int_address_slots_stat_per_block.go new file mode 100644 index 00000000..b430b900 --- /dev/null +++ b/pkg/proto/clickhouse/int_address_slots_stat_per_block.go @@ -0,0 +1,260 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_address_slots_stat_per_block + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntAddressSlotsStatPerBlockQuery constructs a parameterized SQL query from a ListIntAddressSlotsStatPerBlockRequest +func BuildListIntAddressSlotsStatPerBlockQuery(req *ListIntAddressSlotsStatPerBlockRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Address == nil { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Address.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("address", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("address", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("address", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("address", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("address", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("address", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("address", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("address", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("address", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: block_number + if req.BlockNumber != nil { + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: slots_cleared + if req.SlotsCleared != nil { + switch filter := req.SlotsCleared.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("slots_cleared", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("slots_cleared", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("slots_cleared", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("slots_cleared", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("slots_cleared", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("slots_cleared", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("slots_cleared", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("slots_cleared", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("slots_cleared", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: slots_set + if req.SlotsSet != nil { + switch filter := req.SlotsSet.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("slots_set", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("slots_set", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("slots_set", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("slots_set", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("slots_set", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("slots_set", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("slots_set", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("slots_set", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("slots_set", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: net_slots + if req.NetSlots != nil { + switch filter := req.NetSlots.Filter.(type) { + case *Int32Filter_Eq: + qb.AddCondition("net_slots", "=", filter.Eq) + case *Int32Filter_Ne: + qb.AddCondition("net_slots", "!=", filter.Ne) + case *Int32Filter_Lt: + qb.AddCondition("net_slots", "<", filter.Lt) + case *Int32Filter_Lte: + qb.AddCondition("net_slots", "<=", filter.Lte) + case *Int32Filter_Gt: + qb.AddCondition("net_slots", ">", filter.Gt) + case *Int32Filter_Gte: + qb.AddCondition("net_slots", ">=", filter.Gte) + case *Int32Filter_Between: + qb.AddBetweenCondition("net_slots", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("net_slots", Int32SliceToInterface(filter.In.Values)) + } + case *Int32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("net_slots", Int32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: net_slots_bytes + if req.NetSlotsBytes != nil { + switch filter := req.NetSlotsBytes.Filter.(type) { + case *Int32Filter_Eq: + qb.AddCondition("net_slots_bytes", "=", filter.Eq) + case *Int32Filter_Ne: + qb.AddCondition("net_slots_bytes", "!=", filter.Ne) + case *Int32Filter_Lt: + qb.AddCondition("net_slots_bytes", "<", filter.Lt) + case *Int32Filter_Lte: + qb.AddCondition("net_slots_bytes", "<=", filter.Lte) + case *Int32Filter_Gt: + qb.AddCondition("net_slots_bytes", ">", filter.Gt) + case *Int32Filter_Gte: + qb.AddCondition("net_slots_bytes", ">=", filter.Gte) + case *Int32Filter_Between: + qb.AddBetweenCondition("net_slots_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("net_slots_bytes", Int32SliceToInterface(filter.In.Values)) + } + case *Int32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("net_slots_bytes", Int32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"address", "block_number", "slots_cleared", "slots_set", "net_slots", "net_slots_bytes"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY address" + ", block_number" + } + + // Build column list + columns := []string{"address", "block_number", "toUInt32(`slots_cleared`) AS `slots_cleared`", "toUInt32(`slots_set`) AS `slots_set`", "net_slots", "net_slots_bytes"} + + return BuildParameterizedQuery("int_address_slots_stat_per_block", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntAddressSlotsStatPerBlockQuery constructs a parameterized SQL query from a GetIntAddressSlotsStatPerBlockRequest +func BuildGetIntAddressSlotsStatPerBlockQuery(req *GetIntAddressSlotsStatPerBlockRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Address == "" { + return SQLQuery{}, fmt.Errorf("primary key field address is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("address", "=", req.Address) + + // Build ORDER BY clause + orderByClause := " ORDER BY address, block_number" + + // Build column list + columns := []string{"address", "block_number", "toUInt32(`slots_cleared`) AS `slots_cleared`", "toUInt32(`slots_set`) AS `slots_set`", "net_slots", "net_slots_bytes"} + + // Return single record + return BuildParameterizedQuery("int_address_slots_stat_per_block", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_address_slots_stat_per_block.pb.go b/pkg/proto/clickhouse/int_address_slots_stat_per_block.pb.go new file mode 100644 index 00000000..8fb5dfa6 --- /dev/null +++ b/pkg/proto/clickhouse/int_address_slots_stat_per_block.pb.go @@ -0,0 +1,618 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_address_slots_stat_per_block.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntAddressSlotsStatPerBlock struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` + // The block number + BlockNumber uint32 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // The number of slots cleared + SlotsCleared uint32 `protobuf:"varint,13,opt,name=slots_cleared,json=slotsCleared,proto3" json:"slots_cleared,omitempty"` + // The number of slots set + SlotsSet uint32 `protobuf:"varint,14,opt,name=slots_set,json=slotsSet,proto3" json:"slots_set,omitempty"` + // The net number of slots + NetSlots int32 `protobuf:"varint,15,opt,name=net_slots,json=netSlots,proto3" json:"net_slots,omitempty"` + // The net number of raw slot bytes (slot key + value) + NetSlotsBytes int32 `protobuf:"varint,16,opt,name=net_slots_bytes,json=netSlotsBytes,proto3" json:"net_slots_bytes,omitempty"` +} + +func (x *IntAddressSlotsStatPerBlock) Reset() { + *x = IntAddressSlotsStatPerBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntAddressSlotsStatPerBlock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntAddressSlotsStatPerBlock) ProtoMessage() {} + +func (x *IntAddressSlotsStatPerBlock) ProtoReflect() protoreflect.Message { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntAddressSlotsStatPerBlock.ProtoReflect.Descriptor instead. +func (*IntAddressSlotsStatPerBlock) Descriptor() ([]byte, []int) { + return file_int_address_slots_stat_per_block_proto_rawDescGZIP(), []int{0} +} + +func (x *IntAddressSlotsStatPerBlock) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *IntAddressSlotsStatPerBlock) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntAddressSlotsStatPerBlock) GetSlotsCleared() uint32 { + if x != nil { + return x.SlotsCleared + } + return 0 +} + +func (x *IntAddressSlotsStatPerBlock) GetSlotsSet() uint32 { + if x != nil { + return x.SlotsSet + } + return 0 +} + +func (x *IntAddressSlotsStatPerBlock) GetNetSlots() int32 { + if x != nil { + return x.NetSlots + } + return 0 +} + +func (x *IntAddressSlotsStatPerBlock) GetNetSlotsBytes() int32 { + if x != nil { + return x.NetSlotsBytes + } + return 0 +} + +// Request for listing int_address_slots_stat_per_block records +type ListIntAddressSlotsStatPerBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by address - The address of the account (PRIMARY KEY - required) + Address *StringFilter `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Filter by block_number - The block number (ORDER BY column 2 - optional) + BlockNumber *UInt32Filter `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by slots_cleared - The number of slots cleared (optional) + SlotsCleared *UInt32Filter `protobuf:"bytes,3,opt,name=slots_cleared,json=slotsCleared,proto3" json:"slots_cleared,omitempty"` + // Filter by slots_set - The number of slots set (optional) + SlotsSet *UInt32Filter `protobuf:"bytes,4,opt,name=slots_set,json=slotsSet,proto3" json:"slots_set,omitempty"` + // Filter by net_slots - The net number of slots (optional) + NetSlots *Int32Filter `protobuf:"bytes,5,opt,name=net_slots,json=netSlots,proto3" json:"net_slots,omitempty"` + // Filter by net_slots_bytes - The net number of raw slot bytes (slot key + value) (optional) + NetSlotsBytes *Int32Filter `protobuf:"bytes,6,opt,name=net_slots_bytes,json=netSlotsBytes,proto3" json:"net_slots_bytes,omitempty"` + // The maximum number of int_address_slots_stat_per_block to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,7,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntAddressSlotsStatPerBlock` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,8,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,9,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) Reset() { + *x = ListIntAddressSlotsStatPerBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAddressSlotsStatPerBlockRequest) ProtoMessage() {} + +func (x *ListIntAddressSlotsStatPerBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAddressSlotsStatPerBlockRequest.ProtoReflect.Descriptor instead. +func (*ListIntAddressSlotsStatPerBlockRequest) Descriptor() ([]byte, []int) { + return file_int_address_slots_stat_per_block_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetAddress() *StringFilter { + if x != nil { + return x.Address + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetSlotsCleared() *UInt32Filter { + if x != nil { + return x.SlotsCleared + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetSlotsSet() *UInt32Filter { + if x != nil { + return x.SlotsSet + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetNetSlots() *Int32Filter { + if x != nil { + return x.NetSlots + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetNetSlotsBytes() *Int32Filter { + if x != nil { + return x.NetSlotsBytes + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntAddressSlotsStatPerBlockRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_address_slots_stat_per_block records +type ListIntAddressSlotsStatPerBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_address_slots_stat_per_block. + IntAddressSlotsStatPerBlock []*IntAddressSlotsStatPerBlock `protobuf:"bytes,1,rep,name=int_address_slots_stat_per_block,json=intAddressSlotsStatPerBlock,proto3" json:"int_address_slots_stat_per_block,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntAddressSlotsStatPerBlockResponse) Reset() { + *x = ListIntAddressSlotsStatPerBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntAddressSlotsStatPerBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntAddressSlotsStatPerBlockResponse) ProtoMessage() {} + +func (x *ListIntAddressSlotsStatPerBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntAddressSlotsStatPerBlockResponse.ProtoReflect.Descriptor instead. +func (*ListIntAddressSlotsStatPerBlockResponse) Descriptor() ([]byte, []int) { + return file_int_address_slots_stat_per_block_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntAddressSlotsStatPerBlockResponse) GetIntAddressSlotsStatPerBlock() []*IntAddressSlotsStatPerBlock { + if x != nil { + return x.IntAddressSlotsStatPerBlock + } + return nil +} + +func (x *ListIntAddressSlotsStatPerBlockResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_address_slots_stat_per_block record by primary key +type GetIntAddressSlotsStatPerBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The address of the account + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Primary key (required) +} + +func (x *GetIntAddressSlotsStatPerBlockRequest) Reset() { + *x = GetIntAddressSlotsStatPerBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAddressSlotsStatPerBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAddressSlotsStatPerBlockRequest) ProtoMessage() {} + +func (x *GetIntAddressSlotsStatPerBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAddressSlotsStatPerBlockRequest.ProtoReflect.Descriptor instead. +func (*GetIntAddressSlotsStatPerBlockRequest) Descriptor() ([]byte, []int) { + return file_int_address_slots_stat_per_block_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntAddressSlotsStatPerBlockRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// Response for getting a single int_address_slots_stat_per_block record +type GetIntAddressSlotsStatPerBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntAddressSlotsStatPerBlock `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntAddressSlotsStatPerBlockResponse) Reset() { + *x = GetIntAddressSlotsStatPerBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntAddressSlotsStatPerBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntAddressSlotsStatPerBlockResponse) ProtoMessage() {} + +func (x *GetIntAddressSlotsStatPerBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_address_slots_stat_per_block_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntAddressSlotsStatPerBlockResponse.ProtoReflect.Descriptor instead. +func (*GetIntAddressSlotsStatPerBlockResponse) Descriptor() ([]byte, []int) { + return file_int_address_slots_stat_per_block_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntAddressSlotsStatPerBlockResponse) GetItem() *IntAddressSlotsStatPerBlock { + if x != nil { + return x.Item + } + return nil +} + +var File_int_address_slots_stat_per_block_proto protoreflect.FileDescriptor + +var file_int_address_slots_stat_per_block_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x6c, + 0x6f, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x01, 0x0a, 0x1b, + 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, + 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6c, 0x6f, 0x74, + 0x73, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0c, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, + 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6e, + 0x65, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x73, + 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, + 0xb3, 0x03, 0x0a, 0x26, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x36, 0x0a, + 0x0d, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, + 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0c, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x43, 0x6c, + 0x65, 0x61, 0x72, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x09, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x73, + 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, + 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x08, 0x73, 0x6c, 0x6f, + 0x74, 0x73, 0x53, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x09, 0x6e, 0x65, 0x74, 0x5f, 0x73, 0x6c, 0x6f, + 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, + 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x53, + 0x6c, 0x6f, 0x74, 0x73, 0x12, 0x38, 0x0a, 0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, + 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, + 0x0d, 0x6e, 0x65, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0xba, 0x01, 0x0a, 0x27, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, + 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x67, 0x0a, 0x20, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x5f, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, + 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x1b, 0x69, + 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x41, 0x0a, 0x25, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x5e, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, + 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x34, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, + 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xe7, 0x01, 0x0a, 0x22, 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, + 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, + 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x5e, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x2a, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x49, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, + 0x74, 0x61, 0x74, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x50, + 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, + 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, + 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, + 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_int_address_slots_stat_per_block_proto_rawDescOnce sync.Once + file_int_address_slots_stat_per_block_proto_rawDescData = file_int_address_slots_stat_per_block_proto_rawDesc +) + +func file_int_address_slots_stat_per_block_proto_rawDescGZIP() []byte { + file_int_address_slots_stat_per_block_proto_rawDescOnce.Do(func() { + file_int_address_slots_stat_per_block_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_address_slots_stat_per_block_proto_rawDescData) + }) + return file_int_address_slots_stat_per_block_proto_rawDescData +} + +var file_int_address_slots_stat_per_block_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_address_slots_stat_per_block_proto_goTypes = []any{ + (*IntAddressSlotsStatPerBlock)(nil), // 0: cbt.IntAddressSlotsStatPerBlock + (*ListIntAddressSlotsStatPerBlockRequest)(nil), // 1: cbt.ListIntAddressSlotsStatPerBlockRequest + (*ListIntAddressSlotsStatPerBlockResponse)(nil), // 2: cbt.ListIntAddressSlotsStatPerBlockResponse + (*GetIntAddressSlotsStatPerBlockRequest)(nil), // 3: cbt.GetIntAddressSlotsStatPerBlockRequest + (*GetIntAddressSlotsStatPerBlockResponse)(nil), // 4: cbt.GetIntAddressSlotsStatPerBlockResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter + (*Int32Filter)(nil), // 7: cbt.Int32Filter +} +var file_int_address_slots_stat_per_block_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntAddressSlotsStatPerBlockRequest.address:type_name -> cbt.StringFilter + 6, // 1: cbt.ListIntAddressSlotsStatPerBlockRequest.block_number:type_name -> cbt.UInt32Filter + 6, // 2: cbt.ListIntAddressSlotsStatPerBlockRequest.slots_cleared:type_name -> cbt.UInt32Filter + 6, // 3: cbt.ListIntAddressSlotsStatPerBlockRequest.slots_set:type_name -> cbt.UInt32Filter + 7, // 4: cbt.ListIntAddressSlotsStatPerBlockRequest.net_slots:type_name -> cbt.Int32Filter + 7, // 5: cbt.ListIntAddressSlotsStatPerBlockRequest.net_slots_bytes:type_name -> cbt.Int32Filter + 0, // 6: cbt.ListIntAddressSlotsStatPerBlockResponse.int_address_slots_stat_per_block:type_name -> cbt.IntAddressSlotsStatPerBlock + 0, // 7: cbt.GetIntAddressSlotsStatPerBlockResponse.item:type_name -> cbt.IntAddressSlotsStatPerBlock + 1, // 8: cbt.IntAddressSlotsStatPerBlockService.List:input_type -> cbt.ListIntAddressSlotsStatPerBlockRequest + 3, // 9: cbt.IntAddressSlotsStatPerBlockService.Get:input_type -> cbt.GetIntAddressSlotsStatPerBlockRequest + 2, // 10: cbt.IntAddressSlotsStatPerBlockService.List:output_type -> cbt.ListIntAddressSlotsStatPerBlockResponse + 4, // 11: cbt.IntAddressSlotsStatPerBlockService.Get:output_type -> cbt.GetIntAddressSlotsStatPerBlockResponse + 10, // [10:12] is the sub-list for method output_type + 8, // [8:10] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_int_address_slots_stat_per_block_proto_init() } +func file_int_address_slots_stat_per_block_proto_init() { + if File_int_address_slots_stat_per_block_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_address_slots_stat_per_block_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntAddressSlotsStatPerBlock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_slots_stat_per_block_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAddressSlotsStatPerBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_slots_stat_per_block_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntAddressSlotsStatPerBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_slots_stat_per_block_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAddressSlotsStatPerBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_address_slots_stat_per_block_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntAddressSlotsStatPerBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_address_slots_stat_per_block_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_address_slots_stat_per_block_proto_goTypes, + DependencyIndexes: file_int_address_slots_stat_per_block_proto_depIdxs, + MessageInfos: file_int_address_slots_stat_per_block_proto_msgTypes, + }.Build() + File_int_address_slots_stat_per_block_proto = out.File + file_int_address_slots_stat_per_block_proto_rawDesc = nil + file_int_address_slots_stat_per_block_proto_goTypes = nil + file_int_address_slots_stat_per_block_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_address_slots_stat_per_block.proto b/pkg/proto/clickhouse/int_address_slots_stat_per_block.proto new file mode 100644 index 00000000..b1a69170 --- /dev/null +++ b/pkg/proto/clickhouse/int_address_slots_stat_per_block.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table that states the stats of the slots for an account per block + +message IntAddressSlotsStatPerBlock { + // The address of the account + string address = 11; + // The block number + uint32 block_number = 12; + // The number of slots cleared + uint32 slots_cleared = 13; + // The number of slots set + uint32 slots_set = 14; + // The net number of slots + int32 net_slots = 15; + // The net number of raw slot bytes (slot key + value) + int32 net_slots_bytes = 16; +} + +// Request for listing int_address_slots_stat_per_block records +message ListIntAddressSlotsStatPerBlockRequest { + // Filter by address - The address of the account (PRIMARY KEY - required) + StringFilter address = 1; + + // Filter by block_number - The block number (ORDER BY column 2 - optional) + UInt32Filter block_number = 2; + + // Filter by slots_cleared - The number of slots cleared (optional) + UInt32Filter slots_cleared = 3; + // Filter by slots_set - The number of slots set (optional) + UInt32Filter slots_set = 4; + // Filter by net_slots - The net number of slots (optional) + Int32Filter net_slots = 5; + // Filter by net_slots_bytes - The net number of raw slot bytes (slot key + value) (optional) + Int32Filter net_slots_bytes = 6; + + // The maximum number of int_address_slots_stat_per_block to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 7; + // A page token, received from a previous `ListIntAddressSlotsStatPerBlock` call. + // Provide this to retrieve the subsequent page. + string page_token = 8; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 9; +} + +// Response for listing int_address_slots_stat_per_block records +message ListIntAddressSlotsStatPerBlockResponse { + // The list of int_address_slots_stat_per_block. + repeated IntAddressSlotsStatPerBlock int_address_slots_stat_per_block = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_address_slots_stat_per_block record by primary key +message GetIntAddressSlotsStatPerBlockRequest { + // The address of the account + string address = 1; // Primary key (required) +} + +// Response for getting a single int_address_slots_stat_per_block record +message GetIntAddressSlotsStatPerBlockResponse { + IntAddressSlotsStatPerBlock item = 1; +} + +// Query int_address_slots_stat_per_block data +service IntAddressSlotsStatPerBlockService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntAddressSlotsStatPerBlockRequest) returns (ListIntAddressSlotsStatPerBlockResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntAddressSlotsStatPerBlockRequest) returns (GetIntAddressSlotsStatPerBlockResponse); +} diff --git a/pkg/proto/clickhouse/int_block_slots_stat.go b/pkg/proto/clickhouse/int_block_slots_stat.go new file mode 100644 index 00000000..ffd59524 --- /dev/null +++ b/pkg/proto/clickhouse/int_block_slots_stat.go @@ -0,0 +1,230 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for int_block_slots_stat + +package clickhouse + +import ( + "fmt" +) + +// BuildListIntBlockSlotsStatQuery constructs a parameterized SQL query from a ListIntBlockSlotsStatRequest +func BuildListIntBlockSlotsStatQuery(req *ListIntBlockSlotsStatRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.BlockNumber == nil { + return SQLQuery{}, fmt.Errorf("primary key field block_number is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.BlockNumber.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("block_number", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("block_number", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("block_number", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("block_number", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("block_number", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("block_number", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("block_number", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("block_number", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: slots_cleared + if req.SlotsCleared != nil { + switch filter := req.SlotsCleared.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("slots_cleared", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("slots_cleared", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("slots_cleared", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("slots_cleared", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("slots_cleared", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("slots_cleared", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("slots_cleared", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("slots_cleared", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("slots_cleared", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: slots_set + if req.SlotsSet != nil { + switch filter := req.SlotsSet.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("slots_set", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("slots_set", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("slots_set", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("slots_set", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("slots_set", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("slots_set", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("slots_set", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("slots_set", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("slots_set", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: net_slots + if req.NetSlots != nil { + switch filter := req.NetSlots.Filter.(type) { + case *Int32Filter_Eq: + qb.AddCondition("net_slots", "=", filter.Eq) + case *Int32Filter_Ne: + qb.AddCondition("net_slots", "!=", filter.Ne) + case *Int32Filter_Lt: + qb.AddCondition("net_slots", "<", filter.Lt) + case *Int32Filter_Lte: + qb.AddCondition("net_slots", "<=", filter.Lte) + case *Int32Filter_Gt: + qb.AddCondition("net_slots", ">", filter.Gt) + case *Int32Filter_Gte: + qb.AddCondition("net_slots", ">=", filter.Gte) + case *Int32Filter_Between: + qb.AddBetweenCondition("net_slots", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("net_slots", Int32SliceToInterface(filter.In.Values)) + } + case *Int32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("net_slots", Int32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: net_slots_bytes + if req.NetSlotsBytes != nil { + switch filter := req.NetSlotsBytes.Filter.(type) { + case *Int32Filter_Eq: + qb.AddCondition("net_slots_bytes", "=", filter.Eq) + case *Int32Filter_Ne: + qb.AddCondition("net_slots_bytes", "!=", filter.Ne) + case *Int32Filter_Lt: + qb.AddCondition("net_slots_bytes", "<", filter.Lt) + case *Int32Filter_Lte: + qb.AddCondition("net_slots_bytes", "<=", filter.Lte) + case *Int32Filter_Gt: + qb.AddCondition("net_slots_bytes", ">", filter.Gt) + case *Int32Filter_Gte: + qb.AddCondition("net_slots_bytes", ">=", filter.Gte) + case *Int32Filter_Between: + qb.AddBetweenCondition("net_slots_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("net_slots_bytes", Int32SliceToInterface(filter.In.Values)) + } + case *Int32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("net_slots_bytes", Int32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"block_number", "slots_cleared", "slots_set", "net_slots", "net_slots_bytes"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY block_number" + } + + // Build column list + columns := []string{"block_number", "toUInt32(`slots_cleared`) AS `slots_cleared`", "toUInt32(`slots_set`) AS `slots_set`", "net_slots", "net_slots_bytes"} + + return BuildParameterizedQuery("int_block_slots_stat", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetIntBlockSlotsStatQuery constructs a parameterized SQL query from a GetIntBlockSlotsStatRequest +func BuildGetIntBlockSlotsStatQuery(req *GetIntBlockSlotsStatRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.BlockNumber == 0 { + return SQLQuery{}, fmt.Errorf("primary key field block_number is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("block_number", "=", req.BlockNumber) + + // Build ORDER BY clause + orderByClause := " ORDER BY block_number" + + // Build column list + columns := []string{"block_number", "toUInt32(`slots_cleared`) AS `slots_cleared`", "toUInt32(`slots_set`) AS `slots_set`", "net_slots", "net_slots_bytes"} + + // Return single record + return BuildParameterizedQuery("int_block_slots_stat", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/int_block_slots_stat.pb.go b/pkg/proto/clickhouse/int_block_slots_stat.pb.go new file mode 100644 index 00000000..5d1baa5f --- /dev/null +++ b/pkg/proto/clickhouse/int_block_slots_stat.pb.go @@ -0,0 +1,585 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: int_block_slots_stat.proto + +package clickhouse + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IntBlockSlotsStat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The block number + BlockNumber uint32 `protobuf:"varint,11,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // The number of slots cleared + SlotsCleared uint32 `protobuf:"varint,12,opt,name=slots_cleared,json=slotsCleared,proto3" json:"slots_cleared,omitempty"` + // The number of slots set + SlotsSet uint32 `protobuf:"varint,13,opt,name=slots_set,json=slotsSet,proto3" json:"slots_set,omitempty"` + // The net number of slots + NetSlots int32 `protobuf:"varint,14,opt,name=net_slots,json=netSlots,proto3" json:"net_slots,omitempty"` + // The net number of raw slot bytes (slot key + value) + NetSlotsBytes int32 `protobuf:"varint,15,opt,name=net_slots_bytes,json=netSlotsBytes,proto3" json:"net_slots_bytes,omitempty"` +} + +func (x *IntBlockSlotsStat) Reset() { + *x = IntBlockSlotsStat{} + if protoimpl.UnsafeEnabled { + mi := &file_int_block_slots_stat_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntBlockSlotsStat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntBlockSlotsStat) ProtoMessage() {} + +func (x *IntBlockSlotsStat) ProtoReflect() protoreflect.Message { + mi := &file_int_block_slots_stat_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntBlockSlotsStat.ProtoReflect.Descriptor instead. +func (*IntBlockSlotsStat) Descriptor() ([]byte, []int) { + return file_int_block_slots_stat_proto_rawDescGZIP(), []int{0} +} + +func (x *IntBlockSlotsStat) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *IntBlockSlotsStat) GetSlotsCleared() uint32 { + if x != nil { + return x.SlotsCleared + } + return 0 +} + +func (x *IntBlockSlotsStat) GetSlotsSet() uint32 { + if x != nil { + return x.SlotsSet + } + return 0 +} + +func (x *IntBlockSlotsStat) GetNetSlots() int32 { + if x != nil { + return x.NetSlots + } + return 0 +} + +func (x *IntBlockSlotsStat) GetNetSlotsBytes() int32 { + if x != nil { + return x.NetSlotsBytes + } + return 0 +} + +// Request for listing int_block_slots_stat records +type ListIntBlockSlotsStatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by block_number - The block number (PRIMARY KEY - required) + BlockNumber *UInt32Filter `protobuf:"bytes,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // Filter by slots_cleared - The number of slots cleared (optional) + SlotsCleared *UInt32Filter `protobuf:"bytes,2,opt,name=slots_cleared,json=slotsCleared,proto3" json:"slots_cleared,omitempty"` + // Filter by slots_set - The number of slots set (optional) + SlotsSet *UInt32Filter `protobuf:"bytes,3,opt,name=slots_set,json=slotsSet,proto3" json:"slots_set,omitempty"` + // Filter by net_slots - The net number of slots (optional) + NetSlots *Int32Filter `protobuf:"bytes,4,opt,name=net_slots,json=netSlots,proto3" json:"net_slots,omitempty"` + // Filter by net_slots_bytes - The net number of raw slot bytes (slot key + value) (optional) + NetSlotsBytes *Int32Filter `protobuf:"bytes,5,opt,name=net_slots_bytes,json=netSlotsBytes,proto3" json:"net_slots_bytes,omitempty"` + // The maximum number of int_block_slots_stat to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,6,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListIntBlockSlotsStat` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,7,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,8,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListIntBlockSlotsStatRequest) Reset() { + *x = ListIntBlockSlotsStatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_block_slots_stat_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntBlockSlotsStatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntBlockSlotsStatRequest) ProtoMessage() {} + +func (x *ListIntBlockSlotsStatRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_block_slots_stat_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntBlockSlotsStatRequest.ProtoReflect.Descriptor instead. +func (*ListIntBlockSlotsStatRequest) Descriptor() ([]byte, []int) { + return file_int_block_slots_stat_proto_rawDescGZIP(), []int{1} +} + +func (x *ListIntBlockSlotsStatRequest) GetBlockNumber() *UInt32Filter { + if x != nil { + return x.BlockNumber + } + return nil +} + +func (x *ListIntBlockSlotsStatRequest) GetSlotsCleared() *UInt32Filter { + if x != nil { + return x.SlotsCleared + } + return nil +} + +func (x *ListIntBlockSlotsStatRequest) GetSlotsSet() *UInt32Filter { + if x != nil { + return x.SlotsSet + } + return nil +} + +func (x *ListIntBlockSlotsStatRequest) GetNetSlots() *Int32Filter { + if x != nil { + return x.NetSlots + } + return nil +} + +func (x *ListIntBlockSlotsStatRequest) GetNetSlotsBytes() *Int32Filter { + if x != nil { + return x.NetSlotsBytes + } + return nil +} + +func (x *ListIntBlockSlotsStatRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIntBlockSlotsStatRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListIntBlockSlotsStatRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing int_block_slots_stat records +type ListIntBlockSlotsStatResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of int_block_slots_stat. + IntBlockSlotsStat []*IntBlockSlotsStat `protobuf:"bytes,1,rep,name=int_block_slots_stat,json=intBlockSlotsStat,proto3" json:"int_block_slots_stat,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListIntBlockSlotsStatResponse) Reset() { + *x = ListIntBlockSlotsStatResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_block_slots_stat_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListIntBlockSlotsStatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIntBlockSlotsStatResponse) ProtoMessage() {} + +func (x *ListIntBlockSlotsStatResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_block_slots_stat_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIntBlockSlotsStatResponse.ProtoReflect.Descriptor instead. +func (*ListIntBlockSlotsStatResponse) Descriptor() ([]byte, []int) { + return file_int_block_slots_stat_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIntBlockSlotsStatResponse) GetIntBlockSlotsStat() []*IntBlockSlotsStat { + if x != nil { + return x.IntBlockSlotsStat + } + return nil +} + +func (x *ListIntBlockSlotsStatResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single int_block_slots_stat record by primary key +type GetIntBlockSlotsStatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The block number + BlockNumber uint32 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // Primary key (required) +} + +func (x *GetIntBlockSlotsStatRequest) Reset() { + *x = GetIntBlockSlotsStatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_int_block_slots_stat_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntBlockSlotsStatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntBlockSlotsStatRequest) ProtoMessage() {} + +func (x *GetIntBlockSlotsStatRequest) ProtoReflect() protoreflect.Message { + mi := &file_int_block_slots_stat_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntBlockSlotsStatRequest.ProtoReflect.Descriptor instead. +func (*GetIntBlockSlotsStatRequest) Descriptor() ([]byte, []int) { + return file_int_block_slots_stat_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIntBlockSlotsStatRequest) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +// Response for getting a single int_block_slots_stat record +type GetIntBlockSlotsStatResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *IntBlockSlotsStat `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetIntBlockSlotsStatResponse) Reset() { + *x = GetIntBlockSlotsStatResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_int_block_slots_stat_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetIntBlockSlotsStatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIntBlockSlotsStatResponse) ProtoMessage() {} + +func (x *GetIntBlockSlotsStatResponse) ProtoReflect() protoreflect.Message { + mi := &file_int_block_slots_stat_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIntBlockSlotsStatResponse.ProtoReflect.Descriptor instead. +func (*GetIntBlockSlotsStatResponse) Descriptor() ([]byte, []int) { + return file_int_block_slots_stat_proto_rawDescGZIP(), []int{4} +} + +func (x *GetIntBlockSlotsStatResponse) GetItem() *IntBlockSlotsStat { + if x != nil { + return x.Item + } + return nil +} + +var File_int_block_slots_stat_proto protoreflect.FileDescriptor + +var file_int_block_slots_stat_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x69, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x6c, 0x6f, 0x74, + 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, + 0x74, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xbd, 0x01, 0x0a, 0x11, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, + 0x73, 0x53, 0x74, 0x61, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6c, 0x6f, 0x74, + 0x73, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0c, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, + 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6e, + 0x65, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x73, + 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, + 0xfc, 0x02, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x34, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, + 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x0d, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x0c, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x12, 0x2e, + 0x0a, 0x09, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x65, 0x74, 0x12, 0x2d, + 0x0a, 0x09, 0x6e, 0x65, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x12, 0x38, 0x0a, + 0x0f, 0x6e, 0x65, 0x74, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, + 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0d, 0x6e, 0x65, 0x74, 0x53, 0x6c, 0x6f, + 0x74, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0x90, + 0x01, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, + 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x14, 0x69, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x73, 0x6c, + 0x6f, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, + 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x40, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x22, 0x4a, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, + 0xb5, 0x01, 0x0a, 0x18, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, + 0x73, 0x53, 0x74, 0x61, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, + 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, + 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x03, 0x47, + 0x65, 0x74, 0x12, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x6c, 0x6f, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, + 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_int_block_slots_stat_proto_rawDescOnce sync.Once + file_int_block_slots_stat_proto_rawDescData = file_int_block_slots_stat_proto_rawDesc +) + +func file_int_block_slots_stat_proto_rawDescGZIP() []byte { + file_int_block_slots_stat_proto_rawDescOnce.Do(func() { + file_int_block_slots_stat_proto_rawDescData = protoimpl.X.CompressGZIP(file_int_block_slots_stat_proto_rawDescData) + }) + return file_int_block_slots_stat_proto_rawDescData +} + +var file_int_block_slots_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_int_block_slots_stat_proto_goTypes = []any{ + (*IntBlockSlotsStat)(nil), // 0: cbt.IntBlockSlotsStat + (*ListIntBlockSlotsStatRequest)(nil), // 1: cbt.ListIntBlockSlotsStatRequest + (*ListIntBlockSlotsStatResponse)(nil), // 2: cbt.ListIntBlockSlotsStatResponse + (*GetIntBlockSlotsStatRequest)(nil), // 3: cbt.GetIntBlockSlotsStatRequest + (*GetIntBlockSlotsStatResponse)(nil), // 4: cbt.GetIntBlockSlotsStatResponse + (*UInt32Filter)(nil), // 5: cbt.UInt32Filter + (*Int32Filter)(nil), // 6: cbt.Int32Filter +} +var file_int_block_slots_stat_proto_depIdxs = []int32{ + 5, // 0: cbt.ListIntBlockSlotsStatRequest.block_number:type_name -> cbt.UInt32Filter + 5, // 1: cbt.ListIntBlockSlotsStatRequest.slots_cleared:type_name -> cbt.UInt32Filter + 5, // 2: cbt.ListIntBlockSlotsStatRequest.slots_set:type_name -> cbt.UInt32Filter + 6, // 3: cbt.ListIntBlockSlotsStatRequest.net_slots:type_name -> cbt.Int32Filter + 6, // 4: cbt.ListIntBlockSlotsStatRequest.net_slots_bytes:type_name -> cbt.Int32Filter + 0, // 5: cbt.ListIntBlockSlotsStatResponse.int_block_slots_stat:type_name -> cbt.IntBlockSlotsStat + 0, // 6: cbt.GetIntBlockSlotsStatResponse.item:type_name -> cbt.IntBlockSlotsStat + 1, // 7: cbt.IntBlockSlotsStatService.List:input_type -> cbt.ListIntBlockSlotsStatRequest + 3, // 8: cbt.IntBlockSlotsStatService.Get:input_type -> cbt.GetIntBlockSlotsStatRequest + 2, // 9: cbt.IntBlockSlotsStatService.List:output_type -> cbt.ListIntBlockSlotsStatResponse + 4, // 10: cbt.IntBlockSlotsStatService.Get:output_type -> cbt.GetIntBlockSlotsStatResponse + 9, // [9:11] is the sub-list for method output_type + 7, // [7:9] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_int_block_slots_stat_proto_init() } +func file_int_block_slots_stat_proto_init() { + if File_int_block_slots_stat_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_int_block_slots_stat_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*IntBlockSlotsStat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_block_slots_stat_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListIntBlockSlotsStatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_block_slots_stat_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListIntBlockSlotsStatResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_block_slots_stat_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetIntBlockSlotsStatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_int_block_slots_stat_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetIntBlockSlotsStatResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_int_block_slots_stat_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_int_block_slots_stat_proto_goTypes, + DependencyIndexes: file_int_block_slots_stat_proto_depIdxs, + MessageInfos: file_int_block_slots_stat_proto_msgTypes, + }.Build() + File_int_block_slots_stat_proto = out.File + file_int_block_slots_stat_proto_rawDesc = nil + file_int_block_slots_stat_proto_goTypes = nil + file_int_block_slots_stat_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/int_block_slots_stat.proto b/pkg/proto/clickhouse/int_block_slots_stat.proto new file mode 100644 index 00000000..8330c578 --- /dev/null +++ b/pkg/proto/clickhouse/int_block_slots_stat.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Table that states the stats of the slots per block + +message IntBlockSlotsStat { + // The block number + uint32 block_number = 11; + // The number of slots cleared + uint32 slots_cleared = 12; + // The number of slots set + uint32 slots_set = 13; + // The net number of slots + int32 net_slots = 14; + // The net number of raw slot bytes (slot key + value) + int32 net_slots_bytes = 15; +} + +// Request for listing int_block_slots_stat records +message ListIntBlockSlotsStatRequest { + // Filter by block_number - The block number (PRIMARY KEY - required) + UInt32Filter block_number = 1; + + // Filter by slots_cleared - The number of slots cleared (optional) + UInt32Filter slots_cleared = 2; + // Filter by slots_set - The number of slots set (optional) + UInt32Filter slots_set = 3; + // Filter by net_slots - The net number of slots (optional) + Int32Filter net_slots = 4; + // Filter by net_slots_bytes - The net number of raw slot bytes (slot key + value) (optional) + Int32Filter net_slots_bytes = 5; + + // The maximum number of int_block_slots_stat to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 6; + // A page token, received from a previous `ListIntBlockSlotsStat` call. + // Provide this to retrieve the subsequent page. + string page_token = 7; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 8; +} + +// Response for listing int_block_slots_stat records +message ListIntBlockSlotsStatResponse { + // The list of int_block_slots_stat. + repeated IntBlockSlotsStat int_block_slots_stat = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single int_block_slots_stat record by primary key +message GetIntBlockSlotsStatRequest { + // The block number + uint32 block_number = 1; // Primary key (required) +} + +// Response for getting a single int_block_slots_stat record +message GetIntBlockSlotsStatResponse { + IntBlockSlotsStat item = 1; +} + +// Query int_block_slots_stat data +service IntBlockSlotsStatService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListIntBlockSlotsStatRequest) returns (ListIntBlockSlotsStatResponse); + // Get record | Retrieve a single record by primary key + rpc Get(GetIntBlockSlotsStatRequest) returns (GetIntBlockSlotsStatResponse); +} From c731ab405b4478711bf084325e6b525d52f0a3c5 Mon Sep 17 00:00:00 2001 From: weiihann Date: Thu, 27 Nov 2025 14:10:26 +0800 Subject: [PATCH 17/18] increment --- ...on_accounts_v2.down.sql => 033_execution_accounts_v2.down.sql} | 0 ...cution_accounts_v2.up.sql => 033_execution_accounts_v2.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename migrations/{032_execution_accounts_v2.down.sql => 033_execution_accounts_v2.down.sql} (100%) rename migrations/{032_execution_accounts_v2.up.sql => 033_execution_accounts_v2.up.sql} (100%) diff --git a/migrations/032_execution_accounts_v2.down.sql b/migrations/033_execution_accounts_v2.down.sql similarity index 100% rename from migrations/032_execution_accounts_v2.down.sql rename to migrations/033_execution_accounts_v2.down.sql diff --git a/migrations/032_execution_accounts_v2.up.sql b/migrations/033_execution_accounts_v2.up.sql similarity index 100% rename from migrations/032_execution_accounts_v2.up.sql rename to migrations/033_execution_accounts_v2.up.sql From cd3578fd6f44077469ea95fabe5c0b110ac3f6e8 Mon Sep 17 00:00:00 2001 From: weiihann Date: Fri, 28 Nov 2025 10:09:51 +0800 Subject: [PATCH 18/18] feat: add fact tables for execution_state_size --- migrations/033_execution_accounts_v2.up.sql | 134 ++- models/external/execution_state_size.sql | 25 + .../fct_execution_state_size_daily.sql | 41 + .../fct_execution_state_size_hourly.sql | 48 + .../fct_execution_state_size_monthly.sql | 41 + .../fct_execution_state_size_daily.go | 688 +++++++++++ .../fct_execution_state_size_daily.pb.go | 1001 ++++++++++++++++ .../fct_execution_state_size_daily.proto | 147 +++ .../fct_execution_state_size_hourly.go | 696 ++++++++++++ .../fct_execution_state_size_hourly.pb.go | 1009 +++++++++++++++++ .../fct_execution_state_size_hourly.proto | 147 +++ .../fct_execution_state_size_monthly.go | 688 +++++++++++ .../fct_execution_state_size_monthly.pb.go | 1003 ++++++++++++++++ .../fct_execution_state_size_monthly.proto | 147 +++ 14 files changed, 5814 insertions(+), 1 deletion(-) create mode 100644 models/external/execution_state_size.sql create mode 100644 models/transformations/fct_execution_state_size_daily.sql create mode 100644 models/transformations/fct_execution_state_size_hourly.sql create mode 100644 models/transformations/fct_execution_state_size_monthly.sql create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_daily.go create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_daily.pb.go create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_daily.proto create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_hourly.go create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_hourly.pb.go create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_hourly.proto create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_monthly.go create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_monthly.pb.go create mode 100644 pkg/proto/clickhouse/fct_execution_state_size_monthly.proto diff --git a/migrations/033_execution_accounts_v2.up.sql b/migrations/033_execution_accounts_v2.up.sql index 4a45d702..7332a73a 100644 --- a/migrations/033_execution_accounts_v2.up.sql +++ b/migrations/033_execution_accounts_v2.up.sql @@ -130,4 +130,136 @@ CREATE TABLE `${NETWORK_NAME}`.int_block_slots_stat ON CLUSTER '{cluster}' AS `$ `${NETWORK_NAME}`, int_block_slots_stat_local, rand() -); \ No newline at end of file +); + +CREATE TABLE `${NETWORK_NAME}`.fct_execution_state_size_hourly_local ON CLUSTER '{cluster}' ( + `updated_date_time` DateTime COMMENT 'Timestamp when the record was last updated' CODEC(DoubleDelta, ZSTD(1)), + `hour_start_date_time` DateTime COMMENT 'Start of the hour period' CODEC(DoubleDelta, ZSTD(1)), + `measurement_count` UInt32 COMMENT 'Number of measurements in this hour' CODEC(ZSTD(1)), + + `min_block_number` UInt64 COMMENT 'Minimum block number in this hour' CODEC(DoubleDelta, ZSTD(1)), + `max_block_number` UInt64 COMMENT 'Maximum block number in this hour' CODEC(DoubleDelta, ZSTD(1)), + + `accounts` UInt64 COMMENT 'Total accounts at end of hour' CODEC(ZSTD(1)), + `account_bytes` UInt64 COMMENT 'Account bytes at end of hour' CODEC(ZSTD(1)), + `account_trienodes` UInt64 COMMENT 'Account trie nodes at end of hour' CODEC(ZSTD(1)), + `account_trienode_bytes` UInt64 COMMENT 'Account trie node bytes at end of hour' CODEC(ZSTD(1)), + + `contract_codes` UInt64 COMMENT 'Contract codes at end of hour' CODEC(ZSTD(1)), + `contract_code_bytes` UInt64 COMMENT 'Contract code bytes at end of hour' CODEC(ZSTD(1)), + + `storages` UInt64 COMMENT 'Storage slots at end of hour' CODEC(ZSTD(1)), + `storage_bytes` UInt64 COMMENT 'Storage bytes at end of hour' CODEC(ZSTD(1)), + `storage_trienodes` UInt64 COMMENT 'Storage trie nodes at end of hour' CODEC(ZSTD(1)), + `storage_trienode_bytes` UInt64 COMMENT 'Storage trie node bytes at end of hour' CODEC(ZSTD(1)), + + `accounts_delta` Int64 COMMENT 'Account count change within the hour' CODEC(ZSTD(1)), + `account_bytes_delta` Int64 COMMENT 'Account bytes change within the hour' CODEC(ZSTD(1)), + `storage_bytes_delta` Int64 COMMENT 'Storage bytes change within the hour' CODEC(ZSTD(1)), + `contract_code_bytes_delta` Int64 COMMENT 'Contract code bytes change within the hour' CODEC(ZSTD(1)), + + `total_bytes` UInt64 COMMENT 'Total state size in bytes' CODEC(ZSTD(1)) +) ENGINE = ReplicatedReplacingMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}', + `updated_date_time` +) PARTITION BY toStartOfMonth(hour_start_date_time) +ORDER BY (`hour_start_date_time`) +COMMENT 'Execution layer state size metrics aggregated by hour'; + +CREATE TABLE `${NETWORK_NAME}`.fct_execution_state_size_hourly ON CLUSTER '{cluster}' +AS `${NETWORK_NAME}`.fct_execution_state_size_hourly_local +ENGINE = Distributed( + '{cluster}', + '${NETWORK_NAME}', + fct_execution_state_size_hourly_local, + cityHash64(`hour_start_date_time`) +); + +CREATE TABLE `${NETWORK_NAME}`.fct_execution_state_size_daily_local ON CLUSTER '{cluster}' ( + `updated_date_time` DateTime COMMENT 'Timestamp when the record was last updated' CODEC(DoubleDelta, ZSTD(1)), + `date` Date COMMENT 'Date of the aggregation' CODEC(DoubleDelta, ZSTD(1)), + `hour_count` UInt32 COMMENT 'Number of hours in this day' CODEC(ZSTD(1)), + + `min_block_number` UInt64 COMMENT 'Minimum block number in this day' CODEC(DoubleDelta, ZSTD(1)), + `max_block_number` UInt64 COMMENT 'Maximum block number in this day' CODEC(DoubleDelta, ZSTD(1)), + + `accounts` UInt64 COMMENT 'Total accounts at end of day' CODEC(ZSTD(1)), + `account_bytes` UInt64 COMMENT 'Account bytes at end of day' CODEC(ZSTD(1)), + `account_trienodes` UInt64 COMMENT 'Account trie nodes at end of day' CODEC(ZSTD(1)), + `account_trienode_bytes` UInt64 COMMENT 'Account trie node bytes at end of day' CODEC(ZSTD(1)), + + `contract_codes` UInt64 COMMENT 'Contract codes at end of day' CODEC(ZSTD(1)), + `contract_code_bytes` UInt64 COMMENT 'Contract code bytes at end of day' CODEC(ZSTD(1)), + + `storages` UInt64 COMMENT 'Storage slots at end of day' CODEC(ZSTD(1)), + `storage_bytes` UInt64 COMMENT 'Storage bytes at end of day' CODEC(ZSTD(1)), + `storage_trienodes` UInt64 COMMENT 'Storage trie nodes at end of day' CODEC(ZSTD(1)), + `storage_trienode_bytes` UInt64 COMMENT 'Storage trie node bytes at end of day' CODEC(ZSTD(1)), + + `accounts_delta` Int64 COMMENT 'Account count change within the day' CODEC(ZSTD(1)), + `account_bytes_delta` Int64 COMMENT 'Account bytes change within the day' CODEC(ZSTD(1)), + `storage_bytes_delta` Int64 COMMENT 'Storage bytes change within the day' CODEC(ZSTD(1)), + `contract_code_bytes_delta` Int64 COMMENT 'Contract code bytes change within the day' CODEC(ZSTD(1)), + + `total_bytes` UInt64 COMMENT 'Total state size in bytes' CODEC(ZSTD(1)) +) ENGINE = ReplicatedReplacingMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}', + `updated_date_time` +) PARTITION BY toYYYYMM(date) +ORDER BY (`date`) +COMMENT 'Execution layer state size metrics aggregated by day'; + +CREATE TABLE `${NETWORK_NAME}`.fct_execution_state_size_daily ON CLUSTER '{cluster}' +AS `${NETWORK_NAME}`.fct_execution_state_size_daily_local +ENGINE = Distributed( + '{cluster}', + '${NETWORK_NAME}', + fct_execution_state_size_daily_local, + cityHash64(`date`) +); + +CREATE TABLE `${NETWORK_NAME}`.fct_execution_state_size_monthly_local ON CLUSTER '{cluster}' ( + `updated_date_time` DateTime COMMENT 'Timestamp when the record was last updated' CODEC(DoubleDelta, ZSTD(1)), + `month` Date COMMENT 'First day of the month' CODEC(DoubleDelta, ZSTD(1)), + `day_count` UInt32 COMMENT 'Number of days in this month with data' CODEC(ZSTD(1)), + + `min_block_number` UInt64 COMMENT 'Minimum block number in this month' CODEC(DoubleDelta, ZSTD(1)), + `max_block_number` UInt64 COMMENT 'Maximum block number in this month' CODEC(DoubleDelta, ZSTD(1)), + + `accounts` UInt64 COMMENT 'Total accounts at end of month' CODEC(ZSTD(1)), + `account_bytes` UInt64 COMMENT 'Account bytes at end of month' CODEC(ZSTD(1)), + `account_trienodes` UInt64 COMMENT 'Account trie nodes at end of month' CODEC(ZSTD(1)), + `account_trienode_bytes` UInt64 COMMENT 'Account trie node bytes at end of month' CODEC(ZSTD(1)), + + `contract_codes` UInt64 COMMENT 'Contract codes at end of month' CODEC(ZSTD(1)), + `contract_code_bytes` UInt64 COMMENT 'Contract code bytes at end of month' CODEC(ZSTD(1)), + + `storages` UInt64 COMMENT 'Storage slots at end of month' CODEC(ZSTD(1)), + `storage_bytes` UInt64 COMMENT 'Storage bytes at end of month' CODEC(ZSTD(1)), + `storage_trienodes` UInt64 COMMENT 'Storage trie nodes at end of month' CODEC(ZSTD(1)), + `storage_trienode_bytes` UInt64 COMMENT 'Storage trie node bytes at end of month' CODEC(ZSTD(1)), + + `accounts_delta` Int64 COMMENT 'Account count change within the month' CODEC(ZSTD(1)), + `account_bytes_delta` Int64 COMMENT 'Account bytes change within the month' CODEC(ZSTD(1)), + `storage_bytes_delta` Int64 COMMENT 'Storage bytes change within the month' CODEC(ZSTD(1)), + `contract_code_bytes_delta` Int64 COMMENT 'Contract code bytes change within the month' CODEC(ZSTD(1)), + + `total_bytes` UInt64 COMMENT 'Total state size in bytes' CODEC(ZSTD(1)) +) ENGINE = ReplicatedReplacingMergeTree( + '/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', + '{replica}', + `updated_date_time` +) PARTITION BY toYear(month) +ORDER BY (`month`) +COMMENT 'Execution layer state size metrics aggregated by month'; + +CREATE TABLE `${NETWORK_NAME}`.fct_execution_state_size_monthly ON CLUSTER '{cluster}' +AS `${NETWORK_NAME}`.fct_execution_state_size_monthly_local +ENGINE = Distributed( + '{cluster}', + '${NETWORK_NAME}', + fct_execution_state_size_monthly_local, + cityHash64(`month`) +); diff --git a/models/external/execution_state_size.sql b/models/external/execution_state_size.sql new file mode 100644 index 00000000..dc0eb699 --- /dev/null +++ b/models/external/execution_state_size.sql @@ -0,0 +1,25 @@ +--- +table: canonical_execution_block +cache: + incremental_scan_interval: 1m + full_scan_interval: 24h +interval: + type: block +lag: 384 +--- +SELECT + {{ if .cache.is_incremental_scan }} + '{{ .cache.previous_min }}' as min, + {{ else }} + min(block_number) as min, + {{ end }} + max(block_number) as max +FROM {{ .self.helpers.from }} +WHERE + meta_network_name = '{{ .env.NETWORK }}' + +{{ if .cache.is_incremental_scan }} + AND block_number >= {{ .cache.previous_max }} +{{ else }} + AND block_number > {{ .env.EXTERNAL_MODEL_MIN_BLOCK }} +{{ end }} diff --git a/models/transformations/fct_execution_state_size_daily.sql b/models/transformations/fct_execution_state_size_daily.sql new file mode 100644 index 00000000..a83ba84e --- /dev/null +++ b/models/transformations/fct_execution_state_size_daily.sql @@ -0,0 +1,41 @@ +--- +table: fct_execution_state_size_daily +type: incremental +interval: + type: block + max: 100000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - daily + - execution + - state_size +dependencies: + - "{{transformation}}.fct_execution_state_size_hourly" +--- +INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` +SELECT + fromUnixTimestamp({{ .task.start }}) as updated_date_time, + toDate(hour_start_date_time) AS date, + count(*) AS hour_count, + min(min_block_number) AS min_block_number, + max(max_block_number) AS max_block_number, + argMax(accounts, hour_start_date_time) AS accounts, + argMax(account_bytes, hour_start_date_time) AS account_bytes, + argMax(account_trienodes, hour_start_date_time) AS account_trienodes, + argMax(account_trienode_bytes, hour_start_date_time) AS account_trienode_bytes, + argMax(contract_codes, hour_start_date_time) AS contract_codes, + argMax(contract_code_bytes, hour_start_date_time) AS contract_code_bytes, + argMax(storages, hour_start_date_time) AS storages, + argMax(storage_bytes, hour_start_date_time) AS storage_bytes, + argMax(storage_trienodes, hour_start_date_time) AS storage_trienodes, + argMax(storage_trienode_bytes, hour_start_date_time) AS storage_trienode_bytes, + sum(accounts_delta) AS accounts_delta, + sum(account_bytes_delta) AS account_bytes_delta, + sum(storage_bytes_delta) AS storage_bytes_delta, + sum(contract_code_bytes_delta) AS contract_code_bytes_delta, + argMax(total_bytes, hour_start_date_time) AS total_bytes +FROM {{ index .dep "{{transformation}}" "fct_execution_state_size_hourly" "helpers" "from" }} FINAL +WHERE max_block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +GROUP BY toDate(hour_start_date_time) \ No newline at end of file diff --git a/models/transformations/fct_execution_state_size_hourly.sql b/models/transformations/fct_execution_state_size_hourly.sql new file mode 100644 index 00000000..d8a36587 --- /dev/null +++ b/models/transformations/fct_execution_state_size_hourly.sql @@ -0,0 +1,48 @@ +--- +table: fct_execution_state_size_hourly +type: incremental +interval: + type: block + max: 100000 +schedules: + forwardfill: "@every 1m" + backfill: "@every 1m" +tags: + - hourly + - execution + - state_size +dependencies: + - "{{external}}.execution_state_size" + - "{{external}}.canonical_execution_block" +--- +INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` +SELECT + fromUnixTimestamp({{ .task.start }}) as updated_date_time, + toStartOfHour(b.block_date_time) AS hour_start_date_time, + count(*) AS measurement_count, + min(s.block_number) AS min_block_number, + max(s.block_number) AS max_block_number, + argMax(s.accounts, s.block_number) AS accounts, + argMax(s.account_bytes, s.block_number) AS account_bytes, + argMax(s.account_trienodes, s.block_number) AS account_trienodes, + argMax(s.account_trienode_bytes, s.block_number) AS account_trienode_bytes, + argMax(s.contract_codes, s.block_number) AS contract_codes, + argMax(s.contract_code_bytes, s.block_number) AS contract_code_bytes, + argMax(s.storages, s.block_number) AS storages, + argMax(s.storage_bytes, s.block_number) AS storage_bytes, + argMax(s.storage_trienodes, s.block_number) AS storage_trienodes, + argMax(s.storage_trienode_bytes, s.block_number) AS storage_trienode_bytes, + toInt64(argMax(s.accounts, s.block_number)) - toInt64(argMin(s.accounts, s.block_number)) AS accounts_delta, + toInt64(argMax(s.account_bytes, s.block_number)) - toInt64(argMin(s.account_bytes, s.block_number)) AS account_bytes_delta, + toInt64(argMax(s.storage_bytes, s.block_number)) - toInt64(argMin(s.storage_bytes, s.block_number)) AS storage_bytes_delta, + toInt64(argMax(s.contract_code_bytes, s.block_number)) - toInt64(argMin(s.contract_code_bytes, s.block_number)) AS contract_code_bytes_delta, + argMax(s.account_bytes, s.block_number) + + argMax(s.account_trienode_bytes, s.block_number) + + argMax(s.contract_code_bytes, s.block_number) + + argMax(s.storage_bytes, s.block_number) + + argMax(s.storage_trienode_bytes, s.block_number) AS total_bytes +FROM {{ index .dep "{{external}}" "execution_state_size" "helpers" "from" }} AS s FINAL +GLOBAL INNER JOIN {{ index .dep "{{external}}" "canonical_execution_block" "helpers" "from" }} AS b FINAL + ON s.block_number = b.block_number +WHERE s.block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +GROUP BY toStartOfHour(b.block_date_time) \ No newline at end of file diff --git a/models/transformations/fct_execution_state_size_monthly.sql b/models/transformations/fct_execution_state_size_monthly.sql new file mode 100644 index 00000000..3a04347a --- /dev/null +++ b/models/transformations/fct_execution_state_size_monthly.sql @@ -0,0 +1,41 @@ +--- +table: fct_execution_state_size_monthly +type: incremental +interval: + type: block + max: 50000 +schedules: + forwardfill: "@every 5m" + backfill: "@every 5m" +tags: + - monthly + - execution + - state_size +dependencies: + - "{{transformation}}.fct_execution_state_size_daily" +--- +INSERT INTO `{{ .self.database }}`.`{{ .self.table }}` +SELECT + fromUnixTimestamp({{ .task.start }}) as updated_date_time, + toStartOfMonth(date) AS month, + count(*) AS day_count, + min(min_block_number) AS min_block_number, + max(max_block_number) AS max_block_number, + argMax(accounts, date) AS accounts, + argMax(account_bytes, date) AS account_bytes, + argMax(account_trienodes, date) AS account_trienodes, + argMax(account_trienode_bytes, date) AS account_trienode_bytes, + argMax(contract_codes, date) AS contract_codes, + argMax(contract_code_bytes, date) AS contract_code_bytes, + argMax(storages, date) AS storages, + argMax(storage_bytes, date) AS storage_bytes, + argMax(storage_trienodes, date) AS storage_trienodes, + argMax(storage_trienode_bytes, date) AS storage_trienode_bytes, + sum(accounts_delta) AS accounts_delta, + sum(account_bytes_delta) AS account_bytes_delta, + sum(storage_bytes_delta) AS storage_bytes_delta, + sum(contract_code_bytes_delta) AS contract_code_bytes_delta, + argMax(total_bytes, date) AS total_bytes +FROM {{ index .dep "{{transformation}}" "fct_execution_state_size_daily" "helpers" "from" }} FINAL +WHERE max_block_number BETWEEN {{ .bounds.start }} AND {{ .bounds.end }} +GROUP BY toStartOfMonth(date) diff --git a/pkg/proto/clickhouse/fct_execution_state_size_daily.go b/pkg/proto/clickhouse/fct_execution_state_size_daily.go new file mode 100644 index 00000000..ad7af9fb --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_daily.go @@ -0,0 +1,688 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for fct_execution_state_size_daily + +package clickhouse + +import ( + "fmt" +) + +// BuildListFctExecutionStateSizeDailyQuery constructs a parameterized SQL query from a ListFctExecutionStateSizeDailyRequest +func BuildListFctExecutionStateSizeDailyQuery(req *ListFctExecutionStateSizeDailyRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Date == nil { + return SQLQuery{}, fmt.Errorf("primary key field date is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Date.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("date", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("date", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("date", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("date", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("date", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("date", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("date", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("date", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("date", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: updated_date_time + if req.UpdatedDateTime != nil { + switch filter := req.UpdatedDateTime.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("updated_date_time", "=", DateTimeValue{filter.Eq}) + case *UInt32Filter_Ne: + qb.AddCondition("updated_date_time", "!=", DateTimeValue{filter.Ne}) + case *UInt32Filter_Lt: + qb.AddCondition("updated_date_time", "<", DateTimeValue{filter.Lt}) + case *UInt32Filter_Lte: + qb.AddCondition("updated_date_time", "<=", DateTimeValue{filter.Lte}) + case *UInt32Filter_Gt: + qb.AddCondition("updated_date_time", ">", DateTimeValue{filter.Gt}) + case *UInt32Filter_Gte: + qb.AddCondition("updated_date_time", ">=", DateTimeValue{filter.Gte}) + case *UInt32Filter_Between: + qb.AddBetweenCondition("updated_date_time", DateTimeValue{filter.Between.Min}, DateTimeValue{filter.Between.Max.GetValue()}) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + converted := make([]interface{}, len(filter.In.Values)) + for i, v := range filter.In.Values { + converted[i] = DateTimeValue{v} + } + qb.AddInCondition("updated_date_time", converted) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + converted := make([]interface{}, len(filter.NotIn.Values)) + for i, v := range filter.NotIn.Values { + converted[i] = DateTimeValue{v} + } + qb.AddNotInCondition("updated_date_time", converted) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: hour_count + if req.HourCount != nil { + switch filter := req.HourCount.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("hour_count", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("hour_count", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("hour_count", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("hour_count", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("hour_count", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("hour_count", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("hour_count", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("hour_count", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("hour_count", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: min_block_number + if req.MinBlockNumber != nil { + switch filter := req.MinBlockNumber.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("min_block_number", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("min_block_number", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("min_block_number", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("min_block_number", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("min_block_number", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("min_block_number", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("min_block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("min_block_number", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("min_block_number", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: max_block_number + if req.MaxBlockNumber != nil { + switch filter := req.MaxBlockNumber.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("max_block_number", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("max_block_number", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("max_block_number", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("max_block_number", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("max_block_number", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("max_block_number", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("max_block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("max_block_number", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("max_block_number", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: accounts + if req.Accounts != nil { + switch filter := req.Accounts.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("accounts", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("accounts", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("accounts", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("accounts", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("accounts", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("accounts", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("accounts", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("accounts", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("accounts", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_bytes + if req.AccountBytes != nil { + switch filter := req.AccountBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_trienodes + if req.AccountTrienodes != nil { + switch filter := req.AccountTrienodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_trienodes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_trienodes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_trienodes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_trienodes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_trienodes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_trienodes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_trienodes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_trienodes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_trienodes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_trienode_bytes + if req.AccountTrienodeBytes != nil { + switch filter := req.AccountTrienodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_trienode_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_trienode_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_trienode_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_trienode_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_trienode_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_trienode_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_trienode_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_trienode_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_trienode_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_codes + if req.ContractCodes != nil { + switch filter := req.ContractCodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("contract_codes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("contract_codes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("contract_codes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("contract_codes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("contract_codes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("contract_codes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("contract_codes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_codes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_codes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_code_bytes + if req.ContractCodeBytes != nil { + switch filter := req.ContractCodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("contract_code_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("contract_code_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("contract_code_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("contract_code_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("contract_code_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("contract_code_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("contract_code_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_code_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_code_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storages + if req.Storages != nil { + switch filter := req.Storages.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storages", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storages", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storages", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storages", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storages", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storages", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storages", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storages", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storages", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_bytes + if req.StorageBytes != nil { + switch filter := req.StorageBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_trienodes + if req.StorageTrienodes != nil { + switch filter := req.StorageTrienodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_trienodes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_trienodes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_trienodes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_trienodes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_trienodes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_trienodes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_trienodes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_trienodes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_trienodes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_trienode_bytes + if req.StorageTrienodeBytes != nil { + switch filter := req.StorageTrienodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_trienode_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_trienode_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_trienode_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_trienode_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_trienode_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_trienode_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_trienode_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_trienode_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_trienode_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: accounts_delta + if req.AccountsDelta != nil { + switch filter := req.AccountsDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("accounts_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("accounts_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("accounts_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("accounts_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("accounts_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("accounts_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("accounts_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("accounts_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("accounts_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_bytes_delta + if req.AccountBytesDelta != nil { + switch filter := req.AccountBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("account_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("account_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("account_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("account_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("account_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("account_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("account_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_bytes_delta + if req.StorageBytesDelta != nil { + switch filter := req.StorageBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("storage_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("storage_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("storage_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("storage_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("storage_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("storage_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("storage_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_code_bytes_delta + if req.ContractCodeBytesDelta != nil { + switch filter := req.ContractCodeBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("contract_code_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("contract_code_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("contract_code_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("contract_code_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("contract_code_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("contract_code_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("contract_code_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_code_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_code_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: total_bytes + if req.TotalBytes != nil { + switch filter := req.TotalBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("total_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("total_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("total_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("total_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("total_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("total_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("total_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("total_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("total_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"updated_date_time", "date", "hour_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY date" + } + + // Build column list + columns := []string{"toUnixTimestamp(`updated_date_time`) AS `updated_date_time`", "toString(`date`) AS `date`", "hour_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + + return BuildParameterizedQuery("fct_execution_state_size_daily", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetFctExecutionStateSizeDailyQuery constructs a parameterized SQL query from a GetFctExecutionStateSizeDailyRequest +func BuildGetFctExecutionStateSizeDailyQuery(req *GetFctExecutionStateSizeDailyRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Date == "" { + return SQLQuery{}, fmt.Errorf("primary key field date is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("date", "=", req.Date) + + // Build ORDER BY clause + orderByClause := " ORDER BY date" + + // Build column list + columns := []string{"toUnixTimestamp(`updated_date_time`) AS `updated_date_time`", "toString(`date`) AS `date`", "hour_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + + // Return single record + return BuildParameterizedQuery("fct_execution_state_size_daily", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_daily.pb.go b/pkg/proto/clickhouse/fct_execution_state_size_daily.pb.go new file mode 100644 index 00000000..0080f59c --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_daily.pb.go @@ -0,0 +1,1001 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: fct_execution_state_size_daily.proto + +package clickhouse + +import ( + _ "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse/clickhouse" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type FctExecutionStateSizeDaily struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Timestamp when the record was last updated + UpdatedDateTime uint32 `protobuf:"varint,11,opt,name=updated_date_time,json=updatedDateTime,proto3" json:"updated_date_time,omitempty"` + // Date of the aggregation + Date string `protobuf:"bytes,12,opt,name=date,proto3" json:"date,omitempty"` + // Number of hours in this day + HourCount uint32 `protobuf:"varint,13,opt,name=hour_count,json=hourCount,proto3" json:"hour_count,omitempty"` + // Minimum block number in this day + MinBlockNumber uint64 `protobuf:"varint,14,opt,name=min_block_number,json=minBlockNumber,proto3" json:"min_block_number,omitempty"` + // Maximum block number in this day + MaxBlockNumber uint64 `protobuf:"varint,15,opt,name=max_block_number,json=maxBlockNumber,proto3" json:"max_block_number,omitempty"` + // Total accounts at end of day + Accounts uint64 `protobuf:"varint,16,opt,name=accounts,proto3" json:"accounts,omitempty"` + // Account bytes at end of day + AccountBytes uint64 `protobuf:"varint,17,opt,name=account_bytes,json=accountBytes,proto3" json:"account_bytes,omitempty"` + // Account trie nodes at end of day + AccountTrienodes uint64 `protobuf:"varint,18,opt,name=account_trienodes,json=accountTrienodes,proto3" json:"account_trienodes,omitempty"` + // Account trie node bytes at end of day + AccountTrienodeBytes uint64 `protobuf:"varint,19,opt,name=account_trienode_bytes,json=accountTrienodeBytes,proto3" json:"account_trienode_bytes,omitempty"` + // Contract codes at end of day + ContractCodes uint64 `protobuf:"varint,20,opt,name=contract_codes,json=contractCodes,proto3" json:"contract_codes,omitempty"` + // Contract code bytes at end of day + ContractCodeBytes uint64 `protobuf:"varint,21,opt,name=contract_code_bytes,json=contractCodeBytes,proto3" json:"contract_code_bytes,omitempty"` + // Storage slots at end of day + Storages uint64 `protobuf:"varint,22,opt,name=storages,proto3" json:"storages,omitempty"` + // Storage bytes at end of day + StorageBytes uint64 `protobuf:"varint,23,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"` + // Storage trie nodes at end of day + StorageTrienodes uint64 `protobuf:"varint,24,opt,name=storage_trienodes,json=storageTrienodes,proto3" json:"storage_trienodes,omitempty"` + // Storage trie node bytes at end of day + StorageTrienodeBytes uint64 `protobuf:"varint,25,opt,name=storage_trienode_bytes,json=storageTrienodeBytes,proto3" json:"storage_trienode_bytes,omitempty"` + // Account count change within the day + AccountsDelta int64 `protobuf:"varint,26,opt,name=accounts_delta,json=accountsDelta,proto3" json:"accounts_delta,omitempty"` + // Account bytes change within the day + AccountBytesDelta int64 `protobuf:"varint,27,opt,name=account_bytes_delta,json=accountBytesDelta,proto3" json:"account_bytes_delta,omitempty"` + // Storage bytes change within the day + StorageBytesDelta int64 `protobuf:"varint,28,opt,name=storage_bytes_delta,json=storageBytesDelta,proto3" json:"storage_bytes_delta,omitempty"` + // Contract code bytes change within the day + ContractCodeBytesDelta int64 `protobuf:"varint,29,opt,name=contract_code_bytes_delta,json=contractCodeBytesDelta,proto3" json:"contract_code_bytes_delta,omitempty"` + // Total state size in bytes + TotalBytes uint64 `protobuf:"varint,30,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` +} + +func (x *FctExecutionStateSizeDaily) Reset() { + *x = FctExecutionStateSizeDaily{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FctExecutionStateSizeDaily) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FctExecutionStateSizeDaily) ProtoMessage() {} + +func (x *FctExecutionStateSizeDaily) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FctExecutionStateSizeDaily.ProtoReflect.Descriptor instead. +func (*FctExecutionStateSizeDaily) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_daily_proto_rawDescGZIP(), []int{0} +} + +func (x *FctExecutionStateSizeDaily) GetUpdatedDateTime() uint32 { + if x != nil { + return x.UpdatedDateTime + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetDate() string { + if x != nil { + return x.Date + } + return "" +} + +func (x *FctExecutionStateSizeDaily) GetHourCount() uint32 { + if x != nil { + return x.HourCount + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetMinBlockNumber() uint64 { + if x != nil { + return x.MinBlockNumber + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetMaxBlockNumber() uint64 { + if x != nil { + return x.MaxBlockNumber + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetAccounts() uint64 { + if x != nil { + return x.Accounts + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetAccountBytes() uint64 { + if x != nil { + return x.AccountBytes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetAccountTrienodes() uint64 { + if x != nil { + return x.AccountTrienodes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetAccountTrienodeBytes() uint64 { + if x != nil { + return x.AccountTrienodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetContractCodes() uint64 { + if x != nil { + return x.ContractCodes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetContractCodeBytes() uint64 { + if x != nil { + return x.ContractCodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetStorages() uint64 { + if x != nil { + return x.Storages + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetStorageBytes() uint64 { + if x != nil { + return x.StorageBytes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetStorageTrienodes() uint64 { + if x != nil { + return x.StorageTrienodes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetStorageTrienodeBytes() uint64 { + if x != nil { + return x.StorageTrienodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetAccountsDelta() int64 { + if x != nil { + return x.AccountsDelta + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetAccountBytesDelta() int64 { + if x != nil { + return x.AccountBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetStorageBytesDelta() int64 { + if x != nil { + return x.StorageBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetContractCodeBytesDelta() int64 { + if x != nil { + return x.ContractCodeBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeDaily) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +// Request for listing fct_execution_state_size_daily records +type ListFctExecutionStateSizeDailyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by date - Date of the aggregation (PRIMARY KEY - required) + Date *StringFilter `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"` + // Filter by updated_date_time - Timestamp when the record was last updated (optional) + UpdatedDateTime *UInt32Filter `protobuf:"bytes,2,opt,name=updated_date_time,json=updatedDateTime,proto3" json:"updated_date_time,omitempty"` + // Filter by hour_count - Number of hours in this day (optional) + HourCount *UInt32Filter `protobuf:"bytes,3,opt,name=hour_count,json=hourCount,proto3" json:"hour_count,omitempty"` + // Filter by min_block_number - Minimum block number in this day (optional) + MinBlockNumber *UInt64Filter `protobuf:"bytes,4,opt,name=min_block_number,json=minBlockNumber,proto3" json:"min_block_number,omitempty"` + // Filter by max_block_number - Maximum block number in this day (optional) + MaxBlockNumber *UInt64Filter `protobuf:"bytes,5,opt,name=max_block_number,json=maxBlockNumber,proto3" json:"max_block_number,omitempty"` + // Filter by accounts - Total accounts at end of day (optional) + Accounts *UInt64Filter `protobuf:"bytes,6,opt,name=accounts,proto3" json:"accounts,omitempty"` + // Filter by account_bytes - Account bytes at end of day (optional) + AccountBytes *UInt64Filter `protobuf:"bytes,7,opt,name=account_bytes,json=accountBytes,proto3" json:"account_bytes,omitempty"` + // Filter by account_trienodes - Account trie nodes at end of day (optional) + AccountTrienodes *UInt64Filter `protobuf:"bytes,8,opt,name=account_trienodes,json=accountTrienodes,proto3" json:"account_trienodes,omitempty"` + // Filter by account_trienode_bytes - Account trie node bytes at end of day (optional) + AccountTrienodeBytes *UInt64Filter `protobuf:"bytes,9,opt,name=account_trienode_bytes,json=accountTrienodeBytes,proto3" json:"account_trienode_bytes,omitempty"` + // Filter by contract_codes - Contract codes at end of day (optional) + ContractCodes *UInt64Filter `protobuf:"bytes,10,opt,name=contract_codes,json=contractCodes,proto3" json:"contract_codes,omitempty"` + // Filter by contract_code_bytes - Contract code bytes at end of day (optional) + ContractCodeBytes *UInt64Filter `protobuf:"bytes,11,opt,name=contract_code_bytes,json=contractCodeBytes,proto3" json:"contract_code_bytes,omitempty"` + // Filter by storages - Storage slots at end of day (optional) + Storages *UInt64Filter `protobuf:"bytes,12,opt,name=storages,proto3" json:"storages,omitempty"` + // Filter by storage_bytes - Storage bytes at end of day (optional) + StorageBytes *UInt64Filter `protobuf:"bytes,13,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"` + // Filter by storage_trienodes - Storage trie nodes at end of day (optional) + StorageTrienodes *UInt64Filter `protobuf:"bytes,14,opt,name=storage_trienodes,json=storageTrienodes,proto3" json:"storage_trienodes,omitempty"` + // Filter by storage_trienode_bytes - Storage trie node bytes at end of day (optional) + StorageTrienodeBytes *UInt64Filter `protobuf:"bytes,15,opt,name=storage_trienode_bytes,json=storageTrienodeBytes,proto3" json:"storage_trienode_bytes,omitempty"` + // Filter by accounts_delta - Account count change within the day (optional) + AccountsDelta *Int64Filter `protobuf:"bytes,16,opt,name=accounts_delta,json=accountsDelta,proto3" json:"accounts_delta,omitempty"` + // Filter by account_bytes_delta - Account bytes change within the day (optional) + AccountBytesDelta *Int64Filter `protobuf:"bytes,17,opt,name=account_bytes_delta,json=accountBytesDelta,proto3" json:"account_bytes_delta,omitempty"` + // Filter by storage_bytes_delta - Storage bytes change within the day (optional) + StorageBytesDelta *Int64Filter `protobuf:"bytes,18,opt,name=storage_bytes_delta,json=storageBytesDelta,proto3" json:"storage_bytes_delta,omitempty"` + // Filter by contract_code_bytes_delta - Contract code bytes change within the day (optional) + ContractCodeBytesDelta *Int64Filter `protobuf:"bytes,19,opt,name=contract_code_bytes_delta,json=contractCodeBytesDelta,proto3" json:"contract_code_bytes_delta,omitempty"` + // Filter by total_bytes - Total state size in bytes (optional) + TotalBytes *UInt64Filter `protobuf:"bytes,20,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + // The maximum number of fct_execution_state_size_daily to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,21,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListFctExecutionStateSizeDaily` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,22,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,23,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListFctExecutionStateSizeDailyRequest) Reset() { + *x = ListFctExecutionStateSizeDailyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFctExecutionStateSizeDailyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFctExecutionStateSizeDailyRequest) ProtoMessage() {} + +func (x *ListFctExecutionStateSizeDailyRequest) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFctExecutionStateSizeDailyRequest.ProtoReflect.Descriptor instead. +func (*ListFctExecutionStateSizeDailyRequest) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_daily_proto_rawDescGZIP(), []int{1} +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetDate() *StringFilter { + if x != nil { + return x.Date + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetUpdatedDateTime() *UInt32Filter { + if x != nil { + return x.UpdatedDateTime + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetHourCount() *UInt32Filter { + if x != nil { + return x.HourCount + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetMinBlockNumber() *UInt64Filter { + if x != nil { + return x.MinBlockNumber + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetMaxBlockNumber() *UInt64Filter { + if x != nil { + return x.MaxBlockNumber + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetAccounts() *UInt64Filter { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetAccountBytes() *UInt64Filter { + if x != nil { + return x.AccountBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetAccountTrienodes() *UInt64Filter { + if x != nil { + return x.AccountTrienodes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetAccountTrienodeBytes() *UInt64Filter { + if x != nil { + return x.AccountTrienodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetContractCodes() *UInt64Filter { + if x != nil { + return x.ContractCodes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetContractCodeBytes() *UInt64Filter { + if x != nil { + return x.ContractCodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetStorages() *UInt64Filter { + if x != nil { + return x.Storages + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetStorageBytes() *UInt64Filter { + if x != nil { + return x.StorageBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetStorageTrienodes() *UInt64Filter { + if x != nil { + return x.StorageTrienodes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetStorageTrienodeBytes() *UInt64Filter { + if x != nil { + return x.StorageTrienodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetAccountsDelta() *Int64Filter { + if x != nil { + return x.AccountsDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetAccountBytesDelta() *Int64Filter { + if x != nil { + return x.AccountBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetStorageBytesDelta() *Int64Filter { + if x != nil { + return x.StorageBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetContractCodeBytesDelta() *Int64Filter { + if x != nil { + return x.ContractCodeBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetTotalBytes() *UInt64Filter { + if x != nil { + return x.TotalBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListFctExecutionStateSizeDailyRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing fct_execution_state_size_daily records +type ListFctExecutionStateSizeDailyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of fct_execution_state_size_daily. + FctExecutionStateSizeDaily []*FctExecutionStateSizeDaily `protobuf:"bytes,1,rep,name=fct_execution_state_size_daily,json=fctExecutionStateSizeDaily,proto3" json:"fct_execution_state_size_daily,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListFctExecutionStateSizeDailyResponse) Reset() { + *x = ListFctExecutionStateSizeDailyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFctExecutionStateSizeDailyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFctExecutionStateSizeDailyResponse) ProtoMessage() {} + +func (x *ListFctExecutionStateSizeDailyResponse) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFctExecutionStateSizeDailyResponse.ProtoReflect.Descriptor instead. +func (*ListFctExecutionStateSizeDailyResponse) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_daily_proto_rawDescGZIP(), []int{2} +} + +func (x *ListFctExecutionStateSizeDailyResponse) GetFctExecutionStateSizeDaily() []*FctExecutionStateSizeDaily { + if x != nil { + return x.FctExecutionStateSizeDaily + } + return nil +} + +func (x *ListFctExecutionStateSizeDailyResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single fct_execution_state_size_daily record by primary key +type GetFctExecutionStateSizeDailyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Date of the aggregation + Date string `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"` // Primary key (required) +} + +func (x *GetFctExecutionStateSizeDailyRequest) Reset() { + *x = GetFctExecutionStateSizeDailyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFctExecutionStateSizeDailyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFctExecutionStateSizeDailyRequest) ProtoMessage() {} + +func (x *GetFctExecutionStateSizeDailyRequest) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFctExecutionStateSizeDailyRequest.ProtoReflect.Descriptor instead. +func (*GetFctExecutionStateSizeDailyRequest) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_daily_proto_rawDescGZIP(), []int{3} +} + +func (x *GetFctExecutionStateSizeDailyRequest) GetDate() string { + if x != nil { + return x.Date + } + return "" +} + +// Response for getting a single fct_execution_state_size_daily record +type GetFctExecutionStateSizeDailyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *FctExecutionStateSizeDaily `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetFctExecutionStateSizeDailyResponse) Reset() { + *x = GetFctExecutionStateSizeDailyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFctExecutionStateSizeDailyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFctExecutionStateSizeDailyResponse) ProtoMessage() {} + +func (x *GetFctExecutionStateSizeDailyResponse) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_daily_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFctExecutionStateSizeDailyResponse.ProtoReflect.Descriptor instead. +func (*GetFctExecutionStateSizeDailyResponse) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_daily_proto_rawDescGZIP(), []int{4} +} + +func (x *GetFctExecutionStateSizeDailyResponse) GetItem() *FctExecutionStateSizeDaily { + if x != nil { + return x.Item + } + return nil +} + +var File_fct_execution_state_size_daily_proto protoreflect.FileDescriptor + +var file_fct_execution_state_size_daily_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, + 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x68, + 0x6f, 0x75, 0x73, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x06, 0x0a, 0x1a, 0x46, 0x63, 0x74, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x44, 0x61, 0x69, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x68, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x68, 0x6f, 0x75, 0x72, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, + 0x6d, 0x69, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x28, + 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x12, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, + 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x13, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, + 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x14, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, + 0x64, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, + 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x18, + 0x16, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, + 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x17, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, + 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x18, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x10, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, + 0x73, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, + 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x19, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, + 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x2e, + 0x0a, 0x13, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, + 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x2e, + 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, + 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x39, + 0x0a, 0x19, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1d, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xad, 0x0b, 0x0a, 0x25, 0x4c, + 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x12, 0xe0, 0x41, 0x02, 0x9a, 0xb5, 0x18, 0x0b, 0x70, 0x72, + 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, + 0x42, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x0a, 0x68, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, + 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, + 0x09, 0x68, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x10, 0x6d, 0x69, + 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0e, 0x6d, 0x69, + 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x10, + 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0e, + 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x32, + 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, + 0x01, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x43, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, + 0x6f, 0x64, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, + 0x6f, 0x64, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x16, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, + 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x14, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, + 0x73, 0x12, 0x46, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, + 0xe0, 0x41, 0x01, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, 0x3b, 0x0a, + 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0c, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x11, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x10, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, + 0x4c, 0x0a, 0x16, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, + 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x3c, 0x0a, + 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0d, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x45, 0x0a, 0x13, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, + 0x74, 0x61, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, + 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, + 0x74, 0x61, 0x12, 0x45, 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x50, 0x0a, 0x19, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, + 0xe0, 0x41, 0x01, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, + 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x37, 0x0a, 0x0b, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x17, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, + 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0xb5, 0x01, 0x0a, 0x26, 0x4c, + 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x1e, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x1a, + 0x66, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x3a, 0x0a, 0x24, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, + 0x69, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x22, 0x5c, + 0x0a, 0x25, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x46, 0x63, 0x74, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xcb, 0x02, 0x0a, + 0x21, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x64, + 0x61, 0x69, 0x6c, 0x79, 0x12, 0x93, 0x01, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x29, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, + 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x12, 0x2d, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x64, 0x61, + 0x69, 0x6c, 0x79, 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x65, 0x7d, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, 0x70, 0x61, 0x6e, 0x64, + 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, 0x62, 0x74, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x68, 0x6f, 0x75, + 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_fct_execution_state_size_daily_proto_rawDescOnce sync.Once + file_fct_execution_state_size_daily_proto_rawDescData = file_fct_execution_state_size_daily_proto_rawDesc +) + +func file_fct_execution_state_size_daily_proto_rawDescGZIP() []byte { + file_fct_execution_state_size_daily_proto_rawDescOnce.Do(func() { + file_fct_execution_state_size_daily_proto_rawDescData = protoimpl.X.CompressGZIP(file_fct_execution_state_size_daily_proto_rawDescData) + }) + return file_fct_execution_state_size_daily_proto_rawDescData +} + +var file_fct_execution_state_size_daily_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_fct_execution_state_size_daily_proto_goTypes = []any{ + (*FctExecutionStateSizeDaily)(nil), // 0: cbt.FctExecutionStateSizeDaily + (*ListFctExecutionStateSizeDailyRequest)(nil), // 1: cbt.ListFctExecutionStateSizeDailyRequest + (*ListFctExecutionStateSizeDailyResponse)(nil), // 2: cbt.ListFctExecutionStateSizeDailyResponse + (*GetFctExecutionStateSizeDailyRequest)(nil), // 3: cbt.GetFctExecutionStateSizeDailyRequest + (*GetFctExecutionStateSizeDailyResponse)(nil), // 4: cbt.GetFctExecutionStateSizeDailyResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter + (*UInt64Filter)(nil), // 7: cbt.UInt64Filter + (*Int64Filter)(nil), // 8: cbt.Int64Filter +} +var file_fct_execution_state_size_daily_proto_depIdxs = []int32{ + 5, // 0: cbt.ListFctExecutionStateSizeDailyRequest.date:type_name -> cbt.StringFilter + 6, // 1: cbt.ListFctExecutionStateSizeDailyRequest.updated_date_time:type_name -> cbt.UInt32Filter + 6, // 2: cbt.ListFctExecutionStateSizeDailyRequest.hour_count:type_name -> cbt.UInt32Filter + 7, // 3: cbt.ListFctExecutionStateSizeDailyRequest.min_block_number:type_name -> cbt.UInt64Filter + 7, // 4: cbt.ListFctExecutionStateSizeDailyRequest.max_block_number:type_name -> cbt.UInt64Filter + 7, // 5: cbt.ListFctExecutionStateSizeDailyRequest.accounts:type_name -> cbt.UInt64Filter + 7, // 6: cbt.ListFctExecutionStateSizeDailyRequest.account_bytes:type_name -> cbt.UInt64Filter + 7, // 7: cbt.ListFctExecutionStateSizeDailyRequest.account_trienodes:type_name -> cbt.UInt64Filter + 7, // 8: cbt.ListFctExecutionStateSizeDailyRequest.account_trienode_bytes:type_name -> cbt.UInt64Filter + 7, // 9: cbt.ListFctExecutionStateSizeDailyRequest.contract_codes:type_name -> cbt.UInt64Filter + 7, // 10: cbt.ListFctExecutionStateSizeDailyRequest.contract_code_bytes:type_name -> cbt.UInt64Filter + 7, // 11: cbt.ListFctExecutionStateSizeDailyRequest.storages:type_name -> cbt.UInt64Filter + 7, // 12: cbt.ListFctExecutionStateSizeDailyRequest.storage_bytes:type_name -> cbt.UInt64Filter + 7, // 13: cbt.ListFctExecutionStateSizeDailyRequest.storage_trienodes:type_name -> cbt.UInt64Filter + 7, // 14: cbt.ListFctExecutionStateSizeDailyRequest.storage_trienode_bytes:type_name -> cbt.UInt64Filter + 8, // 15: cbt.ListFctExecutionStateSizeDailyRequest.accounts_delta:type_name -> cbt.Int64Filter + 8, // 16: cbt.ListFctExecutionStateSizeDailyRequest.account_bytes_delta:type_name -> cbt.Int64Filter + 8, // 17: cbt.ListFctExecutionStateSizeDailyRequest.storage_bytes_delta:type_name -> cbt.Int64Filter + 8, // 18: cbt.ListFctExecutionStateSizeDailyRequest.contract_code_bytes_delta:type_name -> cbt.Int64Filter + 7, // 19: cbt.ListFctExecutionStateSizeDailyRequest.total_bytes:type_name -> cbt.UInt64Filter + 0, // 20: cbt.ListFctExecutionStateSizeDailyResponse.fct_execution_state_size_daily:type_name -> cbt.FctExecutionStateSizeDaily + 0, // 21: cbt.GetFctExecutionStateSizeDailyResponse.item:type_name -> cbt.FctExecutionStateSizeDaily + 1, // 22: cbt.FctExecutionStateSizeDailyService.List:input_type -> cbt.ListFctExecutionStateSizeDailyRequest + 3, // 23: cbt.FctExecutionStateSizeDailyService.Get:input_type -> cbt.GetFctExecutionStateSizeDailyRequest + 2, // 24: cbt.FctExecutionStateSizeDailyService.List:output_type -> cbt.ListFctExecutionStateSizeDailyResponse + 4, // 25: cbt.FctExecutionStateSizeDailyService.Get:output_type -> cbt.GetFctExecutionStateSizeDailyResponse + 24, // [24:26] is the sub-list for method output_type + 22, // [22:24] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_fct_execution_state_size_daily_proto_init() } +func file_fct_execution_state_size_daily_proto_init() { + if File_fct_execution_state_size_daily_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_fct_execution_state_size_daily_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*FctExecutionStateSizeDaily); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_daily_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListFctExecutionStateSizeDailyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_daily_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListFctExecutionStateSizeDailyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_daily_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetFctExecutionStateSizeDailyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_daily_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetFctExecutionStateSizeDailyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_fct_execution_state_size_daily_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_fct_execution_state_size_daily_proto_goTypes, + DependencyIndexes: file_fct_execution_state_size_daily_proto_depIdxs, + MessageInfos: file_fct_execution_state_size_daily_proto_msgTypes, + }.Build() + File_fct_execution_state_size_daily_proto = out.File + file_fct_execution_state_size_daily_proto_rawDesc = nil + file_fct_execution_state_size_daily_proto_goTypes = nil + file_fct_execution_state_size_daily_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_daily.proto b/pkg/proto/clickhouse/fct_execution_state_size_daily.proto new file mode 100644 index 00000000..0311f6ba --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_daily.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "clickhouse/annotations.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Execution layer state size metrics aggregated by day + +message FctExecutionStateSizeDaily { + // Timestamp when the record was last updated + uint32 updated_date_time = 11; + // Date of the aggregation + string date = 12; + // Number of hours in this day + uint32 hour_count = 13; + // Minimum block number in this day + uint64 min_block_number = 14; + // Maximum block number in this day + uint64 max_block_number = 15; + // Total accounts at end of day + uint64 accounts = 16; + // Account bytes at end of day + uint64 account_bytes = 17; + // Account trie nodes at end of day + uint64 account_trienodes = 18; + // Account trie node bytes at end of day + uint64 account_trienode_bytes = 19; + // Contract codes at end of day + uint64 contract_codes = 20; + // Contract code bytes at end of day + uint64 contract_code_bytes = 21; + // Storage slots at end of day + uint64 storages = 22; + // Storage bytes at end of day + uint64 storage_bytes = 23; + // Storage trie nodes at end of day + uint64 storage_trienodes = 24; + // Storage trie node bytes at end of day + uint64 storage_trienode_bytes = 25; + // Account count change within the day + int64 accounts_delta = 26; + // Account bytes change within the day + int64 account_bytes_delta = 27; + // Storage bytes change within the day + int64 storage_bytes_delta = 28; + // Contract code bytes change within the day + int64 contract_code_bytes_delta = 29; + // Total state size in bytes + uint64 total_bytes = 30; +} + +// Request for listing fct_execution_state_size_daily records +message ListFctExecutionStateSizeDailyRequest { + // Filter by date - Date of the aggregation (PRIMARY KEY - required) + StringFilter date = 1 [(google.api.field_behavior) = REQUIRED, (clickhouse.v1.required_group) = "primary_key"]; + + // Filter by updated_date_time - Timestamp when the record was last updated (optional) + UInt32Filter updated_date_time = 2 [(google.api.field_behavior) = OPTIONAL]; + // Filter by hour_count - Number of hours in this day (optional) + UInt32Filter hour_count = 3 [(google.api.field_behavior) = OPTIONAL]; + // Filter by min_block_number - Minimum block number in this day (optional) + UInt64Filter min_block_number = 4 [(google.api.field_behavior) = OPTIONAL]; + // Filter by max_block_number - Maximum block number in this day (optional) + UInt64Filter max_block_number = 5 [(google.api.field_behavior) = OPTIONAL]; + // Filter by accounts - Total accounts at end of day (optional) + UInt64Filter accounts = 6 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_bytes - Account bytes at end of day (optional) + UInt64Filter account_bytes = 7 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_trienodes - Account trie nodes at end of day (optional) + UInt64Filter account_trienodes = 8 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_trienode_bytes - Account trie node bytes at end of day (optional) + UInt64Filter account_trienode_bytes = 9 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_codes - Contract codes at end of day (optional) + UInt64Filter contract_codes = 10 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_code_bytes - Contract code bytes at end of day (optional) + UInt64Filter contract_code_bytes = 11 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storages - Storage slots at end of day (optional) + UInt64Filter storages = 12 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_bytes - Storage bytes at end of day (optional) + UInt64Filter storage_bytes = 13 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_trienodes - Storage trie nodes at end of day (optional) + UInt64Filter storage_trienodes = 14 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_trienode_bytes - Storage trie node bytes at end of day (optional) + UInt64Filter storage_trienode_bytes = 15 [(google.api.field_behavior) = OPTIONAL]; + // Filter by accounts_delta - Account count change within the day (optional) + Int64Filter accounts_delta = 16 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_bytes_delta - Account bytes change within the day (optional) + Int64Filter account_bytes_delta = 17 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_bytes_delta - Storage bytes change within the day (optional) + Int64Filter storage_bytes_delta = 18 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_code_bytes_delta - Contract code bytes change within the day (optional) + Int64Filter contract_code_bytes_delta = 19 [(google.api.field_behavior) = OPTIONAL]; + // Filter by total_bytes - Total state size in bytes (optional) + UInt64Filter total_bytes = 20 [(google.api.field_behavior) = OPTIONAL]; + + // The maximum number of fct_execution_state_size_daily to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 21 [(google.api.field_behavior) = OPTIONAL]; + // A page token, received from a previous `ListFctExecutionStateSizeDaily` call. + // Provide this to retrieve the subsequent page. + string page_token = 22 [(google.api.field_behavior) = OPTIONAL]; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 23 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for listing fct_execution_state_size_daily records +message ListFctExecutionStateSizeDailyResponse { + // The list of fct_execution_state_size_daily. + repeated FctExecutionStateSizeDaily fct_execution_state_size_daily = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single fct_execution_state_size_daily record by primary key +message GetFctExecutionStateSizeDailyRequest { + // Date of the aggregation + string date = 1; // Primary key (required) +} + +// Response for getting a single fct_execution_state_size_daily record +message GetFctExecutionStateSizeDailyResponse { + FctExecutionStateSizeDaily item = 1; +} + +// Query fct_execution_state_size_daily data +service FctExecutionStateSizeDailyService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListFctExecutionStateSizeDailyRequest) returns (ListFctExecutionStateSizeDailyResponse) { + option (google.api.http) = { + get: "/api/v1/fct_execution_state_size_daily" + }; + } + // Get record | Retrieve a single record by date + rpc Get(GetFctExecutionStateSizeDailyRequest) returns (GetFctExecutionStateSizeDailyResponse) { + option (google.api.http) = { + get: "/api/v1/fct_execution_state_size_daily/{date}" + }; + } +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_hourly.go b/pkg/proto/clickhouse/fct_execution_state_size_hourly.go new file mode 100644 index 00000000..e3582623 --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_hourly.go @@ -0,0 +1,696 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for fct_execution_state_size_hourly + +package clickhouse + +import ( + "fmt" +) + +// BuildListFctExecutionStateSizeHourlyQuery constructs a parameterized SQL query from a ListFctExecutionStateSizeHourlyRequest +func BuildListFctExecutionStateSizeHourlyQuery(req *ListFctExecutionStateSizeHourlyRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.HourStartDateTime == nil { + return SQLQuery{}, fmt.Errorf("primary key field hour_start_date_time is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.HourStartDateTime.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("hour_start_date_time", "=", DateTimeValue{filter.Eq}) + case *UInt32Filter_Ne: + qb.AddCondition("hour_start_date_time", "!=", DateTimeValue{filter.Ne}) + case *UInt32Filter_Lt: + qb.AddCondition("hour_start_date_time", "<", DateTimeValue{filter.Lt}) + case *UInt32Filter_Lte: + qb.AddCondition("hour_start_date_time", "<=", DateTimeValue{filter.Lte}) + case *UInt32Filter_Gt: + qb.AddCondition("hour_start_date_time", ">", DateTimeValue{filter.Gt}) + case *UInt32Filter_Gte: + qb.AddCondition("hour_start_date_time", ">=", DateTimeValue{filter.Gte}) + case *UInt32Filter_Between: + qb.AddBetweenCondition("hour_start_date_time", DateTimeValue{filter.Between.Min}, DateTimeValue{filter.Between.Max.GetValue()}) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + converted := make([]interface{}, len(filter.In.Values)) + for i, v := range filter.In.Values { + converted[i] = DateTimeValue{v} + } + qb.AddInCondition("hour_start_date_time", converted) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + converted := make([]interface{}, len(filter.NotIn.Values)) + for i, v := range filter.NotIn.Values { + converted[i] = DateTimeValue{v} + } + qb.AddNotInCondition("hour_start_date_time", converted) + } + default: + // Unsupported filter type + } + + // Add filter for column: updated_date_time + if req.UpdatedDateTime != nil { + switch filter := req.UpdatedDateTime.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("updated_date_time", "=", DateTimeValue{filter.Eq}) + case *UInt32Filter_Ne: + qb.AddCondition("updated_date_time", "!=", DateTimeValue{filter.Ne}) + case *UInt32Filter_Lt: + qb.AddCondition("updated_date_time", "<", DateTimeValue{filter.Lt}) + case *UInt32Filter_Lte: + qb.AddCondition("updated_date_time", "<=", DateTimeValue{filter.Lte}) + case *UInt32Filter_Gt: + qb.AddCondition("updated_date_time", ">", DateTimeValue{filter.Gt}) + case *UInt32Filter_Gte: + qb.AddCondition("updated_date_time", ">=", DateTimeValue{filter.Gte}) + case *UInt32Filter_Between: + qb.AddBetweenCondition("updated_date_time", DateTimeValue{filter.Between.Min}, DateTimeValue{filter.Between.Max.GetValue()}) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + converted := make([]interface{}, len(filter.In.Values)) + for i, v := range filter.In.Values { + converted[i] = DateTimeValue{v} + } + qb.AddInCondition("updated_date_time", converted) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + converted := make([]interface{}, len(filter.NotIn.Values)) + for i, v := range filter.NotIn.Values { + converted[i] = DateTimeValue{v} + } + qb.AddNotInCondition("updated_date_time", converted) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: measurement_count + if req.MeasurementCount != nil { + switch filter := req.MeasurementCount.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("measurement_count", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("measurement_count", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("measurement_count", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("measurement_count", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("measurement_count", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("measurement_count", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("measurement_count", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("measurement_count", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("measurement_count", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: min_block_number + if req.MinBlockNumber != nil { + switch filter := req.MinBlockNumber.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("min_block_number", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("min_block_number", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("min_block_number", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("min_block_number", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("min_block_number", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("min_block_number", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("min_block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("min_block_number", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("min_block_number", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: max_block_number + if req.MaxBlockNumber != nil { + switch filter := req.MaxBlockNumber.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("max_block_number", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("max_block_number", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("max_block_number", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("max_block_number", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("max_block_number", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("max_block_number", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("max_block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("max_block_number", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("max_block_number", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: accounts + if req.Accounts != nil { + switch filter := req.Accounts.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("accounts", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("accounts", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("accounts", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("accounts", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("accounts", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("accounts", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("accounts", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("accounts", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("accounts", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_bytes + if req.AccountBytes != nil { + switch filter := req.AccountBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_trienodes + if req.AccountTrienodes != nil { + switch filter := req.AccountTrienodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_trienodes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_trienodes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_trienodes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_trienodes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_trienodes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_trienodes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_trienodes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_trienodes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_trienodes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_trienode_bytes + if req.AccountTrienodeBytes != nil { + switch filter := req.AccountTrienodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_trienode_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_trienode_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_trienode_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_trienode_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_trienode_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_trienode_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_trienode_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_trienode_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_trienode_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_codes + if req.ContractCodes != nil { + switch filter := req.ContractCodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("contract_codes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("contract_codes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("contract_codes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("contract_codes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("contract_codes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("contract_codes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("contract_codes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_codes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_codes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_code_bytes + if req.ContractCodeBytes != nil { + switch filter := req.ContractCodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("contract_code_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("contract_code_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("contract_code_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("contract_code_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("contract_code_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("contract_code_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("contract_code_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_code_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_code_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storages + if req.Storages != nil { + switch filter := req.Storages.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storages", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storages", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storages", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storages", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storages", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storages", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storages", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storages", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storages", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_bytes + if req.StorageBytes != nil { + switch filter := req.StorageBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_trienodes + if req.StorageTrienodes != nil { + switch filter := req.StorageTrienodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_trienodes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_trienodes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_trienodes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_trienodes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_trienodes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_trienodes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_trienodes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_trienodes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_trienodes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_trienode_bytes + if req.StorageTrienodeBytes != nil { + switch filter := req.StorageTrienodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_trienode_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_trienode_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_trienode_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_trienode_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_trienode_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_trienode_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_trienode_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_trienode_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_trienode_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: accounts_delta + if req.AccountsDelta != nil { + switch filter := req.AccountsDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("accounts_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("accounts_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("accounts_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("accounts_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("accounts_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("accounts_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("accounts_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("accounts_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("accounts_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_bytes_delta + if req.AccountBytesDelta != nil { + switch filter := req.AccountBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("account_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("account_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("account_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("account_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("account_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("account_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("account_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_bytes_delta + if req.StorageBytesDelta != nil { + switch filter := req.StorageBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("storage_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("storage_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("storage_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("storage_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("storage_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("storage_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("storage_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_code_bytes_delta + if req.ContractCodeBytesDelta != nil { + switch filter := req.ContractCodeBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("contract_code_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("contract_code_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("contract_code_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("contract_code_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("contract_code_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("contract_code_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("contract_code_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_code_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_code_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: total_bytes + if req.TotalBytes != nil { + switch filter := req.TotalBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("total_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("total_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("total_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("total_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("total_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("total_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("total_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("total_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("total_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"updated_date_time", "hour_start_date_time", "measurement_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY hour_start_date_time" + } + + // Build column list + columns := []string{"toUnixTimestamp(`updated_date_time`) AS `updated_date_time`", "toUnixTimestamp(`hour_start_date_time`) AS `hour_start_date_time`", "measurement_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + + return BuildParameterizedQuery("fct_execution_state_size_hourly", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetFctExecutionStateSizeHourlyQuery constructs a parameterized SQL query from a GetFctExecutionStateSizeHourlyRequest +func BuildGetFctExecutionStateSizeHourlyQuery(req *GetFctExecutionStateSizeHourlyRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.HourStartDateTime == 0 { + return SQLQuery{}, fmt.Errorf("primary key field hour_start_date_time is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("hour_start_date_time", "=", req.HourStartDateTime) + + // Build ORDER BY clause + orderByClause := " ORDER BY hour_start_date_time" + + // Build column list + columns := []string{"toUnixTimestamp(`updated_date_time`) AS `updated_date_time`", "toUnixTimestamp(`hour_start_date_time`) AS `hour_start_date_time`", "measurement_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + + // Return single record + return BuildParameterizedQuery("fct_execution_state_size_hourly", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_hourly.pb.go b/pkg/proto/clickhouse/fct_execution_state_size_hourly.pb.go new file mode 100644 index 00000000..a86fc841 --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_hourly.pb.go @@ -0,0 +1,1009 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: fct_execution_state_size_hourly.proto + +package clickhouse + +import ( + _ "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse/clickhouse" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type FctExecutionStateSizeHourly struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Timestamp when the record was last updated + UpdatedDateTime uint32 `protobuf:"varint,11,opt,name=updated_date_time,json=updatedDateTime,proto3" json:"updated_date_time,omitempty"` + // Start of the hour period + HourStartDateTime uint32 `protobuf:"varint,12,opt,name=hour_start_date_time,json=hourStartDateTime,proto3" json:"hour_start_date_time,omitempty"` + // Number of measurements in this hour + MeasurementCount uint32 `protobuf:"varint,13,opt,name=measurement_count,json=measurementCount,proto3" json:"measurement_count,omitempty"` + // Minimum block number in this hour + MinBlockNumber uint64 `protobuf:"varint,14,opt,name=min_block_number,json=minBlockNumber,proto3" json:"min_block_number,omitempty"` + // Maximum block number in this hour + MaxBlockNumber uint64 `protobuf:"varint,15,opt,name=max_block_number,json=maxBlockNumber,proto3" json:"max_block_number,omitempty"` + // Total accounts at end of hour + Accounts uint64 `protobuf:"varint,16,opt,name=accounts,proto3" json:"accounts,omitempty"` + // Account bytes at end of hour + AccountBytes uint64 `protobuf:"varint,17,opt,name=account_bytes,json=accountBytes,proto3" json:"account_bytes,omitempty"` + // Account trie nodes at end of hour + AccountTrienodes uint64 `protobuf:"varint,18,opt,name=account_trienodes,json=accountTrienodes,proto3" json:"account_trienodes,omitempty"` + // Account trie node bytes at end of hour + AccountTrienodeBytes uint64 `protobuf:"varint,19,opt,name=account_trienode_bytes,json=accountTrienodeBytes,proto3" json:"account_trienode_bytes,omitempty"` + // Contract codes at end of hour + ContractCodes uint64 `protobuf:"varint,20,opt,name=contract_codes,json=contractCodes,proto3" json:"contract_codes,omitempty"` + // Contract code bytes at end of hour + ContractCodeBytes uint64 `protobuf:"varint,21,opt,name=contract_code_bytes,json=contractCodeBytes,proto3" json:"contract_code_bytes,omitempty"` + // Storage slots at end of hour + Storages uint64 `protobuf:"varint,22,opt,name=storages,proto3" json:"storages,omitempty"` + // Storage bytes at end of hour + StorageBytes uint64 `protobuf:"varint,23,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"` + // Storage trie nodes at end of hour + StorageTrienodes uint64 `protobuf:"varint,24,opt,name=storage_trienodes,json=storageTrienodes,proto3" json:"storage_trienodes,omitempty"` + // Storage trie node bytes at end of hour + StorageTrienodeBytes uint64 `protobuf:"varint,25,opt,name=storage_trienode_bytes,json=storageTrienodeBytes,proto3" json:"storage_trienode_bytes,omitempty"` + // Account count change within the hour + AccountsDelta int64 `protobuf:"varint,26,opt,name=accounts_delta,json=accountsDelta,proto3" json:"accounts_delta,omitempty"` + // Account bytes change within the hour + AccountBytesDelta int64 `protobuf:"varint,27,opt,name=account_bytes_delta,json=accountBytesDelta,proto3" json:"account_bytes_delta,omitempty"` + // Storage bytes change within the hour + StorageBytesDelta int64 `protobuf:"varint,28,opt,name=storage_bytes_delta,json=storageBytesDelta,proto3" json:"storage_bytes_delta,omitempty"` + // Contract code bytes change within the hour + ContractCodeBytesDelta int64 `protobuf:"varint,29,opt,name=contract_code_bytes_delta,json=contractCodeBytesDelta,proto3" json:"contract_code_bytes_delta,omitempty"` + // Total state size in bytes + TotalBytes uint64 `protobuf:"varint,30,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` +} + +func (x *FctExecutionStateSizeHourly) Reset() { + *x = FctExecutionStateSizeHourly{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FctExecutionStateSizeHourly) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FctExecutionStateSizeHourly) ProtoMessage() {} + +func (x *FctExecutionStateSizeHourly) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FctExecutionStateSizeHourly.ProtoReflect.Descriptor instead. +func (*FctExecutionStateSizeHourly) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_hourly_proto_rawDescGZIP(), []int{0} +} + +func (x *FctExecutionStateSizeHourly) GetUpdatedDateTime() uint32 { + if x != nil { + return x.UpdatedDateTime + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetHourStartDateTime() uint32 { + if x != nil { + return x.HourStartDateTime + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetMeasurementCount() uint32 { + if x != nil { + return x.MeasurementCount + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetMinBlockNumber() uint64 { + if x != nil { + return x.MinBlockNumber + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetMaxBlockNumber() uint64 { + if x != nil { + return x.MaxBlockNumber + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetAccounts() uint64 { + if x != nil { + return x.Accounts + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetAccountBytes() uint64 { + if x != nil { + return x.AccountBytes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetAccountTrienodes() uint64 { + if x != nil { + return x.AccountTrienodes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetAccountTrienodeBytes() uint64 { + if x != nil { + return x.AccountTrienodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetContractCodes() uint64 { + if x != nil { + return x.ContractCodes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetContractCodeBytes() uint64 { + if x != nil { + return x.ContractCodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetStorages() uint64 { + if x != nil { + return x.Storages + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetStorageBytes() uint64 { + if x != nil { + return x.StorageBytes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetStorageTrienodes() uint64 { + if x != nil { + return x.StorageTrienodes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetStorageTrienodeBytes() uint64 { + if x != nil { + return x.StorageTrienodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetAccountsDelta() int64 { + if x != nil { + return x.AccountsDelta + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetAccountBytesDelta() int64 { + if x != nil { + return x.AccountBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetStorageBytesDelta() int64 { + if x != nil { + return x.StorageBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetContractCodeBytesDelta() int64 { + if x != nil { + return x.ContractCodeBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeHourly) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +// Request for listing fct_execution_state_size_hourly records +type ListFctExecutionStateSizeHourlyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by hour_start_date_time - Start of the hour period (PRIMARY KEY - required) + HourStartDateTime *UInt32Filter `protobuf:"bytes,1,opt,name=hour_start_date_time,json=hourStartDateTime,proto3" json:"hour_start_date_time,omitempty"` + // Filter by updated_date_time - Timestamp when the record was last updated (optional) + UpdatedDateTime *UInt32Filter `protobuf:"bytes,2,opt,name=updated_date_time,json=updatedDateTime,proto3" json:"updated_date_time,omitempty"` + // Filter by measurement_count - Number of measurements in this hour (optional) + MeasurementCount *UInt32Filter `protobuf:"bytes,3,opt,name=measurement_count,json=measurementCount,proto3" json:"measurement_count,omitempty"` + // Filter by min_block_number - Minimum block number in this hour (optional) + MinBlockNumber *UInt64Filter `protobuf:"bytes,4,opt,name=min_block_number,json=minBlockNumber,proto3" json:"min_block_number,omitempty"` + // Filter by max_block_number - Maximum block number in this hour (optional) + MaxBlockNumber *UInt64Filter `protobuf:"bytes,5,opt,name=max_block_number,json=maxBlockNumber,proto3" json:"max_block_number,omitempty"` + // Filter by accounts - Total accounts at end of hour (optional) + Accounts *UInt64Filter `protobuf:"bytes,6,opt,name=accounts,proto3" json:"accounts,omitempty"` + // Filter by account_bytes - Account bytes at end of hour (optional) + AccountBytes *UInt64Filter `protobuf:"bytes,7,opt,name=account_bytes,json=accountBytes,proto3" json:"account_bytes,omitempty"` + // Filter by account_trienodes - Account trie nodes at end of hour (optional) + AccountTrienodes *UInt64Filter `protobuf:"bytes,8,opt,name=account_trienodes,json=accountTrienodes,proto3" json:"account_trienodes,omitempty"` + // Filter by account_trienode_bytes - Account trie node bytes at end of hour (optional) + AccountTrienodeBytes *UInt64Filter `protobuf:"bytes,9,opt,name=account_trienode_bytes,json=accountTrienodeBytes,proto3" json:"account_trienode_bytes,omitempty"` + // Filter by contract_codes - Contract codes at end of hour (optional) + ContractCodes *UInt64Filter `protobuf:"bytes,10,opt,name=contract_codes,json=contractCodes,proto3" json:"contract_codes,omitempty"` + // Filter by contract_code_bytes - Contract code bytes at end of hour (optional) + ContractCodeBytes *UInt64Filter `protobuf:"bytes,11,opt,name=contract_code_bytes,json=contractCodeBytes,proto3" json:"contract_code_bytes,omitempty"` + // Filter by storages - Storage slots at end of hour (optional) + Storages *UInt64Filter `protobuf:"bytes,12,opt,name=storages,proto3" json:"storages,omitempty"` + // Filter by storage_bytes - Storage bytes at end of hour (optional) + StorageBytes *UInt64Filter `protobuf:"bytes,13,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"` + // Filter by storage_trienodes - Storage trie nodes at end of hour (optional) + StorageTrienodes *UInt64Filter `protobuf:"bytes,14,opt,name=storage_trienodes,json=storageTrienodes,proto3" json:"storage_trienodes,omitempty"` + // Filter by storage_trienode_bytes - Storage trie node bytes at end of hour (optional) + StorageTrienodeBytes *UInt64Filter `protobuf:"bytes,15,opt,name=storage_trienode_bytes,json=storageTrienodeBytes,proto3" json:"storage_trienode_bytes,omitempty"` + // Filter by accounts_delta - Account count change within the hour (optional) + AccountsDelta *Int64Filter `protobuf:"bytes,16,opt,name=accounts_delta,json=accountsDelta,proto3" json:"accounts_delta,omitempty"` + // Filter by account_bytes_delta - Account bytes change within the hour (optional) + AccountBytesDelta *Int64Filter `protobuf:"bytes,17,opt,name=account_bytes_delta,json=accountBytesDelta,proto3" json:"account_bytes_delta,omitempty"` + // Filter by storage_bytes_delta - Storage bytes change within the hour (optional) + StorageBytesDelta *Int64Filter `protobuf:"bytes,18,opt,name=storage_bytes_delta,json=storageBytesDelta,proto3" json:"storage_bytes_delta,omitempty"` + // Filter by contract_code_bytes_delta - Contract code bytes change within the hour (optional) + ContractCodeBytesDelta *Int64Filter `protobuf:"bytes,19,opt,name=contract_code_bytes_delta,json=contractCodeBytesDelta,proto3" json:"contract_code_bytes_delta,omitempty"` + // Filter by total_bytes - Total state size in bytes (optional) + TotalBytes *UInt64Filter `protobuf:"bytes,20,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + // The maximum number of fct_execution_state_size_hourly to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,21,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListFctExecutionStateSizeHourly` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,22,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,23,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListFctExecutionStateSizeHourlyRequest) Reset() { + *x = ListFctExecutionStateSizeHourlyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFctExecutionStateSizeHourlyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFctExecutionStateSizeHourlyRequest) ProtoMessage() {} + +func (x *ListFctExecutionStateSizeHourlyRequest) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFctExecutionStateSizeHourlyRequest.ProtoReflect.Descriptor instead. +func (*ListFctExecutionStateSizeHourlyRequest) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_hourly_proto_rawDescGZIP(), []int{1} +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetHourStartDateTime() *UInt32Filter { + if x != nil { + return x.HourStartDateTime + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetUpdatedDateTime() *UInt32Filter { + if x != nil { + return x.UpdatedDateTime + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetMeasurementCount() *UInt32Filter { + if x != nil { + return x.MeasurementCount + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetMinBlockNumber() *UInt64Filter { + if x != nil { + return x.MinBlockNumber + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetMaxBlockNumber() *UInt64Filter { + if x != nil { + return x.MaxBlockNumber + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetAccounts() *UInt64Filter { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetAccountBytes() *UInt64Filter { + if x != nil { + return x.AccountBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetAccountTrienodes() *UInt64Filter { + if x != nil { + return x.AccountTrienodes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetAccountTrienodeBytes() *UInt64Filter { + if x != nil { + return x.AccountTrienodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetContractCodes() *UInt64Filter { + if x != nil { + return x.ContractCodes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetContractCodeBytes() *UInt64Filter { + if x != nil { + return x.ContractCodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetStorages() *UInt64Filter { + if x != nil { + return x.Storages + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetStorageBytes() *UInt64Filter { + if x != nil { + return x.StorageBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetStorageTrienodes() *UInt64Filter { + if x != nil { + return x.StorageTrienodes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetStorageTrienodeBytes() *UInt64Filter { + if x != nil { + return x.StorageTrienodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetAccountsDelta() *Int64Filter { + if x != nil { + return x.AccountsDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetAccountBytesDelta() *Int64Filter { + if x != nil { + return x.AccountBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetStorageBytesDelta() *Int64Filter { + if x != nil { + return x.StorageBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetContractCodeBytesDelta() *Int64Filter { + if x != nil { + return x.ContractCodeBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetTotalBytes() *UInt64Filter { + if x != nil { + return x.TotalBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListFctExecutionStateSizeHourlyRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing fct_execution_state_size_hourly records +type ListFctExecutionStateSizeHourlyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of fct_execution_state_size_hourly. + FctExecutionStateSizeHourly []*FctExecutionStateSizeHourly `protobuf:"bytes,1,rep,name=fct_execution_state_size_hourly,json=fctExecutionStateSizeHourly,proto3" json:"fct_execution_state_size_hourly,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListFctExecutionStateSizeHourlyResponse) Reset() { + *x = ListFctExecutionStateSizeHourlyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFctExecutionStateSizeHourlyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFctExecutionStateSizeHourlyResponse) ProtoMessage() {} + +func (x *ListFctExecutionStateSizeHourlyResponse) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFctExecutionStateSizeHourlyResponse.ProtoReflect.Descriptor instead. +func (*ListFctExecutionStateSizeHourlyResponse) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_hourly_proto_rawDescGZIP(), []int{2} +} + +func (x *ListFctExecutionStateSizeHourlyResponse) GetFctExecutionStateSizeHourly() []*FctExecutionStateSizeHourly { + if x != nil { + return x.FctExecutionStateSizeHourly + } + return nil +} + +func (x *ListFctExecutionStateSizeHourlyResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single fct_execution_state_size_hourly record by primary key +type GetFctExecutionStateSizeHourlyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Start of the hour period + HourStartDateTime uint32 `protobuf:"varint,1,opt,name=hour_start_date_time,json=hourStartDateTime,proto3" json:"hour_start_date_time,omitempty"` // Primary key (required) +} + +func (x *GetFctExecutionStateSizeHourlyRequest) Reset() { + *x = GetFctExecutionStateSizeHourlyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFctExecutionStateSizeHourlyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFctExecutionStateSizeHourlyRequest) ProtoMessage() {} + +func (x *GetFctExecutionStateSizeHourlyRequest) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFctExecutionStateSizeHourlyRequest.ProtoReflect.Descriptor instead. +func (*GetFctExecutionStateSizeHourlyRequest) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_hourly_proto_rawDescGZIP(), []int{3} +} + +func (x *GetFctExecutionStateSizeHourlyRequest) GetHourStartDateTime() uint32 { + if x != nil { + return x.HourStartDateTime + } + return 0 +} + +// Response for getting a single fct_execution_state_size_hourly record +type GetFctExecutionStateSizeHourlyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *FctExecutionStateSizeHourly `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetFctExecutionStateSizeHourlyResponse) Reset() { + *x = GetFctExecutionStateSizeHourlyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFctExecutionStateSizeHourlyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFctExecutionStateSizeHourlyResponse) ProtoMessage() {} + +func (x *GetFctExecutionStateSizeHourlyResponse) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_hourly_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFctExecutionStateSizeHourlyResponse.ProtoReflect.Descriptor instead. +func (*GetFctExecutionStateSizeHourlyResponse) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_hourly_proto_rawDescGZIP(), []int{4} +} + +func (x *GetFctExecutionStateSizeHourlyResponse) GetItem() *FctExecutionStateSizeHourly { + if x != nil { + return x.Item + } + return nil +} + +var File_fct_execution_state_size_hourly_proto protoreflect.FileDescriptor + +var file_fct_execution_state_size_hourly_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x68, 0x6f, 0x75, 0x72, 0x6c, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, + 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x63, 0x6c, 0x69, 0x63, 0x6b, + 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x06, 0x0a, 0x1b, 0x46, 0x63, 0x74, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x68, 0x6f, 0x75, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x11, 0x68, 0x6f, 0x75, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x10, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x69, 0x6e, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x6d, + 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, + 0x64, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, + 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x13, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x14, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, + 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x73, + 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, + 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x18, 0x16, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x17, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, + 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x18, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x34, + 0x0a, 0x16, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x19, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x13, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, + 0x74, 0x61, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x13, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, + 0x74, 0x61, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x19, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xd9, 0x0b, 0x0a, 0x26, 0x4c, 0x69, 0x73, 0x74, + 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x56, 0x0a, 0x14, 0x68, 0x6f, 0x75, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x42, 0x12, 0xe0, 0x41, 0x02, 0x9a, 0xb5, 0x18, 0x0b, 0x70, 0x72, 0x69, 0x6d, + 0x61, 0x72, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x52, 0x11, 0x68, 0x6f, 0x75, 0x72, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x11, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, + 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0f, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x43, + 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, + 0x01, 0x52, 0x10, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x10, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, + 0x01, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x0d, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x10, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x4c, 0x0a, + 0x16, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, + 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x14, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, + 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x0e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x13, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, + 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, + 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, + 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x16, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, + 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, + 0x52, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, + 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, + 0x65, 0x6c, 0x74, 0x61, 0x12, 0x45, 0x0a, 0x13, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x11, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x45, 0x0a, 0x13, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, + 0x74, 0x61, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, + 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, + 0x74, 0x61, 0x12, 0x50, 0x0a, 0x19, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, + 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x16, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, + 0x65, 0x6c, 0x74, 0x61, 0x12, 0x37, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, + 0x01, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x22, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x16, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, + 0x17, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x42, 0x79, 0x22, 0xb9, 0x01, 0x0a, 0x27, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x66, 0x0a, 0x1f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x68, 0x6f, 0x75, 0x72, + 0x6c, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x46, + 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x1b, 0x66, 0x63, 0x74, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x58, 0x0a, 0x25, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x68, 0x6f, 0x75, 0x72, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x68, 0x6f, 0x75, 0x72, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x5e, 0x0a, 0x26, 0x47, 0x65, 0x74, + 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, + 0x72, 0x6c, 0x79, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xe2, 0x02, 0x0a, 0x22, 0x46, 0x63, + 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, + 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x92, 0x01, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x68, + 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x12, 0xa6, 0x01, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x2a, 0x2e, + 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, + 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x12, 0x3e, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x5f, 0x68, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x2f, 0x7b, 0x68, 0x6f, 0x75, 0x72, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x7d, 0x42, 0x36, + 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, + 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, 0x62, + 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x63, + 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_fct_execution_state_size_hourly_proto_rawDescOnce sync.Once + file_fct_execution_state_size_hourly_proto_rawDescData = file_fct_execution_state_size_hourly_proto_rawDesc +) + +func file_fct_execution_state_size_hourly_proto_rawDescGZIP() []byte { + file_fct_execution_state_size_hourly_proto_rawDescOnce.Do(func() { + file_fct_execution_state_size_hourly_proto_rawDescData = protoimpl.X.CompressGZIP(file_fct_execution_state_size_hourly_proto_rawDescData) + }) + return file_fct_execution_state_size_hourly_proto_rawDescData +} + +var file_fct_execution_state_size_hourly_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_fct_execution_state_size_hourly_proto_goTypes = []any{ + (*FctExecutionStateSizeHourly)(nil), // 0: cbt.FctExecutionStateSizeHourly + (*ListFctExecutionStateSizeHourlyRequest)(nil), // 1: cbt.ListFctExecutionStateSizeHourlyRequest + (*ListFctExecutionStateSizeHourlyResponse)(nil), // 2: cbt.ListFctExecutionStateSizeHourlyResponse + (*GetFctExecutionStateSizeHourlyRequest)(nil), // 3: cbt.GetFctExecutionStateSizeHourlyRequest + (*GetFctExecutionStateSizeHourlyResponse)(nil), // 4: cbt.GetFctExecutionStateSizeHourlyResponse + (*UInt32Filter)(nil), // 5: cbt.UInt32Filter + (*UInt64Filter)(nil), // 6: cbt.UInt64Filter + (*Int64Filter)(nil), // 7: cbt.Int64Filter +} +var file_fct_execution_state_size_hourly_proto_depIdxs = []int32{ + 5, // 0: cbt.ListFctExecutionStateSizeHourlyRequest.hour_start_date_time:type_name -> cbt.UInt32Filter + 5, // 1: cbt.ListFctExecutionStateSizeHourlyRequest.updated_date_time:type_name -> cbt.UInt32Filter + 5, // 2: cbt.ListFctExecutionStateSizeHourlyRequest.measurement_count:type_name -> cbt.UInt32Filter + 6, // 3: cbt.ListFctExecutionStateSizeHourlyRequest.min_block_number:type_name -> cbt.UInt64Filter + 6, // 4: cbt.ListFctExecutionStateSizeHourlyRequest.max_block_number:type_name -> cbt.UInt64Filter + 6, // 5: cbt.ListFctExecutionStateSizeHourlyRequest.accounts:type_name -> cbt.UInt64Filter + 6, // 6: cbt.ListFctExecutionStateSizeHourlyRequest.account_bytes:type_name -> cbt.UInt64Filter + 6, // 7: cbt.ListFctExecutionStateSizeHourlyRequest.account_trienodes:type_name -> cbt.UInt64Filter + 6, // 8: cbt.ListFctExecutionStateSizeHourlyRequest.account_trienode_bytes:type_name -> cbt.UInt64Filter + 6, // 9: cbt.ListFctExecutionStateSizeHourlyRequest.contract_codes:type_name -> cbt.UInt64Filter + 6, // 10: cbt.ListFctExecutionStateSizeHourlyRequest.contract_code_bytes:type_name -> cbt.UInt64Filter + 6, // 11: cbt.ListFctExecutionStateSizeHourlyRequest.storages:type_name -> cbt.UInt64Filter + 6, // 12: cbt.ListFctExecutionStateSizeHourlyRequest.storage_bytes:type_name -> cbt.UInt64Filter + 6, // 13: cbt.ListFctExecutionStateSizeHourlyRequest.storage_trienodes:type_name -> cbt.UInt64Filter + 6, // 14: cbt.ListFctExecutionStateSizeHourlyRequest.storage_trienode_bytes:type_name -> cbt.UInt64Filter + 7, // 15: cbt.ListFctExecutionStateSizeHourlyRequest.accounts_delta:type_name -> cbt.Int64Filter + 7, // 16: cbt.ListFctExecutionStateSizeHourlyRequest.account_bytes_delta:type_name -> cbt.Int64Filter + 7, // 17: cbt.ListFctExecutionStateSizeHourlyRequest.storage_bytes_delta:type_name -> cbt.Int64Filter + 7, // 18: cbt.ListFctExecutionStateSizeHourlyRequest.contract_code_bytes_delta:type_name -> cbt.Int64Filter + 6, // 19: cbt.ListFctExecutionStateSizeHourlyRequest.total_bytes:type_name -> cbt.UInt64Filter + 0, // 20: cbt.ListFctExecutionStateSizeHourlyResponse.fct_execution_state_size_hourly:type_name -> cbt.FctExecutionStateSizeHourly + 0, // 21: cbt.GetFctExecutionStateSizeHourlyResponse.item:type_name -> cbt.FctExecutionStateSizeHourly + 1, // 22: cbt.FctExecutionStateSizeHourlyService.List:input_type -> cbt.ListFctExecutionStateSizeHourlyRequest + 3, // 23: cbt.FctExecutionStateSizeHourlyService.Get:input_type -> cbt.GetFctExecutionStateSizeHourlyRequest + 2, // 24: cbt.FctExecutionStateSizeHourlyService.List:output_type -> cbt.ListFctExecutionStateSizeHourlyResponse + 4, // 25: cbt.FctExecutionStateSizeHourlyService.Get:output_type -> cbt.GetFctExecutionStateSizeHourlyResponse + 24, // [24:26] is the sub-list for method output_type + 22, // [22:24] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_fct_execution_state_size_hourly_proto_init() } +func file_fct_execution_state_size_hourly_proto_init() { + if File_fct_execution_state_size_hourly_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_fct_execution_state_size_hourly_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*FctExecutionStateSizeHourly); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_hourly_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListFctExecutionStateSizeHourlyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_hourly_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListFctExecutionStateSizeHourlyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_hourly_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetFctExecutionStateSizeHourlyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_hourly_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetFctExecutionStateSizeHourlyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_fct_execution_state_size_hourly_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_fct_execution_state_size_hourly_proto_goTypes, + DependencyIndexes: file_fct_execution_state_size_hourly_proto_depIdxs, + MessageInfos: file_fct_execution_state_size_hourly_proto_msgTypes, + }.Build() + File_fct_execution_state_size_hourly_proto = out.File + file_fct_execution_state_size_hourly_proto_rawDesc = nil + file_fct_execution_state_size_hourly_proto_goTypes = nil + file_fct_execution_state_size_hourly_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_hourly.proto b/pkg/proto/clickhouse/fct_execution_state_size_hourly.proto new file mode 100644 index 00000000..61e5fb69 --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_hourly.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "clickhouse/annotations.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Execution layer state size metrics aggregated by hour + +message FctExecutionStateSizeHourly { + // Timestamp when the record was last updated + uint32 updated_date_time = 11; + // Start of the hour period + uint32 hour_start_date_time = 12; + // Number of measurements in this hour + uint32 measurement_count = 13; + // Minimum block number in this hour + uint64 min_block_number = 14; + // Maximum block number in this hour + uint64 max_block_number = 15; + // Total accounts at end of hour + uint64 accounts = 16; + // Account bytes at end of hour + uint64 account_bytes = 17; + // Account trie nodes at end of hour + uint64 account_trienodes = 18; + // Account trie node bytes at end of hour + uint64 account_trienode_bytes = 19; + // Contract codes at end of hour + uint64 contract_codes = 20; + // Contract code bytes at end of hour + uint64 contract_code_bytes = 21; + // Storage slots at end of hour + uint64 storages = 22; + // Storage bytes at end of hour + uint64 storage_bytes = 23; + // Storage trie nodes at end of hour + uint64 storage_trienodes = 24; + // Storage trie node bytes at end of hour + uint64 storage_trienode_bytes = 25; + // Account count change within the hour + int64 accounts_delta = 26; + // Account bytes change within the hour + int64 account_bytes_delta = 27; + // Storage bytes change within the hour + int64 storage_bytes_delta = 28; + // Contract code bytes change within the hour + int64 contract_code_bytes_delta = 29; + // Total state size in bytes + uint64 total_bytes = 30; +} + +// Request for listing fct_execution_state_size_hourly records +message ListFctExecutionStateSizeHourlyRequest { + // Filter by hour_start_date_time - Start of the hour period (PRIMARY KEY - required) + UInt32Filter hour_start_date_time = 1 [(google.api.field_behavior) = REQUIRED, (clickhouse.v1.required_group) = "primary_key"]; + + // Filter by updated_date_time - Timestamp when the record was last updated (optional) + UInt32Filter updated_date_time = 2 [(google.api.field_behavior) = OPTIONAL]; + // Filter by measurement_count - Number of measurements in this hour (optional) + UInt32Filter measurement_count = 3 [(google.api.field_behavior) = OPTIONAL]; + // Filter by min_block_number - Minimum block number in this hour (optional) + UInt64Filter min_block_number = 4 [(google.api.field_behavior) = OPTIONAL]; + // Filter by max_block_number - Maximum block number in this hour (optional) + UInt64Filter max_block_number = 5 [(google.api.field_behavior) = OPTIONAL]; + // Filter by accounts - Total accounts at end of hour (optional) + UInt64Filter accounts = 6 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_bytes - Account bytes at end of hour (optional) + UInt64Filter account_bytes = 7 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_trienodes - Account trie nodes at end of hour (optional) + UInt64Filter account_trienodes = 8 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_trienode_bytes - Account trie node bytes at end of hour (optional) + UInt64Filter account_trienode_bytes = 9 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_codes - Contract codes at end of hour (optional) + UInt64Filter contract_codes = 10 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_code_bytes - Contract code bytes at end of hour (optional) + UInt64Filter contract_code_bytes = 11 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storages - Storage slots at end of hour (optional) + UInt64Filter storages = 12 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_bytes - Storage bytes at end of hour (optional) + UInt64Filter storage_bytes = 13 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_trienodes - Storage trie nodes at end of hour (optional) + UInt64Filter storage_trienodes = 14 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_trienode_bytes - Storage trie node bytes at end of hour (optional) + UInt64Filter storage_trienode_bytes = 15 [(google.api.field_behavior) = OPTIONAL]; + // Filter by accounts_delta - Account count change within the hour (optional) + Int64Filter accounts_delta = 16 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_bytes_delta - Account bytes change within the hour (optional) + Int64Filter account_bytes_delta = 17 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_bytes_delta - Storage bytes change within the hour (optional) + Int64Filter storage_bytes_delta = 18 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_code_bytes_delta - Contract code bytes change within the hour (optional) + Int64Filter contract_code_bytes_delta = 19 [(google.api.field_behavior) = OPTIONAL]; + // Filter by total_bytes - Total state size in bytes (optional) + UInt64Filter total_bytes = 20 [(google.api.field_behavior) = OPTIONAL]; + + // The maximum number of fct_execution_state_size_hourly to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 21 [(google.api.field_behavior) = OPTIONAL]; + // A page token, received from a previous `ListFctExecutionStateSizeHourly` call. + // Provide this to retrieve the subsequent page. + string page_token = 22 [(google.api.field_behavior) = OPTIONAL]; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 23 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for listing fct_execution_state_size_hourly records +message ListFctExecutionStateSizeHourlyResponse { + // The list of fct_execution_state_size_hourly. + repeated FctExecutionStateSizeHourly fct_execution_state_size_hourly = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single fct_execution_state_size_hourly record by primary key +message GetFctExecutionStateSizeHourlyRequest { + // Start of the hour period + uint32 hour_start_date_time = 1; // Primary key (required) +} + +// Response for getting a single fct_execution_state_size_hourly record +message GetFctExecutionStateSizeHourlyResponse { + FctExecutionStateSizeHourly item = 1; +} + +// Query fct_execution_state_size_hourly data +service FctExecutionStateSizeHourlyService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListFctExecutionStateSizeHourlyRequest) returns (ListFctExecutionStateSizeHourlyResponse) { + option (google.api.http) = { + get: "/api/v1/fct_execution_state_size_hourly" + }; + } + // Get record | Retrieve a single record by hour_start_date_time + rpc Get(GetFctExecutionStateSizeHourlyRequest) returns (GetFctExecutionStateSizeHourlyResponse) { + option (google.api.http) = { + get: "/api/v1/fct_execution_state_size_hourly/{hour_start_date_time}" + }; + } +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_monthly.go b/pkg/proto/clickhouse/fct_execution_state_size_monthly.go new file mode 100644 index 00000000..5ca90417 --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_monthly.go @@ -0,0 +1,688 @@ +// Code generated by clickhouse-proto-gen. DO NOT EDIT. +// SQL query builder for fct_execution_state_size_monthly + +package clickhouse + +import ( + "fmt" +) + +// BuildListFctExecutionStateSizeMonthlyQuery constructs a parameterized SQL query from a ListFctExecutionStateSizeMonthlyRequest +func BuildListFctExecutionStateSizeMonthlyQuery(req *ListFctExecutionStateSizeMonthlyRequest, options ...QueryOption) (SQLQuery, error) { + // Validate that at least one primary key is provided + // Primary keys can come from base table or projections + if req.Month == nil { + return SQLQuery{}, fmt.Errorf("primary key field month is required") + } + + // Build query using QueryBuilder + qb := NewQueryBuilder() + + // Add primary key filter + switch filter := req.Month.Filter.(type) { + case *StringFilter_Eq: + qb.AddCondition("month", "=", filter.Eq) + case *StringFilter_Ne: + qb.AddCondition("month", "!=", filter.Ne) + case *StringFilter_Contains: + qb.AddLikeCondition("month", "%" + filter.Contains + "%") + case *StringFilter_StartsWith: + qb.AddLikeCondition("month", filter.StartsWith + "%") + case *StringFilter_EndsWith: + qb.AddLikeCondition("month", "%" + filter.EndsWith) + case *StringFilter_Like: + qb.AddLikeCondition("month", filter.Like) + case *StringFilter_NotLike: + qb.AddNotLikeCondition("month", filter.NotLike) + case *StringFilter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("month", StringSliceToInterface(filter.In.Values)) + } + case *StringFilter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("month", StringSliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + + // Add filter for column: updated_date_time + if req.UpdatedDateTime != nil { + switch filter := req.UpdatedDateTime.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("updated_date_time", "=", DateTimeValue{filter.Eq}) + case *UInt32Filter_Ne: + qb.AddCondition("updated_date_time", "!=", DateTimeValue{filter.Ne}) + case *UInt32Filter_Lt: + qb.AddCondition("updated_date_time", "<", DateTimeValue{filter.Lt}) + case *UInt32Filter_Lte: + qb.AddCondition("updated_date_time", "<=", DateTimeValue{filter.Lte}) + case *UInt32Filter_Gt: + qb.AddCondition("updated_date_time", ">", DateTimeValue{filter.Gt}) + case *UInt32Filter_Gte: + qb.AddCondition("updated_date_time", ">=", DateTimeValue{filter.Gte}) + case *UInt32Filter_Between: + qb.AddBetweenCondition("updated_date_time", DateTimeValue{filter.Between.Min}, DateTimeValue{filter.Between.Max.GetValue()}) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + converted := make([]interface{}, len(filter.In.Values)) + for i, v := range filter.In.Values { + converted[i] = DateTimeValue{v} + } + qb.AddInCondition("updated_date_time", converted) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + converted := make([]interface{}, len(filter.NotIn.Values)) + for i, v := range filter.NotIn.Values { + converted[i] = DateTimeValue{v} + } + qb.AddNotInCondition("updated_date_time", converted) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: day_count + if req.DayCount != nil { + switch filter := req.DayCount.Filter.(type) { + case *UInt32Filter_Eq: + qb.AddCondition("day_count", "=", filter.Eq) + case *UInt32Filter_Ne: + qb.AddCondition("day_count", "!=", filter.Ne) + case *UInt32Filter_Lt: + qb.AddCondition("day_count", "<", filter.Lt) + case *UInt32Filter_Lte: + qb.AddCondition("day_count", "<=", filter.Lte) + case *UInt32Filter_Gt: + qb.AddCondition("day_count", ">", filter.Gt) + case *UInt32Filter_Gte: + qb.AddCondition("day_count", ">=", filter.Gte) + case *UInt32Filter_Between: + qb.AddBetweenCondition("day_count", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt32Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("day_count", UInt32SliceToInterface(filter.In.Values)) + } + case *UInt32Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("day_count", UInt32SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: min_block_number + if req.MinBlockNumber != nil { + switch filter := req.MinBlockNumber.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("min_block_number", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("min_block_number", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("min_block_number", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("min_block_number", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("min_block_number", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("min_block_number", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("min_block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("min_block_number", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("min_block_number", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: max_block_number + if req.MaxBlockNumber != nil { + switch filter := req.MaxBlockNumber.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("max_block_number", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("max_block_number", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("max_block_number", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("max_block_number", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("max_block_number", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("max_block_number", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("max_block_number", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("max_block_number", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("max_block_number", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: accounts + if req.Accounts != nil { + switch filter := req.Accounts.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("accounts", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("accounts", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("accounts", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("accounts", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("accounts", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("accounts", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("accounts", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("accounts", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("accounts", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_bytes + if req.AccountBytes != nil { + switch filter := req.AccountBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_trienodes + if req.AccountTrienodes != nil { + switch filter := req.AccountTrienodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_trienodes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_trienodes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_trienodes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_trienodes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_trienodes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_trienodes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_trienodes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_trienodes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_trienodes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_trienode_bytes + if req.AccountTrienodeBytes != nil { + switch filter := req.AccountTrienodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("account_trienode_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("account_trienode_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("account_trienode_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("account_trienode_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("account_trienode_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("account_trienode_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("account_trienode_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_trienode_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_trienode_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_codes + if req.ContractCodes != nil { + switch filter := req.ContractCodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("contract_codes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("contract_codes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("contract_codes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("contract_codes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("contract_codes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("contract_codes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("contract_codes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_codes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_codes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_code_bytes + if req.ContractCodeBytes != nil { + switch filter := req.ContractCodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("contract_code_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("contract_code_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("contract_code_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("contract_code_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("contract_code_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("contract_code_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("contract_code_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_code_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_code_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storages + if req.Storages != nil { + switch filter := req.Storages.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storages", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storages", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storages", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storages", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storages", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storages", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storages", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storages", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storages", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_bytes + if req.StorageBytes != nil { + switch filter := req.StorageBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_trienodes + if req.StorageTrienodes != nil { + switch filter := req.StorageTrienodes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_trienodes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_trienodes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_trienodes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_trienodes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_trienodes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_trienodes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_trienodes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_trienodes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_trienodes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_trienode_bytes + if req.StorageTrienodeBytes != nil { + switch filter := req.StorageTrienodeBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("storage_trienode_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("storage_trienode_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("storage_trienode_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("storage_trienode_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("storage_trienode_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("storage_trienode_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("storage_trienode_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_trienode_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_trienode_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: accounts_delta + if req.AccountsDelta != nil { + switch filter := req.AccountsDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("accounts_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("accounts_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("accounts_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("accounts_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("accounts_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("accounts_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("accounts_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("accounts_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("accounts_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: account_bytes_delta + if req.AccountBytesDelta != nil { + switch filter := req.AccountBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("account_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("account_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("account_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("account_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("account_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("account_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("account_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("account_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("account_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: storage_bytes_delta + if req.StorageBytesDelta != nil { + switch filter := req.StorageBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("storage_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("storage_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("storage_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("storage_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("storage_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("storage_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("storage_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("storage_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("storage_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: contract_code_bytes_delta + if req.ContractCodeBytesDelta != nil { + switch filter := req.ContractCodeBytesDelta.Filter.(type) { + case *Int64Filter_Eq: + qb.AddCondition("contract_code_bytes_delta", "=", filter.Eq) + case *Int64Filter_Ne: + qb.AddCondition("contract_code_bytes_delta", "!=", filter.Ne) + case *Int64Filter_Lt: + qb.AddCondition("contract_code_bytes_delta", "<", filter.Lt) + case *Int64Filter_Lte: + qb.AddCondition("contract_code_bytes_delta", "<=", filter.Lte) + case *Int64Filter_Gt: + qb.AddCondition("contract_code_bytes_delta", ">", filter.Gt) + case *Int64Filter_Gte: + qb.AddCondition("contract_code_bytes_delta", ">=", filter.Gte) + case *Int64Filter_Between: + qb.AddBetweenCondition("contract_code_bytes_delta", filter.Between.Min, filter.Between.Max.GetValue()) + case *Int64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("contract_code_bytes_delta", Int64SliceToInterface(filter.In.Values)) + } + case *Int64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("contract_code_bytes_delta", Int64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Add filter for column: total_bytes + if req.TotalBytes != nil { + switch filter := req.TotalBytes.Filter.(type) { + case *UInt64Filter_Eq: + qb.AddCondition("total_bytes", "=", filter.Eq) + case *UInt64Filter_Ne: + qb.AddCondition("total_bytes", "!=", filter.Ne) + case *UInt64Filter_Lt: + qb.AddCondition("total_bytes", "<", filter.Lt) + case *UInt64Filter_Lte: + qb.AddCondition("total_bytes", "<=", filter.Lte) + case *UInt64Filter_Gt: + qb.AddCondition("total_bytes", ">", filter.Gt) + case *UInt64Filter_Gte: + qb.AddCondition("total_bytes", ">=", filter.Gte) + case *UInt64Filter_Between: + qb.AddBetweenCondition("total_bytes", filter.Between.Min, filter.Between.Max.GetValue()) + case *UInt64Filter_In: + if len(filter.In.Values) > 0 { + qb.AddInCondition("total_bytes", UInt64SliceToInterface(filter.In.Values)) + } + case *UInt64Filter_NotIn: + if len(filter.NotIn.Values) > 0 { + qb.AddNotInCondition("total_bytes", UInt64SliceToInterface(filter.NotIn.Values)) + } + default: + // Unsupported filter type + } + } + + // Handle pagination per AIP-132 + // Validate page size + if req.PageSize < 0 { + return SQLQuery{}, fmt.Errorf("page_size must be non-negative, got %d", req.PageSize) + } + if req.PageSize > 10000 { + return SQLQuery{}, fmt.Errorf("page_size must not exceed %d, got %d", 10000, req.PageSize) + } + + var limit, offset uint32 + limit = 100 // Default page size + if req.PageSize > 0 { + limit = uint32(req.PageSize) + } + if req.PageToken != "" { + decodedOffset, err := DecodePageToken(req.PageToken) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid page_token: %w", err) + } + offset = decodedOffset + } + + // Handle custom ordering if provided + var orderByClause string + if req.OrderBy != "" { + validFields := []string{"updated_date_time", "month", "day_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + orderFields, err := ParseOrderBy(req.OrderBy, validFields) + if err != nil { + return SQLQuery{}, fmt.Errorf("invalid order_by: %w", err) + } + orderByClause = BuildOrderByClause(orderFields) + } else { + // Default sorting by primary key + orderByClause = " ORDER BY month" + } + + // Build column list + columns := []string{"toUnixTimestamp(`updated_date_time`) AS `updated_date_time`", "toString(`month`) AS `month`", "day_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + + return BuildParameterizedQuery("fct_execution_state_size_monthly", columns, qb, orderByClause, limit, offset, options...) +} + +// BuildGetFctExecutionStateSizeMonthlyQuery constructs a parameterized SQL query from a GetFctExecutionStateSizeMonthlyRequest +func BuildGetFctExecutionStateSizeMonthlyQuery(req *GetFctExecutionStateSizeMonthlyRequest, options ...QueryOption) (SQLQuery, error) { + // Validate primary key is provided + if req.Month == "" { + return SQLQuery{}, fmt.Errorf("primary key field month is required") + } + + // Build query with primary key condition + qb := NewQueryBuilder() + qb.AddCondition("month", "=", req.Month) + + // Build ORDER BY clause + orderByClause := " ORDER BY month" + + // Build column list + columns := []string{"toUnixTimestamp(`updated_date_time`) AS `updated_date_time`", "toString(`month`) AS `month`", "day_count", "min_block_number", "max_block_number", "accounts", "account_bytes", "account_trienodes", "account_trienode_bytes", "contract_codes", "contract_code_bytes", "storages", "storage_bytes", "storage_trienodes", "storage_trienode_bytes", "accounts_delta", "account_bytes_delta", "storage_bytes_delta", "contract_code_bytes_delta", "total_bytes"} + + // Return single record + return BuildParameterizedQuery("fct_execution_state_size_monthly", columns, qb, orderByClause, 1, 0, options...) +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_monthly.pb.go b/pkg/proto/clickhouse/fct_execution_state_size_monthly.pb.go new file mode 100644 index 00000000..aaab4137 --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_monthly.pb.go @@ -0,0 +1,1003 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: fct_execution_state_size_monthly.proto + +package clickhouse + +import ( + _ "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse/clickhouse" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type FctExecutionStateSizeMonthly struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Timestamp when the record was last updated + UpdatedDateTime uint32 `protobuf:"varint,11,opt,name=updated_date_time,json=updatedDateTime,proto3" json:"updated_date_time,omitempty"` + // First day of the month + Month string `protobuf:"bytes,12,opt,name=month,proto3" json:"month,omitempty"` + // Number of days in this month with data + DayCount uint32 `protobuf:"varint,13,opt,name=day_count,json=dayCount,proto3" json:"day_count,omitempty"` + // Minimum block number in this month + MinBlockNumber uint64 `protobuf:"varint,14,opt,name=min_block_number,json=minBlockNumber,proto3" json:"min_block_number,omitempty"` + // Maximum block number in this month + MaxBlockNumber uint64 `protobuf:"varint,15,opt,name=max_block_number,json=maxBlockNumber,proto3" json:"max_block_number,omitempty"` + // Total accounts at end of month + Accounts uint64 `protobuf:"varint,16,opt,name=accounts,proto3" json:"accounts,omitempty"` + // Account bytes at end of month + AccountBytes uint64 `protobuf:"varint,17,opt,name=account_bytes,json=accountBytes,proto3" json:"account_bytes,omitempty"` + // Account trie nodes at end of month + AccountTrienodes uint64 `protobuf:"varint,18,opt,name=account_trienodes,json=accountTrienodes,proto3" json:"account_trienodes,omitempty"` + // Account trie node bytes at end of month + AccountTrienodeBytes uint64 `protobuf:"varint,19,opt,name=account_trienode_bytes,json=accountTrienodeBytes,proto3" json:"account_trienode_bytes,omitempty"` + // Contract codes at end of month + ContractCodes uint64 `protobuf:"varint,20,opt,name=contract_codes,json=contractCodes,proto3" json:"contract_codes,omitempty"` + // Contract code bytes at end of month + ContractCodeBytes uint64 `protobuf:"varint,21,opt,name=contract_code_bytes,json=contractCodeBytes,proto3" json:"contract_code_bytes,omitempty"` + // Storage slots at end of month + Storages uint64 `protobuf:"varint,22,opt,name=storages,proto3" json:"storages,omitempty"` + // Storage bytes at end of month + StorageBytes uint64 `protobuf:"varint,23,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"` + // Storage trie nodes at end of month + StorageTrienodes uint64 `protobuf:"varint,24,opt,name=storage_trienodes,json=storageTrienodes,proto3" json:"storage_trienodes,omitempty"` + // Storage trie node bytes at end of month + StorageTrienodeBytes uint64 `protobuf:"varint,25,opt,name=storage_trienode_bytes,json=storageTrienodeBytes,proto3" json:"storage_trienode_bytes,omitempty"` + // Account count change within the month + AccountsDelta int64 `protobuf:"varint,26,opt,name=accounts_delta,json=accountsDelta,proto3" json:"accounts_delta,omitempty"` + // Account bytes change within the month + AccountBytesDelta int64 `protobuf:"varint,27,opt,name=account_bytes_delta,json=accountBytesDelta,proto3" json:"account_bytes_delta,omitempty"` + // Storage bytes change within the month + StorageBytesDelta int64 `protobuf:"varint,28,opt,name=storage_bytes_delta,json=storageBytesDelta,proto3" json:"storage_bytes_delta,omitempty"` + // Contract code bytes change within the month + ContractCodeBytesDelta int64 `protobuf:"varint,29,opt,name=contract_code_bytes_delta,json=contractCodeBytesDelta,proto3" json:"contract_code_bytes_delta,omitempty"` + // Total state size in bytes + TotalBytes uint64 `protobuf:"varint,30,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` +} + +func (x *FctExecutionStateSizeMonthly) Reset() { + *x = FctExecutionStateSizeMonthly{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FctExecutionStateSizeMonthly) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FctExecutionStateSizeMonthly) ProtoMessage() {} + +func (x *FctExecutionStateSizeMonthly) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FctExecutionStateSizeMonthly.ProtoReflect.Descriptor instead. +func (*FctExecutionStateSizeMonthly) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_monthly_proto_rawDescGZIP(), []int{0} +} + +func (x *FctExecutionStateSizeMonthly) GetUpdatedDateTime() uint32 { + if x != nil { + return x.UpdatedDateTime + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetMonth() string { + if x != nil { + return x.Month + } + return "" +} + +func (x *FctExecutionStateSizeMonthly) GetDayCount() uint32 { + if x != nil { + return x.DayCount + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetMinBlockNumber() uint64 { + if x != nil { + return x.MinBlockNumber + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetMaxBlockNumber() uint64 { + if x != nil { + return x.MaxBlockNumber + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetAccounts() uint64 { + if x != nil { + return x.Accounts + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetAccountBytes() uint64 { + if x != nil { + return x.AccountBytes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetAccountTrienodes() uint64 { + if x != nil { + return x.AccountTrienodes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetAccountTrienodeBytes() uint64 { + if x != nil { + return x.AccountTrienodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetContractCodes() uint64 { + if x != nil { + return x.ContractCodes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetContractCodeBytes() uint64 { + if x != nil { + return x.ContractCodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetStorages() uint64 { + if x != nil { + return x.Storages + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetStorageBytes() uint64 { + if x != nil { + return x.StorageBytes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetStorageTrienodes() uint64 { + if x != nil { + return x.StorageTrienodes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetStorageTrienodeBytes() uint64 { + if x != nil { + return x.StorageTrienodeBytes + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetAccountsDelta() int64 { + if x != nil { + return x.AccountsDelta + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetAccountBytesDelta() int64 { + if x != nil { + return x.AccountBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetStorageBytesDelta() int64 { + if x != nil { + return x.StorageBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetContractCodeBytesDelta() int64 { + if x != nil { + return x.ContractCodeBytesDelta + } + return 0 +} + +func (x *FctExecutionStateSizeMonthly) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +// Request for listing fct_execution_state_size_monthly records +type ListFctExecutionStateSizeMonthlyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Filter by month - First day of the month (PRIMARY KEY - required) + Month *StringFilter `protobuf:"bytes,1,opt,name=month,proto3" json:"month,omitempty"` + // Filter by updated_date_time - Timestamp when the record was last updated (optional) + UpdatedDateTime *UInt32Filter `protobuf:"bytes,2,opt,name=updated_date_time,json=updatedDateTime,proto3" json:"updated_date_time,omitempty"` + // Filter by day_count - Number of days in this month with data (optional) + DayCount *UInt32Filter `protobuf:"bytes,3,opt,name=day_count,json=dayCount,proto3" json:"day_count,omitempty"` + // Filter by min_block_number - Minimum block number in this month (optional) + MinBlockNumber *UInt64Filter `protobuf:"bytes,4,opt,name=min_block_number,json=minBlockNumber,proto3" json:"min_block_number,omitempty"` + // Filter by max_block_number - Maximum block number in this month (optional) + MaxBlockNumber *UInt64Filter `protobuf:"bytes,5,opt,name=max_block_number,json=maxBlockNumber,proto3" json:"max_block_number,omitempty"` + // Filter by accounts - Total accounts at end of month (optional) + Accounts *UInt64Filter `protobuf:"bytes,6,opt,name=accounts,proto3" json:"accounts,omitempty"` + // Filter by account_bytes - Account bytes at end of month (optional) + AccountBytes *UInt64Filter `protobuf:"bytes,7,opt,name=account_bytes,json=accountBytes,proto3" json:"account_bytes,omitempty"` + // Filter by account_trienodes - Account trie nodes at end of month (optional) + AccountTrienodes *UInt64Filter `protobuf:"bytes,8,opt,name=account_trienodes,json=accountTrienodes,proto3" json:"account_trienodes,omitempty"` + // Filter by account_trienode_bytes - Account trie node bytes at end of month (optional) + AccountTrienodeBytes *UInt64Filter `protobuf:"bytes,9,opt,name=account_trienode_bytes,json=accountTrienodeBytes,proto3" json:"account_trienode_bytes,omitempty"` + // Filter by contract_codes - Contract codes at end of month (optional) + ContractCodes *UInt64Filter `protobuf:"bytes,10,opt,name=contract_codes,json=contractCodes,proto3" json:"contract_codes,omitempty"` + // Filter by contract_code_bytes - Contract code bytes at end of month (optional) + ContractCodeBytes *UInt64Filter `protobuf:"bytes,11,opt,name=contract_code_bytes,json=contractCodeBytes,proto3" json:"contract_code_bytes,omitempty"` + // Filter by storages - Storage slots at end of month (optional) + Storages *UInt64Filter `protobuf:"bytes,12,opt,name=storages,proto3" json:"storages,omitempty"` + // Filter by storage_bytes - Storage bytes at end of month (optional) + StorageBytes *UInt64Filter `protobuf:"bytes,13,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"` + // Filter by storage_trienodes - Storage trie nodes at end of month (optional) + StorageTrienodes *UInt64Filter `protobuf:"bytes,14,opt,name=storage_trienodes,json=storageTrienodes,proto3" json:"storage_trienodes,omitempty"` + // Filter by storage_trienode_bytes - Storage trie node bytes at end of month (optional) + StorageTrienodeBytes *UInt64Filter `protobuf:"bytes,15,opt,name=storage_trienode_bytes,json=storageTrienodeBytes,proto3" json:"storage_trienode_bytes,omitempty"` + // Filter by accounts_delta - Account count change within the month (optional) + AccountsDelta *Int64Filter `protobuf:"bytes,16,opt,name=accounts_delta,json=accountsDelta,proto3" json:"accounts_delta,omitempty"` + // Filter by account_bytes_delta - Account bytes change within the month (optional) + AccountBytesDelta *Int64Filter `protobuf:"bytes,17,opt,name=account_bytes_delta,json=accountBytesDelta,proto3" json:"account_bytes_delta,omitempty"` + // Filter by storage_bytes_delta - Storage bytes change within the month (optional) + StorageBytesDelta *Int64Filter `protobuf:"bytes,18,opt,name=storage_bytes_delta,json=storageBytesDelta,proto3" json:"storage_bytes_delta,omitempty"` + // Filter by contract_code_bytes_delta - Contract code bytes change within the month (optional) + ContractCodeBytesDelta *Int64Filter `protobuf:"bytes,19,opt,name=contract_code_bytes_delta,json=contractCodeBytesDelta,proto3" json:"contract_code_bytes_delta,omitempty"` + // Filter by total_bytes - Total state size in bytes (optional) + TotalBytes *UInt64Filter `protobuf:"bytes,20,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + // The maximum number of fct_execution_state_size_monthly to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + PageSize int32 `protobuf:"varint,21,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListFctExecutionStateSizeMonthly` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,22,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + OrderBy string `protobuf:"bytes,23,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) Reset() { + *x = ListFctExecutionStateSizeMonthlyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFctExecutionStateSizeMonthlyRequest) ProtoMessage() {} + +func (x *ListFctExecutionStateSizeMonthlyRequest) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFctExecutionStateSizeMonthlyRequest.ProtoReflect.Descriptor instead. +func (*ListFctExecutionStateSizeMonthlyRequest) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_monthly_proto_rawDescGZIP(), []int{1} +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetMonth() *StringFilter { + if x != nil { + return x.Month + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetUpdatedDateTime() *UInt32Filter { + if x != nil { + return x.UpdatedDateTime + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetDayCount() *UInt32Filter { + if x != nil { + return x.DayCount + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetMinBlockNumber() *UInt64Filter { + if x != nil { + return x.MinBlockNumber + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetMaxBlockNumber() *UInt64Filter { + if x != nil { + return x.MaxBlockNumber + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetAccounts() *UInt64Filter { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetAccountBytes() *UInt64Filter { + if x != nil { + return x.AccountBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetAccountTrienodes() *UInt64Filter { + if x != nil { + return x.AccountTrienodes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetAccountTrienodeBytes() *UInt64Filter { + if x != nil { + return x.AccountTrienodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetContractCodes() *UInt64Filter { + if x != nil { + return x.ContractCodes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetContractCodeBytes() *UInt64Filter { + if x != nil { + return x.ContractCodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetStorages() *UInt64Filter { + if x != nil { + return x.Storages + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetStorageBytes() *UInt64Filter { + if x != nil { + return x.StorageBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetStorageTrienodes() *UInt64Filter { + if x != nil { + return x.StorageTrienodes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetStorageTrienodeBytes() *UInt64Filter { + if x != nil { + return x.StorageTrienodeBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetAccountsDelta() *Int64Filter { + if x != nil { + return x.AccountsDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetAccountBytesDelta() *Int64Filter { + if x != nil { + return x.AccountBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetStorageBytesDelta() *Int64Filter { + if x != nil { + return x.StorageBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetContractCodeBytesDelta() *Int64Filter { + if x != nil { + return x.ContractCodeBytesDelta + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetTotalBytes() *UInt64Filter { + if x != nil { + return x.TotalBytes + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListFctExecutionStateSizeMonthlyRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response for listing fct_execution_state_size_monthly records +type ListFctExecutionStateSizeMonthlyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of fct_execution_state_size_monthly. + FctExecutionStateSizeMonthly []*FctExecutionStateSizeMonthly `protobuf:"bytes,1,rep,name=fct_execution_state_size_monthly,json=fctExecutionStateSizeMonthly,proto3" json:"fct_execution_state_size_monthly,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListFctExecutionStateSizeMonthlyResponse) Reset() { + *x = ListFctExecutionStateSizeMonthlyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFctExecutionStateSizeMonthlyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFctExecutionStateSizeMonthlyResponse) ProtoMessage() {} + +func (x *ListFctExecutionStateSizeMonthlyResponse) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFctExecutionStateSizeMonthlyResponse.ProtoReflect.Descriptor instead. +func (*ListFctExecutionStateSizeMonthlyResponse) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_monthly_proto_rawDescGZIP(), []int{2} +} + +func (x *ListFctExecutionStateSizeMonthlyResponse) GetFctExecutionStateSizeMonthly() []*FctExecutionStateSizeMonthly { + if x != nil { + return x.FctExecutionStateSizeMonthly + } + return nil +} + +func (x *ListFctExecutionStateSizeMonthlyResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request for getting a single fct_execution_state_size_monthly record by primary key +type GetFctExecutionStateSizeMonthlyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // First day of the month + Month string `protobuf:"bytes,1,opt,name=month,proto3" json:"month,omitempty"` // Primary key (required) +} + +func (x *GetFctExecutionStateSizeMonthlyRequest) Reset() { + *x = GetFctExecutionStateSizeMonthlyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFctExecutionStateSizeMonthlyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFctExecutionStateSizeMonthlyRequest) ProtoMessage() {} + +func (x *GetFctExecutionStateSizeMonthlyRequest) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFctExecutionStateSizeMonthlyRequest.ProtoReflect.Descriptor instead. +func (*GetFctExecutionStateSizeMonthlyRequest) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_monthly_proto_rawDescGZIP(), []int{3} +} + +func (x *GetFctExecutionStateSizeMonthlyRequest) GetMonth() string { + if x != nil { + return x.Month + } + return "" +} + +// Response for getting a single fct_execution_state_size_monthly record +type GetFctExecutionStateSizeMonthlyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *FctExecutionStateSizeMonthly `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *GetFctExecutionStateSizeMonthlyResponse) Reset() { + *x = GetFctExecutionStateSizeMonthlyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFctExecutionStateSizeMonthlyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFctExecutionStateSizeMonthlyResponse) ProtoMessage() {} + +func (x *GetFctExecutionStateSizeMonthlyResponse) ProtoReflect() protoreflect.Message { + mi := &file_fct_execution_state_size_monthly_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFctExecutionStateSizeMonthlyResponse.ProtoReflect.Descriptor instead. +func (*GetFctExecutionStateSizeMonthlyResponse) Descriptor() ([]byte, []int) { + return file_fct_execution_state_size_monthly_proto_rawDescGZIP(), []int{4} +} + +func (x *GetFctExecutionStateSizeMonthlyResponse) GetItem() *FctExecutionStateSizeMonthly { + if x != nil { + return x.Item + } + return nil +} + +var File_fct_execution_state_size_monthly_proto protoreflect.FileDescriptor + +var file_fct_execution_state_size_monthly_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x74, 0x68, + 0x6c, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63, 0x62, 0x74, 0x1a, 0x0c, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, + 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x63, 0x6c, 0x69, 0x63, + 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd3, 0x06, 0x0a, 0x1c, 0x46, 0x63, 0x74, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x64, + 0x61, 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, + 0x64, 0x61, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x69, 0x6e, 0x5f, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x61, + 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, + 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, + 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, + 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x15, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, + 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x73, 0x18, 0x16, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x18, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x19, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, + 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1a, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, + 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x13, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, + 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, + 0x74, 0x61, 0x12, 0x39, 0x0a, 0x19, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, + 0x1d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, + 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x1f, 0x0a, + 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x1e, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xaf, + 0x0b, 0x0a, 0x27, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, + 0x68, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x05, 0x6d, 0x6f, + 0x6e, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x12, 0xe0, 0x41, + 0x02, 0x9a, 0xb5, 0x18, 0x0b, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6b, 0x65, 0x79, + 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x12, 0x42, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x09, 0x64, + 0x61, 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x64, 0x61, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x40, 0x0a, 0x10, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x40, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, + 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, + 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x16, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x14, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x65, 0x6e, + 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x11, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x32, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x12, 0x43, 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x69, 0x65, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, + 0xe0, 0x41, 0x01, 0x52, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, + 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x16, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x14, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x72, 0x69, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, + 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, + 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x44, 0x65, 0x6c, 0x74, + 0x61, 0x12, 0x45, 0x0a, 0x13, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x11, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x45, 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, + 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, + 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x11, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, + 0x50, 0x0a, 0x19, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, + 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x13, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x74, + 0x61, 0x12, 0x37, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x55, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x09, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, 0x42, 0x03, 0xe0, + 0x41, 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x17, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, + 0x22, 0xbd, 0x01, 0x0a, 0x28, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, + 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, + 0x20, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, + 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x46, 0x63, + 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, + 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x52, 0x1c, 0x66, 0x63, 0x74, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, + 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x3e, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, + 0x68, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, + 0x6e, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, + 0x22, 0x60, 0x0a, 0x27, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, + 0x68, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x62, 0x74, 0x2e, + 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x52, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x32, 0xda, 0x02, 0x0a, 0x23, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, + 0x68, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x95, 0x01, 0x0a, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x2c, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, + 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, + 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2d, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x63, 0x74, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x74, 0x68, + 0x6c, 0x79, 0x12, 0x9a, 0x01, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x2b, 0x2e, 0x63, 0x62, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x62, 0x74, 0x2e, 0x47, 0x65, + 0x74, 0x46, 0x63, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, + 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x2f, 0x7b, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x7d, 0x42, + 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, + 0x68, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x70, 0x73, 0x2f, 0x78, 0x61, 0x74, 0x75, 0x2d, 0x63, + 0x62, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, + 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_fct_execution_state_size_monthly_proto_rawDescOnce sync.Once + file_fct_execution_state_size_monthly_proto_rawDescData = file_fct_execution_state_size_monthly_proto_rawDesc +) + +func file_fct_execution_state_size_monthly_proto_rawDescGZIP() []byte { + file_fct_execution_state_size_monthly_proto_rawDescOnce.Do(func() { + file_fct_execution_state_size_monthly_proto_rawDescData = protoimpl.X.CompressGZIP(file_fct_execution_state_size_monthly_proto_rawDescData) + }) + return file_fct_execution_state_size_monthly_proto_rawDescData +} + +var file_fct_execution_state_size_monthly_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_fct_execution_state_size_monthly_proto_goTypes = []any{ + (*FctExecutionStateSizeMonthly)(nil), // 0: cbt.FctExecutionStateSizeMonthly + (*ListFctExecutionStateSizeMonthlyRequest)(nil), // 1: cbt.ListFctExecutionStateSizeMonthlyRequest + (*ListFctExecutionStateSizeMonthlyResponse)(nil), // 2: cbt.ListFctExecutionStateSizeMonthlyResponse + (*GetFctExecutionStateSizeMonthlyRequest)(nil), // 3: cbt.GetFctExecutionStateSizeMonthlyRequest + (*GetFctExecutionStateSizeMonthlyResponse)(nil), // 4: cbt.GetFctExecutionStateSizeMonthlyResponse + (*StringFilter)(nil), // 5: cbt.StringFilter + (*UInt32Filter)(nil), // 6: cbt.UInt32Filter + (*UInt64Filter)(nil), // 7: cbt.UInt64Filter + (*Int64Filter)(nil), // 8: cbt.Int64Filter +} +var file_fct_execution_state_size_monthly_proto_depIdxs = []int32{ + 5, // 0: cbt.ListFctExecutionStateSizeMonthlyRequest.month:type_name -> cbt.StringFilter + 6, // 1: cbt.ListFctExecutionStateSizeMonthlyRequest.updated_date_time:type_name -> cbt.UInt32Filter + 6, // 2: cbt.ListFctExecutionStateSizeMonthlyRequest.day_count:type_name -> cbt.UInt32Filter + 7, // 3: cbt.ListFctExecutionStateSizeMonthlyRequest.min_block_number:type_name -> cbt.UInt64Filter + 7, // 4: cbt.ListFctExecutionStateSizeMonthlyRequest.max_block_number:type_name -> cbt.UInt64Filter + 7, // 5: cbt.ListFctExecutionStateSizeMonthlyRequest.accounts:type_name -> cbt.UInt64Filter + 7, // 6: cbt.ListFctExecutionStateSizeMonthlyRequest.account_bytes:type_name -> cbt.UInt64Filter + 7, // 7: cbt.ListFctExecutionStateSizeMonthlyRequest.account_trienodes:type_name -> cbt.UInt64Filter + 7, // 8: cbt.ListFctExecutionStateSizeMonthlyRequest.account_trienode_bytes:type_name -> cbt.UInt64Filter + 7, // 9: cbt.ListFctExecutionStateSizeMonthlyRequest.contract_codes:type_name -> cbt.UInt64Filter + 7, // 10: cbt.ListFctExecutionStateSizeMonthlyRequest.contract_code_bytes:type_name -> cbt.UInt64Filter + 7, // 11: cbt.ListFctExecutionStateSizeMonthlyRequest.storages:type_name -> cbt.UInt64Filter + 7, // 12: cbt.ListFctExecutionStateSizeMonthlyRequest.storage_bytes:type_name -> cbt.UInt64Filter + 7, // 13: cbt.ListFctExecutionStateSizeMonthlyRequest.storage_trienodes:type_name -> cbt.UInt64Filter + 7, // 14: cbt.ListFctExecutionStateSizeMonthlyRequest.storage_trienode_bytes:type_name -> cbt.UInt64Filter + 8, // 15: cbt.ListFctExecutionStateSizeMonthlyRequest.accounts_delta:type_name -> cbt.Int64Filter + 8, // 16: cbt.ListFctExecutionStateSizeMonthlyRequest.account_bytes_delta:type_name -> cbt.Int64Filter + 8, // 17: cbt.ListFctExecutionStateSizeMonthlyRequest.storage_bytes_delta:type_name -> cbt.Int64Filter + 8, // 18: cbt.ListFctExecutionStateSizeMonthlyRequest.contract_code_bytes_delta:type_name -> cbt.Int64Filter + 7, // 19: cbt.ListFctExecutionStateSizeMonthlyRequest.total_bytes:type_name -> cbt.UInt64Filter + 0, // 20: cbt.ListFctExecutionStateSizeMonthlyResponse.fct_execution_state_size_monthly:type_name -> cbt.FctExecutionStateSizeMonthly + 0, // 21: cbt.GetFctExecutionStateSizeMonthlyResponse.item:type_name -> cbt.FctExecutionStateSizeMonthly + 1, // 22: cbt.FctExecutionStateSizeMonthlyService.List:input_type -> cbt.ListFctExecutionStateSizeMonthlyRequest + 3, // 23: cbt.FctExecutionStateSizeMonthlyService.Get:input_type -> cbt.GetFctExecutionStateSizeMonthlyRequest + 2, // 24: cbt.FctExecutionStateSizeMonthlyService.List:output_type -> cbt.ListFctExecutionStateSizeMonthlyResponse + 4, // 25: cbt.FctExecutionStateSizeMonthlyService.Get:output_type -> cbt.GetFctExecutionStateSizeMonthlyResponse + 24, // [24:26] is the sub-list for method output_type + 22, // [22:24] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_fct_execution_state_size_monthly_proto_init() } +func file_fct_execution_state_size_monthly_proto_init() { + if File_fct_execution_state_size_monthly_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_fct_execution_state_size_monthly_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*FctExecutionStateSizeMonthly); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_monthly_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ListFctExecutionStateSizeMonthlyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_monthly_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListFctExecutionStateSizeMonthlyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_monthly_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetFctExecutionStateSizeMonthlyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_fct_execution_state_size_monthly_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetFctExecutionStateSizeMonthlyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_fct_execution_state_size_monthly_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_fct_execution_state_size_monthly_proto_goTypes, + DependencyIndexes: file_fct_execution_state_size_monthly_proto_depIdxs, + MessageInfos: file_fct_execution_state_size_monthly_proto_msgTypes, + }.Build() + File_fct_execution_state_size_monthly_proto = out.File + file_fct_execution_state_size_monthly_proto_rawDesc = nil + file_fct_execution_state_size_monthly_proto_goTypes = nil + file_fct_execution_state_size_monthly_proto_depIdxs = nil +} diff --git a/pkg/proto/clickhouse/fct_execution_state_size_monthly.proto b/pkg/proto/clickhouse/fct_execution_state_size_monthly.proto new file mode 100644 index 00000000..9ee9048f --- /dev/null +++ b/pkg/proto/clickhouse/fct_execution_state_size_monthly.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; + +package cbt; + +import "common.proto"; +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "clickhouse/annotations.proto"; + +option go_package = "github.com/ethpandaops/xatu-cbt/pkg/proto/clickhouse"; +// Execution layer state size metrics aggregated by month + +message FctExecutionStateSizeMonthly { + // Timestamp when the record was last updated + uint32 updated_date_time = 11; + // First day of the month + string month = 12; + // Number of days in this month with data + uint32 day_count = 13; + // Minimum block number in this month + uint64 min_block_number = 14; + // Maximum block number in this month + uint64 max_block_number = 15; + // Total accounts at end of month + uint64 accounts = 16; + // Account bytes at end of month + uint64 account_bytes = 17; + // Account trie nodes at end of month + uint64 account_trienodes = 18; + // Account trie node bytes at end of month + uint64 account_trienode_bytes = 19; + // Contract codes at end of month + uint64 contract_codes = 20; + // Contract code bytes at end of month + uint64 contract_code_bytes = 21; + // Storage slots at end of month + uint64 storages = 22; + // Storage bytes at end of month + uint64 storage_bytes = 23; + // Storage trie nodes at end of month + uint64 storage_trienodes = 24; + // Storage trie node bytes at end of month + uint64 storage_trienode_bytes = 25; + // Account count change within the month + int64 accounts_delta = 26; + // Account bytes change within the month + int64 account_bytes_delta = 27; + // Storage bytes change within the month + int64 storage_bytes_delta = 28; + // Contract code bytes change within the month + int64 contract_code_bytes_delta = 29; + // Total state size in bytes + uint64 total_bytes = 30; +} + +// Request for listing fct_execution_state_size_monthly records +message ListFctExecutionStateSizeMonthlyRequest { + // Filter by month - First day of the month (PRIMARY KEY - required) + StringFilter month = 1 [(google.api.field_behavior) = REQUIRED, (clickhouse.v1.required_group) = "primary_key"]; + + // Filter by updated_date_time - Timestamp when the record was last updated (optional) + UInt32Filter updated_date_time = 2 [(google.api.field_behavior) = OPTIONAL]; + // Filter by day_count - Number of days in this month with data (optional) + UInt32Filter day_count = 3 [(google.api.field_behavior) = OPTIONAL]; + // Filter by min_block_number - Minimum block number in this month (optional) + UInt64Filter min_block_number = 4 [(google.api.field_behavior) = OPTIONAL]; + // Filter by max_block_number - Maximum block number in this month (optional) + UInt64Filter max_block_number = 5 [(google.api.field_behavior) = OPTIONAL]; + // Filter by accounts - Total accounts at end of month (optional) + UInt64Filter accounts = 6 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_bytes - Account bytes at end of month (optional) + UInt64Filter account_bytes = 7 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_trienodes - Account trie nodes at end of month (optional) + UInt64Filter account_trienodes = 8 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_trienode_bytes - Account trie node bytes at end of month (optional) + UInt64Filter account_trienode_bytes = 9 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_codes - Contract codes at end of month (optional) + UInt64Filter contract_codes = 10 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_code_bytes - Contract code bytes at end of month (optional) + UInt64Filter contract_code_bytes = 11 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storages - Storage slots at end of month (optional) + UInt64Filter storages = 12 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_bytes - Storage bytes at end of month (optional) + UInt64Filter storage_bytes = 13 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_trienodes - Storage trie nodes at end of month (optional) + UInt64Filter storage_trienodes = 14 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_trienode_bytes - Storage trie node bytes at end of month (optional) + UInt64Filter storage_trienode_bytes = 15 [(google.api.field_behavior) = OPTIONAL]; + // Filter by accounts_delta - Account count change within the month (optional) + Int64Filter accounts_delta = 16 [(google.api.field_behavior) = OPTIONAL]; + // Filter by account_bytes_delta - Account bytes change within the month (optional) + Int64Filter account_bytes_delta = 17 [(google.api.field_behavior) = OPTIONAL]; + // Filter by storage_bytes_delta - Storage bytes change within the month (optional) + Int64Filter storage_bytes_delta = 18 [(google.api.field_behavior) = OPTIONAL]; + // Filter by contract_code_bytes_delta - Contract code bytes change within the month (optional) + Int64Filter contract_code_bytes_delta = 19 [(google.api.field_behavior) = OPTIONAL]; + // Filter by total_bytes - Total state size in bytes (optional) + UInt64Filter total_bytes = 20 [(google.api.field_behavior) = OPTIONAL]; + + // The maximum number of fct_execution_state_size_monthly to return. + // If unspecified, at most 100 items will be returned. + // The maximum value is 10000; values above 10000 will be coerced to 10000. + int32 page_size = 21 [(google.api.field_behavior) = OPTIONAL]; + // A page token, received from a previous `ListFctExecutionStateSizeMonthly` call. + // Provide this to retrieve the subsequent page. + string page_token = 22 [(google.api.field_behavior) = OPTIONAL]; + // The order of results. Format: comma-separated list of fields. + // Example: "foo,bar" or "foo desc,bar" for descending order on foo. + // If unspecified, results will be returned in the default order. + string order_by = 23 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for listing fct_execution_state_size_monthly records +message ListFctExecutionStateSizeMonthlyResponse { + // The list of fct_execution_state_size_monthly. + repeated FctExecutionStateSizeMonthly fct_execution_state_size_monthly = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for getting a single fct_execution_state_size_monthly record by primary key +message GetFctExecutionStateSizeMonthlyRequest { + // First day of the month + string month = 1; // Primary key (required) +} + +// Response for getting a single fct_execution_state_size_monthly record +message GetFctExecutionStateSizeMonthlyResponse { + FctExecutionStateSizeMonthly item = 1; +} + +// Query fct_execution_state_size_monthly data +service FctExecutionStateSizeMonthlyService { + // List records | Retrieve paginated results with optional filtering + rpc List(ListFctExecutionStateSizeMonthlyRequest) returns (ListFctExecutionStateSizeMonthlyResponse) { + option (google.api.http) = { + get: "/api/v1/fct_execution_state_size_monthly" + }; + } + // Get record | Retrieve a single record by month + rpc Get(GetFctExecutionStateSizeMonthlyRequest) returns (GetFctExecutionStateSizeMonthlyResponse) { + option (google.api.http) = { + get: "/api/v1/fct_execution_state_size_monthly/{month}" + }; + } +}