Skip to content

Commit

Permalink
adds support for debug_trace method, tx/array_index, minute based blo…
Browse files Browse the repository at this point in the history
…ck delays
  • Loading branch information
drethereum committed Jan 16, 2025
1 parent 3fa3c3b commit 906112a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ UNION ALL
SELECT
_partition_by_block_id AS partition_key,
block_number,
VALUE :"array_index" :: INT AS array_index,
COALESCE(
VALUE :"array_index" :: INT,
TRY_TO_NUMBER(
utils.udf_hex_to_int(
VALUE :"data" :"transactionIndex" :: STRING
)
)
) AS array_index,
VALUE,
DATA,
metadata,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# Set variables #}
{% set source_name = 'TRACES' %}
{% set source_name = 'DEBUG_TRACEBLOCKBYNUMBER' if var('GLOBAL_USES_SINGLE_FLIGHT_METHOD',false) else 'TRACES' %}
{% set source_version = '' %}
{% set model_type = 'FR' %}

Expand Down Expand Up @@ -37,4 +37,4 @@
balances = balances,
block_number = block_number,
uses_receipts_by_hash = uses_receipts_by_hash
) }}
) }}
13 changes: 8 additions & 5 deletions models/main_package/core/streamline/streamline__blocks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
) }}

SELECT
_id AS block_number,
utils.udf_int_to_hex(_id) AS block_number_hex
_id,
(
({{ var('GLOBAL_BLOCKS_PER_HOUR',0) }} / 60) * {{ var('GLOBAL_CHAINHEAD_DELAY',3) }}
) :: INT AS block_number_delay, --minute-based block delay
(_id - block_number_delay) :: INT AS block_number,
utils.udf_int_to_hex(block_number) AS block_number_hex
FROM
{{ ref('utils__number_sequence') }}
{{ ref('silver__number_sequence') }}
WHERE
_id <= (
SELECT
Expand All @@ -29,5 +33,4 @@ WHERE
)
FROM
{{ ref("streamline__get_chainhead") }}
)
and _id > 0
)
1 change: 1 addition & 0 deletions models/sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sources:
- name: receipts_v2
- name: traces
- name: traces_v2
- name: debug_traceblockbynumber
- name: confirm_blocks
- name: confirm_blocks_v2
- name: decoded_logs
Expand Down

0 comments on commit 906112a

Please sign in to comment.