From a2721c06873995a0e984575ced1ea6be26264a5a Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:59:45 +1000 Subject: [PATCH] feat(migrations/clickhouse): add beacon block gas fields --- .../vector-kafka-clickhouse.yaml | 10 +++++++ .../047_block_execution_payloads.down.sql | 27 +++++++++++++++++++ .../047_block_execution_payloads.up.sql | 27 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 deploy/migrations/clickhouse/047_block_execution_payloads.down.sql create mode 100644 deploy/migrations/clickhouse/047_block_execution_payloads.up.sql diff --git a/deploy/local/docker-compose/vector-kafka-clickhouse.yaml b/deploy/local/docker-compose/vector-kafka-clickhouse.yaml index 17dc91db..0ba70105 100644 --- a/deploy/local/docker-compose/vector-kafka-clickhouse.yaml +++ b/deploy/local/docker-compose/vector-kafka-clickhouse.yaml @@ -951,6 +951,11 @@ transforms: .execution_payload_block_hash = .data.message.body.execution_payload.block_hash .execution_payload_block_number = .data.message.body.execution_payload.block_number .execution_payload_fee_recipient = .data.message.body.execution_payload.fee_recipient + .execution_payload_base_fee_per_gas = .data.message.body.execution_payload.base_fee_per_gas + .execution_payload_blob_gas_used = .data.message.body.execution_payload.blob_gas_used + .execution_payload_excess_blob_gas = .data.message.body.execution_payload.excess_blob_gas + .execution_payload_gas_limit = .data.message.body.execution_payload.gas_limit + .execution_payload_gas_used = .data.message.body.execution_payload.gas_used .execution_payload_state_root = .data.message.body.execution_payload.state_root .execution_payload_parent_hash = .data.message.body.execution_payload.parent_hash .execution_payload_transactions_count = .meta.client.additional_data.transactions_count @@ -1016,6 +1021,11 @@ transforms: .execution_payload_block_hash = .data.message.body.execution_payload.block_hash .execution_payload_block_number = .data.message.body.execution_payload.block_number .execution_payload_fee_recipient = .data.message.body.execution_payload.fee_recipient + .execution_payload_base_fee_per_gas = .data.message.body.execution_payload.base_fee_per_gas + .execution_payload_blob_gas_used = .data.message.body.execution_payload.blob_gas_used + .execution_payload_excess_blob_gas = .data.message.body.execution_payload.excess_blob_gas + .execution_payload_gas_limit = .data.message.body.execution_payload.gas_limit + .execution_payload_gas_used = .data.message.body.execution_payload.gas_used .execution_payload_state_root = .data.message.body.execution_payload.state_root .execution_payload_parent_hash = .data.message.body.execution_payload.parent_hash .execution_payload_transactions_count = .meta.client.additional_data.transactions_count diff --git a/deploy/migrations/clickhouse/047_block_execution_payloads.down.sql b/deploy/migrations/clickhouse/047_block_execution_payloads.down.sql new file mode 100644 index 00000000..9aaff2b4 --- /dev/null +++ b/deploy/migrations/clickhouse/047_block_execution_payloads.down.sql @@ -0,0 +1,27 @@ +ALTER TABLE canonical_beacon_block ON CLUSTER '{cluster}' + DROP COLUMN execution_payload_base_fee_per_gas, + DROP COLUMN execution_payload_blob_gas_used, + DROP COLUMN execution_payload_excess_blob_gas, + DROP COLUMN execution_payload_gas_limit, + DROP COLUMN execution_payload_gas_used; + +ALTER TABLE canonical_beacon_block_local ON CLUSTER '{cluster}' + DROP COLUMN execution_payload_base_fee_per_gas, + DROP COLUMN execution_payload_blob_gas_used, + DROP COLUMN execution_payload_excess_blob_gas, + DROP COLUMN execution_payload_gas_limit, + DROP COLUMN execution_payload_gas_used; + +ALTER TABLE beacon_api_eth_v2_beacon_block ON CLUSTER '{cluster}' + DROP COLUMN execution_payload_base_fee_per_gas, + DROP COLUMN execution_payload_blob_gas_used, + DROP COLUMN execution_payload_excess_blob_gas, + DROP COLUMN execution_payload_gas_limit, + DROP COLUMN execution_payload_gas_used; + +ALTER TABLE beacon_api_eth_v2_beacon_block_local ON CLUSTER '{cluster}' + DROP COLUMN execution_payload_base_fee_per_gas, + DROP COLUMN execution_payload_blob_gas_used, + DROP COLUMN execution_payload_excess_blob_gas, + DROP COLUMN execution_payload_gas_limit, + DROP COLUMN execution_payload_gas_used; diff --git a/deploy/migrations/clickhouse/047_block_execution_payloads.up.sql b/deploy/migrations/clickhouse/047_block_execution_payloads.up.sql new file mode 100644 index 00000000..e1f6afd5 --- /dev/null +++ b/deploy/migrations/clickhouse/047_block_execution_payloads.up.sql @@ -0,0 +1,27 @@ +ALTER TABLE canonical_beacon_block_local ON CLUSTER '{cluster}' + ADD COLUMN execution_payload_base_fee_per_gas Nullable(UInt128) COMMENT 'Base fee per gas for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_fee_recipient, + ADD COLUMN execution_payload_blob_gas_used Nullable(UInt64) COMMENT 'Gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_base_fee_per_gas, + ADD COLUMN execution_payload_excess_blob_gas Nullable(UInt64) COMMENT 'Excess gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_blob_gas_used, + ADD COLUMN execution_payload_gas_limit Nullable(UInt64) COMMENT 'Gas limit for execution payload' CODEC(DoubleDelta, ZSTD(1)) AFTER execution_payload_excess_blob_gas, + ADD COLUMN execution_payload_gas_used Nullable(UInt64) COMMENT 'Gas used for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_gas_limit; + +ALTER TABLE canonical_beacon_block ON CLUSTER '{cluster}' + ADD COLUMN execution_payload_base_fee_per_gas Nullable(UInt128) COMMENT 'Base fee per gas for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_fee_recipient, + ADD COLUMN execution_payload_blob_gas_used Nullable(UInt64) COMMENT 'Gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_base_fee_per_gas, + ADD COLUMN execution_payload_excess_blob_gas Nullable(UInt64) COMMENT 'Excess gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_blob_gas_used, + ADD COLUMN execution_payload_gas_limit Nullable(UInt64) COMMENT 'Gas limit for execution payload' CODEC(DoubleDelta, ZSTD(1)) AFTER execution_payload_excess_blob_gas, + ADD COLUMN execution_payload_gas_used Nullable(UInt64) COMMENT 'Gas used for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_gas_limit; + +ALTER TABLE beacon_api_eth_v2_beacon_block_local ON CLUSTER '{cluster}' + ADD COLUMN execution_payload_base_fee_per_gas Nullable(UInt128) COMMENT 'Base fee per gas for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_fee_recipient, + ADD COLUMN execution_payload_blob_gas_used Nullable(UInt64) COMMENT 'Gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_base_fee_per_gas, + ADD COLUMN execution_payload_excess_blob_gas Nullable(UInt64) COMMENT 'Excess gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_blob_gas_used, + ADD COLUMN execution_payload_gas_limit Nullable(UInt64) COMMENT 'Gas limit for execution payload' CODEC(DoubleDelta, ZSTD(1)) AFTER execution_payload_excess_blob_gas, + ADD COLUMN execution_payload_gas_used Nullable(UInt64) COMMENT 'Gas used for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_gas_limit; + +ALTER TABLE beacon_api_eth_v2_beacon_block ON CLUSTER '{cluster}' + ADD COLUMN execution_payload_base_fee_per_gas Nullable(UInt128) COMMENT 'Base fee per gas for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_fee_recipient, + ADD COLUMN execution_payload_blob_gas_used Nullable(UInt64) COMMENT 'Gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_base_fee_per_gas, + ADD COLUMN execution_payload_excess_blob_gas Nullable(UInt64) COMMENT 'Excess gas used for blobs in execution payload' CODEC(ZSTD(1)) AFTER execution_payload_blob_gas_used, + ADD COLUMN execution_payload_gas_limit Nullable(UInt64) COMMENT 'Gas limit for execution payload' CODEC(DoubleDelta, ZSTD(1)) AFTER execution_payload_excess_blob_gas, + ADD COLUMN execution_payload_gas_used Nullable(UInt64) COMMENT 'Gas used for execution payload' CODEC(ZSTD(1)) AFTER execution_payload_gas_limit;