From c4353f0c12be9ed06cb957a1e1e216cd675db85a Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 13:23:52 -0500
Subject: [PATCH 01/32] draft
---
.../models/code/enriched_traces.py | 0
.../models/code/enriched_transaction.py | 25 +++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 src/op_analytics/datapipeline/models/code/enriched_traces.py
create mode 100644 src/op_analytics/datapipeline/models/code/enriched_transaction.py
diff --git a/src/op_analytics/datapipeline/models/code/enriched_traces.py b/src/op_analytics/datapipeline/models/code/enriched_traces.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/src/op_analytics/datapipeline/models/code/enriched_transaction.py b/src/op_analytics/datapipeline/models/code/enriched_transaction.py
new file mode 100644
index 00000000000..8e32746f91e
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/enriched_transaction.py
@@ -0,0 +1,25 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=["ingestion/transactions_v1", "ingestion/blocks_v1"],
+ expected_outputs=["enriched_transactions_v1"],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="transaction_fees",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="enriched_transactions",
+ context={},
+ ),
+ ],
+)
+def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+ return {
+ "enriched_transactions_v1": duckdb_client.view("enriched_transactions"),
+ }
From 5ff10a9c84767a3fda4a22589b024f6ac237617c Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 13:24:05 -0500
Subject: [PATCH 02/32] adds
---
.../models/code/enriched_traces.py | 29 +++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/op_analytics/datapipeline/models/code/enriched_traces.py b/src/op_analytics/datapipeline/models/code/enriched_traces.py
index e69de29bb2d..7ccfe3854f2 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_traces.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_traces.py
@@ -0,0 +1,29 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=["ingestion/traces_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
+ expected_outputs=["enriched_traces_v1"],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="transaction_fees",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="enriched_transactions",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="enriched_traces",
+ context={},
+ ),
+ ],
+)
+def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+ return {
+ "enriched_traces_v1": duckdb_client.view("enriched_traces"),
+ }
From a2eade6ef0b993779a9068c74314dcd96d89e51d Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 13:35:09 -0500
Subject: [PATCH 03/32] fix func names
---
.../datapipeline/models/code/enriched_transaction.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/op_analytics/datapipeline/models/code/enriched_transaction.py b/src/op_analytics/datapipeline/models/code/enriched_transaction.py
index 8e32746f91e..5c66f14ee75 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_transaction.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_transaction.py
@@ -19,7 +19,7 @@
),
],
)
-def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def enriched_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
"enriched_transactions_v1": duckdb_client.view("enriched_transactions"),
}
From ee2d62d9785b17f70d04e2dd52280b08e59383a0 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:28:43 -0500
Subject: [PATCH 04/32] init push
---
.../models/code/enriched_traces.py | 6 +-
...ransaction.py => enriched_transactions.py} | 6 +-
.../datapipeline/models/compute/udfs.py | 21 +++-
.../models/templates/enriched_traces.sql.j2 | 117 ++++++++++++++++++
.../templates/enriched_transactions.sql.j2 | 68 ++++++++++
5 files changed, 207 insertions(+), 11 deletions(-)
rename src/op_analytics/datapipeline/models/code/{enriched_transaction.py => enriched_transactions.py} (84%)
create mode 100644 src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
diff --git a/src/op_analytics/datapipeline/models/code/enriched_traces.py b/src/op_analytics/datapipeline/models/code/enriched_traces.py
index 7ccfe3854f2..bf1cc737bc2 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_traces.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_traces.py
@@ -9,10 +9,6 @@
input_datasets=["ingestion/traces_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
expected_outputs=["enriched_traces_v1"],
auxiliary_views=[
- TemplatedSQLQuery(
- template_name="transaction_fees",
- context={},
- ),
TemplatedSQLQuery(
template_name="enriched_transactions",
context={},
@@ -23,7 +19,7 @@
),
],
)
-def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def enriched_traces(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
"enriched_traces_v1": duckdb_client.view("enriched_traces"),
}
diff --git a/src/op_analytics/datapipeline/models/code/enriched_transaction.py b/src/op_analytics/datapipeline/models/code/enriched_transactions.py
similarity index 84%
rename from src/op_analytics/datapipeline/models/code/enriched_transaction.py
rename to src/op_analytics/datapipeline/models/code/enriched_transactions.py
index 5c66f14ee75..7ad485f6720 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_transaction.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_transactions.py
@@ -9,10 +9,6 @@
input_datasets=["ingestion/transactions_v1", "ingestion/blocks_v1"],
expected_outputs=["enriched_transactions_v1"],
auxiliary_views=[
- TemplatedSQLQuery(
- template_name="transaction_fees",
- context={},
- ),
TemplatedSQLQuery(
template_name="enriched_transactions",
context={},
@@ -21,5 +17,5 @@
)
def enriched_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "enriched_transactions_v1": duckdb_client.view("enriched_transactions"),
+ "enriched_transactions_v1": duckdb_client.view("enriched_transactions.sql"),
}
diff --git a/src/op_analytics/datapipeline/models/compute/udfs.py b/src/op_analytics/datapipeline/models/compute/udfs.py
index 23a57a55a4c..6bba9c1566c 100644
--- a/src/op_analytics/datapipeline/models/compute/udfs.py
+++ b/src/op_analytics/datapipeline/models/compute/udfs.py
@@ -15,6 +15,9 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
CREATE OR REPLACE MACRO wei_to_gwei(a)
AS a::DECIMAL(28, 0) * 0.000000001::DECIMAL(10, 10);
+
+ CREATE OR REPLACE MACRO gwei_to_eth(a)
+ AS wei_to_gwei(a);
CREATE OR REPLACE MACRO safe_div(a, b) AS
IF(b = 0, NULL, a / b);
@@ -34,7 +37,23 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
--Get the length in bytes for binary data that is encoded as a hex string
CREATE OR REPLACE MACRO hexstr_bytelen(x)
- AS (length(x) - 2) / 2
+ AS (length(x) - 2) / 2;
+
+ --Count non-zero bytes for binary data that is encoded as a hex string. We don't use hexstr_bytelen because we need to substring the input data.
+ CREATE OR REPLACE MACRO hexstr_nonzero_bytes(x)
+ AS length( REPLACE(TO_HEX(FROM_HEX(SUBSTR(x, 3))), '00', '') ) / 2;
+
+ --Count non-zero bytes for binary data that is encoded as a hex string
+ CREATE OR REPLACE MACRO hexstr_zero_bytes(x)
+ AS hexstr_bytelen(x) - hexstr_nonzero_bytes(x);
+
+ --Calculate calldata gas used for binary data that is encoded as a hex string (can be updated by an EIP)
+ CREATE OR REPLACE MACRO hexstr_calldata_gas(x)
+ AS 16*hexstr_nonzero_bytes(x) + 4*hexstr_zero_bytes(x);
+
+ --Get the method id for input data. This is the first 4 bytes, or first 10 string characters for binary data that is encoded as a hex string.
+ CREATE OR REPLACE MACRO hexstr_method_id(x)
+ AS substring(x,1,10);
""")
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
new file mode 100644
index 00000000000..49a80064773
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
@@ -0,0 +1,117 @@
+WITH
+
+pb AS (
+ SELECT
+ number,
+ base_fee_per_gas
+ FROM
+ enriched_transasctions_v1
+),
+
+-- Select the columns that we want from transactions joined to blocks.
+-- Include some minor transformations that are needed for further calculations.
+base_level_traces AS (
+ SELECT
+ -- Raw Trace fields
+ r.*,
+ -- Computed Trace Fields
+ hexstr_method_id(r.input) AS trace_method_id,
+ -- Find the next level up in the trace tree, so that we can subtract out subtract gas.
+ CASE WHEN trace_address IS NULL OR trace_address = '' THEN '-1' --if trace address is null, we don't want to go uplevel
+ ELSE
+ CASE
+ WHEN LENGTH(trace_address) - LENGTH(REPLACE(trace_address, ',', '')) = 0 THEN trace_address
+ ELSE SUBSTR(trace_address, 1, LENGTH(trace_address) - LENGTH(SPLIT(trace_address, ',')[ORDINAL(ARRAY_LENGTH(SPLIT(trace_address, ',')))]) - 1)
+ END
+ END AS trace_address_uplevel,
+ -- Raw Transaction Fields
+ t.receipt_gas_used AS transaction_gas_used,
+ t.receipt_l1_gas_used AS transaction_l1_gas_used,
+ t.from_address AS transaction_from_address,
+ t.to_address AS transaction_to_address,
+ t.receipt_gas_used AS transaction_gas_used,
+ t.derived_l1_gas_used AS transaction_l1_gas_used
+ -- Computed Transaction Fee Fields
+ total_gas_fee_native AS transaction_total_gas_fee_native,
+ l1_fee_native AS transaction_l1_fee_native,
+ l2_fee_native AS transaction_l2_fee_native,
+ l2_priority_fee_native AS transaction_l2_priority_fee_native,
+ l2_base_fee_native AS transaction_l2_base_fee_native,
+ transaction_method_id,
+ -- Computed Transaction Gas Price Fields
+ l2_gas_price_gwei,
+ l2_base_gas_price_gwei,
+ l2_priority_gas_price_gwei,
+ l1_base_gas_price_gwei,
+ l1_blob_base_gas_price_gwei,
+
+ hexstr_method_id(t.input) AS transaction_method_id,
+ hexstr_method_id(r.input) AS trace_method_id,
+ ---
+ toDecimal128(t.receipt_l1_gas_price, 18) / 1e9 AS transaction_l1_gas_price_gwei,
+ toDecimal128(t.gas_price, 18) / 1e9 AS transaction_gas_price_gwei,
+ toDecimal128(b.base_fee_per_gas, 18) / 1e9 AS transaction_base_gas_price_gwei,
+ (toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) / 1e9 AS transaction_priority_gas_price_gwei,
+ ---
+ toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_gas_fee_native,
+ toDecimal128(t.receipt_l1_fee, 18) / 1e18 AS transaction_l1_fee_native,
+ toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_l2_fee_native,
+ (toDecimal128(b.base_fee_per_gas, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_base_fee_native,
+ ((toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_priority_fee_native
+
+ FROM traces_v1 r
+ INNER JOIN enriched_transasctions_v1 t
+ ON r.block_number = t.block_number
+ AND r.transaction_hash = t.hash
+
+ WHERE r.trace_type = 'call'
+)
+
+ --get amount of calls per transcation, to use for amortizing
+, get_traces_per_tansaction AS (
+ SELECT block_number, block_timestamp, transaction_hash
+ , COUNT(*) AS count_traces_in_transaction
+ FROM base_level_traces
+ GROUP BY 1,2,3
+)
+
+ --get subtrace gas used, for isolating each call
+, get_subtraces_gas_per_trace AS (
+ SELECT block_number, block_timestamp, transaction_hash, trace_address_uplevel
+ , SUM(trace_gas_used) AS gas_used_in_subtraces, COUNT(*) AS count_subtraces
+ FROM base_level_traces
+ GROUP BY 1,2,3,4
+)
+
+
+SELECT
+bl.*
+--
+, st.gas_used_in_subtraces AS gas_used_in_subtraces
+, tpt.count_traces_in_transaction AS count_traces_in_transaction
+--
+, bl.trace_gas_used - st.gas_used_in_subtraces AS trace_gas_used_minus_subtraces
+
+-- the subtraces will never add up to part of whole, but leave as is
+, (bl.trace_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.transaction_gas_price_gwei) AS trace_l2_fee_native_minus_subtraces
+, (bl.trace_gas_used - st.gas_used_in_subtraces) * bl.transaction_base_gas_price_gwei/1e9 AS trace_base_fee_native_minus_subtraces
+, (bl.trace_gas_used - st.gas_used_in_subtraces) * bl.transaction_priority_gas_price_gwei/1e9 AS trace_priority_fee_native_minus_subtraces
+--
+, (bl.transaction_gas_used) / tpt.count_traces AS transaction_gas_used_per_call_amortized
+, (bl.transaction_l1_gas_used) / tpt.count_traces AS transaction_l1_gas_used_per_call_amortized
+
+, bl.transaction_gas_fee_native / tpt.count_traces AS transaction_gas_fee_native_per_call_amortized
+, bl.transaction_l2_fee_native / tpt.count_traces AS transaction_l2_fee_native_per_call_amortized
+, bl.transaction_l1_fee_native / tpt.count_traces AS transaction_l1_fee_native_per_call_amortized
+, bl.transaction_base_fee_native / tpt.count_traces AS transaction_base_fee_native_per_call_amortized
+, bl.transaction_priority_fee_native / tpt.count_traces AS transaction_priority_fee_native_per_call_amortized
+
+
+FROM base_level_traces bl
+INNER JOIN get_traces_per_tansaction tpt -- join on txn level
+ ON bl.block_number = tpt.block_number
+ AND bl.transaction_hash = tpt.transaction_hash
+LEFT JOIN get_subtraces_gas_per_trace st -- join on trace level 1 level down
+ ON bl.block_number = st.block_number
+ AND bl.transaction_hash = st.transaction_hash
+ AND bl.trace_address = st.trace_address_uplevel
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
new file mode 100644
index 00000000000..989db7893db
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
@@ -0,0 +1,68 @@
+WITH
+
+pb AS (
+ SELECT
+ number,
+ base_fee_per_gas
+ FROM
+ ingestion_blocks_v1
+),
+
+-- Select the columns that we want from transactions joined to blocks.
+-- Include some minor transformations that are needed for further calculations.
+base_level_transactions AS (
+ SELECT
+ -- Raw Transaction fields
+ t.*,
+ -- Fees
+ CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END AS total_gas_fee_native
+ CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee) END AS l1_fee_native,
+ wei_to_eth(t.gas_price * t.receipt_gas_used) AS l2_fee_native,
+ CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth((t.gas_price - b.base_fee_per_gas) * t.receipt_gas_used) END AS l2_priority_fee_native,
+ CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth(b.base_fee_per_gas * t.receipt_gas_used) END AS l2_base_fee_native,
+ -- Gas Prices
+ wei_to_gwei(b.gas_price) AS l2_gas_price_gwei,
+ wei_to_gwei(b.base_fee_per_gas) AS l2_base_gas_price_gwei,
+ wei_to_gwei(t.gas_price - b.base_fee_per_gas) AS l2_priority_gas_price_gwei,
+
+ wei_to_gwei(t.receipt_l1_gas_price) AS l1_base_gas_price_gwei,
+ wei_to_gwei(t.receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei,
+ -- L1 Fee BASE and BLOB scalars
+ coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
+ AS l1_base_scalar,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
+
+ -- Transaction Attributes
+ hexstr_bytelen(t.input) AS input_byte_length,
+ hexstr_bytelen(t.input) AS input_calldata_gas,
+ hexstr_method_id(t.input) AS method_id,
+ transaction_type = 126 AS is_system_transaction,
+ ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ transaction_type = 126
+ AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
+ AND to_address = lower('0x4200000000000000000000000000000000000015')
+ ) AS is_attributes_deposited_transaction,
+
+ -- Convenience columns
+ epoch_to_hour(t.block_timestamp) AS block_hour,
+ t.receipt_status = 1 AS success,
+ FROM ingestion_transactions_v1 AS t
+ INNER JOIN pb AS b ON t.block_number = b.number
+ WHERE 1=1
+ -- Optional address filter for faster results when developing.
+ -- AND from_address LIKE '0x00%'
+),
+
+
+-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+
+ SELECT
+ *,
+ coalesce(
+ receipt_l1_gas_used,
+ round(16 * l1_fee / (
+ (l1_base_scalar * receipt_l1_gas_price)
+ + (l1_blob_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ ) AS derived_l1_gas_used
+ FROM base_level_transactions
From ebeb470bd76903258a17f183dd70ccfdb4259e8b Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:35:38 -0500
Subject: [PATCH 05/32] push example aggregation
---
.../models/code/daily_transactions_to.py | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 src/op_analytics/datapipeline/models/code/daily_transactions_to.py
diff --git a/src/op_analytics/datapipeline/models/code/daily_transactions_to.py b/src/op_analytics/datapipeline/models/code/daily_transactions_to.py
new file mode 100644
index 00000000000..f81d94cfa25
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/daily_transactions_to.py
@@ -0,0 +1,26 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=["intermediate/enriched_transactions_v1"],
+ expected_outputs=["daily_transactions_to_v1"],
+ # TODO: Uncomment if we do this as a view (or some element as a view)
+ # auxiliary_views=[
+ # TemplatedSQLQuery(
+ # template_name="daily_transactions_to",
+ # context={},
+ # ),
+ # ],
+)
+def daily_transactions_to(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+ return {
+ "daily_transactions_to_v1": duckdb_client.view(
+ """
+ TODO: AGGREGATION CODE
+ """
+ ),
+ }
From cc12c72078e574a3f9d7530e3e01a9377aab303a Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 20:25:53 -0500
Subject: [PATCH 06/32] mod
---
...ily_transactions_to.py => daily_transactions_by_to.py} | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
rename src/op_analytics/datapipeline/models/code/{daily_transactions_to.py => daily_transactions_by_to.py} (70%)
diff --git a/src/op_analytics/datapipeline/models/code/daily_transactions_to.py b/src/op_analytics/datapipeline/models/code/daily_transactions_by_to.py
similarity index 70%
rename from src/op_analytics/datapipeline/models/code/daily_transactions_to.py
rename to src/op_analytics/datapipeline/models/code/daily_transactions_by_to.py
index f81d94cfa25..d62ad997f3b 100644
--- a/src/op_analytics/datapipeline/models/code/daily_transactions_to.py
+++ b/src/op_analytics/datapipeline/models/code/daily_transactions_by_to.py
@@ -7,18 +7,18 @@
@register_model(
input_datasets=["intermediate/enriched_transactions_v1"],
- expected_outputs=["daily_transactions_to_v1"],
+ expected_outputs=["daily_transactions_by_to_v1"],
# TODO: Uncomment if we do this as a view (or some element as a view)
# auxiliary_views=[
# TemplatedSQLQuery(
- # template_name="daily_transactions_to",
+ # template_name="daily_transactions_by_to",
# context={},
# ),
# ],
)
-def daily_transactions_to(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def daily_transactions_by_to(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "daily_transactions_to_v1": duckdb_client.view(
+ "daily_transactions_by_to_v1": duckdb_client.view(
"""
TODO: AGGREGATION CODE
"""
From 443e6c48fcd2f2cfd3b137eb220380ed93bed4b3 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 20:48:20 -0500
Subject: [PATCH 07/32] mods
---
.../datapipeline/models/code/enriched_logs.py | 21 +++++
.../datapipeline/models/compute/udfs.py | 25 ++++++
.../models/templates/enriched_logs.sql.j2 | 67 ++++++++++++++++
.../models/templates/enriched_traces.sql.j2 | 78 ++++++++++---------
.../templates/enriched_transactions.sql.j2 | 12 +--
5 files changed, 162 insertions(+), 41 deletions(-)
create mode 100644 src/op_analytics/datapipeline/models/code/enriched_logs.py
create mode 100644 src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2
diff --git a/src/op_analytics/datapipeline/models/code/enriched_logs.py b/src/op_analytics/datapipeline/models/code/enriched_logs.py
new file mode 100644
index 00000000000..56adc562069
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/enriched_logs.py
@@ -0,0 +1,21 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
+ expected_outputs=["enriched_logs_v1"],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="enriched_logs",
+ context={},
+ ),
+ ],
+)
+def enriched_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+ return {
+ "enriched_logs_v1": duckdb_client.view("enriched_logs.sql"),
+ }
diff --git a/src/op_analytics/datapipeline/models/compute/udfs.py b/src/op_analytics/datapipeline/models/compute/udfs.py
index 6bba9c1566c..740ebc1dc09 100644
--- a/src/op_analytics/datapipeline/models/compute/udfs.py
+++ b/src/op_analytics/datapipeline/models/compute/udfs.py
@@ -30,6 +30,10 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
-- Truncate a timestamp to hour.
CREATE OR REPLACE MACRO epoch_to_hour(a) AS
date_trunc('hour', make_timestamp(a * 1000000::BIGINT));
+
+ -- Truncate a timestamp to day.
+ CREATE OR REPLACE MACRO epoch_to_day(a) AS
+ date_trunc('day', make_timestamp(a * 1000000::BIGINT));
-- Division by 16 for DECIMAL types.
CREATE OR REPLACE MACRO div16(a)
@@ -54,6 +58,27 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
--Get the method id for input data. This is the first 4 bytes, or first 10 string characters for binary data that is encoded as a hex string.
CREATE OR REPLACE MACRO hexstr_method_id(x)
AS substring(x,1,10);
+
+ -- TODO: Is there some way that we could or should pass in the alias for each table?
+ -- Calculate total gas fee in native units, given transactions t and blocks b
+ CREATE OR REPLACE MACRO total_gas_fee_native()
+ AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END;
+
+ -- Calculate l2 base fee gas fee in native units, given transactions t and blocks b
+ CREATE OR REPLACE MACRO l2_base_gas_fee_native()
+ AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END;
+
+ -- Calculate l2 priority fee gas fee in native units, given transactions t and blocks b
+ CREATE OR REPLACE MACRO l2_priority_gas_fee_native()
+ AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END;
+
+ -- Calculate l1 data fee gas fee in native units, given transactions t and blocks b
+ CREATE OR REPLACE MACRO l2_gas_fee_native()
+ AS wei_to_eth(t.gas_price * t.receipt_gas_used
+
+ -- Calculate l1 data fee gas fee in native units, given transactions t and blocks b
+ CREATE OR REPLACE MACRO l1_gas_fee_native()
+ AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee) END
""")
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2
new file mode 100644
index 00000000000..69fc8fc33c5
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2
@@ -0,0 +1,67 @@
+WITH
+
+pb AS (
+ SELECT
+ number,
+ base_fee_per_gas
+ FROM
+ ingestion_blocks_v1
+),
+
+-- Select the columns that we want from logs joined to blocks and transactions.
+-- Include some minor transformations that are needed for further calculations.
+base_level_logs AS (
+ SELECT
+ -- Raw Logs fields
+ l.*,
+ -- Raw Transaction Fields
+ t.receipt_gas_used AS tx_gas_used,
+ t.receipt_l1_gas_used AS tx_l1_gas_used,
+ t.from_address AS tx_from_address,
+ t.to_address AS tx_to_address,
+ t.receipt_gas_used AS tx_gas_used,
+ t.derived_l1_gas_used AS tx_l1_gas_used
+ -- Fees
+ total_gas_fee_native() AS total_gas_fee_native
+ l1_gas_fee_native() END AS l1_fee_native,
+ l2_gas_fee_native() AS l2_fee_native,
+ l2_priority_gas_fee_native() AS l2_priority_fee_native,
+ l2_base_gas_fee_native() AS l2_base_fee_native,
+ -- Gas Prices
+ wei_to_gwei(b.gas_price) AS l2_gas_price_gwei,
+ wei_to_gwei(b.base_fee_per_gas) AS l2_base_gas_price_gwei,
+ wei_to_gwei(t.gas_price - b.base_fee_per_gas) AS l2_priority_gas_price_gwei,
+
+ wei_to_gwei(t.receipt_l1_gas_price) AS l1_base_gas_price_gwei,
+ wei_to_gwei(t.receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei,
+ -- L1 Fee BASE and BLOB scalars
+ coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
+ AS l1_base_scalar,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
+
+ -- Convenience columns
+ epoch_to_hour(t.block_timestamp) AS block_hour,
+ epoch_to_day(t.block_timestamp) AS block_date,
+ t.receipt_status = 1 AS success,
+
+ FROM ingestion_logs_v1 AS l
+ INNER JOIN ingestion_transactions_v1 AS t
+ INNER JOIN pb AS b ON t.block_number = b.number
+ WHERE 1=1
+ -- Optional address filter for faster results when developing.
+ -- AND from_address LIKE '0x00%'
+),
+
+
+-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+
+ SELECT
+ *,
+ coalesce(
+ receipt_l1_gas_used,
+ round(16 * l1_fee / (
+ (l1_base_scalar * receipt_l1_gas_price)
+ + (l1_blob_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ ) AS derived_l1_gas_used
+ FROM base_level_transactions
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
index 49a80064773..ad0d0bb0b7c 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
@@ -15,7 +15,7 @@ base_level_traces AS (
-- Raw Trace fields
r.*,
-- Computed Trace Fields
- hexstr_method_id(r.input) AS trace_method_id,
+ hexstr_method_id(r.input) AS trc_method_id,
-- Find the next level up in the trace tree, so that we can subtract out subtract gas.
CASE WHEN trace_address IS NULL OR trace_address = '' THEN '-1' --if trace address is null, we don't want to go uplevel
ELSE
@@ -25,19 +25,19 @@ base_level_traces AS (
END
END AS trace_address_uplevel,
-- Raw Transaction Fields
- t.receipt_gas_used AS transaction_gas_used,
- t.receipt_l1_gas_used AS transaction_l1_gas_used,
- t.from_address AS transaction_from_address,
- t.to_address AS transaction_to_address,
- t.receipt_gas_used AS transaction_gas_used,
- t.derived_l1_gas_used AS transaction_l1_gas_used
+ t.receipt_gas_used AS tx_gas_used,
+ t.receipt_l1_gas_used AS tx_l1_gas_used,
+ t.from_address AS tx_from_address,
+ t.to_address AS tx_to_address,
+ t.receipt_gas_used AS tx_gas_used,
+ t.derived_l1_gas_used AS tx_l1_gas_used
-- Computed Transaction Fee Fields
- total_gas_fee_native AS transaction_total_gas_fee_native,
- l1_fee_native AS transaction_l1_fee_native,
- l2_fee_native AS transaction_l2_fee_native,
- l2_priority_fee_native AS transaction_l2_priority_fee_native,
- l2_base_fee_native AS transaction_l2_base_fee_native,
- transaction_method_id,
+ total_gas_fee_native AS tx_total_gas_fee_native,
+ l1_fee_native AS tx_l1_fee_native,
+ l2_fee_native AS tx_l2_fee_native,
+ l2_priority_fee_native AS tx_l2_priority_fee_native,
+ l2_base_fee_native AS tx_l2_base_fee_native,
+ tx_method_id,
-- Computed Transaction Gas Price Fields
l2_gas_price_gwei,
l2_base_gas_price_gwei,
@@ -45,19 +45,25 @@ base_level_traces AS (
l1_base_gas_price_gwei,
l1_blob_base_gas_price_gwei,
- hexstr_method_id(t.input) AS transaction_method_id,
- hexstr_method_id(r.input) AS trace_method_id,
+ hexstr_method_id(t.input) AS tx_method_id,
+ hexstr_method_id(r.input) AS trc_method_id,
---
- toDecimal128(t.receipt_l1_gas_price, 18) / 1e9 AS transaction_l1_gas_price_gwei,
- toDecimal128(t.gas_price, 18) / 1e9 AS transaction_gas_price_gwei,
- toDecimal128(b.base_fee_per_gas, 18) / 1e9 AS transaction_base_gas_price_gwei,
- (toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) / 1e9 AS transaction_priority_gas_price_gwei,
+ toDecimal128(t.receipt_l1_gas_price, 18) / 1e9 AS tx_l1_gas_price_gwei,
+ toDecimal128(t.gas_price, 18) / 1e9 AS tx_gas_price_gwei,
+ toDecimal128(b.base_fee_per_gas, 18) / 1e9 AS tx_base_gas_price_gwei,
+ (toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) / 1e9 AS tx_priority_gas_price_gwei,
---
- toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_gas_fee_native,
- toDecimal128(t.receipt_l1_fee, 18) / 1e18 AS transaction_l1_fee_native,
- toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_l2_fee_native,
- (toDecimal128(b.base_fee_per_gas, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_base_fee_native,
- ((toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS transaction_priority_fee_native
+ toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_gas_fee_native,
+ toDecimal128(t.receipt_l1_fee, 18) / 1e18 AS tx_l1_fee_native,
+ toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_l2_fee_native,
+ (toDecimal128(b.base_fee_per_gas, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_base_fee_native,
+ ((toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_priority_fee_native
+
+ -- Convenience columns
+ epoch_to_hour(t.block_timestamp) AS block_hour,
+ epoch_to_day(t.block_timestamp) AS block_date,
+ t.receipt_status = 1 AS tx_success,
+ t.receipt_status = 1 AS trc_success,
FROM traces_v1 r
INNER JOIN enriched_transasctions_v1 t
@@ -78,7 +84,7 @@ base_level_traces AS (
--get subtrace gas used, for isolating each call
, get_subtraces_gas_per_trace AS (
SELECT block_number, block_timestamp, transaction_hash, trace_address_uplevel
- , SUM(trace_gas_used) AS gas_used_in_subtraces, COUNT(*) AS count_subtraces
+ , SUM(trc_gas_used) AS gas_used_in_subtraces, COUNT(*) AS count_subtraces
FROM base_level_traces
GROUP BY 1,2,3,4
)
@@ -90,21 +96,21 @@ bl.*
, st.gas_used_in_subtraces AS gas_used_in_subtraces
, tpt.count_traces_in_transaction AS count_traces_in_transaction
--
-, bl.trace_gas_used - st.gas_used_in_subtraces AS trace_gas_used_minus_subtraces
+, bl.trc_gas_used - st.gas_used_in_subtraces AS trc_gas_used_minus_subtraces
-- the subtraces will never add up to part of whole, but leave as is
-, (bl.trace_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.transaction_gas_price_gwei) AS trace_l2_fee_native_minus_subtraces
-, (bl.trace_gas_used - st.gas_used_in_subtraces) * bl.transaction_base_gas_price_gwei/1e9 AS trace_base_fee_native_minus_subtraces
-, (bl.trace_gas_used - st.gas_used_in_subtraces) * bl.transaction_priority_gas_price_gwei/1e9 AS trace_priority_fee_native_minus_subtraces
+, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_gas_price_gwei) AS trc_l2_fee_native_minus_subtraces
+, (bl.trc_gas_used - st.gas_used_in_subtraces) * bl.tx_base_gas_price_gwei/1e9 AS trc_base_fee_native_minus_subtraces
+, (bl.trc_gas_used - st.gas_used_in_subtraces) * bl.tx_priority_gas_price_gwei/1e9 AS trc_priority_fee_native_minus_subtraces
--
-, (bl.transaction_gas_used) / tpt.count_traces AS transaction_gas_used_per_call_amortized
-, (bl.transaction_l1_gas_used) / tpt.count_traces AS transaction_l1_gas_used_per_call_amortized
+, (bl.tx_gas_used) / tpt.count_traces AS tx_gas_used_per_call_amortized
+, (bl.tx_l1_gas_used) / tpt.count_traces AS tx_l1_gas_used_per_call_amortized
-, bl.transaction_gas_fee_native / tpt.count_traces AS transaction_gas_fee_native_per_call_amortized
-, bl.transaction_l2_fee_native / tpt.count_traces AS transaction_l2_fee_native_per_call_amortized
-, bl.transaction_l1_fee_native / tpt.count_traces AS transaction_l1_fee_native_per_call_amortized
-, bl.transaction_base_fee_native / tpt.count_traces AS transaction_base_fee_native_per_call_amortized
-, bl.transaction_priority_fee_native / tpt.count_traces AS transaction_priority_fee_native_per_call_amortized
+, bl.tx_gas_fee_native / tpt.count_traces AS tx_gas_fee_native_per_call_amortized
+, bl.tx_l2_fee_native / tpt.count_traces AS tx_l2_fee_native_per_call_amortized
+, bl.tx_l1_fee_native / tpt.count_traces AS tx_l1_fee_native_per_call_amortized
+, bl.tx_base_fee_native / tpt.count_traces AS tx_base_fee_native_per_call_amortized
+, bl.tx_priority_fee_native / tpt.count_traces AS tx_priority_fee_native_per_call_amortized
FROM base_level_traces bl
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
index 989db7893db..e160f72a3db 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
@@ -15,11 +15,12 @@ base_level_transactions AS (
-- Raw Transaction fields
t.*,
-- Fees
- CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END AS total_gas_fee_native
- CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee) END AS l1_fee_native,
- wei_to_eth(t.gas_price * t.receipt_gas_used) AS l2_fee_native,
- CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth((t.gas_price - b.base_fee_per_gas) * t.receipt_gas_used) END AS l2_priority_fee_native,
- CASE WHEN gas_price = 0 THEN 0 ELSE wei_to_eth(b.base_fee_per_gas * t.receipt_gas_used) END AS l2_base_fee_native,
+ total_gas_fee_native() AS total_gas_fee_native
+ l1_gas_fee_native() END AS l1_fee_native,
+ l2_gas_fee_native() AS l2_fee_native,
+ l2_priority_gas_fee_native() AS l2_priority_fee_native,
+ l2_base_gas_fee_native() AS l2_base_fee_native,
+ -- TODO: Separate L1 Fee in to Blobs vs L1 Fee Contribution - TBD if we do this here or in the next step
-- Gas Prices
wei_to_gwei(b.gas_price) AS l2_gas_price_gwei,
wei_to_gwei(b.base_fee_per_gas) AS l2_base_gas_price_gwei,
@@ -45,6 +46,7 @@ base_level_transactions AS (
-- Convenience columns
epoch_to_hour(t.block_timestamp) AS block_hour,
+ epoch_to_day(t.block_timestamp) AS block_date,
t.receipt_status = 1 AS success,
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b ON t.block_number = b.number
From b33ee035f1b01ed280ed6c32e3155625faf3df75 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 21:55:25 -0500
Subject: [PATCH 08/32] juice it up
---
...ched_traces.py => enriched_trace_calls.py} | 8 +--
.../models/code/enriched_transactions.py | 6 +-
...logs.py => event_emitting_transactions.py} | 10 +--
.../models/templates/enriched_logs.sql.j2 | 67 -------------------
...ces.sql.j2 => enriched_trace_calls.sql.j2} | 36 +++++-----
.../templates/enriched_transactions.sql.j2 | 36 ++++++----
.../event_emitting_transactions_list.sql.j2 | 41 ++++++++++++
7 files changed, 94 insertions(+), 110 deletions(-)
rename src/op_analytics/datapipeline/models/code/{enriched_traces.py => enriched_trace_calls.py} (69%)
rename src/op_analytics/datapipeline/models/code/{enriched_logs.py => event_emitting_transactions.py} (50%)
delete mode 100644 src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2
rename src/op_analytics/datapipeline/models/templates/{enriched_traces.sql.j2 => enriched_trace_calls.sql.j2} (75%)
create mode 100644 src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
diff --git a/src/op_analytics/datapipeline/models/code/enriched_traces.py b/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
similarity index 69%
rename from src/op_analytics/datapipeline/models/code/enriched_traces.py
rename to src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
index bf1cc737bc2..d2cd3863423 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_traces.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
@@ -7,19 +7,19 @@
@register_model(
input_datasets=["ingestion/traces_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
- expected_outputs=["enriched_traces_v1"],
+ expected_outputs=["enriched_trace_calls_v1"],
auxiliary_views=[
TemplatedSQLQuery(
template_name="enriched_transactions",
context={},
),
TemplatedSQLQuery(
- template_name="enriched_traces",
+ template_name="enriched_trace_calls",
context={},
),
],
)
-def enriched_traces(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def enriched_trace_calls(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "enriched_traces_v1": duckdb_client.view("enriched_traces"),
+ "enriched_trace_calls_v1": duckdb_client.view("enriched_trace_calls"),
}
diff --git a/src/op_analytics/datapipeline/models/code/enriched_transactions.py b/src/op_analytics/datapipeline/models/code/enriched_transactions.py
index 7ad485f6720..b6b4b8be96a 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_transactions.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_transactions.py
@@ -9,6 +9,10 @@
input_datasets=["ingestion/transactions_v1", "ingestion/blocks_v1"],
expected_outputs=["enriched_transactions_v1"],
auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="event_emitting_transactions",
+ context={},
+ ),
TemplatedSQLQuery(
template_name="enriched_transactions",
context={},
@@ -17,5 +21,5 @@
)
def enriched_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "enriched_transactions_v1": duckdb_client.view("enriched_transactions.sql"),
+ "enriched_transactions_v1": duckdb_client.view("enriched_transactions"),
}
diff --git a/src/op_analytics/datapipeline/models/code/enriched_logs.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
similarity index 50%
rename from src/op_analytics/datapipeline/models/code/enriched_logs.py
rename to src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
index 56adc562069..94f80d0e1bf 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_logs.py
+++ b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
@@ -6,16 +6,16 @@
@register_model(
- input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
- expected_outputs=["enriched_logs_v1"],
+ input_datasets=["ingestion/logs_v1"],
+ expected_outputs=["event_emitting_transactions_list_v1"],
auxiliary_views=[
TemplatedSQLQuery(
- template_name="enriched_logs",
+ template_name="event_emitting_transactions_list",
context={},
),
],
)
-def enriched_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def event_emitting_transactions_list(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "enriched_logs_v1": duckdb_client.view("enriched_logs.sql"),
+ "event_emitting_transactions_list_v1": duckdb_client.view("event_emitting_transactions_list"),
}
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2
deleted file mode 100644
index 69fc8fc33c5..00000000000
--- a/src/op_analytics/datapipeline/models/templates/enriched_logs.sql.j2
+++ /dev/null
@@ -1,67 +0,0 @@
-WITH
-
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- ingestion_blocks_v1
-),
-
--- Select the columns that we want from logs joined to blocks and transactions.
--- Include some minor transformations that are needed for further calculations.
-base_level_logs AS (
- SELECT
- -- Raw Logs fields
- l.*,
- -- Raw Transaction Fields
- t.receipt_gas_used AS tx_gas_used,
- t.receipt_l1_gas_used AS tx_l1_gas_used,
- t.from_address AS tx_from_address,
- t.to_address AS tx_to_address,
- t.receipt_gas_used AS tx_gas_used,
- t.derived_l1_gas_used AS tx_l1_gas_used
- -- Fees
- total_gas_fee_native() AS total_gas_fee_native
- l1_gas_fee_native() END AS l1_fee_native,
- l2_gas_fee_native() AS l2_fee_native,
- l2_priority_gas_fee_native() AS l2_priority_fee_native,
- l2_base_gas_fee_native() AS l2_base_fee_native,
- -- Gas Prices
- wei_to_gwei(b.gas_price) AS l2_gas_price_gwei,
- wei_to_gwei(b.base_fee_per_gas) AS l2_base_gas_price_gwei,
- wei_to_gwei(t.gas_price - b.base_fee_per_gas) AS l2_priority_gas_price_gwei,
-
- wei_to_gwei(t.receipt_l1_gas_price) AS l1_base_gas_price_gwei,
- wei_to_gwei(t.receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei,
- -- L1 Fee BASE and BLOB scalars
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
-
- -- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- epoch_to_day(t.block_timestamp) AS block_date,
- t.receipt_status = 1 AS success,
-
- FROM ingestion_logs_v1 AS l
- INNER JOIN ingestion_transactions_v1 AS t
- INNER JOIN pb AS b ON t.block_number = b.number
- WHERE 1=1
- -- Optional address filter for faster results when developing.
- -- AND from_address LIKE '0x00%'
-),
-
-
--- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
-
- SELECT
- *,
- coalesce(
- receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_scalar * receipt_l1_gas_price)
- + (l1_blob_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS derived_l1_gas_used
- FROM base_level_transactions
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
similarity index 75%
rename from src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
rename to src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
index ad0d0bb0b7c..0c1d77bab1c 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_traces.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
@@ -10,7 +10,7 @@ pb AS (
-- Select the columns that we want from transactions joined to blocks.
-- Include some minor transformations that are needed for further calculations.
-base_level_traces AS (
+base_level_trace_calls AS (
SELECT
-- Raw Trace fields
r.*,
@@ -37,7 +37,6 @@ base_level_traces AS (
l2_fee_native AS tx_l2_fee_native,
l2_priority_fee_native AS tx_l2_priority_fee_native,
l2_base_fee_native AS tx_l2_base_fee_native,
- tx_method_id,
-- Computed Transaction Gas Price Fields
l2_gas_price_gwei,
l2_base_gas_price_gwei,
@@ -45,30 +44,27 @@ base_level_traces AS (
l1_base_gas_price_gwei,
l1_blob_base_gas_price_gwei,
- hexstr_method_id(t.input) AS tx_method_id,
- hexstr_method_id(r.input) AS trc_method_id,
- ---
- toDecimal128(t.receipt_l1_gas_price, 18) / 1e9 AS tx_l1_gas_price_gwei,
- toDecimal128(t.gas_price, 18) / 1e9 AS tx_gas_price_gwei,
- toDecimal128(b.base_fee_per_gas, 18) / 1e9 AS tx_base_gas_price_gwei,
- (toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) / 1e9 AS tx_priority_gas_price_gwei,
- ---
- toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_gas_fee_native,
- toDecimal128(t.receipt_l1_fee, 18) / 1e18 AS tx_l1_fee_native,
- toDecimal128(t.receipt_l1_fee, 18) / 1e18 + (toDecimal128(t.gas_price, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_l2_fee_native,
- (toDecimal128(b.base_fee_per_gas, 18) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_base_fee_native,
- ((toDecimal128(t.gas_price, 18) - toDecimal128(b.base_fee_per_gas, 18)) * toDecimal128(t.receipt_gas_used, 0)) / 1e18 AS tx_priority_fee_native
+ t.method_id AS tx_method_id,
+ hexstr_method_id(r.input) AS trc_method_id,
+ -- Event Columns
+ log_count_total_events,
+ log_count_approval_events,
+ log_count_wrapping_events,
+ log_count_transfer_events,
+
-- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- epoch_to_day(t.block_timestamp) AS block_date,
- t.receipt_status = 1 AS tx_success,
+ t.block_hour,
+ t.success AS tx_success,
t.receipt_status = 1 AS trc_success,
- FROM traces_v1 r
+ FROM ingestion_traces_v1 r
INNER JOIN enriched_transasctions_v1 t
ON r.block_number = t.block_number
AND r.transaction_hash = t.hash
+ LEFT JOIN event_emitting_transactions eet
+ ON eet.block_number = t.block_number
+ AND eet.transaction_hash = t.transaction_hash
WHERE r.trace_type = 'call'
)
@@ -113,7 +109,7 @@ bl.*
, bl.tx_priority_fee_native / tpt.count_traces AS tx_priority_fee_native_per_call_amortized
-FROM base_level_traces bl
+FROM base_level_trace_calls bl
INNER JOIN get_traces_per_tansaction tpt -- join on txn level
ON bl.block_number = tpt.block_number
AND bl.transaction_hash = tpt.transaction_hash
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
index e160f72a3db..b9058b35a18 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
@@ -46,8 +46,8 @@ base_level_transactions AS (
-- Convenience columns
epoch_to_hour(t.block_timestamp) AS block_hour,
- epoch_to_day(t.block_timestamp) AS block_date,
- t.receipt_status = 1 AS success,
+ t.receipt_status = 1 AS success
+
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b ON t.block_number = b.number
WHERE 1=1
@@ -56,15 +56,25 @@ base_level_transactions AS (
),
--- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
- SELECT
- *,
- coalesce(
- receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_scalar * receipt_l1_gas_price)
- + (l1_blob_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS derived_l1_gas_used
- FROM base_level_transactions
+
+SELECT
+ bl.*
+ -- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+ , coalesce(
+ receipt_l1_gas_used,
+ round(16 * receipt_l1_fee / (
+ (l1_base_scalar * receipt_l1_gas_price)
+ + (l1_blob_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ ) AS derived_l1_gas_used
+ -- Add event emitting transaction fields
+ , COALESCE(eet.count_total_events,0) AS log_count_total_events
+ , COALESCE(eet.count_approval_events,0) AS log_count_approval_events
+ , COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events
+ , COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
+
+ FROM base_level_transactions bl
+ LEFT JOIN event_emitting_transactions eet
+ ON eet.block_number = bl.block_number
+ AND eet.transaction_hash = bl.transaction_hash
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
new file mode 100644
index 00000000000..101f18f55b2
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
@@ -0,0 +1,41 @@
+WITH topic0_filters AS ( -- list of events that we want to indicate for possible future filtering.
+ SELECT distinct lower(topic) as topic, description, category
+ FROM (values
+ ('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', 'ERC20 Approval', 'Approval')
+ ,('0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', 'ERC721/ERC1155 Approval', 'Approval')
+
+ ,('0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', 'WETH Wrap', 'Wrapping')
+ ,('0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65', 'WETH Unwrap', 'Wrapping')
+
+ ,('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'ERC20/ERC721 Transfer', 'Transfer')
+ ,('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', 'ERC1155 Transfer Single', 'Transfer')
+ ,('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer')
+ ,('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer')
+ ,('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer')
+ ) a (topic, description)
+)
+
+-- Select the columns for joining back to transactions and sum event types
+-- Calculate types of events emitted for downstream "qualified transaction" filtering
+
+SELECT
+ l.dt
+ ,epoch_to_hour(l.block_timestamp) AS block_hour
+ ,l.block_timestamp
+ ,l.network, l.chain, l.chain_id
+ ,l.block_number
+ ,l.transaction_hash
+
+ ,COUNT(*) AS count_total_events
+ ,SUM(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events
+ ,SUM(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events
+ ,SUM(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
+
+FROM ingestion_logs_v1 AS l
+
+LEFT JOIN topic0_filters AS f
+ ON l.topic0 = f.topic
+
+GROUP BY 1,2,3,4,5,6,7,8
+
+
From dd03a2a2c6e96de9987261868ec57b0c989d3b45 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 22:17:51 -0500
Subject: [PATCH 09/32] resolve sources
---
.../datapipeline/models/code/enriched_trace_calls.py | 6 +-----
.../datapipeline/models/code/enriched_transactions.py | 6 +-----
.../models/templates/enriched_trace_calls.sql.j2 | 3 ---
3 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py b/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
index d2cd3863423..733a5b51bfb 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
@@ -6,13 +6,9 @@
@register_model(
- input_datasets=["ingestion/traces_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
+ input_datasets=["ingestion/traces_v1", "enriched_transactions_v1"],
expected_outputs=["enriched_trace_calls_v1"],
auxiliary_views=[
- TemplatedSQLQuery(
- template_name="enriched_transactions",
- context={},
- ),
TemplatedSQLQuery(
template_name="enriched_trace_calls",
context={},
diff --git a/src/op_analytics/datapipeline/models/code/enriched_transactions.py b/src/op_analytics/datapipeline/models/code/enriched_transactions.py
index b6b4b8be96a..c3891e80fbb 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_transactions.py
+++ b/src/op_analytics/datapipeline/models/code/enriched_transactions.py
@@ -6,13 +6,9 @@
@register_model(
- input_datasets=["ingestion/transactions_v1", "ingestion/blocks_v1"],
+ input_datasets=["ingestion/transactions_v1", "ingestion/blocks_v1", "event_emitting_transactions_list_v1"],
expected_outputs=["enriched_transactions_v1"],
auxiliary_views=[
- TemplatedSQLQuery(
- template_name="event_emitting_transactions",
- context={},
- ),
TemplatedSQLQuery(
template_name="enriched_transactions",
context={},
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
index 0c1d77bab1c..9cf6d8b3cd9 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
@@ -62,9 +62,6 @@ base_level_trace_calls AS (
INNER JOIN enriched_transasctions_v1 t
ON r.block_number = t.block_number
AND r.transaction_hash = t.hash
- LEFT JOIN event_emitting_transactions eet
- ON eet.block_number = t.block_number
- AND eet.transaction_hash = t.transaction_hash
WHERE r.trace_type = 'call'
)
From ccc8ed931158f82a7ffc852bcb161eab0997b236 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 23:00:02 -0500
Subject: [PATCH 10/32] migrate to existing transaction_fees and rename
---
...y => TODEPRECATE_enriched_transactions.py} | 0
.../models/code/daily_address_summary.py | 6 +-
...trace_calls.py => extended_trace_calls.py} | 2 +-
.../models/code/extended_transactions_fees.py | 21 +++
... TODEPRECATE_enriched_transactions.sql.j2} | 7 +-
.../templates/daily_address_summary.sql.j2 | 3 +-
....j2 => event_emitting_transactions.sql.j2} | 0
...lls.sql.j2 => extended_trace_calls.sql.j2} | 19 ++-
.../extended_transactions_fees.sql.j2 | 145 ++++++++++++++++++
.../models/templates/transaction_fees.sql.j2 | 87 -----------
10 files changed, 192 insertions(+), 98 deletions(-)
rename src/op_analytics/datapipeline/models/code/{enriched_transactions.py => TODEPRECATE_enriched_transactions.py} (100%)
rename src/op_analytics/datapipeline/models/code/{enriched_trace_calls.py => extended_trace_calls.py} (89%)
create mode 100644 src/op_analytics/datapipeline/models/code/extended_transactions_fees.py
rename src/op_analytics/datapipeline/models/templates/{enriched_transactions.sql.j2 => TODEPRECATE_enriched_transactions.sql.j2} (90%)
rename src/op_analytics/datapipeline/models/templates/{event_emitting_transactions_list.sql.j2 => event_emitting_transactions.sql.j2} (100%)
rename src/op_analytics/datapipeline/models/templates/{enriched_trace_calls.sql.j2 => extended_trace_calls.sql.j2} (93%)
create mode 100644 src/op_analytics/datapipeline/models/templates/extended_transactions_fees.sql.j2
delete mode 100644 src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2
diff --git a/src/op_analytics/datapipeline/models/code/enriched_transactions.py b/src/op_analytics/datapipeline/models/code/TODEPRECATE_enriched_transactions.py
similarity index 100%
rename from src/op_analytics/datapipeline/models/code/enriched_transactions.py
rename to src/op_analytics/datapipeline/models/code/TODEPRECATE_enriched_transactions.py
diff --git a/src/op_analytics/datapipeline/models/code/daily_address_summary.py b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
index bcab9b354ae..c1b1eaa2bf7 100644
--- a/src/op_analytics/datapipeline/models/code/daily_address_summary.py
+++ b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
@@ -6,13 +6,9 @@
@register_model(
- input_datasets=["ingestion/blocks_v1", "ingestion/transactions_v1"],
+ input_datasets=["ingestion/blocks_v1", "ingestion/transactions_v1", "extended_transactions_fees"],
expected_outputs=["summary_v1"],
auxiliary_views=[
- TemplatedSQLQuery(
- template_name="transaction_fees",
- context={},
- ),
TemplatedSQLQuery(
template_name="daily_address_summary",
context={},
diff --git a/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py b/src/op_analytics/datapipeline/models/code/extended_trace_calls.py
similarity index 89%
rename from src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
rename to src/op_analytics/datapipeline/models/code/extended_trace_calls.py
index 733a5b51bfb..42d81cce4db 100644
--- a/src/op_analytics/datapipeline/models/code/enriched_trace_calls.py
+++ b/src/op_analytics/datapipeline/models/code/extended_trace_calls.py
@@ -6,7 +6,7 @@
@register_model(
- input_datasets=["ingestion/traces_v1", "enriched_transactions_v1"],
+ input_datasets=["ingestion/traces_v1", "extended_transactions_fees_v1"],
expected_outputs=["enriched_trace_calls_v1"],
auxiliary_views=[
TemplatedSQLQuery(
diff --git a/src/op_analytics/datapipeline/models/code/extended_transactions_fees.py b/src/op_analytics/datapipeline/models/code/extended_transactions_fees.py
new file mode 100644
index 00000000000..e8627044041
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/extended_transactions_fees.py
@@ -0,0 +1,21 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=["ingestion/logs_v1"],
+ expected_outputs=["extended_transactions_fees.sql_v1"],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="extended_transactions_fees",
+ context={},
+ ),
+ ],
+)
+def extended_transactions_fees(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+ return {
+ "extended_transactions_fees_v1": duckdb_client.view("extended_transactions_fees"),
+ }
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
similarity index 90%
rename from src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
rename to src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
index b9058b35a18..1250677ceb0 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
@@ -24,7 +24,10 @@ base_level_transactions AS (
-- Gas Prices
wei_to_gwei(b.gas_price) AS l2_gas_price_gwei,
wei_to_gwei(b.base_fee_per_gas) AS l2_base_gas_price_gwei,
- wei_to_gwei(t.gas_price - b.base_fee_per_gas) AS l2_priority_gas_price_gwei,
+ CASE WHEN t.max_priority_fee_per_gas = 0 THEN 0
+ ELSE wei_to_gwei(t.gas_price - b.base_fee_per_gas)
+ END AS l2_priority_gas_price_gwei,
+ wei_to_gwei(t.gas_price - b.base_fee_per_gas) AS l2_legacy_priority_gas_price_gwei,
wei_to_gwei(t.receipt_l1_gas_price) AS l1_base_gas_price_gwei,
wei_to_gwei(t.receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei,
@@ -35,7 +38,7 @@ base_level_transactions AS (
-- Transaction Attributes
hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_bytelen(t.input) AS input_calldata_gas,
+ hexstr_calldata_gas(t.input) AS input_calldata_gas,
hexstr_method_id(t.input) AS method_id,
transaction_type = 126 AS is_system_transaction,
( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index 96a4a5fd046..0fd4c37dbc6 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -84,7 +84,8 @@ SELECT
wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
AS l1_blob_fee_avg_gwei
FROM
- transaction_fees
+ extended_transactions_fees
+ WHERE gas_price > 0
GROUP BY
1,
2,
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
similarity index 100%
rename from src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
rename to src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
diff --git a/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/extended_trace_calls.sql.j2
similarity index 93%
rename from src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
rename to src/op_analytics/datapipeline/models/templates/extended_trace_calls.sql.j2
index 9cf6d8b3cd9..8d899e72996 100644
--- a/src/op_analytics/datapipeline/models/templates/enriched_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/extended_trace_calls.sql.j2
@@ -13,7 +13,22 @@ pb AS (
base_level_trace_calls AS (
SELECT
-- Raw Trace fields
- r.*,
+ r.dt,
+ r.chain,
+ r.chain_id,
+ r.network,
+ r.block_number,
+ r.block_timestamp,
+ r.transaction_hash,
+ r.transaction_index,
+ r.from_address,
+ r.to_address,
+ r.gas AS gas_limit,
+ r.gas_used,
+ r.trace_address,
+ r.error,
+ r.trace_type,
+
-- Computed Trace Fields
hexstr_method_id(r.input) AS trc_method_id,
-- Find the next level up in the trace tree, so that we can subtract out subtract gas.
@@ -32,7 +47,7 @@ base_level_trace_calls AS (
t.receipt_gas_used AS tx_gas_used,
t.derived_l1_gas_used AS tx_l1_gas_used
-- Computed Transaction Fee Fields
- total_gas_fee_native AS tx_total_gas_fee_native,
+ tx_fee_native AS tx_fee_native,
l1_fee_native AS tx_l1_fee_native,
l2_fee_native AS tx_l2_fee_native,
l2_priority_fee_native AS tx_l2_priority_fee_native,
diff --git a/src/op_analytics/datapipeline/models/templates/extended_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/extended_transactions_fees.sql.j2
new file mode 100644
index 00000000000..3834e42771c
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/extended_transactions_fees.sql.j2
@@ -0,0 +1,145 @@
+WITH
+
+pb AS (
+ SELECT
+ number,
+ base_fee_per_gas
+ FROM
+ ingestion_blocks_v1
+),
+
+-- Select the columns that we want from transactions joined to blocks.
+-- Include some minor transformations that are needed for further calculations.
+pt1 AS (
+ SELECT
+ -- Transaction fields
+ t.dt,
+ t.chain,
+ t.chain_id,
+ t.network,
+ t.nonce,
+ t.transaction_index,
+ t.from_address,
+ t.to_address,
+ t.block_number,
+ t.block_timestamp,
+ t.gas_price,
+ t.gas AS gas_limit,
+ t.receipt_gas_used,
+ t.receipt_l1_gas_used,
+ -- Fees
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
+ t.receipt_l1_gas_price,
+ t.receipt_l1_blob_base_fee,
+ b.base_fee_per_gas,
+ t.max_priority_fee_per_gas,
+ if(t.max_priority_fee_per_gas = 0, t.gas_price - t.max_priority_fee_per_gas, 0) AS base_legacy_fee_per_gas
+ -- L2 Fees and breakdown into BASE and PRIORITY contributions
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
+ -- Convenience columns
+ epoch_to_hour(t.block_timestamp) AS block_hour,
+ hexstr_method_id(t.input) AS method_id,
+ t.receipt_status = 1 AS success,
+ -- L1 Fee BASE and BLOB scalars
+ coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
+ AS l1_base_scalar,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
+
+ -- Transaction Attributes
+ transaction_type,
+ hexstr_bytelen(t.input) AS input_byte_length,
+ hexstr_calldata_gas(t.input) AS input_calldata_gas,
+ transaction_type = 126 AS is_system_transaction,
+ ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ transaction_type = 126
+ AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
+ AND to_address = lower('0x4200000000000000000000000000000000000015')
+ ) AS is_attributes_deposited_transaction,
+
+ COALESCE(eet.count_total_events,0) AS log_count_total_events,
+ COALESCE(eet.count_approval_events,0) AS log_count_approval_events,
+ COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events,
+ COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
+
+ FROM ingestion_transactions_v1 AS t
+ INNER JOIN pb AS b ON t.block_number = b.number
+ LEFT JOIN event_emitting_transactions eet
+ ON eet.block_number = bl.block_number
+ AND eet.transaction_hash = bl.transaction_hash
+ WHERE 1=1
+ -- Optional address filter for faster results when developing.
+ -- AND from_address LIKE '0x00%'
+),
+
+
+-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+pt2 AS (
+ SELECT
+ *,
+ coalesce(
+ receipt_l1_gas_used,
+ round(16 * l1_fee / (
+ (l1_base_scalar * receipt_l1_gas_price)
+ + (l1_blob_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ ) AS l1_gas_used
+ FROM pt1
+),
+
+-- Add more fee calculations.
+-- Reuses results from the previous CTEs.
+
+pt3 AS (
+SELECT
+ *,
+ --
+ -- Total fee
+ l2_fee + l1_fee AS tx_fee,
+ --
+ -- L2 Legacy Fee
+ if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy,
+ --
+ -- L1 Base
+ div16(l1_gas_used) * l1_base_scalar * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used) * l1_base_scalar AS l1_base_scaled_size,
+ --
+ -- L1 Blob
+ div16(l1_gas_used) * l1_blob_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
+ div16(l1_gas_used) * l1_blob_scalar AS l1_blob_scaled_size
+
+FROM pt2
+)
+
+
+-- Generate gas fee breakdowns in native terms, for later aggregation
+-- Generate gas prices in gwei terms
+SELECT *
+
+-- Fees
+, wei_to_eth(tx_fee) AS tx_fee_native
+
+ -- Native Breakdown
+ , wei_to_eth(l1_fee) AS l1_fee_native
+ , wei_to_eth(l2_fee) AS l2_fee_native
+
+ -- L1 Breakdown
+ , wei_to_eth(l1_base_fee) AS l1_base_fee_native
+ , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
+
+ -- L2 Breakdown
+ , wei_to_eth(l2_base_fee) AS l2_base_fee_native
+ , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
+ , wei_to_eth(l2_base_legacy) AS l2_base_legacy_native
+
+-- Gas Prices
+ , wei_to_gwei(gas_price) AS l2_gas_price_gwei
+ , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
+ , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
+ , wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei
+
+ , wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei
+ , wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
+
+FROM pt3
diff --git a/src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2
deleted file mode 100644
index 7a206b0ad1f..00000000000
--- a/src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2
+++ /dev/null
@@ -1,87 +0,0 @@
-WITH
-
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- ingestion_blocks_v1
-),
-
--- Select the columns that we want from transactions joined to blocks.
--- Include some minor transformations that are needed for further calculations.
-pt1 AS (
- SELECT
- -- Transaction fields
- t.dt,
- t.chain,
- t.chain_id,
- t.nonce,
- t.from_address,
- t.to_address,
- t.block_number,
- t.block_timestamp,
- t.gas_price,
- t.receipt_gas_used,
- t.receipt_l1_gas_used,
- -- Fees
- t.receipt_l1_fee AS l1_fee,
- t.receipt_l1_gas_price,
- t.receipt_l1_blob_base_fee,
- -- L2 Fees and breakdown into BASE and PRIORITY contributions
- t.gas_price * t.receipt_gas_used AS l2_fee,
- t.max_priority_fee_per_gas * t.receipt_gas_used AS l2_priority_fee,
- b.base_fee_per_gas * t.receipt_gas_used AS l2_base_fee,
- -- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- substring(t.input, 1, 10) AS method_id,
- t.receipt_status = 1 AS success,
- -- L1 Fee BASE and BLOB scalars
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar
- FROM ingestion_transactions_v1 AS t
- INNER JOIN pb AS b ON t.block_number = b.number
- WHERE
- t.gas_price > 0
- -- Optional address filter for faster results when developing.
- -- AND from_address LIKE '0x00%'
-),
-
-
--- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
-pt2 AS (
- SELECT
- *,
- coalesce(
- receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_scalar * receipt_l1_gas_price)
- + (l1_blob_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS l1_gas_used
- FROM pt1
-)
-
--- Add more fee calculations.
--- Reuses results from the previous CTEs.
-
-SELECT
- *,
- --
- -- Total fee
- l2_fee + l1_fee AS tx_fee,
- --
- -- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy,
- --
- -- L1 Base
- div16(l1_gas_used) * l1_base_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_scalar AS l1_base_scaled_size,
- --
- -- L1 Blob
- div16(l1_gas_used) * l1_blob_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_scalar AS l1_blob_scaled_size
-
-
-FROM pt2
From 563ad68093a67258b8ea5e3b53ccf3cfe521a91e Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 23:08:08 -0500
Subject: [PATCH 11/32] update names
---
..._trace_calls.py => refined_trace_calls.py} | 10 ++++-----
...s_fees.py => refined_transactions_fees.py} | 8 +++----
.../datapipeline/models/compute/udfs.py | 21 -------------------
.../templates/daily_address_summary.sql.j2 | 2 +-
...alls.sql.j2 => refined_trace_calls.sql.j2} | 14 ++++---------
...ql.j2 => refined_transactions_fees.sql.j2} | 0
6 files changed, 14 insertions(+), 41 deletions(-)
rename src/op_analytics/datapipeline/models/code/{extended_trace_calls.py => refined_trace_calls.py} (52%)
rename src/op_analytics/datapipeline/models/code/{extended_transactions_fees.py => refined_transactions_fees.py} (58%)
rename src/op_analytics/datapipeline/models/templates/{extended_trace_calls.sql.j2 => refined_trace_calls.sql.j2} (96%)
rename src/op_analytics/datapipeline/models/templates/{extended_transactions_fees.sql.j2 => refined_transactions_fees.sql.j2} (100%)
diff --git a/src/op_analytics/datapipeline/models/code/extended_trace_calls.py b/src/op_analytics/datapipeline/models/code/refined_trace_calls.py
similarity index 52%
rename from src/op_analytics/datapipeline/models/code/extended_trace_calls.py
rename to src/op_analytics/datapipeline/models/code/refined_trace_calls.py
index 42d81cce4db..a48391d9a7f 100644
--- a/src/op_analytics/datapipeline/models/code/extended_trace_calls.py
+++ b/src/op_analytics/datapipeline/models/code/refined_trace_calls.py
@@ -6,16 +6,16 @@
@register_model(
- input_datasets=["ingestion/traces_v1", "extended_transactions_fees_v1"],
- expected_outputs=["enriched_trace_calls_v1"],
+ input_datasets=["ingestion/traces_v1", "refined_transactions_fees_v1"],
+ expected_outputs=["refined_trace_calls_v1"],
auxiliary_views=[
TemplatedSQLQuery(
- template_name="enriched_trace_calls",
+ template_name="refined_trace_calls",
context={},
),
],
)
-def enriched_trace_calls(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def refined_trace_calls(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "enriched_trace_calls_v1": duckdb_client.view("enriched_trace_calls"),
+ "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
}
diff --git a/src/op_analytics/datapipeline/models/code/extended_transactions_fees.py b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
similarity index 58%
rename from src/op_analytics/datapipeline/models/code/extended_transactions_fees.py
rename to src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
index e8627044041..0cd3cb151e4 100644
--- a/src/op_analytics/datapipeline/models/code/extended_transactions_fees.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
@@ -7,15 +7,15 @@
@register_model(
input_datasets=["ingestion/logs_v1"],
- expected_outputs=["extended_transactions_fees.sql_v1"],
+ expected_outputs=["refined_transactions_fees.sql_v1"],
auxiliary_views=[
TemplatedSQLQuery(
- template_name="extended_transactions_fees",
+ template_name="refined_transactions_fees",
context={},
),
],
)
-def extended_transactions_fees(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def refined_transactions_fees(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "extended_transactions_fees_v1": duckdb_client.view("extended_transactions_fees"),
+ "refined_transactions_fees_v1": duckdb_client.view("refined_transactions_fees"),
}
diff --git a/src/op_analytics/datapipeline/models/compute/udfs.py b/src/op_analytics/datapipeline/models/compute/udfs.py
index 740ebc1dc09..3cc33378e87 100644
--- a/src/op_analytics/datapipeline/models/compute/udfs.py
+++ b/src/op_analytics/datapipeline/models/compute/udfs.py
@@ -58,27 +58,6 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
--Get the method id for input data. This is the first 4 bytes, or first 10 string characters for binary data that is encoded as a hex string.
CREATE OR REPLACE MACRO hexstr_method_id(x)
AS substring(x,1,10);
-
- -- TODO: Is there some way that we could or should pass in the alias for each table?
- -- Calculate total gas fee in native units, given transactions t and blocks b
- CREATE OR REPLACE MACRO total_gas_fee_native()
- AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END;
-
- -- Calculate l2 base fee gas fee in native units, given transactions t and blocks b
- CREATE OR REPLACE MACRO l2_base_gas_fee_native()
- AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END;
-
- -- Calculate l2 priority fee gas fee in native units, given transactions t and blocks b
- CREATE OR REPLACE MACRO l2_priority_gas_fee_native()
- AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee + t.gas_price * t.receipt_gas_used) END;
-
- -- Calculate l1 data fee gas fee in native units, given transactions t and blocks b
- CREATE OR REPLACE MACRO l2_gas_fee_native()
- AS wei_to_eth(t.gas_price * t.receipt_gas_used
-
- -- Calculate l1 data fee gas fee in native units, given transactions t and blocks b
- CREATE OR REPLACE MACRO l1_gas_fee_native()
- AS CASE WHEN t.gas_price = 0 THEN 0 ELSE wei_to_eth(t.receipt_l1_fee) END
""")
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index 0fd4c37dbc6..6e16085194b 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -84,7 +84,7 @@ SELECT
wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
AS l1_blob_fee_avg_gwei
FROM
- extended_transactions_fees
+ refined_transactions_fees
WHERE gas_price > 0
GROUP BY
1,
diff --git a/src/op_analytics/datapipeline/models/templates/extended_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
similarity index 96%
rename from src/op_analytics/datapipeline/models/templates/extended_trace_calls.sql.j2
rename to src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
index 8d899e72996..9cbca215b26 100644
--- a/src/op_analytics/datapipeline/models/templates/extended_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
@@ -1,13 +1,5 @@
WITH
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- enriched_transasctions_v1
-),
-
-- Select the columns that we want from transactions joined to blocks.
-- Include some minor transformations that are needed for further calculations.
base_level_trace_calls AS (
@@ -45,17 +37,19 @@ base_level_trace_calls AS (
t.from_address AS tx_from_address,
t.to_address AS tx_to_address,
t.receipt_gas_used AS tx_gas_used,
- t.derived_l1_gas_used AS tx_l1_gas_used
+ t.l1_gas_used AS tx_l1_gas_used
-- Computed Transaction Fee Fields
tx_fee_native AS tx_fee_native,
l1_fee_native AS tx_l1_fee_native,
l2_fee_native AS tx_l2_fee_native,
l2_priority_fee_native AS tx_l2_priority_fee_native,
l2_base_fee_native AS tx_l2_base_fee_native,
+ l2_base_legacy_native AS tx_l2_base_legacy_native,
-- Computed Transaction Gas Price Fields
l2_gas_price_gwei,
l2_base_gas_price_gwei,
l2_priority_gas_price_gwei,
+ l2_base_legacy_gas_price_gwei,
l1_base_gas_price_gwei,
l1_blob_base_gas_price_gwei,
@@ -74,7 +68,7 @@ base_level_trace_calls AS (
t.receipt_status = 1 AS trc_success,
FROM ingestion_traces_v1 r
- INNER JOIN enriched_transasctions_v1 t
+ INNER JOIN extended_transactions_v1 t
ON r.block_number = t.block_number
AND r.transaction_hash = t.hash
diff --git a/src/op_analytics/datapipeline/models/templates/extended_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
similarity index 100%
rename from src/op_analytics/datapipeline/models/templates/extended_transactions_fees.sql.j2
rename to src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
From 365ee5741f251a2b0e7d51c89eae4f5500be62dc Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 23:50:55 -0500
Subject: [PATCH 12/32] checkpoint
---
notebooks/adhoc/example_daily_data.ipynb | 147 ++----------------
.../models/code/daily_address_summary.py | 2 +-
...to.py => daily_transactions_fees_by_to.py} | 8 +-
...py => event_emitting_transactions_list.py} | 0
.../models/code/refined_transactions_fees.py | 4 +-
.../TODEPRECATE_enriched_transactions.sql.j2 | 8 -
...> event_emitting_transactions_list.sql.j2} | 0
.../refined_transactions_fees.sql.j2 | 2 +-
8 files changed, 17 insertions(+), 154 deletions(-)
rename src/op_analytics/datapipeline/models/code/{daily_transactions_by_to.py => daily_transactions_fees_by_to.py} (68%)
rename src/op_analytics/datapipeline/models/code/{event_emitting_transactions.py => event_emitting_transactions_list.py} (100%)
rename src/op_analytics/datapipeline/models/templates/{event_emitting_transactions.sql.j2 => event_emitting_transactions_list.sql.j2} (100%)
diff --git a/notebooks/adhoc/example_daily_data.ipynb b/notebooks/adhoc/example_daily_data.ipynb
index 8977112871a..90905f89493 100644
--- a/notebooks/adhoc/example_daily_data.ipynb
+++ b/notebooks/adhoc/example_daily_data.ipynb
@@ -9,28 +9,9 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mmodel\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mtransaction_fees\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mmodel\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mmodel\u001b[0m=\u001b[35mcontract_creation\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mcontract_creation_traces\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mLoaded 2 python modules with intermediate model definitions.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mregistry.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m62\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 18 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mFound vault variable GOOGLE_SERVICE_ACCOUNT (has JSON key)\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mgcpauth.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m18\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mLoaded OP chains metadata from /Users/pedro/github/ethereum-optimism/op-analytics-alt/op_chains_tracking/inputs/chain_metadata_raw.csv\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mload.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m85\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1m[REPO vs. GSHEETS] ERROR: Chain Metadata is different\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mload.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m\n",
- "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m187\u001b[0m\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"from op_analytics.coreutils.duckdb_inmem import init_client\n",
"from op_analytics.coreutils.partitioned.reader import DataReader\n",
@@ -68,45 +49,12 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-05 15:38:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m226\u001b[0m\n",
- "\u001b[2m2024-12-05 15:38:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 23/23 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-10-30/000127322000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m63\u001b[0m\n",
- "\u001b[2m2024-12-05 15:38:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 23 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m\n",
- "\u001b[2m2024-12-05 15:38:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 23/23 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-10-30/000127322000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m63\u001b[0m\n",
- "\u001b[2m2024-12-05 15:38:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 23 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m\n",
- "dict_keys(['summary_v1'])\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "┌───────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├───────────────────────────┤\n",
- "│ daily_address_summary │\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ summary_v1 │\n",
- "│ transaction_fees │\n",
- "└───────────────────────────┘"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
"\n",
- "\n",
"execute_model_in_memory(\n",
" duckdb_client=duckdb_client,\n",
" model=\"daily_address_summary\",\n",
@@ -131,36 +79,9 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────┬─────────┬──────────┬────────────────────────────────────────────┬────────┬────────────────┬───────────┬───────────────────┬──────────────────┬──────────────────┬────────────────────┬───────────┬───────────┬────────────────────┬─────────────────────┬─────────────────────┬───────────────────┬───────────────────┬─────────────────┬─────────────────────────┬────────────────┬─────────────────┬─────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬────────────────────────┬───────────────────────┬───────────────────────┬─────────────────────────┬────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────┬────────────────────────┬──────────────────────┐\n",
- "│ dt │ chain │ chain_id │ address │ tx_cnt │ success_tx_cnt │ block_cnt │ success_block_cnt │ block_number_min │ block_number_max │ active_block_range │ nonce_min │ nonce_max │ active_nonce_range │ block_timestamp_min │ block_timestamp_max │ active_time_range │ active_hours_ucnt │ to_address_ucnt │ success_to_address_ucnt │ method_id_ucnt │ l2_gas_used_sum │ success_l2_gas_used_sum │ l1_gas_used_sum │ success_l1_gas_used_sum │ tx_fee_sum_eth │ success_tx_fee_sum_eth │ l2_fee_sum_eth │ l2_base_fee_sum_eth │ l2_priority_fee_sum_eth │ l2_base_legacy_fee_sum_eth │ l1_fee_sum_eth │ l1_base_fee_sum_eth │ l1_blob_fee_sum_eth │ l2_gas_price_avg_gwei │ l2_base_price_avg_gwei │ l2_priority_price_avg_gwei │ l1_base_price_avg_gwei │ l1_blob_fee_avg_gwei │\n",
- "│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ uint32 │ uint32 │ uint32 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │\n",
- "├────────────┼─────────┼──────────┼────────────────────────────────────────────┼────────┼────────────────┼───────────┼───────────────────┼──────────────────┼──────────────────┼────────────────────┼───────────┼───────────┼────────────────────┼─────────────────────┼─────────────────────┼───────────────────┼───────────────────┼─────────────────┼─────────────────────────┼────────────────┼─────────────────┼─────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼────────────────────────┼───────────────────────┼───────────────────────┼─────────────────────────┼────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────┼────────────────────────┼──────────────────────┤\n",
- "│ 2024-10-30 │ op │ 10 │ 0xaa971288ea224d94014d7cafd31faa5a6ba34fa9 │ 6099 │ 5980 │ 4637 │ 4584 │ 127323823 │ 127367011 │ 43189 │ 263880 │ 269978 │ 6099 │ 1730246423 │ 1730332799 │ 86376 │ 24 │ 3 │ 3 │ 5 │ 2011866171 │ 1991937468 │ 15349044 │ 15026564 │ 0.0295394861834670890 │ 0.0291519833502175670 │ 0.0271367522283079090 │ 0.0000009284876573830 │ 0.0271358237406505260 │ 0.0000000000000000000 │ 0.0024027339551591800 │ 0.0010233699604265900 │ 0.0013790109078847010 │ 0.0134883490 │ 0.0000004620 │ 0.0134878870 │ 12.7555395470 │ 1.4173502350 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x80c67432656d59144ceff962e8faf8926599bcf8 │ 17702 │ 17702 │ 17633 │ 17633 │ 127323813 │ 127367008 │ 43196 │ 1057544 │ 1075245 │ 17702 │ 1730246403 │ 1730332793 │ 86390 │ 24 │ 8349 │ 8349 │ 2 │ 372007232 │ 372007232 │ 28334322 │ 28334322 │ 0.0047049174966654290 │ 0.0047049174966654290 │ 0.0004465811645339340 │ 0.0000001724861339340 │ 0.0004464086784000000 │ 0.0000000000000000000 │ 0.0042583363321314950 │ 0.0018015727516364060 │ 0.0024567633068750720 │ 0.0012004640 │ 0.0000004640 │ 0.0012000000 │ 12.1642819940 │ 1.3678589040 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x7cda773fc37b31d0f5fb309b5e078a43fd71c4d8 │ 1 │ 1 │ 1 │ 1 │ 127344003 │ 127344003 │ 1 │ 211 │ 211 │ 1 │ 1730286783 │ 1730286783 │ 0 │ 1 │ 1 │ 1 │ 1 │ 211807 │ 211807 │ 1600 │ 1600 │ 0.0000003574901318760 │ 0.0000003574901318760 │ 0.0000000212499608890 │ 0.0000000000692608890 │ 0.0000000211807000000 │ 0.0000000000000000000 │ 0.0000003362401709870 │ 0.0000000940855941590 │ 0.0000002421545768280 │ 0.0001003270 │ 0.0000003270 │ 0.0001000000 │ 11.2499514730 │ 2.3876106580 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x9a9c86edafb44f065c1aa76f03e997f75ec3497a │ 158 │ 158 │ 158 │ 158 │ 127327802 │ 127365302 │ 37501 │ 48638 │ 48795 │ 158 │ 1730254381 │ 1730329381 │ 75000 │ 22 │ 1 │ 1 │ 3 │ 4588854 │ 4588854 │ 252800 │ 252800 │ 0.0000519553863943680 │ 0.0000519553863943680 │ 0.0000045909825292270 │ 0.0000000021285292270 │ 0.0000045888540000000 │ 0.0000000000000000000 │ 0.0000473644038651410 │ 0.0000190663862292320 │ 0.0000282980176359900 │ 0.0010004640 │ 0.0000004640 │ 0.0010000000 │ 14.4290858240 │ 1.7659148270 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x28a3b352f53804c6afb1c08093eaf25ddef9aa14 │ 10 │ 10 │ 10 │ 10 │ 127343963 │ 127344134 │ 172 │ 0 │ 9 │ 10 │ 1730286703 │ 1730287045 │ 342 │ 1 │ 3 │ 3 │ 3 │ 2127359 │ 2127359 │ 53260 │ 53260 │ 0.0000137701522657060 │ 0.0000137701522657060 │ 0.0000003201331506270 │ 0.0000000006925036370 │ 0.0000003194406469900 │ 0.0000000000000000000 │ 0.0000134500191150790 │ 0.0000029457010747910 │ 0.0000105028255853550 │ 0.0001504840 │ 0.0000003260 │ 0.0001501580 │ 10.5812021380 │ 3.1109698420 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x0f2e509e09e02f350a19a7c52c42deed18940f93 │ 3 │ 3 │ 3 │ 3 │ 127342750 │ 127344007 │ 1258 │ 124 │ 126 │ 3 │ 1730284277 │ 1730286791 │ 2514 │ 2 │ 2 │ 2 │ 2 │ 87132 │ 87132 │ 5516 │ 5516 │ 0.0000016285149832490 │ 0.0000016285149832490 │ 0.0000001045923101640 │ 0.0000000000339101640 │ 0.0000001045584000000 │ 0.0000000000000000000 │ 0.0000015239226730850 │ 0.0000002898918134670 │ 0.0000012338838385960 │ 0.0012003890 │ 0.0000003890 │ 0.0012000000 │ 10.0544702510 │ 3.5289119960 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x8f6966f2244f596d107031049d0e134fd4f2cf47 │ 4 │ 4 │ 4 │ 4 │ 127344008 │ 127344760 │ 753 │ 36 │ 39 │ 4 │ 1730286793 │ 1730288297 │ 1504 │ 1 │ 1 │ 1 │ 1 │ 84000 │ 84000 │ 6400 │ 6400 │ 0.0000012836405214330 │ 0.0000012836405214330 │ 0.0000001008278460000 │ 0.0000000000278460000 │ 0.0000001008000000000 │ 0.0000000000000000000 │ 0.0000011828126754330 │ 0.0000003118171294790 │ 0.0000008709955459560 │ 0.0012003320 │ 0.0000003320 │ 0.0012000000 │ 9.3211070370 │ 2.1469739240 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x5fafb81c4cb955a2268d96bddf12b2f228c534b5 │ 69 │ 55 │ 69 │ 55 │ 127323841 │ 127360205 │ 36365 │ 875 │ 943 │ 69 │ 1730246459 │ 1730319187 │ 72728 │ 15 │ 1 │ 1 │ 2 │ 13256726 │ 12926004 │ 120443 │ 98043 │ 0.0000310144657892840 │ 0.0000244561817408950 │ 0.0000018422436719890 │ 0.0000000061961519890 │ 0.0000018360475200000 │ 0.0000000000000000000 │ 0.0000291722221172950 │ 0.0000110937461564040 │ 0.0000180757038473500 │ 0.0001389670 │ 0.0000004670 │ 0.0001384990 │ 17.6215521610 │ 2.3675789090 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0x9b1c1f60243ea8573803f4ea8dd2b7f3c66c26f3 │ 1214 │ 1214 │ 1214 │ 1214 │ 127323819 │ 127367011 │ 43193 │ 9131 │ 10344 │ 1214 │ 1730246415 │ 1730332799 │ 86384 │ 24 │ 1 │ 1 │ 2 │ 64884944 │ 64884944 │ 2824647 │ 2824647 │ 0.0005114662231347030 │ 0.0005114662231347030 │ 0.0000649155637663880 │ 0.0000000306197663880 │ 0.0000648849440000000 │ 0.0000000000000000000 │ 0.0004465506593683150 │ 0.0001844771371566040 │ 0.0002619855991240930 │ 0.0010004720 │ 0.0000004720 │ 0.0010000000 │ 12.4947010340 │ 1.4632011980 │\n",
- "│ 2024-10-30 │ op │ 10 │ 0xc9bb27e26370993755a9e4b21feeeb003f5a5e08 │ 3 │ 3 │ 3 │ 3 │ 127342916 │ 127344011 │ 1096 │ 37 │ 39 │ 3 │ 1730284609 │ 1730286799 │ 2190 │ 2 │ 2 │ 2 │ 1 │ 63000 │ 63000 │ 4800 │ 4800 │ 0.0000012846498797310 │ 0.0000012846498797310 │ 0.0000000756252630000 │ 0.0000000000252630000 │ 0.0000000756000000000 │ 0.0000000000000000000 │ 0.0000012090246167310 │ 0.0000002550951601520 │ 0.0000009539294565800 │ 0.0012004010 │ 0.0000004010 │ 0.0012000000 │ 10.1673665640 │ 3.1352041980 │\n",
- "├────────────┴─────────┴──────────┴────────────────────────────────────────────┴────────┴────────────────┴───────────┴───────────────────┴──────────────────┴──────────────────┴────────────────────┴───────────┴───────────┴────────────────────┴─────────────────────┴─────────────────────┴───────────────────┴───────────────────┴─────────────────┴─────────────────────────┴────────────────┴─────────────────┴─────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴────────────────────────┴───────────────────────┴───────────────────────┴─────────────────────────┴────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────┴────────────────────────┴──────────────────────┤\n",
- "│ 10 rows 39 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"duckdb_client.sql(\"SELECT * FROM summary_v1 LIMIT 10\")"
]
@@ -174,59 +95,9 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "
shape: (5, 39)dt | chain | chain_id | address | tx_cnt | success_tx_cnt | block_cnt | success_block_cnt | block_number_min | block_number_max | active_block_range | nonce_min | nonce_max | active_nonce_range | block_timestamp_min | block_timestamp_max | active_time_range | active_hours_ucnt | to_address_ucnt | success_to_address_ucnt | method_id_ucnt | l2_gas_used_sum | success_l2_gas_used_sum | l1_gas_used_sum | success_l1_gas_used_sum | tx_fee_sum_eth | success_tx_fee_sum_eth | l2_fee_sum_eth | l2_base_fee_sum_eth | l2_priority_fee_sum_eth | l2_base_legacy_fee_sum_eth | l1_fee_sum_eth | l1_base_fee_sum_eth | l1_blob_fee_sum_eth | l2_gas_price_avg_gwei | l2_base_price_avg_gwei | l2_priority_price_avg_gwei | l1_base_price_avg_gwei | l1_blob_fee_avg_gwei |
---|
date | str | i32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | u32 | u32 | u32 | i64 | i64 | i64 | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | decimal[38,0] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] |
2024-10-30 | "op" | 10 | "0xaa971288ea224d94014d7cafd31f… | 6099 | 5980 | 4637 | 4584 | 127323823 | 127367011 | 43189 | 263880 | 269978 | 6099 | 1730246423 | 1730332799 | 86376 | 24 | 3 | 3 | 5 | 2011866171 | 1991937468 | 15349044 | 15026564 | 0.0295394861834670890 | 0.0291519833502175670 | 0.0271367522283079090 | 0.0000009284876573830 | 0.0271358237406505260 | 0.0000000000000000000 | 0.0024027339551591800 | 0.0010233699604265900 | 0.0013790109078847010 | 0.0134883490 | 0.0000004620 | 0.0134878870 | 12.7555395470 | 1.4173502350 |
2024-10-30 | "op" | 10 | "0x80c67432656d59144ceff962e8fa… | 17702 | 17702 | 17633 | 17633 | 127323813 | 127367008 | 43196 | 1057544 | 1075245 | 17702 | 1730246403 | 1730332793 | 86390 | 24 | 8349 | 8349 | 2 | 372007232 | 372007232 | 28334322 | 28334322 | 0.0047049174966654290 | 0.0047049174966654290 | 0.0004465811645339340 | 0.0000001724861339340 | 0.0004464086784000000 | 0.0000000000000000000 | 0.0042583363321314950 | 0.0018015727516364060 | 0.0024567633068750720 | 0.0012004640 | 0.0000004640 | 0.0012000000 | 12.1642819940 | 1.3678589040 |
2024-10-30 | "op" | 10 | "0x7cda773fc37b31d0f5fb309b5e07… | 1 | 1 | 1 | 1 | 127344003 | 127344003 | 1 | 211 | 211 | 1 | 1730286783 | 1730286783 | 0 | 1 | 1 | 1 | 1 | 211807 | 211807 | 1600 | 1600 | 0.0000003574901318760 | 0.0000003574901318760 | 0.0000000212499608890 | 0.0000000000692608890 | 0.0000000211807000000 | 0.0000000000000000000 | 0.0000003362401709870 | 0.0000000940855941590 | 0.0000002421545768280 | 0.0001003270 | 0.0000003270 | 0.0001000000 | 11.2499514730 | 2.3876106580 |
2024-10-30 | "op" | 10 | "0x9a9c86edafb44f065c1aa76f03e9… | 158 | 158 | 158 | 158 | 127327802 | 127365302 | 37501 | 48638 | 48795 | 158 | 1730254381 | 1730329381 | 75000 | 22 | 1 | 1 | 3 | 4588854 | 4588854 | 252800 | 252800 | 0.0000519553863943680 | 0.0000519553863943680 | 0.0000045909825292270 | 0.0000000021285292270 | 0.0000045888540000000 | 0.0000000000000000000 | 0.0000473644038651410 | 0.0000190663862292320 | 0.0000282980176359900 | 0.0010004640 | 0.0000004640 | 0.0010000000 | 14.4290858240 | 1.7659148270 |
2024-10-30 | "op" | 10 | "0x28a3b352f53804c6afb1c08093ea… | 10 | 10 | 10 | 10 | 127343963 | 127344134 | 172 | 0 | 9 | 10 | 1730286703 | 1730287045 | 342 | 1 | 3 | 3 | 3 | 2127359 | 2127359 | 53260 | 53260 | 0.0000137701522657060 | 0.0000137701522657060 | 0.0000003201331506270 | 0.0000000006925036370 | 0.0000003194406469900 | 0.0000000000000000000 | 0.0000134500191150790 | 0.0000029457010747910 | 0.0000105028255853550 | 0.0001504840 | 0.0000003260 | 0.0001501580 | 10.5812021380 | 3.1109698420 |
"
- ],
- "text/plain": [
- "shape: (5, 39)\n",
- "┌────────────┬───────┬──────────┬────────────┬───┬────────────┬────────────┬───────────┬───────────┐\n",
- "│ dt ┆ chain ┆ chain_id ┆ address ┆ … ┆ l2_base_pr ┆ l2_priorit ┆ l1_base_p ┆ l1_blob_f │\n",
- "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ ice_avg_gw ┆ y_price_av ┆ rice_avg_ ┆ ee_avg_gw │\n",
- "│ date ┆ str ┆ i32 ┆ str ┆ ┆ ei ┆ g_gwei ┆ gwei ┆ ei │\n",
- "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
- "│ ┆ ┆ ┆ ┆ ┆ decimal[38 ┆ decimal[38 ┆ decimal[3 ┆ decimal[3 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ ,10] ┆ ,10] ┆ 8,10] ┆ 8,10] │\n",
- "╞════════════╪═══════╪══════════╪════════════╪═══╪════════════╪════════════╪═══════════╪═══════════╡\n",
- "│ 2024-10-30 ┆ op ┆ 10 ┆ 0xaa971288 ┆ … ┆ 0.00000046 ┆ 0.01348788 ┆ 12.755539 ┆ 1.4173502 │\n",
- "│ ┆ ┆ ┆ ea224d9401 ┆ ┆ 20 ┆ 70 ┆ 5470 ┆ 350 │\n",
- "│ ┆ ┆ ┆ 4d7cafd31f ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x80c67432 ┆ … ┆ 0.00000046 ┆ 0.00120000 ┆ 12.164281 ┆ 1.3678589 │\n",
- "│ ┆ ┆ ┆ 656d59144c ┆ ┆ 40 ┆ 00 ┆ 9940 ┆ 040 │\n",
- "│ ┆ ┆ ┆ eff962e8fa ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x7cda773f ┆ … ┆ 0.00000032 ┆ 0.00010000 ┆ 11.249951 ┆ 2.3876106 │\n",
- "│ ┆ ┆ ┆ c37b31d0f5 ┆ ┆ 70 ┆ 00 ┆ 4730 ┆ 580 │\n",
- "│ ┆ ┆ ┆ fb309b5e07 ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x9a9c86ed ┆ … ┆ 0.00000046 ┆ 0.00100000 ┆ 14.429085 ┆ 1.7659148 │\n",
- "│ ┆ ┆ ┆ afb44f065c ┆ ┆ 40 ┆ 00 ┆ 8240 ┆ 270 │\n",
- "│ ┆ ┆ ┆ 1aa76f03e9 ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x28a3b352 ┆ … ┆ 0.00000032 ┆ 0.00015015 ┆ 10.581202 ┆ 3.1109698 │\n",
- "│ ┆ ┆ ┆ f53804c6af ┆ ┆ 60 ┆ 80 ┆ 1380 ┆ 420 │\n",
- "│ ┆ ┆ ┆ b1c08093ea ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
- "└────────────┴───────┴──────────┴────────────┴───┴────────────┴────────────┴───────────┴───────────┘"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"duckdb_client.sql(\"SELECT * FROM summary_v1 LIMIT 10\").pl().head()"
]
@@ -255,7 +126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.6"
+ "version": "3.12.4"
}
},
"nbformat": 4,
diff --git a/src/op_analytics/datapipeline/models/code/daily_address_summary.py b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
index c1b1eaa2bf7..f11c458ad4a 100644
--- a/src/op_analytics/datapipeline/models/code/daily_address_summary.py
+++ b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
@@ -6,7 +6,7 @@
@register_model(
- input_datasets=["ingestion/blocks_v1", "ingestion/transactions_v1", "extended_transactions_fees"],
+ input_datasets=["refined_transactions_fees_v1"],
expected_outputs=["summary_v1"],
auxiliary_views=[
TemplatedSQLQuery(
diff --git a/src/op_analytics/datapipeline/models/code/daily_transactions_by_to.py b/src/op_analytics/datapipeline/models/code/daily_transactions_fees_by_to.py
similarity index 68%
rename from src/op_analytics/datapipeline/models/code/daily_transactions_by_to.py
rename to src/op_analytics/datapipeline/models/code/daily_transactions_fees_by_to.py
index d62ad997f3b..343dfd39765 100644
--- a/src/op_analytics/datapipeline/models/code/daily_transactions_by_to.py
+++ b/src/op_analytics/datapipeline/models/code/daily_transactions_fees_by_to.py
@@ -7,18 +7,18 @@
@register_model(
input_datasets=["intermediate/enriched_transactions_v1"],
- expected_outputs=["daily_transactions_by_to_v1"],
+ expected_outputs=["daily_transactions_fees_by_to_v1"],
# TODO: Uncomment if we do this as a view (or some element as a view)
# auxiliary_views=[
# TemplatedSQLQuery(
- # template_name="daily_transactions_by_to",
+ # template_name="daily_transactions_fees_by_to",
# context={},
# ),
# ],
)
-def daily_transactions_by_to(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+def daily_transactions_fees_by_to(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "daily_transactions_by_to_v1": duckdb_client.view(
+ "daily_transactions_fees_by_to_v1": duckdb_client.view(
"""
TODO: AGGREGATION CODE
"""
diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
similarity index 100%
rename from src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
rename to src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
index 0cd3cb151e4..19b587394c9 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
@@ -6,8 +6,8 @@
@register_model(
- input_datasets=["ingestion/logs_v1"],
- expected_outputs=["refined_transactions_fees.sql_v1"],
+ input_datasets=["ingestion/logs_v1", "event_emitting_transactions_v1"],
+ expected_outputs=["refined_transactions_fees_v1"],
auxiliary_views=[
TemplatedSQLQuery(
template_name="refined_transactions_fees",
diff --git a/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
index 1250677ceb0..4d2638f7471 100644
--- a/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
@@ -1,13 +1,5 @@
WITH
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- ingestion_blocks_v1
-),
-
-- Select the columns that we want from transactions joined to blocks.
-- Include some minor transformations that are needed for further calculations.
base_level_transactions AS (
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
similarity index 100%
rename from src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
rename to src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 3834e42771c..55d952bef8b 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -65,7 +65,7 @@ pt1 AS (
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b ON t.block_number = b.number
- LEFT JOIN event_emitting_transactions eet
+ LEFT JOIN event_emitting_transactions_v1 eet
ON eet.block_number = bl.block_number
AND eet.transaction_hash = bl.transaction_hash
WHERE 1=1
From 6503ab7ca7d72c63e5a1cca3ad3bc11e51739265 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 23:55:43 -0500
Subject: [PATCH 13/32] check
---
.../code/TODEPRECATE_enriched_transactions.py | 21 ------
.../TODEPRECATE_enriched_transactions.sql.j2 | 75 -------------------
2 files changed, 96 deletions(-)
delete mode 100644 src/op_analytics/datapipeline/models/code/TODEPRECATE_enriched_transactions.py
delete mode 100644 src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
diff --git a/src/op_analytics/datapipeline/models/code/TODEPRECATE_enriched_transactions.py b/src/op_analytics/datapipeline/models/code/TODEPRECATE_enriched_transactions.py
deleted file mode 100644
index c3891e80fbb..00000000000
--- a/src/op_analytics/datapipeline/models/code/TODEPRECATE_enriched_transactions.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import duckdb
-
-from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
-from op_analytics.datapipeline.models.compute.registry import register_model
-from op_analytics.datapipeline.models.compute.types import NamedRelations
-
-
-@register_model(
- input_datasets=["ingestion/transactions_v1", "ingestion/blocks_v1", "event_emitting_transactions_list_v1"],
- expected_outputs=["enriched_transactions_v1"],
- auxiliary_views=[
- TemplatedSQLQuery(
- template_name="enriched_transactions",
- context={},
- ),
- ],
-)
-def enriched_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
- return {
- "enriched_transactions_v1": duckdb_client.view("enriched_transactions"),
- }
diff --git a/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
deleted file mode 100644
index 4d2638f7471..00000000000
--- a/src/op_analytics/datapipeline/models/templates/TODEPRECATE_enriched_transactions.sql.j2
+++ /dev/null
@@ -1,75 +0,0 @@
-WITH
-
--- Select the columns that we want from transactions joined to blocks.
--- Include some minor transformations that are needed for further calculations.
-base_level_transactions AS (
- SELECT
- -- Raw Transaction fields
- t.*,
- -- Fees
- total_gas_fee_native() AS total_gas_fee_native
- l1_gas_fee_native() END AS l1_fee_native,
- l2_gas_fee_native() AS l2_fee_native,
- l2_priority_gas_fee_native() AS l2_priority_fee_native,
- l2_base_gas_fee_native() AS l2_base_fee_native,
- -- TODO: Separate L1 Fee in to Blobs vs L1 Fee Contribution - TBD if we do this here or in the next step
- -- Gas Prices
- wei_to_gwei(b.gas_price) AS l2_gas_price_gwei,
- wei_to_gwei(b.base_fee_per_gas) AS l2_base_gas_price_gwei,
- CASE WHEN t.max_priority_fee_per_gas = 0 THEN 0
- ELSE wei_to_gwei(t.gas_price - b.base_fee_per_gas)
- END AS l2_priority_gas_price_gwei,
- wei_to_gwei(t.gas_price - b.base_fee_per_gas) AS l2_legacy_priority_gas_price_gwei,
-
- wei_to_gwei(t.receipt_l1_gas_price) AS l1_base_gas_price_gwei,
- wei_to_gwei(t.receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei,
- -- L1 Fee BASE and BLOB scalars
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
-
- -- Transaction Attributes
- hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_calldata_gas(t.input) AS input_calldata_gas,
- hexstr_method_id(t.input) AS method_id,
- transaction_type = 126 AS is_system_transaction,
- ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
- transaction_type = 126
- AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
- AND to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction,
-
- -- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- t.receipt_status = 1 AS success
-
- FROM ingestion_transactions_v1 AS t
- INNER JOIN pb AS b ON t.block_number = b.number
- WHERE 1=1
- -- Optional address filter for faster results when developing.
- -- AND from_address LIKE '0x00%'
-),
-
-
-
-
-SELECT
- bl.*
- -- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
- , coalesce(
- receipt_l1_gas_used,
- round(16 * receipt_l1_fee / (
- (l1_base_scalar * receipt_l1_gas_price)
- + (l1_blob_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS derived_l1_gas_used
- -- Add event emitting transaction fields
- , COALESCE(eet.count_total_events,0) AS log_count_total_events
- , COALESCE(eet.count_approval_events,0) AS log_count_approval_events
- , COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events
- , COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
-
- FROM base_level_transactions bl
- LEFT JOIN event_emitting_transactions eet
- ON eet.block_number = bl.block_number
- AND eet.transaction_hash = bl.transaction_hash
From e4a2c7763144356b5f33d4a467cd547c4c74e206 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Thu, 12 Dec 2024 23:56:41 -0500
Subject: [PATCH 14/32] check
---
.../datapipeline/models/code/daily_address_summary.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/op_analytics/datapipeline/models/code/daily_address_summary.py b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
index f11c458ad4a..b20bbe4d894 100644
--- a/src/op_analytics/datapipeline/models/code/daily_address_summary.py
+++ b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
@@ -6,7 +6,7 @@
@register_model(
- input_datasets=["refined_transactions_fees_v1"],
+ input_datasets=["intermediate/refined_transactions_fees_v1"],
expected_outputs=["summary_v1"],
auxiliary_views=[
TemplatedSQLQuery(
From a7850609b09967a68eaeffacd44f95cf478a5077 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 00:02:34 -0500
Subject: [PATCH 15/32] undo
---
.../adhoc/refined_transactions_fees_dev.ipynb | 176 ++++++++++++++++++
.../datapipeline/models/compute/udfs.py | 4 +-
2 files changed, 178 insertions(+), 2 deletions(-)
create mode 100644 notebooks/adhoc/refined_transactions_fees_dev.ipynb
diff --git a/notebooks/adhoc/refined_transactions_fees_dev.ipynb b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
new file mode 100644
index 00000000000..63d423035d1
--- /dev/null
+++ b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
@@ -0,0 +1,176 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Prepare data reader for a given chain and date"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from op_analytics.coreutils.duckdb_inmem import init_client\n",
+ "from op_analytics.coreutils.partitioned.reader import DataReader\n",
+ "from op_analytics.coreutils.partitioned.location import DataLocation\n",
+ "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n",
+ "\n",
+ "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
+ "\n",
+ "\n",
+ "# Define the input data range.\n",
+ "read_batches: list[DataReader] = construct_data_readers(\n",
+ " chains=[\"op\"],\n",
+ " models=[\"refined_transactions_fees\"],\n",
+ " range_spec=\"@20241118:+1\",\n",
+ " read_from=DataLocation.GCS\n",
+ ")\n",
+ "\n",
+ "\n",
+ "# Select input for one date and build the intermediate model inputs.\n",
+ "batch = read_batches[0]\n",
+ "\n",
+ "\n",
+ "duckdb_client = init_client()\n",
+ "create_duckdb_macros(duckdb_client)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Run the model\n",
+ "\n",
+ "This automatically registers the model outputs as duckdb tables."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
+ "\n",
+ "execute_model_in_memory(\n",
+ " duckdb_client=duckdb_client,\n",
+ " model=\"refined_transactions_fees\",\n",
+ " data_reader=batch,\n",
+ " limit_input_parquet_files=1\n",
+ ")\n",
+ "\n",
+ "# The duckdb database will have the following:\n",
+ "# - input tables\n",
+ "# - views used by the model\n",
+ "# - model outputs\n",
+ "# \n",
+ "# You can use duckdb to inspect any of the above results.\n",
+ "duckdb_client.sql(\"SHOW TABLES\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Verify model results"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check the data output size"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) FROM refined_transactions_fees_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"SELECT input FROM ingestion_traces_v1 LIMIT 10\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### You can also convert the results to dataframes to inspect them in more familiar ways"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\").pl().head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Get table schema"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"DESCRIBE refined_transactions_fees_v1\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": ".venv",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/src/op_analytics/datapipeline/models/compute/udfs.py b/src/op_analytics/datapipeline/models/compute/udfs.py
index 3cc33378e87..9912dfb2195 100644
--- a/src/op_analytics/datapipeline/models/compute/udfs.py
+++ b/src/op_analytics/datapipeline/models/compute/udfs.py
@@ -45,7 +45,7 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
--Count non-zero bytes for binary data that is encoded as a hex string. We don't use hexstr_bytelen because we need to substring the input data.
CREATE OR REPLACE MACRO hexstr_nonzero_bytes(x)
- AS length( REPLACE(TO_HEX(FROM_HEX(SUBSTR(x, 3))), '00', '') ) / 2;
+ AS length(replace(hex(unhex(substr(x, 3))), '00', '')) / 2;
--Count non-zero bytes for binary data that is encoded as a hex string
CREATE OR REPLACE MACRO hexstr_zero_bytes(x)
@@ -57,7 +57,7 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
--Get the method id for input data. This is the first 4 bytes, or first 10 string characters for binary data that is encoded as a hex string.
CREATE OR REPLACE MACRO hexstr_method_id(x)
- AS substring(x,1,10);
+ AS substring(x,1,10)
""")
From 7905ab0922eb638b29df9eb5d269070c0a54dc5f Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 00:19:21 -0500
Subject: [PATCH 16/32] fix eet
---
...event_emitting_transactions_list_dev.ipynb | 275 ++++++++++++++++++
.../adhoc/refined_transactions_fees_dev.ipynb | 18 +-
.../code/event_emitting_transactions_list.py | 6 +-
.../event_emitting_transactions_list.sql.j2 | 10 +-
.../refined_transactions_fees.sql.j2 | 8 +-
5 files changed, 307 insertions(+), 10 deletions(-)
create mode 100644 notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
diff --git a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
new file mode 100644
index 00000000000..21406f3a971
--- /dev/null
+++ b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
@@ -0,0 +1,275 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Prepare data reader for a given chain and date"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n"
+ ]
+ }
+ ],
+ "source": [
+ "from op_analytics.coreutils.duckdb_inmem import init_client\n",
+ "from op_analytics.coreutils.partitioned.reader import DataReader\n",
+ "from op_analytics.coreutils.partitioned.location import DataLocation\n",
+ "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n",
+ "\n",
+ "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
+ "\n",
+ "\n",
+ "# Define the input data range.\n",
+ "read_batches: list[DataReader] = construct_data_readers(\n",
+ " chains=[\"op\"],\n",
+ " models=[\"event_emitting_transactions_list\"],\n",
+ " range_spec=\"@20241118:+1\",\n",
+ " read_from=DataLocation.GCS\n",
+ ")\n",
+ "\n",
+ "\n",
+ "# Select input for one date and build the intermediate model inputs.\n",
+ "batch = read_batches[0]\n",
+ "\n",
+ "\n",
+ "duckdb_client = init_client()\n",
+ "create_duckdb_macros(duckdb_client)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Run the model\n",
+ "\n",
+ "This automatically registers the model outputs as duckdb tables."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:14:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
+ "dict_keys(['event_emitting_transactions_list_v1'])\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "┌─────────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├─────────────────────────────────────┤\n",
+ "│ event_emitting_transactions_list │\n",
+ "│ event_emitting_transactions_list_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "└─────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
+ "\n",
+ "execute_model_in_memory(\n",
+ " duckdb_client=duckdb_client,\n",
+ " model=\"event_emitting_transactions_list\",\n",
+ " data_reader=batch,\n",
+ " limit_input_parquet_files=1\n",
+ ")\n",
+ "\n",
+ "# The duckdb database will have the following:\n",
+ "# - input tables\n",
+ "# - views used by the model\n",
+ "# - model outputs\n",
+ "# \n",
+ "# You can use duckdb to inspect any of the above results.\n",
+ "duckdb_client.sql(\"SHOW TABLES\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Verify model results"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
+ "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ gas_price │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │\n",
+ "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890757 │ mainnet │ op │ 10 │ 128145990 │ 0x6b6aa9ee2a63a6e07504e13163a1c5e38a7ad9ad610dc75d5faeb7c7b73fcb28 │ 1012547 │ 10 │ 3 │ 0 │ 4 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0xb02d17c075ebe278fd28ee509eb3ac5b3085c20016116cc1179336f69c945a61 │ 1109509630 │ 3 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890763 │ mainnet │ op │ 10 │ 128145993 │ 0xfda315a9d09fa1cf40c7d7af0f578589d3bbdf151367ce11ac56408e6968bb37 │ 10025300 │ 6 │ 0 │ 0 │ 4 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890763 │ mainnet │ op │ 10 │ 128145993 │ 0x82ad92eb4a44a9a8edfef3bd1f3baa64b1e28ad9424cd365733d8f10f57aa18b │ 247029 │ 10 │ 1 │ 0 │ 1 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0xbbff1e7974443e441c535c1acd59b66a79532921788598000810aa31272a9171 │ 15037965 │ 6 │ 0 │ 0 │ 4 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0xb2ea35d784f78b1e51d971845f8dd5013c3acec101cecb2c4ba75903d189850f │ 215459 │ 13 │ 2 │ 0 │ 3 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0x8bf3c27e006f06cbdd62385d37208b2f56d7f4bad00bacf470a0c3de81e4cf06 │ 10000000 │ 10 │ 0 │ 1 │ 3 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0xa9f7711166e923fda0807100f37ded741b87d951522db1c18fcc3bc0b5557a04 │ 1203052 │ 16 │ 0 │ 0 │ 7 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0x839c031e819358157b6d9f1b2a45d8f81b340b7f8c03865bd0cc054b909817fc │ 1002543 │ 6 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x23b91de60536da3155b36dd60ea075888d5b29dc3d01f11085e30d9212d6d027 │ 4098824393 │ 3 │ 0 │ 0 │ 2 │\n",
+ "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┤\n",
+ "│ 10 rows 13 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_list_v1 LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check the data output size"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────┐\n",
+ "│ count_star() │\n",
+ "│ int64 │\n",
+ "├──────────────┤\n",
+ "│ 16679 │\n",
+ "└──────────────┘"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) FROM event_emitting_transactions_list_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "BinderException",
+ "evalue": "Binder Error: Referenced column \"input\" not found in FROM clause!\nCandidate bindings: \"event_emitting_transactions_list_v1.network\", \"event_emitting_transactions_list_v1.chain_id\", \"event_emitting_transactions_list_v1.block_number\"",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mBinderException\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mduckdb_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msql\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSELECT input FROM event_emitting_transactions_list_v1 LIMIT 10\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mBinderException\u001b[0m: Binder Error: Referenced column \"input\" not found in FROM clause!\nCandidate bindings: \"event_emitting_transactions_list_v1.network\", \"event_emitting_transactions_list_v1.chain_id\", \"event_emitting_transactions_list_v1.block_number\""
+ ]
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT input FROM event_emitting_transactions_list_v1 LIMIT 10\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### You can also convert the results to dataframes to inspect them in more familiar ways"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\").pl().head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Get table schema"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "duckdb_client.sql(\"DESCRIBE event_emitting_transactions_v1\")\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": ".venv",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/notebooks/adhoc/refined_transactions_fees_dev.ipynb b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
index 63d423035d1..e7b7eac54cf 100644
--- a/notebooks/adhoc/refined_transactions_fees_dev.ipynb
+++ b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
@@ -9,9 +9,23 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[33m\u001b[1mwarning \u001b[0m] \u001b[1mMISSING DATA \u001b[0m \u001b[36mchain\u001b[0m=\u001b[35mop\u001b[0m \u001b[36mdate\u001b[0m=\u001b[35m2024-11-18\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m94\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1minput not ready for 1 batches.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m99\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n"
+ ]
+ }
+ ],
"source": [
"from op_analytics.coreutils.duckdb_inmem import init_client\n",
"from op_analytics.coreutils.partitioned.reader import DataReader\n",
diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
index 94f80d0e1bf..b1e381ef7da 100644
--- a/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
+++ b/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
@@ -6,7 +6,7 @@
@register_model(
- input_datasets=["ingestion/logs_v1"],
+ input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1"],
expected_outputs=["event_emitting_transactions_list_v1"],
auxiliary_views=[
TemplatedSQLQuery(
@@ -17,5 +17,7 @@
)
def event_emitting_transactions_list(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
return {
- "event_emitting_transactions_list_v1": duckdb_client.view("event_emitting_transactions_list"),
+ "event_emitting_transactions_list_v1": duckdb_client.view(
+ "event_emitting_transactions_list"
+ ),
}
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
index 101f18f55b2..81f096cdd7f 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
@@ -12,7 +12,7 @@ WITH topic0_filters AS ( -- list of events that we want to indicate for possible
,('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer')
,('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer')
,('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer')
- ) a (topic, description)
+ ) a (topic, description, category)
)
-- Select the columns for joining back to transactions and sum event types
@@ -25,6 +25,7 @@ SELECT
,l.network, l.chain, l.chain_id
,l.block_number
,l.transaction_hash
+ ,t.transaction_type
,COUNT(*) AS count_total_events
,SUM(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events
@@ -32,10 +33,13 @@ SELECT
,SUM(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
FROM ingestion_logs_v1 AS l
-
+INNER JOIN ingestion_transactions_v1 AS t
+ ON l.block_number = t.block_number
+ AND l.transaction_index = t.transaction_index
+ AND l.transaction_hash = t.hash
LEFT JOIN topic0_filters AS f
ON l.topic0 = f.topic
-GROUP BY 1,2,3,4,5,6,7,8
+GROUP BY 1,2,3,4,5,6,7,8,9
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 55d952bef8b..a2e1e7152b3 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -64,10 +64,12 @@ pt1 AS (
COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
FROM ingestion_transactions_v1 AS t
- INNER JOIN pb AS b ON t.block_number = b.number
+ INNER JOIN pb AS b
+ ON t.block_number = b.number
LEFT JOIN event_emitting_transactions_v1 eet
- ON eet.block_number = bl.block_number
- AND eet.transaction_hash = bl.transaction_hash
+ ON eet.block_number = t.block_number
+ AND eet.transaction_index = t.transaction_index
+ AND eet.transaction_hash = t.hash
WHERE 1=1
-- Optional address filter for faster results when developing.
-- AND from_address LIKE '0x00%'
From 65926827b2b03b95138a0a11f929cfd1bc2a883c Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 07:24:51 -0500
Subject: [PATCH 17/32] simplify views
---
.../models/code/refined_transactions_fees.py | 10 +-
.../templates/base_transactions_fees.sql.j2 | 147 ++++++++++++++++++
.../templates/daily_address_summary.sql.j2 | 7 +-
.../refined_transactions_fees.sql.j2 | 146 ++---------------
4 files changed, 174 insertions(+), 136 deletions(-)
create mode 100644 src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
index 19b587394c9..95e2c9662d1 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
@@ -6,9 +6,17 @@
@register_model(
- input_datasets=["ingestion/logs_v1", "event_emitting_transactions_v1"],
+ input_datasets=[
+ "ingestion/transactions_v1",
+ "ingestion/blocks_v1",
+ "intermediate/event_emitting_transactions_v1",
+ ],
expected_outputs=["refined_transactions_fees_v1"],
auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="base_transactions_fees",
+ context={},
+ ),
TemplatedSQLQuery(
template_name="refined_transactions_fees",
context={},
diff --git a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
new file mode 100644
index 00000000000..a2e1e7152b3
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
@@ -0,0 +1,147 @@
+WITH
+
+pb AS (
+ SELECT
+ number,
+ base_fee_per_gas
+ FROM
+ ingestion_blocks_v1
+),
+
+-- Select the columns that we want from transactions joined to blocks.
+-- Include some minor transformations that are needed for further calculations.
+pt1 AS (
+ SELECT
+ -- Transaction fields
+ t.dt,
+ t.chain,
+ t.chain_id,
+ t.network,
+ t.nonce,
+ t.transaction_index,
+ t.from_address,
+ t.to_address,
+ t.block_number,
+ t.block_timestamp,
+ t.gas_price,
+ t.gas AS gas_limit,
+ t.receipt_gas_used,
+ t.receipt_l1_gas_used,
+ -- Fees
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
+ t.receipt_l1_gas_price,
+ t.receipt_l1_blob_base_fee,
+ b.base_fee_per_gas,
+ t.max_priority_fee_per_gas,
+ if(t.max_priority_fee_per_gas = 0, t.gas_price - t.max_priority_fee_per_gas, 0) AS base_legacy_fee_per_gas
+ -- L2 Fees and breakdown into BASE and PRIORITY contributions
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
+ -- Convenience columns
+ epoch_to_hour(t.block_timestamp) AS block_hour,
+ hexstr_method_id(t.input) AS method_id,
+ t.receipt_status = 1 AS success,
+ -- L1 Fee BASE and BLOB scalars
+ coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
+ AS l1_base_scalar,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
+
+ -- Transaction Attributes
+ transaction_type,
+ hexstr_bytelen(t.input) AS input_byte_length,
+ hexstr_calldata_gas(t.input) AS input_calldata_gas,
+ transaction_type = 126 AS is_system_transaction,
+ ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ transaction_type = 126
+ AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
+ AND to_address = lower('0x4200000000000000000000000000000000000015')
+ ) AS is_attributes_deposited_transaction,
+
+ COALESCE(eet.count_total_events,0) AS log_count_total_events,
+ COALESCE(eet.count_approval_events,0) AS log_count_approval_events,
+ COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events,
+ COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
+
+ FROM ingestion_transactions_v1 AS t
+ INNER JOIN pb AS b
+ ON t.block_number = b.number
+ LEFT JOIN event_emitting_transactions_v1 eet
+ ON eet.block_number = t.block_number
+ AND eet.transaction_index = t.transaction_index
+ AND eet.transaction_hash = t.hash
+ WHERE 1=1
+ -- Optional address filter for faster results when developing.
+ -- AND from_address LIKE '0x00%'
+),
+
+
+-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+pt2 AS (
+ SELECT
+ *,
+ coalesce(
+ receipt_l1_gas_used,
+ round(16 * l1_fee / (
+ (l1_base_scalar * receipt_l1_gas_price)
+ + (l1_blob_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ ) AS l1_gas_used
+ FROM pt1
+),
+
+-- Add more fee calculations.
+-- Reuses results from the previous CTEs.
+
+pt3 AS (
+SELECT
+ *,
+ --
+ -- Total fee
+ l2_fee + l1_fee AS tx_fee,
+ --
+ -- L2 Legacy Fee
+ if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy,
+ --
+ -- L1 Base
+ div16(l1_gas_used) * l1_base_scalar * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used) * l1_base_scalar AS l1_base_scaled_size,
+ --
+ -- L1 Blob
+ div16(l1_gas_used) * l1_blob_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
+ div16(l1_gas_used) * l1_blob_scalar AS l1_blob_scaled_size
+
+FROM pt2
+)
+
+
+-- Generate gas fee breakdowns in native terms, for later aggregation
+-- Generate gas prices in gwei terms
+SELECT *
+
+-- Fees
+, wei_to_eth(tx_fee) AS tx_fee_native
+
+ -- Native Breakdown
+ , wei_to_eth(l1_fee) AS l1_fee_native
+ , wei_to_eth(l2_fee) AS l2_fee_native
+
+ -- L1 Breakdown
+ , wei_to_eth(l1_base_fee) AS l1_base_fee_native
+ , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
+
+ -- L2 Breakdown
+ , wei_to_eth(l2_base_fee) AS l2_base_fee_native
+ , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
+ , wei_to_eth(l2_base_legacy) AS l2_base_legacy_native
+
+-- Gas Prices
+ , wei_to_gwei(gas_price) AS l2_gas_price_gwei
+ , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
+ , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
+ , wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei
+
+ , wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei
+ , wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
+
+FROM pt3
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index 6e16085194b..b4a08144c2e 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -82,7 +82,12 @@ SELECT
) AS l1_base_price_avg_gwei,
wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
- AS l1_blob_fee_avg_gwei
+ AS l1_blob_fee_avg_gwei,
+
+ -- Qualified Transactions Variants
+ count(if(is_qualified_tx_not_approval_wrapping_transfer, 1, NULL)) AS qualified_tx_not_approval_wrapping_transfer_cnt,
+ count(if(is_qualified_tx_not_approval_wrapping, 1, NULL)) AS qualified_tx_not_approval_wrapping_cnt
+
FROM
refined_transactions_fees
WHERE gas_price > 0
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index a2e1e7152b3..88dbc85f2f0 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -1,147 +1,25 @@
-WITH
-
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- ingestion_blocks_v1
-),
-
--- Select the columns that we want from transactions joined to blocks.
--- Include some minor transformations that are needed for further calculations.
-pt1 AS (
+-- Extend additional joins to base_transaction_fees
+WITH base_refined AS (
SELECT
-- Transaction fields
- t.dt,
- t.chain,
- t.chain_id,
- t.network,
- t.nonce,
- t.transaction_index,
- t.from_address,
- t.to_address,
- t.block_number,
- t.block_timestamp,
- t.gas_price,
- t.gas AS gas_limit,
- t.receipt_gas_used,
- t.receipt_l1_gas_used,
- -- Fees
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
- t.receipt_l1_gas_price,
- t.receipt_l1_blob_base_fee,
- b.base_fee_per_gas,
- t.max_priority_fee_per_gas,
- if(t.max_priority_fee_per_gas = 0, t.gas_price - t.max_priority_fee_per_gas, 0) AS base_legacy_fee_per_gas
- -- L2 Fees and breakdown into BASE and PRIORITY contributions
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
- -- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- hexstr_method_id(t.input) AS method_id,
- t.receipt_status = 1 AS success,
- -- L1 Fee BASE and BLOB scalars
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
-
- -- Transaction Attributes
- transaction_type,
- hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_calldata_gas(t.input) AS input_calldata_gas,
- transaction_type = 126 AS is_system_transaction,
- ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
- transaction_type = 126
- AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
- AND to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction,
+ bt.*,
COALESCE(eet.count_total_events,0) AS log_count_total_events,
COALESCE(eet.count_approval_events,0) AS log_count_approval_events,
COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events,
COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
- FROM ingestion_transactions_v1 AS t
- INNER JOIN pb AS b
- ON t.block_number = b.number
+ FROM base_transaction_fees AS bt
LEFT JOIN event_emitting_transactions_v1 eet
- ON eet.block_number = t.block_number
- AND eet.transaction_index = t.transaction_index
- AND eet.transaction_hash = t.hash
+ ON eet.block_number = bt.block_number
+ AND eet.transaction_index = bt.transaction_index
+ AND eet.transaction_hash = bt.hash
WHERE 1=1
- -- Optional address filter for faster results when developing.
- -- AND from_address LIKE '0x00%'
-),
-
-
--- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
-pt2 AS (
- SELECT
- *,
- coalesce(
- receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_scalar * receipt_l1_gas_price)
- + (l1_blob_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS l1_gas_used
- FROM pt1
-),
-
--- Add more fee calculations.
--- Reuses results from the previous CTEs.
-
-pt3 AS (
-SELECT
- *,
- --
- -- Total fee
- l2_fee + l1_fee AS tx_fee,
- --
- -- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy,
- --
- -- L1 Base
- div16(l1_gas_used) * l1_base_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_scalar AS l1_base_scaled_size,
- --
- -- L1 Blob
- div16(l1_gas_used) * l1_blob_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_scalar AS l1_blob_scaled_size
-
-FROM pt2
)
+SELECT
+ *
+ , log_count_total_events > log_count_approval_events + log_count_wrapping_events + log_count_transfer_events AS is_qualified_tx_not_approval_wrapping_transfer
+ , log_count_total_events > log_count_approval_events + log_count_wrapping_events AS is_qualified_tx_not_approval_wrapping
--- Generate gas fee breakdowns in native terms, for later aggregation
--- Generate gas prices in gwei terms
-SELECT *
-
--- Fees
-, wei_to_eth(tx_fee) AS tx_fee_native
-
- -- Native Breakdown
- , wei_to_eth(l1_fee) AS l1_fee_native
- , wei_to_eth(l2_fee) AS l2_fee_native
-
- -- L1 Breakdown
- , wei_to_eth(l1_base_fee) AS l1_base_fee_native
- , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
-
- -- L2 Breakdown
- , wei_to_eth(l2_base_fee) AS l2_base_fee_native
- , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
- , wei_to_eth(l2_base_legacy) AS l2_base_legacy_native
-
--- Gas Prices
- , wei_to_gwei(gas_price) AS l2_gas_price_gwei
- , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
- , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
- , wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei
-
- , wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei
- , wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
-
-FROM pt3
+FROM base_refined
\ No newline at end of file
From 1617cba87bcdeaec37aa793c41e61ede440e3649 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 07:26:16 -0500
Subject: [PATCH 18/32] mod nb
---
...event_emitting_transactions_list_dev.ipynb | 224 +++++++++++++-----
1 file changed, 166 insertions(+), 58 deletions(-)
diff --git a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
index 21406f3a971..39b4882bc72 100644
--- a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
+++ b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n"
+ "\u001b[2m2024-12-13 07:19:14\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:14\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n"
]
}
],
@@ -68,12 +68,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:50\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m\n",
- "\u001b[2m2024-12-13 00:14:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8769\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
+ "\u001b[2m2024-12-13 07:19:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
"dict_keys(['event_emitting_transactions_list_v1'])\n"
]
},
@@ -130,23 +130,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
- "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ gas_price │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │\n",
- "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │\n",
- "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890757 │ mainnet │ op │ 10 │ 128145990 │ 0x6b6aa9ee2a63a6e07504e13163a1c5e38a7ad9ad610dc75d5faeb7c7b73fcb28 │ 1012547 │ 10 │ 3 │ 0 │ 4 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0xb02d17c075ebe278fd28ee509eb3ac5b3085c20016116cc1179336f69c945a61 │ 1109509630 │ 3 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890763 │ mainnet │ op │ 10 │ 128145993 │ 0xfda315a9d09fa1cf40c7d7af0f578589d3bbdf151367ce11ac56408e6968bb37 │ 10025300 │ 6 │ 0 │ 0 │ 4 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890763 │ mainnet │ op │ 10 │ 128145993 │ 0x82ad92eb4a44a9a8edfef3bd1f3baa64b1e28ad9424cd365733d8f10f57aa18b │ 247029 │ 10 │ 1 │ 0 │ 1 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0xbbff1e7974443e441c535c1acd59b66a79532921788598000810aa31272a9171 │ 15037965 │ 6 │ 0 │ 0 │ 4 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0xb2ea35d784f78b1e51d971845f8dd5013c3acec101cecb2c4ba75903d189850f │ 215459 │ 13 │ 2 │ 0 │ 3 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0x8bf3c27e006f06cbdd62385d37208b2f56d7f4bad00bacf470a0c3de81e4cf06 │ 10000000 │ 10 │ 0 │ 1 │ 3 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0xa9f7711166e923fda0807100f37ded741b87d951522db1c18fcc3bc0b5557a04 │ 1203052 │ 16 │ 0 │ 0 │ 7 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0x839c031e819358157b6d9f1b2a45d8f81b340b7f8c03865bd0cc054b909817fc │ 1002543 │ 6 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x23b91de60536da3155b36dd60ea075888d5b29dc3d01f11085e30d9212d6d027 │ 4098824393 │ 3 │ 0 │ 0 │ 2 │\n",
- "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┤\n",
- "│ 10 rows 13 columns │\n",
- "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬──────────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
+ "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ transaction_type │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │\n",
+ "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int32 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼──────────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0x0f3da35693644abe74388ab718881855a50e147201bb5be97ff4d653e8e7ba12 │ 0 │ 11 │ 0 │ 0 │ 5 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0xc2a2f0930d2ac4e7dec64fd4cebab2e639c57833122d696a1a8552de009b4f6c │ 0 │ 1 │ 0 │ 1 │ 0 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0xd2964ea0788e9cac8791337a99f3199d7190f519a3f65c4c5b650c869ba5a0cd │ 2 │ 10 │ 1 │ 0 │ 1 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890757 │ mainnet │ op │ 10 │ 128145990 │ 0x6b6aa9ee2a63a6e07504e13163a1c5e38a7ad9ad610dc75d5faeb7c7b73fcb28 │ 0 │ 10 │ 3 │ 0 │ 4 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890757 │ mainnet │ op │ 10 │ 128145990 │ 0x3669f9fe8fdaaffda96bffb7184fca2a2d0169b5f2889127dd5ae1e2a12dc220 │ 2 │ 6 │ 0 │ 0 │ 1 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0xc35deaac4d11790caa169138f6849be7a6eccbab9c7a2155e59473fdf42c9412 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0x1235a81f6e53a98fd084110155e10a2a9987364008a22337339329ad40242387 │ 0 │ 12 │ 3 │ 0 │ 3 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0x4d862c5ed6a09583d3c45ed805cbec6d67fa3649e1ab5aaf3843e9f8cecaac70 │ 0 │ 9 │ 0 │ 0 │ 5 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890761 │ mainnet │ op │ 10 │ 128145992 │ 0xd9049775812dc33560bdb384e5596cd9432ff2fd77949852eb67cfeefa4f446e │ 2 │ 31 │ 0 │ 0 │ 16 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x49047d659e4148cf9fef35d0ff2499ef771d7d3e3d805b437906f60d98c7d4b6 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
+ "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴──────────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┤\n",
+ "│ 10 rows 13 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 3,
@@ -173,12 +173,12 @@
{
"data": {
"text/plain": [
- "┌──────────────┐\n",
- "│ count_star() │\n",
- "│ int64 │\n",
- "├──────────────┤\n",
- "│ 16679 │\n",
- "└──────────────┘"
+ "┌────────────────┐\n",
+ "│ interm_num_txs │\n",
+ "│ int64 │\n",
+ "├────────────────┤\n",
+ "│ 16679 │\n",
+ "└────────────────┘"
]
},
"execution_count": 4,
@@ -187,7 +187,32 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) FROM event_emitting_transactions_list_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_txs FROM event_emitting_transactions_list_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌───────────────────┐\n",
+ "│ ingestion_num_txs │\n",
+ "│ int64 │\n",
+ "├───────────────────┤\n",
+ "│ 16679 │\n",
+ "└───────────────────┘"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(DISTINCT transaction_hash) as ingestion_num_txs FROM ingestion_logs_v1\")"
]
},
{
@@ -196,19 +221,34 @@
"metadata": {},
"outputs": [
{
- "ename": "BinderException",
- "evalue": "Binder Error: Referenced column \"input\" not found in FROM clause!\nCandidate bindings: \"event_emitting_transactions_list_v1.network\", \"event_emitting_transactions_list_v1.chain_id\", \"event_emitting_transactions_list_v1.block_number\"",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mBinderException\u001b[0m Traceback (most recent call last)",
- "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mduckdb_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msql\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSELECT input FROM event_emitting_transactions_list_v1 LIMIT 10\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
- "\u001b[0;31mBinderException\u001b[0m: Binder Error: Referenced column \"input\" not found in FROM clause!\nCandidate bindings: \"event_emitting_transactions_list_v1.network\", \"event_emitting_transactions_list_v1.chain_id\", \"event_emitting_transactions_list_v1.block_number\""
- ]
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────────────────────────────────────────┐\n",
+ "│ topic0 │\n",
+ "│ varchar │\n",
+ "├────────────────────────────────────────────────────────────────────┤\n",
+ "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
+ "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
+ "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
+ "│ 0x112c256902bf554b6ed882d2936687aaeb4225e8cd5b51303c90ca6cf43a8602 │\n",
+ "│ 0xcf2aa50876cdfbb541206f89af0ee78d44a2abf8d328e37fa4917f982149848a │\n",
+ "│ 0xb3e2773606abfd36b5bd91394b3a54d1398336c65005baf7bf7a05efeffaf75b │\n",
+ "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
+ "│ 0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1 │\n",
+ "│ 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822 │\n",
+ "│ 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67 │\n",
+ "├────────────────────────────────────────────────────────────────────┤\n",
+ "│ 10 rows │\n",
+ "└────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT input FROM event_emitting_transactions_list_v1 LIMIT 10\")\n"
+ "duckdb_client.sql(\"SELECT topic0 FROM ingestion_logs_v1 LIMIT 10\")\n"
]
},
{
@@ -220,11 +260,56 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 13)dt | block_hour | block_timestamp | network | chain | chain_id | block_number | transaction_hash | transaction_type | count_total_events | count_approval_events | count_wrapping_events | count_transfer_events |
---|
date | datetime[μs] | u32 | str | str | i32 | i64 | str | i32 | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0x0f3da35693644abe74388ab71888… | 0 | 11 | 0 | 0 | 5 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0xc2a2f0930d2ac4e7dec64fd4ceba… | 0 | 1 | 0 | 1 | 0 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0xd2964ea0788e9cac8791337a99f3… | 2 | 10 | 1 | 0 | 1 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890757 | "mainnet" | "op" | 10 | 128145990 | "0x6b6aa9ee2a63a6e07504e13163a1… | 0 | 10 | 3 | 0 | 4 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890757 | "mainnet" | "op" | 10 | 128145990 | "0x3669f9fe8fdaaffda96bffb7184f… | 2 | 6 | 0 | 0 | 1 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 13)\n",
+ "┌────────────┬───────────┬───────────┬─────────┬───┬───────────┬───────────┬───────────┬───────────┐\n",
+ "│ dt ┆ block_hou ┆ block_tim ┆ network ┆ … ┆ count_tot ┆ count_app ┆ count_wra ┆ count_tra │\n",
+ "│ --- ┆ r ┆ estamp ┆ --- ┆ ┆ al_events ┆ roval_eve ┆ pping_eve ┆ nsfer_eve │\n",
+ "│ date ┆ --- ┆ --- ┆ str ┆ ┆ --- ┆ nts ┆ nts ┆ nts │\n",
+ "│ ┆ datetime[ ┆ u32 ┆ ┆ ┆ i64 ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ μs] ┆ ┆ ┆ ┆ ┆ decimal[3 ┆ decimal[3 ┆ decimal[3 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ ┆ 8,0] ┆ 8,0] ┆ 8,0] │\n",
+ "╞════════════╪═══════════╪═══════════╪═════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 11 ┆ 0 ┆ 0 ┆ 5 │\n",
+ "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 1 ┆ 0 ┆ 1 ┆ 0 │\n",
+ "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 10 ┆ 1 ┆ 0 ┆ 1 │\n",
+ "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 10 ┆ 3 ┆ 0 ┆ 4 │\n",
+ "│ ┆ 8 ┆ 7 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 6 ┆ 0 ┆ 0 ┆ 1 │\n",
+ "│ ┆ 8 ┆ 7 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "└────────────┴───────────┴───────────┴─────────┴───┴───────────┴───────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\").pl().head()"
+ "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_list_v1 LIMIT 5\").pl()"
]
},
{
@@ -236,19 +321,42 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌───────────────────────┬───────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├───────────────────────┼───────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_hour │ TIMESTAMP │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_type │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_wrapping_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transfer_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "├───────────────────────┴───────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 13 rows 6 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"DESCRIBE event_emitting_transactions_v1\")\n"
+ "duckdb_client.sql(\"DESCRIBE event_emitting_transactions_list_v1\")\n"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
From 09cfe7974ac425c5a341fe26105ffdcc448d0035 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 10:25:24 -0500
Subject: [PATCH 19/32] push latest - through refined transactions
---
...event_emitting_transactions_list_dev.ipynb | 77 +++---
.../adhoc/refined_transactions_fees_dev.ipynb | 227 +++++++++++++++---
.../code/event_emitting_transactions_list.py | 2 +
.../models/code/refined_transactions_fees.py | 6 +-
.../templates/base_transactions_fees.sql.j2 | 34 +--
.../templates/daily_address_summary.sql.j2 | 6 +-
.../event_emitting_transactions_list.sql.j2 | 3 +-
.../refined_transactions_fees.sql.j2 | 4 +-
8 files changed, 267 insertions(+), 92 deletions(-)
diff --git a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
index 39b4882bc72..78dcaf60024 100644
--- a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
+++ b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 07:19:14\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:14\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n"
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n"
]
}
],
@@ -68,12 +68,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m\n",
- "\u001b[2m2024-12-13 07:19:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m12154\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:34\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:34\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
+ "\u001b[2m2024-12-13 08:58:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
"dict_keys(['event_emitting_transactions_list_v1'])\n"
]
},
@@ -130,23 +130,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬──────────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
- "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ transaction_type │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │\n",
- "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int32 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │\n",
- "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼──────────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0x0f3da35693644abe74388ab718881855a50e147201bb5be97ff4d653e8e7ba12 │ 0 │ 11 │ 0 │ 0 │ 5 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0xc2a2f0930d2ac4e7dec64fd4cebab2e639c57833122d696a1a8552de009b4f6c │ 0 │ 1 │ 0 │ 1 │ 0 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0xd2964ea0788e9cac8791337a99f3199d7190f519a3f65c4c5b650c869ba5a0cd │ 2 │ 10 │ 1 │ 0 │ 1 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890757 │ mainnet │ op │ 10 │ 128145990 │ 0x6b6aa9ee2a63a6e07504e13163a1c5e38a7ad9ad610dc75d5faeb7c7b73fcb28 │ 0 │ 10 │ 3 │ 0 │ 4 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890757 │ mainnet │ op │ 10 │ 128145990 │ 0x3669f9fe8fdaaffda96bffb7184fca2a2d0169b5f2889127dd5ae1e2a12dc220 │ 2 │ 6 │ 0 │ 0 │ 1 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0xc35deaac4d11790caa169138f6849be7a6eccbab9c7a2155e59473fdf42c9412 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0x1235a81f6e53a98fd084110155e10a2a9987364008a22337339329ad40242387 │ 0 │ 12 │ 3 │ 0 │ 3 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0x4d862c5ed6a09583d3c45ed805cbec6d67fa3649e1ab5aaf3843e9f8cecaac70 │ 0 │ 9 │ 0 │ 0 │ 5 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890761 │ mainnet │ op │ 10 │ 128145992 │ 0xd9049775812dc33560bdb384e5596cd9432ff2fd77949852eb67cfeefa4f446e │ 2 │ 31 │ 0 │ 0 │ 16 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x49047d659e4148cf9fef35d0ff2499ef771d7d3e3d805b437906f60d98c7d4b6 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
- "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴──────────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┤\n",
- "│ 10 rows 13 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬──────────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
+ "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ transaction_index │ transaction_type │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │\n",
+ "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int64 │ int32 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼──────────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0x0f3da35693644abe74388ab718881855a50e147201bb5be97ff4d653e8e7ba12 │ 6 │ 0 │ 11 │ 0 │ 0 │ 5 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0xe5f2bb8587f675aa84c045b73298f6a34f0bbdaaeb45d22a2f4a20d0af788c5a │ 5 │ 0 │ 3 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0xb6a080f67866d9bf3571a126ee7c9263f3778f0400c5dd00a3c64423e73ea65e │ 23 │ 2 │ 2 │ 0 │ 0 │ 1 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890763 │ mainnet │ op │ 10 │ 128145993 │ 0xfda315a9d09fa1cf40c7d7af0f578589d3bbdf151367ce11ac56408e6968bb37 │ 4 │ 0 │ 6 │ 0 │ 0 │ 4 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x882dc42f47ecea249d7540fda95a31c71b3665c4b42651f08819c8a51eeaa52f │ 12 │ 2 │ 10 │ 0 │ 1 │ 3 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0x24adee0e6ed2e6d80be5d20010146d1362cca61cf3b3038f28c973e91a47d17d │ 3 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0x1623043ce3a910f945ec14fb927e0b5f5b639b84f2d5bfd39585344f3c7bdc92 │ 1 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x6179b7e9e318af3a3d91b67dca7e463c1bcfd956403c9370b24fd1b6fb1b509a │ 13 │ 0 │ 3 │ 0 │ 0 │ 2 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x629828cacceea7478ba5d36d709068d0033cf63fbad20d67f96e606c19fc2262 │ 23 │ 0 │ 7 │ 0 │ 0 │ 4 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890773 │ mainnet │ op │ 10 │ 128145998 │ 0x69d2c2d4243dfbc828dccaef2718eb135a38b03f7a6bff07fcf6948cf26c03a5 │ 16 │ 2 │ 1 │ 1 │ 0 │ 0 │\n",
+ "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴──────────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┤\n",
+ "│ 10 rows 14 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 3,
@@ -273,10 +273,10 @@
" white-space: pre-wrap;\n",
"}\n",
"\n",
- "shape: (5, 13)dt | block_hour | block_timestamp | network | chain | chain_id | block_number | transaction_hash | transaction_type | count_total_events | count_approval_events | count_wrapping_events | count_transfer_events |
---|
date | datetime[μs] | u32 | str | str | i32 | i64 | str | i32 | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0x0f3da35693644abe74388ab71888… | 0 | 11 | 0 | 0 | 5 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0xc2a2f0930d2ac4e7dec64fd4ceba… | 0 | 1 | 0 | 1 | 0 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0xd2964ea0788e9cac8791337a99f3… | 2 | 10 | 1 | 0 | 1 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890757 | "mainnet" | "op" | 10 | 128145990 | "0x6b6aa9ee2a63a6e07504e13163a1… | 0 | 10 | 3 | 0 | 4 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890757 | "mainnet" | "op" | 10 | 128145990 | "0x3669f9fe8fdaaffda96bffb7184f… | 2 | 6 | 0 | 0 | 1 |
"
+ "shape: (5, 14)dt | block_hour | block_timestamp | network | chain | chain_id | block_number | transaction_hash | transaction_index | transaction_type | count_total_events | count_approval_events | count_wrapping_events | count_transfer_events |
---|
date | datetime[μs] | u32 | str | str | i32 | i64 | str | i64 | i32 | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0x0f3da35693644abe74388ab71888… | 6 | 0 | 11 | 0 | 0 | 5 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0xe5f2bb8587f675aa84c045b73298… | 5 | 0 | 3 | 0 | 0 | 2 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890759 | "mainnet" | "op" | 10 | 128145991 | "0xb6a080f67866d9bf3571a126ee7c… | 23 | 2 | 2 | 0 | 0 | 1 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890763 | "mainnet" | "op" | 10 | 128145993 | "0xfda315a9d09fa1cf40c7d7af0f57… | 4 | 0 | 6 | 0 | 0 | 4 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890765 | "mainnet" | "op" | 10 | 128145994 | "0x882dc42f47ecea249d7540fda95a… | 12 | 2 | 10 | 0 | 1 | 3 |
"
],
"text/plain": [
- "shape: (5, 13)\n",
+ "shape: (5, 14)\n",
"┌────────────┬───────────┬───────────┬─────────┬───┬───────────┬───────────┬───────────┬───────────┐\n",
"│ dt ┆ block_hou ┆ block_tim ┆ network ┆ … ┆ count_tot ┆ count_app ┆ count_wra ┆ count_tra │\n",
"│ --- ┆ r ┆ estamp ┆ --- ┆ ┆ al_events ┆ roval_eve ┆ pping_eve ┆ nsfer_eve │\n",
@@ -288,17 +288,17 @@
"│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 11 ┆ 0 ┆ 0 ┆ 5 │\n",
"│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 1 ┆ 0 ┆ 1 ┆ 0 │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 3 ┆ 0 ┆ 0 ┆ 2 │\n",
"│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 10 ┆ 1 ┆ 0 ┆ 1 │\n",
- "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 2 ┆ 0 ┆ 0 ┆ 1 │\n",
+ "│ ┆ 8 ┆ 9 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 10 ┆ 3 ┆ 0 ┆ 4 │\n",
- "│ ┆ 8 ┆ 7 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 6 ┆ 0 ┆ 0 ┆ 4 │\n",
+ "│ ┆ 8 ┆ 3 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 6 ┆ 0 ┆ 0 ┆ 1 │\n",
- "│ ┆ 8 ┆ 7 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 10 ┆ 0 ┆ 1 ┆ 3 │\n",
+ "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"└────────────┴───────────┴───────────┴─────────┴───┴───────────┴───────────┴───────────┴───────────┘"
]
@@ -339,13 +339,14 @@
"│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
"│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
"│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
"│ transaction_type │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
"│ count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
"│ count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
"│ count_wrapping_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
"│ count_transfer_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
"├───────────────────────┴───────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 13 rows 6 columns │\n",
+ "│ 14 rows 6 columns │\n",
"└───────────────────────────────────────────────────────────────────────────────┘"
]
},
diff --git a/notebooks/adhoc/refined_transactions_fees_dev.ipynb b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
index e7b7eac54cf..1e3199e739c 100644
--- a/notebooks/adhoc/refined_transactions_fees_dev.ipynb
+++ b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
@@ -16,13 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[33m\u001b[1mwarning \u001b[0m] \u001b[1mMISSING DATA \u001b[0m \u001b[36mchain\u001b[0m=\u001b[35mop\u001b[0m \u001b[36mdate\u001b[0m=\u001b[35m2024-11-18\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m94\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n",
- "\u001b[2m2024-12-13 00:18:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1minput not ready for 1 batches.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m99\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m8495\u001b[0m\n"
+ "\u001b[2m2024-12-13 10:24:38\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:38\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:38\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n"
]
}
],
@@ -63,9 +61,48 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mbase_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
+ "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "dict_keys(['refined_transactions_fees_v1'])\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├──────────────────────────────────┤\n",
+ "│ base_transactions_fees │\n",
+ "│ event_emitting_transactions_list │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ refined_transactions_fees │\n",
+ "│ refined_transactions_fees_v1 │\n",
+ "└──────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
"\n",
@@ -94,9 +131,36 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬─────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────┬───────────┬──────────────────┬─────────────────────┬───────────────┬──────────────────────┬──────────────────────────┬──────────────────┬──────────────────────────┬─────────────────────────┬──────────────┬─────────────────┬─────────────┬─────────────────────┬────────────┬─────────┬────────────────────┬─────────────────────────┬──────────────────┬───────────────────┬────────────────────┬───────────────────────┬─────────────────────────────────────┬─────────────┬───────────────┬────────────────────┬───────────────────────────┬─────────────────────┬────────────────────────────┬─────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬───────────────────────────┬───────────────────┬────────────────────────┬────────────────────────────┬───────────────────────────────┬────────────────────────┬─────────────────────────────┬────────────────────────┬───────────────────────────┬───────────────────────────┬───────────────────────────┬────────────────────────────────────────────────┬───────────────────────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ nonce │ transaction_index │ from_address │ to_address │ block_number │ block_timestamp │ hash │ gas_price │ gas_limit │ receipt_gas_used │ receipt_l1_gas_used │ l1_fee │ receipt_l1_gas_price │ receipt_l1_blob_base_fee │ base_fee_per_gas │ max_priority_fee_per_gas │ base_legacy_fee_per_gas │ l2_fee │ l2_priority_fee │ l2_base_fee │ block_hour │ method_id │ success │ l1_base_fee_scalar │ l1_blob_base_fee_scalar │ transaction_type │ input_byte_length │ input_calldata_gas │ is_system_transaction │ is_attributes_deposited_transaction │ l1_gas_used │ tx_fee │ l2_base_legacy_fee │ l1_base_fee │ l1_base_scaled_size │ l1_blob_fee │ l1_blob_scaled_size │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ l2_gas_price_gwei │ l2_base_gas_price_gwei │ l2_priority_gas_price_gwei │ l2_base_legacy_gas_price_gwei │ l1_base_gas_price_gwei │ l1_blob_base_gas_price_gwei │ log_count_total_events │ log_count_approval_events │ log_count_wrapping_events │ log_count_transfer_events │ is_qualified_tx_not_approval_wrapping_transfer │ is_qualified_tx_not_approval_wrapping │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ uint32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ timestamp │ varchar │ boolean │ decimal(36,7) │ decimal(26,7) │ int32 │ double │ double │ boolean │ boolean │ int64 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ boolean │ boolean │\n",
+ "├────────────┼─────────┼──────────┼─────────┼─────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────┼───────────┼──────────────────┼─────────────────────┼───────────────┼──────────────────────┼──────────────────────────┼──────────────────┼──────────────────────────┼─────────────────────────┼──────────────┼─────────────────┼─────────────┼─────────────────────┼────────────┼─────────┼────────────────────┼─────────────────────────┼──────────────────┼───────────────────┼────────────────────┼───────────────────────┼─────────────────────────────────────┼─────────────┼───────────────┼────────────────────┼───────────────────────────┼─────────────────────┼────────────────────────────┼─────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────────────────────────┼───────────────────────────────┼────────────────────────┼─────────────────────────────┼────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼────────────────────────────────────────────────┼───────────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1236 │ 1 │ 0xcecfc5e576c71e913e900df7e96fc11be2222222 │ 0x0000000000007c4cb8129fc2ae24463c32e5d0da │ 128145646 │ 1731890069 │ 0x740c2dbfffed2f807d7502840596cd4bee063cdc6899e19f6a57b50d63945b00 │ 1509609 │ 363036 │ 303721 │ 1968 │ 464705291307 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1509609 │ 458499955089 │ 0 │ 423387074 │ 2024-11-18 00:00:00 │ 0x03806a3a │ true │ 0.0836320 │ 1.0142130 │ 0 │ 90.0 │ 1392.0 │ false │ false │ 1968 │ 923205246396 │ 922781859322 │ 87582350812.462704000000 │ 10.286736000000 │ 376966580122.755981000000 │ 124.748199000000 │ 0.0000009232052463960 │ 0.0000004647052913070 │ 0.0000004584999550890 │ 0.0000000875823508120 │ 0.0000003769665801230 │ 0.0000000004233870740 │ 0.0000000000000000000 │ 0.0000009227818593220 │ 0.0015096090 │ 0.0000013940 │ 0.0000000000 │ 0.0015096090 │ 8.5141050390 │ 3.0218198190 │ 13 │ 0 │ 0 │ 6 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 558 │ 10 │ 0x72099133f9310c47b3543d6a9c3fef25dd7c71e3 │ 0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8 │ 128145646 │ 1731890069 │ 0x069e5d9f4850092b767b41fb883557c50db14a3f7ab5046e873a39afaf5d1575 │ 452771 │ 67533 │ 51556 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 451377 │ 0 │ 23343061676 │ 23271192612 │ 71869064 │ 2024-11-18 00:00:00 │ 0x095ea7b3 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 68.0 │ 944.0 │ false │ false │ 1600 │ 401025119346 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004010251193460 │ 0.0000003776820576700 │ 0.0000000233430616760 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000718690640 │ 0.0000000232711926120 │ 0.0000000000000000000 │ 0.0004527710 │ 0.0000013940 │ 0.0004513770 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 1 │ 1 │ 0 │ 0 │ false │ false │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 858 │ 15 │ 0x21bdb91661a4472ff0d3871c300d4120a886ad9b │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0xf8c3fa8ece22e50b86ef016e991863191b62f20f376b16dbcca436fc80f8e28c │ 101394 │ 197308 │ 189126 │ 4953 │ 1169231513276 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19176241644 │ 18912600000 │ 263641644 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6388.0 │ false │ false │ 4953 │ 1188407754920 │ 0 │ 220424483523.438909000000 │ 25.889331000000 │ 948737536254.070311937500 │ 313.962311812500 │ 0.0000011884077549200 │ 0.0000011692315132760 │ 0.0000000191762416440 │ 0.0000002204244835230 │ 0.0000009487375362540 │ 0.0000000002636416440 │ 0.0000000189126000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 873 │ 16 │ 0xac50debe83f7dbf2144239bcb946a2506b2782da │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0x8b70ce403d88feb808e4f44d60b95b49fc9299aaf324890ebf9593a5dbc29fd5 │ 101394 │ 197296 │ 189114 │ 4966 │ 1172390823688 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19175024916 │ 18911400000 │ 263624916 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6400.0 │ false │ false │ 4966 │ 1191565848604 │ 0 │ 221003025474.943998000000 │ 25.957282000000 │ 951227661021.141362625000 │ 314.786359875000 │ 0.0000011915658486040 │ 0.0000011723908236880 │ 0.0000000191750249160 │ 0.0000002210030254750 │ 0.0000009512276610210 │ 0.0000000002636249160 │ 0.0000000189114000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1446656 │ 3 │ 0x0771483e9ad0d8c452efbca3451e4e56249b64bd │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 128145646 │ 1731890069 │ 0x94291d07579ee7b6227cd7a2904392d45a39a9ab962892dc6c08a2d08d32bb31 │ 1201665 │ 3000000 │ 522698 │ 3199 │ 755361849249 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1201665 │ 628107892170 │ 0 │ 728641012 │ 2024-11-18 00:00:00 │ 0xe129b4b8 │ true │ 0.0836320 │ 1.0142130 │ 0 │ 214.0 │ 2860.0 │ false │ false │ 3199 │ 1383469741419 │ 1382741100407 │ 142365823297.290747000000 │ 16.721173000000 │ 612762240758.483934562500 │ 202.779211687500 │ 0.0000013834697414190 │ 0.0000007553618492490 │ 0.0000006281078921700 │ 0.0000001423658232970 │ 0.0000006127622407580 │ 0.0000000007286410120 │ 0.0000000000000000000 │ 0.0000013827411004070 │ 0.0012016650 │ 0.0000013940 │ 0.0000000000 │ 0.0012016650 │ 8.5141050390 │ 3.0218198190 │ 12 │ 0 │ 0 │ 8 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 59 │ 4 │ 0x1893d8121f083ebf12227226c94b17871a4d42b7 │ 0x8a2725a6f04816a5274ddd9feadd3bd0c253c1a6 │ 128145646 │ 1731890069 │ 0x1ce1b0856a4d9463cfe6a5718197eef25a976e9934bbc05ab3ef3a38053dfc0f │ 1001394 │ 166761 │ 106027 │ 6746 │ 1592579108540 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 106174801638 │ 106027000000 │ 147801638 │ 2024-11-18 00:00:00 │ 0x891f4e42 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 516.0 │ 6972.0 │ false │ false │ 6746 │ 1698753910178 │ 0 │ 300218769604.102338000000 │ 35.261342000000 │ 1292183206050.869841375000 │ 427.617556125000 │ 0.0000016987539101780 │ 0.0000015925791085400 │ 0.0000001061748016380 │ 0.0000003002187696040 │ 0.0000012921832060510 │ 0.0000000001478016380 │ 0.0000001060270000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 42 │ 5 │ 0x6b08f3ab29cdf708f7059a3acecaf9e905f921bc │ 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45 │ 128145646 │ 1731890069 │ 0xb98479825e34d6d9c94cce974b47024415972c6aecfce3a2584ce6867ddef584 │ 1001394 │ 115761 │ 112669 │ 2383 │ 562643914092 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 112826060586 │ 112669000000 │ 157060586 │ 2024-11-18 00:00:00 │ 0x04e45aaf │ true │ 0.0836320 │ 1.0142130 │ 2 │ 228.0 │ 1776.0 │ false │ false │ 2383 │ 675469974678 │ 0 │ 106051190033.586699000000 │ 12.455941000000 │ 456459024610.024137562500 │ 151.054348687500 │ 0.0000006754699746780 │ 0.0000005626439140920 │ 0.0000001128260605860 │ 0.0000001060511900340 │ 0.0000004564590246100 │ 0.0000000001570605860 │ 0.0000001126690000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 4 │ 1 │ 0 │ 2 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 10500 │ 6 │ 0x43370402cbeba6ab53fbc8a52894537024a39269 │ 0x0000000071727de22e5e9d8baf0edac6f37da032 │ 128145646 │ 1731890069 │ 0xf4e15cd270206216937eddf9a3ac72396ba89a4cebf1eee49af873206eed164f │ 1001394 │ 326206 │ 190204 │ 7054 │ 1665243248025 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 190469144376 │ 190204000000 │ 265144376 │ 2024-11-18 00:00:00 │ 0x765e827f │ true │ 0.0836320 │ 1.0142130 │ 2 │ 1252.0 │ 8404.0 │ false │ false │ 7054 │ 1855712392401 │ 0 │ 313925763532.069062000000 │ 36.871258000000 │ 1351180008224.553196125000 │ 447.141156375000 │ 0.0000018557123924010 │ 0.0000016652432480250 │ 0.0000001904691443760 │ 0.0000003139257635320 │ 0.0000013511800082250 │ 0.0000000002651443760 │ 0.0000001902040000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 4 │ 0 │ 0 │ 1 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1 │ 7 │ 0x8eb24562a06fc42689a66e6b203fc43ed0cb45ab │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 128145646 │ 1731890069 │ 0x72dd6aca2cd8ae01537ce1105987ea8b2ee81a87031d9497138839571c57fe52 │ 1001325 │ 200000 │ 29950 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1001325 │ 29989683750 │ 0 │ 41750300 │ 2024-11-18 00:00:00 │ 0xa9059cbb │ true │ 0.0836320 │ 1.0142130 │ 0 │ 68.0 │ 608.0 │ false │ false │ 1600 │ 407671741420 │ 407629991120 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004076717414200 │ 0.0000003776820576700 │ 0.0000000299896837500 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000417503000 │ 0.0000000000000000000 │ 0.0000004076299911200 │ 0.0010013250 │ 0.0000013940 │ 0.0000000000 │ 0.0010013250 │ 8.5141050390 │ 3.0218198190 │ 1 │ 0 │ 0 │ 1 │ false │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 724110 │ 10 │ 0xa750a354528b56a62ee6f8538ca340f1d986c878 │ 0xca11bde05977b3631167028862be2a173976ca11 │ 128145647 │ 1731890071 │ 0xf775507c1d678f5a650b05bee624db6e6e4b15f1ff6fb7de04801dd9b26ad214 │ 386693 │ 200000 │ 151117 │ 4846 │ 1143957029976 │ 8514105039 │ 3021819819 │ 1392 │ 385301 │ 0 │ 58435886081 │ 58225531217 │ 210354864 │ 2024-11-18 00:00:00 │ 0x82ad56cb │ true │ 0.0836320 │ 1.0142130 │ 2 │ 1124.0 │ 7520.0 │ false │ false │ 4846 │ 1202392916057 │ 0 │ 215662638230.281638000000 │ 25.330042000000 │ 928241893940.485510125000 │ 307.179762375000 │ 0.0000012023929160570 │ 0.0000011439570299760 │ 0.0000000584358860810 │ 0.0000002156626382300 │ 0.0000009282418939400 │ 0.0000000002103548640 │ 0.0000000582255312170 │ 0.0000000000000000000 │ 0.0003866930 │ 0.0000013920 │ 0.0003853010 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 9 │ 1 │ 0 │ 1 │ true │ true │\n",
+ "├────────────┴─────────┴──────────┴─────────┴─────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────┴───────────┴──────────────────┴─────────────────────┴───────────────┴──────────────────────┴──────────────────────────┴──────────────────┴──────────────────────────┴─────────────────────────┴──────────────┴─────────────────┴─────────────┴─────────────────────┴────────────┴─────────┴────────────────────┴─────────────────────────┴──────────────────┴───────────────────┴────────────────────┴───────────────────────┴─────────────────────────────────────┴─────────────┴───────────────┴────────────────────┴───────────────────────────┴─────────────────────┴────────────────────────────┴─────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────────────────────────┴───────────────────────────────┴────────────────────────┴─────────────────────────────┴────────────────────────┴───────────────────────────┴───────────────────────────┴───────────────────────────┴────────────────────────────────────────────────┴───────────────────────────────────────┤\n",
+ "│ 10 rows 61 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\")"
]
@@ -110,20 +174,61 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────┐\n",
+ "│ count_star() │\n",
+ "│ int64 │\n",
+ "├──────────────┤\n",
+ "│ 33168 │\n",
+ "└──────────────┘"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"SELECT COUNT(*) FROM refined_transactions_fees_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────┐\n",
+ "│ count_star() │\n",
+ "│ int64 │\n",
+ "├──────────────┤\n",
+ "│ 33168 │\n",
+ "└──────────────┘"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) FROM ingestion_transactions_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
- "duckdb_client.sql(\"SELECT input FROM ingestion_traces_v1 LIMIT 10\")\n"
+ "# duckdb_client.sql(\"SELECT input FROM ingestion_transactions_v1 LIMIT 10\")\n"
]
},
{
@@ -135,11 +240,46 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 61)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei | log_count_total_events | log_count_approval_events | log_count_wrapping_events | log_count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool |
2024-11-18 | "op" | 10 | "mainnet" | 161383 | 1 | "0xf0161ba9e648dee61d803bbdb896… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145723 | 1731890223 | "0x8d4b95d012045188a679fb118180… | 24106181875 | 321281 | 178421 | 1600 | 413100442666 | 8168396263 | 3399547344 | 1533 | 24106181875 | 0 | 4301049076319375 | 4301049076319375 | 273519393 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 444.0 | false | false | 1600 | 4301462176762041 | 0 | 68313931626.721600000000 | 8.363200000000 | 344786511040.027200000000 | 101.421300000000 | 0.0043014621767620410 | 0.0000004131004426660 | 0.0043010490763193750 | 0.0000000683139316270 | 0.0000003447865110400 | 0.0000000002735193930 | 0.0043010490763193750 | 0.0000000000000000000 | 24.1061818750 | 0.0000015330 | 24.1061818750 | 0.0000000000 | 8.1683962630 | 3.3995473440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 32703 | 2 | "0x870c4b80f61065aa4df267cbac02… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145723 | 1731890223 | "0xaa5703576bc911f19748dcb5f8d3… | 22805151129 | 319950 | 169719 | 1600 | 413100442666 | 8168396263 | 3399547344 | 1533 | 22805151129 | 0 | 3870467444462751 | 3870467444462751 | 260179227 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 444.0 | false | false | 1600 | 3870880544905417 | 0 | 68313931626.721600000000 | 8.363200000000 | 344786511040.027200000000 | 101.421300000000 | 0.0038708805449054170 | 0.0000004131004426660 | 0.0038704674444627510 | 0.0000000683139316270 | 0.0000003447865110400 | 0.0000000002601792270 | 0.0038704674444627510 | 0.0000000000000000000 | 22.8051511290 | 0.0000015330 | 22.8051511290 | 0.0000000000 | 8.1683962630 | 3.3995473440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 32653 | 1 | "0x46619117bfccce427350754988b8… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145391 | 1731889559 | "0x00ad68344e805a7b6a86a0b2e933… | 17763065777 | 294506 | 178388 | 1600 | 271010594468 | 7658457854 | 2040610599 | 956 | 17763065777 | 0 | 3168717777827476 | 3168717777827476 | 170538928 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 444.0 | false | false | 1600 | 3168988788421944 | 0 | 64049214724.572800000000 | 8.363200000000 | 206961379744.358700000000 | 101.421300000000 | 0.0031689887884219440 | 0.0000002710105944680 | 0.0031687177778274760 | 0.0000000640492147250 | 0.0000002069613797440 | 0.0000000001705389280 | 0.0031687177778274760 | 0.0000000000000000000 | 17.7630657770 | 0.0000009560 | 17.7630657770 | 0.0000000000 | 7.6584578540 | 2.0406105990 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 32623 | 3 | "0x574214d3cd9fdb353e17a4768436… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145723 | 1731890223 | "0x88901c244073013c5a8e47162f54… | 14972171875 | 216953 | 161408 | 1600 | 413100442666 | 8168396263 | 3399547344 | 1533 | 14972171875 | 0 | 2416628318000000 | 2416628318000000 | 247438464 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 432.0 | false | false | 1600 | 2417041418442666 | 0 | 68313931626.721600000000 | 8.363200000000 | 344786511040.027200000000 | 101.421300000000 | 0.0024170414184426660 | 0.0000004131004426660 | 0.0024166283180000000 | 0.0000000683139316270 | 0.0000003447865110400 | 0.0000000002474384640 | 0.0024166283180000000 | 0.0000000000000000000 | 14.9721718750 | 0.0000015330 | 14.9721718750 | 0.0000000000 | 8.1683962630 | 3.3995473440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 161414 | 1 | "0xcbc390b984a0578d563ad214a2f6… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145259 | 1731889295 | "0xf2875774e3fd5c6e99a46a52863b… | 12116292491 | 294104 | 172062 | 1600 | 196474826433 | 7424938854 | 1324954204 | 802 | 12116292491 | 0 | 2084753518586442 | 2084753518586442 | 137993724 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 456.0 | false | false | 1600 | 2084949993412875 | 0 | 62096248623.772800000000 | 8.363200000000 | 134378577810.145200000000 | 101.421300000000 | 0.0020849499934128750 | 0.0000001964748264330 | 0.0020847535185864420 | 0.0000000620962486240 | 0.0000001343785778100 | 0.0000000001379937240 | 0.0020847535185864420 | 0.0000000000000000000 | 12.1162924910 | 0.0000008020 | 12.1162924910 | 0.0000000000 | 7.4249388540 | 1.3249542040 | 3 | 0 | 0 | 2 | true | true |
"
+ ],
+ "text/plain": [
+ "shape: (5, 61)\n",
+ "┌────────────┬───────┬──────────┬─────────┬───┬─────────────┬────────────┬────────────┬────────────┐\n",
+ "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ log_count_w ┆ log_count_ ┆ is_qualifi ┆ is_qualifi │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ rapping_eve ┆ transfer_e ┆ ed_tx_not_ ┆ ed_tx_not_ │\n",
+ "│ date ┆ str ┆ i32 ┆ str ┆ ┆ nts ┆ vents ┆ approval_w ┆ approval_w │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ … ┆ … │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ decimal[38, ┆ decimal[38 ┆ --- ┆ --- │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0] ┆ ,0] ┆ bool ┆ bool │\n",
+ "╞════════════╪═══════╪══════════╪═════════╪═══╪═════════════╪════════════╪════════════╪════════════╡\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "└────────────┴───────┴──────────┴─────────┴───┴─────────────┴────────────┴────────────┴────────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\").pl().head()"
+ "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 ORDER BY tx_fee_native DESC LIMIT 10\").pl().head()"
]
},
{
@@ -151,19 +291,52 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├────────────────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ nonce │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ l2_priority_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_legacy_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_blob_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ log_count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ log_count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ log_count_wrapping_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ log_count_transfer_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ is_qualified_tx_not_approval_wrapping_transfer │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n",
+ "│ is_qualified_tx_not_approval_wrapping │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n",
+ "├────────────────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 61 rows (20 shown) 6 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"DESCRIBE refined_transactions_fees_v1\")\n"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
index b1e381ef7da..d1e5dfa6ec7 100644
--- a/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
+++ b/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
@@ -1,3 +1,5 @@
+# TO DEPRECATE?
+
import duckdb
from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
index 95e2c9662d1..b58da7dff47 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
@@ -9,7 +9,7 @@
input_datasets=[
"ingestion/transactions_v1",
"ingestion/blocks_v1",
- "intermediate/event_emitting_transactions_v1",
+ "ingestion/logs_v1",
],
expected_outputs=["refined_transactions_fees_v1"],
auxiliary_views=[
@@ -17,6 +17,10 @@
template_name="base_transactions_fees",
context={},
),
+ TemplatedSQLQuery(
+ template_name="event_emitting_transactions_list",
+ context={},
+ ),
TemplatedSQLQuery(
template_name="refined_transactions_fees",
context={},
diff --git a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
index a2e1e7152b3..29676d29fe7 100644
--- a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
@@ -23,6 +23,7 @@ pt1 AS (
t.to_address,
t.block_number,
t.block_timestamp,
+ t.hash,
t.gas_price,
t.gas AS gas_limit,
t.receipt_gas_used,
@@ -33,7 +34,7 @@ pt1 AS (
t.receipt_l1_blob_base_fee,
b.base_fee_per_gas,
t.max_priority_fee_per_gas,
- if(t.max_priority_fee_per_gas = 0, t.gas_price - t.max_priority_fee_per_gas, 0) AS base_legacy_fee_per_gas
+ if(t.max_priority_fee_per_gas = 0, t.gas_price - t.max_priority_fee_per_gas, 0) AS base_legacy_fee_per_gas,
-- L2 Fees and breakdown into BASE and PRIORITY contributions
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
@@ -44,8 +45,8 @@ pt1 AS (
t.receipt_status = 1 AS success,
-- L1 Fee BASE and BLOB scalars
coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_scalar,
+ AS l1_base_fee_scalar,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
-- Transaction Attributes
transaction_type,
@@ -56,20 +57,11 @@ pt1 AS (
transaction_type = 126
AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
AND to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction,
-
- COALESCE(eet.count_total_events,0) AS log_count_total_events,
- COALESCE(eet.count_approval_events,0) AS log_count_approval_events,
- COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events,
- COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
+ ) AS is_attributes_deposited_transaction
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b
ON t.block_number = b.number
- LEFT JOIN event_emitting_transactions_v1 eet
- ON eet.block_number = t.block_number
- AND eet.transaction_index = t.transaction_index
- AND eet.transaction_hash = t.hash
WHERE 1=1
-- Optional address filter for faster results when developing.
-- AND from_address LIKE '0x00%'
@@ -83,8 +75,8 @@ pt2 AS (
coalesce(
receipt_l1_gas_used,
round(16 * l1_fee / (
- (l1_base_scalar * receipt_l1_gas_price)
- + (l1_blob_scalar * receipt_l1_blob_base_fee)
+ (l1_base_fee_scalar * receipt_l1_gas_price)
+ + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
))::INT64
) AS l1_gas_used
FROM pt1
@@ -101,15 +93,15 @@ SELECT
l2_fee + l1_fee AS tx_fee,
--
-- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy,
+ if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
--
-- L1 Base
- div16(l1_gas_used) * l1_base_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_scalar AS l1_base_scaled_size,
+ div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
--
-- L1 Blob
- div16(l1_gas_used) * l1_blob_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_scalar AS l1_blob_scaled_size
+ div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
+ div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
FROM pt2
)
@@ -133,7 +125,7 @@ SELECT *
-- L2 Breakdown
, wei_to_eth(l2_base_fee) AS l2_base_fee_native
, wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
- , wei_to_eth(l2_base_legacy) AS l2_base_legacy_native
+ , wei_to_eth(l2_base_legacy_fee) AS l2_base_legacy_fee_native
-- Gas Prices
, wei_to_gwei(gas_price) AS l2_gas_price_gwei
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index b4a08144c2e..bc298e3ce25 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -2,6 +2,7 @@ SELECT
dt,
chain,
chain_id,
+ network,
from_address AS address,
-- Aggregates
@@ -58,7 +59,7 @@ SELECT
wei_to_eth(sum(l2_priority_fee)) AS l2_priority_fee_sum_eth,
- wei_to_eth(sum(l2_base_legacy)) AS l2_base_legacy_fee_sum_eth,
+ wei_to_eth(sum(l2_base_legacy_fee)) AS l2_base_legacy_fee_sum_eth,
-- L1 Fee and breakdown into BASE + BLOB
wei_to_eth(sum(l1_fee)) AS l1_fee_sum_eth,
@@ -95,4 +96,5 @@ GROUP BY
1,
2,
3,
- 4
+ 4,
+ 5
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
index 81f096cdd7f..1962b7a71ad 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
@@ -25,6 +25,7 @@ SELECT
,l.network, l.chain, l.chain_id
,l.block_number
,l.transaction_hash
+ ,t.transaction_index
,t.transaction_type
,COUNT(*) AS count_total_events
@@ -40,6 +41,6 @@ INNER JOIN ingestion_transactions_v1 AS t
LEFT JOIN topic0_filters AS f
ON l.topic0 = f.topic
-GROUP BY 1,2,3,4,5,6,7,8,9
+GROUP BY 1,2,3,4,5,6,7,8,9,10
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 88dbc85f2f0..87242d0a819 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -9,8 +9,8 @@ WITH base_refined AS (
COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events,
COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
- FROM base_transaction_fees AS bt
- LEFT JOIN event_emitting_transactions_v1 eet
+ FROM base_transactions_fees AS bt
+ LEFT JOIN event_emitting_transactions_list AS eet
ON eet.block_number = bt.block_number
AND eet.transaction_index = bt.transaction_index
AND eet.transaction_hash = bt.hash
From 379100c48554377d7b72642dc2232ca5a0cca2d3 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 13:32:39 -0500
Subject: [PATCH 20/32] clean
---
notebooks/adhoc/example_daily_data.ipynb | 16 +++-
.../adhoc/refined_transactions_fees_dev.ipynb | 96 +++++++++++++++----
.../templates/base_transactions_fees.sql.j2 | 4 +-
.../templates/daily_address_summary.sql.j2 | 2 +-
.../templates/refined_trace_calls.sql.j2 | 64 ++++++-------
.../refined_transactions_fees.sql.j2 | 31 +++---
6 files changed, 141 insertions(+), 72 deletions(-)
diff --git a/notebooks/adhoc/example_daily_data.ipynb b/notebooks/adhoc/example_daily_data.ipynb
index 90905f89493..acf4ff06179 100644
--- a/notebooks/adhoc/example_daily_data.ipynb
+++ b/notebooks/adhoc/example_daily_data.ipynb
@@ -9,9 +9,21 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
+ "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n"
+ ]
+ }
+ ],
"source": [
"from op_analytics.coreutils.duckdb_inmem import init_client\n",
"from op_analytics.coreutils.partitioned.reader import DataReader\n",
diff --git a/notebooks/adhoc/refined_transactions_fees_dev.ipynb b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
index 1e3199e739c..e569a57d3bb 100644
--- a/notebooks/adhoc/refined_transactions_fees_dev.ipynb
+++ b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 10:24:38\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:38\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:38\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n"
+ "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:48\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n"
]
}
],
@@ -68,16 +68,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mbase_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
- "\u001b[2m2024-12-13 10:24:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m28905\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:48\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:48\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:49\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:49\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:51\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:51\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mbase_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
"dict_keys(['refined_transactions_fees_v1'])\n"
]
},
@@ -141,15 +141,15 @@
"│ dt │ chain │ chain_id │ network │ nonce │ transaction_index │ from_address │ to_address │ block_number │ block_timestamp │ hash │ gas_price │ gas_limit │ receipt_gas_used │ receipt_l1_gas_used │ l1_fee │ receipt_l1_gas_price │ receipt_l1_blob_base_fee │ base_fee_per_gas │ max_priority_fee_per_gas │ base_legacy_fee_per_gas │ l2_fee │ l2_priority_fee │ l2_base_fee │ block_hour │ method_id │ success │ l1_base_fee_scalar │ l1_blob_base_fee_scalar │ transaction_type │ input_byte_length │ input_calldata_gas │ is_system_transaction │ is_attributes_deposited_transaction │ l1_gas_used │ tx_fee │ l2_base_legacy_fee │ l1_base_fee │ l1_base_scaled_size │ l1_blob_fee │ l1_blob_scaled_size │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ l2_gas_price_gwei │ l2_base_gas_price_gwei │ l2_priority_gas_price_gwei │ l2_base_legacy_gas_price_gwei │ l1_base_gas_price_gwei │ l1_blob_base_gas_price_gwei │ log_count_total_events │ log_count_approval_events │ log_count_wrapping_events │ log_count_transfer_events │ is_qualified_tx_not_approval_wrapping_transfer │ is_qualified_tx_not_approval_wrapping │\n",
"│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ uint32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ timestamp │ varchar │ boolean │ decimal(36,7) │ decimal(26,7) │ int32 │ double │ double │ boolean │ boolean │ int64 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ boolean │ boolean │\n",
"├────────────┼─────────┼──────────┼─────────┼─────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────┼───────────┼──────────────────┼─────────────────────┼───────────────┼──────────────────────┼──────────────────────────┼──────────────────┼──────────────────────────┼─────────────────────────┼──────────────┼─────────────────┼─────────────┼─────────────────────┼────────────┼─────────┼────────────────────┼─────────────────────────┼──────────────────┼───────────────────┼────────────────────┼───────────────────────┼─────────────────────────────────────┼─────────────┼───────────────┼────────────────────┼───────────────────────────┼─────────────────────┼────────────────────────────┼─────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────────────────────────┼───────────────────────────────┼────────────────────────┼─────────────────────────────┼────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼────────────────────────────────────────────────┼───────────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1236 │ 1 │ 0xcecfc5e576c71e913e900df7e96fc11be2222222 │ 0x0000000000007c4cb8129fc2ae24463c32e5d0da │ 128145646 │ 1731890069 │ 0x740c2dbfffed2f807d7502840596cd4bee063cdc6899e19f6a57b50d63945b00 │ 1509609 │ 363036 │ 303721 │ 1968 │ 464705291307 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1509609 │ 458499955089 │ 0 │ 423387074 │ 2024-11-18 00:00:00 │ 0x03806a3a │ true │ 0.0836320 │ 1.0142130 │ 0 │ 90.0 │ 1392.0 │ false │ false │ 1968 │ 923205246396 │ 922781859322 │ 87582350812.462704000000 │ 10.286736000000 │ 376966580122.755981000000 │ 124.748199000000 │ 0.0000009232052463960 │ 0.0000004647052913070 │ 0.0000004584999550890 │ 0.0000000875823508120 │ 0.0000003769665801230 │ 0.0000000004233870740 │ 0.0000000000000000000 │ 0.0000009227818593220 │ 0.0015096090 │ 0.0000013940 │ 0.0000000000 │ 0.0015096090 │ 8.5141050390 │ 3.0218198190 │ 13 │ 0 │ 0 │ 6 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1236 │ 1 │ 0xcecfc5e576c71e913e900df7e96fc11be2222222 │ 0x0000000000007c4cb8129fc2ae24463c32e5d0da │ 128145646 │ 1731890069 │ 0x740c2dbfffed2f807d7502840596cd4bee063cdc6899e19f6a57b50d63945b00 │ 1509609 │ 363036 │ 303721 │ 1968 │ 464705291307 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1508215 │ 458499955089 │ 0 │ 423387074 │ 2024-11-18 00:00:00 │ 0x03806a3a │ true │ 0.0836320 │ 1.0142130 │ 0 │ 90.0 │ 1392.0 │ false │ false │ 1968 │ 923205246396 │ 458076568015 │ 87582350812.462704000000 │ 10.286736000000 │ 376966580122.755981000000 │ 124.748199000000 │ 0.0000009232052463960 │ 0.0000004647052913070 │ 0.0000004584999550890 │ 0.0000000875823508120 │ 0.0000003769665801230 │ 0.0000000004233870740 │ 0.0000000000000000000 │ 0.0000004580765680150 │ 0.0015096090 │ 0.0000013940 │ 0.0000000000 │ 0.0015082150 │ 8.5141050390 │ 3.0218198190 │ 13 │ 0 │ 0 │ 6 │ true │ true │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 558 │ 10 │ 0x72099133f9310c47b3543d6a9c3fef25dd7c71e3 │ 0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8 │ 128145646 │ 1731890069 │ 0x069e5d9f4850092b767b41fb883557c50db14a3f7ab5046e873a39afaf5d1575 │ 452771 │ 67533 │ 51556 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 451377 │ 0 │ 23343061676 │ 23271192612 │ 71869064 │ 2024-11-18 00:00:00 │ 0x095ea7b3 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 68.0 │ 944.0 │ false │ false │ 1600 │ 401025119346 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004010251193460 │ 0.0000003776820576700 │ 0.0000000233430616760 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000718690640 │ 0.0000000232711926120 │ 0.0000000000000000000 │ 0.0004527710 │ 0.0000013940 │ 0.0004513770 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 1 │ 1 │ 0 │ 0 │ false │ false │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 858 │ 15 │ 0x21bdb91661a4472ff0d3871c300d4120a886ad9b │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0xf8c3fa8ece22e50b86ef016e991863191b62f20f376b16dbcca436fc80f8e28c │ 101394 │ 197308 │ 189126 │ 4953 │ 1169231513276 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19176241644 │ 18912600000 │ 263641644 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6388.0 │ false │ false │ 4953 │ 1188407754920 │ 0 │ 220424483523.438909000000 │ 25.889331000000 │ 948737536254.070311937500 │ 313.962311812500 │ 0.0000011884077549200 │ 0.0000011692315132760 │ 0.0000000191762416440 │ 0.0000002204244835230 │ 0.0000009487375362540 │ 0.0000000002636416440 │ 0.0000000189126000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 873 │ 16 │ 0xac50debe83f7dbf2144239bcb946a2506b2782da │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0x8b70ce403d88feb808e4f44d60b95b49fc9299aaf324890ebf9593a5dbc29fd5 │ 101394 │ 197296 │ 189114 │ 4966 │ 1172390823688 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19175024916 │ 18911400000 │ 263624916 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6400.0 │ false │ false │ 4966 │ 1191565848604 │ 0 │ 221003025474.943998000000 │ 25.957282000000 │ 951227661021.141362625000 │ 314.786359875000 │ 0.0000011915658486040 │ 0.0000011723908236880 │ 0.0000000191750249160 │ 0.0000002210030254750 │ 0.0000009512276610210 │ 0.0000000002636249160 │ 0.0000000189114000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1446656 │ 3 │ 0x0771483e9ad0d8c452efbca3451e4e56249b64bd │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 128145646 │ 1731890069 │ 0x94291d07579ee7b6227cd7a2904392d45a39a9ab962892dc6c08a2d08d32bb31 │ 1201665 │ 3000000 │ 522698 │ 3199 │ 755361849249 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1201665 │ 628107892170 │ 0 │ 728641012 │ 2024-11-18 00:00:00 │ 0xe129b4b8 │ true │ 0.0836320 │ 1.0142130 │ 0 │ 214.0 │ 2860.0 │ false │ false │ 3199 │ 1383469741419 │ 1382741100407 │ 142365823297.290747000000 │ 16.721173000000 │ 612762240758.483934562500 │ 202.779211687500 │ 0.0000013834697414190 │ 0.0000007553618492490 │ 0.0000006281078921700 │ 0.0000001423658232970 │ 0.0000006127622407580 │ 0.0000000007286410120 │ 0.0000000000000000000 │ 0.0000013827411004070 │ 0.0012016650 │ 0.0000013940 │ 0.0000000000 │ 0.0012016650 │ 8.5141050390 │ 3.0218198190 │ 12 │ 0 │ 0 │ 8 │ true │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1446656 │ 3 │ 0x0771483e9ad0d8c452efbca3451e4e56249b64bd │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 128145646 │ 1731890069 │ 0x94291d07579ee7b6227cd7a2904392d45a39a9ab962892dc6c08a2d08d32bb31 │ 1201665 │ 3000000 │ 522698 │ 3199 │ 755361849249 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1200271 │ 628107892170 │ 0 │ 728641012 │ 2024-11-18 00:00:00 │ 0xe129b4b8 │ true │ 0.0836320 │ 1.0142130 │ 0 │ 214.0 │ 2860.0 │ false │ false │ 3199 │ 1383469741419 │ 627379251158 │ 142365823297.290747000000 │ 16.721173000000 │ 612762240758.483934562500 │ 202.779211687500 │ 0.0000013834697414190 │ 0.0000007553618492490 │ 0.0000006281078921700 │ 0.0000001423658232970 │ 0.0000006127622407580 │ 0.0000000007286410120 │ 0.0000000000000000000 │ 0.0000006273792511580 │ 0.0012016650 │ 0.0000013940 │ 0.0000000000 │ 0.0012002710 │ 8.5141050390 │ 3.0218198190 │ 12 │ 0 │ 0 │ 8 │ true │ true │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 59 │ 4 │ 0x1893d8121f083ebf12227226c94b17871a4d42b7 │ 0x8a2725a6f04816a5274ddd9feadd3bd0c253c1a6 │ 128145646 │ 1731890069 │ 0x1ce1b0856a4d9463cfe6a5718197eef25a976e9934bbc05ab3ef3a38053dfc0f │ 1001394 │ 166761 │ 106027 │ 6746 │ 1592579108540 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 106174801638 │ 106027000000 │ 147801638 │ 2024-11-18 00:00:00 │ 0x891f4e42 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 516.0 │ 6972.0 │ false │ false │ 6746 │ 1698753910178 │ 0 │ 300218769604.102338000000 │ 35.261342000000 │ 1292183206050.869841375000 │ 427.617556125000 │ 0.0000016987539101780 │ 0.0000015925791085400 │ 0.0000001061748016380 │ 0.0000003002187696040 │ 0.0000012921832060510 │ 0.0000000001478016380 │ 0.0000001060270000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 42 │ 5 │ 0x6b08f3ab29cdf708f7059a3acecaf9e905f921bc │ 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45 │ 128145646 │ 1731890069 │ 0xb98479825e34d6d9c94cce974b47024415972c6aecfce3a2584ce6867ddef584 │ 1001394 │ 115761 │ 112669 │ 2383 │ 562643914092 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 112826060586 │ 112669000000 │ 157060586 │ 2024-11-18 00:00:00 │ 0x04e45aaf │ true │ 0.0836320 │ 1.0142130 │ 2 │ 228.0 │ 1776.0 │ false │ false │ 2383 │ 675469974678 │ 0 │ 106051190033.586699000000 │ 12.455941000000 │ 456459024610.024137562500 │ 151.054348687500 │ 0.0000006754699746780 │ 0.0000005626439140920 │ 0.0000001128260605860 │ 0.0000001060511900340 │ 0.0000004564590246100 │ 0.0000000001570605860 │ 0.0000001126690000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 4 │ 1 │ 0 │ 2 │ true │ true │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 10500 │ 6 │ 0x43370402cbeba6ab53fbc8a52894537024a39269 │ 0x0000000071727de22e5e9d8baf0edac6f37da032 │ 128145646 │ 1731890069 │ 0xf4e15cd270206216937eddf9a3ac72396ba89a4cebf1eee49af873206eed164f │ 1001394 │ 326206 │ 190204 │ 7054 │ 1665243248025 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 190469144376 │ 190204000000 │ 265144376 │ 2024-11-18 00:00:00 │ 0x765e827f │ true │ 0.0836320 │ 1.0142130 │ 2 │ 1252.0 │ 8404.0 │ false │ false │ 7054 │ 1855712392401 │ 0 │ 313925763532.069062000000 │ 36.871258000000 │ 1351180008224.553196125000 │ 447.141156375000 │ 0.0000018557123924010 │ 0.0000016652432480250 │ 0.0000001904691443760 │ 0.0000003139257635320 │ 0.0000013511800082250 │ 0.0000000002651443760 │ 0.0000001902040000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 4 │ 0 │ 0 │ 1 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1 │ 7 │ 0x8eb24562a06fc42689a66e6b203fc43ed0cb45ab │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 128145646 │ 1731890069 │ 0x72dd6aca2cd8ae01537ce1105987ea8b2ee81a87031d9497138839571c57fe52 │ 1001325 │ 200000 │ 29950 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1001325 │ 29989683750 │ 0 │ 41750300 │ 2024-11-18 00:00:00 │ 0xa9059cbb │ true │ 0.0836320 │ 1.0142130 │ 0 │ 68.0 │ 608.0 │ false │ false │ 1600 │ 407671741420 │ 407629991120 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004076717414200 │ 0.0000003776820576700 │ 0.0000000299896837500 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000417503000 │ 0.0000000000000000000 │ 0.0000004076299911200 │ 0.0010013250 │ 0.0000013940 │ 0.0000000000 │ 0.0010013250 │ 8.5141050390 │ 3.0218198190 │ 1 │ 0 │ 0 │ 1 │ false │ true │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1 │ 7 │ 0x8eb24562a06fc42689a66e6b203fc43ed0cb45ab │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 128145646 │ 1731890069 │ 0x72dd6aca2cd8ae01537ce1105987ea8b2ee81a87031d9497138839571c57fe52 │ 1001325 │ 200000 │ 29950 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 999931 │ 29989683750 │ 0 │ 41750300 │ 2024-11-18 00:00:00 │ 0xa9059cbb │ true │ 0.0836320 │ 1.0142130 │ 0 │ 68.0 │ 608.0 │ false │ false │ 1600 │ 407671741420 │ 29947933450 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004076717414200 │ 0.0000003776820576700 │ 0.0000000299896837500 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000417503000 │ 0.0000000000000000000 │ 0.0000000299479334500 │ 0.0010013250 │ 0.0000013940 │ 0.0000000000 │ 0.0009999310 │ 8.5141050390 │ 3.0218198190 │ 1 │ 0 │ 0 │ 1 │ false │ true │\n",
"│ 2024-11-18 │ op │ 10 │ mainnet │ 724110 │ 10 │ 0xa750a354528b56a62ee6f8538ca340f1d986c878 │ 0xca11bde05977b3631167028862be2a173976ca11 │ 128145647 │ 1731890071 │ 0xf775507c1d678f5a650b05bee624db6e6e4b15f1ff6fb7de04801dd9b26ad214 │ 386693 │ 200000 │ 151117 │ 4846 │ 1143957029976 │ 8514105039 │ 3021819819 │ 1392 │ 385301 │ 0 │ 58435886081 │ 58225531217 │ 210354864 │ 2024-11-18 00:00:00 │ 0x82ad56cb │ true │ 0.0836320 │ 1.0142130 │ 2 │ 1124.0 │ 7520.0 │ false │ false │ 4846 │ 1202392916057 │ 0 │ 215662638230.281638000000 │ 25.330042000000 │ 928241893940.485510125000 │ 307.179762375000 │ 0.0000012023929160570 │ 0.0000011439570299760 │ 0.0000000584358860810 │ 0.0000002156626382300 │ 0.0000009282418939400 │ 0.0000000002103548640 │ 0.0000000582255312170 │ 0.0000000000000000000 │ 0.0003866930 │ 0.0000013920 │ 0.0003853010 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 9 │ 1 │ 0 │ 1 │ true │ true │\n",
"├────────────┴─────────┴──────────┴─────────┴─────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────┴───────────┴──────────────────┴─────────────────────┴───────────────┴──────────────────────┴──────────────────────────┴──────────────────┴──────────────────────────┴─────────────────────────┴──────────────┴─────────────────┴─────────────┴─────────────────────┴────────────┴─────────┴────────────────────┴─────────────────────────┴──────────────────┴───────────────────┴────────────────────┴───────────────────────┴─────────────────────────────────────┴─────────────┴───────────────┴────────────────────┴───────────────────────────┴─────────────────────┴────────────────────────────┴─────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────────────────────────┴───────────────────────────────┴────────────────────────┴─────────────────────────────┴────────────────────────┴───────────────────────────┴───────────────────────────┴───────────────────────────┴────────────────────────────────────────────────┴───────────────────────────────────────┤\n",
"│ 10 rows 61 columns │\n",
@@ -253,7 +253,7 @@
" white-space: pre-wrap;\n",
"}\n",
"\n",
- "shape: (5, 61)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei | log_count_total_events | log_count_approval_events | log_count_wrapping_events | log_count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool |
2024-11-18 | "op" | 10 | "mainnet" | 161383 | 1 | "0xf0161ba9e648dee61d803bbdb896… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145723 | 1731890223 | "0x8d4b95d012045188a679fb118180… | 24106181875 | 321281 | 178421 | 1600 | 413100442666 | 8168396263 | 3399547344 | 1533 | 24106181875 | 0 | 4301049076319375 | 4301049076319375 | 273519393 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 444.0 | false | false | 1600 | 4301462176762041 | 0 | 68313931626.721600000000 | 8.363200000000 | 344786511040.027200000000 | 101.421300000000 | 0.0043014621767620410 | 0.0000004131004426660 | 0.0043010490763193750 | 0.0000000683139316270 | 0.0000003447865110400 | 0.0000000002735193930 | 0.0043010490763193750 | 0.0000000000000000000 | 24.1061818750 | 0.0000015330 | 24.1061818750 | 0.0000000000 | 8.1683962630 | 3.3995473440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 32703 | 2 | "0x870c4b80f61065aa4df267cbac02… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145723 | 1731890223 | "0xaa5703576bc911f19748dcb5f8d3… | 22805151129 | 319950 | 169719 | 1600 | 413100442666 | 8168396263 | 3399547344 | 1533 | 22805151129 | 0 | 3870467444462751 | 3870467444462751 | 260179227 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 444.0 | false | false | 1600 | 3870880544905417 | 0 | 68313931626.721600000000 | 8.363200000000 | 344786511040.027200000000 | 101.421300000000 | 0.0038708805449054170 | 0.0000004131004426660 | 0.0038704674444627510 | 0.0000000683139316270 | 0.0000003447865110400 | 0.0000000002601792270 | 0.0038704674444627510 | 0.0000000000000000000 | 22.8051511290 | 0.0000015330 | 22.8051511290 | 0.0000000000 | 8.1683962630 | 3.3995473440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 32653 | 1 | "0x46619117bfccce427350754988b8… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145391 | 1731889559 | "0x00ad68344e805a7b6a86a0b2e933… | 17763065777 | 294506 | 178388 | 1600 | 271010594468 | 7658457854 | 2040610599 | 956 | 17763065777 | 0 | 3168717777827476 | 3168717777827476 | 170538928 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 444.0 | false | false | 1600 | 3168988788421944 | 0 | 64049214724.572800000000 | 8.363200000000 | 206961379744.358700000000 | 101.421300000000 | 0.0031689887884219440 | 0.0000002710105944680 | 0.0031687177778274760 | 0.0000000640492147250 | 0.0000002069613797440 | 0.0000000001705389280 | 0.0031687177778274760 | 0.0000000000000000000 | 17.7630657770 | 0.0000009560 | 17.7630657770 | 0.0000000000 | 7.6584578540 | 2.0406105990 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 32623 | 3 | "0x574214d3cd9fdb353e17a4768436… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145723 | 1731890223 | "0x88901c244073013c5a8e47162f54… | 14972171875 | 216953 | 161408 | 1600 | 413100442666 | 8168396263 | 3399547344 | 1533 | 14972171875 | 0 | 2416628318000000 | 2416628318000000 | 247438464 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 432.0 | false | false | 1600 | 2417041418442666 | 0 | 68313931626.721600000000 | 8.363200000000 | 344786511040.027200000000 | 101.421300000000 | 0.0024170414184426660 | 0.0000004131004426660 | 0.0024166283180000000 | 0.0000000683139316270 | 0.0000003447865110400 | 0.0000000002474384640 | 0.0024166283180000000 | 0.0000000000000000000 | 14.9721718750 | 0.0000015330 | 14.9721718750 | 0.0000000000 | 8.1683962630 | 3.3995473440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 161414 | 1 | "0xcbc390b984a0578d563ad214a2f6… | "0x6f1fe5b048de0417c4e838b1fc42… | 128145259 | 1731889295 | "0xf2875774e3fd5c6e99a46a52863b… | 12116292491 | 294104 | 172062 | 1600 | 196474826433 | 7424938854 | 1324954204 | 802 | 12116292491 | 0 | 2084753518586442 | 2084753518586442 | 137993724 | 2024-11-18 00:00:00 | "0xb2460c48" | true | 0.0836320 | 1.0142130 | 2 | 36.0 | 456.0 | false | false | 1600 | 2084949993412875 | 0 | 62096248623.772800000000 | 8.363200000000 | 134378577810.145200000000 | 101.421300000000 | 0.0020849499934128750 | 0.0000001964748264330 | 0.0020847535185864420 | 0.0000000620962486240 | 0.0000001343785778100 | 0.0000000001379937240 | 0.0020847535185864420 | 0.0000000000000000000 | 12.1162924910 | 0.0000008020 | 12.1162924910 | 0.0000000000 | 7.4249388540 | 1.3249542040 | 3 | 0 | 0 | 2 | true | true |
"
+ "shape: (5, 61)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei | log_count_total_events | log_count_approval_events | log_count_wrapping_events | log_count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool |
2024-11-18 | "op" | 10 | "mainnet" | 254942 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128145323 | 1731889423 | "0xa154c2a27f36f900ba0cc89f30e4… | 6009964258 | 1000000 | 167161 | 1600 | 306301485470 | 7670139258 | 2387610658 | 856 | 0 | 6009963402 | 1004631635331538 | 0 | 143089816 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 1004937936817008 | 1004631492241722 | 64146908642.505600000000 | 8.363200000000 | 242154576828.215400000000 | 101.421300000000 | 0.0010049379368170080 | 0.0000003063014854700 | 0.0010046316353315380 | 0.0000000641469086430 | 0.0000002421545768280 | 0.0000000001430898160 | 0.0000000000000000000 | 0.0010046314922417220 | 6.0099642580 | 0.0000008560 | 0.0000000000 | 6.0099634020 | 7.6701392580 | 2.3876106580 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 254890 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128144808 | 1731888393 | "0x3bf1efa2db347fb47dd054401ef4… | 3557316353 | 1000000 | 167130 | 1600 | 178769154750 | 8171754126 | 1088796344 | 662 | 0 | 3557315691 | 594534282076890 | 0 | 110640060 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 594713051231640 | 594534171436830 | 68342014106.563200000000 | 8.363200000000 | 110427140643.727200000000 | 101.421300000000 | 0.0005947130512316400 | 0.0000001787691547500 | 0.0005945342820768900 | 0.0000000683420141070 | 0.0000001104271406440 | 0.0000000001106400600 | 0.0000000000000000000 | 0.0005945341714368300 | 3.5573163530 | 0.0000006620 | 0.0000000000 | 3.5573156910 | 8.1717541260 | 1.0887963440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 278585 | 3 | "0xe3e73f1aa65eeb809ff1f41f3c09… | "0x68b3465833fb72a70ecdf485e0e4… | 128145787 | 1731890351 | "0x3c34052b55b8ea87fad65536694c… | 3806621788 | 1000000 | 150414 | 2263 | 496962886328 | 8132807920 | 2793617096 | 1778 | 0 | 3806620010 | 572569209620232 | 0 | 267436092 | 2024-11-18 00:00:00 | "0x04e45aaf" | false | 0.0836320 | 1.0142130 | 0 | 228.0 | 1644.0 | false | false | 2263 | 573066172506560 | 572568942184140 | 96200553176.111920000000 | 11.828701000000 | 400738090100.154301500000 | 143.447751187500 | 0.0005730661725065600 | 0.0000004969628863280 | 0.0005725692096202320 | 0.0000000962005531760 | 0.0000004007380901000 | 0.0000000002674360920 | 0.0000000000000000000 | 0.0005725689421841400 | 3.8066217880 | 0.0000017780 | 0.0000000000 | 3.8066200100 | 8.1328079200 | 2.7936170960 | 0 | 0 | 0 | 0 | false | false |
2024-11-18 | "op" | 10 | "mainnet" | 15578 | 6 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145605 | 1731889987 | "0x2f1c10fa888a422c3dafe1d8a16d… | 477875164 | 2499999 | 1130360 | 20090 | 3713537605952 | 7522450707 | 2295686953 | 1299 | 0 | 477873865 | 540170970379040 | 0 | 1468337640 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21980.0 | false | false | 20090 | 543884507984992 | 540169502041400 | 789935783395.874010000000 | 105.010430000000 | 2923491214556.840563125000 | 1273.471198125000 | 0.0005438845079849920 | 0.0000037135376059520 | 0.0005401709703790400 | 0.0000007899357833960 | 0.0000029234912145570 | 0.0000000014683376400 | 0.0000000000000000000 | 0.0005401695020414000 | 0.4778751640 | 0.0000012990 | 0.0000000000 | 0.4778738650 | 7.5224507070 | 2.2956869530 | 9 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 15579 | 1 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145777 | 1731890331 | "0x242ec819d3b42117800b3942fa29… | 455586072 | 2499999 | 1149957 | 20157 | 5417238559765 | 8537410887 | 3535671733 | 1751 | 0 | 455584321 | 523904392598904 | 0 | 2013574707 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21956.0 | false | false | 20157 | 529321631158669 | 523902379024197 | 899507066459.876793000000 | 105.360639000000 | 4517592175735.696078312500 | 1277.718215062500 | 0.0005293216311586690 | 0.0000054172385597650 | 0.0005239043925989040 | 0.0000008995070664600 | 0.0000045175921757360 | 0.0000000020135747070 | 0.0000000000000000000 | 0.0005239023790241970 | 0.4555860720 | 0.0000017510 | 0.0000000000 | 0.4555843210 | 8.5374108870 | 3.5356717330 | 9 | 0 | 0 | 2 | true | true |
"
],
"text/plain": [
"shape: (5, 61)\n",
@@ -267,7 +267,7 @@
"╞════════════╪═══════╪══════════╪═════════╪═══╪═════════════╪════════════╪════════════╪════════════╡\n",
"│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
"│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 0 ┆ false ┆ false │\n",
"│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
"│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
"└────────────┴───────┴──────────┴─────────┴───┴─────────────┴────────────┴────────────┴────────────┘"
@@ -279,7 +279,61 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 ORDER BY tx_fee_native DESC LIMIT 10\").pl().head()"
+ "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 WHERE transaction_type = 0 ORDER BY tx_fee_native DESC LIMIT 10\").pl().head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check Type 0 Legacy Fee Logic"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (0, 61)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei | log_count_total_events | log_count_approval_events | log_count_wrapping_events | log_count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool |
"
+ ],
+ "text/plain": [
+ "shape: (0, 61)\n",
+ "┌──────┬───────┬──────────┬─────────┬───┬──────────────┬──────────────┬──────────────┬─────────────┐\n",
+ "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ log_count_wr ┆ log_count_tr ┆ is_qualified ┆ is_qualifie │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ apping_event ┆ ansfer_event ┆ _tx_not_appr ┆ d_tx_not_ap │\n",
+ "│ date ┆ str ┆ i32 ┆ str ┆ ┆ s ┆ s ┆ oval_w… ┆ proval_w… │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ decimal[38,0 ┆ decimal[38,0 ┆ bool ┆ bool │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ ] ┆ ] ┆ ┆ │\n",
+ "╞══════╪═══════╪══════════╪═════════╪═══╪══════════════╪══════════════╪══════════════╪═════════════╡\n",
+ "└──────┴───────┴──────────┴─────────┴───┴──────────────┴──────────────┴──────────────┴─────────────┘"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"\"\"SELECT * FROM refined_transactions_fees_v1\n",
+ " WHERE transaction_type = 0\n",
+ " AND ( --check fee\n",
+ " l1_fee + l2_base_fee + l2_priority_fee + l2_base_legacy_fee != tx_fee\n",
+ " OR --check prices\n",
+ " l2_base_gas_price_gwei + l2_priority_gas_price_gwei + l2_base_legacy_gas_price_gwei != l2_gas_price_gwei\n",
+ " )\n",
+ " LIMIT 10\n",
+ " \"\"\").pl().head()"
]
},
{
diff --git a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
index 29676d29fe7..ac48c815875 100644
--- a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
@@ -34,7 +34,7 @@ pt1 AS (
t.receipt_l1_blob_base_fee,
b.base_fee_per_gas,
t.max_priority_fee_per_gas,
- if(t.max_priority_fee_per_gas = 0, t.gas_price - t.max_priority_fee_per_gas, 0) AS base_legacy_fee_per_gas,
+ if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS base_legacy_fee_per_gas,
-- L2 Fees and breakdown into BASE and PRIORITY contributions
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
@@ -93,7 +93,7 @@ SELECT
l2_fee + l1_fee AS tx_fee,
--
-- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee + l1_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
+ if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
--
-- L1 Base
div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index bc298e3ce25..c985ba9bf93 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -91,7 +91,7 @@ SELECT
FROM
refined_transactions_fees
- WHERE gas_price > 0
+WHERE gas_price > 0
GROUP BY
1,
2,
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
index 9cbca215b26..33080e41179 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
@@ -20,56 +20,52 @@ base_level_trace_calls AS (
r.trace_address,
r.error,
r.trace_type,
-
- -- Computed Trace Fields
- hexstr_method_id(r.input) AS trc_method_id,
- -- Find the next level up in the trace tree, so that we can subtract out subtract gas.
- CASE WHEN trace_address IS NULL OR trace_address = '' THEN '-1' --if trace address is null, we don't want to go uplevel
- ELSE
- CASE
- WHEN LENGTH(trace_address) - LENGTH(REPLACE(trace_address, ',', '')) = 0 THEN trace_address
- ELSE SUBSTR(trace_address, 1, LENGTH(trace_address) - LENGTH(SPLIT(trace_address, ',')[ORDINAL(ARRAY_LENGTH(SPLIT(trace_address, ',')))]) - 1)
- END
- END AS trace_address_uplevel,
-- Raw Transaction Fields
t.receipt_gas_used AS tx_gas_used,
t.receipt_l1_gas_used AS tx_l1_gas_used,
t.from_address AS tx_from_address,
t.to_address AS tx_to_address,
- t.receipt_gas_used AS tx_gas_used,
- t.l1_gas_used AS tx_l1_gas_used
-- Computed Transaction Fee Fields
- tx_fee_native AS tx_fee_native,
- l1_fee_native AS tx_l1_fee_native,
- l2_fee_native AS tx_l2_fee_native,
- l2_priority_fee_native AS tx_l2_priority_fee_native,
- l2_base_fee_native AS tx_l2_base_fee_native,
- l2_base_legacy_native AS tx_l2_base_legacy_native,
+ t.tx_fee_native,
+ t.l1_fee_native AS tx_l1_fee_native,
+ t.l2_fee_native AS tx_l2_fee_native,
+ t.l2_priority_fee_native AS tx_l2_priority_fee_native,
+ t.l2_base_fee_native AS tx_l2_base_fee_native,
+ t.l2_base_legacy_native AS tx_l2_base_legacy_native,
-- Computed Transaction Gas Price Fields
- l2_gas_price_gwei,
- l2_base_gas_price_gwei,
- l2_priority_gas_price_gwei,
- l2_base_legacy_gas_price_gwei,
- l1_base_gas_price_gwei,
- l1_blob_base_gas_price_gwei,
+ t.l2_gas_price_gwei,
+ t.l2_base_gas_price_gwei,
+ t.l2_priority_gas_price_gwei,
+ t.l2_base_legacy_gas_price_gwei,
+ t.l1_base_gas_price_gwei,
+ t.l1_blob_base_gas_price_gwei,
t.method_id AS tx_method_id,
hexstr_method_id(r.input) AS trc_method_id,
-- Event Columns
- log_count_total_events,
- log_count_approval_events,
- log_count_wrapping_events,
- log_count_transfer_events,
+ t.log_count_total_events,
+ t.log_count_approval_events,
+ t.log_count_wrapping_events,
+ t.log_count_transfer_events,
-- Convenience columns
t.block_hour,
t.success AS tx_success,
t.receipt_status = 1 AS trc_success,
- FROM ingestion_traces_v1 r
- INNER JOIN extended_transactions_v1 t
- ON r.block_number = t.block_number
+ --Get the next trace level up so that we can subtract subtrace gas
+ CASE WHEN r.trace_address IS NULL OR r.trace_address = '' THEN '-1'
+ ELSE
+ CASE
+ WHEN LENGTH(r.trace_address) - LENGTH(REPLACE(r.trace_address, ',', '')) = 0 THEN r.trace_address
+ ELSE SUBSTR(r.trace_address, 1, LENGTH(r.trace_address) - LENGTH(SPLIT(r.trace_address, ',')[ORDINAL(ARRAY_LENGTH(SPLIT(r.trace_address, ',')))]) - 1)
+ END
+ END AS trace_address_uplevel
+
+ FROM ingestion_traces_v1 r
+ INNER JOIN extended_transactions_v1 t
+ ON r.block_number = t.block_number
AND r.transaction_hash = t.hash
WHERE r.trace_type = 'call'
@@ -102,8 +98,8 @@ bl.*
-- the subtraces will never add up to part of whole, but leave as is
, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_gas_price_gwei) AS trc_l2_fee_native_minus_subtraces
-, (bl.trc_gas_used - st.gas_used_in_subtraces) * bl.tx_base_gas_price_gwei/1e9 AS trc_base_fee_native_minus_subtraces
-, (bl.trc_gas_used - st.gas_used_in_subtraces) * bl.tx_priority_gas_price_gwei/1e9 AS trc_priority_fee_native_minus_subtraces
+, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_base_gas_price_gwei) AS trc_base_fee_native_minus_subtraces
+, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_priority_gas_price_gwei) AS trc_priority_fee_native_minus_subtraces
--
, (bl.tx_gas_used) / tpt.count_traces AS tx_gas_used_per_call_amortized
, (bl.tx_l1_gas_used) / tpt.count_traces AS tx_l1_gas_used_per_call_amortized
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 87242d0a819..75f08069b3b 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -4,22 +4,29 @@ WITH base_refined AS (
-- Transaction fields
bt.*,
- COALESCE(eet.count_total_events,0) AS log_count_total_events,
- COALESCE(eet.count_approval_events,0) AS log_count_approval_events,
- COALESCE(eet.count_wrapping_events,0) AS log_count_wrapping_events,
- COALESCE(eet.count_transfer_events,0) AS log_count_transfer_events
+ COALESCE(eet.count_total_events, 0) AS log_count_total_events,
+ COALESCE(eet.count_approval_events, 0) AS log_count_approval_events,
+ COALESCE(eet.count_wrapping_events, 0) AS log_count_wrapping_events,
+ COALESCE(eet.count_transfer_events, 0) AS log_count_transfer_events
FROM base_transactions_fees AS bt
LEFT JOIN event_emitting_transactions_list AS eet
- ON eet.block_number = bt.block_number
- AND eet.transaction_index = bt.transaction_index
- AND eet.transaction_hash = bt.hash
- WHERE 1=1
+ ON
+ bt.block_number = eet.block_number
+ AND bt.transaction_index = eet.transaction_index
+ AND bt.hash = eet.transaction_hash
+ WHERE 1 = 1
)
SELECT
- *
- , log_count_total_events > log_count_approval_events + log_count_wrapping_events + log_count_transfer_events AS is_qualified_tx_not_approval_wrapping_transfer
- , log_count_total_events > log_count_approval_events + log_count_wrapping_events AS is_qualified_tx_not_approval_wrapping
+ *,
+
+ log_count_total_events
+ > log_count_approval_events + log_count_wrapping_events + log_count_transfer_events
+ AS is_qualified_tx_not_approval_wrapping_transfer,
-FROM base_refined
\ No newline at end of file
+ log_count_total_events
+ > log_count_approval_events + log_count_wrapping_events
+ AS is_qualified_tx_not_approval_wrapping
+
+FROM base_refined
From a185a85e4d61eca2e88a7fe94f004d8fe3bd5382 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 13:59:46 -0500
Subject: [PATCH 21/32] push updates to models
---
...event_emitting_transactions_list_dev.ipynb | 179 ++++++++--------
.../adhoc/refined_transactions_fees_dev.ipynb | 199 +++++++++---------
.../code/event_emitting_transactions.py | 31 +++
.../code/event_emitting_transactions_list.py | 25 ---
.../models/code/refined_transactions_fees.py | 8 -
.../templates/base_transactions_fees.sql.j2 | 139 ------------
.../event_emitting_transactions.sql.j2 | 61 ++++++
...list.sql.j2 => logs_topic0_filters.sql.j2} | 30 +--
.../refined_transactions_fees.sql.j2 | 157 +++++++++++---
9 files changed, 422 insertions(+), 407 deletions(-)
create mode 100644 src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
delete mode 100644 src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
delete mode 100644 src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
rename src/op_analytics/datapipeline/models/templates/{event_emitting_transactions_list.sql.j2 => logs_topic0_filters.sql.j2} (54%)
diff --git a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
index 78dcaf60024..0847f521332 100644
--- a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
+++ b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n"
+ "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n"
]
}
],
@@ -36,7 +36,7 @@
"# Define the input data range.\n",
"read_batches: list[DataReader] = construct_data_readers(\n",
" chains=[\"op\"],\n",
- " models=[\"event_emitting_transactions_list\"],\n",
+ " models=[\"event_emitting_transactions\"],\n",
" range_spec=\"@20241118:+1\",\n",
" read_from=DataLocation.GCS\n",
")\n",
@@ -68,27 +68,34 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:34\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:34\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m\n",
- "\u001b[2m2024-12-13 08:58:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m21682\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
- "dict_keys(['event_emitting_transactions_list_v1'])\n"
+ "\u001b[2m2024-12-13 13:59:07\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:07\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:08\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:08\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:09\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:09\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
+ "dict_keys(['event_emitting_transactions_v1'])\n"
]
},
{
"data": {
"text/plain": [
- "┌─────────────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├─────────────────────────────────────┤\n",
- "│ event_emitting_transactions_list │\n",
- "│ event_emitting_transactions_list_v1 │\n",
- "│ ingestion_logs_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "└─────────────────────────────────────┘"
+ "┌────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├────────────────────────────────┤\n",
+ "│ event_emitting_transactions │\n",
+ "│ event_emitting_transactions_v1 │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ logs_topic0_filters │\n",
+ "│ refined_transactions_fees │\n",
+ "└────────────────────────────────┘"
]
},
"execution_count": 2,
@@ -101,7 +108,7 @@
"\n",
"execute_model_in_memory(\n",
" duckdb_client=duckdb_client,\n",
- " model=\"event_emitting_transactions_list\",\n",
+ " model=\"event_emitting_transactions\",\n",
" data_reader=batch,\n",
" limit_input_parquet_files=1\n",
")\n",
@@ -130,23 +137,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬──────────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐\n",
- "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ transaction_index │ transaction_type │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │\n",
- "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int64 │ int32 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │\n",
- "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼──────────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0x0f3da35693644abe74388ab718881855a50e147201bb5be97ff4d653e8e7ba12 │ 6 │ 0 │ 11 │ 0 │ 0 │ 5 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890755 │ mainnet │ op │ 10 │ 128145989 │ 0xe5f2bb8587f675aa84c045b73298f6a34f0bbdaaeb45d22a2f4a20d0af788c5a │ 5 │ 0 │ 3 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0xb6a080f67866d9bf3571a126ee7c9263f3778f0400c5dd00a3c64423e73ea65e │ 23 │ 2 │ 2 │ 0 │ 0 │ 1 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890763 │ mainnet │ op │ 10 │ 128145993 │ 0xfda315a9d09fa1cf40c7d7af0f578589d3bbdf151367ce11ac56408e6968bb37 │ 4 │ 0 │ 6 │ 0 │ 0 │ 4 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x882dc42f47ecea249d7540fda95a31c71b3665c4b42651f08819c8a51eeaa52f │ 12 │ 2 │ 10 │ 0 │ 1 │ 3 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890767 │ mainnet │ op │ 10 │ 128145995 │ 0x24adee0e6ed2e6d80be5d20010146d1362cca61cf3b3038f28c973e91a47d17d │ 3 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0x1623043ce3a910f945ec14fb927e0b5f5b639b84f2d5bfd39585344f3c7bdc92 │ 1 │ 2 │ 3 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x6179b7e9e318af3a3d91b67dca7e463c1bcfd956403c9370b24fd1b6fb1b509a │ 13 │ 0 │ 3 │ 0 │ 0 │ 2 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x629828cacceea7478ba5d36d709068d0033cf63fbad20d67f96e606c19fc2262 │ 23 │ 0 │ 7 │ 0 │ 0 │ 4 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890773 │ mainnet │ op │ 10 │ 128145998 │ 0x69d2c2d4243dfbc828dccaef2718eb135a38b03f7a6bff07fcf6948cf26c03a5 │ 16 │ 2 │ 1 │ 1 │ 0 │ 0 │\n",
- "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴──────────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┤\n",
- "│ 10 rows 14 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────────────────────────────┬───────────────────────────────────────┬───────────────────┬──────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬───────────────────────────┬───────────────────┬────────────────────┬─────────────┬──────────────────┐\n",
+ "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │ is_qualified_tx_not_approval_wrapping_transfer │ is_qualified_tx_not_approval_wrapping │ transaction_index │ transaction_type │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ input_byte_length │ input_calldata_gas │ l1_gas_used │ receipt_gas_used │\n",
+ "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ boolean │ boolean │ int64 │ int32 │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ int64 │ int64 │\n",
+ "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────────────────────────────┼───────────────────────────────────────┼───────────────────┼──────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────┼─────────────┼──────────────────┤\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0x1235a81f6e53a98fd084110155e10a2a9987364008a22337339329ad40242387 │ 12 │ 3 │ 0 │ 3 │ true │ true │ 20 │ 0 │ 0.0000020874702928900 │ 0.0000014879054668900 │ 0.0000005995648260000 │ 0.0000004307828968610 │ 0.0000010570047134670 │ 0.0000000015123672900 │ 0.0000000000000000000 │ 0.0000005980524587100 │ 2340.0 │ 15192.0 │ 7857 │ 598010 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890761 │ mainnet │ op │ 10 │ 128145992 │ 0xedd5381353abf8e805af44d583c9ed59b1d6a611a194b6bac0a8cf3db26401c3 │ 7 │ 1 │ 0 │ 2 │ true │ true │ 9 │ 2 │ 0.0000030584908877560 │ 0.0000006801850001760 │ 0.0000023783058875800 │ 0.0000002110564649070 │ 0.0000004690025804280 │ 0.0000000005537082100 │ 0.0000023777521793700 │ 0.0000000000000000000 │ 708.0 │ 4668.0 │ 3922 │ 218857 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890761 │ mainnet │ op │ 10 │ 128145992 │ 0xa541416b4022b2de958bdc9e46401d23db0e3ac16cb5a0d8856b7bbcad8356b8 │ 21 │ 1 │ 0 │ 10 │ true │ true │ 14 │ 0 │ 0.0000017034381682460 │ 0.0000006616191454840 │ 0.0000010418190227620 │ 0.0000002052984226460 │ 0.0000004562072525070 │ 0.0000000021909622900 │ 0.0000000000000000000 │ 0.0000010396280604720 │ 254.0 │ 3668.0 │ 3815 │ 865993 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x882dc42f47ecea249d7540fda95a31c71b3665c4b42651f08819c8a51eeaa52f │ 10 │ 0 │ 1 │ 3 │ true │ true │ 12 │ 2 │ 0.0000036917430291910 │ 0.0000003251130291910 │ 0.0000033666300000000 │ 0.0000001008464597740 │ 0.0000002240976123720 │ 0.0000000008564706720 │ 0.0000033666300000000 │ 0.0000000000000000000 │ 260.0 │ 1736.0 │ 1874 │ 336663 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x68a86601a960770e35d97b6b809cdc405ddf0859a8899fc8ad3ed62746ef7b3b │ 6 │ 0 │ 0 │ 4 │ true │ true │ 15 │ 0 │ 0.0000006501825344740 │ 0.0000003784898614310 │ 0.0000002716926730430 │ 0.0000001174210113270 │ 0.0000002609290235830 │ 0.0000000005745344160 │ 0.0000000000000000000 │ 0.0000002711181386270 │ 119.0 │ 1568.0 │ 2182 │ 225839 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0xb44f4b1cba612ee8aa3fe75587c93a229311f352ff723f9270cb6a810cd9796f │ 3 │ 0 │ 0 │ 2 │ true │ true │ 4 │ 2 │ 0.0000060802707468270 │ 0.0000003436788838830 │ 0.0000057365918629440 │ 0.0000001066583155140 │ 0.0000002370125227960 │ 0.0000000002918629440 │ 0.0000057363000000000 │ 0.0000000000000000000 │ 196.0 │ 1360.0 │ 1982 │ 114726 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0x839c031e819358157b6d9f1b2a45d8f81b340b7f8c03865bd0cc054b909817fc │ 6 │ 0 │ 0 │ 2 │ true │ true │ 4 │ 2 │ 0.0000010497055963680 │ 0.0000005409410899860 │ 0.0000005087645063820 │ 0.0000001678442412150 │ 0.0000003729778297690 │ 0.0000000012905063820 │ 0.0000005074740000000 │ 0.0000000000000000000 │ 1284.0 │ 6276.0 │ 3119 │ 507474 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0xd18e16ed59bac5a1539139b621b2f920468f5ce96e5e4286c45eadb05d032502 │ 16 │ 0 │ 0 │ 16 │ false │ true │ 5 │ 0 │ 0.0000015609741782860 │ 0.0000011512935629860 │ 0.0000004096806153000 │ 0.0000003572676875360 │ 0.0000007939082436150 │ 0.0000000010391969500 │ 0.0000000000000000000 │ 0.0000004086414183500 │ 644.0 │ 6728.0 │ 6639 │ 408650 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x67b91deb4dacda098419875604d3e6629c803ab4965f8ccf29c4732d04be7ce6 │ 2 │ 0 │ 0 │ 1 │ true │ true │ 19 │ 2 │ 0.0000004114548578430 │ 0.0000002774335728030 │ 0.0000001340212850400 │ 0.0000000861015665100 │ 0.0000001913320062940 │ 0.0000000003412850400 │ 0.0000001336800000000 │ 0.0000000000000000000 │ 36.0 │ 228.0 │ 1600 │ 133680 │\n",
+ "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890773 │ mainnet │ op │ 10 │ 128145998 │ 0xe7add7889df390b6b32eecd72e25fa7146a458afa248b38c1ec4882e7c35237e │ 3 │ 0 │ 0 │ 2 │ true │ true │ 1 │ 2 │ 0.0001283789798928150 │ 0.0000002878469029230 │ 0.0001280911329898920 │ 0.0000000888535964360 │ 0.0000001989933064880 │ 0.0000000004393237560 │ 0.0001280911329898920 │ 0.0000000000000000000 │ 36.0 │ 444.0 │ 1600 │ 172014 │\n",
+ "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────────────────────────────┴───────────────────────────────────────┴───────────────────┴──────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────┴─────────────┴──────────────────┤\n",
+ "│ 10 rows 28 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 3,
@@ -155,7 +162,7 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_list_v1 LIMIT 10\")"
+ "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_v1 LIMIT 10\")"
]
},
{
@@ -187,7 +194,7 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_txs FROM event_emitting_transactions_list_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_txs FROM event_emitting_transactions_v1\")"
]
},
{
@@ -273,31 +280,30 @@
" white-space: pre-wrap;\n",
"}\n",
"\n",
- "shape: (5, 14)dt | block_hour | block_timestamp | network | chain | chain_id | block_number | transaction_hash | transaction_index | transaction_type | count_total_events | count_approval_events | count_wrapping_events | count_transfer_events |
---|
date | datetime[μs] | u32 | str | str | i32 | i64 | str | i64 | i32 | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0x0f3da35693644abe74388ab71888… | 6 | 0 | 11 | 0 | 0 | 5 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890755 | "mainnet" | "op" | 10 | 128145989 | "0xe5f2bb8587f675aa84c045b73298… | 5 | 0 | 3 | 0 | 0 | 2 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890759 | "mainnet" | "op" | 10 | 128145991 | "0xb6a080f67866d9bf3571a126ee7c… | 23 | 2 | 2 | 0 | 0 | 1 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890763 | "mainnet" | "op" | 10 | 128145993 | "0xfda315a9d09fa1cf40c7d7af0f57… | 4 | 0 | 6 | 0 | 0 | 4 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890765 | "mainnet" | "op" | 10 | 128145994 | "0x882dc42f47ecea249d7540fda95a… | 12 | 2 | 10 | 0 | 1 | 3 |
"
+ "shape: (5, 28)dt | block_hour | block_timestamp | network | chain | chain_id | block_number | transaction_hash | count_total_events | count_approval_events | count_wrapping_events | count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping | transaction_index | transaction_type | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | input_byte_length | input_calldata_gas | l1_gas_used | receipt_gas_used |
---|
date | datetime[μs] | u32 | str | str | i32 | i64 | str | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool | i64 | i32 | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | f64 | f64 | i64 | i64 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890759 | "mainnet" | "op" | 10 | 128145991 | "0x1235a81f6e53a98fd084110155e1… | 12 | 3 | 0 | 3 | true | true | 20 | 0 | 0.0000020874702928900 | 0.0000014879054668900 | 0.0000005995648260000 | 0.0000004307828968610 | 0.0000010570047134670 | 0.0000000015123672900 | 0.0000000000000000000 | 0.0000005980524587100 | 2340.0 | 15192.0 | 7857 | 598010 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890761 | "mainnet" | "op" | 10 | 128145992 | "0xedd5381353abf8e805af44d583c9… | 7 | 1 | 0 | 2 | true | true | 9 | 2 | 0.0000030584908877560 | 0.0000006801850001760 | 0.0000023783058875800 | 0.0000002110564649070 | 0.0000004690025804280 | 0.0000000005537082100 | 0.0000023777521793700 | 0.0000000000000000000 | 708.0 | 4668.0 | 3922 | 218857 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890761 | "mainnet" | "op" | 10 | 128145992 | "0xa541416b4022b2de958bdc9e4640… | 21 | 1 | 0 | 10 | true | true | 14 | 0 | 0.0000017034381682460 | 0.0000006616191454840 | 0.0000010418190227620 | 0.0000002052984226460 | 0.0000004562072525070 | 0.0000000021909622900 | 0.0000000000000000000 | 0.0000010396280604720 | 254.0 | 3668.0 | 3815 | 865993 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890765 | "mainnet" | "op" | 10 | 128145994 | "0x882dc42f47ecea249d7540fda95a… | 10 | 0 | 1 | 3 | true | true | 12 | 2 | 0.0000036917430291910 | 0.0000003251130291910 | 0.0000033666300000000 | 0.0000001008464597740 | 0.0000002240976123720 | 0.0000000008564706720 | 0.0000033666300000000 | 0.0000000000000000000 | 260.0 | 1736.0 | 1874 | 336663 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890765 | "mainnet" | "op" | 10 | 128145994 | "0x68a86601a960770e35d97b6b809c… | 6 | 0 | 0 | 4 | true | true | 15 | 0 | 0.0000006501825344740 | 0.0000003784898614310 | 0.0000002716926730430 | 0.0000001174210113270 | 0.0000002609290235830 | 0.0000000005745344160 | 0.0000000000000000000 | 0.0000002711181386270 | 119.0 | 1568.0 | 2182 | 225839 |
"
],
"text/plain": [
- "shape: (5, 14)\n",
+ "shape: (5, 28)\n",
"┌────────────┬───────────┬───────────┬─────────┬───┬───────────┬───────────┬───────────┬───────────┐\n",
- "│ dt ┆ block_hou ┆ block_tim ┆ network ┆ … ┆ count_tot ┆ count_app ┆ count_wra ┆ count_tra │\n",
- "│ --- ┆ r ┆ estamp ┆ --- ┆ ┆ al_events ┆ roval_eve ┆ pping_eve ┆ nsfer_eve │\n",
- "│ date ┆ --- ┆ --- ┆ str ┆ ┆ --- ┆ nts ┆ nts ┆ nts │\n",
- "│ ┆ datetime[ ┆ u32 ┆ ┆ ┆ i64 ┆ --- ┆ --- ┆ --- │\n",
- "│ ┆ μs] ┆ ┆ ┆ ┆ ┆ decimal[3 ┆ decimal[3 ┆ decimal[3 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ ┆ 8,0] ┆ 8,0] ┆ 8,0] │\n",
+ "│ dt ┆ block_hou ┆ block_tim ┆ network ┆ … ┆ input_byt ┆ input_cal ┆ l1_gas_us ┆ receipt_g │\n",
+ "│ --- ┆ r ┆ estamp ┆ --- ┆ ┆ e_length ┆ ldata_gas ┆ ed ┆ as_used │\n",
+ "│ date ┆ --- ┆ --- ┆ str ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ datetime[ ┆ u32 ┆ ┆ ┆ f64 ┆ f64 ┆ i64 ┆ i64 │\n",
+ "│ ┆ μs] ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"╞════════════╪═══════════╪═══════════╪═════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 11 ┆ 0 ┆ 0 ┆ 5 │\n",
- "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 2340.0 ┆ 15192.0 ┆ 7857 ┆ 598010 │\n",
+ "│ ┆ 8 ┆ 9 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 3 ┆ 0 ┆ 0 ┆ 2 │\n",
- "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 708.0 ┆ 4668.0 ┆ 3922 ┆ 218857 │\n",
+ "│ ┆ 8 ┆ 1 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 2 ┆ 0 ┆ 0 ┆ 1 │\n",
- "│ ┆ 8 ┆ 9 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 254.0 ┆ 3668.0 ┆ 3815 ┆ 865993 │\n",
+ "│ ┆ 8 ┆ 1 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 6 ┆ 0 ┆ 0 ┆ 4 │\n",
- "│ ┆ 8 ┆ 3 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 260.0 ┆ 1736.0 ┆ 1874 ┆ 336663 │\n",
+ "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 10 ┆ 0 ┆ 1 ┆ 3 │\n",
+ "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 119.0 ┆ 1568.0 ┆ 2182 ┆ 225839 │\n",
"│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"└────────────┴───────────┴───────────┴─────────┴───┴───────────┴───────────┴───────────┴───────────┘"
@@ -309,7 +315,7 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_list_v1 LIMIT 5\").pl()"
+ "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_v1 LIMIT 5\").pl()"
]
},
{
@@ -327,27 +333,36 @@
{
"data": {
"text/plain": [
- "┌───────────────────────┬───────────────┬─────────┬─────────┬─────────┬─────────┐\n",
- "│ column_name │ column_type │ null │ key │ default │ extra │\n",
- "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
- "├───────────────────────┼───────────────┼─────────┼─────────┼─────────┼─────────┤\n",
- "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_hour │ TIMESTAMP │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_type │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_wrapping_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_transfer_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "├───────────────────────┴───────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 14 rows 6 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────┘"
+ "┌───────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├───────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_hour │ TIMESTAMP │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ l2_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_blob_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_priority_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_legacy_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ input_byte_length │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ input_calldata_gas │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ receipt_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "├───────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 28 rows (20 shown) 6 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 8,
@@ -356,7 +371,7 @@
}
],
"source": [
- "duckdb_client.sql(\"DESCRIBE event_emitting_transactions_list_v1\")\n"
+ "duckdb_client.sql(\"DESCRIBE event_emitting_transactions_v1\")\n"
]
}
],
diff --git a/notebooks/adhoc/refined_transactions_fees_dev.ipynb b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
index e569a57d3bb..8cc8250cc80 100644
--- a/notebooks/adhoc/refined_transactions_fees_dev.ipynb
+++ b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:47\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:48\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n"
+ "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n"
]
}
],
@@ -68,34 +68,30 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 13:10:48\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:48\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:49\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:49\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:51\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:51\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mbase_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions_list\u001b[0m\n",
- "\u001b[2m2024-12-13 13:10:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m42986\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
+ "\u001b[2m2024-12-13 13:51:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
"dict_keys(['refined_transactions_fees_v1'])\n"
]
},
{
"data": {
"text/plain": [
- "┌──────────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├──────────────────────────────────┤\n",
- "│ base_transactions_fees │\n",
- "│ event_emitting_transactions_list │\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_logs_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ refined_transactions_fees │\n",
- "│ refined_transactions_fees_v1 │\n",
- "└──────────────────────────────────┘"
+ "┌──────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├──────────────────────────────┤\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ refined_transactions_fees │\n",
+ "│ refined_transactions_fees_v1 │\n",
+ "└──────────────────────────────┘"
]
},
"execution_count": 2,
@@ -137,23 +133,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────┬──────────┬─────────┬─────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────┬───────────┬──────────────────┬─────────────────────┬───────────────┬──────────────────────┬──────────────────────────┬──────────────────┬──────────────────────────┬─────────────────────────┬──────────────┬─────────────────┬─────────────┬─────────────────────┬────────────┬─────────┬────────────────────┬─────────────────────────┬──────────────────┬───────────────────┬────────────────────┬───────────────────────┬─────────────────────────────────────┬─────────────┬───────────────┬────────────────────┬───────────────────────────┬─────────────────────┬────────────────────────────┬─────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬───────────────────────────┬───────────────────┬────────────────────────┬────────────────────────────┬───────────────────────────────┬────────────────────────┬─────────────────────────────┬────────────────────────┬───────────────────────────┬───────────────────────────┬───────────────────────────┬────────────────────────────────────────────────┬───────────────────────────────────────┐\n",
- "│ dt │ chain │ chain_id │ network │ nonce │ transaction_index │ from_address │ to_address │ block_number │ block_timestamp │ hash │ gas_price │ gas_limit │ receipt_gas_used │ receipt_l1_gas_used │ l1_fee │ receipt_l1_gas_price │ receipt_l1_blob_base_fee │ base_fee_per_gas │ max_priority_fee_per_gas │ base_legacy_fee_per_gas │ l2_fee │ l2_priority_fee │ l2_base_fee │ block_hour │ method_id │ success │ l1_base_fee_scalar │ l1_blob_base_fee_scalar │ transaction_type │ input_byte_length │ input_calldata_gas │ is_system_transaction │ is_attributes_deposited_transaction │ l1_gas_used │ tx_fee │ l2_base_legacy_fee │ l1_base_fee │ l1_base_scaled_size │ l1_blob_fee │ l1_blob_scaled_size │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ l2_gas_price_gwei │ l2_base_gas_price_gwei │ l2_priority_gas_price_gwei │ l2_base_legacy_gas_price_gwei │ l1_base_gas_price_gwei │ l1_blob_base_gas_price_gwei │ log_count_total_events │ log_count_approval_events │ log_count_wrapping_events │ log_count_transfer_events │ is_qualified_tx_not_approval_wrapping_transfer │ is_qualified_tx_not_approval_wrapping │\n",
- "│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ uint32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ timestamp │ varchar │ boolean │ decimal(36,7) │ decimal(26,7) │ int32 │ double │ double │ boolean │ boolean │ int64 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ boolean │ boolean │\n",
- "├────────────┼─────────┼──────────┼─────────┼─────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────┼───────────┼──────────────────┼─────────────────────┼───────────────┼──────────────────────┼──────────────────────────┼──────────────────┼──────────────────────────┼─────────────────────────┼──────────────┼─────────────────┼─────────────┼─────────────────────┼────────────┼─────────┼────────────────────┼─────────────────────────┼──────────────────┼───────────────────┼────────────────────┼───────────────────────┼─────────────────────────────────────┼─────────────┼───────────────┼────────────────────┼───────────────────────────┼─────────────────────┼────────────────────────────┼─────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────────────────────────┼───────────────────────────────┼────────────────────────┼─────────────────────────────┼────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┼────────────────────────────────────────────────┼───────────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1236 │ 1 │ 0xcecfc5e576c71e913e900df7e96fc11be2222222 │ 0x0000000000007c4cb8129fc2ae24463c32e5d0da │ 128145646 │ 1731890069 │ 0x740c2dbfffed2f807d7502840596cd4bee063cdc6899e19f6a57b50d63945b00 │ 1509609 │ 363036 │ 303721 │ 1968 │ 464705291307 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1508215 │ 458499955089 │ 0 │ 423387074 │ 2024-11-18 00:00:00 │ 0x03806a3a │ true │ 0.0836320 │ 1.0142130 │ 0 │ 90.0 │ 1392.0 │ false │ false │ 1968 │ 923205246396 │ 458076568015 │ 87582350812.462704000000 │ 10.286736000000 │ 376966580122.755981000000 │ 124.748199000000 │ 0.0000009232052463960 │ 0.0000004647052913070 │ 0.0000004584999550890 │ 0.0000000875823508120 │ 0.0000003769665801230 │ 0.0000000004233870740 │ 0.0000000000000000000 │ 0.0000004580765680150 │ 0.0015096090 │ 0.0000013940 │ 0.0000000000 │ 0.0015082150 │ 8.5141050390 │ 3.0218198190 │ 13 │ 0 │ 0 │ 6 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 558 │ 10 │ 0x72099133f9310c47b3543d6a9c3fef25dd7c71e3 │ 0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8 │ 128145646 │ 1731890069 │ 0x069e5d9f4850092b767b41fb883557c50db14a3f7ab5046e873a39afaf5d1575 │ 452771 │ 67533 │ 51556 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 451377 │ 0 │ 23343061676 │ 23271192612 │ 71869064 │ 2024-11-18 00:00:00 │ 0x095ea7b3 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 68.0 │ 944.0 │ false │ false │ 1600 │ 401025119346 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004010251193460 │ 0.0000003776820576700 │ 0.0000000233430616760 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000718690640 │ 0.0000000232711926120 │ 0.0000000000000000000 │ 0.0004527710 │ 0.0000013940 │ 0.0004513770 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 1 │ 1 │ 0 │ 0 │ false │ false │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 858 │ 15 │ 0x21bdb91661a4472ff0d3871c300d4120a886ad9b │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0xf8c3fa8ece22e50b86ef016e991863191b62f20f376b16dbcca436fc80f8e28c │ 101394 │ 197308 │ 189126 │ 4953 │ 1169231513276 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19176241644 │ 18912600000 │ 263641644 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6388.0 │ false │ false │ 4953 │ 1188407754920 │ 0 │ 220424483523.438909000000 │ 25.889331000000 │ 948737536254.070311937500 │ 313.962311812500 │ 0.0000011884077549200 │ 0.0000011692315132760 │ 0.0000000191762416440 │ 0.0000002204244835230 │ 0.0000009487375362540 │ 0.0000000002636416440 │ 0.0000000189126000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 873 │ 16 │ 0xac50debe83f7dbf2144239bcb946a2506b2782da │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0x8b70ce403d88feb808e4f44d60b95b49fc9299aaf324890ebf9593a5dbc29fd5 │ 101394 │ 197296 │ 189114 │ 4966 │ 1172390823688 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19175024916 │ 18911400000 │ 263624916 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6400.0 │ false │ false │ 4966 │ 1191565848604 │ 0 │ 221003025474.943998000000 │ 25.957282000000 │ 951227661021.141362625000 │ 314.786359875000 │ 0.0000011915658486040 │ 0.0000011723908236880 │ 0.0000000191750249160 │ 0.0000002210030254750 │ 0.0000009512276610210 │ 0.0000000002636249160 │ 0.0000000189114000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1446656 │ 3 │ 0x0771483e9ad0d8c452efbca3451e4e56249b64bd │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 128145646 │ 1731890069 │ 0x94291d07579ee7b6227cd7a2904392d45a39a9ab962892dc6c08a2d08d32bb31 │ 1201665 │ 3000000 │ 522698 │ 3199 │ 755361849249 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1200271 │ 628107892170 │ 0 │ 728641012 │ 2024-11-18 00:00:00 │ 0xe129b4b8 │ true │ 0.0836320 │ 1.0142130 │ 0 │ 214.0 │ 2860.0 │ false │ false │ 3199 │ 1383469741419 │ 627379251158 │ 142365823297.290747000000 │ 16.721173000000 │ 612762240758.483934562500 │ 202.779211687500 │ 0.0000013834697414190 │ 0.0000007553618492490 │ 0.0000006281078921700 │ 0.0000001423658232970 │ 0.0000006127622407580 │ 0.0000000007286410120 │ 0.0000000000000000000 │ 0.0000006273792511580 │ 0.0012016650 │ 0.0000013940 │ 0.0000000000 │ 0.0012002710 │ 8.5141050390 │ 3.0218198190 │ 12 │ 0 │ 0 │ 8 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 59 │ 4 │ 0x1893d8121f083ebf12227226c94b17871a4d42b7 │ 0x8a2725a6f04816a5274ddd9feadd3bd0c253c1a6 │ 128145646 │ 1731890069 │ 0x1ce1b0856a4d9463cfe6a5718197eef25a976e9934bbc05ab3ef3a38053dfc0f │ 1001394 │ 166761 │ 106027 │ 6746 │ 1592579108540 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 106174801638 │ 106027000000 │ 147801638 │ 2024-11-18 00:00:00 │ 0x891f4e42 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 516.0 │ 6972.0 │ false │ false │ 6746 │ 1698753910178 │ 0 │ 300218769604.102338000000 │ 35.261342000000 │ 1292183206050.869841375000 │ 427.617556125000 │ 0.0000016987539101780 │ 0.0000015925791085400 │ 0.0000001061748016380 │ 0.0000003002187696040 │ 0.0000012921832060510 │ 0.0000000001478016380 │ 0.0000001060270000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 2 │ 0 │ 0 │ 1 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 42 │ 5 │ 0x6b08f3ab29cdf708f7059a3acecaf9e905f921bc │ 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45 │ 128145646 │ 1731890069 │ 0xb98479825e34d6d9c94cce974b47024415972c6aecfce3a2584ce6867ddef584 │ 1001394 │ 115761 │ 112669 │ 2383 │ 562643914092 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 112826060586 │ 112669000000 │ 157060586 │ 2024-11-18 00:00:00 │ 0x04e45aaf │ true │ 0.0836320 │ 1.0142130 │ 2 │ 228.0 │ 1776.0 │ false │ false │ 2383 │ 675469974678 │ 0 │ 106051190033.586699000000 │ 12.455941000000 │ 456459024610.024137562500 │ 151.054348687500 │ 0.0000006754699746780 │ 0.0000005626439140920 │ 0.0000001128260605860 │ 0.0000001060511900340 │ 0.0000004564590246100 │ 0.0000000001570605860 │ 0.0000001126690000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 4 │ 1 │ 0 │ 2 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 10500 │ 6 │ 0x43370402cbeba6ab53fbc8a52894537024a39269 │ 0x0000000071727de22e5e9d8baf0edac6f37da032 │ 128145646 │ 1731890069 │ 0xf4e15cd270206216937eddf9a3ac72396ba89a4cebf1eee49af873206eed164f │ 1001394 │ 326206 │ 190204 │ 7054 │ 1665243248025 │ 8514105039 │ 3021819819 │ 1394 │ 1000000 │ 0 │ 190469144376 │ 190204000000 │ 265144376 │ 2024-11-18 00:00:00 │ 0x765e827f │ true │ 0.0836320 │ 1.0142130 │ 2 │ 1252.0 │ 8404.0 │ false │ false │ 7054 │ 1855712392401 │ 0 │ 313925763532.069062000000 │ 36.871258000000 │ 1351180008224.553196125000 │ 447.141156375000 │ 0.0000018557123924010 │ 0.0000016652432480250 │ 0.0000001904691443760 │ 0.0000003139257635320 │ 0.0000013511800082250 │ 0.0000000002651443760 │ 0.0000001902040000000 │ 0.0000000000000000000 │ 0.0010013940 │ 0.0000013940 │ 0.0010000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 4 │ 0 │ 0 │ 1 │ true │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1 │ 7 │ 0x8eb24562a06fc42689a66e6b203fc43ed0cb45ab │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 128145646 │ 1731890069 │ 0x72dd6aca2cd8ae01537ce1105987ea8b2ee81a87031d9497138839571c57fe52 │ 1001325 │ 200000 │ 29950 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 999931 │ 29989683750 │ 0 │ 41750300 │ 2024-11-18 00:00:00 │ 0xa9059cbb │ true │ 0.0836320 │ 1.0142130 │ 0 │ 68.0 │ 608.0 │ false │ false │ 1600 │ 407671741420 │ 29947933450 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004076717414200 │ 0.0000003776820576700 │ 0.0000000299896837500 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000417503000 │ 0.0000000000000000000 │ 0.0000000299479334500 │ 0.0010013250 │ 0.0000013940 │ 0.0000000000 │ 0.0009999310 │ 8.5141050390 │ 3.0218198190 │ 1 │ 0 │ 0 │ 1 │ false │ true │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 724110 │ 10 │ 0xa750a354528b56a62ee6f8538ca340f1d986c878 │ 0xca11bde05977b3631167028862be2a173976ca11 │ 128145647 │ 1731890071 │ 0xf775507c1d678f5a650b05bee624db6e6e4b15f1ff6fb7de04801dd9b26ad214 │ 386693 │ 200000 │ 151117 │ 4846 │ 1143957029976 │ 8514105039 │ 3021819819 │ 1392 │ 385301 │ 0 │ 58435886081 │ 58225531217 │ 210354864 │ 2024-11-18 00:00:00 │ 0x82ad56cb │ true │ 0.0836320 │ 1.0142130 │ 2 │ 1124.0 │ 7520.0 │ false │ false │ 4846 │ 1202392916057 │ 0 │ 215662638230.281638000000 │ 25.330042000000 │ 928241893940.485510125000 │ 307.179762375000 │ 0.0000012023929160570 │ 0.0000011439570299760 │ 0.0000000584358860810 │ 0.0000002156626382300 │ 0.0000009282418939400 │ 0.0000000002103548640 │ 0.0000000582255312170 │ 0.0000000000000000000 │ 0.0003866930 │ 0.0000013920 │ 0.0003853010 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │ 9 │ 1 │ 0 │ 1 │ true │ true │\n",
- "├────────────┴─────────┴──────────┴─────────┴─────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────┴───────────┴──────────────────┴─────────────────────┴───────────────┴──────────────────────┴──────────────────────────┴──────────────────┴──────────────────────────┴─────────────────────────┴──────────────┴─────────────────┴─────────────┴─────────────────────┴────────────┴─────────┴────────────────────┴─────────────────────────┴──────────────────┴───────────────────┴────────────────────┴───────────────────────┴─────────────────────────────────────┴─────────────┴───────────────┴────────────────────┴───────────────────────────┴─────────────────────┴────────────────────────────┴─────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────────────────────────┴───────────────────────────────┴────────────────────────┴─────────────────────────────┴────────────────────────┴───────────────────────────┴───────────────────────────┴───────────────────────────┴────────────────────────────────────────────────┴───────────────────────────────────────┤\n",
- "│ 10 rows 61 columns │\n",
- "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────┬──────────┬─────────┬──────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────┬───────────┬──────────────────┬─────────────────────┬───────────────┬──────────────────────┬──────────────────────────┬──────────────────┬──────────────────────────┬─────────────────────────┬──────────────┬─────────────────┬─────────────┬─────────────────────┬────────────┬─────────┬────────────────────┬─────────────────────────┬──────────────────┬───────────────────┬────────────────────┬───────────────────────┬─────────────────────────────────────┬─────────────┬───────────────┬────────────────────┬───────────────────────────┬─────────────────────┬───────────────────────────┬─────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬───────────────────────────┬───────────────────┬────────────────────────┬────────────────────────────┬───────────────────────────────┬────────────────────────┬─────────────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ nonce │ transaction_index │ from_address │ to_address │ block_number │ block_timestamp │ hash │ gas_price │ gas_limit │ receipt_gas_used │ receipt_l1_gas_used │ l1_fee │ receipt_l1_gas_price │ receipt_l1_blob_base_fee │ base_fee_per_gas │ max_priority_fee_per_gas │ base_legacy_fee_per_gas │ l2_fee │ l2_priority_fee │ l2_base_fee │ block_hour │ method_id │ success │ l1_base_fee_scalar │ l1_blob_base_fee_scalar │ transaction_type │ input_byte_length │ input_calldata_gas │ is_system_transaction │ is_attributes_deposited_transaction │ l1_gas_used │ tx_fee │ l2_base_legacy_fee │ l1_base_fee │ l1_base_scaled_size │ l1_blob_fee │ l1_blob_scaled_size │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ l2_gas_price_gwei │ l2_base_gas_price_gwei │ l2_priority_gas_price_gwei │ l2_base_legacy_gas_price_gwei │ l1_base_gas_price_gwei │ l1_blob_base_gas_price_gwei │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ uint32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ timestamp │ varchar │ boolean │ decimal(36,7) │ decimal(26,7) │ int32 │ double │ double │ boolean │ boolean │ int64 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │\n",
+ "├────────────┼─────────┼──────────┼─────────┼──────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────┼───────────┼──────────────────┼─────────────────────┼───────────────┼──────────────────────┼──────────────────────────┼──────────────────┼──────────────────────────┼─────────────────────────┼──────────────┼─────────────────┼─────────────┼─────────────────────┼────────────┼─────────┼────────────────────┼─────────────────────────┼──────────────────┼───────────────────┼────────────────────┼───────────────────────┼─────────────────────────────────────┼─────────────┼───────────────┼────────────────────┼───────────────────────────┼─────────────────────┼───────────────────────────┼─────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────────────────────────┼───────────────────────────────┼────────────────────────┼─────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 22910584 │ 0 │ 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001 │ 0x4200000000000000000000000000000000000015 │ 128145646 │ 1731890069 │ 0xd84f3bf3f18a1cf627450597ec683e81319c8eb0f9e00c1eaa8288869bc0cf0c │ 0 │ 1000000 │ 43887 │ NULL │ 0 │ NULL │ NULL │ 1394 │ 0 │ -1394 │ 0 │ 0 │ 0 │ 2024-11-18 00:00:00 │ 0x440a5e20 │ true │ NULL │ 0.0000000 │ 126 │ 164.0 │ 1604.0 │ true │ true │ NULL │ 0 │ 0 │ NULL │ NULL │ NULL │ NULL │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000000000000000 │ NULL │ NULL │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000000 │ 0.0000013940 │ 0.0000000000 │ -0.0000013940 │ NULL │ NULL │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1236 │ 1 │ 0xcecfc5e576c71e913e900df7e96fc11be2222222 │ 0x0000000000007c4cb8129fc2ae24463c32e5d0da │ 128145646 │ 1731890069 │ 0x740c2dbfffed2f807d7502840596cd4bee063cdc6899e19f6a57b50d63945b00 │ 1509609 │ 363036 │ 303721 │ 1968 │ 464705291307 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1508215 │ 458499955089 │ 0 │ 423387074 │ 2024-11-18 00:00:00 │ 0x03806a3a │ true │ 0.0836320 │ 1.0142130 │ 0 │ 90.0 │ 1392.0 │ false │ false │ 1968 │ 923205246396 │ 458076568015 │ 87582350812.462704000000 │ 10.286736000000 │ 376966580122.755981000000 │ 124.748199000000 │ 0.0000009232052463960 │ 0.0000004647052913070 │ 0.0000004584999550890 │ 0.0000000875823508120 │ 0.0000003769665801230 │ 0.0000000004233870740 │ 0.0000000000000000000 │ 0.0000004580765680150 │ 0.0015096090 │ 0.0000013940 │ 0.0000000000 │ 0.0015082150 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 558 │ 10 │ 0x72099133f9310c47b3543d6a9c3fef25dd7c71e3 │ 0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8 │ 128145646 │ 1731890069 │ 0x069e5d9f4850092b767b41fb883557c50db14a3f7ab5046e873a39afaf5d1575 │ 452771 │ 67533 │ 51556 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 451377 │ 0 │ 23343061676 │ 23271192612 │ 71869064 │ 2024-11-18 00:00:00 │ 0x095ea7b3 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 68.0 │ 944.0 │ false │ false │ 1600 │ 401025119346 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004010251193460 │ 0.0000003776820576700 │ 0.0000000233430616760 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000718690640 │ 0.0000000232711926120 │ 0.0000000000000000000 │ 0.0004527710 │ 0.0000013940 │ 0.0004513770 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 461242 │ 11 │ 0x669bee230facc9240e2ef81c2e566c3ebadd7c71 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 128145646 │ 1731890069 │ 0xc73122d98c55a550441d600fb07f46962788a97a3b9cfd9194e3367cf8f870ae │ 448961 │ 15000000 │ 513743 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 447567 │ 0 │ 230650571023 │ 229934413281 │ 716157742 │ 2024-11-18 00:00:00 │ 0x24f88863 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 4.0 │ 64.0 │ false │ false │ 1600 │ 608332628693 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000006083326286930 │ 0.0000003776820576700 │ 0.0000002306505710230 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000007161577420 │ 0.0000002299344132810 │ 0.0000000000000000000 │ 0.0004489610 │ 0.0000013940 │ 0.0004475670 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1370265 │ 12 │ 0xc97240c92596276b8b9366064123fd76a1207164 │ 0x24f6f36a551fe6008fa80afcff1d6ace182ead2b │ 128145646 │ 1731890069 │ 0x11a1d608f9ab9016ebfaa80a658fbe22f622cad6595df8ef59ae5ecf6098e034 │ 386695 │ 800000 │ 305090 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 385301 │ 0 │ 117976777550 │ 117551482090 │ 425295460 │ 2024-11-18 00:00:00 │ 0x540817d7 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 100.0 │ 688.0 │ false │ false │ 1600 │ 495658835220 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004956588352200 │ 0.0000003776820576700 │ 0.0000001179767775500 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000004252954600 │ 0.0000001175514820900 │ 0.0000000000000000000 │ 0.0003866950 │ 0.0000013940 │ 0.0003853010 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 1948828 │ 13 │ 0xc96909cd052f6000ffaf3e9ff17f9c2047cfd1b8 │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 128145646 │ 1731890069 │ 0x7beb4c5e4a7a2f9dd1fc18c469051a419534652065ea50afdf86ea13cccb6839 │ 341508 │ 5000000 │ 342331 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 340114 │ 0 │ 116908775148 │ 116431565734 │ 477209414 │ 2024-11-18 00:00:00 │ 0x0001 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 2.0 │ 20.0 │ false │ false │ 1600 │ 494590832818 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004945908328180 │ 0.0000003776820576700 │ 0.0000001169087751480 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000004772094140 │ 0.0000001164315657340 │ 0.0000000000000000000 │ 0.0003415080 │ 0.0000013940 │ 0.0003401140 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 2021489 │ 14 │ 0xc96faba4ff9941a55754d7a4b02aeaf7d53f43b9 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 128145646 │ 1731890069 │ 0x27d1249da3b373260ce0b6ec9ce1fc9ce8e51ae6e22211dbcbcfe314d35d4a23 │ 101394 │ 15000000 │ 513743 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 52090457742 │ 51374300000 │ 716157742 │ 2024-11-18 00:00:00 │ 0x24f88863 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 4.0 │ 64.0 │ false │ false │ 1600 │ 429772515412 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004297725154120 │ 0.0000003776820576700 │ 0.0000000520904577420 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000007161577420 │ 0.0000000513743000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 858 │ 15 │ 0x21bdb91661a4472ff0d3871c300d4120a886ad9b │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0xf8c3fa8ece22e50b86ef016e991863191b62f20f376b16dbcca436fc80f8e28c │ 101394 │ 197308 │ 189126 │ 4953 │ 1169231513276 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19176241644 │ 18912600000 │ 263641644 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6388.0 │ false │ false │ 4953 │ 1188407754920 │ 0 │ 220424483523.438909000000 │ 25.889331000000 │ 948737536254.070311937500 │ 313.962311812500 │ 0.0000011884077549200 │ 0.0000011692315132760 │ 0.0000000191762416440 │ 0.0000002204244835230 │ 0.0000009487375362540 │ 0.0000000002636416440 │ 0.0000000189126000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 873 │ 16 │ 0xac50debe83f7dbf2144239bcb946a2506b2782da │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0x8b70ce403d88feb808e4f44d60b95b49fc9299aaf324890ebf9593a5dbc29fd5 │ 101394 │ 197296 │ 189114 │ 4966 │ 1172390823688 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19175024916 │ 18911400000 │ 263624916 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6400.0 │ false │ false │ 4966 │ 1191565848604 │ 0 │ 221003025474.943998000000 │ 25.957282000000 │ 951227661021.141362625000 │ 314.786359875000 │ 0.0000011915658486040 │ 0.0000011723908236880 │ 0.0000000191750249160 │ 0.0000002210030254750 │ 0.0000009512276610210 │ 0.0000000002636249160 │ 0.0000000189114000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 270110 │ 17 │ 0xabe58b50367fb4cea7d19c41c228abed381ed2ef │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 128145646 │ 1731890069 │ 0x50aed494babf3fcafe2f1c271c7e5ff361a7f45a9134ab8d2ff660244b6b0bf0 │ 101393 │ 5000000 │ 342331 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 99999 │ 0 │ 34709967083 │ 34232757669 │ 477209414 │ 2024-11-18 00:00:00 │ 0x0001 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 2.0 │ 20.0 │ false │ false │ 1600 │ 412392024753 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004123920247530 │ 0.0000003776820576700 │ 0.0000000347099670830 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000004772094140 │ 0.0000000342327576690 │ 0.0000000000000000000 │ 0.0001013930 │ 0.0000013940 │ 0.0000999990 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴──────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────┴───────────┴──────────────────┴─────────────────────┴───────────────┴──────────────────────┴──────────────────────────┴──────────────────┴──────────────────────────┴─────────────────────────┴──────────────┴─────────────────┴─────────────┴─────────────────────┴────────────┴─────────┴────────────────────┴─────────────────────────┴──────────────────┴───────────────────┴────────────────────┴───────────────────────┴─────────────────────────────────────┴─────────────┴───────────────┴────────────────────┴───────────────────────────┴─────────────────────┴───────────────────────────┴─────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────────────────────────┴───────────────────────────────┴────────────────────────┴─────────────────────────────┤\n",
+ "│ 10 rows 55 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 3,
@@ -253,23 +249,28 @@
" white-space: pre-wrap;\n",
"}\n",
"\n",
- "shape: (5, 61)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei | log_count_total_events | log_count_approval_events | log_count_wrapping_events | log_count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool |
2024-11-18 | "op" | 10 | "mainnet" | 254942 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128145323 | 1731889423 | "0xa154c2a27f36f900ba0cc89f30e4… | 6009964258 | 1000000 | 167161 | 1600 | 306301485470 | 7670139258 | 2387610658 | 856 | 0 | 6009963402 | 1004631635331538 | 0 | 143089816 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 1004937936817008 | 1004631492241722 | 64146908642.505600000000 | 8.363200000000 | 242154576828.215400000000 | 101.421300000000 | 0.0010049379368170080 | 0.0000003063014854700 | 0.0010046316353315380 | 0.0000000641469086430 | 0.0000002421545768280 | 0.0000000001430898160 | 0.0000000000000000000 | 0.0010046314922417220 | 6.0099642580 | 0.0000008560 | 0.0000000000 | 6.0099634020 | 7.6701392580 | 2.3876106580 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 254890 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128144808 | 1731888393 | "0x3bf1efa2db347fb47dd054401ef4… | 3557316353 | 1000000 | 167130 | 1600 | 178769154750 | 8171754126 | 1088796344 | 662 | 0 | 3557315691 | 594534282076890 | 0 | 110640060 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 594713051231640 | 594534171436830 | 68342014106.563200000000 | 8.363200000000 | 110427140643.727200000000 | 101.421300000000 | 0.0005947130512316400 | 0.0000001787691547500 | 0.0005945342820768900 | 0.0000000683420141070 | 0.0000001104271406440 | 0.0000000001106400600 | 0.0000000000000000000 | 0.0005945341714368300 | 3.5573163530 | 0.0000006620 | 0.0000000000 | 3.5573156910 | 8.1717541260 | 1.0887963440 | 3 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 278585 | 3 | "0xe3e73f1aa65eeb809ff1f41f3c09… | "0x68b3465833fb72a70ecdf485e0e4… | 128145787 | 1731890351 | "0x3c34052b55b8ea87fad65536694c… | 3806621788 | 1000000 | 150414 | 2263 | 496962886328 | 8132807920 | 2793617096 | 1778 | 0 | 3806620010 | 572569209620232 | 0 | 267436092 | 2024-11-18 00:00:00 | "0x04e45aaf" | false | 0.0836320 | 1.0142130 | 0 | 228.0 | 1644.0 | false | false | 2263 | 573066172506560 | 572568942184140 | 96200553176.111920000000 | 11.828701000000 | 400738090100.154301500000 | 143.447751187500 | 0.0005730661725065600 | 0.0000004969628863280 | 0.0005725692096202320 | 0.0000000962005531760 | 0.0000004007380901000 | 0.0000000002674360920 | 0.0000000000000000000 | 0.0005725689421841400 | 3.8066217880 | 0.0000017780 | 0.0000000000 | 3.8066200100 | 8.1328079200 | 2.7936170960 | 0 | 0 | 0 | 0 | false | false |
2024-11-18 | "op" | 10 | "mainnet" | 15578 | 6 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145605 | 1731889987 | "0x2f1c10fa888a422c3dafe1d8a16d… | 477875164 | 2499999 | 1130360 | 20090 | 3713537605952 | 7522450707 | 2295686953 | 1299 | 0 | 477873865 | 540170970379040 | 0 | 1468337640 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21980.0 | false | false | 20090 | 543884507984992 | 540169502041400 | 789935783395.874010000000 | 105.010430000000 | 2923491214556.840563125000 | 1273.471198125000 | 0.0005438845079849920 | 0.0000037135376059520 | 0.0005401709703790400 | 0.0000007899357833960 | 0.0000029234912145570 | 0.0000000014683376400 | 0.0000000000000000000 | 0.0005401695020414000 | 0.4778751640 | 0.0000012990 | 0.0000000000 | 0.4778738650 | 7.5224507070 | 2.2956869530 | 9 | 0 | 0 | 2 | true | true |
2024-11-18 | "op" | 10 | "mainnet" | 15579 | 1 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145777 | 1731890331 | "0x242ec819d3b42117800b3942fa29… | 455586072 | 2499999 | 1149957 | 20157 | 5417238559765 | 8537410887 | 3535671733 | 1751 | 0 | 455584321 | 523904392598904 | 0 | 2013574707 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21956.0 | false | false | 20157 | 529321631158669 | 523902379024197 | 899507066459.876793000000 | 105.360639000000 | 4517592175735.696078312500 | 1277.718215062500 | 0.0005293216311586690 | 0.0000054172385597650 | 0.0005239043925989040 | 0.0000008995070664600 | 0.0000045175921757360 | 0.0000000020135747070 | 0.0000000000000000000 | 0.0005239023790241970 | 0.4555860720 | 0.0000017510 | 0.0000000000 | 0.4555843210 | 8.5374108870 | 3.5356717330 | 9 | 0 | 0 | 2 | true | true |
"
+ "shape: (5, 55)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] |
2024-11-18 | "op" | 10 | "mainnet" | 254942 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128145323 | 1731889423 | "0xa154c2a27f36f900ba0cc89f30e4… | 6009964258 | 1000000 | 167161 | 1600 | 306301485470 | 7670139258 | 2387610658 | 856 | 0 | 6009963402 | 1004631635331538 | 0 | 143089816 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 1004937936817008 | 1004631492241722 | 64146908642.505600000000 | 8.363200000000 | 242154576828.215400000000 | 101.421300000000 | 0.0010049379368170080 | 0.0000003063014854700 | 0.0010046316353315380 | 0.0000000641469086430 | 0.0000002421545768280 | 0.0000000001430898160 | 0.0000000000000000000 | 0.0010046314922417220 | 6.0099642580 | 0.0000008560 | 0.0000000000 | 6.0099634020 | 7.6701392580 | 2.3876106580 |
2024-11-18 | "op" | 10 | "mainnet" | 254890 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128144808 | 1731888393 | "0x3bf1efa2db347fb47dd054401ef4… | 3557316353 | 1000000 | 167130 | 1600 | 178769154750 | 8171754126 | 1088796344 | 662 | 0 | 3557315691 | 594534282076890 | 0 | 110640060 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 594713051231640 | 594534171436830 | 68342014106.563200000000 | 8.363200000000 | 110427140643.727200000000 | 101.421300000000 | 0.0005947130512316400 | 0.0000001787691547500 | 0.0005945342820768900 | 0.0000000683420141070 | 0.0000001104271406440 | 0.0000000001106400600 | 0.0000000000000000000 | 0.0005945341714368300 | 3.5573163530 | 0.0000006620 | 0.0000000000 | 3.5573156910 | 8.1717541260 | 1.0887963440 |
2024-11-18 | "op" | 10 | "mainnet" | 278585 | 3 | "0xe3e73f1aa65eeb809ff1f41f3c09… | "0x68b3465833fb72a70ecdf485e0e4… | 128145787 | 1731890351 | "0x3c34052b55b8ea87fad65536694c… | 3806621788 | 1000000 | 150414 | 2263 | 496962886328 | 8132807920 | 2793617096 | 1778 | 0 | 3806620010 | 572569209620232 | 0 | 267436092 | 2024-11-18 00:00:00 | "0x04e45aaf" | false | 0.0836320 | 1.0142130 | 0 | 228.0 | 1644.0 | false | false | 2263 | 573066172506560 | 572568942184140 | 96200553176.111920000000 | 11.828701000000 | 400738090100.154301500000 | 143.447751187500 | 0.0005730661725065600 | 0.0000004969628863280 | 0.0005725692096202320 | 0.0000000962005531760 | 0.0000004007380901000 | 0.0000000002674360920 | 0.0000000000000000000 | 0.0005725689421841400 | 3.8066217880 | 0.0000017780 | 0.0000000000 | 3.8066200100 | 8.1328079200 | 2.7936170960 |
2024-11-18 | "op" | 10 | "mainnet" | 15578 | 6 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145605 | 1731889987 | "0x2f1c10fa888a422c3dafe1d8a16d… | 477875164 | 2499999 | 1130360 | 20090 | 3713537605952 | 7522450707 | 2295686953 | 1299 | 0 | 477873865 | 540170970379040 | 0 | 1468337640 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21980.0 | false | false | 20090 | 543884507984992 | 540169502041400 | 789935783395.874010000000 | 105.010430000000 | 2923491214556.840563125000 | 1273.471198125000 | 0.0005438845079849920 | 0.0000037135376059520 | 0.0005401709703790400 | 0.0000007899357833960 | 0.0000029234912145570 | 0.0000000014683376400 | 0.0000000000000000000 | 0.0005401695020414000 | 0.4778751640 | 0.0000012990 | 0.0000000000 | 0.4778738650 | 7.5224507070 | 2.2956869530 |
2024-11-18 | "op" | 10 | "mainnet" | 15579 | 1 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145777 | 1731890331 | "0x242ec819d3b42117800b3942fa29… | 455586072 | 2499999 | 1149957 | 20157 | 5417238559765 | 8537410887 | 3535671733 | 1751 | 0 | 455584321 | 523904392598904 | 0 | 2013574707 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21956.0 | false | false | 20157 | 529321631158669 | 523902379024197 | 899507066459.876793000000 | 105.360639000000 | 4517592175735.696078312500 | 1277.718215062500 | 0.0005293216311586690 | 0.0000054172385597650 | 0.0005239043925989040 | 0.0000008995070664600 | 0.0000045175921757360 | 0.0000000020135747070 | 0.0000000000000000000 | 0.0005239023790241970 | 0.4555860720 | 0.0000017510 | 0.0000000000 | 0.4555843210 | 8.5374108870 | 3.5356717330 |
"
],
"text/plain": [
- "shape: (5, 61)\n",
+ "shape: (5, 55)\n",
"┌────────────┬───────┬──────────┬─────────┬───┬─────────────┬────────────┬────────────┬────────────┐\n",
- "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ log_count_w ┆ log_count_ ┆ is_qualifi ┆ is_qualifi │\n",
- "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ rapping_eve ┆ transfer_e ┆ ed_tx_not_ ┆ ed_tx_not_ │\n",
- "│ date ┆ str ┆ i32 ┆ str ┆ ┆ nts ┆ vents ┆ approval_w ┆ approval_w │\n",
- "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ … ┆ … │\n",
- "│ ┆ ┆ ┆ ┆ ┆ decimal[38, ┆ decimal[38 ┆ --- ┆ --- │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0] ┆ ,0] ┆ bool ┆ bool │\n",
+ "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ l2_priority ┆ l2_base_le ┆ l1_base_ga ┆ l1_blob_ba │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ _gas_price_ ┆ gacy_gas_p ┆ s_price_gw ┆ se_gas_pri │\n",
+ "│ date ┆ str ┆ i32 ┆ str ┆ ┆ gwei ┆ rice_gwei ┆ ei ┆ ce_gwei │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ decimal[38, ┆ decimal[38 ┆ decimal[38 ┆ decimal[38 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 10] ┆ ,10] ┆ ,10] ┆ ,10] │\n",
"╞════════════╪═══════╪══════════╪═════════╪═══╪═════════════╪════════════╪════════════╪════════════╡\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 0 ┆ false ┆ false │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0 ┆ 2 ┆ true ┆ true │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 6.00996340 ┆ 7.67013925 ┆ 2.38761065 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 20 ┆ 80 ┆ 80 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 3.55731569 ┆ 8.17175412 ┆ 1.08879634 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 10 ┆ 60 ┆ 40 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 3.80662001 ┆ 8.13280792 ┆ 2.79361709 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 00 ┆ 00 ┆ 60 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 0.47787386 ┆ 7.52245070 ┆ 2.29568695 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 50 ┆ 70 ┆ 30 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 0.45558432 ┆ 8.53741088 ┆ 3.53567173 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 10 ┆ 70 ┆ 30 │\n",
"└────────────┴───────┴──────────┴─────────┴───┴─────────────┴────────────┴────────────┴────────────┘"
]
},
@@ -291,7 +292,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -304,22 +305,22 @@
" white-space: pre-wrap;\n",
"}\n",
"\n",
- "shape: (0, 61)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei | log_count_total_events | log_count_approval_events | log_count_wrapping_events | log_count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool |
"
+ "shape: (0, 55)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] |
"
],
"text/plain": [
- "shape: (0, 61)\n",
+ "shape: (0, 55)\n",
"┌──────┬───────┬──────────┬─────────┬───┬──────────────┬──────────────┬──────────────┬─────────────┐\n",
- "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ log_count_wr ┆ log_count_tr ┆ is_qualified ┆ is_qualifie │\n",
- "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ apping_event ┆ ansfer_event ┆ _tx_not_appr ┆ d_tx_not_ap │\n",
- "│ date ┆ str ┆ i32 ┆ str ┆ ┆ s ┆ s ┆ oval_w… ┆ proval_w… │\n",
- "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
- "│ ┆ ┆ ┆ ┆ ┆ decimal[38,0 ┆ decimal[38,0 ┆ bool ┆ bool │\n",
- "│ ┆ ┆ ┆ ┆ ┆ ] ┆ ] ┆ ┆ │\n",
+ "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ l2_priority_ ┆ l2_base_lega ┆ l1_base_gas_ ┆ l1_blob_bas │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ gas_price_gw ┆ cy_gas_price ┆ price_gwei ┆ e_gas_price │\n",
+ "│ date ┆ str ┆ i32 ┆ str ┆ ┆ ei ┆ _gwei ┆ --- ┆ _gwei │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ decimal[38,1 ┆ --- │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ decimal[38,1 ┆ decimal[38,1 ┆ 0] ┆ decimal[38, │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ 0] ┆ 0] ┆ ┆ 10] │\n",
"╞══════╪═══════╪══════════╪═════════╪═══╪══════════════╪══════════════╪══════════════╪═════════════╡\n",
"└──────┴───────┴──────────┴─────────┴───┴──────────────┴──────────────┴──────────────┴─────────────┘"
]
},
- "execution_count": 13,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -345,45 +346,45 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "┌────────────────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
- "│ column_name │ column_type │ null │ key │ default │ extra │\n",
- "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
- "├────────────────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
- "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ nonce │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ l2_priority_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_legacy_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_blob_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ log_count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ log_count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ log_count_wrapping_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ log_count_transfer_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ is_qualified_tx_not_approval_wrapping_transfer │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n",
- "│ is_qualified_tx_not_approval_wrapping │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n",
- "├────────────────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 61 rows (20 shown) 6 columns │\n",
- "└─────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌───────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├───────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ nonce │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ l1_blob_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_priority_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_legacy_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_priority_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l2_base_legacy_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ l1_blob_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
+ "├───────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 55 rows (20 shown) 6 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
new file mode 100644
index 00000000000..08397cf5ede
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
@@ -0,0 +1,31 @@
+# TO DEPRECATE?
+
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
+ expected_outputs=["event_emitting_transactions_v1"],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="refined_transactions_fees",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="logs_topic0_filters",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="event_emitting_transactions",
+ context={},
+ ),
+ ],
+)
+def event_emitting_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+ return {
+ "event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
+ }
diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
deleted file mode 100644
index d1e5dfa6ec7..00000000000
--- a/src/op_analytics/datapipeline/models/code/event_emitting_transactions_list.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# TO DEPRECATE?
-
-import duckdb
-
-from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
-from op_analytics.datapipeline.models.compute.registry import register_model
-from op_analytics.datapipeline.models.compute.types import NamedRelations
-
-
-@register_model(
- input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1"],
- expected_outputs=["event_emitting_transactions_list_v1"],
- auxiliary_views=[
- TemplatedSQLQuery(
- template_name="event_emitting_transactions_list",
- context={},
- ),
- ],
-)
-def event_emitting_transactions_list(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
- return {
- "event_emitting_transactions_list_v1": duckdb_client.view(
- "event_emitting_transactions_list"
- ),
- }
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
index b58da7dff47..8b492557bec 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
@@ -13,14 +13,6 @@
],
expected_outputs=["refined_transactions_fees_v1"],
auxiliary_views=[
- TemplatedSQLQuery(
- template_name="base_transactions_fees",
- context={},
- ),
- TemplatedSQLQuery(
- template_name="event_emitting_transactions_list",
- context={},
- ),
TemplatedSQLQuery(
template_name="refined_transactions_fees",
context={},
diff --git a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
deleted file mode 100644
index ac48c815875..00000000000
--- a/src/op_analytics/datapipeline/models/templates/base_transactions_fees.sql.j2
+++ /dev/null
@@ -1,139 +0,0 @@
-WITH
-
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- ingestion_blocks_v1
-),
-
--- Select the columns that we want from transactions joined to blocks.
--- Include some minor transformations that are needed for further calculations.
-pt1 AS (
- SELECT
- -- Transaction fields
- t.dt,
- t.chain,
- t.chain_id,
- t.network,
- t.nonce,
- t.transaction_index,
- t.from_address,
- t.to_address,
- t.block_number,
- t.block_timestamp,
- t.hash,
- t.gas_price,
- t.gas AS gas_limit,
- t.receipt_gas_used,
- t.receipt_l1_gas_used,
- -- Fees
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
- t.receipt_l1_gas_price,
- t.receipt_l1_blob_base_fee,
- b.base_fee_per_gas,
- t.max_priority_fee_per_gas,
- if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS base_legacy_fee_per_gas,
- -- L2 Fees and breakdown into BASE and PRIORITY contributions
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
- -- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- hexstr_method_id(t.input) AS method_id,
- t.receipt_status = 1 AS success,
- -- L1 Fee BASE and BLOB scalars
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_fee_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
-
- -- Transaction Attributes
- transaction_type,
- hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_calldata_gas(t.input) AS input_calldata_gas,
- transaction_type = 126 AS is_system_transaction,
- ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
- transaction_type = 126
- AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
- AND to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction
-
- FROM ingestion_transactions_v1 AS t
- INNER JOIN pb AS b
- ON t.block_number = b.number
- WHERE 1=1
- -- Optional address filter for faster results when developing.
- -- AND from_address LIKE '0x00%'
-),
-
-
--- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
-pt2 AS (
- SELECT
- *,
- coalesce(
- receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_fee_scalar * receipt_l1_gas_price)
- + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS l1_gas_used
- FROM pt1
-),
-
--- Add more fee calculations.
--- Reuses results from the previous CTEs.
-
-pt3 AS (
-SELECT
- *,
- --
- -- Total fee
- l2_fee + l1_fee AS tx_fee,
- --
- -- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
- --
- -- L1 Base
- div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
- --
- -- L1 Blob
- div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
-
-FROM pt2
-)
-
-
--- Generate gas fee breakdowns in native terms, for later aggregation
--- Generate gas prices in gwei terms
-SELECT *
-
--- Fees
-, wei_to_eth(tx_fee) AS tx_fee_native
-
- -- Native Breakdown
- , wei_to_eth(l1_fee) AS l1_fee_native
- , wei_to_eth(l2_fee) AS l2_fee_native
-
- -- L1 Breakdown
- , wei_to_eth(l1_base_fee) AS l1_base_fee_native
- , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
-
- -- L2 Breakdown
- , wei_to_eth(l2_base_fee) AS l2_base_fee_native
- , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
- , wei_to_eth(l2_base_legacy_fee) AS l2_base_legacy_fee_native
-
--- Gas Prices
- , wei_to_gwei(gas_price) AS l2_gas_price_gwei
- , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
- , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
- , wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei
-
- , wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei
- , wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
-
-FROM pt3
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
new file mode 100644
index 00000000000..1fab8ce0ba7
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
@@ -0,0 +1,61 @@
+-- Select the columns for joining back to transactions and sum event types
+-- Calculate types of events emitted for downstream "qualified transaction" filtering
+
+WITH event_emitting AS (
+SELECT
+ l.dt
+ ,epoch_to_hour(l.block_timestamp) AS block_hour
+ ,l.block_timestamp
+ ,l.network, l.chain, l.chain_id
+ ,l.block_number
+ ,l.transaction_hash
+
+ ,COUNT(*) AS count_total_events
+ ,SUM(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events
+ ,SUM(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events
+ ,SUM(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
+
+FROM ingestion_logs_v1 AS l
+LEFT JOIN logs_topic0_filters AS f
+ ON l.topic0 = f.topic
+
+GROUP BY 1,2,3,4,5,6,7,8
+)
+
+SELECT
+ ee.*
+
+ ,ee.count_total_events
+ > ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events
+ AS is_qualified_tx_not_approval_wrapping_transfer
+
+ ,ee.count_total_events
+ > ee.count_approval_events + ee.count_wrapping_events
+ AS is_qualified_tx_not_approval_wrapping
+
+ -- Join Transaction Fields
+ ,t.transaction_index
+ ,t.transaction_type
+ -- gas fees
+ ,t.tx_fee_native
+
+ ,t.l1_fee_native
+ ,t.l2_fee_native
+
+ ,t.l1_base_fee_native
+ ,t.l1_blob_fee_native
+
+ ,t.l2_base_fee_native
+ ,t.l2_priority_fee_native
+ ,t.l2_base_legacy_fee_native
+ -- transaction attributes
+ ,t.input_byte_length
+ ,t.input_calldata_gas
+ ,t.l1_gas_used
+ ,t.receipt_gas_used
+
+
+FROM event_emitting ee
+INNER JOIN refined_transactions_fees AS t
+ ON ee.block_number = t.block_number
+ AND ee.transaction_hash = t.hash
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2 b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
similarity index 54%
rename from src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
rename to src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
index 1962b7a71ad..d9882ca2b5d 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions_list.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
@@ -15,32 +15,4 @@ WITH topic0_filters AS ( -- list of events that we want to indicate for possible
) a (topic, description, category)
)
--- Select the columns for joining back to transactions and sum event types
--- Calculate types of events emitted for downstream "qualified transaction" filtering
-
-SELECT
- l.dt
- ,epoch_to_hour(l.block_timestamp) AS block_hour
- ,l.block_timestamp
- ,l.network, l.chain, l.chain_id
- ,l.block_number
- ,l.transaction_hash
- ,t.transaction_index
- ,t.transaction_type
-
- ,COUNT(*) AS count_total_events
- ,SUM(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events
- ,SUM(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events
- ,SUM(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
-
-FROM ingestion_logs_v1 AS l
-INNER JOIN ingestion_transactions_v1 AS t
- ON l.block_number = t.block_number
- AND l.transaction_index = t.transaction_index
- AND l.transaction_hash = t.hash
-LEFT JOIN topic0_filters AS f
- ON l.topic0 = f.topic
-
-GROUP BY 1,2,3,4,5,6,7,8,9,10
-
-
+SELECT * FROM topic0_filters
\ No newline at end of file
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 75f08069b3b..ac48c815875 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -1,32 +1,139 @@
--- Extend additional joins to base_transaction_fees
-WITH base_refined AS (
+WITH
+
+pb AS (
+ SELECT
+ number,
+ base_fee_per_gas
+ FROM
+ ingestion_blocks_v1
+),
+
+-- Select the columns that we want from transactions joined to blocks.
+-- Include some minor transformations that are needed for further calculations.
+pt1 AS (
SELECT
-- Transaction fields
- bt.*,
-
- COALESCE(eet.count_total_events, 0) AS log_count_total_events,
- COALESCE(eet.count_approval_events, 0) AS log_count_approval_events,
- COALESCE(eet.count_wrapping_events, 0) AS log_count_wrapping_events,
- COALESCE(eet.count_transfer_events, 0) AS log_count_transfer_events
-
- FROM base_transactions_fees AS bt
- LEFT JOIN event_emitting_transactions_list AS eet
- ON
- bt.block_number = eet.block_number
- AND bt.transaction_index = eet.transaction_index
- AND bt.hash = eet.transaction_hash
- WHERE 1 = 1
-)
+ t.dt,
+ t.chain,
+ t.chain_id,
+ t.network,
+ t.nonce,
+ t.transaction_index,
+ t.from_address,
+ t.to_address,
+ t.block_number,
+ t.block_timestamp,
+ t.hash,
+ t.gas_price,
+ t.gas AS gas_limit,
+ t.receipt_gas_used,
+ t.receipt_l1_gas_used,
+ -- Fees
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
+ t.receipt_l1_gas_price,
+ t.receipt_l1_blob_base_fee,
+ b.base_fee_per_gas,
+ t.max_priority_fee_per_gas,
+ if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS base_legacy_fee_per_gas,
+ -- L2 Fees and breakdown into BASE and PRIORITY contributions
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
+ -- Convenience columns
+ epoch_to_hour(t.block_timestamp) AS block_hour,
+ hexstr_method_id(t.input) AS method_id,
+ t.receipt_status = 1 AS success,
+ -- L1 Fee BASE and BLOB scalars
+ coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
+ AS l1_base_fee_scalar,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
+
+ -- Transaction Attributes
+ transaction_type,
+ hexstr_bytelen(t.input) AS input_byte_length,
+ hexstr_calldata_gas(t.input) AS input_calldata_gas,
+ transaction_type = 126 AS is_system_transaction,
+ ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ transaction_type = 126
+ AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
+ AND to_address = lower('0x4200000000000000000000000000000000000015')
+ ) AS is_attributes_deposited_transaction
+
+ FROM ingestion_transactions_v1 AS t
+ INNER JOIN pb AS b
+ ON t.block_number = b.number
+ WHERE 1=1
+ -- Optional address filter for faster results when developing.
+ -- AND from_address LIKE '0x00%'
+),
+
+
+-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+pt2 AS (
+ SELECT
+ *,
+ coalesce(
+ receipt_l1_gas_used,
+ round(16 * l1_fee / (
+ (l1_base_fee_scalar * receipt_l1_gas_price)
+ + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ ) AS l1_gas_used
+ FROM pt1
+),
+
+-- Add more fee calculations.
+-- Reuses results from the previous CTEs.
+pt3 AS (
SELECT
*,
-
- log_count_total_events
- > log_count_approval_events + log_count_wrapping_events + log_count_transfer_events
- AS is_qualified_tx_not_approval_wrapping_transfer,
+ --
+ -- Total fee
+ l2_fee + l1_fee AS tx_fee,
+ --
+ -- L2 Legacy Fee
+ if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
+ --
+ -- L1 Base
+ div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
+ --
+ -- L1 Blob
+ div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
+ div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
+
+FROM pt2
+)
+
+
+-- Generate gas fee breakdowns in native terms, for later aggregation
+-- Generate gas prices in gwei terms
+SELECT *
+
+-- Fees
+, wei_to_eth(tx_fee) AS tx_fee_native
+
+ -- Native Breakdown
+ , wei_to_eth(l1_fee) AS l1_fee_native
+ , wei_to_eth(l2_fee) AS l2_fee_native
+
+ -- L1 Breakdown
+ , wei_to_eth(l1_base_fee) AS l1_base_fee_native
+ , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
+
+ -- L2 Breakdown
+ , wei_to_eth(l2_base_fee) AS l2_base_fee_native
+ , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
+ , wei_to_eth(l2_base_legacy_fee) AS l2_base_legacy_fee_native
+
+-- Gas Prices
+ , wei_to_gwei(gas_price) AS l2_gas_price_gwei
+ , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
+ , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
+ , wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei
- log_count_total_events
- > log_count_approval_events + log_count_wrapping_events
- AS is_qualified_tx_not_approval_wrapping
+ , wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei
+ , wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
-FROM base_refined
+FROM pt3
From e705cacc4d5f62a1bb579dd5bc979ff6abffb638 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Fri, 13 Dec 2024 18:26:39 -0500
Subject: [PATCH 22/32] checkpoint, base models DONE
---
...event_emitting_transactions_list_dev.ipynb | 399 -------------
.../adhoc/refined_transactions_fees_dev.ipynb | 418 --------------
...ansactions_traces_address_models_dev.ipynb | 533 ++++++++++++++++++
.../models/code/daily_address_summary.py | 36 +-
.../code/event_emitting_transactions.py | 54 +-
.../models/code/refined_trace_calls.py | 36 +-
.../models/code/refined_transactions_fees.py | 25 -
...ined_transactions_traces_address_models.py | 52 ++
.../datapipeline/models/compute/udfs.py | 2 +-
.../templates/daily_address_summary.sql.j2 | 8 +-
.../event_emitting_transactions.sql.j2 | 111 ++--
.../templates/logs_topic0_filters.sql.j2 | 30 +-
.../templates/refined_trace_calls.sql.j2 | 180 +++---
.../refined_transactions_fees.sql.j2 | 103 ++--
14 files changed, 883 insertions(+), 1104 deletions(-)
delete mode 100644 notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
delete mode 100644 notebooks/adhoc/refined_transactions_fees_dev.ipynb
create mode 100644 notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
delete mode 100644 src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
create mode 100644 src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
diff --git a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb b/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
deleted file mode 100644
index 0847f521332..00000000000
--- a/notebooks/adhoc/event_emitting_transactions_list_dev.ipynb
+++ /dev/null
@@ -1,399 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Prepare data reader for a given chain and date"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n"
- ]
- }
- ],
- "source": [
- "from op_analytics.coreutils.duckdb_inmem import init_client\n",
- "from op_analytics.coreutils.partitioned.reader import DataReader\n",
- "from op_analytics.coreutils.partitioned.location import DataLocation\n",
- "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n",
- "\n",
- "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
- "\n",
- "\n",
- "# Define the input data range.\n",
- "read_batches: list[DataReader] = construct_data_readers(\n",
- " chains=[\"op\"],\n",
- " models=[\"event_emitting_transactions\"],\n",
- " range_spec=\"@20241118:+1\",\n",
- " read_from=DataLocation.GCS\n",
- ")\n",
- "\n",
- "\n",
- "# Select input for one date and build the intermediate model inputs.\n",
- "batch = read_batches[0]\n",
- "\n",
- "\n",
- "duckdb_client = init_client()\n",
- "create_duckdb_macros(duckdb_client)\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Run the model\n",
- "\n",
- "This automatically registers the model outputs as duckdb tables."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-13 13:59:07\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:07\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:08\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:08\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:09\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:09\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
- "\u001b[2m2024-12-13 13:59:10\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m52305\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
- "dict_keys(['event_emitting_transactions_v1'])\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "┌────────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├────────────────────────────────┤\n",
- "│ event_emitting_transactions │\n",
- "│ event_emitting_transactions_v1 │\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_logs_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ logs_topic0_filters │\n",
- "│ refined_transactions_fees │\n",
- "└────────────────────────────────┘"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
- "\n",
- "execute_model_in_memory(\n",
- " duckdb_client=duckdb_client,\n",
- " model=\"event_emitting_transactions\",\n",
- " data_reader=batch,\n",
- " limit_input_parquet_files=1\n",
- ")\n",
- "\n",
- "# The duckdb database will have the following:\n",
- "# - input tables\n",
- "# - views used by the model\n",
- "# - model outputs\n",
- "# \n",
- "# You can use duckdb to inspect any of the above results.\n",
- "duckdb_client.sql(\"SHOW TABLES\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Verify model results"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────┬─────────────────────┬─────────────────┬─────────┬─────────┬──────────┬──────────────┬────────────────────────────────────────────────────────────────────┬────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────────────────────────────┬───────────────────────────────────────┬───────────────────┬──────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬───────────────────────────┬───────────────────┬────────────────────┬─────────────┬──────────────────┐\n",
- "│ dt │ block_hour │ block_timestamp │ network │ chain │ chain_id │ block_number │ transaction_hash │ count_total_events │ count_approval_events │ count_wrapping_events │ count_transfer_events │ is_qualified_tx_not_approval_wrapping_transfer │ is_qualified_tx_not_approval_wrapping │ transaction_index │ transaction_type │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ input_byte_length │ input_calldata_gas │ l1_gas_used │ receipt_gas_used │\n",
- "│ date │ timestamp │ uint32 │ varchar │ varchar │ int32 │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ boolean │ boolean │ int64 │ int32 │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ int64 │ int64 │\n",
- "├────────────┼─────────────────────┼─────────────────┼─────────┼─────────┼──────────┼──────────────┼────────────────────────────────────────────────────────────────────┼────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────────────────────────────┼───────────────────────────────────────┼───────────────────┼──────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────┼─────────────┼──────────────────┤\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890759 │ mainnet │ op │ 10 │ 128145991 │ 0x1235a81f6e53a98fd084110155e10a2a9987364008a22337339329ad40242387 │ 12 │ 3 │ 0 │ 3 │ true │ true │ 20 │ 0 │ 0.0000020874702928900 │ 0.0000014879054668900 │ 0.0000005995648260000 │ 0.0000004307828968610 │ 0.0000010570047134670 │ 0.0000000015123672900 │ 0.0000000000000000000 │ 0.0000005980524587100 │ 2340.0 │ 15192.0 │ 7857 │ 598010 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890761 │ mainnet │ op │ 10 │ 128145992 │ 0xedd5381353abf8e805af44d583c9ed59b1d6a611a194b6bac0a8cf3db26401c3 │ 7 │ 1 │ 0 │ 2 │ true │ true │ 9 │ 2 │ 0.0000030584908877560 │ 0.0000006801850001760 │ 0.0000023783058875800 │ 0.0000002110564649070 │ 0.0000004690025804280 │ 0.0000000005537082100 │ 0.0000023777521793700 │ 0.0000000000000000000 │ 708.0 │ 4668.0 │ 3922 │ 218857 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890761 │ mainnet │ op │ 10 │ 128145992 │ 0xa541416b4022b2de958bdc9e46401d23db0e3ac16cb5a0d8856b7bbcad8356b8 │ 21 │ 1 │ 0 │ 10 │ true │ true │ 14 │ 0 │ 0.0000017034381682460 │ 0.0000006616191454840 │ 0.0000010418190227620 │ 0.0000002052984226460 │ 0.0000004562072525070 │ 0.0000000021909622900 │ 0.0000000000000000000 │ 0.0000010396280604720 │ 254.0 │ 3668.0 │ 3815 │ 865993 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x882dc42f47ecea249d7540fda95a31c71b3665c4b42651f08819c8a51eeaa52f │ 10 │ 0 │ 1 │ 3 │ true │ true │ 12 │ 2 │ 0.0000036917430291910 │ 0.0000003251130291910 │ 0.0000033666300000000 │ 0.0000001008464597740 │ 0.0000002240976123720 │ 0.0000000008564706720 │ 0.0000033666300000000 │ 0.0000000000000000000 │ 260.0 │ 1736.0 │ 1874 │ 336663 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0x68a86601a960770e35d97b6b809cdc405ddf0859a8899fc8ad3ed62746ef7b3b │ 6 │ 0 │ 0 │ 4 │ true │ true │ 15 │ 0 │ 0.0000006501825344740 │ 0.0000003784898614310 │ 0.0000002716926730430 │ 0.0000001174210113270 │ 0.0000002609290235830 │ 0.0000000005745344160 │ 0.0000000000000000000 │ 0.0000002711181386270 │ 119.0 │ 1568.0 │ 2182 │ 225839 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890765 │ mainnet │ op │ 10 │ 128145994 │ 0xb44f4b1cba612ee8aa3fe75587c93a229311f352ff723f9270cb6a810cd9796f │ 3 │ 0 │ 0 │ 2 │ true │ true │ 4 │ 2 │ 0.0000060802707468270 │ 0.0000003436788838830 │ 0.0000057365918629440 │ 0.0000001066583155140 │ 0.0000002370125227960 │ 0.0000000002918629440 │ 0.0000057363000000000 │ 0.0000000000000000000 │ 196.0 │ 1360.0 │ 1982 │ 114726 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0x839c031e819358157b6d9f1b2a45d8f81b340b7f8c03865bd0cc054b909817fc │ 6 │ 0 │ 0 │ 2 │ true │ true │ 4 │ 2 │ 0.0000010497055963680 │ 0.0000005409410899860 │ 0.0000005087645063820 │ 0.0000001678442412150 │ 0.0000003729778297690 │ 0.0000000012905063820 │ 0.0000005074740000000 │ 0.0000000000000000000 │ 1284.0 │ 6276.0 │ 3119 │ 507474 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890769 │ mainnet │ op │ 10 │ 128145996 │ 0xd18e16ed59bac5a1539139b621b2f920468f5ce96e5e4286c45eadb05d032502 │ 16 │ 0 │ 0 │ 16 │ false │ true │ 5 │ 0 │ 0.0000015609741782860 │ 0.0000011512935629860 │ 0.0000004096806153000 │ 0.0000003572676875360 │ 0.0000007939082436150 │ 0.0000000010391969500 │ 0.0000000000000000000 │ 0.0000004086414183500 │ 644.0 │ 6728.0 │ 6639 │ 408650 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890771 │ mainnet │ op │ 10 │ 128145997 │ 0x67b91deb4dacda098419875604d3e6629c803ab4965f8ccf29c4732d04be7ce6 │ 2 │ 0 │ 0 │ 1 │ true │ true │ 19 │ 2 │ 0.0000004114548578430 │ 0.0000002774335728030 │ 0.0000001340212850400 │ 0.0000000861015665100 │ 0.0000001913320062940 │ 0.0000000003412850400 │ 0.0000001336800000000 │ 0.0000000000000000000 │ 36.0 │ 228.0 │ 1600 │ 133680 │\n",
- "│ 2024-11-18 │ 2024-11-18 00:00:00 │ 1731890773 │ mainnet │ op │ 10 │ 128145998 │ 0xe7add7889df390b6b32eecd72e25fa7146a458afa248b38c1ec4882e7c35237e │ 3 │ 0 │ 0 │ 2 │ true │ true │ 1 │ 2 │ 0.0001283789798928150 │ 0.0000002878469029230 │ 0.0001280911329898920 │ 0.0000000888535964360 │ 0.0000001989933064880 │ 0.0000000004393237560 │ 0.0001280911329898920 │ 0.0000000000000000000 │ 36.0 │ 444.0 │ 1600 │ 172014 │\n",
- "├────────────┴─────────────────────┴─────────────────┴─────────┴─────────┴──────────┴──────────────┴────────────────────────────────────────────────────────────────────┴────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────────────────────────────┴───────────────────────────────────────┴───────────────────┴──────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────┴─────────────┴──────────────────┤\n",
- "│ 10 rows 28 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_v1 LIMIT 10\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Check the data output size"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────────┐\n",
- "│ interm_num_txs │\n",
- "│ int64 │\n",
- "├────────────────┤\n",
- "│ 16679 │\n",
- "└────────────────┘"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_txs FROM event_emitting_transactions_v1\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌───────────────────┐\n",
- "│ ingestion_num_txs │\n",
- "│ int64 │\n",
- "├───────────────────┤\n",
- "│ 16679 │\n",
- "└───────────────────┘"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT COUNT(DISTINCT transaction_hash) as ingestion_num_txs FROM ingestion_logs_v1\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────────────────────────────────────────────────────────────┐\n",
- "│ topic0 │\n",
- "│ varchar │\n",
- "├────────────────────────────────────────────────────────────────────┤\n",
- "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
- "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
- "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
- "│ 0x112c256902bf554b6ed882d2936687aaeb4225e8cd5b51303c90ca6cf43a8602 │\n",
- "│ 0xcf2aa50876cdfbb541206f89af0ee78d44a2abf8d328e37fa4917f982149848a │\n",
- "│ 0xb3e2773606abfd36b5bd91394b3a54d1398336c65005baf7bf7a05efeffaf75b │\n",
- "│ 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef │\n",
- "│ 0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1 │\n",
- "│ 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822 │\n",
- "│ 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67 │\n",
- "├────────────────────────────────────────────────────────────────────┤\n",
- "│ 10 rows │\n",
- "└────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT topic0 FROM ingestion_logs_v1 LIMIT 10\")\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### You can also convert the results to dataframes to inspect them in more familiar ways"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
shape: (5, 28)dt | block_hour | block_timestamp | network | chain | chain_id | block_number | transaction_hash | count_total_events | count_approval_events | count_wrapping_events | count_transfer_events | is_qualified_tx_not_approval_wrapping_transfer | is_qualified_tx_not_approval_wrapping | transaction_index | transaction_type | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | input_byte_length | input_calldata_gas | l1_gas_used | receipt_gas_used |
---|
date | datetime[μs] | u32 | str | str | i32 | i64 | str | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | bool | bool | i64 | i32 | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | f64 | f64 | i64 | i64 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890759 | "mainnet" | "op" | 10 | 128145991 | "0x1235a81f6e53a98fd084110155e1… | 12 | 3 | 0 | 3 | true | true | 20 | 0 | 0.0000020874702928900 | 0.0000014879054668900 | 0.0000005995648260000 | 0.0000004307828968610 | 0.0000010570047134670 | 0.0000000015123672900 | 0.0000000000000000000 | 0.0000005980524587100 | 2340.0 | 15192.0 | 7857 | 598010 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890761 | "mainnet" | "op" | 10 | 128145992 | "0xedd5381353abf8e805af44d583c9… | 7 | 1 | 0 | 2 | true | true | 9 | 2 | 0.0000030584908877560 | 0.0000006801850001760 | 0.0000023783058875800 | 0.0000002110564649070 | 0.0000004690025804280 | 0.0000000005537082100 | 0.0000023777521793700 | 0.0000000000000000000 | 708.0 | 4668.0 | 3922 | 218857 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890761 | "mainnet" | "op" | 10 | 128145992 | "0xa541416b4022b2de958bdc9e4640… | 21 | 1 | 0 | 10 | true | true | 14 | 0 | 0.0000017034381682460 | 0.0000006616191454840 | 0.0000010418190227620 | 0.0000002052984226460 | 0.0000004562072525070 | 0.0000000021909622900 | 0.0000000000000000000 | 0.0000010396280604720 | 254.0 | 3668.0 | 3815 | 865993 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890765 | "mainnet" | "op" | 10 | 128145994 | "0x882dc42f47ecea249d7540fda95a… | 10 | 0 | 1 | 3 | true | true | 12 | 2 | 0.0000036917430291910 | 0.0000003251130291910 | 0.0000033666300000000 | 0.0000001008464597740 | 0.0000002240976123720 | 0.0000000008564706720 | 0.0000033666300000000 | 0.0000000000000000000 | 260.0 | 1736.0 | 1874 | 336663 |
2024-11-18 | 2024-11-18 00:00:00 | 1731890765 | "mainnet" | "op" | 10 | 128145994 | "0x68a86601a960770e35d97b6b809c… | 6 | 0 | 0 | 4 | true | true | 15 | 0 | 0.0000006501825344740 | 0.0000003784898614310 | 0.0000002716926730430 | 0.0000001174210113270 | 0.0000002609290235830 | 0.0000000005745344160 | 0.0000000000000000000 | 0.0000002711181386270 | 119.0 | 1568.0 | 2182 | 225839 |
"
- ],
- "text/plain": [
- "shape: (5, 28)\n",
- "┌────────────┬───────────┬───────────┬─────────┬───┬───────────┬───────────┬───────────┬───────────┐\n",
- "│ dt ┆ block_hou ┆ block_tim ┆ network ┆ … ┆ input_byt ┆ input_cal ┆ l1_gas_us ┆ receipt_g │\n",
- "│ --- ┆ r ┆ estamp ┆ --- ┆ ┆ e_length ┆ ldata_gas ┆ ed ┆ as_used │\n",
- "│ date ┆ --- ┆ --- ┆ str ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
- "│ ┆ datetime[ ┆ u32 ┆ ┆ ┆ f64 ┆ f64 ┆ i64 ┆ i64 │\n",
- "│ ┆ μs] ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "╞════════════╪═══════════╪═══════════╪═════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189075 ┆ mainnet ┆ … ┆ 2340.0 ┆ 15192.0 ┆ 7857 ┆ 598010 │\n",
- "│ ┆ 8 ┆ 9 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 708.0 ┆ 4668.0 ┆ 3922 ┆ 218857 │\n",
- "│ ┆ 8 ┆ 1 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 254.0 ┆ 3668.0 ┆ 3815 ┆ 865993 │\n",
- "│ ┆ 8 ┆ 1 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 260.0 ┆ 1736.0 ┆ 1874 ┆ 336663 │\n",
- "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ 2024-11-18 ┆ 2024-11-1 ┆ 173189076 ┆ mainnet ┆ … ┆ 119.0 ┆ 1568.0 ┆ 2182 ┆ 225839 │\n",
- "│ ┆ 8 ┆ 5 ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "│ ┆ 00:00:00 ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
- "└────────────┴───────────┴───────────┴─────────┴───┴───────────┴───────────┴───────────┴───────────┘"
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT * FROM event_emitting_transactions_v1 LIMIT 5\").pl()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Get table schema"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌───────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
- "│ column_name │ column_type │ null │ key │ default │ extra │\n",
- "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
- "├───────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
- "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_hour │ TIMESTAMP │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_total_events │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_approval_events │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ l2_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_blob_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_priority_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_legacy_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ input_byte_length │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ input_calldata_gas │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ receipt_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "├───────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 28 rows (20 shown) 6 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"DESCRIBE event_emitting_transactions_v1\")\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": ".venv",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.12.4"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/notebooks/adhoc/refined_transactions_fees_dev.ipynb b/notebooks/adhoc/refined_transactions_fees_dev.ipynb
deleted file mode 100644
index 8cc8250cc80..00000000000
--- a/notebooks/adhoc/refined_transactions_fees_dev.ipynb
+++ /dev/null
@@ -1,418 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Prepare data reader for a given chain and date"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:00\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n"
- ]
- }
- ],
- "source": [
- "from op_analytics.coreutils.duckdb_inmem import init_client\n",
- "from op_analytics.coreutils.partitioned.reader import DataReader\n",
- "from op_analytics.coreutils.partitioned.location import DataLocation\n",
- "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n",
- "\n",
- "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
- "\n",
- "\n",
- "# Define the input data range.\n",
- "read_batches: list[DataReader] = construct_data_readers(\n",
- " chains=[\"op\"],\n",
- " models=[\"refined_transactions_fees\"],\n",
- " range_spec=\"@20241118:+1\",\n",
- " read_from=DataLocation.GCS\n",
- ")\n",
- "\n",
- "\n",
- "# Select input for one date and build the intermediate model inputs.\n",
- "batch = read_batches[0]\n",
- "\n",
- "\n",
- "duckdb_client = init_client()\n",
- "create_duckdb_macros(duckdb_client)\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Run the model\n",
- "\n",
- "This automatically registers the model outputs as duckdb tables."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-13 13:51:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m\n",
- "\u001b[2m2024-12-13 13:51:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m51769\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
- "dict_keys(['refined_transactions_fees_v1'])\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "┌──────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├──────────────────────────────┤\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_logs_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ refined_transactions_fees │\n",
- "│ refined_transactions_fees_v1 │\n",
- "└──────────────────────────────┘"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
- "\n",
- "execute_model_in_memory(\n",
- " duckdb_client=duckdb_client,\n",
- " model=\"refined_transactions_fees\",\n",
- " data_reader=batch,\n",
- " limit_input_parquet_files=1\n",
- ")\n",
- "\n",
- "# The duckdb database will have the following:\n",
- "# - input tables\n",
- "# - views used by the model\n",
- "# - model outputs\n",
- "# \n",
- "# You can use duckdb to inspect any of the above results.\n",
- "duckdb_client.sql(\"SHOW TABLES\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Verify model results"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────┬─────────┬──────────┬─────────┬──────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────┬───────────┬──────────────────┬─────────────────────┬───────────────┬──────────────────────┬──────────────────────────┬──────────────────┬──────────────────────────┬─────────────────────────┬──────────────┬─────────────────┬─────────────┬─────────────────────┬────────────┬─────────┬────────────────────┬─────────────────────────┬──────────────────┬───────────────────┬────────────────────┬───────────────────────┬─────────────────────────────────────┬─────────────┬───────────────┬────────────────────┬───────────────────────────┬─────────────────────┬───────────────────────────┬─────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬───────────────────────────┬───────────────────┬────────────────────────┬────────────────────────────┬───────────────────────────────┬────────────────────────┬─────────────────────────────┐\n",
- "│ dt │ chain │ chain_id │ network │ nonce │ transaction_index │ from_address │ to_address │ block_number │ block_timestamp │ hash │ gas_price │ gas_limit │ receipt_gas_used │ receipt_l1_gas_used │ l1_fee │ receipt_l1_gas_price │ receipt_l1_blob_base_fee │ base_fee_per_gas │ max_priority_fee_per_gas │ base_legacy_fee_per_gas │ l2_fee │ l2_priority_fee │ l2_base_fee │ block_hour │ method_id │ success │ l1_base_fee_scalar │ l1_blob_base_fee_scalar │ transaction_type │ input_byte_length │ input_calldata_gas │ is_system_transaction │ is_attributes_deposited_transaction │ l1_gas_used │ tx_fee │ l2_base_legacy_fee │ l1_base_fee │ l1_base_scaled_size │ l1_blob_fee │ l1_blob_scaled_size │ tx_fee_native │ l1_fee_native │ l2_fee_native │ l1_base_fee_native │ l1_blob_fee_native │ l2_base_fee_native │ l2_priority_fee_native │ l2_base_legacy_fee_native │ l2_gas_price_gwei │ l2_base_gas_price_gwei │ l2_priority_gas_price_gwei │ l2_base_legacy_gas_price_gwei │ l1_base_gas_price_gwei │ l1_blob_base_gas_price_gwei │\n",
- "│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ uint32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ timestamp │ varchar │ boolean │ decimal(36,7) │ decimal(26,7) │ int32 │ double │ double │ boolean │ boolean │ int64 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,12) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │\n",
- "├────────────┼─────────┼──────────┼─────────┼──────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────┼───────────┼──────────────────┼─────────────────────┼───────────────┼──────────────────────┼──────────────────────────┼──────────────────┼──────────────────────────┼─────────────────────────┼──────────────┼─────────────────┼─────────────┼─────────────────────┼────────────┼─────────┼────────────────────┼─────────────────────────┼──────────────────┼───────────────────┼────────────────────┼───────────────────────┼─────────────────────────────────────┼─────────────┼───────────────┼────────────────────┼───────────────────────────┼─────────────────────┼───────────────────────────┼─────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────────────────────────┼───────────────────────────────┼────────────────────────┼─────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 22910584 │ 0 │ 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001 │ 0x4200000000000000000000000000000000000015 │ 128145646 │ 1731890069 │ 0xd84f3bf3f18a1cf627450597ec683e81319c8eb0f9e00c1eaa8288869bc0cf0c │ 0 │ 1000000 │ 43887 │ NULL │ 0 │ NULL │ NULL │ 1394 │ 0 │ -1394 │ 0 │ 0 │ 0 │ 2024-11-18 00:00:00 │ 0x440a5e20 │ true │ NULL │ 0.0000000 │ 126 │ 164.0 │ 1604.0 │ true │ true │ NULL │ 0 │ 0 │ NULL │ NULL │ NULL │ NULL │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000000000000000 │ NULL │ NULL │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000000 │ 0.0000013940 │ 0.0000000000 │ -0.0000013940 │ NULL │ NULL │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1236 │ 1 │ 0xcecfc5e576c71e913e900df7e96fc11be2222222 │ 0x0000000000007c4cb8129fc2ae24463c32e5d0da │ 128145646 │ 1731890069 │ 0x740c2dbfffed2f807d7502840596cd4bee063cdc6899e19f6a57b50d63945b00 │ 1509609 │ 363036 │ 303721 │ 1968 │ 464705291307 │ 8514105039 │ 3021819819 │ 1394 │ 0 │ 1508215 │ 458499955089 │ 0 │ 423387074 │ 2024-11-18 00:00:00 │ 0x03806a3a │ true │ 0.0836320 │ 1.0142130 │ 0 │ 90.0 │ 1392.0 │ false │ false │ 1968 │ 923205246396 │ 458076568015 │ 87582350812.462704000000 │ 10.286736000000 │ 376966580122.755981000000 │ 124.748199000000 │ 0.0000009232052463960 │ 0.0000004647052913070 │ 0.0000004584999550890 │ 0.0000000875823508120 │ 0.0000003769665801230 │ 0.0000000004233870740 │ 0.0000000000000000000 │ 0.0000004580765680150 │ 0.0015096090 │ 0.0000013940 │ 0.0000000000 │ 0.0015082150 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 558 │ 10 │ 0x72099133f9310c47b3543d6a9c3fef25dd7c71e3 │ 0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8 │ 128145646 │ 1731890069 │ 0x069e5d9f4850092b767b41fb883557c50db14a3f7ab5046e873a39afaf5d1575 │ 452771 │ 67533 │ 51556 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 451377 │ 0 │ 23343061676 │ 23271192612 │ 71869064 │ 2024-11-18 00:00:00 │ 0x095ea7b3 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 68.0 │ 944.0 │ false │ false │ 1600 │ 401025119346 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004010251193460 │ 0.0000003776820576700 │ 0.0000000233430616760 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000000718690640 │ 0.0000000232711926120 │ 0.0000000000000000000 │ 0.0004527710 │ 0.0000013940 │ 0.0004513770 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 461242 │ 11 │ 0x669bee230facc9240e2ef81c2e566c3ebadd7c71 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 128145646 │ 1731890069 │ 0xc73122d98c55a550441d600fb07f46962788a97a3b9cfd9194e3367cf8f870ae │ 448961 │ 15000000 │ 513743 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 447567 │ 0 │ 230650571023 │ 229934413281 │ 716157742 │ 2024-11-18 00:00:00 │ 0x24f88863 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 4.0 │ 64.0 │ false │ false │ 1600 │ 608332628693 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000006083326286930 │ 0.0000003776820576700 │ 0.0000002306505710230 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000007161577420 │ 0.0000002299344132810 │ 0.0000000000000000000 │ 0.0004489610 │ 0.0000013940 │ 0.0004475670 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1370265 │ 12 │ 0xc97240c92596276b8b9366064123fd76a1207164 │ 0x24f6f36a551fe6008fa80afcff1d6ace182ead2b │ 128145646 │ 1731890069 │ 0x11a1d608f9ab9016ebfaa80a658fbe22f622cad6595df8ef59ae5ecf6098e034 │ 386695 │ 800000 │ 305090 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 385301 │ 0 │ 117976777550 │ 117551482090 │ 425295460 │ 2024-11-18 00:00:00 │ 0x540817d7 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 100.0 │ 688.0 │ false │ false │ 1600 │ 495658835220 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004956588352200 │ 0.0000003776820576700 │ 0.0000001179767775500 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000004252954600 │ 0.0000001175514820900 │ 0.0000000000000000000 │ 0.0003866950 │ 0.0000013940 │ 0.0003853010 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 1948828 │ 13 │ 0xc96909cd052f6000ffaf3e9ff17f9c2047cfd1b8 │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 128145646 │ 1731890069 │ 0x7beb4c5e4a7a2f9dd1fc18c469051a419534652065ea50afdf86ea13cccb6839 │ 341508 │ 5000000 │ 342331 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 340114 │ 0 │ 116908775148 │ 116431565734 │ 477209414 │ 2024-11-18 00:00:00 │ 0x0001 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 2.0 │ 20.0 │ false │ false │ 1600 │ 494590832818 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004945908328180 │ 0.0000003776820576700 │ 0.0000001169087751480 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000004772094140 │ 0.0000001164315657340 │ 0.0000000000000000000 │ 0.0003415080 │ 0.0000013940 │ 0.0003401140 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 2021489 │ 14 │ 0xc96faba4ff9941a55754d7a4b02aeaf7d53f43b9 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 128145646 │ 1731890069 │ 0x27d1249da3b373260ce0b6ec9ce1fc9ce8e51ae6e22211dbcbcfe314d35d4a23 │ 101394 │ 15000000 │ 513743 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 52090457742 │ 51374300000 │ 716157742 │ 2024-11-18 00:00:00 │ 0x24f88863 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 4.0 │ 64.0 │ false │ false │ 1600 │ 429772515412 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004297725154120 │ 0.0000003776820576700 │ 0.0000000520904577420 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000007161577420 │ 0.0000000513743000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 858 │ 15 │ 0x21bdb91661a4472ff0d3871c300d4120a886ad9b │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0xf8c3fa8ece22e50b86ef016e991863191b62f20f376b16dbcca436fc80f8e28c │ 101394 │ 197308 │ 189126 │ 4953 │ 1169231513276 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19176241644 │ 18912600000 │ 263641644 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6388.0 │ false │ false │ 4953 │ 1188407754920 │ 0 │ 220424483523.438909000000 │ 25.889331000000 │ 948737536254.070311937500 │ 313.962311812500 │ 0.0000011884077549200 │ 0.0000011692315132760 │ 0.0000000191762416440 │ 0.0000002204244835230 │ 0.0000009487375362540 │ 0.0000000002636416440 │ 0.0000000189126000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 873 │ 16 │ 0xac50debe83f7dbf2144239bcb946a2506b2782da │ 0x1195cf65f83b3a5768f3c496d3a05ad6412c64b7 │ 128145646 │ 1731890069 │ 0x8b70ce403d88feb808e4f44d60b95b49fc9299aaf324890ebf9593a5dbc29fd5 │ 101394 │ 197296 │ 189114 │ 4966 │ 1172390823688 │ 8514105039 │ 3021819819 │ 1394 │ 100000 │ 0 │ 19175024916 │ 18911400000 │ 263624916 │ 2024-11-18 00:00:00 │ 0xd123b4d8 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 964.0 │ 6400.0 │ false │ false │ 4966 │ 1191565848604 │ 0 │ 221003025474.943998000000 │ 25.957282000000 │ 951227661021.141362625000 │ 314.786359875000 │ 0.0000011915658486040 │ 0.0000011723908236880 │ 0.0000000191750249160 │ 0.0000002210030254750 │ 0.0000009512276610210 │ 0.0000000002636249160 │ 0.0000000189114000000 │ 0.0000000000000000000 │ 0.0001013940 │ 0.0000013940 │ 0.0001000000 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 270110 │ 17 │ 0xabe58b50367fb4cea7d19c41c228abed381ed2ef │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 128145646 │ 1731890069 │ 0x50aed494babf3fcafe2f1c271c7e5ff361a7f45a9134ab8d2ff660244b6b0bf0 │ 101393 │ 5000000 │ 342331 │ 1600 │ 377682057670 │ 8514105039 │ 3021819819 │ 1394 │ 99999 │ 0 │ 34709967083 │ 34232757669 │ 477209414 │ 2024-11-18 00:00:00 │ 0x0001 │ true │ 0.0836320 │ 1.0142130 │ 2 │ 2.0 │ 20.0 │ false │ false │ 1600 │ 412392024753 │ 0 │ 71205163262.164800000000 │ 8.363200000000 │ 306476894408.744700000000 │ 101.421300000000 │ 0.0000004123920247530 │ 0.0000003776820576700 │ 0.0000000347099670830 │ 0.0000000712051632620 │ 0.0000003064768944090 │ 0.0000000004772094140 │ 0.0000000342327576690 │ 0.0000000000000000000 │ 0.0001013930 │ 0.0000013940 │ 0.0000999990 │ 0.0000000000 │ 8.5141050390 │ 3.0218198190 │\n",
- "├────────────┴─────────┴──────────┴─────────┴──────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────┴───────────┴──────────────────┴─────────────────────┴───────────────┴──────────────────────┴──────────────────────────┴──────────────────┴──────────────────────────┴─────────────────────────┴──────────────┴─────────────────┴─────────────┴─────────────────────┴────────────┴─────────┴────────────────────┴─────────────────────────┴──────────────────┴───────────────────┴────────────────────┴───────────────────────┴─────────────────────────────────────┴─────────────┴───────────────┴────────────────────┴───────────────────────────┴─────────────────────┴───────────────────────────┴─────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────────────────────────┴───────────────────────────────┴────────────────────────┴─────────────────────────────┤\n",
- "│ 10 rows 55 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 LIMIT 10\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Check the data output size"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌──────────────┐\n",
- "│ count_star() │\n",
- "│ int64 │\n",
- "├──────────────┤\n",
- "│ 33168 │\n",
- "└──────────────┘"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT COUNT(*) FROM refined_transactions_fees_v1\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌──────────────┐\n",
- "│ count_star() │\n",
- "│ int64 │\n",
- "├──────────────┤\n",
- "│ 33168 │\n",
- "└──────────────┘"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT COUNT(*) FROM ingestion_transactions_v1\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [],
- "source": [
- "# duckdb_client.sql(\"SELECT input FROM ingestion_transactions_v1 LIMIT 10\")\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### You can also convert the results to dataframes to inspect them in more familiar ways"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
shape: (5, 55)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] |
2024-11-18 | "op" | 10 | "mainnet" | 254942 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128145323 | 1731889423 | "0xa154c2a27f36f900ba0cc89f30e4… | 6009964258 | 1000000 | 167161 | 1600 | 306301485470 | 7670139258 | 2387610658 | 856 | 0 | 6009963402 | 1004631635331538 | 0 | 143089816 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 1004937936817008 | 1004631492241722 | 64146908642.505600000000 | 8.363200000000 | 242154576828.215400000000 | 101.421300000000 | 0.0010049379368170080 | 0.0000003063014854700 | 0.0010046316353315380 | 0.0000000641469086430 | 0.0000002421545768280 | 0.0000000001430898160 | 0.0000000000000000000 | 0.0010046314922417220 | 6.0099642580 | 0.0000008560 | 0.0000000000 | 6.0099634020 | 7.6701392580 | 2.3876106580 |
2024-11-18 | "op" | 10 | "mainnet" | 254890 | 1 | "0x3088f0191e49f120d567fbd21ae6… | "0xeb4378aacdfb7d02a0c9accfac2e… | 128144808 | 1731888393 | "0x3bf1efa2db347fb47dd054401ef4… | 3557316353 | 1000000 | 167130 | 1600 | 178769154750 | 8171754126 | 1088796344 | 662 | 0 | 3557315691 | 594534282076890 | 0 | 110640060 | 2024-11-18 00:00:00 | "0x01000000" | true | 0.0836320 | 1.0142130 | 0 | 39.0 | 492.0 | false | false | 1600 | 594713051231640 | 594534171436830 | 68342014106.563200000000 | 8.363200000000 | 110427140643.727200000000 | 101.421300000000 | 0.0005947130512316400 | 0.0000001787691547500 | 0.0005945342820768900 | 0.0000000683420141070 | 0.0000001104271406440 | 0.0000000001106400600 | 0.0000000000000000000 | 0.0005945341714368300 | 3.5573163530 | 0.0000006620 | 0.0000000000 | 3.5573156910 | 8.1717541260 | 1.0887963440 |
2024-11-18 | "op" | 10 | "mainnet" | 278585 | 3 | "0xe3e73f1aa65eeb809ff1f41f3c09… | "0x68b3465833fb72a70ecdf485e0e4… | 128145787 | 1731890351 | "0x3c34052b55b8ea87fad65536694c… | 3806621788 | 1000000 | 150414 | 2263 | 496962886328 | 8132807920 | 2793617096 | 1778 | 0 | 3806620010 | 572569209620232 | 0 | 267436092 | 2024-11-18 00:00:00 | "0x04e45aaf" | false | 0.0836320 | 1.0142130 | 0 | 228.0 | 1644.0 | false | false | 2263 | 573066172506560 | 572568942184140 | 96200553176.111920000000 | 11.828701000000 | 400738090100.154301500000 | 143.447751187500 | 0.0005730661725065600 | 0.0000004969628863280 | 0.0005725692096202320 | 0.0000000962005531760 | 0.0000004007380901000 | 0.0000000002674360920 | 0.0000000000000000000 | 0.0005725689421841400 | 3.8066217880 | 0.0000017780 | 0.0000000000 | 3.8066200100 | 8.1328079200 | 2.7936170960 |
2024-11-18 | "op" | 10 | "mainnet" | 15578 | 6 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145605 | 1731889987 | "0x2f1c10fa888a422c3dafe1d8a16d… | 477875164 | 2499999 | 1130360 | 20090 | 3713537605952 | 7522450707 | 2295686953 | 1299 | 0 | 477873865 | 540170970379040 | 0 | 1468337640 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21980.0 | false | false | 20090 | 543884507984992 | 540169502041400 | 789935783395.874010000000 | 105.010430000000 | 2923491214556.840563125000 | 1273.471198125000 | 0.0005438845079849920 | 0.0000037135376059520 | 0.0005401709703790400 | 0.0000007899357833960 | 0.0000029234912145570 | 0.0000000014683376400 | 0.0000000000000000000 | 0.0005401695020414000 | 0.4778751640 | 0.0000012990 | 0.0000000000 | 0.4778738650 | 7.5224507070 | 2.2956869530 |
2024-11-18 | "op" | 10 | "mainnet" | 15579 | 1 | "0x9c71e8299b145a4190c65ac0d555… | "0x8fc1756b0bc045c06b7bb207b629… | 128145777 | 1731890331 | "0x242ec819d3b42117800b3942fa29… | 455586072 | 2499999 | 1149957 | 20157 | 5417238559765 | 8537410887 | 3535671733 | 1751 | 0 | 455584321 | 523904392598904 | 0 | 2013574707 | 2024-11-18 00:00:00 | "0xd9d73414" | true | 0.0836320 | 1.0142130 | 0 | 1604.0 | 21956.0 | false | false | 20157 | 529321631158669 | 523902379024197 | 899507066459.876793000000 | 105.360639000000 | 4517592175735.696078312500 | 1277.718215062500 | 0.0005293216311586690 | 0.0000054172385597650 | 0.0005239043925989040 | 0.0000008995070664600 | 0.0000045175921757360 | 0.0000000020135747070 | 0.0000000000000000000 | 0.0005239023790241970 | 0.4555860720 | 0.0000017510 | 0.0000000000 | 0.4555843210 | 8.5374108870 | 3.5356717330 |
"
- ],
- "text/plain": [
- "shape: (5, 55)\n",
- "┌────────────┬───────┬──────────┬─────────┬───┬─────────────┬────────────┬────────────┬────────────┐\n",
- "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ l2_priority ┆ l2_base_le ┆ l1_base_ga ┆ l1_blob_ba │\n",
- "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ _gas_price_ ┆ gacy_gas_p ┆ s_price_gw ┆ se_gas_pri │\n",
- "│ date ┆ str ┆ i32 ┆ str ┆ ┆ gwei ┆ rice_gwei ┆ ei ┆ ce_gwei │\n",
- "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
- "│ ┆ ┆ ┆ ┆ ┆ decimal[38, ┆ decimal[38 ┆ decimal[38 ┆ decimal[38 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 10] ┆ ,10] ┆ ,10] ┆ ,10] │\n",
- "╞════════════╪═══════╪══════════╪═════════╪═══╪═════════════╪════════════╪════════════╪════════════╡\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 6.00996340 ┆ 7.67013925 ┆ 2.38761065 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 20 ┆ 80 ┆ 80 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 3.55731569 ┆ 8.17175412 ┆ 1.08879634 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 10 ┆ 60 ┆ 40 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 3.80662001 ┆ 8.13280792 ┆ 2.79361709 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 00 ┆ 00 ┆ 60 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 0.47787386 ┆ 7.52245070 ┆ 2.29568695 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 50 ┆ 70 ┆ 30 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 0.000000000 ┆ 0.45558432 ┆ 8.53741088 ┆ 3.53567173 │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ 10 ┆ 70 ┆ 30 │\n",
- "└────────────┴───────┴──────────┴─────────┴───┴─────────────┴────────────┴────────────┴────────────┘"
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"SELECT * FROM refined_transactions_fees_v1 WHERE transaction_type = 0 ORDER BY tx_fee_native DESC LIMIT 10\").pl().head()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Check Type 0 Legacy Fee Logic"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
shape: (0, 55)dt | chain | chain_id | network | nonce | transaction_index | from_address | to_address | block_number | block_timestamp | hash | gas_price | gas_limit | receipt_gas_used | receipt_l1_gas_used | l1_fee | receipt_l1_gas_price | receipt_l1_blob_base_fee | base_fee_per_gas | max_priority_fee_per_gas | base_legacy_fee_per_gas | l2_fee | l2_priority_fee | l2_base_fee | block_hour | method_id | success | l1_base_fee_scalar | l1_blob_base_fee_scalar | transaction_type | input_byte_length | input_calldata_gas | is_system_transaction | is_attributes_deposited_transaction | l1_gas_used | tx_fee | l2_base_legacy_fee | l1_base_fee | l1_base_scaled_size | l1_blob_fee | l1_blob_scaled_size | tx_fee_native | l1_fee_native | l2_fee_native | l1_base_fee_native | l1_blob_fee_native | l2_base_fee_native | l2_priority_fee_native | l2_base_legacy_fee_native | l2_gas_price_gwei | l2_base_gas_price_gwei | l2_priority_gas_price_gwei | l2_base_legacy_gas_price_gwei | l1_base_gas_price_gwei | l1_blob_base_gas_price_gwei |
---|
date | str | i32 | str | i64 | i64 | str | str | i64 | u32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | datetime[μs] | str | bool | decimal[36,7] | decimal[26,7] | i32 | f64 | f64 | bool | bool | i64 | i64 | i64 | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,12] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] |
"
- ],
- "text/plain": [
- "shape: (0, 55)\n",
- "┌──────┬───────┬──────────┬─────────┬───┬──────────────┬──────────────┬──────────────┬─────────────┐\n",
- "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ l2_priority_ ┆ l2_base_lega ┆ l1_base_gas_ ┆ l1_blob_bas │\n",
- "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ gas_price_gw ┆ cy_gas_price ┆ price_gwei ┆ e_gas_price │\n",
- "│ date ┆ str ┆ i32 ┆ str ┆ ┆ ei ┆ _gwei ┆ --- ┆ _gwei │\n",
- "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ decimal[38,1 ┆ --- │\n",
- "│ ┆ ┆ ┆ ┆ ┆ decimal[38,1 ┆ decimal[38,1 ┆ 0] ┆ decimal[38, │\n",
- "│ ┆ ┆ ┆ ┆ ┆ 0] ┆ 0] ┆ ┆ 10] │\n",
- "╞══════╪═══════╪══════════╪═════════╪═══╪══════════════╪══════════════╪══════════════╪═════════════╡\n",
- "└──────┴───────┴──────────┴─────────┴───┴──────────────┴──────────────┴──────────────┴─────────────┘"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"\"\"SELECT * FROM refined_transactions_fees_v1\n",
- " WHERE transaction_type = 0\n",
- " AND ( --check fee\n",
- " l1_fee + l2_base_fee + l2_priority_fee + l2_base_legacy_fee != tx_fee\n",
- " OR --check prices\n",
- " l2_base_gas_price_gwei + l2_priority_gas_price_gwei + l2_base_legacy_gas_price_gwei != l2_gas_price_gwei\n",
- " )\n",
- " LIMIT 10\n",
- " \"\"\").pl().head()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Get table schema"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 9,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌───────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
- "│ column_name │ column_type │ null │ key │ default │ extra │\n",
- "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
- "├───────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
- "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ nonce │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ l1_blob_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_priority_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_legacy_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_priority_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l2_base_legacy_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "│ l1_blob_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n",
- "├───────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 55 rows (20 shown) 6 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "duckdb_client.sql(\"DESCRIBE refined_transactions_fees_v1\")\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": ".venv",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.12.4"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb b/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
new file mode 100644
index 00000000000..e28dfa3bcd1
--- /dev/null
+++ b/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
@@ -0,0 +1,533 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Prepare data reader for a given chain and date"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 18:21:53\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:53\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n"
+ ]
+ }
+ ],
+ "source": [
+ "from op_analytics.coreutils.duckdb_inmem import init_client\n",
+ "from op_analytics.coreutils.partitioned.reader import DataReader\n",
+ "from op_analytics.coreutils.partitioned.location import DataLocation\n",
+ "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n",
+ "\n",
+ "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
+ "\n",
+ "\n",
+ "# Define the input data range.\n",
+ "read_batches: list[DataReader] = construct_data_readers(\n",
+ " chains=[\"op\"],\n",
+ " models=[\"refined_transactions_traces_address_models\"],\n",
+ " range_spec=\"@20241118:+1\",\n",
+ " read_from=DataLocation.GCS\n",
+ ")\n",
+ "\n",
+ "\n",
+ "# Select input for one date and build the intermediate model inputs.\n",
+ "batch = read_batches[0]\n",
+ "\n",
+ "\n",
+ "duckdb_client = init_client()\n",
+ "create_duckdb_macros(duckdb_client)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Run the model\n",
+ "\n",
+ "This automatically registers the model outputs as duckdb tables."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:55\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:55\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:57\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:57\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
+ "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
+ "dict_keys(['refined_transactions_fees_v1', 'refined_trace_calls_v1', 'event_emitting_transactions_v1', 'summary_v1'])\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├────────────────────────────────┤\n",
+ "│ daily_address_summary │\n",
+ "│ event_emitting_transactions │\n",
+ "│ event_emitting_transactions_v1 │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_traces_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ logs_topic0_filters │\n",
+ "│ refined_trace_calls │\n",
+ "│ refined_trace_calls_v1 │\n",
+ "│ refined_transactions_fees │\n",
+ "│ refined_transactions_fees_v1 │\n",
+ "│ summary_v1 │\n",
+ "├────────────────────────────────┤\n",
+ "│ 13 rows │\n",
+ "└────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
+ "\n",
+ "execute_model_in_memory(\n",
+ " duckdb_client=duckdb_client,\n",
+ " model=\"refined_transactions_traces_address_models\",\n",
+ " data_reader=batch,\n",
+ " limit_input_parquet_files=1\n",
+ ")\n",
+ "\n",
+ "# The duckdb database will have the following:\n",
+ "# - input tables\n",
+ "# - views used by the model\n",
+ "# - model outputs\n",
+ "# \n",
+ "# You can use duckdb to inspect any of the above results.\n",
+ "duckdb_client.sql(\"SHOW TABLES\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Verify model results"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────┬──────────┬───────────────┬────────────┬─────────────┬────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬────────────┬─────────┬───────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬──────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬──────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ from_address │ to_address │ gas_limit │ gas_used │ trace_address │ trace_type │ tx_gas_used │ tx_l1_gas_used │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_method_id │ block_hour │ tx_success │ error │ method_id │ success │ trace_address_cardinality │ trace_address_uplevel │ count_traces_in_transaction │ gas_used_in_subtraces │ gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_gas_used_per_call_amortized │ tx_l1_gas_used_per_call_amortized │ tx_fee_native_per_call_amortized │ tx_l2_fee_native_per_call_amortized │ tx_l1_fee_native_per_call_amortized │ tx_l2_base_fee_native_per_call_amortized │ tx_l2_priority_fee_native_per_call_amortized │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
+ "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────┼──────────┼───────────────┼────────────┼─────────────┼────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼────────────┼─────────┼───────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼──────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼──────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ 0 │ -1 │ 19 │ 135545 │ 35841 │ 4.9811242501917e-05 │ 8.3688735e-11 │ 4.9811242501917e-05 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 1 │ │ 19 │ 132840 │ 2705 │ 3.759365279085e-06 │ 6.316174999999999e-12 │ 3.759365279085e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 2 │ 0 │ 19 │ 69223 │ 63617 │ 8.841387835842901e-05 │ 1.48545695e-10 │ 8.841387835842901e-05 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ 3 │ 0,0 │ 19 │ 3542 │ 5918 │ 8.224740747366e-06 │ 1.381853e-11 │ 8.224740747366e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ 4 │ 0,0,0 │ 19 │ 547 │ 2995 │ 4.162402591815e-06 │ 6.993325e-12 │ 4.162402591815e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 5 │ 0,0,0,0 │ 19 │ 381 │ 166 │ 2.30704116942e-07 │ 3.8761e-13 │ 2.30704116942e-07 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 6 │ 0,0,0,0,0 │ 19 │ 0 │ 381 │ 5.29507641897e-07 │ 8.89635e-13 │ 5.29507641897e-07 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ 3 │ 0,0 │ 19 │ 7940 │ 9330 │ 1.296668319921e-05 │ 2.178555e-11 │ 1.296668319921e-05 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2674 │ 3.716281980138e-06 │ 6.2437899999999996e-12 │ 3.716281980138e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2682 │ 3.727400250834e-06 │ 6.26247e-12 │ 3.727400250834e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────┴──────────┴───────────────┴────────────┴─────────────┴────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴────────────┴─────────┴───────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴──────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴──────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
+ "│ 10 rows 53 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"\"\"\n",
+ " SELECT * FROM refined_trace_calls_v1\n",
+ " where transaction_hash = '0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda'\n",
+ " AND block_number = 128145924\n",
+ " ORDER BY trace_address ASC\n",
+ " LIMIT 10\n",
+ " \"\"\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌─────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────────────┬───────────────────────┬─────────┬───────────┐\n",
+ "│ chain │ from_address │ to_address │ tx_fee_native_amortized │ tx_gas_used_amortized │ num_txs │ num_calls │\n",
+ "│ varchar │ varchar │ varchar │ double │ double │ int64 │ int64 │\n",
+ "├─────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────────────┼───────────────────────┼─────────┼───────────┤\n",
+ "│ op │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 0.01984228587366746 │ 206503287.08812115 │ 6684 │ 24102 │\n",
+ "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 0.012270676533798753 │ 181409113.2045721 │ 12419 │ 18268 │\n",
+ "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 0.01067813349083112 │ 31450680.81716765 │ 1869 │ 4068 │\n",
+ "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0.006808327150355245 │ 11008145.621250395 │ 739 │ 1466 │\n",
+ "│ op │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0.006125945087181573 │ 3175354.4807279063 │ 188 │ 349 │\n",
+ "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 0.0055345100190961685 │ 13710242.223767499 │ 966 │ 1415 │\n",
+ "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0xc565f7ba9c56b157da983c4db30e13f5f06c59d9 │ 0.0053390667454155565 │ 15725340.408583831 │ 1869 │ 2034 │\n",
+ "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0.0052924938575950094 │ 23877798.364569433 │ 2525 │ 3512 │\n",
+ "│ op │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 0.00501805130922075 │ 9193205.190832019 │ 552 │ 833 │\n",
+ "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0x4200000000000000000000000000000000000006 │ 0.004612185045687997 │ 14845981.801992826 │ 967 │ 1586 │\n",
+ "├─────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────────────┴───────────────────────┴─────────┴───────────┤\n",
+ "│ 10 rows 7 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"\"\"\n",
+ " SELECT chain, from_address, to_address\n",
+ " , SUM(tx_fee_native_per_call_amortized) AS tx_fee_native_amortized\n",
+ " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
+ " , COUNT(DISTINCT transaction_hash) AS num_txs\n",
+ " , COUNT(*) AS num_calls\n",
+ " FROM refined_trace_calls_v1\n",
+ " GROUP BY 1,2,3\n",
+ " ORDER BY 4 DESC\n",
+ " LIMIT 10\n",
+ " \"\"\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌─────────┬────────────────────────────────────────────┬────────────┬───────────────────────────────────────┬──────────────────────────────────┬──────────────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────────────────────────┬──────────────────────────┬───────────────────────┬─────────┬───────────┐\n",
+ "│ chain │ to_address │ method_id │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ gas_used_minus_subtraces │ tx_fee_native_amortized │ tx_gas_used_amortized │ tx_fee_native_l1_amortized_l2_minus_subtraces │ gas_used_minus_subtraces │ tx_gas_used_amortized │ num_txs │ num_calls │\n",
+ "│ varchar │ varchar │ varchar │ double │ double │ decimal(38,0) │ double │ double │ double │ decimal(38,0) │ double │ int64 │ int64 │\n",
+ "├─────────┼────────────────────────────────────────────┼────────────┼───────────────────────────────────────┼──────────────────────────────────┼──────────────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────────────────────────┼──────────────────────────┼───────────────────────┼─────────┼───────────┤\n",
+ "│ op │ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 0x9ff054df │ 5.174952896237992e-06 │ 1.8004188943487814e-05 │ 4140738114 │ 3.607112685741571e-05 │ 1389050444.4329228 │ 4.7656172137043205e-05 │ 4140738114 │ 1389050444.4329228 │ 326 │ 33037 │\n",
+ "│ op │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 3.2568401079389976e-06 │ 0.0010683153210424413 │ 2942876799 │ 6.65785639444228e-05 │ 79211123.77754316 │ 0.0011061417841192833 │ 2942876799 │ 79211123.77754316 │ 6766 │ 6766 │\n",
+ "│ op │ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 0xb1ae2ed1 │ 1.72403834768e-06 │ 5.543154580473999e-06 │ 1379290005 │ 3.520120981110036e-07 │ 13696759.836841851 │ 5.839542590379801e-06 │ 1379290005 │ 13696759.836841851 │ 325 │ 325 │\n",
+ "│ op │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1.1581475066439993e-06 │ 0.0005499961607026094 │ 1047163102 │ 4.46055711276664e-05 │ 36282314.964982085 │ 0.0005755365112395222 │ 1047163102 │ 36282314.964982085 │ 4132 │ 4132 │\n",
+ "│ op │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 0x022c0d9f │ 3.384370727930002e-07 │ 0.0015854822408981504 │ 266015077 │ 0.00021776773617876308 │ 26827815.199359253 │ 0.0016095264829950739 │ 266015077 │ 26827815.199359253 │ 1830 │ 3976 │\n",
+ "│ op │ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 0x1c560305 │ 3.2550231868400006e-07 │ 4.275001198438411e-05 │ 197005008 │ 8.27594366476248e-06 │ 28416951.268856198 │ 4.443545424898916e-05 │ 197005008 │ 28416951.268856198 │ 32 │ 4068 │\n",
+ "│ op │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 0x3850c7bd │ 2.5566371258498903e-07 │ 0.0006416230082392013 │ 230104893 │ 0.002771396783210153 │ 900603590.577735 │ 0.0011937857148023626 │ 230104893 │ 900603590.577735 │ 12883 │ 87157 │\n",
+ "│ op │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 0x128acb08 │ 1.7850146736199996e-07 │ 0.03820034576304705 │ 135497644 │ 0.00589899034739893 │ 20379707.056646183 │ 0.03824197579684476 │ 135497644 │ 20379707.056646183 │ 2296 │ 2677 │\n",
+ "│ op │ 0x4200000000000000000000000000000000000006 │ 0xa9059cbb │ 1.5023342879200017e-07 │ 0.008066713087357846 │ 114500894 │ 0.007241313753707096 │ 85910990.62567064 │ 0.008224337088685797 │ 114500894 │ 85910990.62567064 │ 5275 │ 9790 │\n",
+ "│ op │ 0x4200000000000000000000000000000000000042 │ 0xa9059cbb │ 1.2411857105699984e-07 │ 0.008311508205302787 │ 91957505 │ 0.0057811880326216255 │ 54647064.36140897 │ 0.008435380574996963 │ 91957505 │ 54647064.36140897 │ 3392 │ 5196 │\n",
+ "├─────────┴────────────────────────────────────────────┴────────────┴───────────────────────────────────────┴──────────────────────────────────┴──────────────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────────────────────────┴──────────────────────────┴───────────────────────┴─────────┴───────────┤\n",
+ "│ 10 rows 13 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"\"\"\n",
+ " SELECT chain, to_address, method_id\n",
+ " , SUM(tx_l2_base_fee_native_minus_subtraces) AS tx_l2_base_fee_native_minus_subtraces\n",
+ " , SUM(tx_l2_fee_native_minus_subtraces) AS tx_l2_fee_native_minus_subtraces\n",
+ " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
+ " , SUM(tx_fee_native_per_call_amortized) AS tx_fee_native_amortized\n",
+ " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
+ " , SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS tx_fee_native_l1_amortized_l2_minus_subtraces\n",
+ " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
+ " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
+ " , COUNT(DISTINCT transaction_hash) AS num_txs\n",
+ " , COUNT(*) AS num_calls\n",
+ " FROM refined_trace_calls_v1\n",
+ " GROUP BY 1,2,3\n",
+ " ORDER BY 4 DESC\n",
+ " LIMIT 10\n",
+ " \"\"\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌─────────┬────────────────────────────────────────────┬───────────────────────────────────────┬──────────────────────────────────┬──────────────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────────────────────────┬──────────────────────────┬───────────────────────┬─────────┬───────────┐\n",
+ "│ chain │ to_address │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ gas_used_minus_subtraces │ tx_fee_native_amortized │ tx_gas_used_amortized │ tx_fee_native_l1_amortized_l2_minus_subtraces │ gas_used_minus_subtraces │ tx_gas_used_amortized │ num_txs │ num_calls │\n",
+ "│ varchar │ varchar │ double │ double │ decimal(38,0) │ double │ double │ double │ decimal(38,0) │ double │ int64 │ int64 │\n",
+ "├─────────┼────────────────────────────────────────────┼───────────────────────────────────────┼──────────────────────────────────┼──────────────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────────────────────────┼──────────────────────────┼───────────────────────┼─────────┼───────────┤\n",
+ "│ op │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 6.050638967780253e-07 │ 0.04029101981655446 │ 529558288 │ 0.019182016703136347 │ 1068526615.5823003 │ 0.0410588316726855 │ 529558288 │ 1068526615.5823003 │ 14695 │ 108919 │\n",
+ "│ op │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 3.3478649509999996e-08 │ 0.03293851659707459 │ 24663045 │ 0.01897902807032173 │ 15480950.408311438 │ 0.03297361627015615 │ 24663045 │ 15480950.408311438 │ 645 │ 1233 │\n",
+ "│ op │ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 1.9456840452799985e-07 │ 0.01705440360559736 │ 166029433 │ 0.019842285873667473 │ 206503287.08812097 │ 0.01748343274821649 │ 166029433 │ 206503287.08812097 │ 6684 │ 24102 │\n",
+ "│ op │ 0x4200000000000000000000000000000000000006 │ 2.3316792023799954e-07 │ 0.015431971262860111 │ 178430485 │ 0.026771242371313383 │ 286334678.66157997 │ 0.015998930668723665 │ 178430485 │ 286334678.66157997 │ 8320 │ 32006 │\n",
+ "│ op │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 6.65385193219998e-08 │ 0.012689425145080506 │ 56703147 │ 0.005833905709314263 │ 130637259.29100353 │ 0.01279931877359867 │ 56703147 │ 130637259.29100353 │ 11629 │ 12356 │\n",
+ "│ op │ 0x4200000000000000000000000000000000000042 │ 1.6444814631400037e-07 │ 0.0097273262673029 │ 125165161 │ 0.00990857277048237 │ 148085202.57725108 │ 0.01001047702579258 │ 125165161 │ 148085202.57725108 │ 3841 │ 15444 │\n",
+ "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 5.067934249799999e-08 │ 0.009262629776185478 │ 38916418 │ 0.0118713804579046 │ 82267708.62408267 │ 0.00939493920090396 │ 38916418 │ 82267708.62408267 │ 3471 │ 10733 │\n",
+ "│ op │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 7.682785107299994e-08 │ 0.006820829227152148 │ 65627440 │ 0.019842285873667462 │ 206503287.08812094 │ 0.007249858369771295 │ 65627440 │ 206503287.08812094 │ 6684 │ 24102 │\n",
+ "│ op │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 9.111683892699985e-08 │ 0.00532948449070532 │ 70348033 │ 0.0037762033963338057 │ 144491780.93517327 │ 0.005471669528346366 │ 70348033 │ 144491780.93517327 │ 12057 │ 13948 │\n",
+ "│ op │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 6.9242942491e-08 │ 0.00481471283401902 │ 58246424 │ 0.005780227389582877 │ 69226356.25752687 │ 0.00512344419084279 │ 58246424 │ 69226356.25752687 │ 1690 │ 5304 │\n",
+ "├─────────┴────────────────────────────────────────────┴───────────────────────────────────────┴──────────────────────────────────┴──────────────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────────────────────────┴──────────────────────────┴───────────────────────┴─────────┴───────────┤\n",
+ "│ 10 rows 12 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"\"\"\n",
+ " SELECT chain, to_address\n",
+ " , SUM(tx_l2_base_fee_native_minus_subtraces) AS tx_l2_base_fee_native_minus_subtraces\n",
+ " , SUM(tx_l2_fee_native_minus_subtraces) AS tx_l2_fee_native_minus_subtraces\n",
+ " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
+ " , SUM(tx_fee_native_per_call_amortized) AS tx_fee_native_amortized\n",
+ " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
+ " , SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS tx_fee_native_l1_amortized_l2_minus_subtraces\n",
+ " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
+ " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
+ " , COUNT(DISTINCT transaction_hash) AS num_txs\n",
+ " , COUNT(*) AS num_calls\n",
+ " FROM refined_trace_calls_v1\n",
+ " GROUP BY 1,2\n",
+ " ORDER BY 4 DESC\n",
+ " LIMIT 10\n",
+ " \"\"\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check the data output size"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────────┬─────────┐\n",
+ "│ interm_num_calls │ num_txs │\n",
+ "│ int64 │ int64 │\n",
+ "├──────────────────┼─────────┤\n",
+ "│ 1274668 │ 33166 │\n",
+ "└──────────────────┴─────────┘"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs FROM refined_trace_calls_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┐\n",
+ "│ method_id │\n",
+ "│ varchar │\n",
+ "├────────────┤\n",
+ "│ 0xa6f19c84 │\n",
+ "│ 0xa34123a7 │\n",
+ "│ 0x514ea4bf │\n",
+ "│ 0xa6f19c84 │\n",
+ "│ 0x4f1eb3d8 │\n",
+ "│ 0x4f1eb3d8 │\n",
+ "│ 0xa9059cbb │\n",
+ "│ 0xdf2ab5bb │\n",
+ "│ 0x2e1a7d4d │\n",
+ "│ 0x2e1a7d4d │\n",
+ "├────────────┤\n",
+ "│ 10 rows │\n",
+ "└────────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT method_id FROM refined_trace_calls_v1 LIMIT 10\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### You can also convert the results to dataframes to inspect them in more familiar ways"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 53)dt | chain | chain_id | network | block_number | block_timestamp | transaction_hash | transaction_index | from_address | to_address | gas_limit | gas_used | trace_address | trace_type | tx_gas_used | tx_l1_gas_used | tx_from_address | tx_to_address | tx_fee_native | tx_l1_fee_native | tx_l2_fee_native | tx_l2_priority_fee_native | tx_l2_base_fee_native | tx_l2_legacy_extra_fee_native | tx_l2_gas_price_gwei | tx_l2_base_gas_price_gwei | tx_l2_priority_gas_price_gwei | tx_l2_legacy_extra_gas_price_gwei | tx_l1_base_gas_price_gwei | tx_l1_blob_base_gas_price_gwei | tx_method_id | block_hour | tx_success | error | method_id | success | trace_address_cardinality | trace_address_uplevel | count_traces_in_transaction | gas_used_in_subtraces | gas_used_minus_subtraces | tx_l2_fee_native_minus_subtraces | tx_l2_base_fee_native_minus_subtraces | tx_l2_priority_fee_native_minus_subtraces | tx_l2_legacy_base_fee_native_minus_subtraces | tx_gas_used_per_call_amortized | tx_l1_gas_used_per_call_amortized | tx_fee_native_per_call_amortized | tx_l2_fee_native_per_call_amortized | tx_l1_fee_native_per_call_amortized | tx_l2_base_fee_native_per_call_amortized | tx_l2_priority_fee_native_per_call_amortized | tx_fee_native_l1_amortized_l2_minus_subtraces |
---|
date | str | i32 | str | i64 | u32 | str | i64 | str | str | i64 | i64 | str | str | i64 | i64 | str | str | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | str | datetime[μs] | bool | str | str | bool | i64 | str | i64 | decimal[38,0] | decimal[38,0] | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 532667 | 5136 | "0,1" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0xa6f19c84" | true | 2 | "0" | 27 | 2470 | 2666 | 6.6669e-9 | 1.8582e-12 | 6.6650e-9 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.6573e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 525605 | 84738 | "0,2" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0xa34123a7" | true | 2 | "0" | 27 | 84551 | 187 | 4.6763e-10 | 1.3034e-13 | 4.6750e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0373e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 441068 | 1250 | "0,3" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0x514ea4bf" | true | 2 | "0" | 27 | 1057 | 193 | 4.8264e-10 | 1.3452e-13 | 4.8250e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0388e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 401968 | 636 | "1,1" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0xa6f19c84" | true | 2 | "1" | 27 | 470 | 166 | 4.1512e-10 | 1.1570e-13 | 4.1500e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0321e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 399004 | 89966 | "1,2" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0x4f1eb3d8" | true | 2 | "1" | 27 | 89767 | 199 | 4.9764e-10 | 1.3870e-13 | 4.9750e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0403e-8 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 53)\n",
+ "┌────────────┬───────┬──────────┬─────────┬───┬─────────────┬────────────┬────────────┬────────────┐\n",
+ "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ tx_l1_fee_n ┆ tx_l2_base ┆ tx_l2_prio ┆ tx_fee_nat │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ ative_per_c ┆ _fee_nativ ┆ rity_fee_n ┆ ive_l1_amo │\n",
+ "│ date ┆ str ┆ i32 ┆ str ┆ ┆ all_amor… ┆ e_per_call ┆ ative_per_ ┆ rtized_l2_ │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ --- ┆ … ┆ … ┆ … │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ f64 ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │\n",
+ "╞════════════╪═══════╪══════════╪═════════╪═══╪═════════════╪════════════╪════════════╪════════════╡\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.6573e-8 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0373e-8 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0388e-8 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0321e-8 │\n",
+ "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0403e-8 │\n",
+ "└────────────┴───────┴──────────┴─────────┴───┴─────────────┴────────────┴────────────┴────────────┘"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM refined_trace_calls_v1 LIMIT 5\").pl()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Get table schema"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌───────────────────────────────────────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├───────────────────────────────────────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ tx_l2_priority_fee_native_minus_subtraces │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_l2_legacy_base_fee_native_minus_subtraces │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_gas_used_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_l1_gas_used_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_l2_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_l1_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_l2_base_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_l2_priority_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ tx_fee_native_l1_amortized_l2_minus_subtraces │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "├───────────────────────────────────────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 53 rows (20 shown) 6 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"DESCRIBE refined_trace_calls_v1\")\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": ".venv",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/src/op_analytics/datapipeline/models/code/daily_address_summary.py b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
index b20bbe4d894..01027c4d7b3 100644
--- a/src/op_analytics/datapipeline/models/code/daily_address_summary.py
+++ b/src/op_analytics/datapipeline/models/code/daily_address_summary.py
@@ -1,21 +1,21 @@
-import duckdb
+# import duckdb
-from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
-from op_analytics.datapipeline.models.compute.registry import register_model
-from op_analytics.datapipeline.models.compute.types import NamedRelations
+# from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+# from op_analytics.datapipeline.models.compute.registry import register_model
+# from op_analytics.datapipeline.models.compute.types import NamedRelations
-@register_model(
- input_datasets=["intermediate/refined_transactions_fees_v1"],
- expected_outputs=["summary_v1"],
- auxiliary_views=[
- TemplatedSQLQuery(
- template_name="daily_address_summary",
- context={},
- ),
- ],
-)
-def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
- return {
- "summary_v1": duckdb_client.view("daily_address_summary"),
- }
+# @register_model(
+# input_datasets=["intermediate/refined_transactions_fees_v1"],
+# expected_outputs=["summary_v1"],
+# auxiliary_views=[
+# TemplatedSQLQuery(
+# template_name="daily_address_summary",
+# context={},
+# ),
+# ],
+# )
+# def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+# return {
+# "summary_v1": duckdb_client.view("daily_address_summary"),
+# }
diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
index 08397cf5ede..b5e156333f9 100644
--- a/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
+++ b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py
@@ -1,31 +1,31 @@
-# TO DEPRECATE?
+# # TO DEPRECATE?
-import duckdb
+# import duckdb
-from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
-from op_analytics.datapipeline.models.compute.registry import register_model
-from op_analytics.datapipeline.models.compute.types import NamedRelations
+# from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+# from op_analytics.datapipeline.models.compute.registry import register_model
+# from op_analytics.datapipeline.models.compute.types import NamedRelations
-@register_model(
- input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
- expected_outputs=["event_emitting_transactions_v1"],
- auxiliary_views=[
- TemplatedSQLQuery(
- template_name="refined_transactions_fees",
- context={},
- ),
- TemplatedSQLQuery(
- template_name="logs_topic0_filters",
- context={},
- ),
- TemplatedSQLQuery(
- template_name="event_emitting_transactions",
- context={},
- ),
- ],
-)
-def event_emitting_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
- return {
- "event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
- }
+# @register_model(
+# input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"],
+# expected_outputs=["event_emitting_transactions_v1"],
+# auxiliary_views=[
+# TemplatedSQLQuery(
+# template_name="refined_transactions_fees",
+# context={},
+# ),
+# TemplatedSQLQuery(
+# template_name="logs_topic0_filters",
+# context={},
+# ),
+# TemplatedSQLQuery(
+# template_name="event_emitting_transactions",
+# context={},
+# ),
+# ],
+# )
+# def event_emitting_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+# return {
+# "event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
+# }
diff --git a/src/op_analytics/datapipeline/models/code/refined_trace_calls.py b/src/op_analytics/datapipeline/models/code/refined_trace_calls.py
index a48391d9a7f..e3db8c4185c 100644
--- a/src/op_analytics/datapipeline/models/code/refined_trace_calls.py
+++ b/src/op_analytics/datapipeline/models/code/refined_trace_calls.py
@@ -1,21 +1,21 @@
-import duckdb
+# import duckdb
-from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
-from op_analytics.datapipeline.models.compute.registry import register_model
-from op_analytics.datapipeline.models.compute.types import NamedRelations
+# from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+# from op_analytics.datapipeline.models.compute.registry import register_model
+# from op_analytics.datapipeline.models.compute.types import NamedRelations
-@register_model(
- input_datasets=["ingestion/traces_v1", "refined_transactions_fees_v1"],
- expected_outputs=["refined_trace_calls_v1"],
- auxiliary_views=[
- TemplatedSQLQuery(
- template_name="refined_trace_calls",
- context={},
- ),
- ],
-)
-def refined_trace_calls(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
- return {
- "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
- }
+# @register_model(
+# input_datasets=["ingestion/traces_v1", "refined_transactions_fees_v1"],
+# expected_outputs=["refined_trace_calls_v1"],
+# auxiliary_views=[
+# TemplatedSQLQuery(
+# template_name="refined_trace_calls",
+# context={},
+# ),
+# ],
+# )
+# def refined_trace_calls(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+# return {
+# "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
+# }
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py b/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
deleted file mode 100644
index 8b492557bec..00000000000
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_fees.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import duckdb
-
-from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
-from op_analytics.datapipeline.models.compute.registry import register_model
-from op_analytics.datapipeline.models.compute.types import NamedRelations
-
-
-@register_model(
- input_datasets=[
- "ingestion/transactions_v1",
- "ingestion/blocks_v1",
- "ingestion/logs_v1",
- ],
- expected_outputs=["refined_transactions_fees_v1"],
- auxiliary_views=[
- TemplatedSQLQuery(
- template_name="refined_transactions_fees",
- context={},
- ),
- ],
-)
-def refined_transactions_fees(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
- return {
- "refined_transactions_fees_v1": duckdb_client.view("refined_transactions_fees"),
- }
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py b/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
new file mode 100644
index 00000000000..26cc6f9580e
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
@@ -0,0 +1,52 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=[
+ "ingestion/transactions_v1",
+ "ingestion/blocks_v1",
+ "ingestion/logs_v1",
+ "ingestion/traces_v1",
+ ],
+ expected_outputs=[
+ "refined_transactions_fees_v1",
+ "refined_trace_calls_v1",
+ "event_emitting_transactions_v1",
+ "summary_v1",
+ ],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="refined_transactions_fees",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="refined_trace_calls",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="logs_topic0_filters",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="event_emitting_transactions",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="daily_address_summary",
+ context={},
+ ),
+ ],
+)
+def refined_transactions_traces_address_models(
+ duckdb_client: duckdb.DuckDBPyConnection,
+) -> NamedRelations:
+ return {
+ "refined_transactions_fees_v1": duckdb_client.view("refined_transactions_fees"),
+ "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
+ "event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
+ "summary_v1": duckdb_client.view("daily_address_summary"),
+ }
diff --git a/src/op_analytics/datapipeline/models/compute/udfs.py b/src/op_analytics/datapipeline/models/compute/udfs.py
index 9912dfb2195..78778cc0589 100644
--- a/src/op_analytics/datapipeline/models/compute/udfs.py
+++ b/src/op_analytics/datapipeline/models/compute/udfs.py
@@ -17,7 +17,7 @@ def create_duckdb_macros(duckdb_client: duckdb.DuckDBPyConnection):
AS a::DECIMAL(28, 0) * 0.000000001::DECIMAL(10, 10);
CREATE OR REPLACE MACRO gwei_to_eth(a)
- AS wei_to_gwei(a);
+ AS a::DECIMAL(28, 10) * 0.000000001::DECIMAL(10, 10);
CREATE OR REPLACE MACRO safe_div(a, b) AS
IF(b = 0, NULL, a / b);
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index c985ba9bf93..1d0de1cd3b9 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -59,7 +59,7 @@ SELECT
wei_to_eth(sum(l2_priority_fee)) AS l2_priority_fee_sum_eth,
- wei_to_eth(sum(l2_base_legacy_fee)) AS l2_base_legacy_fee_sum_eth,
+ wei_to_eth(sum(l2_legacy_extra_fee)) AS l2_base_legacy_fee_sum_eth,
-- L1 Fee and breakdown into BASE + BLOB
wei_to_eth(sum(l1_fee)) AS l1_fee_sum_eth,
@@ -83,11 +83,7 @@ SELECT
) AS l1_base_price_avg_gwei,
wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
- AS l1_blob_fee_avg_gwei,
-
- -- Qualified Transactions Variants
- count(if(is_qualified_tx_not_approval_wrapping_transfer, 1, NULL)) AS qualified_tx_not_approval_wrapping_transfer_cnt,
- count(if(is_qualified_tx_not_approval_wrapping, 1, NULL)) AS qualified_tx_not_approval_wrapping_cnt
+ AS l1_blob_fee_avg_gwei
FROM
refined_transactions_fees
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
index 1fab8ce0ba7..8b3c5d98ace 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
@@ -2,60 +2,63 @@
-- Calculate types of events emitted for downstream "qualified transaction" filtering
WITH event_emitting AS (
-SELECT
- l.dt
- ,epoch_to_hour(l.block_timestamp) AS block_hour
- ,l.block_timestamp
- ,l.network, l.chain, l.chain_id
- ,l.block_number
- ,l.transaction_hash
-
- ,COUNT(*) AS count_total_events
- ,SUM(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events
- ,SUM(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events
- ,SUM(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
-
-FROM ingestion_logs_v1 AS l
-LEFT JOIN logs_topic0_filters AS f
- ON l.topic0 = f.topic
-
-GROUP BY 1,2,3,4,5,6,7,8
+ SELECT
+ l.dt,
+ epoch_to_hour(l.block_timestamp) AS block_hour,
+ l.block_timestamp,
+ l.network,
+ l.chain,
+ l.chain_id,
+ l.block_number,
+ l.transaction_hash,
+
+ count(*) AS count_total_events,
+ sum(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events,
+ sum(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events,
+ sum(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
+
+ FROM ingestion_logs_v1 AS l
+ LEFT JOIN logs_topic0_filters AS f
+ ON l.topic0 = f.topic
+
+ GROUP BY 1, 2, 3, 4, 5, 6, 7, 8
)
SELECT
- ee.*
-
- ,ee.count_total_events
- > ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events
- AS is_qualified_tx_not_approval_wrapping_transfer
-
- ,ee.count_total_events
- > ee.count_approval_events + ee.count_wrapping_events
- AS is_qualified_tx_not_approval_wrapping
-
- -- Join Transaction Fields
- ,t.transaction_index
- ,t.transaction_type
- -- gas fees
- ,t.tx_fee_native
-
- ,t.l1_fee_native
- ,t.l2_fee_native
-
- ,t.l1_base_fee_native
- ,t.l1_blob_fee_native
-
- ,t.l2_base_fee_native
- ,t.l2_priority_fee_native
- ,t.l2_base_legacy_fee_native
- -- transaction attributes
- ,t.input_byte_length
- ,t.input_calldata_gas
- ,t.l1_gas_used
- ,t.receipt_gas_used
-
-
-FROM event_emitting ee
-INNER JOIN refined_transactions_fees AS t
- ON ee.block_number = t.block_number
- AND ee.transaction_hash = t.hash
+ ee.*,
+
+ t.transaction_index,
+
+ t.transaction_type,
+
+ -- Join Transaction Fields
+ t.tx_fee_native,
+ t.l1_fee_native,
+ -- gas fees
+ t.l2_fee_native,
+
+ t.l1_base_fee_native,
+ t.l1_blob_fee_native,
+
+ t.l2_base_fee_native,
+ t.l2_priority_fee_native,
+
+ t.l2_legacy_extra_fee_native,
+ t.input_byte_length,
+ t.input_calldata_gas,
+ -- transaction attributes
+ t.l1_gas_used,
+ t.receipt_gas_used,
+ ee.count_total_events
+ > ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events
+ AS is_qualified_tx_not_approval_wrapping_transfer,
+ ee.count_total_events
+ > ee.count_approval_events + ee.count_wrapping_events
+ AS is_qualified_tx_not_approval_wrapping
+
+
+FROM event_emitting AS ee
+INNER JOIN refined_transactions_fees AS t
+ ON
+ ee.block_number = t.block_number
+ AND ee.transaction_hash = t.hash
diff --git a/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2 b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
index d9882ca2b5d..d79d1584cef 100644
--- a/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
@@ -1,18 +1,22 @@
WITH topic0_filters AS ( -- list of events that we want to indicate for possible future filtering.
- SELECT distinct lower(topic) as topic, description, category
- FROM (values
- ('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', 'ERC20 Approval', 'Approval')
- ,('0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', 'ERC721/ERC1155 Approval', 'Approval')
+ SELECT DISTINCT
+ lower(topic) AS topic,
+ description,
+ category
+ FROM (
+ VALUES
+ ('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', 'ERC20 Approval', 'Approval'),
+ ('0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', 'ERC721/ERC1155 Approval', 'Approval'),
- ,('0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', 'WETH Wrap', 'Wrapping')
- ,('0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65', 'WETH Unwrap', 'Wrapping')
+ ('0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', 'WETH Wrap', 'Wrapping'),
+ ('0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65', 'WETH Unwrap', 'Wrapping'),
- ,('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'ERC20/ERC721 Transfer', 'Transfer')
- ,('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', 'ERC1155 Transfer Single', 'Transfer')
- ,('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer')
- ,('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer')
- ,('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer')
- ) a (topic, description, category)
+ ('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'ERC20/ERC721 Transfer', 'Transfer'),
+ ('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', 'ERC1155 Transfer Single', 'Transfer'),
+ ('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer'),
+ ('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer'),
+ ('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer')
+ )a (topic, description, category)
)
-SELECT * FROM topic0_filters
\ No newline at end of file
+SELECT * FROM topic0_filters
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
index 33080e41179..05ce7dec2cd 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
@@ -18,11 +18,10 @@ base_level_trace_calls AS (
r.gas AS gas_limit,
r.gas_used,
r.trace_address,
- r.error,
r.trace_type,
-- Raw Transaction Fields
t.receipt_gas_used AS tx_gas_used,
- t.receipt_l1_gas_used AS tx_l1_gas_used,
+ t.l1_gas_used AS tx_l1_gas_used,
t.from_address AS tx_from_address,
t.to_address AS tx_to_address,
-- Computed Transaction Fee Fields
@@ -31,91 +30,124 @@ base_level_trace_calls AS (
t.l2_fee_native AS tx_l2_fee_native,
t.l2_priority_fee_native AS tx_l2_priority_fee_native,
t.l2_base_fee_native AS tx_l2_base_fee_native,
- t.l2_base_legacy_native AS tx_l2_base_legacy_native,
+ t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native,
-- Computed Transaction Gas Price Fields
- t.l2_gas_price_gwei,
- t.l2_base_gas_price_gwei,
- t.l2_priority_gas_price_gwei,
- t.l2_base_legacy_gas_price_gwei,
- t.l1_base_gas_price_gwei,
- t.l1_blob_base_gas_price_gwei,
+ t.l2_gas_price_gwei AS tx_l2_gas_price_gwei,
+ t.l2_base_gas_price_gwei AS tx_l2_base_gas_price_gwei,
+ t.l2_priority_gas_price_gwei AS tx_l2_priority_gas_price_gwei,
+ t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei,
+ t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei,
+ t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei,
t.method_id AS tx_method_id,
- hexstr_method_id(r.input) AS trc_method_id,
-
- -- Event Columns
- t.log_count_total_events,
- t.log_count_approval_events,
- t.log_count_wrapping_events,
- t.log_count_transfer_events,
-
- -- Convenience columns
t.block_hour,
+
+ -- Convenience columns
t.success AS tx_success,
- t.receipt_status = 1 AS trc_success,
+ r.error,
+ hexstr_method_id(r.input) AS method_id,
+ r.status = 1 AS success,
--Get the next trace level up so that we can subtract subtrace gas
- CASE WHEN r.trace_address IS NULL OR r.trace_address = '' THEN '-1'
- ELSE
- CASE
- WHEN LENGTH(r.trace_address) - LENGTH(REPLACE(r.trace_address, ',', '')) = 0 THEN r.trace_address
- ELSE SUBSTR(r.trace_address, 1, LENGTH(r.trace_address) - LENGTH(SPLIT(r.trace_address, ',')[ORDINAL(ARRAY_LENGTH(SPLIT(r.trace_address, ',')))]) - 1)
- END
- END AS trace_address_uplevel
-
- FROM ingestion_traces_v1 r
- INNER JOIN extended_transactions_v1 t
- ON r.block_number = t.block_number
+ CASE
+ WHEN r.trace_address = '' THEN 0
+ ELSE length(r.trace_address) - length(replace(r.trace_address, ',', '')) + 1
+ END AS trace_address_cardinality,
+
+ CASE
+ WHEN r.trace_address = '' THEN '-1'
+ WHEN strpos(r.trace_address, ',') = 0 THEN '' -- No comma found
+ WHEN length(r.trace_address) - length(replace(r.trace_address, ',', '')) = 1
+ THEN
+ split_part(r.trace_address, ',', 1) -- Only one comma, return first part
+ ELSE
+ substr(
+ r.trace_address,
+ 1,
+ length(r.trace_address)
+ - length(split_part(r.trace_address, ',', array_length(string_split(r.trace_address, ','))))
+ - 1
+ )
+ END AS trace_address_uplevel
+
+
+
+ FROM ingestion_traces_v1 AS r
+ INNER JOIN refined_transactions_fees AS t
+ ON
+ r.block_number = t.block_number
AND r.transaction_hash = t.hash
-
- WHERE r.trace_type = 'call'
-)
- --get amount of calls per transcation, to use for amortizing
-, get_traces_per_tansaction AS (
- SELECT block_number, block_timestamp, transaction_hash
- , COUNT(*) AS count_traces_in_transaction
- FROM base_level_traces
- GROUP BY 1,2,3
-)
+ WHERE r.trace_type = 'call'
+),
+
+--get amount of calls per transcation, to use for amortizing
+get_traces_per_tansaction AS (
+ SELECT
+ block_number,
+ block_timestamp,
+ transaction_hash,
+ count(*) AS count_traces_in_transaction
+ FROM base_level_trace_calls
+ GROUP BY 1, 2, 3
+),
- --get subtrace gas used, for isolating each call
-, get_subtraces_gas_per_trace AS (
- SELECT block_number, block_timestamp, transaction_hash, trace_address_uplevel
- , SUM(trc_gas_used) AS gas_used_in_subtraces, COUNT(*) AS count_subtraces
- FROM base_level_traces
- GROUP BY 1,2,3,4
+--get subtrace gas used, for isolating each call
+get_subtraces_gas_per_trace AS (
+ SELECT
+ block_number,
+ block_timestamp,
+ transaction_hash,
+ trace_address_uplevel,
+ trace_address_cardinality,
+ sum(gas_used) AS gas_used_in_subtraces,
+ count(*) AS count_subtraces_in_trace
+ FROM base_level_trace_calls
+ GROUP BY 1, 2, 3, 4, 5
)
-SELECT
-bl.*
---
-, st.gas_used_in_subtraces AS gas_used_in_subtraces
-, tpt.count_traces_in_transaction AS count_traces_in_transaction
---
-, bl.trc_gas_used - st.gas_used_in_subtraces AS trc_gas_used_minus_subtraces
-
--- the subtraces will never add up to part of whole, but leave as is
-, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_gas_price_gwei) AS trc_l2_fee_native_minus_subtraces
-, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_base_gas_price_gwei) AS trc_base_fee_native_minus_subtraces
-, (bl.trc_gas_used - st.gas_used_in_subtraces) * gwei_to_eth(bl.tx_priority_gas_price_gwei) AS trc_priority_fee_native_minus_subtraces
---
-, (bl.tx_gas_used) / tpt.count_traces AS tx_gas_used_per_call_amortized
-, (bl.tx_l1_gas_used) / tpt.count_traces AS tx_l1_gas_used_per_call_amortized
-
-, bl.tx_gas_fee_native / tpt.count_traces AS tx_gas_fee_native_per_call_amortized
-, bl.tx_l2_fee_native / tpt.count_traces AS tx_l2_fee_native_per_call_amortized
-, bl.tx_l1_fee_native / tpt.count_traces AS tx_l1_fee_native_per_call_amortized
-, bl.tx_base_fee_native / tpt.count_traces AS tx_base_fee_native_per_call_amortized
-, bl.tx_priority_fee_native / tpt.count_traces AS tx_priority_fee_native_per_call_amortized
-
-
-FROM base_level_trace_calls bl
-INNER JOIN get_traces_per_tansaction tpt -- join on txn level
- ON bl.block_number = tpt.block_number
+SELECT
+ bl.*,
+ --
+ tpt.count_traces_in_transaction,
+ coalesce(st.gas_used_in_subtraces, 0) AS gas_used_in_subtraces,
+ --
+ bl.gas_used - coalesce(st.gas_used_in_subtraces, 0) AS gas_used_minus_subtraces,
+
+ -- the subtraces will never add up to part of whole, but leave as is
+ (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_gas_price_gwei)::DOUBLE AS tx_l2_fee_native_minus_subtraces,
+ (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_base_gas_price_gwei)::DOUBLE AS tx_l2_base_fee_native_minus_subtraces,
+ (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei)::DOUBLE AS tx_l2_priority_fee_native_minus_subtraces,
+ (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei)::DOUBLE AS tx_l2_legacy_base_fee_native_minus_subtraces,
+ --
+ bl.tx_gas_used / tpt.count_traces_in_transaction AS tx_gas_used_per_call_amortized,
+ bl.tx_l1_gas_used / tpt.count_traces_in_transaction AS tx_l1_gas_used_per_call_amortized,
+
+ bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_per_call_amortized,
+ bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_per_call_amortized,
+ bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_per_call_amortized,
+ bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_per_call_amortized,
+ bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_per_call_amortized,
+
+ --
+ (bl.tx_l1_fee_native / tpt.count_traces_in_transaction)
+ + (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_fee_native_l1_amortized_l2_minus_subtraces
+
+
+FROM base_level_trace_calls AS bl
+INNER JOIN get_traces_per_tansaction AS tpt -- join on txn level
+ ON
+ bl.block_number = tpt.block_number
AND bl.transaction_hash = tpt.transaction_hash
-LEFT JOIN get_subtraces_gas_per_trace st -- join on trace level 1 level down
- ON bl.block_number = st.block_number
+LEFT JOIN get_subtraces_gas_per_trace AS st -- join on trace level 1 level down
+ ON
+ bl.block_number = st.block_number
AND bl.transaction_hash = st.transaction_hash
+ AND bl.trace_address_cardinality = (st.trace_address_cardinality - 1)
AND bl.trace_address = st.trace_address_uplevel
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index ac48c815875..83f20cb1b82 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -29,42 +29,42 @@ pt1 AS (
t.receipt_gas_used,
t.receipt_l1_gas_used,
-- Fees
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
t.receipt_l1_gas_price,
t.receipt_l1_blob_base_fee,
b.base_fee_per_gas,
t.max_priority_fee_per_gas,
- if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS base_legacy_fee_per_gas,
+ t.transaction_type,
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
-- L2 Fees and breakdown into BASE and PRIORITY contributions
+ if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas,
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
-- Convenience columns
+ CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
epoch_to_hour(t.block_timestamp) AS block_hour,
hexstr_method_id(t.input) AS method_id,
- t.receipt_status = 1 AS success,
-- L1 Fee BASE and BLOB scalars
+ t.receipt_status = 1 AS success,
coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
AS l1_base_fee_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
-- Transaction Attributes
- transaction_type,
+ coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
hexstr_bytelen(t.input) AS input_byte_length,
hexstr_calldata_gas(t.input) AS input_calldata_gas,
- transaction_type = 126 AS is_system_transaction,
+ t.transaction_type = 126 AS is_system_transaction,
( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
- transaction_type = 126
- AND from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
- AND to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction
+ t.transaction_type = 126
+ AND t.from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
+ AND t.to_address = lower('0x4200000000000000000000000000000000000015')
+ ) AS is_attributes_deposited_transaction
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b
ON t.block_number = b.number
- WHERE 1=1
- -- Optional address filter for faster results when developing.
- -- AND from_address LIKE '0x00%'
+ WHERE 1 = 1
+-- Optional address filter for faster results when developing.
+-- AND from_address LIKE '0x00%'
),
@@ -86,54 +86,55 @@ pt2 AS (
-- Reuses results from the previous CTEs.
pt3 AS (
-SELECT
- *,
- --
- -- Total fee
- l2_fee + l1_fee AS tx_fee,
- --
- -- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
- --
- -- L1 Base
- div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
- --
- -- L1 Blob
- div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
-
-FROM pt2
+ SELECT
+ *,
+ --
+ -- Total fee
+ l2_fee + l1_fee AS tx_fee,
+ --
+ -- L2 Legacy Fee
+ if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee,
+ --
+ -- L1 Base
+ div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
+ --
+ -- L1 Blob
+ div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
+ div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
+
+ FROM pt2
)
-- Generate gas fee breakdowns in native terms, for later aggregation
-- Generate gas prices in gwei terms
-SELECT *
+SELECT
+ *,
--- Fees
-, wei_to_eth(tx_fee) AS tx_fee_native
+ -- Fees
+ wei_to_eth(tx_fee) AS tx_fee_native,
-- Native Breakdown
- , wei_to_eth(l1_fee) AS l1_fee_native
- , wei_to_eth(l2_fee) AS l2_fee_native
+ wei_to_eth(l1_fee) AS l1_fee_native,
+ wei_to_eth(l2_fee) AS l2_fee_native,
-- L1 Breakdown
- , wei_to_eth(l1_base_fee) AS l1_base_fee_native
- , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
+ wei_to_eth(l1_base_fee) AS l1_base_fee_native,
+ wei_to_eth(l1_blob_fee) AS l1_blob_fee_native,
-- L2 Breakdown
- , wei_to_eth(l2_base_fee) AS l2_base_fee_native
- , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
- , wei_to_eth(l2_base_legacy_fee) AS l2_base_legacy_fee_native
-
--- Gas Prices
- , wei_to_gwei(gas_price) AS l2_gas_price_gwei
- , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
- , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
- , wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei
-
- , wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei
- , wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
+ wei_to_eth(l2_base_fee) AS l2_base_fee_native,
+ wei_to_eth(l2_priority_fee) AS l2_priority_fee_native,
+ wei_to_eth(l2_legacy_extra_fee) AS l2_legacy_extra_fee_native,
+
+ -- Gas Prices
+ wei_to_gwei(gas_price) AS l2_gas_price_gwei,
+ wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei,
+ wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei,
+ wei_to_gwei(legacy_extra_fee_per_gas) AS l2_legacy_extra_gas_price_gwei,
+
+ wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei,
+ wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
FROM pt3
From 61cab6998a9c552062ea911f6867cdced5dee992 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Sat, 14 Dec 2024 13:11:17 -0500
Subject: [PATCH 23/32] separate l1 fee scalar versions
The definition of the L1 fee scalar changed in Fjord, we should not combine them together.
---
.../refined_transactions_fees.sql.j2 | 27 ++++++++++++-------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 83f20cb1b82..0b63222048c 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -45,13 +45,14 @@ pt1 AS (
hexstr_method_id(t.input) AS method_id,
-- L1 Fee BASE and BLOB scalars
t.receipt_status = 1 AS success,
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_fee_scalar,
+ micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar,
+ t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar,
-- Transaction Attributes
coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_calldata_gas(t.input) AS input_calldata_gas,
+ hexstr_zero_bytes(t.input) AS input_zero_bytes,
+ hexstr_nonzero_bytes(t.input) AS input_nonzero_bytes,
t.transaction_type = 126 AS is_system_transaction,
( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
t.transaction_type = 126
@@ -74,12 +75,18 @@ pt2 AS (
*,
coalesce(
receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_fee_scalar * receipt_l1_gas_price)
- + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
- ))::INT64
+ round(16 * estimated_size)::INT64
) AS l1_gas_used
- FROM pt1
+ FROM (
+ SELECT
+ *,
+ -- Estimated Size in bytes calculation, post-Fjord. This is not equivalent to L1 Gas Used
+ l1_fee / (
+ (16 * l1_base_fee_scalar * receipt_l1_gas_price)
+ + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
+ ) AS estimated_size_bytes
+ FROM pt1
+ )
),
-- Add more fee calculations.
@@ -96,8 +103,8 @@ pt3 AS (
if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee,
--
-- L1 Base
- div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
+ div16(l1_gas_used) * COALESCE(16*l1_base_fee_scalar,l1_fee_scalar) * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used) * COALESCE(16*l1_base_fee_scalar,l1_fee_scalar) AS l1_base_scaled_size,
--
-- L1 Blob
div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
From ae7b7dbfc3655eace8ee262f82d1980b4008d973 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Sat, 14 Dec 2024 17:37:02 -0500
Subject: [PATCH 24/32] fixes and create aggregate trace models
---
.vscode/settings.json | 5 +-
notebooks/adhoc/example_daily_data.ipynb | 41 +-
...ansactions_traces_address_models_dev.ipynb | 469 ++++++++----------
...ummary.py => daily_address_summary_old.py} | 2 +-
...ined_transactions_traces_address_models.py | 17 +
.../templates/daily_address_summary.sql.j2 | 23 +-
.../templates/daily_trace_calls_agg_to.sql.j2 | 162 ++++++
.../event_emitting_transactions.sql.j2 | 22 +-
.../templates/refined_trace_calls.sql.j2 | 85 ++--
...efined_trace_calls_agg_from_to_hash.sql.j2 | 87 ++++
.../refined_trace_calls_agg_to_hash.sql.j2 | 101 ++++
.../refined_transactions_fees.sql.j2 | 53 +-
12 files changed, 731 insertions(+), 336 deletions(-)
rename src/op_analytics/datapipeline/models/code/{daily_address_summary.py => daily_address_summary_old.py} (87%)
create mode 100644 src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 26e3327da0e..00015949b21 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -22,5 +22,8 @@
"sqlfluff.executablePath": ".venv/bin/sqlfluff",
"files.associations": {
"*.sql.j2": "sql"
- }
+ },
+ "sqlfluff.excludeRules": [
+ "LT04"
+ ]
}
diff --git a/notebooks/adhoc/example_daily_data.ipynb b/notebooks/adhoc/example_daily_data.ipynb
index acf4ff06179..2850b15d73a 100644
--- a/notebooks/adhoc/example_daily_data.ipynb
+++ b/notebooks/adhoc/example_daily_data.ipynb
@@ -9,18 +9,18 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
- "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
- "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
- "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n",
- "\u001b[2m2024-12-13 00:03:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader_bydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m6571\u001b[0m\n"
+ "\u001b[2m2024-12-14 13:32:29\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
+ "\u001b[2m2024-12-14 13:32:29\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
+ "\u001b[2m2024-12-14 13:32:29\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
+ "\u001b[2m2024-12-14 13:32:30\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
+ "\u001b[2m2024-12-14 13:32:30\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n"
]
}
],
@@ -36,7 +36,7 @@
"# Define the input data range.\n",
"read_batches: list[DataReader] = construct_data_readers(\n",
" chains=[\"op\"],\n",
- " models=[\"daily_address_summary\"],\n",
+ " models=[\"refined_transactions_traces_address_models\"],\n",
" range_spec=\"@20241030:+1\",\n",
" read_from=DataLocation.GCS\n",
")\n",
@@ -61,15 +61,36 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-14 13:32:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n"
+ ]
+ },
+ {
+ "ename": "KeyError",
+ "evalue": "'daily_address_summary'",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[3], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mop_analytics\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdatapipeline\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodels\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcompute\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtestutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m execute_model_in_memory\n\u001b[0;32m----> 3\u001b[0m \u001b[43mexecute_model_in_memory\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43mduckdb_client\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mduckdb_client\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdaily_address_summary\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_reader\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbatch\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 7\u001b[0m \u001b[43m)\u001b[49m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;66;03m# The duckdb database will have the following:\u001b[39;00m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# - input tables\u001b[39;00m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;66;03m# - views used by the model\u001b[39;00m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;66;03m# - model outputs\u001b[39;00m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;66;03m# You can use duckdb to inspect any of the above results.\u001b[39;00m\n\u001b[1;32m 15\u001b[0m duckdb_client\u001b[38;5;241m.\u001b[39msql(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSHOW TABLES\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
+ "File \u001b[0;32m~/Documents/GitHub/op-analytics/src/op_analytics/datapipeline/models/compute/testutils.py:222\u001b[0m, in \u001b[0;36mexecute_model_in_memory\u001b[0;34m(duckdb_client, model, data_reader, limit_input_parquet_files)\u001b[0m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Execute a model and register results as views.\"\"\"\u001b[39;00m\n\u001b[1;32m 220\u001b[0m log\u001b[38;5;241m.\u001b[39minfo(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExecuting model...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 222\u001b[0m model_obj \u001b[38;5;241m=\u001b[39m \u001b[43mPythonModel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 224\u001b[0m create_duckdb_macros(duckdb_client)\n\u001b[1;32m 226\u001b[0m model_executor \u001b[38;5;241m=\u001b[39m PythonModelExecutor(\n\u001b[1;32m 227\u001b[0m model\u001b[38;5;241m=\u001b[39mmodel_obj,\n\u001b[1;32m 228\u001b[0m client\u001b[38;5;241m=\u001b[39mduckdb_client,\n\u001b[1;32m 229\u001b[0m data_reader\u001b[38;5;241m=\u001b[39mdata_reader,\n\u001b[1;32m 230\u001b[0m limit_input_parquet_files\u001b[38;5;241m=\u001b[39mlimit_input_parquet_files,\n\u001b[1;32m 231\u001b[0m )\n",
+ "File \u001b[0;32m~/Documents/GitHub/op-analytics/src/op_analytics/datapipeline/models/compute/modelexecute.py:49\u001b[0m, in \u001b[0;36mPythonModel.get\u001b[0;34m(cls, model_name)\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m model_name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m_registry:\n\u001b[1;32m 44\u001b[0m \u001b[38;5;66;03m# Import the module so that the model gets registered.\u001b[39;00m\n\u001b[1;32m 45\u001b[0m \u001b[38;5;66;03m# For now the module and model name are the same by convention, but\u001b[39;00m\n\u001b[1;32m 46\u001b[0m \u001b[38;5;66;03m# that can change if we need to.\u001b[39;00m\n\u001b[1;32m 47\u001b[0m importlib\u001b[38;5;241m.\u001b[39mimport_module(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mop_analytics.datapipeline.models.code.\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodel_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 49\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_registry\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmodel_name\u001b[49m\u001b[43m]\u001b[49m\n",
+ "\u001b[0;31mKeyError\u001b[0m: 'daily_address_summary'"
+ ]
+ }
+ ],
"source": [
"from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
"\n",
"execute_model_in_memory(\n",
" duckdb_client=duckdb_client,\n",
- " model=\"daily_address_summary\",\n",
+ " model=\"refined_transactions_traces_address_models\",\n",
" data_reader=batch,\n",
")\n",
"\n",
diff --git a/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb b/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
index e28dfa3bcd1..0659433a923 100644
--- a/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
+++ b/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 18:21:53\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:53\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:53\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n"
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n"
]
}
],
@@ -68,46 +68,55 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:54\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:55\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:55\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:56\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:57\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:57\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
- "\u001b[2m2024-12-13 18:21:59\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m79296\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
- "dict_keys(['refined_transactions_fees_v1', 'refined_trace_calls_v1', 'event_emitting_transactions_v1', 'summary_v1'])\n"
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:37\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:37\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_from_to_hash\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_to_hash\u001b[0m\n",
+ "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_trace_calls_agg_to\u001b[0m\n",
+ "dict_keys(['refined_transactions_fees_v1', 'refined_trace_calls_v1', 'event_emitting_transactions_v1', 'summary_v1', 'refined_trace_calls_agg_from_to_hash_v1', 'refined_trace_calls_agg_to_hash_v1', 'daily_trace_calls_agg_to_v1'])\n"
]
},
{
"data": {
"text/plain": [
- "┌────────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├────────────────────────────────┤\n",
- "│ daily_address_summary │\n",
- "│ event_emitting_transactions │\n",
- "│ event_emitting_transactions_v1 │\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_logs_v1 │\n",
- "│ ingestion_traces_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ logs_topic0_filters │\n",
- "│ refined_trace_calls │\n",
- "│ refined_trace_calls_v1 │\n",
- "│ refined_transactions_fees │\n",
- "│ refined_transactions_fees_v1 │\n",
- "│ summary_v1 │\n",
- "├────────────────────────────────┤\n",
- "│ 13 rows │\n",
- "└────────────────────────────────┘"
+ "┌─────────────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├─────────────────────────────────────────┤\n",
+ "│ daily_address_summary │\n",
+ "│ daily_trace_calls_agg_to │\n",
+ "│ daily_trace_calls_agg_to_v1 │\n",
+ "│ event_emitting_transactions │\n",
+ "│ event_emitting_transactions_v1 │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_traces_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ logs_topic0_filters │\n",
+ "│ refined_trace_calls │\n",
+ "│ refined_trace_calls_agg_from_to_hash │\n",
+ "│ refined_trace_calls_agg_from_to_hash_v1 │\n",
+ "│ refined_trace_calls_agg_to_hash │\n",
+ "│ refined_trace_calls_agg_to_hash_v1 │\n",
+ "│ refined_trace_calls_v1 │\n",
+ "│ refined_transactions_fees │\n",
+ "│ refined_transactions_fees_v1 │\n",
+ "│ summary_v1 │\n",
+ "├─────────────────────────────────────────┤\n",
+ "│ 19 rows │\n",
+ "└─────────────────────────────────────────┘"
]
},
"execution_count": 2,
@@ -149,23 +158,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────┬──────────┬───────────────┬────────────┬─────────────┬────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬────────────┬─────────┬───────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬──────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬──────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
- "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ from_address │ to_address │ gas_limit │ gas_used │ trace_address │ trace_type │ tx_gas_used │ tx_l1_gas_used │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_method_id │ block_hour │ tx_success │ error │ method_id │ success │ trace_address_cardinality │ trace_address_uplevel │ count_traces_in_transaction │ gas_used_in_subtraces │ gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_gas_used_per_call_amortized │ tx_l1_gas_used_per_call_amortized │ tx_fee_native_per_call_amortized │ tx_l2_fee_native_per_call_amortized │ tx_l1_fee_native_per_call_amortized │ tx_l2_base_fee_native_per_call_amortized │ tx_l2_priority_fee_native_per_call_amortized │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
- "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
- "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────┼──────────┼───────────────┼────────────┼─────────────┼────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼────────────┼─────────┼───────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼──────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼──────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ 0 │ -1 │ 19 │ 135545 │ 35841 │ 4.9811242501917e-05 │ 8.3688735e-11 │ 4.9811242501917e-05 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 1 │ │ 19 │ 132840 │ 2705 │ 3.759365279085e-06 │ 6.316174999999999e-12 │ 3.759365279085e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 2 │ 0 │ 19 │ 69223 │ 63617 │ 8.841387835842901e-05 │ 1.48545695e-10 │ 8.841387835842901e-05 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ 3 │ 0,0 │ 19 │ 3542 │ 5918 │ 8.224740747366e-06 │ 1.381853e-11 │ 8.224740747366e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ 4 │ 0,0,0 │ 19 │ 547 │ 2995 │ 4.162402591815e-06 │ 6.993325e-12 │ 4.162402591815e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 5 │ 0,0,0,0 │ 19 │ 381 │ 166 │ 2.30704116942e-07 │ 3.8761e-13 │ 2.30704116942e-07 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 6 │ 0,0,0,0,0 │ 19 │ 0 │ 381 │ 5.29507641897e-07 │ 8.89635e-13 │ 5.29507641897e-07 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ 3 │ 0,0 │ 19 │ 7940 │ 9330 │ 1.296668319921e-05 │ 2.178555e-11 │ 1.296668319921e-05 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2674 │ 3.716281980138e-06 │ 6.2437899999999996e-12 │ 3.716281980138e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ call │ 171386 │ 1600 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2682 │ 3.727400250834e-06 │ 6.26247e-12 │ 3.727400250834e-06 │ 0.0 │ 9020.315789473685 │ 84.21052631578948 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
- "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────┴──────────┴───────────────┴────────────┴─────────────┴────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴────────────┴─────────┴───────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴──────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴──────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
- "│ 10 rows 53 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────┬─────────┬──────────┬────────────────────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬────────────────────────────┬────────────────────────────────┬──────────────────────────────┬────────────────────────────┬────────────────────────┬───────────────────────────────────┬──────────────────────────┬─────────────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬───────────────────────┬──────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────┬───────────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬──────────────────────────────┬────────────────────┬───────────────────────────────┬────────────────────────────────────┬───────────────────────────────────────────────┬───────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬─────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬─────────────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────┐\n",
+ "│ dt │ chain │ network │ chain_id │ trace_to_address │ count_transactions_called │ count_transactions_called_tx_success │ count_unique_blocks_called │ count_unique_tx_from_addresses │ count_unique_tx_to_addresses │ count_unique_tx_method_ids │ sum_tx_gas_used_called │ sum_tx_gas_used_called_tx_success │ sum_tx_fee_native_called │ sum_tx_fee_native_called_tx_success │ tx_l1_fee_native │ tx_l1_fee_native_tx_success │ tx_l2_fee_native │ tx_l2_fee_native_tx_success │ tx_l2_priority_fee_native │ tx_l2_priority_fee_native_tx_success │ tx_l2_base_fee_native │ tx_l2_base_fee_native_tx_success │ tx_l2_legacy_extra_fee_native │ tx_l2_legacy_extra_fee_native_tx_success │ avg_tx_l2_gas_price_gwei_called │ avg_tx_l2_priority_gas_price_gwei_called │ avg_tx_l2_legacy_extra_gas_price_gwei_called │ avg_tx_l1_base_gas_price_gwei_called │ avg_tx_l1_blob_base_gas_price_gwei_called │ sum_tx_input_byte_length_called │ sum_tx_input_zero_bytes_called │ sum_tx_input_nonzero_bytes_called │ sum_tx_l1_base_scaled_size_called │ sum_tx_l1_blob_scaled_size_called │ sum_tx_l1_gas_used_unified_called │ sum_tx_estimated_size_called │ sum_trace_gas_used │ sum_trace_gas_used_tx_success │ sum_trace_gas_used_minus_subtraces │ sum_trace_gas_used_minus_subtraces_tx_success │ sum_tx_gas_used_amortized_by_call │ sum_tx_gas_used_amortized_by_call_tx_success │ sum_tx_l1_gas_used_unified_amortized_by_call │ sum_tx_l1_base_scaled_size_amortized_by_call │ sum_tx_l1_blob_scaled_size_amortized_by_call │ sum_tx_estimated_size_amortized_by_call │ sum_tx_l2_fee_native_minus_subtraces │ sum_tx_l2_fee_native_minus_subtraces_tx_success │ sum_tx_l2_base_fee_native_minus_subtraces │ sum_tx_l2_priority_fee_native_minus_subtraces │ sum_tx_l2_legacy_base_fee_native_minus_subtraces │ sum_tx_fee_native_amortized_by_call │ sum_tx_fee_native_amortized_by_call_tx_success │ sum_tx_l2_fee_native_amortized_by_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success │ sum_tx_l1_fee_native_amortized_by_call │ sum_tx_l1_fee_native_amortized_by_call_tx_success │ sum_tx_l2_base_fee_native_amortized_by_call │ sum_tx_l2_priority_fee_native_amortized_by_call │ sum_tx_fee_native_l1_amortized_l2_minus_subtraces │ count_top_level_calls │ count_internal_calls_all_types │ count_internal_calls_all_types_trace_success │ count_internal_calls_static_type │ count_internal_calls_static_type_trace_success │ count_internal_calls_delegate_type │ count_internal_calls_delegate_type_trace_success │ count_internal_calls_call_type │ count_internal_calls_call_type_trace_success │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_unique_trace_from_addresses │\n",
+ "│ date │ varchar │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ int64 │ int64 │ decimal(38,0) │ double │ decimal(38,20) │ double │ double │ int64 │\n",
+ "├────────────┼─────────┼─────────┼──────────┼────────────────────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼────────────────────────────┼────────────────────────────────┼──────────────────────────────┼────────────────────────────┼────────────────────────┼───────────────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼───────────────────────┼──────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────┼───────────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼──────────────────────────────┼────────────────────┼───────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────────┼───────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14695 │ 13688 │ 1380 │ 341 │ 77 │ 299 │ 6452271886 │ 6250947632 │ 0.1219897937370507150 │ 0.1106332698372177340 │ 0.0046893913808264620 │ 0.0041940751403341490 │ 0.1173004023562242530 │ 0.1064391946968835850 │ 0.0952425665896049750 │ 0.0925352274339835120 │ 0.0000073738719558640 │ 0.0000070583473422090 │ 0.0220505987724079880 │ 0.0138970429090307190 │ 0.018179705447741612 │ 0.014761090089253715 │ 0.0034174937389499812 │ 8.201251243507212 │ 1.809727157458527 │ 1634709.0 │ 1108076.0 │ 526633.0 │ 153099.723817000000 │ 1856654.512526437500 │ 29290171 │ 1830873 │ 806347671 │ 749646962 │ 529558288 │ 500050621 │ 1068526615.5822927 │ 1046647297.4262667 │ 4888768.627139387 │ 25553.59361405734 │ 309890.79347730573 │ 305586.89104998065 │ 0.04029101981655442800 │ 0.03829338800582661200 │ 0.00000060506389677800 │ 0.03379136370802675700 │ 0.00649908218414147200 │ 0.019182016703136285 │ 0.01649740713228372 │ 0.01841420484700526 │ 0.015821709761356884 │ 0.0007678118561310304 │ 0.0006756973709268444 │ 1.1894692653723834e-06 │ 0.014623270722784026 │ 0.04105883167268544 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 3670 │ 14695 │ 288049460 │ 204823127.44738504 │ 0.03819199276620082500 │ 0.015445279151271056 │ 0.015644821523381112 │ 34 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 13054 │ 12803 │ 1379 │ 269 │ 94 │ 181 │ 6428944143 │ 6291511311 │ 0.0177214889376692160 │ 0.0171720726307182100 │ 0.0039149172970481770 │ 0.0036774312323045060 │ 0.0138065716406210390 │ 0.0134946413984137040 │ 0.0118712635101399800 │ 0.0117670453288556910 │ 0.0000073569861295260 │ 0.0000071245687027410 │ 0.0019280085884527420 │ 0.0017205254171395800 │ 0.0021475644108144864 │ 0.0018465339324911878 │ 0.00029989505983684853 │ 8.203521185800055 │ 1.798948965305693 │ 734430.0 │ 396845.0 │ 337585.0 │ 127261.627871000000 │ 1543313.532953062500 │ 24346973 │ 1521742 │ 793020153 │ 761387815 │ 602330824 │ 579413082 │ 800395406.3520414 │ 792614207.2110538 │ 2802019.568151297 │ 14646.15628272649 │ 177615.292017086 │ 175133.05163566952 │ 0.00223246010334795500 │ 0.00217883334892808100 │ 0.00000071272173782700 │ 0.00156035784691197600 │ 0.00067140258033343000 │ 0.001412668900401075 │ 0.0013457128649722674 │ 0.0009691987829059819 │ 0.0009275452134075283 │ 0.00044347011749509374 │ 0.00041816765156474004 │ 8.965536192711148e-07 │ 0.0007682652692257424 │ 0.0026759302208430496 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 2464 │ 13054 │ 403481910 │ 94993814.89057307 │ 0.00210707216596956100 │ 0.0006638033414379764 │ 0.0007307862989703063 │ 180 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 12419 │ 11983 │ 1379 │ 188 │ 39 │ 180 │ 5509275663 │ 5420289642 │ 0.0812010819017146630 │ 0.0740585349932124140 │ 0.0034191107584217350 │ 0.0032050065832735430 │ 0.0777819711432929280 │ 0.0708535284099388710 │ 0.0638217003754810510 │ 0.0618929396178460310 │ 0.0000061980374237800 │ 0.0000060440079740220 │ 0.0139541426180543950 │ 0.0089546128717087240 │ 0.014118366170288497 │ 0.01158440860095351 │ 0.0025328452362203746 │ 8.193557265424658 │ 1.77845501825804 │ 547535.0 │ 352895.0 │ 194640.0 │ 113804.857500000000 │ 1380122.033906250000 │ 21772500 │ 1360831 │ 247637741 │ 231751597 │ 34407198 │ 33173217 │ 181409113.2045715 │ 174851869.68935168 │ 1017011.7609458567 │ 5315.92047446403 │ 64466.6593190135 │ 63571.00859461225 │ 0.00161791364834116600 │ 0.00118483349730291200 │ 0.00000003820465697000 │ 0.00112362448665840500 │ 0.00049425184282953400 │ 0.012270676533798744 │ 0.010404734196149073 │ 0.012110766514152403 │ 0.010281284602777128 │ 0.00015991001964633017 │ 0.000123449593371934 │ 1.9596279262904913e-07 │ 0.009512241894549304 │ 0.0017778236679874967 │ 0 │ 18268 │ 17387 │ 15936 │ 15200 │ 0 │ 0 │ 2332 │ 2187 │ 1687 │ 12419 │ 5087651 │ 63075664.93452309 │ 0.00117079859301269400 │ 0.010217330953640719 │ 0.010275181596323601 │ 40 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 12057 │ 11735 │ 1379 │ 261 │ 53 │ 256 │ 5377586786 │ 5286455316 │ 0.0232969391423820980 │ 0.0209563174421668930 │ 0.0034168346898384660 │ 0.0032127940004109450 │ 0.0198801044525436320 │ 0.0177435234417559480 │ 0.0183407833558363430 │ 0.0171825434751415000 │ 0.0000061420894750850 │ 0.0000059943431254880 │ 0.0015332572510255230 │ 0.0005550591762551140 │ 0.0036968449313174194 │ 0.0034105973712195044 │ 0.0002851199454404348 │ 8.208016337742121 │ 1.8032290003079243 │ 527342.0 │ 313350.0 │ 213992.0 │ 111864.093308000000 │ 1356586.207028250000 │ 21401204 │ 1337655 │ 164208684 │ 151365149 │ 70348033 │ 63356929 │ 144491780.93517274 │ 137155589.65942404 │ 855428.0388996563 │ 4471.322359328464 │ 54224.139851035 │ 53474.66247289785 │ 0.00532948449070531800 │ 0.00479894612631183000 │ 0.00000009111683892700 │ 0.00497237357020249600 │ 0.00035703306041542600 │ 0.00377620339633381 │ 0.003335618883272324 │ 0.0036340183586927575 │ 0.0032277447102081473 │ 0.00014218503764105067 │ 0.00010787417306417667 │ 1.709256128511763e-07 │ 0.003277776599106972 │ 0.005471669528346368 │ 0 │ 13948 │ 13203 │ 12827 │ 12276 │ 0 │ 0 │ 1121 │ 927 │ 1483 │ 11943 │ 35182861 │ 25337952.36447993 │ 0.00478704417847796600 │ 0.003181593098840977 │ 0.003222434310232159 │ 40 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 11842 │ 11572 │ 1380 │ 185 │ 28 │ 96 │ 5374653125 │ 5292988684 │ 0.0301797184740908970 │ 0.0275751674917356450 │ 0.0032079598058830470 │ 0.0030595347433565770 │ 0.0269717586682078500 │ 0.0245156327483790680 │ 0.0239145630016689240 │ 0.0233415174566461200 │ 0.0000060837781266980 │ 0.0000059476070391350 │ 0.0030511622017185950 │ 0.0011682174216660980 │ 0.005018325469740496 │ 0.00444950817205881 │ 0.0005676947201534229 │ 8.203940575214546 │ 1.784020770292575 │ 429785.0 │ 279789.0 │ 149996.0 │ 106683.420209000000 │ 1293759.705141937500 │ 20410067 │ 1275735 │ 181978502 │ 162868323 │ 5260405 │ 4485759 │ 159789118.708217 │ 153283188.7768482 │ 768812.0511767175 │ 4018.5805915006304 │ 48733.69855375735 │ 48065.15414666977 │ 0.00047852347276841400 │ 0.00039545461476174600 │ 0.00000000628765871200 │ 0.00040979203771864100 │ 0.00006872555817834500 │ 0.004141314031135213 │ 0.003667228319724064 │ 0.004020001182121213 │ 0.003565688929790064 │ 0.00012131284901400016 │ 0.00010153938993400012 │ 1.806105462733887e-07 │ 0.003589790873218296 │ 0.0005998363217824134 │ 0 │ 15741 │ 14910 │ 14241 │ 13671 │ 0 │ 0 │ 1500 │ 1239 │ 1361 │ 11842 │ 2436607 │ 42156895.72476116 │ 0.00039430556297552000 │ 0.003517087848871931 │ 0.003557114042353152 │ 31 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 11629 │ 11335 │ 1379 │ 207 │ 55 │ 107 │ 5192960124 │ 5111471019 │ 0.0385805977857356220 │ 0.0286334499974164940 │ 0.0031220427054908210 │ 0.0029461056019041320 │ 0.0354585550802448010 │ 0.0256873443955123620 │ 0.0241924430564917020 │ 0.0230589995493936380 │ 0.0000058070135646340 │ 0.0000056921334498320 │ 0.0112603362586334100 │ 0.0026226792500277260 │ 0.006828197065555746 │ 0.004658699947392799 │ 0.0021683848883399227 │ 8.191009697732017 │ 1.7688029317897829 │ 414115.0 │ 252467.0 │ 161648.0 │ 104980.918358000000 │ 1273113.307712625000 │ 20084354 │ 1255348 │ 86492551 │ 73215959 │ 56703147 │ 49508128 │ 130637259.29100338 │ 125461323.54484165 │ 689248.7675517761 │ 3602.703307993061 │ 43690.31626781258 │ 43096.101888391546 │ 0.01268942514508051100 │ 0.00930790926353997200 │ 0.00000006653851932200 │ 0.00858835711056542700 │ 0.00410100821552410900 │ 0.005833905709314264 │ 0.004240585618287049 │ 0.005724012080796109 │ 0.004157020801367643 │ 0.00010989362851815141 │ 8.356481691940254e-05 │ 1.4716247230833444e-07 │ 0.004111370935708565 │ 0.012799318773598653 │ 0 │ 12356 │ 11892 │ 11626 │ 11361 │ 0 │ 0 │ 730 │ 531 │ 1146 │ 11557 │ 21451912 │ 14181568.32767524 │ 0.00929610137937214000 │ 0.004111318843136729 │ 0.004132350453560312 │ 42 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 11625 │ 11436 │ 1379 │ 144 │ 41 │ 78 │ 5243474206 │ 5156416961 │ 0.0156279882492578490 │ 0.0120260751312825160 │ 0.0031798546004170230 │ 0.0030353949259197480 │ 0.0124481336488408260 │ 0.0089906802053627680 │ 0.0092287612906324480 │ 0.0082244739389089310 │ 0.0000059226175323900 │ 0.0000057950450332990 │ 0.0032134892284338710 │ 0.0007604504932057870 │ 0.002374024007707844 │ 0.0017600470466836977 │ 0.000612854970232664 │ 8.199354679266955 │ 1.782327780315835 │ 410882.0 │ 237372.0 │ 173510.0 │ 105985.396175000000 │ 1285294.703114062500 │ 20276525 │ 1267359 │ 95945172 │ 87281000 │ 58705420 │ 53635007 │ 135901352.73302448 │ 132423493.65167841 │ 708131.3574124356 │ 3701.4026051947317 │ 44887.251774709555 │ 44272.13920975134 │ 0.00394576075872735100 │ 0.00284609070787392600 │ 0.00000006933728096700 │ 0.00272674599166435800 │ 0.00121895058248596000 │ 0.0021813819304510144 │ 0.0016119193447205016 │ 0.0020675144277595486 │ 0.001515000744396952 │ 0.00011386750269146593 │ 9.691860032354945e-05 │ 1.5394538980134926e-07 │ 0.0015480525615527282 │ 0.004059628261418815 │ 0 │ 12948 │ 12651 │ 12162 │ 12000 │ 0 │ 0 │ 786 │ 651 │ 1156 │ 11584 │ 25460939 │ 20585492.7916548 │ 0.00283264368853589000 │ 0.001461574560317471 │ 0.0014910806595664042 │ 33 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 11229 │ 11148 │ 1379 │ 112 │ 29 │ 36 │ 5112738802 │ 5072420427 │ 0.0073606840852945480 │ 0.0069919974138059380 │ 0.0029458763141605170 │ 0.0028672307683049090 │ 0.0044148077711340310 │ 0.0041247666455010290 │ 0.0036351253005716780 │ 0.0036088821030808790 │ 0.0000057153963770370 │ 0.0000056635089986220 │ 0.0007739834400406350 │ 0.0005102373445989130 │ 0.0008634917491593835 │ 0.0007109937435391166 │ 0.00015138333288957932 │ 8.193502166729221 │ 1.7649904093193 │ 261870.0 │ 143390.0 │ 118480.0 │ 99293.539879000000 │ 1204141.942812562500 │ 18996277 │ 1187293 │ 51980514 │ 49194255 │ 42759295 │ 40779725 │ 121989647.43375479 │ 120449310.63483883 │ 527661.900062017 │ 2758.0887516240928 │ 33447.5974154745 │ 32984.27131114666 │ 0.00089300422058779200 │ 0.00085632499342977600 │ 0.00000004833956906600 │ 0.00069597300470962000 │ 0.00019698531639617200 │ 0.0006574994656780434 │ 0.0005366275083218485 │ 0.000573451470950501 │ 0.0004623090708653184 │ 8.404799472754251e-05 │ 7.431843745652972e-05 │ 1.3623812352628944e-07 │ 0.00037373513973324476 │ 0.0009770522153153345 │ 0 │ 11557 │ 11397 │ 11251 │ 11133 │ 0 │ 0 │ 306 │ 264 │ 807 │ 11201 │ 12769625 │ 9330385.170053398 │ 0.00084456288257907200 │ 0.0004167685581526744 │ 0.0004295550972362154 │ 24 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 11006 │ 10984 │ 1379 │ 58 │ 20 │ 20 │ 5029780657 │ 5023913161 │ 0.0060735538237173350 │ 0.0059833504223231600 │ 0.0027876039974382160 │ 0.0027713824304713380 │ 0.0032859498262791190 │ 0.0032119679918518220 │ 0.0029589854273758550 │ 0.0029510050391285750 │ 0.0000055978250700170 │ 0.0000055886599657600 │ 0.0003213888708145280 │ 0.0002553965897387680 │ 0.0006532988315715174 │ 0.0005882931342657662 │ 6.389719407888049e-05 │ 8.189933307768259 │ 1.763358675368465 │ 103294.0 │ 42538.0 │ 60756.0 │ 94002.571853000000 │ 1139977.884144187500 │ 17984039 │ 1124012 │ 42819405 │ 41826096 │ 2483548 │ 2415801 │ 118984247.22848396 │ 118377092.17050248 │ 448078.0915806506 │ 2342.104184692024 │ 28402.914093517487 │ 28005.857080041802 │ 0.00001998465317498800 │ 0.00001851622456476300 │ 0.00000000286834802200 │ 0.00001576625271079400 │ 0.00000421557645465200 │ 0.0002530570242379544 │ 0.00023789094111646025 │ 0.00018271752514350672 │ 0.00017002447839809163 │ 7.033949909444786e-05 │ 6.786646271836875e-05 │ 1.3264413541765068e-07 │ 0.00014133350137056886 │ 9.032415226943577e-05 │ 0 │ 11480 │ 11373 │ 11377 │ 11276 │ 0 │ 0 │ 103 │ 97 │ 608 │ 11006 │ 378097 │ 7312093.923610215 │ 0.00001727900416486700 │ 0.00012261687323334195 │ 0.00012962667099010455 │ 19 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 10996 │ 10960 │ 1379 │ 48 │ 23 │ 24 │ 5052411568 │ 5031188403 │ 0.0057205865962422110 │ 0.0056176076708706290 │ 0.0028357061309091870 │ 0.0027957262675124070 │ 0.0028848804653330240 │ 0.0028218814033582220 │ 0.0025795299938098260 │ 0.0025711431104438020 │ 0.0000056444679973690 │ 0.0000056129856245520 │ 0.0002997150146508930 │ 0.0002451308301588750 │ 0.0005709907885582262 │ 0.0005105542094289311 │ 5.932117972121882e-05 │ 8.196171239543245 │ 1.7683514441472665 │ 171079.0 │ 87791.0 │ 83288.0 │ 95346.339467000000 │ 1156273.878298312500 │ 18241121 │ 1140081 │ 36625424 │ 35002403 │ 33996626 │ 32905182 │ 117861285.39334987 │ 117237656.57763085 │ 442175.52560038137 │ 2311.2514723131635 │ 28028.760396608337 │ 27637.25010558765 │ 0.00027396551375628900 │ 0.00027002799722618500 │ 0.00000003962761984600 │ 0.00024441422137034400 │ 0.00002951251985920000 │ 0.00021046070615958953 │ 0.00019855252410786478 │ 0.0001413515823386982 │ 0.00013183108474805707 │ 6.910912382089126e-05 │ 6.672143935980768e-05 │ 1.3145748689026882e-07 │ 0.00011163940987808386 │ 0.00034307463757718014 │ 0 │ 11193 │ 11126 │ 11081 │ 11043 │ 0 │ 0 │ 112 │ 83 │ 607 │ 10996 │ 4910454 │ 6164740.731893017 │ 0.00025775511051438900 │ 8.462144118505954e-05 │ 9.020902102423792e-05 │ 17 │\n",
+ "├────────────┴─────────┴─────────┴──────────┴────────────────────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴────────────────────────────┴────────────────────────────────┴──────────────────────────────┴────────────────────────────┴────────────────────────┴───────────────────────────────────┴──────────────────────────┴─────────────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴───────────────────────┴──────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────┴───────────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴──────────────────────────────┴────────────────────┴───────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────────────┴───────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴─────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴─────────────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────┤\n",
+ "│ 10 rows 78 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 3,
@@ -174,13 +183,14 @@
}
],
"source": [
- "duckdb_client.sql(\"\"\"\n",
- " SELECT * FROM refined_trace_calls_v1\n",
- " where transaction_hash = '0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda'\n",
- " AND block_number = 128145924\n",
- " ORDER BY trace_address ASC\n",
- " LIMIT 10\n",
- " \"\"\")"
+ "duckdb_client.sql(\"SELECT * FROM daily_trace_calls_agg_to_v1 ORDER BY count_transactions_called DESC LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Test Transaction Metrics"
]
},
{
@@ -191,23 +201,23 @@
{
"data": {
"text/plain": [
- "┌─────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────────────┬───────────────────────┬─────────┬───────────┐\n",
- "│ chain │ from_address │ to_address │ tx_fee_native_amortized │ tx_gas_used_amortized │ num_txs │ num_calls │\n",
- "│ varchar │ varchar │ varchar │ double │ double │ int64 │ int64 │\n",
- "├─────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────────────┼───────────────────────┼─────────┼───────────┤\n",
- "│ op │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 0.01984228587366746 │ 206503287.08812115 │ 6684 │ 24102 │\n",
- "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 0.012270676533798753 │ 181409113.2045721 │ 12419 │ 18268 │\n",
- "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 0.01067813349083112 │ 31450680.81716765 │ 1869 │ 4068 │\n",
- "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0.006808327150355245 │ 11008145.621250395 │ 739 │ 1466 │\n",
- "│ op │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0.006125945087181573 │ 3175354.4807279063 │ 188 │ 349 │\n",
- "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 0.0055345100190961685 │ 13710242.223767499 │ 966 │ 1415 │\n",
- "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0xc565f7ba9c56b157da983c4db30e13f5f06c59d9 │ 0.0053390667454155565 │ 15725340.408583831 │ 1869 │ 2034 │\n",
- "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0.0052924938575950094 │ 23877798.364569433 │ 2525 │ 3512 │\n",
- "│ op │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 0.00501805130922075 │ 9193205.190832019 │ 552 │ 833 │\n",
- "│ op │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0x4200000000000000000000000000000000000006 │ 0.004612185045687997 │ 14845981.801992826 │ 967 │ 1586 │\n",
- "├─────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────────────┴───────────────────────┴─────────┴───────────┤\n",
- "│ 10 rows 7 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
+ "│ trace_to_address │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
+ "│ varchar │ int64 │ int64 │ int64 │\n",
+ "├────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
+ "│ 0x4200000000000000000000000000000000000006 │ 8191 │ 8264 │ 8320 │\n",
+ "│ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 3975 │ 4012 │ 4068 │\n",
+ "│ 0x0000000000000000000000000000000000000001 │ 3676 │ 3927 │ 4639 │\n",
+ "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 3670 │ 14695 │ 14695 │\n",
+ "│ 0x4200000000000000000000000000000000000042 │ 3666 │ 3685 │ 3841 │\n",
+ "│ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 3068 │ 3471 │ 3471 │\n",
+ "│ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 3014 │ 3014 │ 3014 │\n",
+ "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 2464 │ 13054 │ 13054 │\n",
+ "├────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
+ "│ 10 rows 4 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 4,
@@ -217,18 +227,22 @@
],
"source": [
"duckdb_client.sql(\"\"\"\n",
- " SELECT chain, from_address, to_address\n",
- " , SUM(tx_fee_native_per_call_amortized) AS tx_fee_native_amortized\n",
- " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
- " , COUNT(DISTINCT transaction_hash) AS num_txs\n",
- " , COUNT(*) AS num_calls\n",
- " FROM refined_trace_calls_v1\n",
- " GROUP BY 1,2,3\n",
- " ORDER BY 4 DESC\n",
+ " SELECT trace_to_address,\n",
+ " count_transactions_called_with_internal_type_call, count_transactions_called_with_internal_type_call_or_delegate,\n",
+ " count_transactions_called\n",
+ " FROM daily_trace_calls_agg_to_v1\n",
+ " ORDER BY count_transactions_called_with_internal_type_call DESC\n",
" LIMIT 10\n",
" \"\"\")"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Test Gas Used Metrics"
+ ]
+ },
{
"cell_type": "code",
"execution_count": 5,
@@ -237,23 +251,23 @@
{
"data": {
"text/plain": [
- "┌─────────┬────────────────────────────────────────────┬────────────┬───────────────────────────────────────┬──────────────────────────────────┬──────────────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────────────────────────┬──────────────────────────┬───────────────────────┬─────────┬───────────┐\n",
- "│ chain │ to_address │ method_id │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ gas_used_minus_subtraces │ tx_fee_native_amortized │ tx_gas_used_amortized │ tx_fee_native_l1_amortized_l2_minus_subtraces │ gas_used_minus_subtraces │ tx_gas_used_amortized │ num_txs │ num_calls │\n",
- "│ varchar │ varchar │ varchar │ double │ double │ decimal(38,0) │ double │ double │ double │ decimal(38,0) │ double │ int64 │ int64 │\n",
- "├─────────┼────────────────────────────────────────────┼────────────┼───────────────────────────────────────┼──────────────────────────────────┼──────────────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────────────────────────┼──────────────────────────┼───────────────────────┼─────────┼───────────┤\n",
- "│ op │ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 0x9ff054df │ 5.174952896237992e-06 │ 1.8004188943487814e-05 │ 4140738114 │ 3.607112685741571e-05 │ 1389050444.4329228 │ 4.7656172137043205e-05 │ 4140738114 │ 1389050444.4329228 │ 326 │ 33037 │\n",
- "│ op │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 3.2568401079389976e-06 │ 0.0010683153210424413 │ 2942876799 │ 6.65785639444228e-05 │ 79211123.77754316 │ 0.0011061417841192833 │ 2942876799 │ 79211123.77754316 │ 6766 │ 6766 │\n",
- "│ op │ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 0xb1ae2ed1 │ 1.72403834768e-06 │ 5.543154580473999e-06 │ 1379290005 │ 3.520120981110036e-07 │ 13696759.836841851 │ 5.839542590379801e-06 │ 1379290005 │ 13696759.836841851 │ 325 │ 325 │\n",
- "│ op │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1.1581475066439993e-06 │ 0.0005499961607026094 │ 1047163102 │ 4.46055711276664e-05 │ 36282314.964982085 │ 0.0005755365112395222 │ 1047163102 │ 36282314.964982085 │ 4132 │ 4132 │\n",
- "│ op │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 0x022c0d9f │ 3.384370727930002e-07 │ 0.0015854822408981504 │ 266015077 │ 0.00021776773617876308 │ 26827815.199359253 │ 0.0016095264829950739 │ 266015077 │ 26827815.199359253 │ 1830 │ 3976 │\n",
- "│ op │ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 0x1c560305 │ 3.2550231868400006e-07 │ 4.275001198438411e-05 │ 197005008 │ 8.27594366476248e-06 │ 28416951.268856198 │ 4.443545424898916e-05 │ 197005008 │ 28416951.268856198 │ 32 │ 4068 │\n",
- "│ op │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 0x3850c7bd │ 2.5566371258498903e-07 │ 0.0006416230082392013 │ 230104893 │ 0.002771396783210153 │ 900603590.577735 │ 0.0011937857148023626 │ 230104893 │ 900603590.577735 │ 12883 │ 87157 │\n",
- "│ op │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 0x128acb08 │ 1.7850146736199996e-07 │ 0.03820034576304705 │ 135497644 │ 0.00589899034739893 │ 20379707.056646183 │ 0.03824197579684476 │ 135497644 │ 20379707.056646183 │ 2296 │ 2677 │\n",
- "│ op │ 0x4200000000000000000000000000000000000006 │ 0xa9059cbb │ 1.5023342879200017e-07 │ 0.008066713087357846 │ 114500894 │ 0.007241313753707096 │ 85910990.62567064 │ 0.008224337088685797 │ 114500894 │ 85910990.62567064 │ 5275 │ 9790 │\n",
- "│ op │ 0x4200000000000000000000000000000000000042 │ 0xa9059cbb │ 1.2411857105699984e-07 │ 0.008311508205302787 │ 91957505 │ 0.0057811880326216255 │ 54647064.36140897 │ 0.008435380574996963 │ 91957505 │ 54647064.36140897 │ 3392 │ 5196 │\n",
- "├─────────┴────────────────────────────────────────────┴────────────┴───────────────────────────────────────┴──────────────────────────────────┴──────────────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────────────────────────┴──────────────────────────┴───────────────────────┴─────────┴───────────┤\n",
- "│ 10 rows 13 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
+ "│ trace_to_address │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
+ "│ varchar │ decimal(38,0) │ double │ decimal(38,20) │ double │ int64 │ int64 │ int64 │\n",
+ "├────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
+ "│ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 4336291158 │ 1416977599.783289 │ 0.00006075181680298400 │ 4.428249782673902e-05 │ 357 │ 357 │ 357 │\n",
+ "│ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 1408738482 │ 1402224990.8886633 │ 0.00000562532943659800 │ 3.636351036943135e-05 │ 326 │ 326 │ 326 │\n",
+ "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 403481910 │ 94993814.89057307 │ 0.00210707216596956100 │ 0.0007307862989703063 │ 2464 │ 13054 │ 13054 │\n",
+ "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 288049460 │ 204823127.44738504 │ 0.03819199276620082500 │ 0.015644821523381112 │ 3670 │ 14695 │ 14695 │\n",
+ "│ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 220618821 │ 68159718.96890971 │ 0.00107271191945114100 │ 0.0004481642659551657 │ 946 │ 1097 │ 1175 │\n",
+ "│ 0x4200000000000000000000000000000000000006 │ 159906187 │ 252716979.5751807 │ 0.01377174827006443900 │ 0.02364533942470271 │ 8191 │ 8264 │ 8320 │\n",
+ "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 147222841 │ 180406504.91480613 │ 0.01486079382578650400 │ 0.01660686668994283 │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 134640530 │ 4448836.836776924 │ 0.00007106463186232300 │ 5.1367270293187554e-06 │ 517 │ 4132 │ 4132 │\n",
+ "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 119952045 │ 125551585.96841848 │ 0.00193008438541577500 │ 0.0032815324126219646 │ 3975 │ 4012 │ 4068 │\n",
+ "│ 0x4200000000000000000000000000000000000042 │ 103674485 │ 123213874.92716485 │ 0.00809187465620548800 │ 0.008077490671055848 │ 3666 │ 3685 │ 3841 │\n",
+ "├────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
+ "│ 10 rows 8 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 5,
@@ -263,72 +277,64 @@
],
"source": [
"duckdb_client.sql(\"\"\"\n",
- " SELECT chain, to_address, method_id\n",
- " , SUM(tx_l2_base_fee_native_minus_subtraces) AS tx_l2_base_fee_native_minus_subtraces\n",
- " , SUM(tx_l2_fee_native_minus_subtraces) AS tx_l2_fee_native_minus_subtraces\n",
- " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
- " , SUM(tx_fee_native_per_call_amortized) AS tx_fee_native_amortized\n",
- " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
- " , SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS tx_fee_native_l1_amortized_l2_minus_subtraces\n",
- " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
- " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
- " , COUNT(DISTINCT transaction_hash) AS num_txs\n",
- " , COUNT(*) AS num_calls\n",
- " FROM refined_trace_calls_v1\n",
- " GROUP BY 1,2,3\n",
- " ORDER BY 4 DESC\n",
+ " SELECT\n",
+ " trace_to_address,\n",
+ " \n",
+ " sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call,\n",
+ " sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call,\n",
+ " \n",
+ " sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call\n",
+ " sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call,\n",
+ " sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call,\n",
+ " \n",
+ " count_transactions_called_with_internal_type_call,\n",
+ " count_transactions_called_with_internal_type_call_or_delegate,\n",
+ " count_transactions_called\n",
+ " \n",
+ " FROM daily_trace_calls_agg_to_v1\n",
+ " ORDER BY sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call DESC\n",
" LIMIT 10\n",
" \"\"\")"
]
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "┌─────────┬────────────────────────────────────────────┬───────────────────────────────────────┬──────────────────────────────────┬──────────────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────────────────────────┬──────────────────────────┬───────────────────────┬─────────┬───────────┐\n",
- "│ chain │ to_address │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ gas_used_minus_subtraces │ tx_fee_native_amortized │ tx_gas_used_amortized │ tx_fee_native_l1_amortized_l2_minus_subtraces │ gas_used_minus_subtraces │ tx_gas_used_amortized │ num_txs │ num_calls │\n",
- "│ varchar │ varchar │ double │ double │ decimal(38,0) │ double │ double │ double │ decimal(38,0) │ double │ int64 │ int64 │\n",
- "├─────────┼────────────────────────────────────────────┼───────────────────────────────────────┼──────────────────────────────────┼──────────────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────────────────────────┼──────────────────────────┼───────────────────────┼─────────┼───────────┤\n",
- "│ op │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 6.050638967780253e-07 │ 0.04029101981655446 │ 529558288 │ 0.019182016703136347 │ 1068526615.5823003 │ 0.0410588316726855 │ 529558288 │ 1068526615.5823003 │ 14695 │ 108919 │\n",
- "│ op │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 3.3478649509999996e-08 │ 0.03293851659707459 │ 24663045 │ 0.01897902807032173 │ 15480950.408311438 │ 0.03297361627015615 │ 24663045 │ 15480950.408311438 │ 645 │ 1233 │\n",
- "│ op │ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 1.9456840452799985e-07 │ 0.01705440360559736 │ 166029433 │ 0.019842285873667473 │ 206503287.08812097 │ 0.01748343274821649 │ 166029433 │ 206503287.08812097 │ 6684 │ 24102 │\n",
- "│ op │ 0x4200000000000000000000000000000000000006 │ 2.3316792023799954e-07 │ 0.015431971262860111 │ 178430485 │ 0.026771242371313383 │ 286334678.66157997 │ 0.015998930668723665 │ 178430485 │ 286334678.66157997 │ 8320 │ 32006 │\n",
- "│ op │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 6.65385193219998e-08 │ 0.012689425145080506 │ 56703147 │ 0.005833905709314263 │ 130637259.29100353 │ 0.01279931877359867 │ 56703147 │ 130637259.29100353 │ 11629 │ 12356 │\n",
- "│ op │ 0x4200000000000000000000000000000000000042 │ 1.6444814631400037e-07 │ 0.0097273262673029 │ 125165161 │ 0.00990857277048237 │ 148085202.57725108 │ 0.01001047702579258 │ 125165161 │ 148085202.57725108 │ 3841 │ 15444 │\n",
- "│ op │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 5.067934249799999e-08 │ 0.009262629776185478 │ 38916418 │ 0.0118713804579046 │ 82267708.62408267 │ 0.00939493920090396 │ 38916418 │ 82267708.62408267 │ 3471 │ 10733 │\n",
- "│ op │ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 7.682785107299994e-08 │ 0.006820829227152148 │ 65627440 │ 0.019842285873667462 │ 206503287.08812094 │ 0.007249858369771295 │ 65627440 │ 206503287.08812094 │ 6684 │ 24102 │\n",
- "│ op │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 9.111683892699985e-08 │ 0.00532948449070532 │ 70348033 │ 0.0037762033963338057 │ 144491780.93517327 │ 0.005471669528346366 │ 70348033 │ 144491780.93517327 │ 12057 │ 13948 │\n",
- "│ op │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 6.9242942491e-08 │ 0.00481471283401902 │ 58246424 │ 0.005780227389582877 │ 69226356.25752687 │ 0.00512344419084279 │ 58246424 │ 69226356.25752687 │ 1690 │ 5304 │\n",
- "├─────────┴────────────────────────────────────────────┴───────────────────────────────────────┴──────────────────────────────────┴──────────────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────────────────────────┴──────────────────────────┴───────────────────────┴─────────┴───────────┤\n",
- "│ 10 rows 12 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬──────────────┬─────────────┬────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────────────┬─────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬─────────────────┬───────────────┬───────────────────────────┬───────────────────────┬─────────────────────────────┬─────────────────────────────┬────────────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ call_type │ tx_gas_used │ tx_l1_gas_used_unified │ tx_estimated_size │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_input_byte_length │ tx_input_zero_bytes │ tx_input_nonzero_bytes │ tx_l1_base_scaled_size │ tx_l1_blob_scaled_size │ tx_method_id │ block_hour │ tx_success │ error │ trace_method_id │ trace_success │ trace_address_cardinality │ trace_address_uplevel │ count_traces_in_transaction │ trace_gas_used_in_subtraces │ trace_gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ double │ double │ double │ decimal(38,12) │ decimal(38,12) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
+ "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼──────────────┼─────────────┼────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────────────┼─────────────────────┼────────────────────────┼────────────────────────┼────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼─────────────────┼───────────────┼───────────────────────────┼───────────────────────┼─────────────────────────────┼─────────────────────────────┼────────────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ 0 │ -1 │ 19 │ 135545 │ 35841 │ 0.00004981124250191700 │ 0.00000000008368873500 │ 0.00004981124250191700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 1 │ │ 19 │ 132840 │ 2705 │ 0.00000375936527908500 │ 0.00000000000631617500 │ 0.00000375936527908500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 2 │ 0 │ 19 │ 69223 │ 63617 │ 0.00008841387835842900 │ 0.00000000014854569500 │ 0.00008841387835842900 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ 3 │ 0,0 │ 19 │ 3542 │ 5918 │ 0.00000822474074736600 │ 0.00000000001381853000 │ 0.00000822474074736600 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ 4 │ 0,0,0 │ 19 │ 547 │ 2995 │ 0.00000416240259181500 │ 0.00000000000699332500 │ 0.00000416240259181500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 5 │ 0,0,0,0 │ 19 │ 381 │ 166 │ 0.00000023070411694200 │ 0.00000000000038761000 │ 0.00000023070411694200 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 6 │ 0,0,0,0,0 │ 19 │ 0 │ 381 │ 0.00000052950764189700 │ 0.00000000000088963500 │ 0.00000052950764189700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ 3 │ 0,0 │ 19 │ 7940 │ 9330 │ 0.00001296668319921000 │ 0.00000000002178555000 │ 0.00001296668319921000 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2674 │ 0.00000371628198013800 │ 0.00000000000624379000 │ 0.00000371628198013800 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2682 │ 0.00000372740025083400 │ 0.00000000000626247000 │ 0.00000372740025083400 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴──────────────┴─────────────┴────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────────────┴─────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴─────────────────┴───────────────┴───────────────────────────┴───────────────────────┴─────────────────────────────┴─────────────────────────────┴────────────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
+ "│ 10 rows 62 columns │\n",
+ "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
- "execution_count": 11,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"duckdb_client.sql(\"\"\"\n",
- " SELECT chain, to_address\n",
- " , SUM(tx_l2_base_fee_native_minus_subtraces) AS tx_l2_base_fee_native_minus_subtraces\n",
- " , SUM(tx_l2_fee_native_minus_subtraces) AS tx_l2_fee_native_minus_subtraces\n",
- " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
- " , SUM(tx_fee_native_per_call_amortized) AS tx_fee_native_amortized\n",
- " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
- " , SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS tx_fee_native_l1_amortized_l2_minus_subtraces\n",
- " , SUM(gas_used_minus_subtraces) AS gas_used_minus_subtraces\n",
- " , SUM(tx_gas_used_per_call_amortized) AS tx_gas_used_amortized\n",
- " , COUNT(DISTINCT transaction_hash) AS num_txs\n",
- " , COUNT(*) AS num_calls\n",
- " FROM refined_trace_calls_v1\n",
- " GROUP BY 1,2\n",
- " ORDER BY 4 DESC\n",
+ " SELECT * FROM refined_trace_calls_v1\n",
+ " where transaction_hash = '0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda'\n",
+ " AND block_number = 128145924\n",
+ " ORDER BY trace_address ASC\n",
" LIMIT 10\n",
" \"\"\")"
]
@@ -342,114 +348,77 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "┌──────────────────┬─────────┐\n",
- "│ interm_num_calls │ num_txs │\n",
- "│ int64 │ int64 │\n",
- "├──────────────────┼─────────┤\n",
- "│ 1274668 │ 33166 │\n",
- "└──────────────────┴─────────┘"
+ "┌──────────────────┬─────────┬───────────────┐\n",
+ "│ interm_num_calls │ num_txs │ num_trace_tos │\n",
+ "│ int64 │ int64 │ int64 │\n",
+ "├──────────────────┼─────────┼───────────────┤\n",
+ "│ 1274668 │ 33166 │ 43972 │\n",
+ "└──────────────────┴─────────┴───────────────┘"
]
},
- "execution_count": 12,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs FROM refined_trace_calls_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_trace_calls_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "┌────────────┐\n",
- "│ method_id │\n",
- "│ varchar │\n",
- "├────────────┤\n",
- "│ 0xa6f19c84 │\n",
- "│ 0xa34123a7 │\n",
- "│ 0x514ea4bf │\n",
- "│ 0xa6f19c84 │\n",
- "│ 0x4f1eb3d8 │\n",
- "│ 0x4f1eb3d8 │\n",
- "│ 0xa9059cbb │\n",
- "│ 0xdf2ab5bb │\n",
- "│ 0x2e1a7d4d │\n",
- "│ 0x2e1a7d4d │\n",
- "├────────────┤\n",
- "│ 10 rows │\n",
- "└────────────┘"
+ "┌──────────┬─────────┬───────────────┐\n",
+ "│ num_rows │ num_txs │ num_trace_tos │\n",
+ "│ int64 │ int64 │ int64 │\n",
+ "├──────────┼─────────┼───────────────┤\n",
+ "│ 528958 │ 33166 │ 43972 │\n",
+ "└──────────┴─────────┴───────────────┘"
]
},
- "execution_count": 7,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT method_id FROM refined_trace_calls_v1 LIMIT 10\")\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### You can also convert the results to dataframes to inspect them in more familiar ways"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_trace_calls_agg_to_hash_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
- "text/html": [
- "\n",
- "
shape: (5, 53)dt | chain | chain_id | network | block_number | block_timestamp | transaction_hash | transaction_index | from_address | to_address | gas_limit | gas_used | trace_address | trace_type | tx_gas_used | tx_l1_gas_used | tx_from_address | tx_to_address | tx_fee_native | tx_l1_fee_native | tx_l2_fee_native | tx_l2_priority_fee_native | tx_l2_base_fee_native | tx_l2_legacy_extra_fee_native | tx_l2_gas_price_gwei | tx_l2_base_gas_price_gwei | tx_l2_priority_gas_price_gwei | tx_l2_legacy_extra_gas_price_gwei | tx_l1_base_gas_price_gwei | tx_l1_blob_base_gas_price_gwei | tx_method_id | block_hour | tx_success | error | method_id | success | trace_address_cardinality | trace_address_uplevel | count_traces_in_transaction | gas_used_in_subtraces | gas_used_minus_subtraces | tx_l2_fee_native_minus_subtraces | tx_l2_base_fee_native_minus_subtraces | tx_l2_priority_fee_native_minus_subtraces | tx_l2_legacy_base_fee_native_minus_subtraces | tx_gas_used_per_call_amortized | tx_l1_gas_used_per_call_amortized | tx_fee_native_per_call_amortized | tx_l2_fee_native_per_call_amortized | tx_l1_fee_native_per_call_amortized | tx_l2_base_fee_native_per_call_amortized | tx_l2_priority_fee_native_per_call_amortized | tx_fee_native_l1_amortized_l2_minus_subtraces |
---|
date | str | i32 | str | i64 | u32 | str | i64 | str | str | i64 | i64 | str | str | i64 | i64 | str | str | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | str | datetime[μs] | bool | str | str | bool | i64 | str | i64 | decimal[38,0] | decimal[38,0] | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 532667 | 5136 | "0,1" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0xa6f19c84" | true | 2 | "0" | 27 | 2470 | 2666 | 6.6669e-9 | 1.8582e-12 | 6.6650e-9 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.6573e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 525605 | 84738 | "0,2" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0xa34123a7" | true | 2 | "0" | 27 | 84551 | 187 | 4.6763e-10 | 1.3034e-13 | 4.6750e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0373e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 441068 | 1250 | "0,3" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0x514ea4bf" | true | 2 | "0" | 27 | 1057 | 193 | 4.8264e-10 | 1.3452e-13 | 4.8250e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0388e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 401968 | 636 | "1,1" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0xa6f19c84" | true | 2 | "1" | 27 | 470 | 166 | 4.1512e-10 | 1.1570e-13 | 4.1500e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0321e-8 |
2024-11-18 | "op" | 10 | "mainnet" | 128144652 | 1731888081 | "0xd11bb31573669ca4a4cf0df6cdf6… | 9 | "0x416b433906b1b72fa758e166e239… | "0x478946bcd4a5a22b316470f5486f… | 399004 | 89966 | "1,2" | "call" | 306540 | 3949 | "0xaa971288ea224d94014d7cafd31f… | "0x416b433906b1b72fa758e166e239… | 0.0000010340242394010 | 0.0000002674575156210 | 0.0000007665667237800 | 0.0000007663530654000 | 0.0000000002136583800 | 0.0000000000000000000 | 0.0025007070 | 0.0000006970 | 0.0025000100 | 0.0000000000 | 7.1662697820 | 0.4773961980 | "0xac9650d8" | 2024-11-18 00:00:00 | true | "" | "0x4f1eb3d8" | true | 2 | "1" | 27 | 89767 | 199 | 4.9764e-10 | 1.3870e-13 | 4.9750e-10 | 0.0 | 11353.333333 | 146.259259 | 3.8297e-8 | 2.8391e-8 | 9.9058e-9 | 7.9133e-12 | 2.8383e-8 | 1.0403e-8 |
"
- ],
"text/plain": [
- "shape: (5, 53)\n",
- "┌────────────┬───────┬──────────┬─────────┬───┬─────────────┬────────────┬────────────┬────────────┐\n",
- "│ dt ┆ chain ┆ chain_id ┆ network ┆ … ┆ tx_l1_fee_n ┆ tx_l2_base ┆ tx_l2_prio ┆ tx_fee_nat │\n",
- "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ ative_per_c ┆ _fee_nativ ┆ rity_fee_n ┆ ive_l1_amo │\n",
- "│ date ┆ str ┆ i32 ┆ str ┆ ┆ all_amor… ┆ e_per_call ┆ ative_per_ ┆ rtized_l2_ │\n",
- "│ ┆ ┆ ┆ ┆ ┆ --- ┆ … ┆ … ┆ … │\n",
- "│ ┆ ┆ ┆ ┆ ┆ f64 ┆ --- ┆ --- ┆ --- │\n",
- "│ ┆ ┆ ┆ ┆ ┆ ┆ f64 ┆ f64 ┆ f64 │\n",
- "╞════════════╪═══════╪══════════╪═════════╪═══╪═════════════╪════════════╪════════════╪════════════╡\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.6573e-8 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0373e-8 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0388e-8 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0321e-8 │\n",
- "│ 2024-11-18 ┆ op ┆ 10 ┆ mainnet ┆ … ┆ 9.9058e-9 ┆ 7.9133e-12 ┆ 2.8383e-8 ┆ 1.0403e-8 │\n",
- "└────────────┴───────┴──────────┴─────────┴───┴─────────────┴────────────┴────────────┴────────────┘"
+ "┌──────────┬───────────────┐\n",
+ "│ num_rows │ num_trace_tos │\n",
+ "│ int64 │ int64 │\n",
+ "├──────────┼───────────────┤\n",
+ "│ 43972 │ 43972 │\n",
+ "└──────────┴───────────────┘"
]
},
- "execution_count": 8,
+ "execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM refined_trace_calls_v1 LIMIT 5\").pl()"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM daily_trace_calls_agg_to_v1\")"
]
},
{
@@ -461,51 +430,51 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "┌───────────────────────────────────────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐\n",
- "│ column_name │ column_type │ null │ key │ default │ extra │\n",
- "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
- "├───────────────────────────────────────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤\n",
- "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ tx_l2_priority_fee_native_minus_subtraces │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_l2_legacy_base_fee_native_minus_subtraces │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_gas_used_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_l1_gas_used_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_l2_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_l1_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_l2_base_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_l2_priority_fee_native_per_call_amortized │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ tx_fee_native_l1_amortized_l2_minus_subtraces │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "├───────────────────────────────────────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 53 rows (20 shown) 6 columns │\n",
- "└─────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌──────────────────────────────────────────────────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├──────────────────────────────────────────────────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ trace_to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_called │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_called_tx_success │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_blocks_called │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_tx_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_tx_to_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ count_internal_calls_call_type │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_internal_calls_call_type_trace_success │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_called_with_internal_type_call │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_called_with_internal_type_call_or_delegate │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,20) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_trace_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "├──────────────────────────────────────────────────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 78 rows (20 shown) 6 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"DESCRIBE refined_trace_calls_v1\")\n"
+ "duckdb_client.sql(\"DESCRIBE daily_trace_calls_agg_to_v1\")\n"
]
}
],
diff --git a/src/op_analytics/datapipeline/models/code/daily_address_summary.py b/src/op_analytics/datapipeline/models/code/daily_address_summary_old.py
similarity index 87%
rename from src/op_analytics/datapipeline/models/code/daily_address_summary.py
rename to src/op_analytics/datapipeline/models/code/daily_address_summary_old.py
index 01027c4d7b3..25f8f38aed3 100644
--- a/src/op_analytics/datapipeline/models/code/daily_address_summary.py
+++ b/src/op_analytics/datapipeline/models/code/daily_address_summary_old.py
@@ -15,7 +15,7 @@
# ),
# ],
# )
-# def daily_address_summary(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
+# def daily_address_summary_old(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations:
# return {
# "summary_v1": duckdb_client.view("daily_address_summary"),
# }
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py b/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
index 26cc6f9580e..051aee6b087 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
@@ -39,6 +39,18 @@
template_name="daily_address_summary",
context={},
),
+ TemplatedSQLQuery(
+ template_name="refined_trace_calls_agg_from_to_hash",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="refined_trace_calls_agg_to_hash",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="daily_trace_calls_agg_to",
+ context={},
+ ),
],
)
def refined_transactions_traces_address_models(
@@ -49,4 +61,9 @@ def refined_transactions_traces_address_models(
"refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
"event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
"summary_v1": duckdb_client.view("daily_address_summary"),
+ "refined_trace_calls_agg_from_to_hash_v1": duckdb_client.view(
+ "refined_trace_calls_agg_from_to_hash"
+ ),
+ "refined_trace_calls_agg_to_hash_v1": duckdb_client.view("refined_trace_calls_agg_to_hash"),
+ "daily_trace_calls_agg_to_v1": duckdb_client.view("daily_trace_calls_agg_to"),
}
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index 1d0de1cd3b9..5a63165994f 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -44,9 +44,9 @@ SELECT
sum(if(success, receipt_gas_used, 0)) AS success_l2_gas_used_sum,
- sum(l1_gas_used) AS l1_gas_used_sum,
+ sum(l1_gas_used_unified) AS l1_gas_used_unified_sum,
- sum(if(success, l1_gas_used, 0)) AS success_l1_gas_used_sum,
+ sum(if(success, l1_gas_used_unified, 0)) AS success_l1_gas_used_unified_sum,
wei_to_eth(sum(tx_fee)) AS tx_fee_sum_eth,
@@ -83,11 +83,26 @@ SELECT
) AS l1_base_price_avg_gwei,
wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
- AS l1_blob_fee_avg_gwei
+ AS l1_blob_fee_avg_gwei,
+
+ -- Data Processed
+ sum(input_zero_bytes) AS input_zero_bytes_sum,
+ sum(if(success, input_zero_bytes, 0)) AS success_input_zero_bytes_sum,
+
+ sum(input_nonzero_bytes) AS input_nonzero_bytes_sum,
+ sum(if(success, input_nonzero_bytes, 0)) AS success_input_nonzero_bytes_sum,
+
+ sum(input_byte_length) AS input_byte_length_sum,
+ sum(if(success, input_byte_length, 0)) AS success_input_byte_length_sum,
+
+ sum(estimated_size) AS estimated_size_sum,
+ sum(if(success, estimated_size, 0)) AS success_estimated_size_sum
FROM
refined_transactions_fees
-WHERE gas_price > 0
+WHERE
+ NOT is_system_transaction
+ AND gas_price > 0
GROUP BY
1,
2,
diff --git a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2
new file mode 100644
index 00000000000..9190098c349
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2
@@ -0,0 +1,162 @@
+-- Aggreagte traces by day and the contract called (to address)
+-- This will be used as the final table for dashboards that show the most used contracts in aggregate
+
+-- Get Unique contracts that call this contract, since we lose this granularity at the to_hash level
+WITH get_unique_callers AS (
+ SELECT
+ dt, chain_id, trace_to_address,
+ COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses
+ FROM refined_trace_calls_agg_from_to_hash
+ GROUP BY
+ dt, chain, network, chain_id, trace_to_address
+)
+
+, raw_aggregation AS (
+SELECT
+dt, chain, network, chain_id, trace_to_address
+-- Aggregate transaction metrics, in transactions when a given contract was called
+/*
+ Note: We can NOT sum these up at the project level, since a project may have
+ many of its contracts called in a single transaction.
+
+ For these use cases (i.e. project impact metrics), we can aggregate `daily_trace_calls_agg_to_hash`
+ at the project name level, only after all trace_to_address entries are mapped to their respective
+ project name (i.e. a transaction may call 10 contracts, but this may only represent 3 projects).
+*/
+-- Attributes
+ , COUNT(*) AS count_transactions_called
+ , COUNT(*) FILTER (WHERE tx_success) AS count_transactions_called_tx_success
+ , COUNT(DISTINCT block_number) AS count_unique_blocks_called
+ , COUNT(DISTINCT tx_from_address) AS count_unique_tx_from_addresses
+ , COUNT(DISTINCT tx_to_address) AS count_unique_tx_to_addresses
+ , COUNT(DISTINCT tx_method_id) AS count_unique_tx_method_ids
+-- Transaction-Level gas & fees
+ , SUM(tx_gas_used) AS sum_tx_gas_used_called
+ , SUM(tx_gas_used) FILTER (WHERE tx_success) AS sum_tx_gas_used_called_tx_success
+
+ , SUM(tx_fee_native) AS sum_tx_fee_native_called
+ , SUM(tx_fee_native) FILTER (WHERE tx_success) AS sum_tx_fee_native_called_tx_success
+
+ , SUM(tx_l1_fee_native) AS tx_l1_fee_native
+ , SUM(tx_l1_fee_native) FILTER (WHERE tx_success) AS tx_l1_fee_native_tx_success
+
+ , SUM(tx_l2_fee_native) AS tx_l2_fee_native
+ , SUM(tx_l2_fee_native) FILTER (WHERE tx_success) AS tx_l2_fee_native_tx_success
+
+ , SUM(tx_l2_priority_fee_native) AS tx_l2_priority_fee_native
+ , SUM(tx_l2_priority_fee_native) FILTER (WHERE tx_success) AS tx_l2_priority_fee_native_tx_success
+
+ , SUM(tx_l2_base_fee_native) AS tx_l2_base_fee_native
+ , SUM(tx_l2_base_fee_native) FILTER (WHERE tx_success) AS tx_l2_base_fee_native_tx_success
+
+ , SUM(tx_l2_legacy_extra_fee_native) AS tx_l2_legacy_extra_fee_native
+ , SUM(tx_l2_legacy_extra_fee_native) FILTER (WHERE tx_success) AS tx_l2_legacy_extra_fee_native_tx_success
+
+ -- Transaction-Level Gas Prices
+ , SUM(tx_gas_used * tx_l2_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l2_gas_price_gwei_called
+ , SUM(tx_gas_used * tx_l2_priority_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l2_priority_gas_price_gwei_called
+ , SUM(tx_gas_used * tx_l2_legacy_extra_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l2_legacy_extra_gas_price_gwei_called
+ , SUM(tx_gas_used * tx_l1_base_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l1_base_gas_price_gwei_called
+ , SUM(tx_gas_used * tx_l1_blob_base_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l1_blob_base_gas_price_gwei_called
+ -- Transaction-Level transaction sizes
+ , SUM(tx_input_byte_length) AS sum_tx_input_byte_length_called
+ , SUM(tx_input_zero_bytes) AS sum_tx_input_zero_bytes_called
+ , SUM(tx_input_nonzero_bytes) AS sum_tx_input_nonzero_bytes_called
+ , SUM(tx_l1_base_scaled_size) AS sum_tx_l1_base_scaled_size_called
+ , SUM(tx_l1_blob_scaled_size) AS sum_tx_l1_blob_scaled_size_called
+ , SUM(tx_l1_gas_used_unified) AS sum_tx_l1_gas_used_unified_called
+ , SUM(tx_estimated_size) AS sum_tx_estimated_size_called
+
+-- Sum Internal Trace Gas
+/*
+ Note: As opposed to transaction-level equivalent metrics, these CAN be summed up at a project level.
+ These methodologies were designed to distribute gas usage and fees across each call, so that they
+ still represent a "part of a whole," whereas transaction-level metrics do not.
+*/
+
+ , SUM(sum_trace_gas_used) AS sum_trace_gas_used
+ , SUM(sum_trace_gas_used) FILTER (WHERE tx_success) AS sum_trace_gas_used_tx_success
+
+ , SUM(sum_trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces
+ , SUM(sum_trace_gas_used_minus_subtraces) FILTER (WHERE tx_success) AS sum_trace_gas_used_minus_subtraces_tx_success
+
+
+ , SUM(sum_tx_gas_used_amortized_by_call) AS sum_tx_gas_used_amortized_by_call
+ , SUM(sum_tx_gas_used_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_gas_used_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
+ , SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
+ , SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call
+ , SUM(sum_tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call
+
+ , SUM(sum_tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_minus_subtraces_tx_success
+
+ , SUM(sum_tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces
+
+ , SUM(sum_tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call
+ , SUM(sum_tx_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_fee_native_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call
+ , SUM(sum_tx_l1_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l1_fee_native_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call
+
+ , SUM(sum_tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces
+
+ -- Calls
+ , SUM(count_top_level_calls) AS count_top_level_calls
+ --count non-null trace addresses, null is the transaction-level call.
+ , SUM(count_internal_calls_all_types) AS count_internal_calls_all_types
+ , SUM(count_internal_calls_all_types_trace_success) AS count_internal_calls_all_types_trace_success
+ --static calls only read state, and can not write
+ , SUM(count_internal_calls_static_type) AS count_internal_calls_static_type
+ , SUM(count_internal_calls_static_type_trace_success) AS count_internal_calls_static_type_trace_success
+ --delegate calls call a function on another contract
+ , SUM(count_internal_calls_delegate_type) AS count_internal_calls_delegate_type
+ , SUM(count_internal_calls_delegate_type_trace_success) AS count_internal_calls_delegate_type_trace_success
+ --normal function calls
+ , SUM(count_internal_calls_call_type) AS count_internal_calls_call_type
+ , SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success
+
+ -- Experimental
+ , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call) AS count_transactions_called_with_internal_type_call
+ , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call_or_delegate) AS count_transactions_called_with_internal_type_call_or_delegate
+
+ , SUM(sum_trace_gas_used_minus_subtraces) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call
+, SUM(sum_tx_gas_used_amortized_by_call) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call
+, SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call
+, SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
+, SUM(sum_tx_fee_native_amortized_by_call) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
+
+
+FROM refined_trace_calls_agg_to_hash
+
+GROUP BY
+dt, chain, network, chain_id, trace_to_address
+)
+
+SELECT
+ra.*, gu.count_unique_trace_from_addresses
+
+FROM raw_aggregation ra
+LEFT JOIN get_unique_callers gu
+ON ra.trace_to_address = gu.trace_to_address
+AND ra.dt = gu.dt
+AND ra.chain_id = gu.chain_id
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
index 8b3c5d98ace..120de86a724 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
@@ -33,22 +33,22 @@ SELECT
-- Join Transaction Fields
t.tx_fee_native,
- t.l1_fee_native,
+ t.l1_fee_native AS tx_l1_fee_native,
-- gas fees
- t.l2_fee_native,
+ t.l2_fee_native AS tx_l2_fee_native,
- t.l1_base_fee_native,
- t.l1_blob_fee_native,
+ t.l1_base_fee_native AS tx_l1_base_fee_native,
+ t.l1_blob_fee_native AS tx_l1_blob_fee_native,
- t.l2_base_fee_native,
- t.l2_priority_fee_native,
+ t.l2_base_fee_native AS tx_l2_base_fee_native,
+ t.l2_priority_fee_native AS tx_l2_priority_fee_native,
- t.l2_legacy_extra_fee_native,
- t.input_byte_length,
- t.input_calldata_gas,
+ t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native,
+ t.input_byte_length AS tx_input_byte_length,
-- transaction attributes
- t.l1_gas_used,
- t.receipt_gas_used,
+ t.l1_gas_used_unified AS tx_l1_gas_used_unified,
+ t.estimated_size AS tx_estimated_size,
+ t.receipt_gas_used AS tx_receipt_gas_used,
ee.count_total_events
> ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events
AS is_qualified_tx_not_approval_wrapping_transfer,
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
index 05ce7dec2cd..a5496f8abd8 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
@@ -13,15 +13,16 @@ base_level_trace_calls AS (
r.block_timestamp,
r.transaction_hash,
r.transaction_index,
- r.from_address,
- r.to_address,
- r.gas AS gas_limit,
- r.gas_used,
+ r.from_address AS trace_from_address,
+ r.to_address AS trace_to_address,
+ r.gas AS trace_gas_limit,
+ r.gas_used AS trace_gas_used,
r.trace_address,
- r.trace_type,
+ r.call_type,
-- Raw Transaction Fields
t.receipt_gas_used AS tx_gas_used,
- t.l1_gas_used AS tx_l1_gas_used,
+ t.l1_gas_used_unified AS tx_l1_gas_used_unified,
+ t.estimated_size AS tx_estimated_size,
t.from_address AS tx_from_address,
t.to_address AS tx_to_address,
-- Computed Transaction Fee Fields
@@ -38,6 +39,12 @@ base_level_trace_calls AS (
t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei,
t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei,
t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei,
+ -- Computed Transaction Size Fields
+ t.input_byte_length AS tx_input_byte_length,
+ t.input_zero_bytes AS tx_input_zero_bytes,
+ t.input_nonzero_bytes AS tx_input_nonzero_bytes,
+ t.l1_base_scaled_size AS tx_l1_base_scaled_size,
+ t.l1_blob_scaled_size AS tx_l1_blob_scaled_size,
t.method_id AS tx_method_id,
t.block_hour,
@@ -45,8 +52,8 @@ base_level_trace_calls AS (
-- Convenience columns
t.success AS tx_success,
r.error,
- hexstr_method_id(r.input) AS method_id,
- r.status = 1 AS success,
+ hexstr_method_id(r.input) AS trace_method_id,
+ r.status = 1 AS trace_success,
--Get the next trace level up so that we can subtract subtrace gas
CASE
@@ -84,26 +91,28 @@ base_level_trace_calls AS (
--get amount of calls per transcation, to use for amortizing
get_traces_per_tansaction AS (
SELECT
+ dt, chain_id,
block_number,
block_timestamp,
transaction_hash,
count(*) AS count_traces_in_transaction
FROM base_level_trace_calls
- GROUP BY 1, 2, 3
+ GROUP BY 1, 2, 3, 4, 5
),
--get subtrace gas used, for isolating each call
get_subtraces_gas_per_trace AS (
SELECT
+ dt, chain_id,
block_number,
block_timestamp,
transaction_hash,
trace_address_uplevel,
trace_address_cardinality,
- sum(gas_used) AS gas_used_in_subtraces,
+ sum(trace_gas_used) AS trace_gas_used_in_subtraces,
count(*) AS count_subtraces_in_trace
FROM base_level_trace_calls
- GROUP BY 1, 2, 3, 4, 5
+ GROUP BY 1, 2, 3, 4, 5, 6, 7
)
@@ -111,43 +120,49 @@ SELECT
bl.*,
--
tpt.count_traces_in_transaction,
- coalesce(st.gas_used_in_subtraces, 0) AS gas_used_in_subtraces,
+ coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_in_subtraces,
--
- bl.gas_used - coalesce(st.gas_used_in_subtraces, 0) AS gas_used_minus_subtraces,
+ bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_minus_subtraces,
-- the subtraces will never add up to part of whole, but leave as is
- (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_gas_price_gwei)::DOUBLE AS tx_l2_fee_native_minus_subtraces,
- (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_base_gas_price_gwei)::DOUBLE AS tx_l2_base_fee_native_minus_subtraces,
- (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei)::DOUBLE AS tx_l2_priority_fee_native_minus_subtraces,
- (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei)::DOUBLE AS tx_l2_legacy_base_fee_native_minus_subtraces,
- --
- bl.tx_gas_used / tpt.count_traces_in_transaction AS tx_gas_used_per_call_amortized,
- bl.tx_l1_gas_used / tpt.count_traces_in_transaction AS tx_l1_gas_used_per_call_amortized,
-
- bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_per_call_amortized,
- bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_per_call_amortized,
- bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_per_call_amortized,
- bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_per_call_amortized,
- bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_per_call_amortized,
+ (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_l2_fee_native_minus_subtraces,
+ (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_base_gas_price_gwei) AS tx_l2_base_fee_native_minus_subtraces,
+ (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei) AS tx_l2_priority_fee_native_minus_subtraces,
+ (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei) AS tx_l2_legacy_base_fee_native_minus_subtraces,
+
+ -- Amortize evenly across all calls
+ bl.tx_gas_used / tpt.count_traces_in_transaction AS tx_gas_used_amortized_by_call,
+ bl.tx_l1_gas_used_unified / tpt.count_traces_in_transaction AS tx_l1_gas_used_unified_amortized_by_call,
+ bl.tx_l1_base_scaled_size / tpt.count_traces_in_transaction AS tx_l1_base_scaled_size_amortized_by_call,
+ bl.tx_l1_blob_scaled_size / tpt.count_traces_in_transaction AS tx_l1_blob_scaled_size_amortized_by_call,
+ bl.tx_estimated_size / tpt.count_traces_in_transaction AS tx_estimated_size_amortized_by_call,
+
+ bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_amortized_by_call,
+ bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_amortized_by_call,
+ bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_amortized_by_call,
+ bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_amortized_by_call,
+ bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_amortized_by_call,
--
(bl.tx_l1_fee_native / tpt.count_traces_in_transaction)
- + (bl.gas_used - coalesce(st.gas_used_in_subtraces, 0))
+ + (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
* gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_fee_native_l1_amortized_l2_minus_subtraces
FROM base_level_trace_calls AS bl
INNER JOIN get_traces_per_tansaction AS tpt -- join on txn level
- ON
- bl.block_number = tpt.block_number
+ ON bl.dt = tpt.dt
+ AND bl.chain_id = tpt.chain_id
+ AND bl.block_number = tpt.block_number
AND bl.transaction_hash = tpt.transaction_hash
LEFT JOIN get_subtraces_gas_per_trace AS st -- join on trace level 1 level down
- ON
- bl.block_number = st.block_number
+ ON bl.dt = st.dt
+ AND bl.chain_id = st.chain_id
+ AND bl.block_number = st.block_number
AND bl.transaction_hash = st.transaction_hash
AND bl.trace_address_cardinality = (st.trace_address_cardinality - 1)
AND bl.trace_address = st.trace_address_uplevel
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2
new file mode 100644
index 00000000000..4b572aef635
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2
@@ -0,0 +1,87 @@
+-- NOTE: May not materialize this for now. We expect to use the to/from/method as our most granular in practice
+
+/*
+ Aggregate Trace Calls by day at the trace from/to and transaction hash level.
+ This is our most granular aggregation of traces, and comes enriched with transaction and trace gas fields.
+
+ Use cases include:
+ - Reducing table size for a better query and model-building experience than raw traces.
+ - Investigating specific transactions to see where the internal gas usage comes from.
+ - Investigating specific to / from combinations to evaluate what top-level user actions call them.
+*/
+
+SELECT
+ -- Descriptors
+ dt, chain, network, chain_id
+ , trace_from_address, trace_to_address, block_timestamp, block_number
+ , tx_from_address, tx_to_address, transaction_hash, tx_method_id
+ -- Transaction-Level gas & fees
+ , tx_gas_used
+ , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
+ , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
+ -- Transaction-Level Gas Prices
+ , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei
+ , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei
+ -- Transaction-Level transaction sizes
+ , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes
+ , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
+ -- Attributes
+ , tx_success
+
+ -- Sum Internal Trace Gas
+ , SUM(trace_gas_used) AS sum_trace_gas_used
+ , SUM(trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces
+
+ , SUM(tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces
+ , SUM(tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces
+ , SUM(tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces
+ , SUM(tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces
+
+ , SUM(tx_gas_used_amortized_by_call) AS sum_tx_gas_used_amortized_by_call
+ , SUM(tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
+ , SUM(tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
+ , SUM(tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call
+ , SUM(tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call
+
+ , SUM(tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call
+ , SUM(tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call
+ , SUM(tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call
+ , SUM(tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call
+ , SUM(tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call
+
+ , SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces
+
+ -- Count Call Types
+ , COUNT(*) FILTER (WHERE trace_address = '') AS count_top_level_calls
+ --count non-null trace addresses, null is the transaction-level call.
+ , COUNT(*) FILTER (WHERE trace_address != '') AS count_internal_calls_all_types
+ , COUNT(*) FILTER (WHERE trace_address != '' AND trace_success) AS count_internal_calls_all_types_trace_success
+ --static calls only read state, and can not write
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'staticcall') AS count_internal_calls_static_type
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'staticcall' AND trace_success) AS count_internal_calls_static_type_trace_success
+ --delegate calls call a function on another contract
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'delegatecall') AS count_internal_calls_delegate_type
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'delegatecall' AND trace_success) AS count_internal_calls_delegate_type_trace_success
+ --normal function calls
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'call') AS count_internal_calls_call_type
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'call' AND trace_success) AS count_internal_calls_call_type_trace_success
+
+FROM refined_trace_calls
+
+GROUP BY
+ -- Descriptors
+ dt, chain, network, chain_id
+ , trace_from_address, trace_to_address, block_timestamp, block_number
+ , tx_from_address, tx_to_address, transaction_hash, tx_method_id
+ -- Transaction-Level gas & fees
+ , tx_gas_used
+ , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
+ , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
+ -- Transaction-Level Gas Prices
+ , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei
+ , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei
+ -- Transaction-Level transaction sizes
+ , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes
+ , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
+ -- Attributes
+ , tx_success
\ No newline at end of file
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2
new file mode 100644
index 00000000000..75dcb0e50b7
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2
@@ -0,0 +1,101 @@
+
+-- Base-Level Aggregation view to generate unique transaction & to combinations before we aggregate up
+
+WITH get_transactions_by_call_type AS (
+-- Tag Transactions by internal call types
+SELECT dt, chain_id, block_number, transaction_hash
+ , SUM(count_internal_calls_call_type) > 0 AS is_transaction_with_internal_call_type_call
+ , SUM(coalesce(count_internal_calls_call_type,0)+coalesce(count_internal_calls_delegate_type,0)) > 0 AS is_transaction_with_internal_call_type_call_or_delegate
+ FROM refined_trace_calls_agg_from_to_hash
+ GROUP BY
+ dt, chain_id, block_number, transaction_hash
+
+)
+
+, raw_aggregation AS (
+SELECT
+dt, chain, network, chain_id,
+ trace_to_address, transaction_hash, block_timestamp, block_number,
+ tx_from_address, tx_to_address, tx_method_id
+-- Transaction-Level gas & fees
+ , tx_gas_used
+ , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
+ , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
+ -- Transaction-Level Gas Prices
+ , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei
+ , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei
+ -- Transaction-Level transaction sizes
+ , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes
+ , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
+ -- Attributes
+ , tx_success
+
+-- Sum Internal Trace Gas
+ , SUM(sum_trace_gas_used) AS sum_trace_gas_used
+ , SUM(sum_trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces
+ , SUM(sum_tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces
+
+ , SUM(sum_tx_gas_used_amortized_by_call) AS sum_tx_gas_used_amortized_by_call
+ , SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
+ , SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
+ , SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call
+ , SUM(sum_tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call
+
+ , SUM(sum_tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call
+ , SUM(sum_tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call
+
+ , SUM(sum_tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces
+
+ -- Calls
+ , SUM(count_top_level_calls) AS count_top_level_calls
+ --count non-null trace addresses, null is the transaction-level call.
+ , SUM(count_internal_calls_all_types) AS count_internal_calls_all_types
+ , SUM(count_internal_calls_all_types_trace_success) AS count_internal_calls_all_types_trace_success
+ --static calls only read state, and can not write
+ , SUM(count_internal_calls_static_type) AS count_internal_calls_static_type
+ , SUM(count_internal_calls_static_type_trace_success) AS count_internal_calls_static_type_trace_success
+ --delegate calls call a function on another contract
+ , SUM(count_internal_calls_delegate_type) AS count_internal_calls_delegate_type
+ , SUM(count_internal_calls_delegate_type_trace_success) AS count_internal_calls_delegate_type_trace_success
+ --normal function calls
+ , SUM(count_internal_calls_call_type) AS count_internal_calls_call_type
+ , SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success
+
+FROM refined_trace_calls_agg_from_to_hash
+
+GROUP BY
+dt, chain, network, chain_id,
+ trace_to_address, transaction_hash, block_timestamp, block_number,
+ tx_from_address, tx_to_address, tx_method_id
+-- Transaction-Level gas & fees
+ , tx_gas_used
+ , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
+ , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
+ -- Transaction-Level Gas Prices
+ , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei
+ , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei
+ -- Transaction-Level transaction sizes
+ , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes
+ , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
+ -- Attributes
+ , tx_success
+
+)
+
+SELECT
+ra.*,
+ gt.is_transaction_with_internal_call_type_call,
+ gt.is_transaction_with_internal_call_type_call_or_delegate
+
+FROM raw_aggregation AS ra
+ LEFT JOIN get_transactions_by_call_type AS gt
+ ON ra.dt = gt.dt
+ AND ra.chain_id = gt.chain_id
+ AND ra.block_number = gt.block_number
+ AND ra.transaction_hash = gt.transaction_hash
\ No newline at end of file
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 0b63222048c..ef6558c1dd5 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -34,31 +34,33 @@ pt1 AS (
b.base_fee_per_gas,
t.max_priority_fee_per_gas,
t.transaction_type,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
-- L2 Fees and breakdown into BASE and PRIORITY contributions
- if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas,
+ t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar,
+ CASE WHEN t.gas_price = 0 THEN 0
+ ELSE t.receipt_l1_fee END AS l1_fee,
+ if(t.max_priority_fee_per_gas = 0 AND t.gas_price > 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas,
+ -- Convenience columns
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
- -- Convenience columns
CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
- epoch_to_hour(t.block_timestamp) AS block_hour,
- hexstr_method_id(t.input) AS method_id,
-- L1 Fee BASE and BLOB scalars
- t.receipt_status = 1 AS success,
+
micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar,
- t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar,
+ micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar,
- -- Transaction Attributes
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
+ hexstr_method_id(t.input) AS method_id,
+ t.receipt_status = 1 AS success,
hexstr_bytelen(t.input) AS input_byte_length,
hexstr_zero_bytes(t.input) AS input_zero_bytes,
hexstr_nonzero_bytes(t.input) AS input_nonzero_bytes,
- t.transaction_type = 126 AS is_system_transaction,
+ t.transaction_type = 126 OR t.gas_price = 0 AS is_system_transaction,
( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
- t.transaction_type = 126
+ (t.transaction_type = 126 OR t.gas_price = 0)
AND t.from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
AND t.to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction
+ ) AS is_attributes_deposited_transaction,
+
+ epoch_to_hour(t.block_timestamp) AS block_hour
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b
@@ -68,24 +70,27 @@ pt1 AS (
-- AND from_address LIKE '0x00%'
),
-
-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
+-- Ecotone+ specs on L1 Fee Calculations: https://specs.optimism.io/protocol/exec-engine.html#l1-cost-fees-l1-fee-vault
+-- Fjord+ specs on Estimated Size: https://specs.optimism.io/protocol/fjord/predeploys.html#l1-gas-usage-estimation
pt2 AS (
SELECT
*,
+ -- Note that this is the "unified" L1 Gas Used, since the meaning of the field has changed in Fjord.
coalesce(
receipt_l1_gas_used,
- round(16 * estimated_size)::INT64
- ) AS l1_gas_used
+ 16 * estimated_size
+ ) AS l1_gas_used_unified
FROM (
SELECT
*,
-- Estimated Size in bytes calculation, post-Fjord. This is not equivalent to L1 Gas Used
- l1_fee / (
- (16 * l1_base_fee_scalar * receipt_l1_gas_price)
- + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
- ) AS estimated_size_bytes
- FROM pt1
+ (l1_fee / (
+ (16 * l1_base_fee_scalar * receipt_l1_gas_price)
+ + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
+ ))::INT64
+ AS estimated_size
+ FROM pt1
)
),
@@ -103,12 +108,12 @@ pt3 AS (
if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee,
--
-- L1 Base
- div16(l1_gas_used) * COALESCE(16*l1_base_fee_scalar,l1_fee_scalar) * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * COALESCE(16*l1_base_fee_scalar,l1_fee_scalar) AS l1_base_scaled_size,
+ div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) AS l1_base_scaled_size,
--
-- L1 Blob
- div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
+ coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee,0) AS l1_blob_fee,
+ coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar,0) AS l1_blob_scaled_size
FROM pt2
)
From 7112e821aeac807281cf75216a0108746bf9b71b Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Sat, 14 Dec 2024 22:21:31 -0500
Subject: [PATCH 25/32] split txs and traces - push tx aggregates
---
....ipynb => refined_traces_models_dev.ipynb} | 218 +++++----
...ined_transactions_address_models_dev.ipynb | 416 ++++++++++++++++++
.../models/code/refined_traces_models.py | 62 +++
... refined_transactions_addresses_models.py} | 28 +-
.../templates/daily_address_summary.sql.j2 | 11 +-
....j2 => daily_trace_calls_agg_tr_to.sql.j2} | 29 +-
.../daily_trace_calls_agg_tr_to_tx_to.sql.j2 | 169 +++++++
...ansactions_agg_tx_from_tx_to_method.sql.j2 | 67 +++
.../daily_transactions_agg_tx_to.sql.j2 | 65 +++
...daily_transactions_agg_tx_to_method.sql.j2 | 66 +++
.../event_emitting_transactions.sql.j2 | 2 +-
.../templates/refined_trace_calls.sql.j2 | 5 +-
...trace_calls_agg_tr_from_tr_to_hash.sql.j2} | 11 +-
...refined_trace_calls_agg_tr_to_hash.sql.j2} | 15 +-
.../refined_transactions_fees.sql.j2 | 18 +-
.../models/templates/transaction_fees.sql.j2 | 136 ------
16 files changed, 1011 insertions(+), 307 deletions(-)
rename notebooks/adhoc/{refined_transactions_traces_address_models_dev.ipynb => refined_traces_models_dev.ipynb} (54%)
create mode 100644 notebooks/adhoc/refined_transactions_address_models_dev.ipynb
create mode 100644 src/op_analytics/datapipeline/models/code/refined_traces_models.py
rename src/op_analytics/datapipeline/models/code/{refined_transactions_traces_address_models.py => refined_transactions_addresses_models.py} (66%)
rename src/op_analytics/datapipeline/models/templates/{daily_trace_calls_agg_to.sql.j2 => daily_trace_calls_agg_tr_to.sql.j2} (86%)
create mode 100644 src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_from_tx_to_method.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to.sql.j2
create mode 100644 src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to_method.sql.j2
rename src/op_analytics/datapipeline/models/templates/{refined_trace_calls_agg_from_to_hash.sql.j2 => refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2} (96%)
rename src/op_analytics/datapipeline/models/templates/{refined_trace_calls_agg_to_hash.sql.j2 => refined_trace_calls_agg_tr_to_hash.sql.j2} (93%)
delete mode 100644 src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2
diff --git a/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb b/notebooks/adhoc/refined_traces_models_dev.ipynb
similarity index 54%
rename from notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
rename to notebooks/adhoc/refined_traces_models_dev.ipynb
index 0659433a923..8ea3ccc7f2c 100644
--- a/notebooks/adhoc/refined_transactions_traces_address_models_dev.ipynb
+++ b/notebooks/adhoc/refined_traces_models_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n"
+ "\u001b[2m2024-12-14 22:09:13\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:13\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:13\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n"
]
}
],
@@ -32,11 +32,12 @@
"\n",
"from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
"\n",
+ "model_name = \"refined_traces_models\"\n",
"\n",
"# Define the input data range.\n",
"read_batches: list[DataReader] = construct_data_readers(\n",
" chains=[\"op\"],\n",
- " models=[\"refined_transactions_traces_address_models\"],\n",
+ " models=[model_name],\n",
" range_spec=\"@20241118:+1\",\n",
" read_from=DataLocation.GCS\n",
")\n",
@@ -68,55 +69,46 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:36\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:37\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:37\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:39\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_from_to_hash\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_to_hash\u001b[0m\n",
- "\u001b[2m2024-12-14 17:31:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m25566\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_trace_calls_agg_to\u001b[0m\n",
- "dict_keys(['refined_transactions_fees_v1', 'refined_trace_calls_v1', 'event_emitting_transactions_v1', 'summary_v1', 'refined_trace_calls_agg_from_to_hash_v1', 'refined_trace_calls_agg_to_hash_v1', 'daily_trace_calls_agg_to_v1'])\n"
+ "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_tr_from_tr_to_hash\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_tr_to_hash\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_trace_calls_agg_tr_to_tx_to\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_trace_calls_agg_tr_to\u001b[0m\n",
+ "dict_keys(['refined_trace_calls_v1', 'refined_trace_calls_agg_tr_from_tr_to_hash_v1', 'refined_trace_calls_agg_to_hash_v1', 'daily_trace_calls_agg_tr_to_tx_to_v1', 'daily_trace_calls_agg_to_v1'])\n"
]
},
{
"data": {
"text/plain": [
- "┌─────────────────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├─────────────────────────────────────────┤\n",
- "│ daily_address_summary │\n",
- "│ daily_trace_calls_agg_to │\n",
- "│ daily_trace_calls_agg_to_v1 │\n",
- "│ event_emitting_transactions │\n",
- "│ event_emitting_transactions_v1 │\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_logs_v1 │\n",
- "│ ingestion_traces_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ logs_topic0_filters │\n",
- "│ refined_trace_calls │\n",
- "│ refined_trace_calls_agg_from_to_hash │\n",
- "│ refined_trace_calls_agg_from_to_hash_v1 │\n",
- "│ refined_trace_calls_agg_to_hash │\n",
- "│ refined_trace_calls_agg_to_hash_v1 │\n",
- "│ refined_trace_calls_v1 │\n",
- "│ refined_transactions_fees │\n",
- "│ refined_transactions_fees_v1 │\n",
- "│ summary_v1 │\n",
- "├─────────────────────────────────────────┤\n",
- "│ 19 rows │\n",
- "└─────────────────────────────────────────┘"
+ "┌───────────────────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├───────────────────────────────────────────────┤\n",
+ "│ daily_trace_calls_agg_to_v1 │\n",
+ "│ daily_trace_calls_agg_tr_to │\n",
+ "│ daily_trace_calls_agg_tr_to_tx_to │\n",
+ "│ daily_trace_calls_agg_tr_to_tx_to_v1 │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_traces_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ refined_trace_calls │\n",
+ "│ refined_trace_calls_agg_to_hash_v1 │\n",
+ "│ refined_trace_calls_agg_tr_from_tr_to_hash │\n",
+ "│ refined_trace_calls_agg_tr_from_tr_to_hash_v1 │\n",
+ "│ refined_trace_calls_agg_tr_to_hash │\n",
+ "│ refined_trace_calls_v1 │\n",
+ "│ refined_transactions_fees │\n",
+ "├───────────────────────────────────────────────┤\n",
+ "│ 14 rows │\n",
+ "└───────────────────────────────────────────────┘"
]
},
"execution_count": 2,
@@ -129,7 +121,7 @@
"\n",
"execute_model_in_memory(\n",
" duckdb_client=duckdb_client,\n",
- " model=\"refined_transactions_traces_address_models\",\n",
+ " model=model_name,\n",
" data_reader=batch,\n",
" limit_input_parquet_files=1\n",
")\n",
@@ -147,7 +139,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Verify model results"
+ "## Verify model results - Traces"
]
},
{
@@ -158,23 +150,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────┬─────────┬──────────┬────────────────────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬────────────────────────────┬────────────────────────────────┬──────────────────────────────┬────────────────────────────┬────────────────────────┬───────────────────────────────────┬──────────────────────────┬─────────────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬───────────────────────┬──────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────┬───────────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬──────────────────────────────┬────────────────────┬───────────────────────────────┬────────────────────────────────────┬───────────────────────────────────────────────┬───────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬─────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬─────────────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────┐\n",
- "│ dt │ chain │ network │ chain_id │ trace_to_address │ count_transactions_called │ count_transactions_called_tx_success │ count_unique_blocks_called │ count_unique_tx_from_addresses │ count_unique_tx_to_addresses │ count_unique_tx_method_ids │ sum_tx_gas_used_called │ sum_tx_gas_used_called_tx_success │ sum_tx_fee_native_called │ sum_tx_fee_native_called_tx_success │ tx_l1_fee_native │ tx_l1_fee_native_tx_success │ tx_l2_fee_native │ tx_l2_fee_native_tx_success │ tx_l2_priority_fee_native │ tx_l2_priority_fee_native_tx_success │ tx_l2_base_fee_native │ tx_l2_base_fee_native_tx_success │ tx_l2_legacy_extra_fee_native │ tx_l2_legacy_extra_fee_native_tx_success │ avg_tx_l2_gas_price_gwei_called │ avg_tx_l2_priority_gas_price_gwei_called │ avg_tx_l2_legacy_extra_gas_price_gwei_called │ avg_tx_l1_base_gas_price_gwei_called │ avg_tx_l1_blob_base_gas_price_gwei_called │ sum_tx_input_byte_length_called │ sum_tx_input_zero_bytes_called │ sum_tx_input_nonzero_bytes_called │ sum_tx_l1_base_scaled_size_called │ sum_tx_l1_blob_scaled_size_called │ sum_tx_l1_gas_used_unified_called │ sum_tx_estimated_size_called │ sum_trace_gas_used │ sum_trace_gas_used_tx_success │ sum_trace_gas_used_minus_subtraces │ sum_trace_gas_used_minus_subtraces_tx_success │ sum_tx_gas_used_amortized_by_call │ sum_tx_gas_used_amortized_by_call_tx_success │ sum_tx_l1_gas_used_unified_amortized_by_call │ sum_tx_l1_base_scaled_size_amortized_by_call │ sum_tx_l1_blob_scaled_size_amortized_by_call │ sum_tx_estimated_size_amortized_by_call │ sum_tx_l2_fee_native_minus_subtraces │ sum_tx_l2_fee_native_minus_subtraces_tx_success │ sum_tx_l2_base_fee_native_minus_subtraces │ sum_tx_l2_priority_fee_native_minus_subtraces │ sum_tx_l2_legacy_base_fee_native_minus_subtraces │ sum_tx_fee_native_amortized_by_call │ sum_tx_fee_native_amortized_by_call_tx_success │ sum_tx_l2_fee_native_amortized_by_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success │ sum_tx_l1_fee_native_amortized_by_call │ sum_tx_l1_fee_native_amortized_by_call_tx_success │ sum_tx_l2_base_fee_native_amortized_by_call │ sum_tx_l2_priority_fee_native_amortized_by_call │ sum_tx_fee_native_l1_amortized_l2_minus_subtraces │ count_top_level_calls │ count_internal_calls_all_types │ count_internal_calls_all_types_trace_success │ count_internal_calls_static_type │ count_internal_calls_static_type_trace_success │ count_internal_calls_delegate_type │ count_internal_calls_delegate_type_trace_success │ count_internal_calls_call_type │ count_internal_calls_call_type_trace_success │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_unique_trace_from_addresses │\n",
- "│ date │ varchar │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ int64 │ int64 │ decimal(38,0) │ double │ decimal(38,20) │ double │ double │ int64 │\n",
- "├────────────┼─────────┼─────────┼──────────┼────────────────────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼────────────────────────────┼────────────────────────────────┼──────────────────────────────┼────────────────────────────┼────────────────────────┼───────────────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼───────────────────────┼──────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────┼───────────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼──────────────────────────────┼────────────────────┼───────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────────┼───────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14695 │ 13688 │ 1380 │ 341 │ 77 │ 299 │ 6452271886 │ 6250947632 │ 0.1219897937370507150 │ 0.1106332698372177340 │ 0.0046893913808264620 │ 0.0041940751403341490 │ 0.1173004023562242530 │ 0.1064391946968835850 │ 0.0952425665896049750 │ 0.0925352274339835120 │ 0.0000073738719558640 │ 0.0000070583473422090 │ 0.0220505987724079880 │ 0.0138970429090307190 │ 0.018179705447741612 │ 0.014761090089253715 │ 0.0034174937389499812 │ 8.201251243507212 │ 1.809727157458527 │ 1634709.0 │ 1108076.0 │ 526633.0 │ 153099.723817000000 │ 1856654.512526437500 │ 29290171 │ 1830873 │ 806347671 │ 749646962 │ 529558288 │ 500050621 │ 1068526615.5822927 │ 1046647297.4262667 │ 4888768.627139387 │ 25553.59361405734 │ 309890.79347730573 │ 305586.89104998065 │ 0.04029101981655442800 │ 0.03829338800582661200 │ 0.00000060506389677800 │ 0.03379136370802675700 │ 0.00649908218414147200 │ 0.019182016703136285 │ 0.01649740713228372 │ 0.01841420484700526 │ 0.015821709761356884 │ 0.0007678118561310304 │ 0.0006756973709268444 │ 1.1894692653723834e-06 │ 0.014623270722784026 │ 0.04105883167268544 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 3670 │ 14695 │ 288049460 │ 204823127.44738504 │ 0.03819199276620082500 │ 0.015445279151271056 │ 0.015644821523381112 │ 34 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 13054 │ 12803 │ 1379 │ 269 │ 94 │ 181 │ 6428944143 │ 6291511311 │ 0.0177214889376692160 │ 0.0171720726307182100 │ 0.0039149172970481770 │ 0.0036774312323045060 │ 0.0138065716406210390 │ 0.0134946413984137040 │ 0.0118712635101399800 │ 0.0117670453288556910 │ 0.0000073569861295260 │ 0.0000071245687027410 │ 0.0019280085884527420 │ 0.0017205254171395800 │ 0.0021475644108144864 │ 0.0018465339324911878 │ 0.00029989505983684853 │ 8.203521185800055 │ 1.798948965305693 │ 734430.0 │ 396845.0 │ 337585.0 │ 127261.627871000000 │ 1543313.532953062500 │ 24346973 │ 1521742 │ 793020153 │ 761387815 │ 602330824 │ 579413082 │ 800395406.3520414 │ 792614207.2110538 │ 2802019.568151297 │ 14646.15628272649 │ 177615.292017086 │ 175133.05163566952 │ 0.00223246010334795500 │ 0.00217883334892808100 │ 0.00000071272173782700 │ 0.00156035784691197600 │ 0.00067140258033343000 │ 0.001412668900401075 │ 0.0013457128649722674 │ 0.0009691987829059819 │ 0.0009275452134075283 │ 0.00044347011749509374 │ 0.00041816765156474004 │ 8.965536192711148e-07 │ 0.0007682652692257424 │ 0.0026759302208430496 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 2464 │ 13054 │ 403481910 │ 94993814.89057307 │ 0.00210707216596956100 │ 0.0006638033414379764 │ 0.0007307862989703063 │ 180 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 12419 │ 11983 │ 1379 │ 188 │ 39 │ 180 │ 5509275663 │ 5420289642 │ 0.0812010819017146630 │ 0.0740585349932124140 │ 0.0034191107584217350 │ 0.0032050065832735430 │ 0.0777819711432929280 │ 0.0708535284099388710 │ 0.0638217003754810510 │ 0.0618929396178460310 │ 0.0000061980374237800 │ 0.0000060440079740220 │ 0.0139541426180543950 │ 0.0089546128717087240 │ 0.014118366170288497 │ 0.01158440860095351 │ 0.0025328452362203746 │ 8.193557265424658 │ 1.77845501825804 │ 547535.0 │ 352895.0 │ 194640.0 │ 113804.857500000000 │ 1380122.033906250000 │ 21772500 │ 1360831 │ 247637741 │ 231751597 │ 34407198 │ 33173217 │ 181409113.2045715 │ 174851869.68935168 │ 1017011.7609458567 │ 5315.92047446403 │ 64466.6593190135 │ 63571.00859461225 │ 0.00161791364834116600 │ 0.00118483349730291200 │ 0.00000003820465697000 │ 0.00112362448665840500 │ 0.00049425184282953400 │ 0.012270676533798744 │ 0.010404734196149073 │ 0.012110766514152403 │ 0.010281284602777128 │ 0.00015991001964633017 │ 0.000123449593371934 │ 1.9596279262904913e-07 │ 0.009512241894549304 │ 0.0017778236679874967 │ 0 │ 18268 │ 17387 │ 15936 │ 15200 │ 0 │ 0 │ 2332 │ 2187 │ 1687 │ 12419 │ 5087651 │ 63075664.93452309 │ 0.00117079859301269400 │ 0.010217330953640719 │ 0.010275181596323601 │ 40 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 12057 │ 11735 │ 1379 │ 261 │ 53 │ 256 │ 5377586786 │ 5286455316 │ 0.0232969391423820980 │ 0.0209563174421668930 │ 0.0034168346898384660 │ 0.0032127940004109450 │ 0.0198801044525436320 │ 0.0177435234417559480 │ 0.0183407833558363430 │ 0.0171825434751415000 │ 0.0000061420894750850 │ 0.0000059943431254880 │ 0.0015332572510255230 │ 0.0005550591762551140 │ 0.0036968449313174194 │ 0.0034105973712195044 │ 0.0002851199454404348 │ 8.208016337742121 │ 1.8032290003079243 │ 527342.0 │ 313350.0 │ 213992.0 │ 111864.093308000000 │ 1356586.207028250000 │ 21401204 │ 1337655 │ 164208684 │ 151365149 │ 70348033 │ 63356929 │ 144491780.93517274 │ 137155589.65942404 │ 855428.0388996563 │ 4471.322359328464 │ 54224.139851035 │ 53474.66247289785 │ 0.00532948449070531800 │ 0.00479894612631183000 │ 0.00000009111683892700 │ 0.00497237357020249600 │ 0.00035703306041542600 │ 0.00377620339633381 │ 0.003335618883272324 │ 0.0036340183586927575 │ 0.0032277447102081473 │ 0.00014218503764105067 │ 0.00010787417306417667 │ 1.709256128511763e-07 │ 0.003277776599106972 │ 0.005471669528346368 │ 0 │ 13948 │ 13203 │ 12827 │ 12276 │ 0 │ 0 │ 1121 │ 927 │ 1483 │ 11943 │ 35182861 │ 25337952.36447993 │ 0.00478704417847796600 │ 0.003181593098840977 │ 0.003222434310232159 │ 40 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 11842 │ 11572 │ 1380 │ 185 │ 28 │ 96 │ 5374653125 │ 5292988684 │ 0.0301797184740908970 │ 0.0275751674917356450 │ 0.0032079598058830470 │ 0.0030595347433565770 │ 0.0269717586682078500 │ 0.0245156327483790680 │ 0.0239145630016689240 │ 0.0233415174566461200 │ 0.0000060837781266980 │ 0.0000059476070391350 │ 0.0030511622017185950 │ 0.0011682174216660980 │ 0.005018325469740496 │ 0.00444950817205881 │ 0.0005676947201534229 │ 8.203940575214546 │ 1.784020770292575 │ 429785.0 │ 279789.0 │ 149996.0 │ 106683.420209000000 │ 1293759.705141937500 │ 20410067 │ 1275735 │ 181978502 │ 162868323 │ 5260405 │ 4485759 │ 159789118.708217 │ 153283188.7768482 │ 768812.0511767175 │ 4018.5805915006304 │ 48733.69855375735 │ 48065.15414666977 │ 0.00047852347276841400 │ 0.00039545461476174600 │ 0.00000000628765871200 │ 0.00040979203771864100 │ 0.00006872555817834500 │ 0.004141314031135213 │ 0.003667228319724064 │ 0.004020001182121213 │ 0.003565688929790064 │ 0.00012131284901400016 │ 0.00010153938993400012 │ 1.806105462733887e-07 │ 0.003589790873218296 │ 0.0005998363217824134 │ 0 │ 15741 │ 14910 │ 14241 │ 13671 │ 0 │ 0 │ 1500 │ 1239 │ 1361 │ 11842 │ 2436607 │ 42156895.72476116 │ 0.00039430556297552000 │ 0.003517087848871931 │ 0.003557114042353152 │ 31 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 11629 │ 11335 │ 1379 │ 207 │ 55 │ 107 │ 5192960124 │ 5111471019 │ 0.0385805977857356220 │ 0.0286334499974164940 │ 0.0031220427054908210 │ 0.0029461056019041320 │ 0.0354585550802448010 │ 0.0256873443955123620 │ 0.0241924430564917020 │ 0.0230589995493936380 │ 0.0000058070135646340 │ 0.0000056921334498320 │ 0.0112603362586334100 │ 0.0026226792500277260 │ 0.006828197065555746 │ 0.004658699947392799 │ 0.0021683848883399227 │ 8.191009697732017 │ 1.7688029317897829 │ 414115.0 │ 252467.0 │ 161648.0 │ 104980.918358000000 │ 1273113.307712625000 │ 20084354 │ 1255348 │ 86492551 │ 73215959 │ 56703147 │ 49508128 │ 130637259.29100338 │ 125461323.54484165 │ 689248.7675517761 │ 3602.703307993061 │ 43690.31626781258 │ 43096.101888391546 │ 0.01268942514508051100 │ 0.00930790926353997200 │ 0.00000006653851932200 │ 0.00858835711056542700 │ 0.00410100821552410900 │ 0.005833905709314264 │ 0.004240585618287049 │ 0.005724012080796109 │ 0.004157020801367643 │ 0.00010989362851815141 │ 8.356481691940254e-05 │ 1.4716247230833444e-07 │ 0.004111370935708565 │ 0.012799318773598653 │ 0 │ 12356 │ 11892 │ 11626 │ 11361 │ 0 │ 0 │ 730 │ 531 │ 1146 │ 11557 │ 21451912 │ 14181568.32767524 │ 0.00929610137937214000 │ 0.004111318843136729 │ 0.004132350453560312 │ 42 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 11625 │ 11436 │ 1379 │ 144 │ 41 │ 78 │ 5243474206 │ 5156416961 │ 0.0156279882492578490 │ 0.0120260751312825160 │ 0.0031798546004170230 │ 0.0030353949259197480 │ 0.0124481336488408260 │ 0.0089906802053627680 │ 0.0092287612906324480 │ 0.0082244739389089310 │ 0.0000059226175323900 │ 0.0000057950450332990 │ 0.0032134892284338710 │ 0.0007604504932057870 │ 0.002374024007707844 │ 0.0017600470466836977 │ 0.000612854970232664 │ 8.199354679266955 │ 1.782327780315835 │ 410882.0 │ 237372.0 │ 173510.0 │ 105985.396175000000 │ 1285294.703114062500 │ 20276525 │ 1267359 │ 95945172 │ 87281000 │ 58705420 │ 53635007 │ 135901352.73302448 │ 132423493.65167841 │ 708131.3574124356 │ 3701.4026051947317 │ 44887.251774709555 │ 44272.13920975134 │ 0.00394576075872735100 │ 0.00284609070787392600 │ 0.00000006933728096700 │ 0.00272674599166435800 │ 0.00121895058248596000 │ 0.0021813819304510144 │ 0.0016119193447205016 │ 0.0020675144277595486 │ 0.001515000744396952 │ 0.00011386750269146593 │ 9.691860032354945e-05 │ 1.5394538980134926e-07 │ 0.0015480525615527282 │ 0.004059628261418815 │ 0 │ 12948 │ 12651 │ 12162 │ 12000 │ 0 │ 0 │ 786 │ 651 │ 1156 │ 11584 │ 25460939 │ 20585492.7916548 │ 0.00283264368853589000 │ 0.001461574560317471 │ 0.0014910806595664042 │ 33 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 11229 │ 11148 │ 1379 │ 112 │ 29 │ 36 │ 5112738802 │ 5072420427 │ 0.0073606840852945480 │ 0.0069919974138059380 │ 0.0029458763141605170 │ 0.0028672307683049090 │ 0.0044148077711340310 │ 0.0041247666455010290 │ 0.0036351253005716780 │ 0.0036088821030808790 │ 0.0000057153963770370 │ 0.0000056635089986220 │ 0.0007739834400406350 │ 0.0005102373445989130 │ 0.0008634917491593835 │ 0.0007109937435391166 │ 0.00015138333288957932 │ 8.193502166729221 │ 1.7649904093193 │ 261870.0 │ 143390.0 │ 118480.0 │ 99293.539879000000 │ 1204141.942812562500 │ 18996277 │ 1187293 │ 51980514 │ 49194255 │ 42759295 │ 40779725 │ 121989647.43375479 │ 120449310.63483883 │ 527661.900062017 │ 2758.0887516240928 │ 33447.5974154745 │ 32984.27131114666 │ 0.00089300422058779200 │ 0.00085632499342977600 │ 0.00000004833956906600 │ 0.00069597300470962000 │ 0.00019698531639617200 │ 0.0006574994656780434 │ 0.0005366275083218485 │ 0.000573451470950501 │ 0.0004623090708653184 │ 8.404799472754251e-05 │ 7.431843745652972e-05 │ 1.3623812352628944e-07 │ 0.00037373513973324476 │ 0.0009770522153153345 │ 0 │ 11557 │ 11397 │ 11251 │ 11133 │ 0 │ 0 │ 306 │ 264 │ 807 │ 11201 │ 12769625 │ 9330385.170053398 │ 0.00084456288257907200 │ 0.0004167685581526744 │ 0.0004295550972362154 │ 24 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 11006 │ 10984 │ 1379 │ 58 │ 20 │ 20 │ 5029780657 │ 5023913161 │ 0.0060735538237173350 │ 0.0059833504223231600 │ 0.0027876039974382160 │ 0.0027713824304713380 │ 0.0032859498262791190 │ 0.0032119679918518220 │ 0.0029589854273758550 │ 0.0029510050391285750 │ 0.0000055978250700170 │ 0.0000055886599657600 │ 0.0003213888708145280 │ 0.0002553965897387680 │ 0.0006532988315715174 │ 0.0005882931342657662 │ 6.389719407888049e-05 │ 8.189933307768259 │ 1.763358675368465 │ 103294.0 │ 42538.0 │ 60756.0 │ 94002.571853000000 │ 1139977.884144187500 │ 17984039 │ 1124012 │ 42819405 │ 41826096 │ 2483548 │ 2415801 │ 118984247.22848396 │ 118377092.17050248 │ 448078.0915806506 │ 2342.104184692024 │ 28402.914093517487 │ 28005.857080041802 │ 0.00001998465317498800 │ 0.00001851622456476300 │ 0.00000000286834802200 │ 0.00001576625271079400 │ 0.00000421557645465200 │ 0.0002530570242379544 │ 0.00023789094111646025 │ 0.00018271752514350672 │ 0.00017002447839809163 │ 7.033949909444786e-05 │ 6.786646271836875e-05 │ 1.3264413541765068e-07 │ 0.00014133350137056886 │ 9.032415226943577e-05 │ 0 │ 11480 │ 11373 │ 11377 │ 11276 │ 0 │ 0 │ 103 │ 97 │ 608 │ 11006 │ 378097 │ 7312093.923610215 │ 0.00001727900416486700 │ 0.00012261687323334195 │ 0.00012962667099010455 │ 19 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 10996 │ 10960 │ 1379 │ 48 │ 23 │ 24 │ 5052411568 │ 5031188403 │ 0.0057205865962422110 │ 0.0056176076708706290 │ 0.0028357061309091870 │ 0.0027957262675124070 │ 0.0028848804653330240 │ 0.0028218814033582220 │ 0.0025795299938098260 │ 0.0025711431104438020 │ 0.0000056444679973690 │ 0.0000056129856245520 │ 0.0002997150146508930 │ 0.0002451308301588750 │ 0.0005709907885582262 │ 0.0005105542094289311 │ 5.932117972121882e-05 │ 8.196171239543245 │ 1.7683514441472665 │ 171079.0 │ 87791.0 │ 83288.0 │ 95346.339467000000 │ 1156273.878298312500 │ 18241121 │ 1140081 │ 36625424 │ 35002403 │ 33996626 │ 32905182 │ 117861285.39334987 │ 117237656.57763085 │ 442175.52560038137 │ 2311.2514723131635 │ 28028.760396608337 │ 27637.25010558765 │ 0.00027396551375628900 │ 0.00027002799722618500 │ 0.00000003962761984600 │ 0.00024441422137034400 │ 0.00002951251985920000 │ 0.00021046070615958953 │ 0.00019855252410786478 │ 0.0001413515823386982 │ 0.00013183108474805707 │ 6.910912382089126e-05 │ 6.672143935980768e-05 │ 1.3145748689026882e-07 │ 0.00011163940987808386 │ 0.00034307463757718014 │ 0 │ 11193 │ 11126 │ 11081 │ 11043 │ 0 │ 0 │ 112 │ 83 │ 607 │ 10996 │ 4910454 │ 6164740.731893017 │ 0.00025775511051438900 │ 8.462144118505954e-05 │ 9.020902102423792e-05 │ 17 │\n",
- "├────────────┴─────────┴─────────┴──────────┴────────────────────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴────────────────────────────┴────────────────────────────────┴──────────────────────────────┴────────────────────────────┴────────────────────────┴───────────────────────────────────┴──────────────────────────┴─────────────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴───────────────────────┴──────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────┴───────────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴──────────────────────────────┴────────────────────┴───────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────────────┴───────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴─────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴─────────────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────┤\n",
- "│ 10 rows 78 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────┬─────────┬──────────┬────────────────────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬────────────────────────────┬────────────────────────────────┬──────────────────────────────┬────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬──────────────────────────┬─────────────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬───────────────────────┬──────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────┬───────────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬──────────────────────────────┬────────────────────┬───────────────────────────────┬────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬─────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬─────────────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────┐\n",
+ "│ dt │ chain │ network │ chain_id │ trace_to_address │ count_transactions_called │ count_transactions_called_tx_success │ count_unique_blocks_called │ count_unique_tx_from_addresses │ count_unique_tx_to_addresses │ count_unique_tx_method_ids │ sum_tx_l2_gas_used_called │ sum_tx_l2_gas_used_called_tx_success │ sum_tx_fee_native_called │ sum_tx_fee_native_called_tx_success │ tx_l1_fee_native │ tx_l1_fee_native_tx_success │ tx_l2_fee_native │ tx_l2_fee_native_tx_success │ tx_l2_priority_fee_native │ tx_l2_priority_fee_native_tx_success │ tx_l2_base_fee_native │ tx_l2_base_fee_native_tx_success │ tx_l2_legacy_extra_fee_native │ tx_l2_legacy_extra_fee_native_tx_success │ avg_tx_l2_gas_price_gwei_called │ avg_tx_l2_priority_gas_price_gwei_called │ avg_tx_l2_legacy_extra_gas_price_gwei_called │ avg_tx_l1_base_gas_price_gwei_called │ avg_tx_l1_blob_base_gas_price_gwei_called │ sum_tx_input_byte_length_called │ sum_tx_input_zero_bytes_called │ sum_tx_input_nonzero_bytes_called │ sum_tx_l1_base_scaled_size_called │ sum_tx_l1_blob_scaled_size_called │ sum_tx_l1_gas_used_unified_called │ sum_tx_estimated_size_called │ sum_trace_gas_used │ sum_trace_gas_used_tx_success │ sum_trace_gas_used_minus_subtraces │ sum_trace_gas_used_minus_subtraces_tx_success │ sum_tx_l2_gas_used_amortized_by_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success │ sum_tx_l1_gas_used_unified_amortized_by_call │ sum_tx_l1_base_scaled_size_amortized_by_call │ sum_tx_l1_blob_scaled_size_amortized_by_call │ sum_tx_estimated_size_amortized_by_call │ sum_tx_l2_fee_native_minus_subtraces │ sum_tx_l2_fee_native_minus_subtraces_tx_success │ sum_tx_l2_base_fee_native_minus_subtraces │ sum_tx_l2_priority_fee_native_minus_subtraces │ sum_tx_l2_legacy_base_fee_native_minus_subtraces │ sum_tx_fee_native_amortized_by_call │ sum_tx_fee_native_amortized_by_call_tx_success │ sum_tx_l2_fee_native_amortized_by_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success │ sum_tx_l1_fee_native_amortized_by_call │ sum_tx_l1_fee_native_amortized_by_call_tx_success │ sum_tx_l2_base_fee_native_amortized_by_call │ sum_tx_l2_priority_fee_native_amortized_by_call │ sum_tx_fee_native_l1_amortized_l2_minus_subtraces │ count_top_level_calls │ count_internal_calls_all_types │ count_internal_calls_all_types_trace_success │ count_internal_calls_static_type │ count_internal_calls_static_type_trace_success │ count_internal_calls_delegate_type │ count_internal_calls_delegate_type_trace_success │ count_internal_calls_call_type │ count_internal_calls_call_type_trace_success │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_unique_trace_from_addresses │\n",
+ "│ date │ varchar │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ int64 │ int64 │ decimal(38,0) │ double │ decimal(38,20) │ double │ double │ int64 │\n",
+ "├────────────┼─────────┼─────────┼──────────┼────────────────────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼────────────────────────────┼────────────────────────────────┼──────────────────────────────┼────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼───────────────────────┼──────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────┼───────────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼──────────────────────────────┼────────────────────┼───────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14695 │ 13688 │ 1380 │ 341 │ 77 │ 299 │ 6452271886 │ 6250947632 │ 0.1219897937370507150 │ 0.1106332698372177340 │ 0.0046893913808264620 │ 0.0041940751403341490 │ 0.1173004023562242530 │ 0.1064391946968835850 │ 0.0952425665896049750 │ 0.0925352274339835120 │ 0.0000073738719558640 │ 0.0000070583473422090 │ 0.0220505987724079880 │ 0.0138970429090307190 │ 0.018179705447741612 │ 0.014761090089253715 │ 0.0034174937389499812 │ 8.201251243507212 │ 1.809727157458527 │ 1634709 │ 1100753 │ 533956 │ 153099.723817000000 │ 1856654.512526437500 │ 29290171 │ 1830873 │ 806347671 │ 749646962 │ 529558288 │ 500050621 │ 1068526615.5822927 │ 1046647297.4262667 │ 4888768.627139384 │ 25553.593614057296 │ 309890.7934773059 │ 305586.89104998036 │ 0.04029101981655442800 │ 0.03829338800582661200 │ 0.00000060506389677800 │ 0.03379136370802675700 │ 0.00649908218414147200 │ 0.019182016703136285 │ 0.016497407132283724 │ 0.018414204847005254 │ 0.015821709761356877 │ 0.0007678118561310301 │ 0.0006756973709268447 │ 1.189469265372385e-06 │ 0.014623270722784024 │ 0.041058831672685446 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 3670 │ 14695 │ 288049460 │ 204823127.4473851 │ 0.03819199276620082500 │ 0.015445279151271054 │ 0.015644821523381106 │ 34 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 13054 │ 12803 │ 1379 │ 269 │ 94 │ 181 │ 6428944143 │ 6291511311 │ 0.0177214889376692160 │ 0.0171720726307182100 │ 0.0039149172970481770 │ 0.0036774312323045060 │ 0.0138065716406210390 │ 0.0134946413984137040 │ 0.0118712635101399800 │ 0.0117670453288556910 │ 0.0000073569861295260 │ 0.0000071245687027410 │ 0.0019280085884527420 │ 0.0017205254171395800 │ 0.0021475644108144864 │ 0.0018465339324911878 │ 0.00029989505983684853 │ 8.203521185800055 │ 1.798948965305693 │ 734430 │ 393661 │ 340769 │ 127261.627871000000 │ 1543313.532953062500 │ 24346973 │ 1521742 │ 793020153 │ 761387815 │ 602330824 │ 579413082 │ 800395406.3520415 │ 792614207.211054 │ 2802019.5681512994 │ 14646.156282726475 │ 177615.292017086 │ 175133.0516356697 │ 0.00223246010334795500 │ 0.00217883334892808100 │ 0.00000071272173782700 │ 0.00156035784691197600 │ 0.00067140258033343000 │ 0.001412668900401075 │ 0.001345712864972268 │ 0.0009691987829059819 │ 0.0009275452134075285 │ 0.0004434701174950936 │ 0.00041816765156473993 │ 8.965536192711147e-07 │ 0.0007682652692257427 │ 0.002675930220843047 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 2464 │ 13054 │ 403481910 │ 94993814.89057308 │ 0.00210707216596956100 │ 0.0006638033414379764 │ 0.0007307862989703064 │ 180 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 12419 │ 11983 │ 1379 │ 188 │ 39 │ 180 │ 5509275663 │ 5420289642 │ 0.0812010819017146630 │ 0.0740585349932124140 │ 0.0034191107584217350 │ 0.0032050065832735430 │ 0.0777819711432929280 │ 0.0708535284099388710 │ 0.0638217003754810510 │ 0.0618929396178460310 │ 0.0000061980374237800 │ 0.0000060440079740220 │ 0.0139541426180543950 │ 0.0089546128717087240 │ 0.014118366170288497 │ 0.01158440860095351 │ 0.0025328452362203746 │ 8.193557265424658 │ 1.77845501825804 │ 547535 │ 350706 │ 196829 │ 113804.857500000000 │ 1380122.033906250000 │ 21772500 │ 1360831 │ 247637741 │ 231751597 │ 34407198 │ 33173217 │ 181409113.2045715 │ 174851869.6893516 │ 1017011.7609458554 │ 5315.920474464031 │ 64466.65931901353 │ 63571.00859461218 │ 0.00161791364834116600 │ 0.00118483349730291200 │ 0.00000003820465697000 │ 0.00112362448665840500 │ 0.00049425184282953400 │ 0.012270676533798739 │ 0.010404734196149066 │ 0.012110766514152412 │ 0.010281284602777128 │ 0.00015991001964633033 │ 0.00012344959337193403 │ 1.959627926290491e-07 │ 0.009512241894549313 │ 0.0017778236679874952 │ 0 │ 18268 │ 17387 │ 15936 │ 15200 │ 0 │ 0 │ 2332 │ 2187 │ 1687 │ 12419 │ 5087651 │ 63075664.9345231 │ 0.00117079859301269400 │ 0.010217330953640717 │ 0.010275181596323601 │ 40 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 12057 │ 11735 │ 1379 │ 261 │ 53 │ 256 │ 5377586786 │ 5286455316 │ 0.0232969391423820980 │ 0.0209563174421668930 │ 0.0034168346898384660 │ 0.0032127940004109450 │ 0.0198801044525436320 │ 0.0177435234417559480 │ 0.0183407833558363430 │ 0.0171825434751415000 │ 0.0000061420894750850 │ 0.0000059943431254880 │ 0.0015332572510255230 │ 0.0005550591762551140 │ 0.0036968449313174194 │ 0.0034105973712195044 │ 0.0002851199454404348 │ 8.208016337742121 │ 1.8032290003079243 │ 527342 │ 310789 │ 216553 │ 111864.093308000000 │ 1356586.207028250000 │ 21401204 │ 1337655 │ 164208684 │ 151365149 │ 70348033 │ 63356929 │ 144491780.9351728 │ 137155589.6594242 │ 855428.0388996555 │ 4471.322359328464 │ 54224.13985103515 │ 53474.6624728978 │ 0.00532948449070531800 │ 0.00479894612631183000 │ 0.00000009111683892700 │ 0.00497237357020249600 │ 0.00035703306041542600 │ 0.003776203396333809 │ 0.0033356188832723245 │ 0.0036340183586927566 │ 0.003227744710208146 │ 0.00014218503764105083 │ 0.00010787417306417665 │ 1.7092561285117626e-07 │ 0.0032777765991069737 │ 0.005471669528346364 │ 0 │ 13948 │ 13203 │ 12827 │ 12276 │ 0 │ 0 │ 1121 │ 927 │ 1483 │ 11943 │ 35182861 │ 25337952.364479937 │ 0.00478704417847796600 │ 0.003181593098840976 │ 0.003222434310232159 │ 40 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 11842 │ 11572 │ 1380 │ 185 │ 28 │ 96 │ 5374653125 │ 5292988684 │ 0.0301797184740908970 │ 0.0275751674917356450 │ 0.0032079598058830470 │ 0.0030595347433565770 │ 0.0269717586682078500 │ 0.0245156327483790680 │ 0.0239145630016689240 │ 0.0233415174566461200 │ 0.0000060837781266980 │ 0.0000059476070391350 │ 0.0030511622017185950 │ 0.0011682174216660980 │ 0.005018325469740496 │ 0.00444950817205881 │ 0.0005676947201534229 │ 8.203940575214546 │ 1.784020770292575 │ 429785 │ 277672 │ 152113 │ 106683.420209000000 │ 1293759.705141937500 │ 20410067 │ 1275735 │ 181978502 │ 162868323 │ 5260405 │ 4485759 │ 159789118.70821685 │ 153283188.77684808 │ 768812.0511767166 │ 4018.5805915006313 │ 48733.69855375741 │ 48065.15414666971 │ 0.00047852347276841400 │ 0.00039545461476174600 │ 0.00000000628765871200 │ 0.00040979203771864100 │ 0.00006872555817834500 │ 0.004141314031135212 │ 0.003667228319724062 │ 0.004020001182121207 │ 0.0035656889297900583 │ 0.0001213128490140001 │ 0.00010153938993400007 │ 1.8061054627338888e-07 │ 0.0035897908732182935 │ 0.0005998363217824139 │ 0 │ 15741 │ 14910 │ 14241 │ 13671 │ 0 │ 0 │ 1500 │ 1239 │ 1361 │ 11842 │ 2436607 │ 42156895.72476116 │ 0.00039430556297552000 │ 0.0035170878488719306 │ 0.003557114042353152 │ 31 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 11629 │ 11335 │ 1379 │ 207 │ 55 │ 107 │ 5192960124 │ 5111471019 │ 0.0385805977857356220 │ 0.0286334499974164940 │ 0.0031220427054908210 │ 0.0029461056019041320 │ 0.0354585550802448010 │ 0.0256873443955123620 │ 0.0241924430564917020 │ 0.0230589995493936380 │ 0.0000058070135646340 │ 0.0000056921334498320 │ 0.0112603362586334100 │ 0.0026226792500277260 │ 0.006828197065555746 │ 0.004658699947392799 │ 0.0021683848883399227 │ 8.191009697732017 │ 1.7688029317897829 │ 414115 │ 250361 │ 163754 │ 104980.918358000000 │ 1273113.307712625000 │ 20084354 │ 1255348 │ 86492551 │ 73215959 │ 56703147 │ 49508128 │ 130637259.29100339 │ 125461323.54484168 │ 689248.7675517754 │ 3602.7033079930616 │ 43690.316267812654 │ 43096.10188839152 │ 0.01268942514508051100 │ 0.00930790926353997200 │ 0.00000006653851932200 │ 0.00858835711056542700 │ 0.00410100821552410900 │ 0.005833905709314264 │ 0.0042405856182870455 │ 0.005724012080796111 │ 0.004157020801367643 │ 0.00010989362851815146 │ 8.356481691940254e-05 │ 1.471624723083344e-07 │ 0.004111370935708563 │ 0.012799318773598658 │ 0 │ 12356 │ 11892 │ 11626 │ 11361 │ 0 │ 0 │ 730 │ 531 │ 1146 │ 11557 │ 21451912 │ 14181568.327675238 │ 0.00929610137937214000 │ 0.004111318843136728 │ 0.0041323504535603125 │ 42 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 11625 │ 11436 │ 1379 │ 144 │ 41 │ 78 │ 5243474206 │ 5156416961 │ 0.0156279882492578490 │ 0.0120260751312825160 │ 0.0031798546004170230 │ 0.0030353949259197480 │ 0.0124481336488408260 │ 0.0089906802053627680 │ 0.0092287612906324480 │ 0.0082244739389089310 │ 0.0000059226175323900 │ 0.0000057950450332990 │ 0.0032134892284338710 │ 0.0007604504932057870 │ 0.002374024007707844 │ 0.0017600470466836977 │ 0.000612854970232664 │ 8.199354679266955 │ 1.782327780315835 │ 410882 │ 235247 │ 175635 │ 105985.396175000000 │ 1285294.703114062500 │ 20276525 │ 1267359 │ 95945172 │ 87281000 │ 58705420 │ 53635007 │ 135901352.73302457 │ 132423493.65167841 │ 708131.3574124334 │ 3701.4026051947203 │ 44887.25177470968 │ 44272.13920975122 │ 0.00394576075872735100 │ 0.00284609070787392600 │ 0.00000006933728096700 │ 0.00272674599166435800 │ 0.00121895058248596000 │ 0.0021813819304510136 │ 0.0016119193447205011 │ 0.0020675144277595473 │ 0.0015150007443969526 │ 0.00011386750269146585 │ 9.691860032354941e-05 │ 1.5394538980134923e-07 │ 0.0015480525615527278 │ 0.004059628261418819 │ 0 │ 12948 │ 12651 │ 12162 │ 12000 │ 0 │ 0 │ 786 │ 651 │ 1156 │ 11584 │ 25460939 │ 20585492.791654795 │ 0.00283264368853589000 │ 0.0014615745603174708 │ 0.0014910806595664038 │ 33 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 11229 │ 11148 │ 1379 │ 112 │ 29 │ 36 │ 5112738802 │ 5072420427 │ 0.0073606840852945480 │ 0.0069919974138059380 │ 0.0029458763141605170 │ 0.0028672307683049090 │ 0.0044148077711340310 │ 0.0041247666455010290 │ 0.0036351253005716780 │ 0.0036088821030808790 │ 0.0000057153963770370 │ 0.0000056635089986220 │ 0.0007739834400406350 │ 0.0005102373445989130 │ 0.0008634917491593835 │ 0.0007109937435391166 │ 0.00015138333288957932 │ 8.193502166729221 │ 1.7649904093193 │ 261870 │ 141787 │ 120083 │ 99293.539879000000 │ 1204141.942812562500 │ 18996277 │ 1187293 │ 51980514 │ 49194255 │ 42759295 │ 40779725 │ 121989647.43375477 │ 120449310.63483883 │ 527661.900062017 │ 2758.08875162409 │ 33447.59741547452 │ 32984.27131114666 │ 0.00089300422058779200 │ 0.00085632499342977600 │ 0.00000004833956906600 │ 0.00069597300470962000 │ 0.00019698531639617200 │ 0.0006574994656780423 │ 0.0005366275083218476 │ 0.0005734514709505007 │ 0.0004623090708653184 │ 8.404799472754249e-05 │ 7.431843745652969e-05 │ 1.3623812352628942e-07 │ 0.00037373513973324444 │ 0.000977052215315335 │ 0 │ 11557 │ 11397 │ 11251 │ 11133 │ 0 │ 0 │ 306 │ 264 │ 807 │ 11201 │ 12769625 │ 9330385.170053398 │ 0.00084456288257907200 │ 0.00041676855815267445 │ 0.0004295550972362153 │ 24 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 11006 │ 10984 │ 1379 │ 58 │ 20 │ 20 │ 5029780657 │ 5023913161 │ 0.0060735538237173350 │ 0.0059833504223231600 │ 0.0027876039974382160 │ 0.0027713824304713380 │ 0.0032859498262791190 │ 0.0032119679918518220 │ 0.0029589854273758550 │ 0.0029510050391285750 │ 0.0000055978250700170 │ 0.0000055886599657600 │ 0.0003213888708145280 │ 0.0002553965897387680 │ 0.0006532988315715174 │ 0.0005882931342657662 │ 6.389719407888049e-05 │ 8.189933307768259 │ 1.763358675368465 │ 103294 │ 42165 │ 61129 │ 94002.571853000000 │ 1139977.884144187500 │ 17984039 │ 1124012 │ 42819405 │ 41826096 │ 2483548 │ 2415801 │ 118984247.22848397 │ 118377092.1705025 │ 448078.09158065036 │ 2342.1041846920243 │ 28402.91409351748 │ 28005.857080041787 │ 0.00001998465317498800 │ 0.00001851622456476300 │ 0.00000000286834802200 │ 0.00001576625271079400 │ 0.00000421557645465200 │ 0.0002530570242379545 │ 0.00023789094111646036 │ 0.0001827175251435067 │ 0.00017002447839809158 │ 7.033949909444785e-05 │ 6.786646271836872e-05 │ 1.3264413541765076e-07 │ 0.00014133350137056886 │ 9.032415226943577e-05 │ 0 │ 11480 │ 11373 │ 11377 │ 11276 │ 0 │ 0 │ 103 │ 97 │ 608 │ 11006 │ 378097 │ 7312093.923610215 │ 0.00001727900416486700 │ 0.000122616873233342 │ 0.0001296266709901045 │ 19 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 10996 │ 10960 │ 1379 │ 48 │ 23 │ 24 │ 5052411568 │ 5031188403 │ 0.0057205865962422110 │ 0.0056176076708706290 │ 0.0028357061309091870 │ 0.0027957262675124070 │ 0.0028848804653330240 │ 0.0028218814033582220 │ 0.0025795299938098260 │ 0.0025711431104438020 │ 0.0000056444679973690 │ 0.0000056129856245520 │ 0.0002997150146508930 │ 0.0002451308301588750 │ 0.0005709907885582262 │ 0.0005105542094289311 │ 5.932117972121882e-05 │ 8.196171239543245 │ 1.7683514441472665 │ 171079 │ 86853 │ 84226 │ 95346.339467000000 │ 1156273.878298312500 │ 18241121 │ 1140081 │ 36625424 │ 35002403 │ 33996626 │ 32905182 │ 117861285.39334993 │ 117237656.57763092 │ 442175.5256003813 │ 2311.2514723131626 │ 28028.760396608333 │ 27637.250105587656 │ 0.00027396551375628900 │ 0.00027002799722618500 │ 0.00000003962761984600 │ 0.00024441422137034400 │ 0.00002951251985920000 │ 0.00021046070615958937 │ 0.0001985525241078646 │ 0.0001413515823386983 │ 0.00013183108474805705 │ 6.910912382089125e-05 │ 6.672143935980768e-05 │ 1.3145748689026882e-07 │ 0.00011163940987808375 │ 0.0003430746375771801 │ 0 │ 11193 │ 11126 │ 11081 │ 11043 │ 0 │ 0 │ 112 │ 83 │ 607 │ 10996 │ 4910454 │ 6164740.731893016 │ 0.00025775511051438900 │ 8.462144118505956e-05 │ 9.020902102423792e-05 │ 17 │\n",
+ "├────────────┴─────────┴─────────┴──────────┴────────────────────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴────────────────────────────┴────────────────────────────────┴──────────────────────────────┴────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴──────────────────────────┴─────────────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴───────────────────────┴──────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────┴───────────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴──────────────────────────────┴────────────────────┴───────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴─────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴─────────────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────┤\n",
+ "│ 10 rows 78 columns │\n",
+ "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 3,
@@ -206,8 +198,8 @@
"│ varchar │ int64 │ int64 │ int64 │\n",
"├────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
"│ 0x4200000000000000000000000000000000000006 │ 8191 │ 8264 │ 8320 │\n",
- "│ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 6335 │ 6684 │ 6684 │\n",
"│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 6335 │ 6684 │ 6684 │\n",
"│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 3975 │ 4012 │ 4068 │\n",
"│ 0x0000000000000000000000000000000000000001 │ 3676 │ 3927 │ 4639 │\n",
"│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 3670 │ 14695 │ 14695 │\n",
@@ -251,23 +243,23 @@
{
"data": {
"text/plain": [
- "┌────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
- "│ trace_to_address │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
- "│ varchar │ decimal(38,0) │ double │ decimal(38,20) │ double │ int64 │ int64 │ int64 │\n",
- "├────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
- "│ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 4336291158 │ 1416977599.783289 │ 0.00006075181680298400 │ 4.428249782673902e-05 │ 357 │ 357 │ 357 │\n",
- "│ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 1408738482 │ 1402224990.8886633 │ 0.00000562532943659800 │ 3.636351036943135e-05 │ 326 │ 326 │ 326 │\n",
- "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 403481910 │ 94993814.89057307 │ 0.00210707216596956100 │ 0.0007307862989703063 │ 2464 │ 13054 │ 13054 │\n",
- "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 288049460 │ 204823127.44738504 │ 0.03819199276620082500 │ 0.015644821523381112 │ 3670 │ 14695 │ 14695 │\n",
- "│ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 220618821 │ 68159718.96890971 │ 0.00107271191945114100 │ 0.0004481642659551657 │ 946 │ 1097 │ 1175 │\n",
- "│ 0x4200000000000000000000000000000000000006 │ 159906187 │ 252716979.5751807 │ 0.01377174827006443900 │ 0.02364533942470271 │ 8191 │ 8264 │ 8320 │\n",
- "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 147222841 │ 180406504.91480613 │ 0.01486079382578650400 │ 0.01660686668994283 │ 6335 │ 6684 │ 6684 │\n",
- "│ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 134640530 │ 4448836.836776924 │ 0.00007106463186232300 │ 5.1367270293187554e-06 │ 517 │ 4132 │ 4132 │\n",
- "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 119952045 │ 125551585.96841848 │ 0.00193008438541577500 │ 0.0032815324126219646 │ 3975 │ 4012 │ 4068 │\n",
- "│ 0x4200000000000000000000000000000000000042 │ 103674485 │ 123213874.92716485 │ 0.00809187465620548800 │ 0.008077490671055848 │ 3666 │ 3685 │ 3841 │\n",
- "├────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
- "│ 10 rows 8 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
+ "│ trace_to_address │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
+ "│ varchar │ decimal(38,0) │ double │ decimal(38,20) │ double │ int64 │ int64 │ int64 │\n",
+ "├────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
+ "│ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 4336291158 │ 1416977599.783289 │ 0.00006075181680298400 │ 4.4282497826739014e-05 │ 357 │ 357 │ 357 │\n",
+ "│ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 1408738482 │ 1402224990.8886633 │ 0.00000562532943659800 │ 3.636351036943136e-05 │ 326 │ 326 │ 326 │\n",
+ "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 403481910 │ 94993814.89057308 │ 0.00210707216596956100 │ 0.0007307862989703064 │ 2464 │ 13054 │ 13054 │\n",
+ "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 288049460 │ 204823127.4473851 │ 0.03819199276620082500 │ 0.015644821523381106 │ 3670 │ 14695 │ 14695 │\n",
+ "│ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 220618821 │ 68159718.9689097 │ 0.00107271191945114100 │ 0.00044816426595516574 │ 946 │ 1097 │ 1175 │\n",
+ "│ 0x4200000000000000000000000000000000000006 │ 159906187 │ 252716979.57518074 │ 0.01377174827006443900 │ 0.023645339424702712 │ 8191 │ 8264 │ 8320 │\n",
+ "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 147222841 │ 180406504.91480607 │ 0.01486079382578650400 │ 0.01660686668994283 │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 134640530 │ 4448836.836776925 │ 0.00007106463186232300 │ 5.136727029318757e-06 │ 517 │ 4132 │ 4132 │\n",
+ "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 119952045 │ 125551585.96841855 │ 0.00193008438541577500 │ 0.003281532412621963 │ 3975 │ 4012 │ 4068 │\n",
+ "│ 0x4200000000000000000000000000000000000042 │ 103674485 │ 123213874.92716488 │ 0.00809187465620548800 │ 0.00807749067105585 │ 3666 │ 3685 │ 3841 │\n",
+ "├────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
+ "│ 10 rows 8 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 5,
@@ -281,7 +273,7 @@
" trace_to_address,\n",
" \n",
" sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call,\n",
- " sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call,\n",
+ " sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call,\n",
" \n",
" sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call\n",
" sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call,\n",
@@ -305,23 +297,23 @@
{
"data": {
"text/plain": [
- "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬──────────────┬─────────────┬────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────────────┬─────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬─────────────────┬───────────────┬───────────────────────────┬───────────────────────┬─────────────────────────────┬─────────────────────────────┬────────────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
- "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ call_type │ tx_gas_used │ tx_l1_gas_used_unified │ tx_estimated_size │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_input_byte_length │ tx_input_zero_bytes │ tx_input_nonzero_bytes │ tx_l1_base_scaled_size │ tx_l1_blob_scaled_size │ tx_method_id │ block_hour │ tx_success │ error │ trace_method_id │ trace_success │ trace_address_cardinality │ trace_address_uplevel │ count_traces_in_transaction │ trace_gas_used_in_subtraces │ trace_gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
- "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ double │ double │ double │ decimal(38,12) │ decimal(38,12) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
- "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼──────────────┼─────────────┼────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────────────┼─────────────────────┼────────────────────────┼────────────────────────┼────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼─────────────────┼───────────────┼───────────────────────────┼───────────────────────┼─────────────────────────────┼─────────────────────────────┼────────────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ 0 │ -1 │ 19 │ 135545 │ 35841 │ 0.00004981124250191700 │ 0.00000000008368873500 │ 0.00004981124250191700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 1 │ │ 19 │ 132840 │ 2705 │ 0.00000375936527908500 │ 0.00000000000631617500 │ 0.00000375936527908500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ 2 │ 0 │ 19 │ 69223 │ 63617 │ 0.00008841387835842900 │ 0.00000000014854569500 │ 0.00008841387835842900 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ 3 │ 0,0 │ 19 │ 3542 │ 5918 │ 0.00000822474074736600 │ 0.00000000001381853000 │ 0.00000822474074736600 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ 4 │ 0,0,0 │ 19 │ 547 │ 2995 │ 0.00000416240259181500 │ 0.00000000000699332500 │ 0.00000416240259181500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 5 │ 0,0,0,0 │ 19 │ 381 │ 166 │ 0.00000023070411694200 │ 0.00000000000038761000 │ 0.00000023070411694200 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ 6 │ 0,0,0,0,0 │ 19 │ 0 │ 381 │ 0.00000052950764189700 │ 0.00000000000088963500 │ 0.00000052950764189700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ 3 │ 0,0 │ 19 │ 7940 │ 9330 │ 0.00001296668319921000 │ 0.00000000002178555000 │ 0.00001296668319921000 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2674 │ 0.00000371628198013800 │ 0.00000000000624379000 │ 0.00000371628198013800 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36.0 │ 10.0 │ 26.0 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ 4 │ 0,0,1 │ 19 │ 0 │ 2682 │ 0.00000372740025083400 │ 0.00000000000626247000 │ 0.00000372740025083400 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
- "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴──────────────┴─────────────┴────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────────────┴─────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴─────────────────┴───────────────┴───────────────────────────┴───────────────────────┴─────────────────────────────┴─────────────────────────────┴────────────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
- "│ 10 rows 62 columns │\n",
- "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬──────────────┬────────────────┬────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────────────┬─────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬─────────────────┬───────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬─────────────────────────────┬─────────────────────────────┬────────────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ call_type │ tx_l2_gas_used │ tx_l1_gas_used_unified │ tx_estimated_size │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_input_byte_length │ tx_input_zero_bytes │ tx_input_nonzero_bytes │ tx_l1_base_scaled_size │ tx_l1_blob_scaled_size │ tx_method_id │ block_hour │ tx_success │ error │ trace_method_id │ trace_success │ is_system_transaction │ trace_address_cardinality │ trace_address_uplevel │ count_traces_in_transaction │ trace_gas_used_in_subtraces │ trace_gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_l2_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ int32 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ boolean │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
+ "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼──────────────┼────────────────┼────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────────────┼─────────────────────┼────────────────────────┼────────────────────────┼────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼─────────────────┼───────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼─────────────────────────────┼─────────────────────────────┼────────────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ false │ 0 │ -1 │ 19 │ 135545 │ 35841 │ 0.00004981124250191700 │ 0.00000000008368873500 │ 0.00004981124250191700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ false │ 1 │ │ 19 │ 132840 │ 2705 │ 0.00000375936527908500 │ 0.00000000000631617500 │ 0.00000375936527908500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ false │ 2 │ 0 │ 19 │ 69223 │ 63617 │ 0.00008841387835842900 │ 0.00000000014854569500 │ 0.00008841387835842900 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ false │ 3 │ 0,0 │ 19 │ 3542 │ 5918 │ 0.00000822474074736600 │ 0.00000000001381853000 │ 0.00000822474074736600 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ false │ 4 │ 0,0,0 │ 19 │ 547 │ 2995 │ 0.00000416240259181500 │ 0.00000000000699332500 │ 0.00000416240259181500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ false │ 5 │ 0,0,0,0 │ 19 │ 381 │ 166 │ 0.00000023070411694200 │ 0.00000000000038761000 │ 0.00000023070411694200 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ false │ 6 │ 0,0,0,0,0 │ 19 │ 0 │ 381 │ 0.00000052950764189700 │ 0.00000000000088963500 │ 0.00000052950764189700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ false │ 3 │ 0,0 │ 19 │ 7940 │ 9330 │ 0.00001296668319921000 │ 0.00000000002178555000 │ 0.00001296668319921000 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ false │ 4 │ 0,0,1 │ 19 │ 0 │ 2674 │ 0.00000371628198013800 │ 0.00000000000624379000 │ 0.00000371628198013800 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ false │ 4 │ 0,0,1 │ 19 │ 0 │ 2682 │ 0.00000372740025083400 │ 0.00000000000626247000 │ 0.00000372740025083400 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴──────────────┴────────────────┴────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────────────┴─────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴─────────────────┴───────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴─────────────────────────────┴─────────────────────────────┴────────────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
+ "│ 10 rows 63 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
"execution_count": 6,
@@ -348,7 +340,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
@@ -362,7 +354,7 @@
"└──────────────────┴─────────┴───────────────┘"
]
},
- "execution_count": 11,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -373,7 +365,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -387,7 +379,7 @@
"└──────────┴─────────┴───────────────┘"
]
},
- "execution_count": 12,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -398,7 +390,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
@@ -408,11 +400,11 @@
"│ num_rows │ num_trace_tos │\n",
"│ int64 │ int64 │\n",
"├──────────┼───────────────┤\n",
- "│ 43972 │ 43972 │\n",
+ "│ 43966 │ 43966 │\n",
"└──────────┴───────────────┘"
]
},
- "execution_count": 13,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -458,7 +450,7 @@
"│ count_transactions_called_with_internal_type_call │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
"│ count_transactions_called_with_internal_type_call_or_delegate │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
"│ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
"│ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,20) │ YES │ NULL │ NULL │ NULL │\n",
"│ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
"│ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
diff --git a/notebooks/adhoc/refined_transactions_address_models_dev.ipynb b/notebooks/adhoc/refined_transactions_address_models_dev.ipynb
new file mode 100644
index 00000000000..57ba66863a5
--- /dev/null
+++ b/notebooks/adhoc/refined_transactions_address_models_dev.ipynb
@@ -0,0 +1,416 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Prepare data reader for a given chain and date"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-14 20:59:01\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:01\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n"
+ ]
+ }
+ ],
+ "source": [
+ "from op_analytics.coreutils.duckdb_inmem import init_client\n",
+ "from op_analytics.coreutils.partitioned.reader import DataReader\n",
+ "from op_analytics.coreutils.partitioned.location import DataLocation\n",
+ "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n",
+ "\n",
+ "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n",
+ "\n",
+ "model_name = \"refined_transactions_addresses_models\"\n",
+ "\n",
+ "# Define the input data range.\n",
+ "read_batches: list[DataReader] = construct_data_readers(\n",
+ " chains=[\"op\"],\n",
+ " models=[model_name],\n",
+ " range_spec=\"@20241118:+1\",\n",
+ " read_from=DataLocation.GCS\n",
+ ")\n",
+ "\n",
+ "\n",
+ "# Select input for one date and build the intermediate model inputs.\n",
+ "batch = read_batches[0]\n",
+ "\n",
+ "\n",
+ "duckdb_client = init_client()\n",
+ "create_duckdb_macros(duckdb_client)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Run the model\n",
+ "\n",
+ "This automatically registers the model outputs as duckdb tables."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:03\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:03\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_from_tx_to_method\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to_method\u001b[0m\n",
+ "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to\u001b[0m\n",
+ "dict_keys(['refined_transactions_fees_v1', 'event_emitting_transactions_v1', 'summary_v1', 'daily_transactions_agg_tx_from_tx_to_method_v1', 'daily_transactions_agg_tx_to_method_v1', 'daily_transactions_agg_tx_to_v1'])\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├────────────────────────────────────────────────┤\n",
+ "│ daily_address_summary │\n",
+ "│ daily_transactions_agg_tx_from_tx_to_method │\n",
+ "│ daily_transactions_agg_tx_from_tx_to_method_v1 │\n",
+ "│ daily_transactions_agg_tx_to │\n",
+ "│ daily_transactions_agg_tx_to_method │\n",
+ "│ daily_transactions_agg_tx_to_method_v1 │\n",
+ "│ daily_transactions_agg_tx_to_v1 │\n",
+ "│ event_emitting_transactions │\n",
+ "│ event_emitting_transactions_v1 │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_logs_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ logs_topic0_filters │\n",
+ "│ refined_transactions_fees │\n",
+ "│ refined_transactions_fees_v1 │\n",
+ "│ summary_v1 │\n",
+ "├────────────────────────────────────────────────┤\n",
+ "│ 16 rows │\n",
+ "└────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
+ "\n",
+ "execute_model_in_memory(\n",
+ " duckdb_client=duckdb_client,\n",
+ " model=model_name,\n",
+ " data_reader=batch,\n",
+ " limit_input_parquet_files=1\n",
+ ")\n",
+ "\n",
+ "# The duckdb database will have the following:\n",
+ "# - input tables\n",
+ "# - views used by the model\n",
+ "# - model outputs\n",
+ "# \n",
+ "# You can use duckdb to inspect any of the above results.\n",
+ "duckdb_client.sql(\"SHOW TABLES\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Verify model results - Transactions"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ from_address │ to_address │ method_id │ count_transactions │ count_transactions_success │ count_unique_blocks │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n",
+ "│ date │ varchar │ int32 │ varchar │ varchar │ varchar │ varchar │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabe58b50367fb4cea7d19c41c228abed381ed2ef │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1382 │ 1382 │ 1358 │ 482318566 │ 482318566 │ 0.0003913002292985670 │ 0.0003913002292985670 │ 0.0003412383580521060 │ 0.0003412383580521060 │ 0.0000500618712464610 │ 0.0000500618712464610 │ 0.0000495272351094990 │ 0.0000495272351094990 │ 0.0000005346361369620 │ 0.0000005346361369620 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00010379420319984324 │ 0.00010268573221271976 │ 0.0 │ 8.181933951719273 │ 1.7652776299931656 │ 2764 │ 1382 │ 1382 │ 11557.942400000000 │ 140164.236600000000 │ 2211200 │ 138200 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x669bee230facc9240e2ef81c2e566c3ebadd7c71 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1380 │ 1380 │ 1338 │ 710920321 │ 710920321 │ 0.0005336257693735600 │ 0.0005336257693735600 │ 0.0003400395876824320 │ 0.0003400395876824320 │ 0.0001935861816911280 │ 0.0001935861816911280 │ 0.0001928001503458680 │ 0.0001928001503458680 │ 0.0000007860313452600 │ 0.0000007860313452600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0002723036266832609 │ 0.00027119797345878373 │ 0.0 │ 8.182952605069152 │ 1.754385178728055 │ 5520 │ 0 │ 5520 │ 11541.216000000000 │ 139961.394000000000 │ 2208000 │ 138000 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xae0b5df2dfaacd6eb6c1c56cc710f529f31c6c44 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1378 │ 1378 │ 1011 │ 709892239 │ 709892239 │ 0.0003405743725520270 │ 0.0003405743725520270 │ 0.0003381303792971470 │ 0.0003381303792971470 │ 0.0000024439932548800 │ 0.0000024439932548800 │ 0.0000016614856152610 │ 0.0000016614856152610 │ 0.0000007825076396190 │ 0.0000007825076396190 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 3.4427665504876723e-06 │ 2.3404758130635094e-06 │ 0.0 │ 8.174754733242228 │ 1.7449185898165436 │ 5512 │ 0 │ 5512 │ 11524.489600000000 │ 139758.551400000000 │ 2204800 │ 137800 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xc96909cd052f6000ffaf3e9ff17f9c2047cfd1b8 │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1377 │ 1377 │ 1294 │ 489785396 │ 489785396 │ 0.0005479238051485660 │ 0.0005479238051485660 │ 0.0003398517049643630 │ 0.0003398517049643630 │ 0.0002080721001842030 │ 0.0002080721001842030 │ 0.0002075249990322950 │ 0.0002075249990322950 │ 0.0000005471011519080 │ 0.0000005471011519080 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.000424822997752679 │ 0.00042370597557035976 │ 0.0 │ 8.186137752838 │ 1.7737158616522526 │ 2754 │ 1377 │ 1377 │ 11516.126400000000 │ 139657.130100000000 │ 2203200 │ 137700 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xc96faba4ff9941a55754d7a4b02aeaf7d53f43b9 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1375 │ 1375 │ 1243 │ 708337771 │ 708337771 │ 0.0003951649379339080 │ 0.0003951649379339080 │ 0.0003377082167361510 │ 0.0003377082167361510 │ 0.0000574567211977570 │ 0.0000574567211977570 │ 0.0000566747668676990 │ 0.0000566747668676990 │ 0.0000007819543300580 │ 0.0000007819543300580 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 8.111486292287101e-05 │ 8.001093431413104e-05 │ 0.0 │ 8.180426687822184 │ 1.7466995186037855 │ 5500 │ 0 │ 5500 │ 11499.400000000000 │ 139454.287500000000 │ 2200000 │ 137500 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x3c9779d3ec32ed4985a3e634c44d38c517564f5b │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1373 │ 1373 │ 1294 │ 491075055 │ 491075055 │ 0.0008552131244147220 │ 0.0008552131244147220 │ 0.0003387120382349520 │ 0.0003387120382349520 │ 0.0005165010861797700 │ 0.0005165010861797700 │ 0.0005159557138518800 │ 0.0005159557138518800 │ 0.0000005453723278900 │ 0.0000005453723278900 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0010517762629579505 │ 0.0010506656947823995 │ 0.0 │ 8.185846771361819 │ 1.7679067135344035 │ 2746 │ 1373 │ 1373 │ 11482.673600000000 │ 139251.444900000000 │ 2196800 │ 137300 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x74e27bd4fdb82f36d843d049dee5fd2d5f03335f │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1364 │ 1364 │ 1341 │ 703534687 │ 703534687 │ 0.0010010743284877850 │ 0.0010010743284877850 │ 0.0003357583603829810 │ 0.0003357583603829810 │ 0.0006653159681048040 │ 0.0006653159681048040 │ 0.0006645372476909190 │ 0.0006645372476909190 │ 0.0000007787204138850 │ 0.0000007787204138850 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0009456761413454004 │ 0.0009445692728024922 │ 0.0 │ 8.188979361125213 │ 1.750083199381662 │ 5456 │ 0 │ 5456 │ 11407.404800000000 │ 138338.653200000000 │ 2182400 │ 136400 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x678fa1d680beb37d345412fb60b381c429276faf │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1269 │ 1269 │ 1158 │ 653747506 │ 653747506 │ 0.0006606553463715090 │ 0.0006606553463715090 │ 0.0003128380455535130 │ 0.0003128380455535130 │ 0.0003478173008179960 │ 0.0003478173008179960 │ 0.0003470885916694200 │ 0.0003470885916694200 │ 0.0000007287091485760 │ 0.0000007287091485760 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005320361418220018 │ 0.0005309214773041444 │ 0.0 │ 8.21656335963141 │ 1.7527739641574809 │ 5076 │ 0 │ 5076 │ 10612.900800000000 │ 128703.629700000000 │ 2030400 │ 126900 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xa750a354528b56a62ee6f8538ca340f1d986c878 │ 0xca11bde05977b3631167028862be2a173976ca11 │ 0x82ad56cb │ 645 │ 645 │ 643 │ 120615423 │ 120615423 │ 0.0005615134749219040 │ 0.0005615134749219040 │ 0.0005054401110283420 │ 0.0005054401110283420 │ 0.0000560733638935620 │ 0.0000560733638935620 │ 0.0000559428295058780 │ 0.0000559428295058780 │ 0.0000001305343876840 │ 0.0000001305343876840 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0004648938129045238 │ 0.00046381157661635027 │ 0.0 │ 8.190255176056374 │ 1.7265227217195962 │ 783860 │ 595812 │ 188048 │ 17367.684949000000 │ 210619.521895687500 │ 3322687 │ 207804 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x0771483e9ad0d8c452efbca3451e4e56249b64bd │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 0xe129b4b8 │ 531 │ 411 │ 244 │ 255606813 │ 240203893 │ 0.0006421451107887370 │ 0.0005577252442263160 │ 0.0003349658754101420 │ 0.0002690557854285030 │ 0.0003071792353785950 │ 0.0002886694587978130 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003774028573460 │ 0.0000003553926710770 │ 0.0003068018325212490 │ 0.0002883140661267360 │ 0.0012017646625819595 │ 0.0 │ 0.001200288164937329 │ 8.250504460545287 │ 2.1931209621529346 │ 124991 │ 28064 │ 96927 │ 9585.962564000000 │ 116249.854719750000 │ 1833932 │ 114638 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n",
+ "│ 10 rows 36 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_agg_tx_from_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ to_address │ method_id │ count_transactions │ count_transactions_success │ count_unique_blocks │ count_unique_from_addresses │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n",
+ "│ date │ varchar │ int32 │ varchar │ varchar │ varchar │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 6766 │ 6766 │ 1366 │ 5 │ 3486432524 │ 3486432524 │ 0.0029310947547187890 │ 0.0029310947547187890 │ 0.0016644745896522240 │ 0.0016644745896522240 │ 0.0012666201650665650 │ 0.0012666201650665650 │ 0.0012627622421891670 │ 0.0012627622421891670 │ 0.0000038579228773980 │ 0.0000038579228773980 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00036329977888496914 │ 0.00036219322573906987 │ 0.0 │ 8.188288767636077 │ 1.749725911569594 │ 27064 │ 0 │ 27064 │ 56585.411200000000 │ 686216.515800000000 │ 10825600 │ 676600 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 4132 │ 4132 │ 1361 │ 3 │ 1463179017 │ 1463179017 │ 0.0017944371588618550 │ 0.0017944371588618550 │ 0.0010198021012514210 │ 0.0010198021012514210 │ 0.0007746350576104340 │ 0.0007746350576104340 │ 0.0007730079479936740 │ 0.0007730079479936740 │ 0.0000016271096167600 │ 0.0000016271096167600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005294191951977904 │ 0.0005283071579160528 │ 0.0 │ 8.18465436287236 │ 1.76898462682423 │ 8264 │ 4132 │ 4132 │ 34556.742400000000 │ 419072.811600000000 │ 6611200 │ 413200 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xca11bde05977b3631167028862be2a173976ca11 │ 0x82ad56cb │ 1953 │ 1953 │ 1025 │ 14 │ 368648954 │ 368648954 │ 0.0017152021180275460 │ 0.0017152021180275460 │ 0.0015446633785242060 │ 0.0015446633785242060 │ 0.0001705387395033400 │ 0.0001705387395033400 │ 0.0001693481029723900 │ 0.0001693481029723900 │ 0.0000003977523406470 │ 0.0000003977523406470 │ 0.0000007956603712990 │ 0.0000007956603712990 │ 0.0004626047019879514 │ 0.00045937497213782957 │ 2.158314468726256e-06 │ 8.150272419802972 │ 1.7415342558618798 │ 2368996 │ 1799132 │ 569864 │ 52768.666254000000 │ 639930.496789125000 │ 10095402 │ 631379 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x802b65b5d9016621e66003aed0b16615093f328b │ 0xa00597a0 │ 1232 │ 1062 │ 555 │ 24 │ 147821257 │ 137693545 │ 0.0100565704491694620 │ 0.0094198296878668720 │ 0.0004155514541569470 │ 0.0003572613217446540 │ 0.0096410189950125150 │ 0.0090625683661222180 │ 0.0096408431679565280 │ 0.0090624058163189720 │ 0.0000001758270559870 │ 0.0000001625498032460 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0652207888816188 │ 0.06521959942443546 │ 0.0 │ 8.179245044635106 │ 1.8934894037806322 │ 241472 │ 171539 │ 69933 │ 13313.498301000000 │ 161454.025401187500 │ 2547063 │ 159449 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 0x00000001 │ 860 │ 581 │ 334 │ 39 │ 196779084 │ 168296201 │ 0.0059076257887813410 │ 0.0043030184416324580 │ 0.0003818180253589620 │ 0.0002561905894682100 │ 0.0055258077634223790 │ 0.0040468278521642480 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000002658997551030 │ 0.0000002266407367040 │ 0.0055255418636672760 │ 0.0040466012114275440 │ 0.028081275972513316 │ 0.0 │ 0.028079924712258928 │ 8.244433172100253 │ 2.1350748990277957 │ 120703 │ 29229 │ 91474 │ 11095.358127000000 │ 134554.434332062500 │ 2122701 │ 132793 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 0xa9059cbb │ 728 │ 728 │ 537 │ 563 │ 25456048 │ 25456048 │ 0.0040625414726000710 │ 0.0040625414726000710 │ 0.0001964661196555430 │ 0.0001964661196555430 │ 0.0038660753529445280 │ 0.0038660753529445280 │ 0.0033772419587455260 │ 0.0033772419587455260 │ 0.0000000295539835420 │ 0.0000000295539835420 │ 0.0004888038402154600 │ 0.0004888038402154600 │ 0.15187256690215734 │ 0.1326695313720938 │ 0.019201874549241108 │ 8.035720630971008 │ 1.972745485799214 │ 49504 │ 29316 │ 20188 │ 6088.409600000000 │ 73834.706400000000 │ 1164800 │ 72800 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0xb2460c48 │ 645 │ 582 │ 258 │ 22 │ 91833326 │ 88720964 │ 0.1301338657302059040 │ 0.1267186651330060110 │ 0.0001795861496755980 │ 0.0001617806061999360 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.0000001239708663080 │ 0.0000001194382884650 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 1.4151102354773724 │ 1.4151102354773724 │ 0.0 │ 8.34974817814926 │ 2.0426825710566794 │ 23220 │ 7212 │ 16008 │ 5394.264000000000 │ 65416.738500000000 │ 1032000 │ 64500 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 0xe129b4b8 │ 531 │ 411 │ 244 │ 1 │ 255606813 │ 240203893 │ 0.0006421451107887370 │ 0.0005577252442263160 │ 0.0003349658754101420 │ 0.0002690557854285030 │ 0.0003071792353785950 │ 0.0002886694587978130 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003774028573460 │ 0.0000003553926710770 │ 0.0003068018325212490 │ 0.0002883140661267360 │ 0.0012017646625819595 │ 0.0 │ 0.001200288164937329 │ 8.250504460545287 │ 2.1931209621529346 │ 124991 │ 28064 │ 96927 │ 9585.962564000000 │ 116249.854719750000 │ 1833932 │ 114638 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x2b86d9abaf056661ab3d43201211172aa0e0b8c4 │ 0x00000000 │ 427 │ 312 │ 220 │ 20 │ 99067881 │ 89687455 │ 0.0015839057563132140 │ 0.0013702666997647930 │ 0.0002492569463044840 │ 0.0001831644931472380 │ 0.0013346488100087300 │ 0.0011871022066175550 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000001285124851690 │ 0.0000001167377014790 │ 0.0013345202975235610 │ 0.0011869854689160760 │ 0.013472063766143641 │ 0.0 │ 0.013470766549690923 │ 8.370617304692704 │ 1.9801324067381532 │ 109286 │ 26074 │ 83212 │ 7670.575457000000 │ 93021.778098937500 │ 1467491 │ 91738 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 0x00000002 │ 375 │ 233 │ 242 │ 39 │ 45886694 │ 34563118 │ 0.0026296801972266880 │ 0.0016010900793226030 │ 0.0001423950597136840 │ 0.0000905432151757250 │ 0.0024872851375130040 │ 0.0015105468641468780 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000594774491490 │ 0.0000000457077350370 │ 0.0024872256600638550 │ 0.0015105011564118410 │ 0.054204932207864084 │ 0.0 │ 0.05420363602712052 │ 8.205539296170423 │ 1.9898004619641945 │ 57375 │ 27431 │ 29944 │ 4422.569927000000 │ 53632.914594562500 │ 846101 │ 52881 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n",
+ "│ 10 rows 36 columns │\n",
+ "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_agg_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────────────────┬─────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ to_address │ count_transactions │ count_transactions_success │ count_unique_blocks │ count_unique_from_addresses │ count_unique_method_ids │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n",
+ "│ date │ varchar │ int32 │ varchar │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────────────────┼─────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 6766 │ 6766 │ 1366 │ 5 │ 1 │ 3486432524 │ 3486432524 │ 0.0029310947547187890 │ 0.0029310947547187890 │ 0.0016644745896522240 │ 0.0016644745896522240 │ 0.0012666201650665650 │ 0.0012666201650665650 │ 0.0012627622421891670 │ 0.0012627622421891670 │ 0.0000038579228773980 │ 0.0000038579228773980 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00036329977888496914 │ 0.00036219322573906987 │ 0.0 │ 8.188288767636077 │ 1.749725911569594 │ 27064 │ 0 │ 27064 │ 56585.411200000000 │ 686216.515800000000 │ 10825600 │ 676600 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 4132 │ 4132 │ 1361 │ 3 │ 1 │ 1463179017 │ 1463179017 │ 0.0017944371588618550 │ 0.0017944371588618550 │ 0.0010198021012514210 │ 0.0010198021012514210 │ 0.0007746350576104340 │ 0.0007746350576104340 │ 0.0007730079479936740 │ 0.0007730079479936740 │ 0.0000016271096167600 │ 0.0000016271096167600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005294191951977904 │ 0.0005283071579160528 │ 0.0 │ 8.18465436287236 │ 1.76898462682423 │ 8264 │ 4132 │ 4132 │ 34556.742400000000 │ 419072.811600000000 │ 6611200 │ 413200 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xca11bde05977b3631167028862be2a173976ca11 │ 1953 │ 1953 │ 1025 │ 14 │ 1 │ 368648954 │ 368648954 │ 0.0017152021180275460 │ 0.0017152021180275460 │ 0.0015446633785242060 │ 0.0015446633785242060 │ 0.0001705387395033400 │ 0.0001705387395033400 │ 0.0001693481029723900 │ 0.0001693481029723900 │ 0.0000003977523406470 │ 0.0000003977523406470 │ 0.0000007956603712990 │ 0.0000007956603712990 │ 0.0004626047019879514 │ 0.00045937497213782957 │ 2.158314468726256e-06 │ 8.150272419802972 │ 1.7415342558618798 │ 2368996 │ 1799132 │ 569864 │ 52768.666254000000 │ 639930.496789125000 │ 10095402 │ 631379 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x802b65b5d9016621e66003aed0b16615093f328b │ 1416 │ 1244 │ 570 │ 29 │ 2 │ 181646841 │ 171429824 │ 0.0108782510554045840 │ 0.0102386569241862050 │ 0.0004951275076615130 │ 0.0004362167537166010 │ 0.0103831235477430710 │ 0.0098024401704696040 │ 0.0103829011191635720 │ 0.0098022311425260160 │ 0.0000002224285794990 │ 0.0000002090279435880 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0571610466253199 │ 0.05715982211418459 │ 0.0 │ 8.171833945862689 │ 1.9660420553473057 │ 283424 │ 200785 │ 82639 │ 15534.450601000000 │ 188387.719382437500 │ 2971963 │ 185984 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 1254 │ 833 │ 433 │ 40 │ 4 │ 243866812 │ 204060353 │ 0.0085534027251148020 │ 0.0059202052600618340 │ 0.0005297215979739630 │ 0.0003522423175452520 │ 0.0080236811271408390 │ 0.0055679629425165820 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003272555681630 │ 0.0000002742268356520 │ 0.0080233538715726760 │ 0.0055676887156809300 │ 0.03290189862793154 │ 0.0 │ 0.03290055668408326 │ 8.239423478882845 │ 2.107833908320731 │ 179978 │ 57796 │ 122182 │ 15677.633812000000 │ 190124.115426750000 │ 2999356 │ 187582 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 773 │ 773 │ 560 │ 593 │ 3 │ 27282141 │ 27282141 │ 0.0044753602954082940 │ 0.0044753602954082940 │ 0.0002091756264387080 │ 0.0002091756264387080 │ 0.0042661846689695860 │ 0.0042661846689695860 │ 0.0037770245145686980 │ 0.0037770245145686980 │ 0.0000000319845278930 │ 0.0000000319845278930 │ 0.0004891283261214480 │ 0.0004891283261214480 │ 0.156372795997557 │ 0.13844311245839167 │ 0.017928516904939684 │ 8.045102861593637 │ 1.9794536922851642 │ 52660 │ 30871 │ 21789 │ 6466.818265000000 │ 78423.703283437500 │ 1237195 │ 77325 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 645 │ 582 │ 258 │ 22 │ 1 │ 91833326 │ 88720964 │ 0.1301338657302059040 │ 0.1267186651330060110 │ 0.0001795861496755980 │ 0.0001617806061999360 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.0000001239708663080 │ 0.0000001194382884650 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 1.4151102354773724 │ 1.4151102354773724 │ 0.0 │ 8.34974817814926 │ 2.0426825710566794 │ 23220 │ 7212 │ 16008 │ 5394.264000000000 │ 65416.738500000000 │ 1032000 │ 64500 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x8864dedd579cd1d7c36e099adf18465a8ded456d │ 640 │ 189 │ 341 │ 14 │ 4 │ 50096969 │ 30864767 │ 0.0070723659366675420 │ 0.0038263909960486210 │ 0.0001833643481359590 │ 0.0000549551334551500 │ 0.0068890015885315830 │ 0.0037714358625934710 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000678510879360 │ 0.0000000442586674330 │ 0.0068889337374436470 │ 0.0037713916039260380 │ 0.13751334114707783 │ 0.0 │ 0.13751198675200585 │ 8.266924337552002 │ 2.030841530355978 │ 82134 │ 58371 │ 23763 │ 5545.617012000000 │ 67252.210476750000 │ 1060956 │ 66365 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x2b86d9abaf056661ab3d43201211172aa0e0b8c4 │ 562 │ 429 │ 270 │ 21 │ 4 │ 115573680 │ 104304264 │ 0.0018842709429315030 │ 0.0016301632833440710 │ 0.0003077722249904040 │ 0.0002336658955041920 │ 0.0015764987179410990 │ 0.0013964973878398790 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000001519665802760 │ 0.0000001374043068420 │ 0.0015763467513608230 │ 0.0013963599835330370 │ 0.01364063788520967 │ 0.0 │ 0.013639322996038743 │ 8.359806547584222 │ 2.007466056351254 │ 129090 │ 32946 │ 96144 │ 9360.077759000000 │ 113510.528795062500 │ 1790717 │ 111940 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 540 │ 457 │ 431 │ 15 │ 4 │ 118174601 │ 114226587 │ 0.0009009555701843000 │ 0.0008705263939930400 │ 0.0001733808189142260 │ 0.0001510135358454320 │ 0.0007275747512700740 │ 0.0007195128581476080 │ 0.0007268461725643530 │ 0.0007187874416905200 │ 0.0000000965964031140 │ 0.0000000934341544810 │ 0.0000006319833258710 │ 0.0000006319833258710 │ 0.006156777726459801 │ 0.006150612453215331 │ 5.347877805578545e-06 │ 7.875161467080705 │ 1.4186915815533334 │ 228688 │ 196058 │ 32630 │ 6869.098639000000 │ 83302.194590062500 │ 1314157 │ 82155 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────────────────┴─────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n",
+ "│ 10 rows 36 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_agg_tx_to_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Check the data output size"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────┬─────────┬─────────┐\n",
+ "│ num_rows │ num_tos │ num_txs │\n",
+ "│ int64 │ int64 │ int128 │\n",
+ "├──────────┼─────────┼─────────┤\n",
+ "│ 5885 │ 1374 │ 31773 │\n",
+ "└──────────┴─────────┴─────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_agg_tx_from_tx_to_method_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────┬─────────┬─────────┐\n",
+ "│ num_rows │ num_tos │ num_txs │\n",
+ "│ int64 │ int64 │ int128 │\n",
+ "├──────────┼─────────┼─────────┤\n",
+ "│ 2327 │ 1374 │ 31773 │\n",
+ "└──────────┴─────────┴─────────┘"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_agg_tx_to_method_v1\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────┬─────────┬─────────┐\n",
+ "│ num_rows │ num_tos │ num_txs │\n",
+ "│ int64 │ int64 │ int128 │\n",
+ "├──────────┼─────────┼─────────┤\n",
+ "│ 1374 │ 1374 │ 31773 │\n",
+ "└──────────┴─────────┴─────────┘"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_agg_tx_to_v1\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Get table schema"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_success │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_blocks │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_method_ids │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ avg_l2_legacy_extra_gas_price_gwei │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ avg_l1_base_gas_price_gwei │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ avg_l1_blob_base_gas_price_gwei │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_input_byte_length │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_input_zero_bytes │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_input_nonzero_bytes │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_l1_base_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_l1_blob_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_l1_gas_used_unified │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_estimated_size │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "├────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 36 rows (20 shown) 6 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "duckdb_client.sql(\"DESCRIBE daily_transactions_agg_tx_to_v1\")\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": ".venv",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/src/op_analytics/datapipeline/models/code/refined_traces_models.py b/src/op_analytics/datapipeline/models/code/refined_traces_models.py
new file mode 100644
index 00000000000..27952f5de6e
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/code/refined_traces_models.py
@@ -0,0 +1,62 @@
+import duckdb
+
+from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery
+from op_analytics.datapipeline.models.compute.registry import register_model
+from op_analytics.datapipeline.models.compute.types import NamedRelations
+
+
+@register_model(
+ input_datasets=[
+ "ingestion/transactions_v1",
+ "ingestion/blocks_v1",
+ "ingestion/traces_v1",
+ ],
+ expected_outputs=[
+ "refined_trace_calls_v1",
+ "refined_trace_calls_agg_tr_from_tr_to_hash_v1",
+ "daily_trace_calls_agg_tr_to_tx_to_v1",
+ "daily_trace_calls_agg_to_v1",
+ ],
+ auxiliary_views=[
+ TemplatedSQLQuery(
+ template_name="refined_transactions_fees",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="refined_trace_calls",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="refined_trace_calls_agg_tr_from_tr_to_hash",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="refined_trace_calls_agg_tr_to_hash",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="daily_trace_calls_agg_tr_to_tx_to",
+ context={},
+ ),
+ TemplatedSQLQuery(
+ template_name="daily_trace_calls_agg_tr_to",
+ context={},
+ ),
+ ],
+)
+def refined_traces_models(
+ duckdb_client: duckdb.DuckDBPyConnection,
+) -> NamedRelations:
+ return {
+ "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
+ "refined_trace_calls_agg_tr_from_tr_to_hash_v1": duckdb_client.view(
+ "refined_trace_calls_agg_tr_from_tr_to_hash"
+ ),
+ "refined_trace_calls_agg_to_hash_v1": duckdb_client.view(
+ "refined_trace_calls_agg_tr_to_hash"
+ ),
+ "daily_trace_calls_agg_tr_to_tx_to_v1": duckdb_client.view(
+ "daily_trace_calls_agg_tr_to_tx_to"
+ ),
+ "daily_trace_calls_agg_to_v1": duckdb_client.view("daily_trace_calls_agg_tr_to"),
+ }
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py b/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py
similarity index 66%
rename from src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
rename to src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py
index 051aee6b087..84996faa289 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_traces_address_models.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py
@@ -10,23 +10,20 @@
"ingestion/transactions_v1",
"ingestion/blocks_v1",
"ingestion/logs_v1",
- "ingestion/traces_v1",
],
expected_outputs=[
"refined_transactions_fees_v1",
- "refined_trace_calls_v1",
"event_emitting_transactions_v1",
"summary_v1",
+ "daily_transactions_agg_tx_from_tx_to_method_v1",
+ "daily_transactions_agg_tx_to_method_v1",
+ "daily_transactions_agg_tx_to_v1",
],
auxiliary_views=[
TemplatedSQLQuery(
template_name="refined_transactions_fees",
context={},
),
- TemplatedSQLQuery(
- template_name="refined_trace_calls",
- context={},
- ),
TemplatedSQLQuery(
template_name="logs_topic0_filters",
context={},
@@ -40,30 +37,31 @@
context={},
),
TemplatedSQLQuery(
- template_name="refined_trace_calls_agg_from_to_hash",
+ template_name="daily_transactions_agg_tx_from_tx_to_method",
context={},
),
TemplatedSQLQuery(
- template_name="refined_trace_calls_agg_to_hash",
+ template_name="daily_transactions_agg_tx_to_method",
context={},
),
TemplatedSQLQuery(
- template_name="daily_trace_calls_agg_to",
+ template_name="daily_transactions_agg_tx_to",
context={},
),
],
)
-def refined_transactions_traces_address_models(
+def refined_transactions_addresses_models(
duckdb_client: duckdb.DuckDBPyConnection,
) -> NamedRelations:
return {
"refined_transactions_fees_v1": duckdb_client.view("refined_transactions_fees"),
- "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
"event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
"summary_v1": duckdb_client.view("daily_address_summary"),
- "refined_trace_calls_agg_from_to_hash_v1": duckdb_client.view(
- "refined_trace_calls_agg_from_to_hash"
+ "daily_transactions_agg_tx_from_tx_to_method_v1": duckdb_client.view(
+ "daily_transactions_agg_tx_from_tx_to_method"
+ ),
+ "daily_transactions_agg_tx_to_method_v1": duckdb_client.view(
+ "daily_transactions_agg_tx_to_method"
),
- "refined_trace_calls_agg_to_hash_v1": duckdb_client.view("refined_trace_calls_agg_to_hash"),
- "daily_trace_calls_agg_to_v1": duckdb_client.view("daily_trace_calls_agg_to"),
+ "daily_transactions_agg_tx_to_v1": duckdb_client.view("daily_transactions_agg_tx_to"),
}
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index 5a63165994f..535e6054621 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -40,9 +40,9 @@ SELECT
count(DISTINCT method_id) AS method_id_ucnt,
- sum(receipt_gas_used) AS l2_gas_used_sum,
+ sum(l2_gas_used) AS l2_gas_used_sum,
- sum(if(success, receipt_gas_used, 0)) AS success_l2_gas_used_sum,
+ sum(if(success, l2_gas_used, 0)) AS success_l2_gas_used_sum,
sum(l1_gas_used_unified) AS l1_gas_used_unified_sum,
@@ -69,13 +69,13 @@ SELECT
wei_to_eth(sum(l1_blob_fee)) AS l1_blob_fee_sum_eth,
-- L2 Price and breakdown into BASE + PRIORITY
- wei_to_gwei(safe_div(sum(l2_fee), sum(receipt_gas_used)))
+ wei_to_gwei(safe_div(sum(l2_fee), sum(l2_gas_used)))
AS l2_gas_price_avg_gwei,
- wei_to_gwei(safe_div(sum(l2_base_fee), sum(receipt_gas_used)))
+ wei_to_gwei(safe_div(sum(l2_base_fee), sum(l2_gas_used)))
AS l2_base_price_avg_gwei,
- wei_to_gwei(safe_div(sum(l2_priority_fee), sum(receipt_gas_used)))
+ wei_to_gwei(safe_div(sum(l2_priority_fee), sum(l2_gas_used)))
AS l2_priority_price_avg_gwei,
-- L1 Price breakdown into BASE + BLOB
@@ -102,7 +102,6 @@ FROM
refined_transactions_fees
WHERE
NOT is_system_transaction
- AND gas_price > 0
GROUP BY
1,
2,
diff --git a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to.sql.j2
similarity index 86%
rename from src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2
rename to src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to.sql.j2
index 9190098c349..c442469a8ef 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_to.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to.sql.j2
@@ -6,7 +6,7 @@ WITH get_unique_callers AS (
SELECT
dt, chain_id, trace_to_address,
COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses
- FROM refined_trace_calls_agg_from_to_hash
+ FROM refined_trace_calls_agg_tr_from_tr_to_hash
GROUP BY
dt, chain, network, chain_id, trace_to_address
)
@@ -31,8 +31,8 @@ dt, chain, network, chain_id, trace_to_address
, COUNT(DISTINCT tx_to_address) AS count_unique_tx_to_addresses
, COUNT(DISTINCT tx_method_id) AS count_unique_tx_method_ids
-- Transaction-Level gas & fees
- , SUM(tx_gas_used) AS sum_tx_gas_used_called
- , SUM(tx_gas_used) FILTER (WHERE tx_success) AS sum_tx_gas_used_called_tx_success
+ , SUM(tx_l2_gas_used) AS sum_tx_l2_gas_used_called
+ , SUM(tx_l2_gas_used) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_called_tx_success
, SUM(tx_fee_native) AS sum_tx_fee_native_called
, SUM(tx_fee_native) FILTER (WHERE tx_success) AS sum_tx_fee_native_called_tx_success
@@ -53,11 +53,11 @@ dt, chain, network, chain_id, trace_to_address
, SUM(tx_l2_legacy_extra_fee_native) FILTER (WHERE tx_success) AS tx_l2_legacy_extra_fee_native_tx_success
-- Transaction-Level Gas Prices
- , SUM(tx_gas_used * tx_l2_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l2_gas_price_gwei_called
- , SUM(tx_gas_used * tx_l2_priority_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l2_priority_gas_price_gwei_called
- , SUM(tx_gas_used * tx_l2_legacy_extra_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l2_legacy_extra_gas_price_gwei_called
- , SUM(tx_gas_used * tx_l1_base_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l1_base_gas_price_gwei_called
- , SUM(tx_gas_used * tx_l1_blob_base_gas_price_gwei) / SUM(tx_gas_used) AS avg_tx_l1_blob_base_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l2_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l2_priority_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_priority_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l2_legacy_extra_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_legacy_extra_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l1_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_base_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l1_blob_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_blob_base_gas_price_gwei_called
-- Transaction-Level transaction sizes
, SUM(tx_input_byte_length) AS sum_tx_input_byte_length_called
, SUM(tx_input_zero_bytes) AS sum_tx_input_zero_bytes_called
@@ -81,8 +81,8 @@ dt, chain, network, chain_id, trace_to_address
, SUM(sum_trace_gas_used_minus_subtraces) FILTER (WHERE tx_success) AS sum_trace_gas_used_minus_subtraces_tx_success
- , SUM(sum_tx_gas_used_amortized_by_call) AS sum_tx_gas_used_amortized_by_call
- , SUM(sum_tx_gas_used_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_gas_used_amortized_by_call_tx_success
+ , SUM(sum_tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call
+ , SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_amortized_by_call_tx_success
, SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
, SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
@@ -124,7 +124,7 @@ dt, chain, network, chain_id, trace_to_address
--normal function calls
, SUM(count_internal_calls_call_type) AS count_internal_calls_call_type
, SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success
-
+
-- Experimental
, COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call) AS count_transactions_called_with_internal_type_call
, COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call_or_delegate) AS count_transactions_called_with_internal_type_call_or_delegate
@@ -132,9 +132,9 @@ dt, chain, network, chain_id, trace_to_address
, SUM(sum_trace_gas_used_minus_subtraces) FILTER (
WHERE tx_success AND is_transaction_with_internal_call_type_call
) AS sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call
-, SUM(sum_tx_gas_used_amortized_by_call) FILTER (
+, SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER (
WHERE tx_success AND is_transaction_with_internal_call_type_call
- ) AS sum_tx_gas_used_amortized_by_call_tx_success_called_with_internal_type_call
+ ) AS sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call
, SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (
WHERE tx_success AND is_transaction_with_internal_call_type_call
) AS sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call
@@ -146,7 +146,8 @@ dt, chain, network, chain_id, trace_to_address
) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
-FROM refined_trace_calls_agg_to_hash
+FROM refined_trace_calls_agg_tr_to_hash
+WHERE NOT is_system_transaction
GROUP BY
dt, chain, network, chain_id, trace_to_address
diff --git a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2
new file mode 100644
index 00000000000..c539615b36e
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2
@@ -0,0 +1,169 @@
+/*Aggreagte traces by day,
+ The internal contract called (trace to address),
+ direct contract called (tx to address),
+ and direct function called (tx method id).
+ This will be used as the to show in what direct user action contracts are often called within
+ (i.e. see that an oracle contract was called within a lending market action)
+*/
+
+-- Get Unique contracts that call this contract, since we lose this granularity at the to_hash level
+WITH get_unique_callers AS (
+ SELECT
+ dt, chain_id, trace_to_address, tx_to_address, tx_method_id,
+ COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses
+ FROM refined_trace_calls_agg_tr_from_tr_to_hash
+ GROUP BY
+ dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id
+)
+
+, raw_aggregation AS (
+SELECT
+dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id
+-- Aggregate transaction metrics, in transactions when a given contract was called
+/*
+ Note: We can NOT sum these up at the project level, since a project may have
+ many of its contracts called in a single transaction.
+
+ For these use cases (i.e. project impact metrics), we can aggregate `daily_trace_calls_agg_to_hash`
+ at the project name level, only after all trace_to_address entries are mapped to their respective
+ project name (i.e. a transaction may call 10 contracts, but this may only represent 3 projects).
+*/
+-- Attributes
+ -- Since we're aggregating from the to & hash level, count(*) returns distinct transactions
+ , COUNT(*) AS count_transactions_called
+ , COUNT(*) FILTER (WHERE tx_success) AS count_transactions_called_tx_success
+ , COUNT(DISTINCT block_number) AS count_unique_blocks_called
+ , COUNT(DISTINCT tx_from_address) AS count_unique_tx_from_addresses
+-- Transaction-Level gas & fees
+ , SUM(tx_l2_gas_used) AS sum_tx_l2_gas_used_called
+ , SUM(tx_l2_gas_used) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_called_tx_success
+
+ , SUM(tx_fee_native) AS sum_tx_fee_native_called
+ , SUM(tx_fee_native) FILTER (WHERE tx_success) AS sum_tx_fee_native_called_tx_success
+
+ , SUM(tx_l1_fee_native) AS tx_l1_fee_native
+ , SUM(tx_l1_fee_native) FILTER (WHERE tx_success) AS tx_l1_fee_native_tx_success
+
+ , SUM(tx_l2_fee_native) AS tx_l2_fee_native
+ , SUM(tx_l2_fee_native) FILTER (WHERE tx_success) AS tx_l2_fee_native_tx_success
+
+ , SUM(tx_l2_priority_fee_native) AS tx_l2_priority_fee_native
+ , SUM(tx_l2_priority_fee_native) FILTER (WHERE tx_success) AS tx_l2_priority_fee_native_tx_success
+
+ , SUM(tx_l2_base_fee_native) AS tx_l2_base_fee_native
+ , SUM(tx_l2_base_fee_native) FILTER (WHERE tx_success) AS tx_l2_base_fee_native_tx_success
+
+ , SUM(tx_l2_legacy_extra_fee_native) AS tx_l2_legacy_extra_fee_native
+ , SUM(tx_l2_legacy_extra_fee_native) FILTER (WHERE tx_success) AS tx_l2_legacy_extra_fee_native_tx_success
+
+ -- Transaction-Level Gas Prices
+ , SUM(tx_l2_gas_used * tx_l2_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l2_priority_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_priority_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l2_legacy_extra_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_legacy_extra_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l1_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_base_gas_price_gwei_called
+ , SUM(tx_l2_gas_used * tx_l1_blob_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_blob_base_gas_price_gwei_called
+ -- Transaction-Level transaction sizes
+ , SUM(tx_input_byte_length) AS sum_tx_input_byte_length_called
+ , SUM(tx_input_zero_bytes) AS sum_tx_input_zero_bytes_called
+ , SUM(tx_input_nonzero_bytes) AS sum_tx_input_nonzero_bytes_called
+ , SUM(tx_l1_base_scaled_size) AS sum_tx_l1_base_scaled_size_called
+ , SUM(tx_l1_blob_scaled_size) AS sum_tx_l1_blob_scaled_size_called
+ , SUM(tx_l1_gas_used_unified) AS sum_tx_l1_gas_used_unified_called
+ , SUM(tx_estimated_size) AS sum_tx_estimated_size_called
+
+-- Sum Internal Trace Gas
+/*
+ Note: As opposed to transaction-level equivalent metrics, these CAN be summed up at a project level.
+ These methodologies were designed to distribute gas usage and fees across each call, so that they
+ still represent a "part of a whole," whereas transaction-level metrics do not.
+*/
+
+ , SUM(sum_trace_gas_used) AS sum_trace_gas_used
+ , SUM(sum_trace_gas_used) FILTER (WHERE tx_success) AS sum_trace_gas_used_tx_success
+
+ , SUM(sum_trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces
+ , SUM(sum_trace_gas_used_minus_subtraces) FILTER (WHERE tx_success) AS sum_trace_gas_used_minus_subtraces_tx_success
+
+
+ , SUM(sum_tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call
+ , SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
+ , SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
+ , SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call
+ , SUM(sum_tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call
+
+ , SUM(sum_tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_minus_subtraces_tx_success
+
+ , SUM(sum_tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces
+ , SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces
+
+ , SUM(sum_tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call
+ , SUM(sum_tx_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_fee_native_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call
+ , SUM(sum_tx_l1_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l1_fee_native_amortized_by_call_tx_success
+
+ , SUM(sum_tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call
+ , SUM(sum_tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call
+
+ , SUM(sum_tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces
+
+ -- Calls
+ , SUM(count_top_level_calls) AS count_top_level_calls
+ --count non-null trace addresses, null is the transaction-level call.
+ , SUM(count_internal_calls_all_types) AS count_internal_calls_all_types
+ , SUM(count_internal_calls_all_types_trace_success) AS count_internal_calls_all_types_trace_success
+ --static calls only read state, and can not write
+ , SUM(count_internal_calls_static_type) AS count_internal_calls_static_type
+ , SUM(count_internal_calls_static_type_trace_success) AS count_internal_calls_static_type_trace_success
+ --delegate calls call a function on another contract
+ , SUM(count_internal_calls_delegate_type) AS count_internal_calls_delegate_type
+ , SUM(count_internal_calls_delegate_type_trace_success) AS count_internal_calls_delegate_type_trace_success
+ --normal function calls
+ , SUM(count_internal_calls_call_type) AS count_internal_calls_call_type
+ , SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success
+
+ -- Experimental
+ , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call) AS count_transactions_called_with_internal_type_call
+ , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call_or_delegate) AS count_transactions_called_with_internal_type_call_or_delegate
+
+ , SUM(sum_trace_gas_used_minus_subtraces) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call
+, SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call
+, SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call
+, SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
+, SUM(sum_tx_fee_native_amortized_by_call) FILTER (
+ WHERE tx_success AND is_transaction_with_internal_call_type_call
+ ) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
+
+
+FROM refined_trace_calls_agg_tr_to_hash
+WHERE NOT is_system_transaction
+
+GROUP BY
+dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id
+)
+
+SELECT
+ra.*, gu.count_unique_trace_from_addresses
+
+FROM raw_aggregation ra
+LEFT JOIN get_unique_callers gu
+ON ra.trace_to_address = gu.trace_to_address
+AND ra.tx_to_address = gu.tx_to_address
+AND ra.tx_method_id = gu.tx_method_id
+AND ra.dt = gu.dt
+AND ra.chain_id = gu.chain_id
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_from_tx_to_method.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_from_tx_to_method.sql.j2
new file mode 100644
index 00000000000..0465b00f622
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_from_tx_to_method.sql.j2
@@ -0,0 +1,67 @@
+/*
+Aggregates at the transaction level, at the most granular-level (from, to, method).
+"From address" enables filtering by known senders (i.e. bots, relayers).
+"Method ID" enables segmenting and filtering by function called (i.e. swap, transfer, approve, handle userops)
+"To address" is the contract (or address) that the sender (from address) is directly interacting with.
+Downstream, we can use contracts tables to filter for transactions to contracts versus others.
+*/
+
+SELECT
+ dt,
+ chain,
+ chain_id,
+ network,
+ from_address,
+ to_address,
+ method_id
+
+ -- Aggregations
+ , COUNT(*) AS count_transactions
+ , COUNT(*) FILTER (WHERE success) AS count_transactions_success
+
+ , COUNT(DISTINCT block_number) AS count_unique_blocks
+
+ , SUM(l2_gas_used) AS sum_l2_gas_used
+ , SUM(l2_gas_used) FILTER (WHERE success) AS sum_l2_gas_used_success
+
+ , SUM(tx_fee_native) AS sum_tx_fee_native
+ , SUM(tx_fee_native) FILTER (WHERE success) AS sum_tx_fee_native_success
+
+ , SUM(l1_fee_native) AS l1_fee_native
+ , SUM(l1_fee_native) FILTER (WHERE success) AS l1_fee_native_success
+
+ , SUM(l2_fee_native) AS l2_fee_native
+ , SUM(l2_fee_native) FILTER (WHERE success) AS l2_fee_native_success
+
+ , SUM(l2_priority_fee_native) AS l2_priority_fee_native
+ , SUM(l2_priority_fee_native) FILTER (WHERE success) AS l2_priority_fee_native_success
+
+ , SUM(l2_base_fee_native) AS l2_base_fee_native
+ , SUM(l2_base_fee_native) FILTER (WHERE success) AS l2_base_fee_native_success
+
+ , SUM(l2_legacy_extra_fee_native) AS l2_legacy_extra_fee_native
+ , SUM(l2_legacy_extra_fee_native) FILTER (WHERE success) AS l2_legacy_extra_fee_native_success
+
+ -- Transaction-Level Gas Prices
+ , SUM(l2_gas_used * l2_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_gas_price_gwei
+ , SUM(l2_gas_used * l2_priority_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_priority_gas_price_gwei
+ , SUM(l2_gas_used * l2_legacy_extra_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_legacy_extra_gas_price_gwei
+ , SUM(l2_gas_used * l1_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_base_gas_price_gwei
+ , SUM(l2_gas_used * l1_blob_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_blob_base_gas_price_gwei
+
+ -- Transaction-Level transaction sizes
+ , SUM(input_byte_length) AS sum_input_byte_length
+ , SUM(input_zero_bytes) AS sum_input_zero_bytes
+ , SUM(input_nonzero_bytes) AS sum_input_nonzero_bytes
+ , SUM(l1_base_scaled_size) AS sum_l1_base_scaled_size
+ , SUM(l1_blob_scaled_size) AS sum_l1_blob_scaled_size
+ , SUM(l1_gas_used_unified) AS sum_l1_gas_used_unified
+ , SUM(estimated_size) AS sum_estimated_size
+
+
+FROM refined_transactions_fees
+WHERE NOT is_system_transaction
+
+GROUP BY
+ dt, chain, chain_id, network,
+ from_address, to_address, method_id
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to.sql.j2
new file mode 100644
index 00000000000..ec46c0275c1
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to.sql.j2
@@ -0,0 +1,65 @@
+/*
+Aggregates at the transaction level, at transaction to.
+"To address" is the contract (or address) that the sender (from address) is directly interacting with.
+Downstream, we can use contracts tables to filter for transactions to contracts versus others.
+*/
+
+SELECT
+ dt,
+ chain,
+ chain_id,
+ network,
+ to_address
+
+ -- Aggregations
+ , COUNT(*) AS count_transactions
+ , COUNT(*) FILTER (WHERE success) AS count_transactions_success
+
+ , COUNT(DISTINCT block_number) AS count_unique_blocks
+ , COUNT(DISTINCT from_address) AS count_unique_from_addresses
+ , COUNT(DISTINCT method_id) AS count_unique_method_ids
+
+ , SUM(l2_gas_used) AS sum_l2_gas_used
+ , SUM(l2_gas_used) FILTER (WHERE success) AS sum_l2_gas_used_success
+
+ , SUM(tx_fee_native) AS sum_tx_fee_native
+ , SUM(tx_fee_native) FILTER (WHERE success) AS sum_tx_fee_native_success
+
+ , SUM(l1_fee_native) AS l1_fee_native
+ , SUM(l1_fee_native) FILTER (WHERE success) AS l1_fee_native_success
+
+ , SUM(l2_fee_native) AS l2_fee_native
+ , SUM(l2_fee_native) FILTER (WHERE success) AS l2_fee_native_success
+
+ , SUM(l2_priority_fee_native) AS l2_priority_fee_native
+ , SUM(l2_priority_fee_native) FILTER (WHERE success) AS l2_priority_fee_native_success
+
+ , SUM(l2_base_fee_native) AS l2_base_fee_native
+ , SUM(l2_base_fee_native) FILTER (WHERE success) AS l2_base_fee_native_success
+
+ , SUM(l2_legacy_extra_fee_native) AS l2_legacy_extra_fee_native
+ , SUM(l2_legacy_extra_fee_native) FILTER (WHERE success) AS l2_legacy_extra_fee_native_success
+
+ -- Transaction-Level Gas Prices
+ , SUM(l2_gas_used * l2_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_gas_price_gwei
+ , SUM(l2_gas_used * l2_priority_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_priority_gas_price_gwei
+ , SUM(l2_gas_used * l2_legacy_extra_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_legacy_extra_gas_price_gwei
+ , SUM(l2_gas_used * l1_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_base_gas_price_gwei
+ , SUM(l2_gas_used * l1_blob_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_blob_base_gas_price_gwei
+
+ -- Transaction-Level transaction sizes
+ , SUM(input_byte_length) AS sum_input_byte_length
+ , SUM(input_zero_bytes) AS sum_input_zero_bytes
+ , SUM(input_nonzero_bytes) AS sum_input_nonzero_bytes
+ , SUM(l1_base_scaled_size) AS sum_l1_base_scaled_size
+ , SUM(l1_blob_scaled_size) AS sum_l1_blob_scaled_size
+ , SUM(l1_gas_used_unified) AS sum_l1_gas_used_unified
+ , SUM(estimated_size) AS sum_estimated_size
+
+
+FROM refined_transactions_fees
+WHERE NOT is_system_transaction
+
+GROUP BY
+ dt, chain, chain_id, network,
+ to_address
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to_method.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to_method.sql.j2
new file mode 100644
index 00000000000..aeb1ea4eed5
--- /dev/null
+++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to_method.sql.j2
@@ -0,0 +1,66 @@
+/*
+Aggregates at the transaction level, at transaction to and method.
+"Method ID" enables segmenting and filtering by function called (i.e. swap, transfer, approve, handle userops)
+"To address" is the contract (or address) that the sender (from address) is directly interacting with.
+Downstream, we can use contracts tables to filter for transactions to contracts versus others.
+*/
+
+SELECT
+ dt,
+ chain,
+ chain_id,
+ network,
+ to_address,
+ method_id
+
+ -- Aggregations
+ , COUNT(*) AS count_transactions
+ , COUNT(*) FILTER (WHERE success) AS count_transactions_success
+
+ , COUNT(DISTINCT block_number) AS count_unique_blocks
+ , COUNT(DISTINCT from_address) AS count_unique_from_addresses
+
+ , SUM(l2_gas_used) AS sum_l2_gas_used
+ , SUM(l2_gas_used) FILTER (WHERE success) AS sum_l2_gas_used_success
+
+ , SUM(tx_fee_native) AS sum_tx_fee_native
+ , SUM(tx_fee_native) FILTER (WHERE success) AS sum_tx_fee_native_success
+
+ , SUM(l1_fee_native) AS l1_fee_native
+ , SUM(l1_fee_native) FILTER (WHERE success) AS l1_fee_native_success
+
+ , SUM(l2_fee_native) AS l2_fee_native
+ , SUM(l2_fee_native) FILTER (WHERE success) AS l2_fee_native_success
+
+ , SUM(l2_priority_fee_native) AS l2_priority_fee_native
+ , SUM(l2_priority_fee_native) FILTER (WHERE success) AS l2_priority_fee_native_success
+
+ , SUM(l2_base_fee_native) AS l2_base_fee_native
+ , SUM(l2_base_fee_native) FILTER (WHERE success) AS l2_base_fee_native_success
+
+ , SUM(l2_legacy_extra_fee_native) AS l2_legacy_extra_fee_native
+ , SUM(l2_legacy_extra_fee_native) FILTER (WHERE success) AS l2_legacy_extra_fee_native_success
+
+ -- Transaction-Level Gas Prices
+ , SUM(l2_gas_used * l2_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_gas_price_gwei
+ , SUM(l2_gas_used * l2_priority_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_priority_gas_price_gwei
+ , SUM(l2_gas_used * l2_legacy_extra_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_legacy_extra_gas_price_gwei
+ , SUM(l2_gas_used * l1_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_base_gas_price_gwei
+ , SUM(l2_gas_used * l1_blob_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_blob_base_gas_price_gwei
+
+ -- Transaction-Level transaction sizes
+ , SUM(input_byte_length) AS sum_input_byte_length
+ , SUM(input_zero_bytes) AS sum_input_zero_bytes
+ , SUM(input_nonzero_bytes) AS sum_input_nonzero_bytes
+ , SUM(l1_base_scaled_size) AS sum_l1_base_scaled_size
+ , SUM(l1_blob_scaled_size) AS sum_l1_blob_scaled_size
+ , SUM(l1_gas_used_unified) AS sum_l1_gas_used_unified
+ , SUM(estimated_size) AS sum_estimated_size
+
+
+FROM refined_transactions_fees
+WHERE NOT is_system_transaction
+
+GROUP BY
+ dt, chain, chain_id, network,
+ to_address, method_id
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
index 120de86a724..f783355e74a 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
@@ -48,7 +48,7 @@ SELECT
-- transaction attributes
t.l1_gas_used_unified AS tx_l1_gas_used_unified,
t.estimated_size AS tx_estimated_size,
- t.receipt_gas_used AS tx_receipt_gas_used,
+ t.l2_gas_used AS tx_l2_gas_used,
ee.count_total_events
> ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events
AS is_qualified_tx_not_approval_wrapping_transfer,
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
index a5496f8abd8..2942fa9953e 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
@@ -20,7 +20,7 @@ base_level_trace_calls AS (
r.trace_address,
r.call_type,
-- Raw Transaction Fields
- t.receipt_gas_used AS tx_gas_used,
+ t.l2_gas_used AS tx_l2_gas_used,
t.l1_gas_used_unified AS tx_l1_gas_used_unified,
t.estimated_size AS tx_estimated_size,
t.from_address AS tx_from_address,
@@ -54,6 +54,7 @@ base_level_trace_calls AS (
r.error,
hexstr_method_id(r.input) AS trace_method_id,
r.status = 1 AS trace_success,
+ t.is_system_transaction,
--Get the next trace level up so that we can subtract subtrace gas
CASE
@@ -135,7 +136,7 @@ SELECT
* gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei) AS tx_l2_legacy_base_fee_native_minus_subtraces,
-- Amortize evenly across all calls
- bl.tx_gas_used / tpt.count_traces_in_transaction AS tx_gas_used_amortized_by_call,
+ bl.tx_l2_gas_used / tpt.count_traces_in_transaction AS tx_l2_gas_used_amortized_by_call,
bl.tx_l1_gas_used_unified / tpt.count_traces_in_transaction AS tx_l1_gas_used_unified_amortized_by_call,
bl.tx_l1_base_scaled_size / tpt.count_traces_in_transaction AS tx_l1_base_scaled_size_amortized_by_call,
bl.tx_l1_blob_scaled_size / tpt.count_traces_in_transaction AS tx_l1_blob_scaled_size_amortized_by_call,
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2
similarity index 96%
rename from src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2
rename to src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2
index 4b572aef635..7e03113ae4b 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_from_to_hash.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2
@@ -16,7 +16,7 @@ SELECT
, trace_from_address, trace_to_address, block_timestamp, block_number
, tx_from_address, tx_to_address, transaction_hash, tx_method_id
-- Transaction-Level gas & fees
- , tx_gas_used
+ , tx_l2_gas_used
, tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
, tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
-- Transaction-Level Gas Prices
@@ -27,6 +27,7 @@ SELECT
, tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
-- Attributes
, tx_success
+ , is_system_transaction
-- Sum Internal Trace Gas
, SUM(trace_gas_used) AS sum_trace_gas_used
@@ -37,7 +38,7 @@ SELECT
, SUM(tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces
, SUM(tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces
- , SUM(tx_gas_used_amortized_by_call) AS sum_tx_gas_used_amortized_by_call
+ , SUM(tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call
, SUM(tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
, SUM(tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
, SUM(tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call
@@ -74,7 +75,7 @@ GROUP BY
, trace_from_address, trace_to_address, block_timestamp, block_number
, tx_from_address, tx_to_address, transaction_hash, tx_method_id
-- Transaction-Level gas & fees
- , tx_gas_used
+ , tx_l2_gas_used
, tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
, tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
-- Transaction-Level Gas Prices
@@ -84,4 +85,6 @@ GROUP BY
, tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes
, tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
-- Attributes
- , tx_success
\ No newline at end of file
+ , tx_success
+ , is_system_transaction
+
\ No newline at end of file
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_to_hash.sql.j2
similarity index 93%
rename from src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2
rename to src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_to_hash.sql.j2
index 75dcb0e50b7..19cb98a206a 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_to_hash.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_to_hash.sql.j2
@@ -1,4 +1,3 @@
-
-- Base-Level Aggregation view to generate unique transaction & to combinations before we aggregate up
WITH get_transactions_by_call_type AS (
@@ -6,7 +5,7 @@ WITH get_transactions_by_call_type AS (
SELECT dt, chain_id, block_number, transaction_hash
, SUM(count_internal_calls_call_type) > 0 AS is_transaction_with_internal_call_type_call
, SUM(coalesce(count_internal_calls_call_type,0)+coalesce(count_internal_calls_delegate_type,0)) > 0 AS is_transaction_with_internal_call_type_call_or_delegate
- FROM refined_trace_calls_agg_from_to_hash
+ FROM refined_trace_calls_agg_tr_from_tr_to_hash
GROUP BY
dt, chain_id, block_number, transaction_hash
@@ -18,7 +17,7 @@ dt, chain, network, chain_id,
trace_to_address, transaction_hash, block_timestamp, block_number,
tx_from_address, tx_to_address, tx_method_id
-- Transaction-Level gas & fees
- , tx_gas_used
+ , tx_l2_gas_used
, tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
, tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
-- Transaction-Level Gas Prices
@@ -29,6 +28,7 @@ dt, chain, network, chain_id,
, tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
-- Attributes
, tx_success
+ , is_system_transaction
-- Sum Internal Trace Gas
, SUM(sum_trace_gas_used) AS sum_trace_gas_used
@@ -38,7 +38,7 @@ dt, chain, network, chain_id,
, SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces
, SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces
- , SUM(sum_tx_gas_used_amortized_by_call) AS sum_tx_gas_used_amortized_by_call
+ , SUM(sum_tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call
, SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call
, SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call
, SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call
@@ -67,14 +67,14 @@ dt, chain, network, chain_id,
, SUM(count_internal_calls_call_type) AS count_internal_calls_call_type
, SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success
-FROM refined_trace_calls_agg_from_to_hash
+FROM refined_trace_calls_agg_tr_from_tr_to_hash
GROUP BY
dt, chain, network, chain_id,
trace_to_address, transaction_hash, block_timestamp, block_number,
tx_from_address, tx_to_address, tx_method_id
-- Transaction-Level gas & fees
- , tx_gas_used
+ , tx_l2_gas_used
, tx_fee_native, tx_l1_fee_native, tx_l2_fee_native
, tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native
-- Transaction-Level Gas Prices
@@ -85,6 +85,7 @@ dt, chain, network, chain_id,
, tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size
-- Attributes
, tx_success
+ , is_system_transaction
)
@@ -98,4 +99,4 @@ FROM raw_aggregation AS ra
ON ra.dt = gt.dt
AND ra.chain_id = gt.chain_id
AND ra.block_number = gt.block_number
- AND ra.transaction_hash = gt.transaction_hash
\ No newline at end of file
+ AND ra.transaction_hash = gt.transaction_hash
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index ef6558c1dd5..4f98aa206cf 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -26,11 +26,11 @@ pt1 AS (
t.hash,
t.gas_price,
t.gas AS gas_limit,
- t.receipt_gas_used,
+ t.receipt_gas_used AS l2_gas_used,
t.receipt_l1_gas_used,
-- Fees
- t.receipt_l1_gas_price,
- t.receipt_l1_blob_base_fee,
+ t.receipt_l1_gas_price AS l1_gas_price,
+ t.receipt_l1_blob_base_fee AS l1_blob_base_fee,
b.base_fee_per_gas,
t.max_priority_fee_per_gas,
t.transaction_type,
@@ -86,8 +86,8 @@ pt2 AS (
*,
-- Estimated Size in bytes calculation, post-Fjord. This is not equivalent to L1 Gas Used
(l1_fee / (
- (16 * l1_base_fee_scalar * receipt_l1_gas_price)
- + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
+ (16 * l1_base_fee_scalar * l1_gas_price)
+ + (l1_blob_base_fee_scalar * l1_blob_base_fee)
))::INT64
AS estimated_size
FROM pt1
@@ -108,11 +108,11 @@ pt3 AS (
if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee,
--
-- L1 Base
- div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * receipt_l1_gas_price AS l1_base_fee,
+ div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * l1_gas_price AS l1_base_fee,
div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) AS l1_base_scaled_size,
--
-- L1 Blob
- coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee,0) AS l1_blob_fee,
+ coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * l1_blob_base_fee,0) AS l1_blob_fee,
coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar,0) AS l1_blob_scaled_size
FROM pt2
@@ -146,7 +146,7 @@ SELECT
wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei,
wei_to_gwei(legacy_extra_fee_per_gas) AS l2_legacy_extra_gas_price_gwei,
- wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei,
- wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
+ wei_to_gwei(l1_gas_price) AS l1_base_gas_price_gwei,
+ wei_to_gwei(l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
FROM pt3
diff --git a/src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2
deleted file mode 100644
index b6e6f8f2b5e..00000000000
--- a/src/op_analytics/datapipeline/models/templates/transaction_fees.sql.j2
+++ /dev/null
@@ -1,136 +0,0 @@
-WITH
-
-pb AS (
- SELECT
- number,
- base_fee_per_gas
- FROM
- ingestion_blocks_v1
-),
-
--- Select the columns that we want from transactions joined to blocks.
--- Include some minor transformations that are needed for further calculations.
-pt1 AS (
- SELECT
- -- Transaction fields
- t.dt,
- t.chain,
- t.chain_id,
- t.network,
- t.nonce,
- t.transaction_index,
- t.from_address,
- t.to_address,
- t.block_number,
- t.block_timestamp,
- t.hash,
- t.transaction_type,
- t.gas_price,
- t.gas AS gas_limit,
- t.receipt_gas_used,
- t.receipt_l1_gas_used,
- -- L1 Fees
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee,
- t.receipt_l1_gas_price,
- t.receipt_l1_blob_base_fee,
- -- L2 Fees and breakdown into BASE and PRIORITY contributions
- b.base_fee_per_gas,
- t.max_priority_fee_per_gas,
- if(t.max_priority_fee_per_gas = 0, t.gas_price - b.base_fee_per_gas, 0) AS base_legacy_fee_per_gas,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
- -- Convenience columns
- epoch_to_hour(t.block_timestamp) AS block_hour,
- -- L1 Fee BASE and BLOB scalars
- t.receipt_status = 1 AS success,
- coalesce(16 * micro(t.receipt_l1_base_fee_scalar), t.receipt_l1_fee_scalar::DECIMAL(12, 6))
- AS l1_base_fee_scalar,
- coalesce(micro(t.receipt_l1_blob_base_fee_scalar), 0) AS l1_blob_base_fee_scalar,
- -- Transaction Attributes
- hexstr_method_id(t.input) AS method_id,
- hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_calldata_gas(t.input) AS input_calldata_gas,
- t.transaction_type = 126 AS is_system_transaction,
- ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
- t.transaction_type = 126
- AND t.from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
- AND t.to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction
-
- FROM ingestion_transactions_v1 AS t
- INNER JOIN pb AS b ON t.block_number = b.number
- WHERE 1 = 1
-),
-
-
--- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
-pt2 AS (
- SELECT
- *,
- coalesce(
- receipt_l1_gas_used,
- round(16 * l1_fee / (
- (l1_base_fee_scalar * receipt_l1_gas_price)
- + (l1_blob_base_fee_scalar * receipt_l1_blob_base_fee)
- ))::INT64
- ) AS l1_gas_used
- FROM pt1
-),
-
--- Add more fee calculations.
--- Reuses results from the previous CTEs.
-
-pt3 AS (
- SELECT
- *,
- --
- -- Total fee
- l2_fee + l1_fee AS tx_fee,
- --
- -- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_base_legacy_fee,
- --
- -- L1 Base
- div16(l1_gas_used) * l1_base_fee_scalar * receipt_l1_gas_price AS l1_base_fee,
- div16(l1_gas_used) * l1_base_fee_scalar AS l1_base_scaled_size,
- --
- -- L1 Blob
- div16(l1_gas_used) * l1_blob_base_fee_scalar * receipt_l1_blob_base_fee AS l1_blob_fee,
- div16(l1_gas_used) * l1_blob_base_fee_scalar AS l1_blob_scaled_size
-
- FROM pt2
-)
-
-
--- Generate gas fee breakdowns in native terms, for later aggregation
--- Generate gas prices in gwei terms
-SELECT
- *,
-
- -- Fees
- wei_to_eth(tx_fee) AS tx_fee_native,
-
- -- Native Breakdown
- wei_to_eth(l1_fee) AS l1_fee_native,
- wei_to_eth(l2_fee) AS l2_fee_native,
-
- -- L1 Breakdown
- wei_to_eth(l1_base_fee) AS l1_base_fee_native,
- wei_to_eth(l1_blob_fee) AS l1_blob_fee_native,
-
- -- L2 Breakdown
- wei_to_eth(l2_base_fee) AS l2_base_fee_native,
- wei_to_eth(l2_priority_fee) AS l2_priority_fee_native,
- wei_to_eth(l2_base_legacy_fee) AS l2_base_legacy_fee_native,
-
- -- Gas Prices
- wei_to_gwei(gas_price) AS l2_gas_price_gwei,
- wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei,
- wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei,
- wei_to_gwei(base_legacy_fee_per_gas) AS l2_base_legacy_gas_price_gwei,
-
- wei_to_gwei(receipt_l1_gas_price) AS l1_base_gas_price_gwei,
- wei_to_gwei(receipt_l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
-
-FROM pt3
From 45ed3431db3fe08ee258b35de21720d380e89d93 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Mon, 16 Dec 2024 09:57:10 -0500
Subject: [PATCH 26/32] rename traces & include all types
---
notebooks/adhoc/example_daily_data.ipynb | 45 +--
.../adhoc/refined_traces_models_dev.ipynb | 314 +++---------------
...ined_transactions_address_models_dev.ipynb | 105 ++++--
.../models/code/refined_traces_models.py | 34 +-
.../refined_transactions_addresses_models.py | 22 +-
...gregated_traces_tr_from_tr_to_hash.sql.j2} | 15 +-
...j2 => aggregated_traces_tr_to_hash.sql.j2} | 12 +-
...tr_to.sql.j2 => daily_traces_tr_to.sql.j2} | 11 +-
...sql.j2 => daily_traces_tr_to_tx_to.sql.j2} | 12 +-
..._transactions_tx_from_tx_to_method.sql.j2} | 0
...sql.j2 => daily_transactions_tx_to.sql.j2} | 0
...=> daily_transactions_tx_to_method.sql.j2} | 0
...alls.sql.j2 => refined_traces_fees.sql.j2} | 21 +-
.../refined_transactions_fees.sql.j2 | 4 +
14 files changed, 202 insertions(+), 393 deletions(-)
rename src/op_analytics/datapipeline/models/templates/{refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2 => aggregated_traces_tr_from_tr_to_hash.sql.j2} (90%)
rename src/op_analytics/datapipeline/models/templates/{refined_trace_calls_agg_tr_to_hash.sql.j2 => aggregated_traces_tr_to_hash.sql.j2} (89%)
rename src/op_analytics/datapipeline/models/templates/{daily_trace_calls_agg_tr_to.sql.j2 => daily_traces_tr_to.sql.j2} (94%)
rename src/op_analytics/datapipeline/models/templates/{daily_trace_calls_agg_tr_to_tx_to.sql.j2 => daily_traces_tr_to_tx_to.sql.j2} (94%)
rename src/op_analytics/datapipeline/models/templates/{daily_transactions_agg_tx_from_tx_to_method.sql.j2 => daily_transactions_tx_from_tx_to_method.sql.j2} (100%)
rename src/op_analytics/datapipeline/models/templates/{daily_transactions_agg_tx_to.sql.j2 => daily_transactions_tx_to.sql.j2} (100%)
rename src/op_analytics/datapipeline/models/templates/{daily_transactions_agg_tx_to_method.sql.j2 => daily_transactions_tx_to_method.sql.j2} (100%)
rename src/op_analytics/datapipeline/models/templates/{refined_trace_calls.sql.j2 => refined_traces_fees.sql.j2} (93%)
diff --git a/notebooks/adhoc/example_daily_data.ipynb b/notebooks/adhoc/example_daily_data.ipynb
index 2850b15d73a..d221483fd78 100644
--- a/notebooks/adhoc/example_daily_data.ipynb
+++ b/notebooks/adhoc/example_daily_data.ipynb
@@ -9,21 +9,9 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-14 13:32:29\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
- "\u001b[2m2024-12-14 13:32:29\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
- "\u001b[2m2024-12-14 13:32:29\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
- "\u001b[2m2024-12-14 13:32:30\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n",
- "\u001b[2m2024-12-14 13:32:30\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"from op_analytics.coreutils.duckdb_inmem import init_client\n",
"from op_analytics.coreutils.partitioned.reader import DataReader\n",
@@ -36,7 +24,7 @@
"# Define the input data range.\n",
"read_batches: list[DataReader] = construct_data_readers(\n",
" chains=[\"op\"],\n",
- " models=[\"refined_transactions_traces_address_models\"],\n",
+ " models=[\"refined_transactions_addresses_models\"],\n",
" range_spec=\"@20241030:+1\",\n",
" read_from=DataLocation.GCS\n",
")\n",
@@ -61,36 +49,15 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\u001b[2m2024-12-14 13:32:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m89004\u001b[0m\n"
- ]
- },
- {
- "ename": "KeyError",
- "evalue": "'daily_address_summary'",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
- "Cell \u001b[0;32mIn[3], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mop_analytics\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdatapipeline\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodels\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcompute\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtestutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m execute_model_in_memory\n\u001b[0;32m----> 3\u001b[0m \u001b[43mexecute_model_in_memory\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43mduckdb_client\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mduckdb_client\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdaily_address_summary\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_reader\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbatch\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 7\u001b[0m \u001b[43m)\u001b[49m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;66;03m# The duckdb database will have the following:\u001b[39;00m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# - input tables\u001b[39;00m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;66;03m# - views used by the model\u001b[39;00m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;66;03m# - model outputs\u001b[39;00m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;66;03m# You can use duckdb to inspect any of the above results.\u001b[39;00m\n\u001b[1;32m 15\u001b[0m duckdb_client\u001b[38;5;241m.\u001b[39msql(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSHOW TABLES\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
- "File \u001b[0;32m~/Documents/GitHub/op-analytics/src/op_analytics/datapipeline/models/compute/testutils.py:222\u001b[0m, in \u001b[0;36mexecute_model_in_memory\u001b[0;34m(duckdb_client, model, data_reader, limit_input_parquet_files)\u001b[0m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Execute a model and register results as views.\"\"\"\u001b[39;00m\n\u001b[1;32m 220\u001b[0m log\u001b[38;5;241m.\u001b[39minfo(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExecuting model...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 222\u001b[0m model_obj \u001b[38;5;241m=\u001b[39m \u001b[43mPythonModel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 224\u001b[0m create_duckdb_macros(duckdb_client)\n\u001b[1;32m 226\u001b[0m model_executor \u001b[38;5;241m=\u001b[39m PythonModelExecutor(\n\u001b[1;32m 227\u001b[0m model\u001b[38;5;241m=\u001b[39mmodel_obj,\n\u001b[1;32m 228\u001b[0m client\u001b[38;5;241m=\u001b[39mduckdb_client,\n\u001b[1;32m 229\u001b[0m data_reader\u001b[38;5;241m=\u001b[39mdata_reader,\n\u001b[1;32m 230\u001b[0m limit_input_parquet_files\u001b[38;5;241m=\u001b[39mlimit_input_parquet_files,\n\u001b[1;32m 231\u001b[0m )\n",
- "File \u001b[0;32m~/Documents/GitHub/op-analytics/src/op_analytics/datapipeline/models/compute/modelexecute.py:49\u001b[0m, in \u001b[0;36mPythonModel.get\u001b[0;34m(cls, model_name)\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m model_name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m_registry:\n\u001b[1;32m 44\u001b[0m \u001b[38;5;66;03m# Import the module so that the model gets registered.\u001b[39;00m\n\u001b[1;32m 45\u001b[0m \u001b[38;5;66;03m# For now the module and model name are the same by convention, but\u001b[39;00m\n\u001b[1;32m 46\u001b[0m \u001b[38;5;66;03m# that can change if we need to.\u001b[39;00m\n\u001b[1;32m 47\u001b[0m importlib\u001b[38;5;241m.\u001b[39mimport_module(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mop_analytics.datapipeline.models.code.\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodel_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 49\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_registry\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmodel_name\u001b[49m\u001b[43m]\u001b[49m\n",
- "\u001b[0;31mKeyError\u001b[0m: 'daily_address_summary'"
- ]
- }
- ],
+ "outputs": [],
"source": [
"from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
"\n",
"execute_model_in_memory(\n",
" duckdb_client=duckdb_client,\n",
- " model=\"refined_transactions_traces_address_models\",\n",
+ " model=\"refined_transactions_addresses_models\",\n",
" data_reader=batch,\n",
")\n",
"\n",
diff --git a/notebooks/adhoc/refined_traces_models_dev.ipynb b/notebooks/adhoc/refined_traces_models_dev.ipynb
index 8ea3ccc7f2c..70d93b098b6 100644
--- a/notebooks/adhoc/refined_traces_models_dev.ipynb
+++ b/notebooks/adhoc/refined_traces_models_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-14 22:09:13\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:13\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:13\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n"
+ "\u001b[2m2024-12-16 09:53:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m92\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n"
]
}
],
@@ -62,58 +62,28 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_tr_from_tr_to_hash\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_trace_calls_agg_tr_to_hash\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_trace_calls_agg_tr_to_tx_to\u001b[0m\n",
- "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46910\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_trace_calls_agg_tr_to\u001b[0m\n",
- "dict_keys(['refined_trace_calls_v1', 'refined_trace_calls_agg_tr_from_tr_to_hash_v1', 'refined_trace_calls_agg_to_hash_v1', 'daily_trace_calls_agg_tr_to_tx_to_v1', 'daily_trace_calls_agg_to_v1'])\n"
+ "\u001b[2m2024-12-16 09:53:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:43\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:44\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:44\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/traces_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_traces_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces_fees\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35maggregated_traces_tr_from_tr_to_hash\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35maggregated_traces_tr_to_hash\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_traces_tr_to_tx_to\u001b[0m\n",
+ "\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_traces_tr_to\u001b[0m\n",
+ "dict_keys(['refined_traces_fees_v1', 'aggregated_traces_tr_from_tr_to_hash_v1', 'aggregated_traces_tr_to_hash_v1', 'daily_traces_tr_to_tx_to_v1', 'daily_traces_tr_to_v1'])\n"
]
- },
- {
- "data": {
- "text/plain": [
- "┌───────────────────────────────────────────────┐\n",
- "│ name │\n",
- "│ varchar │\n",
- "├───────────────────────────────────────────────┤\n",
- "│ daily_trace_calls_agg_to_v1 │\n",
- "│ daily_trace_calls_agg_tr_to │\n",
- "│ daily_trace_calls_agg_tr_to_tx_to │\n",
- "│ daily_trace_calls_agg_tr_to_tx_to_v1 │\n",
- "│ ingestion_blocks_v1 │\n",
- "│ ingestion_traces_v1 │\n",
- "│ ingestion_transactions_v1 │\n",
- "│ refined_trace_calls │\n",
- "│ refined_trace_calls_agg_to_hash_v1 │\n",
- "│ refined_trace_calls_agg_tr_from_tr_to_hash │\n",
- "│ refined_trace_calls_agg_tr_from_tr_to_hash_v1 │\n",
- "│ refined_trace_calls_agg_tr_to_hash │\n",
- "│ refined_trace_calls_v1 │\n",
- "│ refined_transactions_fees │\n",
- "├───────────────────────────────────────────────┤\n",
- "│ 14 rows │\n",
- "└───────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
}
],
"source": [
@@ -144,38 +114,11 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────┬─────────┬─────────┬──────────┬────────────────────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬────────────────────────────┬────────────────────────────────┬──────────────────────────────┬────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬──────────────────────────┬─────────────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬───────────────────────┬──────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────┬───────────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬──────────────────────────────┬────────────────────┬───────────────────────────────┬────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬─────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬─────────────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────┐\n",
- "│ dt │ chain │ network │ chain_id │ trace_to_address │ count_transactions_called │ count_transactions_called_tx_success │ count_unique_blocks_called │ count_unique_tx_from_addresses │ count_unique_tx_to_addresses │ count_unique_tx_method_ids │ sum_tx_l2_gas_used_called │ sum_tx_l2_gas_used_called_tx_success │ sum_tx_fee_native_called │ sum_tx_fee_native_called_tx_success │ tx_l1_fee_native │ tx_l1_fee_native_tx_success │ tx_l2_fee_native │ tx_l2_fee_native_tx_success │ tx_l2_priority_fee_native │ tx_l2_priority_fee_native_tx_success │ tx_l2_base_fee_native │ tx_l2_base_fee_native_tx_success │ tx_l2_legacy_extra_fee_native │ tx_l2_legacy_extra_fee_native_tx_success │ avg_tx_l2_gas_price_gwei_called │ avg_tx_l2_priority_gas_price_gwei_called │ avg_tx_l2_legacy_extra_gas_price_gwei_called │ avg_tx_l1_base_gas_price_gwei_called │ avg_tx_l1_blob_base_gas_price_gwei_called │ sum_tx_input_byte_length_called │ sum_tx_input_zero_bytes_called │ sum_tx_input_nonzero_bytes_called │ sum_tx_l1_base_scaled_size_called │ sum_tx_l1_blob_scaled_size_called │ sum_tx_l1_gas_used_unified_called │ sum_tx_estimated_size_called │ sum_trace_gas_used │ sum_trace_gas_used_tx_success │ sum_trace_gas_used_minus_subtraces │ sum_trace_gas_used_minus_subtraces_tx_success │ sum_tx_l2_gas_used_amortized_by_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success │ sum_tx_l1_gas_used_unified_amortized_by_call │ sum_tx_l1_base_scaled_size_amortized_by_call │ sum_tx_l1_blob_scaled_size_amortized_by_call │ sum_tx_estimated_size_amortized_by_call │ sum_tx_l2_fee_native_minus_subtraces │ sum_tx_l2_fee_native_minus_subtraces_tx_success │ sum_tx_l2_base_fee_native_minus_subtraces │ sum_tx_l2_priority_fee_native_minus_subtraces │ sum_tx_l2_legacy_base_fee_native_minus_subtraces │ sum_tx_fee_native_amortized_by_call │ sum_tx_fee_native_amortized_by_call_tx_success │ sum_tx_l2_fee_native_amortized_by_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success │ sum_tx_l1_fee_native_amortized_by_call │ sum_tx_l1_fee_native_amortized_by_call_tx_success │ sum_tx_l2_base_fee_native_amortized_by_call │ sum_tx_l2_priority_fee_native_amortized_by_call │ sum_tx_fee_native_l1_amortized_l2_minus_subtraces │ count_top_level_calls │ count_internal_calls_all_types │ count_internal_calls_all_types_trace_success │ count_internal_calls_static_type │ count_internal_calls_static_type_trace_success │ count_internal_calls_delegate_type │ count_internal_calls_delegate_type_trace_success │ count_internal_calls_call_type │ count_internal_calls_call_type_trace_success │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_unique_trace_from_addresses │\n",
- "│ date │ varchar │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ int64 │ int64 │ decimal(38,0) │ double │ decimal(38,20) │ double │ double │ int64 │\n",
- "├────────────┼─────────┼─────────┼──────────┼────────────────────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼────────────────────────────┼────────────────────────────────┼──────────────────────────────┼────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼───────────────────────┼──────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────┼───────────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼──────────────────────────────┼────────────────────┼───────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14695 │ 13688 │ 1380 │ 341 │ 77 │ 299 │ 6452271886 │ 6250947632 │ 0.1219897937370507150 │ 0.1106332698372177340 │ 0.0046893913808264620 │ 0.0041940751403341490 │ 0.1173004023562242530 │ 0.1064391946968835850 │ 0.0952425665896049750 │ 0.0925352274339835120 │ 0.0000073738719558640 │ 0.0000070583473422090 │ 0.0220505987724079880 │ 0.0138970429090307190 │ 0.018179705447741612 │ 0.014761090089253715 │ 0.0034174937389499812 │ 8.201251243507212 │ 1.809727157458527 │ 1634709 │ 1100753 │ 533956 │ 153099.723817000000 │ 1856654.512526437500 │ 29290171 │ 1830873 │ 806347671 │ 749646962 │ 529558288 │ 500050621 │ 1068526615.5822927 │ 1046647297.4262667 │ 4888768.627139384 │ 25553.593614057296 │ 309890.7934773059 │ 305586.89104998036 │ 0.04029101981655442800 │ 0.03829338800582661200 │ 0.00000060506389677800 │ 0.03379136370802675700 │ 0.00649908218414147200 │ 0.019182016703136285 │ 0.016497407132283724 │ 0.018414204847005254 │ 0.015821709761356877 │ 0.0007678118561310301 │ 0.0006756973709268447 │ 1.189469265372385e-06 │ 0.014623270722784024 │ 0.041058831672685446 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 3670 │ 14695 │ 288049460 │ 204823127.4473851 │ 0.03819199276620082500 │ 0.015445279151271054 │ 0.015644821523381106 │ 34 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 13054 │ 12803 │ 1379 │ 269 │ 94 │ 181 │ 6428944143 │ 6291511311 │ 0.0177214889376692160 │ 0.0171720726307182100 │ 0.0039149172970481770 │ 0.0036774312323045060 │ 0.0138065716406210390 │ 0.0134946413984137040 │ 0.0118712635101399800 │ 0.0117670453288556910 │ 0.0000073569861295260 │ 0.0000071245687027410 │ 0.0019280085884527420 │ 0.0017205254171395800 │ 0.0021475644108144864 │ 0.0018465339324911878 │ 0.00029989505983684853 │ 8.203521185800055 │ 1.798948965305693 │ 734430 │ 393661 │ 340769 │ 127261.627871000000 │ 1543313.532953062500 │ 24346973 │ 1521742 │ 793020153 │ 761387815 │ 602330824 │ 579413082 │ 800395406.3520415 │ 792614207.211054 │ 2802019.5681512994 │ 14646.156282726475 │ 177615.292017086 │ 175133.0516356697 │ 0.00223246010334795500 │ 0.00217883334892808100 │ 0.00000071272173782700 │ 0.00156035784691197600 │ 0.00067140258033343000 │ 0.001412668900401075 │ 0.001345712864972268 │ 0.0009691987829059819 │ 0.0009275452134075285 │ 0.0004434701174950936 │ 0.00041816765156473993 │ 8.965536192711147e-07 │ 0.0007682652692257427 │ 0.002675930220843047 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 2464 │ 13054 │ 403481910 │ 94993814.89057308 │ 0.00210707216596956100 │ 0.0006638033414379764 │ 0.0007307862989703064 │ 180 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 12419 │ 11983 │ 1379 │ 188 │ 39 │ 180 │ 5509275663 │ 5420289642 │ 0.0812010819017146630 │ 0.0740585349932124140 │ 0.0034191107584217350 │ 0.0032050065832735430 │ 0.0777819711432929280 │ 0.0708535284099388710 │ 0.0638217003754810510 │ 0.0618929396178460310 │ 0.0000061980374237800 │ 0.0000060440079740220 │ 0.0139541426180543950 │ 0.0089546128717087240 │ 0.014118366170288497 │ 0.01158440860095351 │ 0.0025328452362203746 │ 8.193557265424658 │ 1.77845501825804 │ 547535 │ 350706 │ 196829 │ 113804.857500000000 │ 1380122.033906250000 │ 21772500 │ 1360831 │ 247637741 │ 231751597 │ 34407198 │ 33173217 │ 181409113.2045715 │ 174851869.6893516 │ 1017011.7609458554 │ 5315.920474464031 │ 64466.65931901353 │ 63571.00859461218 │ 0.00161791364834116600 │ 0.00118483349730291200 │ 0.00000003820465697000 │ 0.00112362448665840500 │ 0.00049425184282953400 │ 0.012270676533798739 │ 0.010404734196149066 │ 0.012110766514152412 │ 0.010281284602777128 │ 0.00015991001964633033 │ 0.00012344959337193403 │ 1.959627926290491e-07 │ 0.009512241894549313 │ 0.0017778236679874952 │ 0 │ 18268 │ 17387 │ 15936 │ 15200 │ 0 │ 0 │ 2332 │ 2187 │ 1687 │ 12419 │ 5087651 │ 63075664.9345231 │ 0.00117079859301269400 │ 0.010217330953640717 │ 0.010275181596323601 │ 40 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 12057 │ 11735 │ 1379 │ 261 │ 53 │ 256 │ 5377586786 │ 5286455316 │ 0.0232969391423820980 │ 0.0209563174421668930 │ 0.0034168346898384660 │ 0.0032127940004109450 │ 0.0198801044525436320 │ 0.0177435234417559480 │ 0.0183407833558363430 │ 0.0171825434751415000 │ 0.0000061420894750850 │ 0.0000059943431254880 │ 0.0015332572510255230 │ 0.0005550591762551140 │ 0.0036968449313174194 │ 0.0034105973712195044 │ 0.0002851199454404348 │ 8.208016337742121 │ 1.8032290003079243 │ 527342 │ 310789 │ 216553 │ 111864.093308000000 │ 1356586.207028250000 │ 21401204 │ 1337655 │ 164208684 │ 151365149 │ 70348033 │ 63356929 │ 144491780.9351728 │ 137155589.6594242 │ 855428.0388996555 │ 4471.322359328464 │ 54224.13985103515 │ 53474.6624728978 │ 0.00532948449070531800 │ 0.00479894612631183000 │ 0.00000009111683892700 │ 0.00497237357020249600 │ 0.00035703306041542600 │ 0.003776203396333809 │ 0.0033356188832723245 │ 0.0036340183586927566 │ 0.003227744710208146 │ 0.00014218503764105083 │ 0.00010787417306417665 │ 1.7092561285117626e-07 │ 0.0032777765991069737 │ 0.005471669528346364 │ 0 │ 13948 │ 13203 │ 12827 │ 12276 │ 0 │ 0 │ 1121 │ 927 │ 1483 │ 11943 │ 35182861 │ 25337952.364479937 │ 0.00478704417847796600 │ 0.003181593098840976 │ 0.003222434310232159 │ 40 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 11842 │ 11572 │ 1380 │ 185 │ 28 │ 96 │ 5374653125 │ 5292988684 │ 0.0301797184740908970 │ 0.0275751674917356450 │ 0.0032079598058830470 │ 0.0030595347433565770 │ 0.0269717586682078500 │ 0.0245156327483790680 │ 0.0239145630016689240 │ 0.0233415174566461200 │ 0.0000060837781266980 │ 0.0000059476070391350 │ 0.0030511622017185950 │ 0.0011682174216660980 │ 0.005018325469740496 │ 0.00444950817205881 │ 0.0005676947201534229 │ 8.203940575214546 │ 1.784020770292575 │ 429785 │ 277672 │ 152113 │ 106683.420209000000 │ 1293759.705141937500 │ 20410067 │ 1275735 │ 181978502 │ 162868323 │ 5260405 │ 4485759 │ 159789118.70821685 │ 153283188.77684808 │ 768812.0511767166 │ 4018.5805915006313 │ 48733.69855375741 │ 48065.15414666971 │ 0.00047852347276841400 │ 0.00039545461476174600 │ 0.00000000628765871200 │ 0.00040979203771864100 │ 0.00006872555817834500 │ 0.004141314031135212 │ 0.003667228319724062 │ 0.004020001182121207 │ 0.0035656889297900583 │ 0.0001213128490140001 │ 0.00010153938993400007 │ 1.8061054627338888e-07 │ 0.0035897908732182935 │ 0.0005998363217824139 │ 0 │ 15741 │ 14910 │ 14241 │ 13671 │ 0 │ 0 │ 1500 │ 1239 │ 1361 │ 11842 │ 2436607 │ 42156895.72476116 │ 0.00039430556297552000 │ 0.0035170878488719306 │ 0.003557114042353152 │ 31 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 11629 │ 11335 │ 1379 │ 207 │ 55 │ 107 │ 5192960124 │ 5111471019 │ 0.0385805977857356220 │ 0.0286334499974164940 │ 0.0031220427054908210 │ 0.0029461056019041320 │ 0.0354585550802448010 │ 0.0256873443955123620 │ 0.0241924430564917020 │ 0.0230589995493936380 │ 0.0000058070135646340 │ 0.0000056921334498320 │ 0.0112603362586334100 │ 0.0026226792500277260 │ 0.006828197065555746 │ 0.004658699947392799 │ 0.0021683848883399227 │ 8.191009697732017 │ 1.7688029317897829 │ 414115 │ 250361 │ 163754 │ 104980.918358000000 │ 1273113.307712625000 │ 20084354 │ 1255348 │ 86492551 │ 73215959 │ 56703147 │ 49508128 │ 130637259.29100339 │ 125461323.54484168 │ 689248.7675517754 │ 3602.7033079930616 │ 43690.316267812654 │ 43096.10188839152 │ 0.01268942514508051100 │ 0.00930790926353997200 │ 0.00000006653851932200 │ 0.00858835711056542700 │ 0.00410100821552410900 │ 0.005833905709314264 │ 0.0042405856182870455 │ 0.005724012080796111 │ 0.004157020801367643 │ 0.00010989362851815146 │ 8.356481691940254e-05 │ 1.471624723083344e-07 │ 0.004111370935708563 │ 0.012799318773598658 │ 0 │ 12356 │ 11892 │ 11626 │ 11361 │ 0 │ 0 │ 730 │ 531 │ 1146 │ 11557 │ 21451912 │ 14181568.327675238 │ 0.00929610137937214000 │ 0.004111318843136728 │ 0.0041323504535603125 │ 42 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 11625 │ 11436 │ 1379 │ 144 │ 41 │ 78 │ 5243474206 │ 5156416961 │ 0.0156279882492578490 │ 0.0120260751312825160 │ 0.0031798546004170230 │ 0.0030353949259197480 │ 0.0124481336488408260 │ 0.0089906802053627680 │ 0.0092287612906324480 │ 0.0082244739389089310 │ 0.0000059226175323900 │ 0.0000057950450332990 │ 0.0032134892284338710 │ 0.0007604504932057870 │ 0.002374024007707844 │ 0.0017600470466836977 │ 0.000612854970232664 │ 8.199354679266955 │ 1.782327780315835 │ 410882 │ 235247 │ 175635 │ 105985.396175000000 │ 1285294.703114062500 │ 20276525 │ 1267359 │ 95945172 │ 87281000 │ 58705420 │ 53635007 │ 135901352.73302457 │ 132423493.65167841 │ 708131.3574124334 │ 3701.4026051947203 │ 44887.25177470968 │ 44272.13920975122 │ 0.00394576075872735100 │ 0.00284609070787392600 │ 0.00000006933728096700 │ 0.00272674599166435800 │ 0.00121895058248596000 │ 0.0021813819304510136 │ 0.0016119193447205011 │ 0.0020675144277595473 │ 0.0015150007443969526 │ 0.00011386750269146585 │ 9.691860032354941e-05 │ 1.5394538980134923e-07 │ 0.0015480525615527278 │ 0.004059628261418819 │ 0 │ 12948 │ 12651 │ 12162 │ 12000 │ 0 │ 0 │ 786 │ 651 │ 1156 │ 11584 │ 25460939 │ 20585492.791654795 │ 0.00283264368853589000 │ 0.0014615745603174708 │ 0.0014910806595664038 │ 33 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 11229 │ 11148 │ 1379 │ 112 │ 29 │ 36 │ 5112738802 │ 5072420427 │ 0.0073606840852945480 │ 0.0069919974138059380 │ 0.0029458763141605170 │ 0.0028672307683049090 │ 0.0044148077711340310 │ 0.0041247666455010290 │ 0.0036351253005716780 │ 0.0036088821030808790 │ 0.0000057153963770370 │ 0.0000056635089986220 │ 0.0007739834400406350 │ 0.0005102373445989130 │ 0.0008634917491593835 │ 0.0007109937435391166 │ 0.00015138333288957932 │ 8.193502166729221 │ 1.7649904093193 │ 261870 │ 141787 │ 120083 │ 99293.539879000000 │ 1204141.942812562500 │ 18996277 │ 1187293 │ 51980514 │ 49194255 │ 42759295 │ 40779725 │ 121989647.43375477 │ 120449310.63483883 │ 527661.900062017 │ 2758.08875162409 │ 33447.59741547452 │ 32984.27131114666 │ 0.00089300422058779200 │ 0.00085632499342977600 │ 0.00000004833956906600 │ 0.00069597300470962000 │ 0.00019698531639617200 │ 0.0006574994656780423 │ 0.0005366275083218476 │ 0.0005734514709505007 │ 0.0004623090708653184 │ 8.404799472754249e-05 │ 7.431843745652969e-05 │ 1.3623812352628942e-07 │ 0.00037373513973324444 │ 0.000977052215315335 │ 0 │ 11557 │ 11397 │ 11251 │ 11133 │ 0 │ 0 │ 306 │ 264 │ 807 │ 11201 │ 12769625 │ 9330385.170053398 │ 0.00084456288257907200 │ 0.00041676855815267445 │ 0.0004295550972362153 │ 24 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 11006 │ 10984 │ 1379 │ 58 │ 20 │ 20 │ 5029780657 │ 5023913161 │ 0.0060735538237173350 │ 0.0059833504223231600 │ 0.0027876039974382160 │ 0.0027713824304713380 │ 0.0032859498262791190 │ 0.0032119679918518220 │ 0.0029589854273758550 │ 0.0029510050391285750 │ 0.0000055978250700170 │ 0.0000055886599657600 │ 0.0003213888708145280 │ 0.0002553965897387680 │ 0.0006532988315715174 │ 0.0005882931342657662 │ 6.389719407888049e-05 │ 8.189933307768259 │ 1.763358675368465 │ 103294 │ 42165 │ 61129 │ 94002.571853000000 │ 1139977.884144187500 │ 17984039 │ 1124012 │ 42819405 │ 41826096 │ 2483548 │ 2415801 │ 118984247.22848397 │ 118377092.1705025 │ 448078.09158065036 │ 2342.1041846920243 │ 28402.91409351748 │ 28005.857080041787 │ 0.00001998465317498800 │ 0.00001851622456476300 │ 0.00000000286834802200 │ 0.00001576625271079400 │ 0.00000421557645465200 │ 0.0002530570242379545 │ 0.00023789094111646036 │ 0.0001827175251435067 │ 0.00017002447839809158 │ 7.033949909444785e-05 │ 6.786646271836872e-05 │ 1.3264413541765076e-07 │ 0.00014133350137056886 │ 9.032415226943577e-05 │ 0 │ 11480 │ 11373 │ 11377 │ 11276 │ 0 │ 0 │ 103 │ 97 │ 608 │ 11006 │ 378097 │ 7312093.923610215 │ 0.00001727900416486700 │ 0.000122616873233342 │ 0.0001296266709901045 │ 19 │\n",
- "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 10996 │ 10960 │ 1379 │ 48 │ 23 │ 24 │ 5052411568 │ 5031188403 │ 0.0057205865962422110 │ 0.0056176076708706290 │ 0.0028357061309091870 │ 0.0027957262675124070 │ 0.0028848804653330240 │ 0.0028218814033582220 │ 0.0025795299938098260 │ 0.0025711431104438020 │ 0.0000056444679973690 │ 0.0000056129856245520 │ 0.0002997150146508930 │ 0.0002451308301588750 │ 0.0005709907885582262 │ 0.0005105542094289311 │ 5.932117972121882e-05 │ 8.196171239543245 │ 1.7683514441472665 │ 171079 │ 86853 │ 84226 │ 95346.339467000000 │ 1156273.878298312500 │ 18241121 │ 1140081 │ 36625424 │ 35002403 │ 33996626 │ 32905182 │ 117861285.39334993 │ 117237656.57763092 │ 442175.5256003813 │ 2311.2514723131626 │ 28028.760396608333 │ 27637.250105587656 │ 0.00027396551375628900 │ 0.00027002799722618500 │ 0.00000003962761984600 │ 0.00024441422137034400 │ 0.00002951251985920000 │ 0.00021046070615958937 │ 0.0001985525241078646 │ 0.0001413515823386983 │ 0.00013183108474805705 │ 6.910912382089125e-05 │ 6.672143935980768e-05 │ 1.3145748689026882e-07 │ 0.00011163940987808375 │ 0.0003430746375771801 │ 0 │ 11193 │ 11126 │ 11081 │ 11043 │ 0 │ 0 │ 112 │ 83 │ 607 │ 10996 │ 4910454 │ 6164740.731893016 │ 0.00025775511051438900 │ 8.462144118505956e-05 │ 9.020902102423792e-05 │ 17 │\n",
- "├────────────┴─────────┴─────────┴──────────┴────────────────────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴────────────────────────────┴────────────────────────────────┴──────────────────────────────┴────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴──────────────────────────┴─────────────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴───────────────────────┴──────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────┴───────────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴──────────────────────────────┴────────────────────┴───────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴─────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴─────────────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────┤\n",
- "│ 10 rows 78 columns │\n",
- "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "duckdb_client.sql(\"SELECT * FROM daily_trace_calls_agg_to_v1 ORDER BY count_transactions_called DESC LIMIT 10\")"
+ "duckdb_client.sql(\"SELECT * FROM daily_trace_calls_tr_to_v1 ORDER BY count_transactions_called DESC LIMIT 10\")"
]
},
{
@@ -187,42 +130,15 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
- "│ trace_to_address │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
- "│ varchar │ int64 │ int64 │ int64 │\n",
- "├────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
- "│ 0x4200000000000000000000000000000000000006 │ 8191 │ 8264 │ 8320 │\n",
- "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 6335 │ 6684 │ 6684 │\n",
- "│ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 6335 │ 6684 │ 6684 │\n",
- "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 3975 │ 4012 │ 4068 │\n",
- "│ 0x0000000000000000000000000000000000000001 │ 3676 │ 3927 │ 4639 │\n",
- "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 3670 │ 14695 │ 14695 │\n",
- "│ 0x4200000000000000000000000000000000000042 │ 3666 │ 3685 │ 3841 │\n",
- "│ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 3068 │ 3471 │ 3471 │\n",
- "│ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 3014 │ 3014 │ 3014 │\n",
- "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 2464 │ 13054 │ 13054 │\n",
- "├────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
- "│ 10 rows 4 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"duckdb_client.sql(\"\"\"\n",
" SELECT trace_to_address,\n",
" count_transactions_called_with_internal_type_call, count_transactions_called_with_internal_type_call_or_delegate,\n",
" count_transactions_called\n",
- " FROM daily_trace_calls_agg_to_v1\n",
+ " FROM daily_trace_calls_tr_to_v1\n",
" ORDER BY count_transactions_called_with_internal_type_call DESC\n",
" LIMIT 10\n",
" \"\"\")"
@@ -237,36 +153,9 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
- "│ trace_to_address │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
- "│ varchar │ decimal(38,0) │ double │ decimal(38,20) │ double │ int64 │ int64 │ int64 │\n",
- "├────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
- "│ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 4336291158 │ 1416977599.783289 │ 0.00006075181680298400 │ 4.4282497826739014e-05 │ 357 │ 357 │ 357 │\n",
- "│ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 1408738482 │ 1402224990.8886633 │ 0.00000562532943659800 │ 3.636351036943136e-05 │ 326 │ 326 │ 326 │\n",
- "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 403481910 │ 94993814.89057308 │ 0.00210707216596956100 │ 0.0007307862989703064 │ 2464 │ 13054 │ 13054 │\n",
- "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 288049460 │ 204823127.4473851 │ 0.03819199276620082500 │ 0.015644821523381106 │ 3670 │ 14695 │ 14695 │\n",
- "│ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 220618821 │ 68159718.9689097 │ 0.00107271191945114100 │ 0.00044816426595516574 │ 946 │ 1097 │ 1175 │\n",
- "│ 0x4200000000000000000000000000000000000006 │ 159906187 │ 252716979.57518074 │ 0.01377174827006443900 │ 0.023645339424702712 │ 8191 │ 8264 │ 8320 │\n",
- "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 147222841 │ 180406504.91480607 │ 0.01486079382578650400 │ 0.01660686668994283 │ 6335 │ 6684 │ 6684 │\n",
- "│ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 134640530 │ 4448836.836776925 │ 0.00007106463186232300 │ 5.136727029318757e-06 │ 517 │ 4132 │ 4132 │\n",
- "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 119952045 │ 125551585.96841855 │ 0.00193008438541577500 │ 0.003281532412621963 │ 3975 │ 4012 │ 4068 │\n",
- "│ 0x4200000000000000000000000000000000000042 │ 103674485 │ 123213874.92716488 │ 0.00809187465620548800 │ 0.00807749067105585 │ 3666 │ 3685 │ 3841 │\n",
- "├────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
- "│ 10 rows 8 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"duckdb_client.sql(\"\"\"\n",
" SELECT\n",
@@ -283,7 +172,7 @@
" count_transactions_called_with_internal_type_call_or_delegate,\n",
" count_transactions_called\n",
" \n",
- " FROM daily_trace_calls_agg_to_v1\n",
+ " FROM daily_trace_calls_tr_to_v1\n",
" ORDER BY sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call DESC\n",
" LIMIT 10\n",
" \"\"\")"
@@ -291,39 +180,12 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬──────────────┬────────────────┬────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────────────┬─────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬─────────────────┬───────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬─────────────────────────────┬─────────────────────────────┬────────────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
- "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ call_type │ tx_l2_gas_used │ tx_l1_gas_used_unified │ tx_estimated_size │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_input_byte_length │ tx_input_zero_bytes │ tx_input_nonzero_bytes │ tx_l1_base_scaled_size │ tx_l1_blob_scaled_size │ tx_method_id │ block_hour │ tx_success │ error │ trace_method_id │ trace_success │ is_system_transaction │ trace_address_cardinality │ trace_address_uplevel │ count_traces_in_transaction │ trace_gas_used_in_subtraces │ trace_gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_l2_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
- "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ int64 │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ int32 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ boolean │ int64 │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
- "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼──────────────┼────────────────┼────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────────────┼─────────────────────┼────────────────────────┼────────────────────────┼────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼─────────────────┼───────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼─────────────────────────────┼─────────────────────────────┼────────────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ false │ 0 │ -1 │ 19 │ 135545 │ 35841 │ 0.00004981124250191700 │ 0.00000000008368873500 │ 0.00004981124250191700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ false │ 1 │ │ 19 │ 132840 │ 2705 │ 0.00000375936527908500 │ 0.00000000000631617500 │ 0.00000375936527908500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ false │ 2 │ 0 │ 19 │ 69223 │ 63617 │ 0.00008841387835842900 │ 0.00000000014854569500 │ 0.00008841387835842900 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ false │ 3 │ 0,0 │ 19 │ 3542 │ 5918 │ 0.00000822474074736600 │ 0.00000000001381853000 │ 0.00000822474074736600 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ false │ 4 │ 0,0,0 │ 19 │ 547 │ 2995 │ 0.00000416240259181500 │ 0.00000000000699332500 │ 0.00000416240259181500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ false │ 5 │ 0,0,0,0 │ 19 │ 381 │ 166 │ 0.00000023070411694200 │ 0.00000000000038761000 │ 0.00000023070411694200 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ false │ 6 │ 0,0,0,0,0 │ 19 │ 0 │ 381 │ 0.00000052950764189700 │ 0.00000000000088963500 │ 0.00000052950764189700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ false │ 3 │ 0,0 │ 19 │ 7940 │ 9330 │ 0.00001296668319921000 │ 0.00000000002178555000 │ 0.00001296668319921000 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ false │ 4 │ 0,0,1 │ 19 │ 0 │ 2674 │ 0.00000371628198013800 │ 0.00000000000624379000 │ 0.00000371628198013800 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
- "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ false │ 4 │ 0,0,1 │ 19 │ 0 │ 2682 │ 0.00000372740025083400 │ 0.00000000000626247000 │ 0.00000372740025083400 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
- "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴──────────────┴────────────────┴────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────────────┴─────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴─────────────────┴───────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴─────────────────────────────┴─────────────────────────────┴────────────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
- "│ 10 rows 63 columns │\n",
- "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"duckdb_client.sql(\"\"\"\n",
- " SELECT * FROM refined_trace_calls_v1\n",
+ " SELECT * FROM refined_traces_v1\n",
" where transaction_hash = '0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda'\n",
" AND block_number = 128145924\n",
" ORDER BY trace_address ASC\n",
@@ -340,77 +202,29 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌──────────────────┬─────────┬───────────────┐\n",
- "│ interm_num_calls │ num_txs │ num_trace_tos │\n",
- "│ int64 │ int64 │ int64 │\n",
- "├──────────────────┼─────────┼───────────────┤\n",
- "│ 1274668 │ 33166 │ 43972 │\n",
- "└──────────────────┴─────────┴───────────────┘"
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_trace_calls_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_traces_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌──────────┬─────────┬───────────────┐\n",
- "│ num_rows │ num_txs │ num_trace_tos │\n",
- "│ int64 │ int64 │ int64 │\n",
- "├──────────┼─────────┼───────────────┤\n",
- "│ 528958 │ 33166 │ 43972 │\n",
- "└──────────┴─────────┴───────────────┘"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_trace_calls_agg_to_hash_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM aggregated_traces_tr_to_hash_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌──────────┬───────────────┐\n",
- "│ num_rows │ num_trace_tos │\n",
- "│ int64 │ int64 │\n",
- "├──────────┼───────────────┤\n",
- "│ 43966 │ 43966 │\n",
- "└──────────┴───────────────┘"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM daily_trace_calls_agg_to_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM daily_trace_calls_tr_to_v1\")"
]
},
{
@@ -422,51 +236,11 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "┌──────────────────────────────────────────────────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
- "│ column_name │ column_type │ null │ key │ default │ extra │\n",
- "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
- "├──────────────────────────────────────────────────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
- "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
- "│ trace_to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_transactions_called │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_transactions_called_tx_success │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_unique_blocks_called │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_unique_tx_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_unique_tx_to_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ · │ · │ · │ · │ · │ · │\n",
- "│ count_internal_calls_call_type │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_internal_calls_call_type_trace_success │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_transactions_called_with_internal_type_call │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_transactions_called_with_internal_type_call_or_delegate │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "│ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
- "│ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,20) │ YES │ NULL │ NULL │ NULL │\n",
- "│ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
- "│ count_unique_trace_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
- "├──────────────────────────────────────────────────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
- "│ 78 rows (20 shown) 6 columns │\n",
- "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
- ]
- },
- "execution_count": 10,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "duckdb_client.sql(\"DESCRIBE daily_trace_calls_agg_to_v1\")\n"
+ "duckdb_client.sql(\"DESCRIBE daily_trace_calls_tr_to_v1\")\n"
]
}
],
diff --git a/notebooks/adhoc/refined_transactions_address_models_dev.ipynb b/notebooks/adhoc/refined_transactions_address_models_dev.ipynb
index 57ba66863a5..c30a30b9d9a 100644
--- a/notebooks/adhoc/refined_transactions_address_models_dev.ipynb
+++ b/notebooks/adhoc/refined_transactions_address_models_dev.ipynb
@@ -16,11 +16,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-14 20:59:01\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:01\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:01\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n"
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n"
]
}
],
@@ -69,20 +69,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:02\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:03\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:03\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_from_tx_to_method\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to_method\u001b[0m\n",
- "\u001b[2m2024-12-14 20:59:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m40572\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_from_tx_to_method\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to_method\u001b[0m\n",
+ "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to\u001b[0m\n",
"dict_keys(['refined_transactions_fees_v1', 'event_emitting_transactions_v1', 'summary_v1', 'daily_transactions_agg_tx_from_tx_to_method_v1', 'daily_transactions_agg_tx_to_method_v1', 'daily_transactions_agg_tx_to_v1'])\n"
]
},
@@ -178,7 +178,7 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM daily_transactions_agg_tx_from_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_from_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")"
]
},
{
@@ -214,7 +214,7 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM daily_transactions_agg_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")"
]
},
{
@@ -250,7 +250,44 @@
}
],
"source": [
- "duckdb_client.sql(\"SELECT * FROM daily_transactions_agg_tx_to_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_to_v1 ORDER BY count_transactions DESC LIMIT 10\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────────────────┬─────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ to_address │ count_transactions │ count_transactions_success │ count_unique_blocks │ count_unique_from_addresses │ count_unique_method_ids │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n",
+ "│ date │ varchar │ int32 │ varchar │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n",
+ "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────────────────┼─────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 6766 │ 6766 │ 1366 │ 5 │ 1 │ 3486432524 │ 3486432524 │ 0.0029310947547187890 │ 0.0029310947547187890 │ 0.0016644745896522240 │ 0.0016644745896522240 │ 0.0012666201650665650 │ 0.0012666201650665650 │ 0.0012627622421891670 │ 0.0012627622421891670 │ 0.0000038579228773980 │ 0.0000038579228773980 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00036329977888496914 │ 0.00036219322573906987 │ 0.0 │ 8.188288767636077 │ 1.749725911569594 │ 27064 │ 0 │ 27064 │ 56585.411200000000 │ 686216.515800000000 │ 10825600 │ 676600 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 4132 │ 4132 │ 1361 │ 3 │ 1 │ 1463179017 │ 1463179017 │ 0.0017944371588618550 │ 0.0017944371588618550 │ 0.0010198021012514210 │ 0.0010198021012514210 │ 0.0007746350576104340 │ 0.0007746350576104340 │ 0.0007730079479936740 │ 0.0007730079479936740 │ 0.0000016271096167600 │ 0.0000016271096167600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005294191951977904 │ 0.0005283071579160528 │ 0.0 │ 8.18465436287236 │ 1.76898462682423 │ 8264 │ 4132 │ 4132 │ 34556.742400000000 │ 419072.811600000000 │ 6611200 │ 413200 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xca11bde05977b3631167028862be2a173976ca11 │ 1953 │ 1953 │ 1025 │ 14 │ 1 │ 368648954 │ 368648954 │ 0.0017152021180275460 │ 0.0017152021180275460 │ 0.0015446633785242060 │ 0.0015446633785242060 │ 0.0001705387395033400 │ 0.0001705387395033400 │ 0.0001693481029723900 │ 0.0001693481029723900 │ 0.0000003977523406470 │ 0.0000003977523406470 │ 0.0000007956603712990 │ 0.0000007956603712990 │ 0.0004626047019879514 │ 0.00045937497213782957 │ 2.158314468726256e-06 │ 8.150272419802972 │ 1.7415342558618798 │ 2368996 │ 1799132 │ 569864 │ 52768.666254000000 │ 639930.496789125000 │ 10095402 │ 631379 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x802b65b5d9016621e66003aed0b16615093f328b │ 1416 │ 1244 │ 570 │ 29 │ 2 │ 181646841 │ 171429824 │ 0.0108782510554045840 │ 0.0102386569241862050 │ 0.0004951275076615130 │ 0.0004362167537166010 │ 0.0103831235477430710 │ 0.0098024401704696040 │ 0.0103829011191635720 │ 0.0098022311425260160 │ 0.0000002224285794990 │ 0.0000002090279435880 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0571610466253199 │ 0.05715982211418459 │ 0.0 │ 8.171833945862689 │ 1.9660420553473057 │ 283424 │ 200785 │ 82639 │ 15534.450601000000 │ 188387.719382437500 │ 2971963 │ 185984 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 1254 │ 833 │ 433 │ 40 │ 4 │ 243866812 │ 204060353 │ 0.0085534027251148020 │ 0.0059202052600618340 │ 0.0005297215979739630 │ 0.0003522423175452520 │ 0.0080236811271408390 │ 0.0055679629425165820 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003272555681630 │ 0.0000002742268356520 │ 0.0080233538715726760 │ 0.0055676887156809300 │ 0.03290189862793154 │ 0.0 │ 0.03290055668408326 │ 8.239423478882845 │ 2.107833908320731 │ 179978 │ 57796 │ 122182 │ 15677.633812000000 │ 190124.115426750000 │ 2999356 │ 187582 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 773 │ 773 │ 560 │ 593 │ 3 │ 27282141 │ 27282141 │ 0.0044753602954082940 │ 0.0044753602954082940 │ 0.0002091756264387080 │ 0.0002091756264387080 │ 0.0042661846689695860 │ 0.0042661846689695860 │ 0.0037770245145686980 │ 0.0037770245145686980 │ 0.0000000319845278930 │ 0.0000000319845278930 │ 0.0004891283261214480 │ 0.0004891283261214480 │ 0.156372795997557 │ 0.13844311245839167 │ 0.017928516904939684 │ 8.045102861593637 │ 1.9794536922851642 │ 52660 │ 30871 │ 21789 │ 6466.818265000000 │ 78423.703283437500 │ 1237195 │ 77325 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 645 │ 582 │ 258 │ 22 │ 1 │ 91833326 │ 88720964 │ 0.1301338657302059040 │ 0.1267186651330060110 │ 0.0001795861496755980 │ 0.0001617806061999360 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.0000001239708663080 │ 0.0000001194382884650 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 1.4151102354773724 │ 1.4151102354773724 │ 0.0 │ 8.34974817814926 │ 2.0426825710566794 │ 23220 │ 7212 │ 16008 │ 5394.264000000000 │ 65416.738500000000 │ 1032000 │ 64500 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x8864dedd579cd1d7c36e099adf18465a8ded456d │ 640 │ 189 │ 341 │ 14 │ 4 │ 50096969 │ 30864767 │ 0.0070723659366675420 │ 0.0038263909960486210 │ 0.0001833643481359590 │ 0.0000549551334551500 │ 0.0068890015885315830 │ 0.0037714358625934710 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000678510879360 │ 0.0000000442586674330 │ 0.0068889337374436470 │ 0.0037713916039260380 │ 0.13751334114707783 │ 0.0 │ 0.13751198675200585 │ 8.266924337552002 │ 2.030841530355978 │ 82134 │ 58371 │ 23763 │ 5545.617012000000 │ 67252.210476750000 │ 1060956 │ 66365 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x2b86d9abaf056661ab3d43201211172aa0e0b8c4 │ 562 │ 429 │ 270 │ 21 │ 4 │ 115573680 │ 104304264 │ 0.0018842709429315030 │ 0.0016301632833440710 │ 0.0003077722249904040 │ 0.0002336658955041920 │ 0.0015764987179410990 │ 0.0013964973878398790 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000001519665802760 │ 0.0000001374043068420 │ 0.0015763467513608230 │ 0.0013963599835330370 │ 0.01364063788520967 │ 0.0 │ 0.013639322996038743 │ 8.359806547584222 │ 2.007466056351254 │ 129090 │ 32946 │ 96144 │ 9360.077759000000 │ 113510.528795062500 │ 1790717 │ 111940 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 540 │ 457 │ 431 │ 15 │ 4 │ 118174601 │ 114226587 │ 0.0009009555701843000 │ 0.0008705263939930400 │ 0.0001733808189142260 │ 0.0001510135358454320 │ 0.0007275747512700740 │ 0.0007195128581476080 │ 0.0007268461725643530 │ 0.0007187874416905200 │ 0.0000000965964031140 │ 0.0000000934341544810 │ 0.0000006319833258710 │ 0.0000006319833258710 │ 0.006156777726459801 │ 0.006150612453215331 │ 5.347877805578545e-06 │ 7.875161467080705 │ 1.4186915815533334 │ 228688 │ 196058 │ 32630 │ 6869.098639000000 │ 83302.194590062500 │ 1314157 │ 82155 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────────────────┴─────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n",
+ "│ 10 rows 36 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Check System tx identification\n",
+ "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_to_v1 ORDER BY count_transactions DESC LIMIT 10\")"
]
},
{
@@ -262,7 +299,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -276,18 +313,18 @@
"└──────────┴─────────┴─────────┘"
]
},
- "execution_count": 7,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_agg_tx_from_tx_to_method_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_tx_from_tx_to_method_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
@@ -301,18 +338,18 @@
"└──────────┴─────────┴─────────┘"
]
},
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_agg_tx_to_method_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_tx_to_method_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"outputs": [
{
@@ -326,13 +363,13 @@
"└──────────┴─────────┴─────────┘"
]
},
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_agg_tx_to_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_tx_to_v1\")"
]
},
{
@@ -344,7 +381,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 11,
"metadata": {},
"outputs": [
{
@@ -382,13 +419,13 @@
"└─────────────────────────────────────────────────────────────────────────────────────────────┘"
]
},
- "execution_count": 10,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "duckdb_client.sql(\"DESCRIBE daily_transactions_agg_tx_to_v1\")\n"
+ "duckdb_client.sql(\"DESCRIBE daily_transactions_tx_to_v1\")\n"
]
}
],
diff --git a/src/op_analytics/datapipeline/models/code/refined_traces_models.py b/src/op_analytics/datapipeline/models/code/refined_traces_models.py
index 27952f5de6e..67bb788d428 100644
--- a/src/op_analytics/datapipeline/models/code/refined_traces_models.py
+++ b/src/op_analytics/datapipeline/models/code/refined_traces_models.py
@@ -12,10 +12,10 @@
"ingestion/traces_v1",
],
expected_outputs=[
- "refined_trace_calls_v1",
- "refined_trace_calls_agg_tr_from_tr_to_hash_v1",
- "daily_trace_calls_agg_tr_to_tx_to_v1",
- "daily_trace_calls_agg_to_v1",
+ "refined_traces_fees_v1",
+ "refined_traces_fees_tr_from_tr_to_hash_v1",
+ "daily_traces_tr_to_tx_to_v1",
+ "daily_traces_to_v1",
],
auxiliary_views=[
TemplatedSQLQuery(
@@ -23,23 +23,23 @@
context={},
),
TemplatedSQLQuery(
- template_name="refined_trace_calls",
+ template_name="refined_traces_fees",
context={},
),
TemplatedSQLQuery(
- template_name="refined_trace_calls_agg_tr_from_tr_to_hash",
+ template_name="aggregated_traces_tr_from_tr_to_hash",
context={},
),
TemplatedSQLQuery(
- template_name="refined_trace_calls_agg_tr_to_hash",
+ template_name="aggregated_traces_tr_to_hash",
context={},
),
TemplatedSQLQuery(
- template_name="daily_trace_calls_agg_tr_to_tx_to",
+ template_name="daily_traces_tr_to_tx_to",
context={},
),
TemplatedSQLQuery(
- template_name="daily_trace_calls_agg_tr_to",
+ template_name="daily_traces_tr_to",
context={},
),
],
@@ -48,15 +48,11 @@ def refined_traces_models(
duckdb_client: duckdb.DuckDBPyConnection,
) -> NamedRelations:
return {
- "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"),
- "refined_trace_calls_agg_tr_from_tr_to_hash_v1": duckdb_client.view(
- "refined_trace_calls_agg_tr_from_tr_to_hash"
+ "refined_traces_fees_v1": duckdb_client.view("refined_traces_fees"),
+ "aggregated_traces_tr_from_tr_to_hash_v1": duckdb_client.view(
+ "aggregated_traces_tr_from_tr_to_hash"
),
- "refined_trace_calls_agg_to_hash_v1": duckdb_client.view(
- "refined_trace_calls_agg_tr_to_hash"
- ),
- "daily_trace_calls_agg_tr_to_tx_to_v1": duckdb_client.view(
- "daily_trace_calls_agg_tr_to_tx_to"
- ),
- "daily_trace_calls_agg_to_v1": duckdb_client.view("daily_trace_calls_agg_tr_to"),
+ "aggregated_traces_tr_to_hash_v1": duckdb_client.view("aggregated_traces_tr_to_hash"),
+ "daily_traces_tr_to_tx_to_v1": duckdb_client.view("daily_traces_tr_to_tx_to"),
+ "daily_traces_tr_to_v1": duckdb_client.view("daily_traces_tr_to"),
}
diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py b/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py
index 84996faa289..0ea35566c02 100644
--- a/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py
+++ b/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py
@@ -15,9 +15,9 @@
"refined_transactions_fees_v1",
"event_emitting_transactions_v1",
"summary_v1",
- "daily_transactions_agg_tx_from_tx_to_method_v1",
- "daily_transactions_agg_tx_to_method_v1",
- "daily_transactions_agg_tx_to_v1",
+ "daily_transactions_tx_from_tx_to_method_v1",
+ "daily_transactions_tx_to_method_v1",
+ "daily_transactions_tx_to_v1",
],
auxiliary_views=[
TemplatedSQLQuery(
@@ -37,15 +37,15 @@
context={},
),
TemplatedSQLQuery(
- template_name="daily_transactions_agg_tx_from_tx_to_method",
+ template_name="daily_transactions_tx_from_tx_to_method",
context={},
),
TemplatedSQLQuery(
- template_name="daily_transactions_agg_tx_to_method",
+ template_name="daily_transactions_tx_to_method",
context={},
),
TemplatedSQLQuery(
- template_name="daily_transactions_agg_tx_to",
+ template_name="daily_transactions_tx_to",
context={},
),
],
@@ -57,11 +57,9 @@ def refined_transactions_addresses_models(
"refined_transactions_fees_v1": duckdb_client.view("refined_transactions_fees"),
"event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"),
"summary_v1": duckdb_client.view("daily_address_summary"),
- "daily_transactions_agg_tx_from_tx_to_method_v1": duckdb_client.view(
- "daily_transactions_agg_tx_from_tx_to_method"
+ "daily_transactions_tx_from_tx_to_method_v1": duckdb_client.view(
+ "daily_transactions_tx_from_tx_to_method"
),
- "daily_transactions_agg_tx_to_method_v1": duckdb_client.view(
- "daily_transactions_agg_tx_to_method"
- ),
- "daily_transactions_agg_tx_to_v1": duckdb_client.view("daily_transactions_agg_tx_to"),
+ "daily_transactions_tx_to_method_v1": duckdb_client.view("daily_transactions_tx_to_method"),
+ "daily_transactions_tx_to_v1": duckdb_client.view("daily_transactions_tx_to"),
}
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_from_tr_to_hash.sql.j2
similarity index 90%
rename from src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2
rename to src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_from_tr_to_hash.sql.j2
index 7e03113ae4b..43ab1df0cb3 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_from_tr_to_hash.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_from_tr_to_hash.sql.j2
@@ -13,7 +13,8 @@
SELECT
-- Descriptors
dt, chain, network, chain_id
- , trace_from_address, trace_to_address, block_timestamp, block_number
+ , trace_from_address, trace_to_address, trace_type
+ , block_timestamp, block_number
, tx_from_address, tx_to_address, transaction_hash, tx_method_id
-- Transaction-Level gas & fees
, tx_l2_gas_used
@@ -53,10 +54,10 @@ SELECT
, SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces
-- Count Call Types
- , COUNT(*) FILTER (WHERE trace_address = '') AS count_top_level_calls
+ , COUNT(*) FILTER (WHERE trace_address = '' AND call_type != '') AS count_top_level_calls
--count non-null trace addresses, null is the transaction-level call.
- , COUNT(*) FILTER (WHERE trace_address != '') AS count_internal_calls_all_types
- , COUNT(*) FILTER (WHERE trace_address != '' AND trace_success) AS count_internal_calls_all_types_trace_success
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type != '') AS count_internal_calls_all_types
+ , COUNT(*) FILTER (WHERE trace_address != '' AND call_type != '' AND trace_success) AS count_internal_calls_all_types_trace_success
--static calls only read state, and can not write
, COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'staticcall') AS count_internal_calls_static_type
, COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'staticcall' AND trace_success) AS count_internal_calls_static_type_trace_success
@@ -67,12 +68,13 @@ SELECT
, COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'call') AS count_internal_calls_call_type
, COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'call' AND trace_success) AS count_internal_calls_call_type_trace_success
-FROM refined_trace_calls
+FROM refined_traces_fees
GROUP BY
-- Descriptors
dt, chain, network, chain_id
- , trace_from_address, trace_to_address, block_timestamp, block_number
+ , trace_from_address, trace_to_address, trace_type
+ , block_timestamp, block_number
, tx_from_address, tx_to_address, transaction_hash, tx_method_id
-- Transaction-Level gas & fees
, tx_l2_gas_used
@@ -87,4 +89,3 @@ GROUP BY
-- Attributes
, tx_success
, is_system_transaction
-
\ No newline at end of file
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_to_hash.sql.j2
similarity index 89%
rename from src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_to_hash.sql.j2
rename to src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_to_hash.sql.j2
index 19cb98a206a..c7703c1ec2f 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls_agg_tr_to_hash.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_to_hash.sql.j2
@@ -5,7 +5,7 @@ WITH get_transactions_by_call_type AS (
SELECT dt, chain_id, block_number, transaction_hash
, SUM(count_internal_calls_call_type) > 0 AS is_transaction_with_internal_call_type_call
, SUM(coalesce(count_internal_calls_call_type,0)+coalesce(count_internal_calls_delegate_type,0)) > 0 AS is_transaction_with_internal_call_type_call_or_delegate
- FROM refined_trace_calls_agg_tr_from_tr_to_hash
+ FROM aggregated_traces_tr_from_tr_to_hash
GROUP BY
dt, chain_id, block_number, transaction_hash
@@ -67,7 +67,15 @@ dt, chain, network, chain_id,
, SUM(count_internal_calls_call_type) AS count_internal_calls_call_type
, SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success
-FROM refined_trace_calls_agg_tr_from_tr_to_hash
+ --count by trace type
+ ,COUNT(*) AS count_traces_type_all_types
+ ,COUNT(*) FILTER (WHERE trace_type = 'call') AS count_traces_trace_type_call
+ ,COUNT(*) FILTER (WHERE trace_type = 'suicide') AS count_traces_trace_type_suicide
+ ,COUNT(*) FILTER (WHERE trace_type = 'create') AS count_traces_trace_type_create
+ ,COUNT(*) FILTER (WHERE trace_type = 'create2') AS count_traces_trace_type_create2
+ ,COUNT(*) FILTER (WHERE trace_type LIKE 'create%') AS count_traces_trace_type_create_any
+
+FROM aggregated_traces_tr_from_tr_to_hash
GROUP BY
dt, chain, network, chain_id,
diff --git a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to.sql.j2
similarity index 94%
rename from src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to.sql.j2
rename to src/op_analytics/datapipeline/models/templates/daily_traces_tr_to.sql.j2
index c442469a8ef..eb8d04df574 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to.sql.j2
@@ -6,7 +6,7 @@ WITH get_unique_callers AS (
SELECT
dt, chain_id, trace_to_address,
COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses
- FROM refined_trace_calls_agg_tr_from_tr_to_hash
+ FROM aggregated_traces_tr_from_tr_to_hash
GROUP BY
dt, chain, network, chain_id, trace_to_address
)
@@ -145,8 +145,15 @@ dt, chain, network, chain_id, trace_to_address
WHERE tx_success AND is_transaction_with_internal_call_type_call
) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
+--count by trace type
+,SUM(count_traces_type_all_types) AS count_traces_type_all_types
+,SUM(count_traces_trace_type_call) AS count_traces_trace_type_call
+,SUM(count_traces_trace_type_suicide) AS count_traces_trace_type_suicide
+,SUM(count_traces_trace_type_create) AS count_traces_trace_type_create
+,SUM(count_traces_trace_type_create2) AS count_traces_trace_type_create2
+,SUM(count_traces_trace_type_create_any) AS count_traces_trace_type_create_any
-FROM refined_trace_calls_agg_tr_to_hash
+FROM aggregated_traces_tr_to_hash
WHERE NOT is_system_transaction
GROUP BY
diff --git a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to_tx_to.sql.j2
similarity index 94%
rename from src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2
rename to src/op_analytics/datapipeline/models/templates/daily_traces_tr_to_tx_to.sql.j2
index c539615b36e..08ff098c20f 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_trace_calls_agg_tr_to_tx_to.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to_tx_to.sql.j2
@@ -11,7 +11,7 @@ WITH get_unique_callers AS (
SELECT
dt, chain_id, trace_to_address, tx_to_address, tx_method_id,
COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses
- FROM refined_trace_calls_agg_tr_from_tr_to_hash
+ FROM aggregated_traces_tr_from_tr_to_hash
GROUP BY
dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id
)
@@ -149,8 +149,16 @@ dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id
WHERE tx_success AND is_transaction_with_internal_call_type_call
) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call
+--count by trace type
+,SUM(count_traces_type_all_types) AS count_traces_type_all_types
+,SUM(count_traces_trace_type_call) AS count_traces_trace_type_call
+,SUM(count_traces_trace_type_suicide) AS count_traces_trace_type_suicide
+,SUM(count_traces_trace_type_create) AS count_traces_trace_type_create
+,SUM(count_traces_trace_type_create2) AS count_traces_trace_type_create2
+,SUM(count_traces_trace_type_create_any) AS count_traces_trace_type_create_any
-FROM refined_trace_calls_agg_tr_to_hash
+
+FROM aggregated_traces_tr_to_hash
WHERE NOT is_system_transaction
GROUP BY
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_from_tx_to_method.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_from_tx_to_method.sql.j2
similarity index 100%
rename from src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_from_tx_to_method.sql.j2
rename to src/op_analytics/datapipeline/models/templates/daily_transactions_tx_from_tx_to_method.sql.j2
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2
similarity index 100%
rename from src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to.sql.j2
rename to src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to_method.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to_method.sql.j2
similarity index 100%
rename from src/op_analytics/datapipeline/models/templates/daily_transactions_agg_tx_to_method.sql.j2
rename to src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to_method.sql.j2
diff --git a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2
similarity index 93%
rename from src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
rename to src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2
index 2942fa9953e..1a390db6cea 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_trace_calls.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2
@@ -2,7 +2,7 @@ WITH
-- Select the columns that we want from transactions joined to blocks.
-- Include some minor transformations that are needed for further calculations.
-base_level_trace_calls AS (
+base_level_traces AS (
SELECT
-- Raw Trace fields
r.dt,
@@ -18,7 +18,11 @@ base_level_trace_calls AS (
r.gas AS trace_gas_limit,
r.gas_used AS trace_gas_used,
r.trace_address,
+ r.trace_type,
r.call_type,
+ -- Trace i/o data - comment out for now to save on data space
+ -- r.input,
+ -- r.output,
-- Raw Transaction Fields
t.l2_gas_used AS tx_l2_gas_used,
t.l1_gas_used_unified AS tx_l1_gas_used_unified,
@@ -76,7 +80,13 @@ base_level_trace_calls AS (
- length(split_part(r.trace_address, ',', array_length(string_split(r.trace_address, ','))))
- 1
)
- END AS trace_address_uplevel
+ END AS trace_address_uplevel,
+
+ -- get the first trace level, for downstream cases where we want to split by each action
+ CASE
+ WHEN r.trace_address = '' THEN ''
+ ELSE split_part(r.trace_address, ',', 1)
+ END AS trace_address_toplevel
@@ -86,7 +96,6 @@ base_level_trace_calls AS (
r.block_number = t.block_number
AND r.transaction_hash = t.hash
- WHERE r.trace_type = 'call'
),
--get amount of calls per transcation, to use for amortizing
@@ -97,7 +106,7 @@ get_traces_per_tansaction AS (
block_timestamp,
transaction_hash,
count(*) AS count_traces_in_transaction
- FROM base_level_trace_calls
+ FROM base_level_traces
GROUP BY 1, 2, 3, 4, 5
),
@@ -112,7 +121,7 @@ get_subtraces_gas_per_trace AS (
trace_address_cardinality,
sum(trace_gas_used) AS trace_gas_used_in_subtraces,
count(*) AS count_subtraces_in_trace
- FROM base_level_trace_calls
+ FROM base_level_traces
GROUP BY 1, 2, 3, 4, 5, 6, 7
)
@@ -154,7 +163,7 @@ SELECT
* gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_fee_native_l1_amortized_l2_minus_subtraces
-FROM base_level_trace_calls AS bl
+FROM base_level_traces AS bl
INNER JOIN get_traces_per_tansaction AS tpt -- join on txn level
ON bl.dt = tpt.dt
AND bl.chain_id = tpt.chain_id
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 4f98aa206cf..c6f6d11e7c1 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -28,12 +28,16 @@ pt1 AS (
t.gas AS gas_limit,
t.receipt_gas_used AS l2_gas_used,
t.receipt_l1_gas_used,
+ -- Transaction input data - comment out for now to save on data space
+ -- t.input,
-- Fees
t.receipt_l1_gas_price AS l1_gas_price,
t.receipt_l1_blob_base_fee AS l1_blob_base_fee,
b.base_fee_per_gas,
t.max_priority_fee_per_gas,
t.transaction_type,
+ -- blob reference, comment out for now, but bring in if/when we aplly this to L1, or see L2 blobs
+ -- t.blob_versioned_hashes
-- L2 Fees and breakdown into BASE and PRIORITY contributions
t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar,
CASE WHEN t.gas_price = 0 THEN 0
From 9f147e25a8e38ab071197b129a1ece5457a10c43 Mon Sep 17 00:00:00 2001
From: Michael Silberling <4006780+MSilb7@users.noreply.github.com>
Date: Mon, 16 Dec 2024 10:18:32 -0500
Subject: [PATCH 27/32] push dev notebook
---
.../adhoc/refined_traces_models_dev.ipynb | 274 ++++++++++++++++--
1 file changed, 250 insertions(+), 24 deletions(-)
diff --git a/notebooks/adhoc/refined_traces_models_dev.ipynb b/notebooks/adhoc/refined_traces_models_dev.ipynb
index 70d93b098b6..af170c040c1 100644
--- a/notebooks/adhoc/refined_traces_models_dev.ipynb
+++ b/notebooks/adhoc/refined_traces_models_dev.ipynb
@@ -62,7 +62,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
"outputs": [
{
@@ -84,6 +84,36 @@
"\u001b[2m2024-12-16 09:53:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m61221\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_traces_tr_to\u001b[0m\n",
"dict_keys(['refined_traces_fees_v1', 'aggregated_traces_tr_from_tr_to_hash_v1', 'aggregated_traces_tr_to_hash_v1', 'daily_traces_tr_to_tx_to_v1', 'daily_traces_tr_to_v1'])\n"
]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "┌─────────────────────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├─────────────────────────────────────────┤\n",
+ "│ aggregated_traces_tr_from_tr_to_hash │\n",
+ "│ aggregated_traces_tr_from_tr_to_hash_v1 │\n",
+ "│ aggregated_traces_tr_to_hash │\n",
+ "│ aggregated_traces_tr_to_hash_v1 │\n",
+ "│ daily_traces_tr_to │\n",
+ "│ daily_traces_tr_to_tx_to │\n",
+ "│ daily_traces_tr_to_tx_to_v1 │\n",
+ "│ daily_traces_tr_to_v1 │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_traces_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ refined_traces_fees │\n",
+ "│ refined_traces_fees_v1 │\n",
+ "│ refined_transactions_fees │\n",
+ "├─────────────────────────────────────────┤\n",
+ "│ 14 rows │\n",
+ "└─────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
}
],
"source": [
@@ -114,11 +144,38 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬─────────┬──────────┬────────────────────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬────────────────────────────┬────────────────────────────────┬──────────────────────────────┬────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬──────────────────────────┬─────────────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────┬─────────────────────────────┬───────────────────────────┬──────────────────────────────────────┬───────────────────────┬──────────────────────────────────┬───────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────┬───────────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬──────────────────────────────┬────────────────────┬───────────────────────────────┬────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────────────────┬─────────────────────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────┬─────────────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬────────────────────────────────────────────────┬────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────┬──────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬─────────────────────────────┬──────────────────────────────┬─────────────────────────────────┬────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬───────────────────────────────────┐\n",
+ "│ dt │ chain │ network │ chain_id │ trace_to_address │ count_transactions_called │ count_transactions_called_tx_success │ count_unique_blocks_called │ count_unique_tx_from_addresses │ count_unique_tx_to_addresses │ count_unique_tx_method_ids │ sum_tx_l2_gas_used_called │ sum_tx_l2_gas_used_called_tx_success │ sum_tx_fee_native_called │ sum_tx_fee_native_called_tx_success │ tx_l1_fee_native │ tx_l1_fee_native_tx_success │ tx_l2_fee_native │ tx_l2_fee_native_tx_success │ tx_l2_priority_fee_native │ tx_l2_priority_fee_native_tx_success │ tx_l2_base_fee_native │ tx_l2_base_fee_native_tx_success │ tx_l2_legacy_extra_fee_native │ tx_l2_legacy_extra_fee_native_tx_success │ avg_tx_l2_gas_price_gwei_called │ avg_tx_l2_priority_gas_price_gwei_called │ avg_tx_l2_legacy_extra_gas_price_gwei_called │ avg_tx_l1_base_gas_price_gwei_called │ avg_tx_l1_blob_base_gas_price_gwei_called │ sum_tx_input_byte_length_called │ sum_tx_input_zero_bytes_called │ sum_tx_input_nonzero_bytes_called │ sum_tx_l1_base_scaled_size_called │ sum_tx_l1_blob_scaled_size_called │ sum_tx_l1_gas_used_unified_called │ sum_tx_estimated_size_called │ sum_trace_gas_used │ sum_trace_gas_used_tx_success │ sum_trace_gas_used_minus_subtraces │ sum_trace_gas_used_minus_subtraces_tx_success │ sum_tx_l2_gas_used_amortized_by_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success │ sum_tx_l1_gas_used_unified_amortized_by_call │ sum_tx_l1_base_scaled_size_amortized_by_call │ sum_tx_l1_blob_scaled_size_amortized_by_call │ sum_tx_estimated_size_amortized_by_call │ sum_tx_l2_fee_native_minus_subtraces │ sum_tx_l2_fee_native_minus_subtraces_tx_success │ sum_tx_l2_base_fee_native_minus_subtraces │ sum_tx_l2_priority_fee_native_minus_subtraces │ sum_tx_l2_legacy_base_fee_native_minus_subtraces │ sum_tx_fee_native_amortized_by_call │ sum_tx_fee_native_amortized_by_call_tx_success │ sum_tx_l2_fee_native_amortized_by_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success │ sum_tx_l1_fee_native_amortized_by_call │ sum_tx_l1_fee_native_amortized_by_call_tx_success │ sum_tx_l2_base_fee_native_amortized_by_call │ sum_tx_l2_priority_fee_native_amortized_by_call │ sum_tx_fee_native_l1_amortized_l2_minus_subtraces │ count_top_level_calls │ count_internal_calls_all_types │ count_internal_calls_all_types_trace_success │ count_internal_calls_static_type │ count_internal_calls_static_type_trace_success │ count_internal_calls_delegate_type │ count_internal_calls_delegate_type_trace_success │ count_internal_calls_call_type │ count_internal_calls_call_type_trace_success │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_traces_type_all_types │ count_traces_trace_type_call │ count_traces_trace_type_suicide │ count_traces_trace_type_create │ count_traces_trace_type_create2 │ count_traces_trace_type_create_any │ count_unique_trace_from_addresses │\n",
+ "│ date │ varchar │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ double │ double │ double │ double │ double │ double │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ int64 │ int64 │ decimal(38,0) │ double │ decimal(38,20) │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ int64 │\n",
+ "├────────────┼─────────┼─────────┼──────────┼────────────────────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼────────────────────────────┼────────────────────────────────┼──────────────────────────────┼────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────────────────┼───────────────────────┼──────────────────────────────────┼───────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────┼───────────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼──────────────────────────────┼────────────────────┼───────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────────────────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼────────────────────────────────────────────────┼────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────┼──────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼─────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14695 │ 13688 │ 1380 │ 341 │ 77 │ 299 │ 6452271886 │ 6250947632 │ 0.1219897937370507150 │ 0.1106332698372177340 │ 0.0046893913808264620 │ 0.0041940751403341490 │ 0.1173004023562242530 │ 0.1064391946968835850 │ 0.0952425665896049750 │ 0.0925352274339835120 │ 0.0000073738719558640 │ 0.0000070583473422090 │ 0.0220505987724079880 │ 0.0138970429090307190 │ 0.018179705447741612 │ 0.014761090089253715 │ 0.0034174937389499812 │ 8.201251243507212 │ 1.809727157458527 │ 1634709 │ 1100753 │ 533956 │ 153099.723817000000 │ 1856654.512526437500 │ 29290171 │ 1830873 │ 806347671 │ 749646962 │ 529558288 │ 500050621 │ 1068526615.5822929 │ 1046647297.4262673 │ 4888768.627139386 │ 25553.593614057347 │ 309890.793477306 │ 305586.8910499804 │ 0.04029101981655442800 │ 0.03829338800582661200 │ 0.00000060506389677800 │ 0.03379136370802675700 │ 0.00649908218414147200 │ 0.01918201670313629 │ 0.016497407132283728 │ 0.01841420484700524 │ 0.015821709761356873 │ 0.0007678118561310304 │ 0.0006756973709268447 │ 1.1894692653723839e-06 │ 0.014623270722784028 │ 0.04105883167268545 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 108919 │ 105750 │ 0 │ 0 │ 3670 │ 14695 │ 288049460 │ 204823127.44738504 │ 0.03819199276620082500 │ 0.015445279151271054 │ 0.015644821523381112 │ 88838 │ 88838 │ 0 │ 0 │ 0 │ 0 │ 34 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 13054 │ 12803 │ 1379 │ 269 │ 94 │ 181 │ 6428944143 │ 6291511311 │ 0.0177214889376692160 │ 0.0171720726307182100 │ 0.0039149172970481770 │ 0.0036774312323045060 │ 0.0138065716406210390 │ 0.0134946413984137040 │ 0.0118712635101399800 │ 0.0117670453288556910 │ 0.0000073569861295260 │ 0.0000071245687027410 │ 0.0019280085884527420 │ 0.0017205254171395800 │ 0.0021475644108144864 │ 0.0018465339324911878 │ 0.00029989505983684853 │ 8.203521185800055 │ 1.798948965305693 │ 734430 │ 393661 │ 340769 │ 127261.627871000000 │ 1543313.532953062500 │ 24346973 │ 1521742 │ 793020153 │ 761387815 │ 601844620 │ 578926878 │ 800355995.2562444 │ 792574796.1152569 │ 2801964.987398146 │ 14645.870989129777 │ 177611.83223524876 │ 175129.63427717518 │ 0.00223241117712563900 │ 0.00217878442270576500 │ 0.00000071241591551100 │ 0.00156030922651197600 │ 0.00067140258033343000 │ 0.0014126579337360179 │ 0.0013457018983072107 │ 0.0009691947028858401 │ 0.0009275411333873869 │ 0.00044346323085017747 │ 0.0004181607649198239 │ 8.965288235753237e-07 │ 0.0007682613407935641 │ 0.0026758744079758154 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 76887 │ 75904 │ 0 │ 0 │ 2464 │ 13054 │ 402995706 │ 94954403.79477677 │ 0.00210702323974724500 │ 0.0006637992614178352 │ 0.0007307753323052493 │ 40438 │ 40438 │ 0 │ 0 │ 0 │ 0 │ 180 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 12419 │ 11983 │ 1379 │ 188 │ 39 │ 180 │ 5509275663 │ 5420289642 │ 0.0812010819017146630 │ 0.0740585349932124140 │ 0.0034191107584217350 │ 0.0032050065832735430 │ 0.0777819711432929280 │ 0.0708535284099388710 │ 0.0638217003754810510 │ 0.0618929396178460310 │ 0.0000061980374237800 │ 0.0000060440079740220 │ 0.0139541426180543950 │ 0.0089546128717087240 │ 0.014118366170288497 │ 0.01158440860095351 │ 0.0025328452362203746 │ 8.193557265424658 │ 1.77845501825804 │ 547535 │ 350706 │ 196829 │ 113804.857500000000 │ 1380122.033906250000 │ 21772500 │ 1360831 │ 247637741 │ 231751597 │ 34407198 │ 33173217 │ 181409113.20457152 │ 174851869.68935162 │ 1017011.7609458558 │ 5315.920474464036 │ 64466.65931901351 │ 63571.008594612205 │ 0.00161791364834116600 │ 0.00118483349730291200 │ 0.00000003820465697000 │ 0.00112362448665840500 │ 0.00049425184282953400 │ 0.012270676533798743 │ 0.01040473419614907 │ 0.01211076651415241 │ 0.01028128460277713 │ 0.00015991001964633028 │ 0.00012344959337193398 │ 1.959627926290492e-07 │ 0.009512241894549313 │ 0.0017778236679874976 │ 0 │ 18268 │ 17387 │ 15936 │ 15200 │ 0 │ 0 │ 2332 │ 2187 │ 1687 │ 12419 │ 5087651 │ 63075664.9345231 │ 0.00117079859301269400 │ 0.010217330953640717 │ 0.010275181596323603 │ 13575 │ 13575 │ 0 │ 0 │ 0 │ 0 │ 40 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 12057 │ 11735 │ 1379 │ 261 │ 53 │ 256 │ 5377586786 │ 5286455316 │ 0.0232969391423820980 │ 0.0209563174421668930 │ 0.0034168346898384660 │ 0.0032127940004109450 │ 0.0198801044525436320 │ 0.0177435234417559480 │ 0.0183407833558363430 │ 0.0171825434751415000 │ 0.0000061420894750850 │ 0.0000059943431254880 │ 0.0015332572510255230 │ 0.0005550591762551140 │ 0.0036968449313174194 │ 0.0034105973712195044 │ 0.0002851199454404348 │ 8.208016337742121 │ 1.8032290003079243 │ 527342 │ 310789 │ 216553 │ 111864.093308000000 │ 1356586.207028250000 │ 21401204 │ 1337655 │ 164208684 │ 151365149 │ 70348033 │ 63356929 │ 144491780.9351728 │ 137155589.65942413 │ 855428.0388996559 │ 4471.322359328467 │ 54224.13985103501 │ 53474.662472897835 │ 0.00532948449070531800 │ 0.00479894612631183000 │ 0.00000009111683892700 │ 0.00497237357020249600 │ 0.00035703306041542600 │ 0.00377620339633381 │ 0.0033356188832723223 │ 0.0036340183586927584 │ 0.0032277447102081473 │ 0.00014218503764105083 │ 0.00010787417306417675 │ 1.7092561285117616e-07 │ 0.0032777765991069733 │ 0.005471669528346368 │ 0 │ 13948 │ 13203 │ 12827 │ 12276 │ 0 │ 0 │ 1121 │ 927 │ 1483 │ 11943 │ 35182861 │ 25337952.364479925 │ 0.00478704417847796600 │ 0.003181593098840975 │ 0.003222434310232159 │ 12111 │ 12111 │ 0 │ 0 │ 0 │ 0 │ 40 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 11842 │ 11572 │ 1380 │ 185 │ 28 │ 96 │ 5374653125 │ 5292988684 │ 0.0301797184740908970 │ 0.0275751674917356450 │ 0.0032079598058830470 │ 0.0030595347433565770 │ 0.0269717586682078500 │ 0.0245156327483790680 │ 0.0239145630016689240 │ 0.0233415174566461200 │ 0.0000060837781266980 │ 0.0000059476070391350 │ 0.0030511622017185950 │ 0.0011682174216660980 │ 0.005018325469740496 │ 0.00444950817205881 │ 0.0005676947201534229 │ 8.203940575214546 │ 1.784020770292575 │ 429785 │ 277672 │ 152113 │ 106683.420209000000 │ 1293759.705141937500 │ 20410067 │ 1275735 │ 181978502 │ 162868323 │ 5260405 │ 4485759 │ 159789118.70821694 │ 153283188.77684814 │ 768812.0511767166 │ 4018.5805915006295 │ 48733.69855375741 │ 48065.15414666971 │ 0.00047852347276841400 │ 0.00039545461476174600 │ 0.00000000628765871200 │ 0.00040979203771864100 │ 0.00006872555817834500 │ 0.0041413140311352134 │ 0.003667228319724064 │ 0.004020001182121213 │ 0.003565688929790063 │ 0.00012131284901400014 │ 0.00010153938993400012 │ 1.806105462733887e-07 │ 0.0035897908732182952 │ 0.0005998363217824137 │ 0 │ 15741 │ 14910 │ 14241 │ 13671 │ 0 │ 0 │ 1500 │ 1239 │ 1361 │ 11842 │ 2436607 │ 42156895.724761166 │ 0.00039430556297552000 │ 0.003517087848871932 │ 0.0035571140423531523 │ 13261 │ 13261 │ 0 │ 0 │ 0 │ 0 │ 31 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 11629 │ 11335 │ 1379 │ 207 │ 55 │ 107 │ 5192960124 │ 5111471019 │ 0.0385805977857356220 │ 0.0286334499974164940 │ 0.0031220427054908210 │ 0.0029461056019041320 │ 0.0354585550802448010 │ 0.0256873443955123620 │ 0.0241924430564917020 │ 0.0230589995493936380 │ 0.0000058070135646340 │ 0.0000056921334498320 │ 0.0112603362586334100 │ 0.0026226792500277260 │ 0.006828197065555746 │ 0.004658699947392799 │ 0.0021683848883399227 │ 8.191009697732017 │ 1.7688029317897829 │ 414115 │ 250361 │ 163754 │ 104980.918358000000 │ 1273113.307712625000 │ 20084354 │ 1255348 │ 86492551 │ 73215959 │ 56703147 │ 49508128 │ 130637259.29100339 │ 125461323.54484168 │ 689248.7675517767 │ 3602.7033079930634 │ 43690.31626781257 │ 43096.10188839158 │ 0.01268942514508051100 │ 0.00930790926353997200 │ 0.00000006653851932200 │ 0.00858835711056542700 │ 0.00410100821552410900 │ 0.005833905709314265 │ 0.004240585618287048 │ 0.005724012080796109 │ 0.004157020801367643 │ 0.00010989362851815146 │ 8.356481691940255e-05 │ 1.4716247230833441e-07 │ 0.004111370935708565 │ 0.012799318773598665 │ 0 │ 12356 │ 11892 │ 11626 │ 11361 │ 0 │ 0 │ 730 │ 531 │ 1146 │ 11557 │ 21451912 │ 14181568.327675236 │ 0.00929610137937214000 │ 0.004111318843136727 │ 0.004132350453560312 │ 11645 │ 11645 │ 0 │ 0 │ 0 │ 0 │ 42 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 11625 │ 11436 │ 1379 │ 144 │ 41 │ 78 │ 5243474206 │ 5156416961 │ 0.0156279882492578490 │ 0.0120260751312825160 │ 0.0031798546004170230 │ 0.0030353949259197480 │ 0.0124481336488408260 │ 0.0089906802053627680 │ 0.0092287612906324480 │ 0.0082244739389089310 │ 0.0000059226175323900 │ 0.0000057950450332990 │ 0.0032134892284338710 │ 0.0007604504932057870 │ 0.002374024007707844 │ 0.0017600470466836977 │ 0.000612854970232664 │ 8.199354679266955 │ 1.782327780315835 │ 410882 │ 235247 │ 175635 │ 105985.396175000000 │ 1285294.703114062500 │ 20276525 │ 1267359 │ 95945172 │ 87281000 │ 58705420 │ 53635007 │ 135901352.73302457 │ 132423493.65167838 │ 708131.3574124348 │ 3701.4026051947276 │ 44887.251774709606 │ 44272.139209751294 │ 0.00394576075872735100 │ 0.00284609070787392600 │ 0.00000006933728096700 │ 0.00272674599166435800 │ 0.00121895058248596000 │ 0.002181381930451015 │ 0.001611919344720502 │ 0.0020675144277595464 │ 0.0015150007443969498 │ 0.00011386750269146585 │ 9.691860032354939e-05 │ 1.5394538980134915e-07 │ 0.0015480525615527284 │ 0.004059628261418816 │ 0 │ 12948 │ 12651 │ 12162 │ 12000 │ 0 │ 0 │ 786 │ 651 │ 1156 │ 11584 │ 25460939 │ 20585492.7916548 │ 0.00283264368853589000 │ 0.0014615745603174706 │ 0.0014910806595664042 │ 12174 │ 12174 │ 0 │ 0 │ 0 │ 0 │ 33 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 11229 │ 11148 │ 1379 │ 112 │ 29 │ 36 │ 5112738802 │ 5072420427 │ 0.0073606840852945480 │ 0.0069919974138059380 │ 0.0029458763141605170 │ 0.0028672307683049090 │ 0.0044148077711340310 │ 0.0041247666455010290 │ 0.0036351253005716780 │ 0.0036088821030808790 │ 0.0000057153963770370 │ 0.0000056635089986220 │ 0.0007739834400406350 │ 0.0005102373445989130 │ 0.0008634917491593835 │ 0.0007109937435391166 │ 0.00015138333288957932 │ 8.193502166729221 │ 1.7649904093193 │ 261870 │ 141787 │ 120083 │ 99293.539879000000 │ 1204141.942812562500 │ 18996277 │ 1187293 │ 51980514 │ 49194255 │ 42759295 │ 40779725 │ 121989647.43375477 │ 120449310.63483882 │ 527661.9000620173 │ 2758.0887516240914 │ 33447.597415474505 │ 32984.27131114668 │ 0.00089300422058779200 │ 0.00085632499342977600 │ 0.00000004833956906600 │ 0.00069597300470962000 │ 0.00019698531639617200 │ 0.000657499465678043 │ 0.0005366275083218477 │ 0.0005734514709505007 │ 0.0004623090708653185 │ 8.404799472754249e-05 │ 7.431843745652968e-05 │ 1.362381235262895e-07 │ 0.00037373513973324476 │ 0.0009770522153153343 │ 0 │ 11557 │ 11397 │ 11251 │ 11133 │ 0 │ 0 │ 306 │ 264 │ 807 │ 11201 │ 12769625 │ 9330385.170053398 │ 0.00084456288257907200 │ 0.0004167685581526745 │ 0.0004295550972362153 │ 11233 │ 11233 │ 0 │ 0 │ 0 │ 0 │ 24 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 11006 │ 10984 │ 1379 │ 58 │ 20 │ 20 │ 5029780657 │ 5023913161 │ 0.0060735538237173350 │ 0.0059833504223231600 │ 0.0027876039974382160 │ 0.0027713824304713380 │ 0.0032859498262791190 │ 0.0032119679918518220 │ 0.0029589854273758550 │ 0.0029510050391285750 │ 0.0000055978250700170 │ 0.0000055886599657600 │ 0.0003213888708145280 │ 0.0002553965897387680 │ 0.0006532988315715174 │ 0.0005882931342657662 │ 6.389719407888049e-05 │ 8.189933307768259 │ 1.763358675368465 │ 103294 │ 42165 │ 61129 │ 94002.571853000000 │ 1139977.884144187500 │ 17984039 │ 1124012 │ 42819405 │ 41826096 │ 2483548 │ 2415801 │ 118984247.22848395 │ 118377092.17050244 │ 448078.09158065065 │ 2342.1041846920243 │ 28402.914093517476 │ 28005.857080041806 │ 0.00001998465317498800 │ 0.00001851622456476300 │ 0.00000000286834802200 │ 0.00001576625271079400 │ 0.00000421557645465200 │ 0.00025305702423795447 │ 0.00023789094111646033 │ 0.00018271752514350663 │ 0.0001700244783980916 │ 7.033949909444785e-05 │ 6.786646271836871e-05 │ 1.3264413541765074e-07 │ 0.00014133350137056873 │ 9.032415226943573e-05 │ 0 │ 11480 │ 11373 │ 11377 │ 11276 │ 0 │ 0 │ 103 │ 97 │ 608 │ 11006 │ 378097 │ 7312093.923610216 │ 0.00001727900416486700 │ 0.000122616873233342 │ 0.00012962667099010452 │ 11101 │ 11101 │ 0 │ 0 │ 0 │ 0 │ 19 │\n",
+ "│ 2024-11-18 │ op │ mainnet │ 10 │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 10996 │ 10960 │ 1379 │ 48 │ 23 │ 24 │ 5052411568 │ 5031188403 │ 0.0057205865962422110 │ 0.0056176076708706290 │ 0.0028357061309091870 │ 0.0027957262675124070 │ 0.0028848804653330240 │ 0.0028218814033582220 │ 0.0025795299938098260 │ 0.0025711431104438020 │ 0.0000056444679973690 │ 0.0000056129856245520 │ 0.0002997150146508930 │ 0.0002451308301588750 │ 0.0005709907885582262 │ 0.0005105542094289311 │ 5.932117972121882e-05 │ 8.196171239543245 │ 1.7683514441472665 │ 171079 │ 86853 │ 84226 │ 95346.339467000000 │ 1156273.878298312500 │ 18241121 │ 1140081 │ 36625424 │ 35002403 │ 33996626 │ 32905182 │ 117861285.39334993 │ 117237656.5776309 │ 442175.5256003812 │ 2311.2514723131626 │ 28028.760396608333 │ 27637.25010558764 │ 0.00027396551375628900 │ 0.00027002799722618500 │ 0.00000003962761984600 │ 0.00024441422137034400 │ 0.00002951251985920000 │ 0.00021046070615958945 │ 0.00019855252410786464 │ 0.00014135158233869827 │ 0.00013183108474805707 │ 6.910912382089124e-05 │ 6.672143935980769e-05 │ 1.3145748689026884e-07 │ 0.00011163940987808378 │ 0.0003430746375771802 │ 0 │ 11193 │ 11126 │ 11081 │ 11043 │ 0 │ 0 │ 112 │ 83 │ 607 │ 10996 │ 4910454 │ 6164740.731893016 │ 0.00025775511051438900 │ 8.462144118505956e-05 │ 9.020902102423795e-05 │ 10998 │ 10998 │ 0 │ 0 │ 0 │ 0 │ 17 │\n",
+ "├────────────┴─────────┴─────────┴──────────┴────────────────────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴────────────────────────────┴────────────────────────────────┴──────────────────────────────┴────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴──────────────────────────┴─────────────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────┴─────────────────────────────┴───────────────────────────┴──────────────────────────────────────┴───────────────────────┴──────────────────────────────────┴───────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────┴───────────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴──────────────────────────────┴────────────────────┴───────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────────────────┴─────────────────────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────────────────────────────────────┴─────────────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴────────────────────────────────────────────────┴────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────┴──────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴─────────────────────────────┴──────────────────────────────┴─────────────────────────────────┴────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴───────────────────────────────────┤\n",
+ "│ 10 rows 84 columns │\n",
+ "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"SELECT * FROM daily_trace_calls_tr_to_v1 ORDER BY count_transactions_called DESC LIMIT 10\")"
+ "duckdb_client.sql(\"SELECT * FROM daily_traces_tr_to_v1 ORDER BY count_transactions_called DESC LIMIT 10\")"
]
},
{
@@ -130,15 +187,42 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
+ "│ trace_to_address │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
+ "│ varchar │ int64 │ int64 │ int64 │\n",
+ "├────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
+ "│ 0x4200000000000000000000000000000000000006 │ 8191 │ 8264 │ 8320 │\n",
+ "│ 0x0b2c639c533813f4aa9d7837caf62653d097ff85 │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 3975 │ 4012 │ 4068 │\n",
+ "│ 0x0000000000000000000000000000000000000001 │ 3676 │ 3927 │ 4639 │\n",
+ "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 3670 │ 14695 │ 14695 │\n",
+ "│ 0x4200000000000000000000000000000000000042 │ 3666 │ 3685 │ 3841 │\n",
+ "│ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 3068 │ 3471 │ 3471 │\n",
+ "│ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 3014 │ 3014 │ 3014 │\n",
+ "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 2464 │ 13054 │ 13054 │\n",
+ "├────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
+ "│ 10 rows 4 columns │\n",
+ "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"\"\"\n",
" SELECT trace_to_address,\n",
" count_transactions_called_with_internal_type_call, count_transactions_called_with_internal_type_call_or_delegate,\n",
" count_transactions_called\n",
- " FROM daily_trace_calls_tr_to_v1\n",
+ " FROM daily_traces_tr_to_v1\n",
" ORDER BY count_transactions_called_with_internal_type_call DESC\n",
" LIMIT 10\n",
" \"\"\")"
@@ -153,9 +237,36 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────┬───────────────────────────┐\n",
+ "│ trace_to_address │ sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call │ sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ count_transactions_called_with_internal_type_call │ count_transactions_called_with_internal_type_call_or_delegate │ count_transactions_called │\n",
+ "│ varchar │ decimal(38,0) │ double │ decimal(38,20) │ double │ int64 │ int64 │ int64 │\n",
+ "├────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────┼───────────────────────────┤\n",
+ "│ 0xeb585163debb1e637c6d617de3bef99347cd75c8 │ 4336291158 │ 1136484640.4479165 │ 0.00006075181680298400 │ 3.634152296570821e-05 │ 357 │ 357 │ 357 │\n",
+ "│ 0x9ec1c3dcf667f2035fb4cd2eb42a1566fd54d2b7 │ 1111392807 │ 1122500208.3492224 │ 0.00000443017412139800 │ 2.9313352050302083e-05 │ 326 │ 326 │ 326 │\n",
+ "│ 0x95885af5492195f0754be71ad1545fe81364e531 │ 402995706 │ 94954403.79477677 │ 0.00210702323974724500 │ 0.0007307753323052493 │ 2464 │ 13054 │ 13054 │\n",
+ "│ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 288049460 │ 204823127.44738504 │ 0.03819199276620082500 │ 0.015644821523381112 │ 3670 │ 14695 │ 14695 │\n",
+ "│ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 220618821 │ 68159718.9689097 │ 0.00107271191945114100 │ 0.00044816426595516563 │ 946 │ 1097 │ 1175 │\n",
+ "│ 0x4200000000000000000000000000000000000006 │ 159906187 │ 252647630.2439854 │ 0.01377174827006443900 │ 0.023645314873956918 │ 8191 │ 8264 │ 8320 │\n",
+ "│ 0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc │ 147222841 │ 180390539.10250407 │ 0.01486079382578650400 │ 0.016606836771005936 │ 6335 │ 6684 │ 6684 │\n",
+ "│ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 134640530 │ 4448836.836776925 │ 0.00007106463186232300 │ 5.136727029318756e-06 │ 517 │ 4132 │ 4132 │\n",
+ "│ 0x7f5c764cbc14f9669b88837ca1490cca17c31607 │ 119952045 │ 125551571.05382898 │ 0.00193008438541577500 │ 0.003281532397093052 │ 3975 │ 4012 │ 4068 │\n",
+ "│ 0x4200000000000000000000000000000000000042 │ 103674485 │ 123213864.98410517 │ 0.00809187465620548800 │ 0.008077490660703247 │ 3666 │ 3685 │ 3841 │\n",
+ "├────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────┴───────────────────────────┤\n",
+ "│ 10 rows 8 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"\"\"\n",
" SELECT\n",
@@ -172,7 +283,7 @@
" count_transactions_called_with_internal_type_call_or_delegate,\n",
" count_transactions_called\n",
" \n",
- " FROM daily_trace_calls_tr_to_v1\n",
+ " FROM daily_traces_tr_to_v1\n",
" ORDER BY sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call DESC\n",
" LIMIT 10\n",
" \"\"\")"
@@ -180,12 +291,39 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 9,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬────────────┬──────────────┬────────────────┬────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────────────┬──────────────────────┬───────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────────────────┬──────────────────────┬─────────────────────┬────────────────────────┬────────────────────────┬────────────────────────┬──────────────┬─────────────────────┬────────────┬─────────┬─────────────────┬───────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬────────────────────────┬─────────────────────────────┬─────────────────────────────┬────────────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┬───────────────────────────────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ trace_type │ call_type │ tx_l2_gas_used │ tx_l1_gas_used_unified │ tx_estimated_size │ tx_from_address │ tx_to_address │ tx_fee_native │ tx_l1_fee_native │ tx_l2_fee_native │ tx_l2_priority_fee_native │ tx_l2_base_fee_native │ tx_l2_legacy_extra_fee_native │ tx_l2_gas_price_gwei │ tx_l2_base_gas_price_gwei │ tx_l2_priority_gas_price_gwei │ tx_l2_legacy_extra_gas_price_gwei │ tx_l1_base_gas_price_gwei │ tx_l1_blob_base_gas_price_gwei │ tx_input_byte_length │ tx_input_zero_bytes │ tx_input_nonzero_bytes │ tx_l1_base_scaled_size │ tx_l1_blob_scaled_size │ tx_method_id │ block_hour │ tx_success │ error │ trace_method_id │ trace_success │ is_system_transaction │ trace_address_cardinality │ trace_address_uplevel │ trace_address_toplevel │ count_traces_in_transaction │ trace_gas_used_in_subtraces │ trace_gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_l2_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │ tx_fee_native_l1_amortized_l2_minus_subtraces │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ varchar │ int64 │ int64 │ int64 │ varchar │ varchar │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ int32 │ int64 │ int64 │ decimal(38,12) │ decimal(38,12) │ varchar │ timestamp │ boolean │ varchar │ varchar │ boolean │ boolean │ int64 │ varchar │ varchar │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n",
+ "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼────────────┼──────────────┼────────────────┼────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────────────┼──────────────────────┼───────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────────────────┼──────────────────────┼─────────────────────┼────────────────────────┼────────────────────────┼────────────────────────┼──────────────┼─────────────────────┼────────────┼─────────┼─────────────────┼───────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼────────────────────────┼─────────────────────────────┼─────────────────────────────┼────────────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────────────────────┤\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 278942 │ 171386 │ │ call │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb2460c48 │ true │ false │ 0 │ -1 │ │ 19 │ 135545 │ 35841 │ 0.00004981124250191700 │ 0.00000000008368873500 │ 0.00004981124250191700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.982892605858347e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 239515 │ 135545 │ 0 │ call │ call │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ false │ 1 │ │ 0 │ 19 │ 132840 │ 2705 │ 0.00000375936527908500 │ 0.00000000000631617500 │ 0.00000375936527908500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.777048835751474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 233149 │ 132840 │ 0,0 │ call │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x128acb08 │ true │ false │ 2 │ 0 │ 0 │ 19 │ 69223 │ 63617 │ 0.00008841387835842900 │ 0.00000000014854569500 │ 0.00008841387835842900 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.843156191509548e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 214029 │ 9460 │ 0,0,0 │ call │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x35458dcc │ true │ false │ 3 │ 0,0 │ 0 │ 19 │ 3542 │ 5918 │ 0.00000822474074736600 │ 0.00000000001381853000 │ 0.00000822474074736600 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 8.242424304032473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 200000 │ 3542 │ 0,0,0,0 │ call │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb88c9148 │ true │ false │ 4 │ 0,0,0 │ 0 │ 19 │ 547 │ 2995 │ 0.00000416240259181500 │ 0.00000000000699332500 │ 0.00000416240259181500 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 4.180086148481473e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x7361e9079920fb75496e9764a2665d8ee5049d5f │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 194140 │ 547 │ 0,0,0,0,0 │ call │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ false │ 5 │ 0,0,0,0 │ 0 │ 19 │ 381 │ 166 │ 0.00000023070411694200 │ 0.00000000000038761000 │ 0.00000023070411694200 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 2.483876736084737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 190979 │ 381 │ 0,0,0,0,0,0 │ call │ delegatecall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xd0c93a7c │ true │ false │ 6 │ 0,0,0,0,0 │ 0 │ 19 │ 0 │ 381 │ 0.00000052950764189700 │ 0.00000000000088963500 │ 0.00000052950764189700 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 5.471911985634737e-07 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 194073 │ 17270 │ 0,0,1 │ call │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x48cf7a43 │ true │ false │ 3 │ 0,0 │ 0 │ 19 │ 7940 │ 9330 │ 0.00001296668319921000 │ 0.00000000002178555000 │ 0.00001296668319921000 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 1.2984366755876474e-05 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 187913 │ 2674 │ 0,0,1,0 │ call │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0xb9a09fd5 │ true │ false │ 4 │ 0,0,1 │ 0 │ 19 │ 0 │ 2674 │ 0.00000371628198013800 │ 0.00000000000624379000 │ 0.00000371628198013800 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.733965536804474e-06 │\n",
+ "│ 2024-11-18 │ op │ 10 │ mainnet │ 128145924 │ 1731890625 │ 0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda │ 1 │ 0xcc0bddb707055e04e497ab22a59c2af4391cd12f │ 0x41c914ee0c7e1a5edcd0295623e6dc557b5abf3c │ 184844 │ 2682 │ 0,0,1,1 │ call │ staticcall │ 171386 │ 1600 │ 100 │ 0x46619117bfccce427350754988b8188f9d421eac │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0.0002385254802647450 │ 0.0000003359875766630 │ 0.0002381894926880820 │ 0.0002381894926880820 │ 0.0000000004001863100 │ 0.0000000000000000000 │ 1.3897838370 │ 0.0000023350 │ 1.3897838370 │ 0.0000000000 │ 11.2197484020 │ 2.3876106580 │ 36 │ 10 │ 26 │ 8.363200000000 │ 101.421300000000 │ 0xb2460c48 │ 2024-11-18 00:00:00 │ true │ │ 0x1703e5f9 │ true │ false │ 4 │ 0,0,1 │ 0 │ 19 │ 0 │ 2682 │ 0.00000372740025083400 │ 0.00000000000626247000 │ 0.00000372740025083400 │ 0.00000000000000000000 │ 9020.315789473685 │ 84.21052631578948 │ 0.4401684210526316 │ 5.337963157894737 │ 5.2631578947368425 │ 1.2553972645512895e-05 │ 1.253628908884642e-05 │ 1.7683556666473682e-08 │ 2.1062437368421053e-11 │ 1.253628908884642e-05 │ 3.745083807500474e-06 │\n",
+ "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴────────────┴──────────────┴────────────────┴────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────────────┴──────────────────────┴───────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────┴──────────────────────┴─────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┴──────────────┴─────────────────────┴────────────┴─────────┴─────────────────┴───────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴────────────────────────┴─────────────────────────────┴─────────────────────────────┴────────────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────────────────────┤\n",
+ "│ 10 rows 65 columns │\n",
+ "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"\"\"\n",
- " SELECT * FROM refined_traces_v1\n",
+ " SELECT * FROM refined_traces_fees_v1\n",
" where transaction_hash = '0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda'\n",
" AND block_number = 128145924\n",
" ORDER BY trace_address ASC\n",
@@ -202,29 +340,77 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────────┬─────────┬───────────────┐\n",
+ "│ interm_num_calls │ num_txs │ num_trace_tos │\n",
+ "│ int64 │ int64 │ int64 │\n",
+ "├──────────────────┼─────────┼───────────────┤\n",
+ "│ 1312049 │ 33168 │ 43982 │\n",
+ "└──────────────────┴─────────┴───────────────┘"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_traces_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_traces_fees_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────┬─────────┬───────────────┐\n",
+ "│ num_rows │ num_txs │ num_trace_tos │\n",
+ "│ int64 │ int64 │ int64 │\n",
+ "├──────────┼─────────┼───────────────┤\n",
+ "│ 529010 │ 33168 │ 43982 │\n",
+ "└──────────┴─────────┴───────────────┘"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM aggregated_traces_tr_to_hash_v1\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────┬───────────────┐\n",
+ "│ num_rows │ num_trace_tos │\n",
+ "│ int64 │ int64 │\n",
+ "├──────────┼───────────────┤\n",
+ "│ 43976 │ 43976 │\n",
+ "└──────────┴───────────────┘"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM daily_trace_calls_tr_to_v1\")"
+ "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM daily_traces_tr_to_v1\")"
]
},
{
@@ -236,11 +422,51 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 16,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌──────────────────────────────────────────────────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n",
+ "│ column_name │ column_type │ null │ key │ default │ extra │\n",
+ "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n",
+ "├──────────────────────────────────────────────────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n",
+ "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n",
+ "│ trace_to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_called │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_transactions_called_tx_success │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_blocks_called │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_tx_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_tx_to_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ · │ · │ · │ · │ · │ · │\n",
+ "│ sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call │ DECIMAL(38,20) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_traces_type_all_types │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_traces_trace_type_call │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_traces_trace_type_suicide │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_traces_trace_type_create │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_traces_trace_type_create2 │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_traces_trace_type_create_any │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n",
+ "│ count_unique_trace_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n",
+ "├──────────────────────────────────────────────────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n",
+ "│ 84 rows (20 shown) 6 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "duckdb_client.sql(\"DESCRIBE daily_trace_calls_tr_to_v1\")\n"
+ "duckdb_client.sql(\"DESCRIBE daily_traces_tr_to_v1\")\n"
]
}
],
From 0633750fcdced308dae922496d2c97b2a371f66a Mon Sep 17 00:00:00 2001
From: Pedro M Duarte
Date: Mon, 16 Dec 2024 16:15:30 -0500
Subject: [PATCH 28/32] Undo changes to example_daily_data.ipynb
---
notebooks/adhoc/example_daily_data.ipynb | 151 +++++++++++++++++++++--
1 file changed, 140 insertions(+), 11 deletions(-)
diff --git a/notebooks/adhoc/example_daily_data.ipynb b/notebooks/adhoc/example_daily_data.ipynb
index d221483fd78..8977112871a 100644
--- a/notebooks/adhoc/example_daily_data.ipynb
+++ b/notebooks/adhoc/example_daily_data.ipynb
@@ -9,9 +9,28 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mmodel\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mtransaction_fees\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mmodel\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mmodel\u001b[0m=\u001b[35mcontract_creation\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mcontract_creation_traces\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mLoaded 2 python modules with intermediate model definitions.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mregistry.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m62\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 18 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:41\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mFound vault variable GOOGLE_SERVICE_ACCOUNT (has JSON key)\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mgcpauth.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m18\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mLoaded OP chains metadata from /Users/pedro/github/ethereum-optimism/op-analytics-alt/op_chains_tracking/inputs/chain_metadata_raw.csv\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mload.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m85\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1m[REPO vs. GSHEETS] ERROR: Chain Metadata is different\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mload.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m97\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:37:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m187\u001b[0m\n"
+ ]
+ }
+ ],
"source": [
"from op_analytics.coreutils.duckdb_inmem import init_client\n",
"from op_analytics.coreutils.partitioned.reader import DataReader\n",
@@ -24,7 +43,7 @@
"# Define the input data range.\n",
"read_batches: list[DataReader] = construct_data_readers(\n",
" chains=[\"op\"],\n",
- " models=[\"refined_transactions_addresses_models\"],\n",
+ " models=[\"daily_address_summary\"],\n",
" range_spec=\"@20241030:+1\",\n",
" read_from=DataLocation.GCS\n",
")\n",
@@ -49,15 +68,48 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[2m2024-12-05 15:38:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m226\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:38:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 23/23 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-10-30/000127322000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m63\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:38:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 23 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:38:05\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 23/23 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-10-30/000127322000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m63\u001b[0m\n",
+ "\u001b[2m2024-12-05 15:38:06\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 23 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m\n",
+ "dict_keys(['summary_v1'])\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "┌───────────────────────────┐\n",
+ "│ name │\n",
+ "│ varchar │\n",
+ "├───────────────────────────┤\n",
+ "│ daily_address_summary │\n",
+ "│ ingestion_blocks_v1 │\n",
+ "│ ingestion_transactions_v1 │\n",
+ "│ summary_v1 │\n",
+ "│ transaction_fees │\n",
+ "└───────────────────────────┘"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n",
"\n",
+ "\n",
"execute_model_in_memory(\n",
" duckdb_client=duckdb_client,\n",
- " model=\"refined_transactions_addresses_models\",\n",
+ " model=\"daily_address_summary\",\n",
" data_reader=batch,\n",
")\n",
"\n",
@@ -79,9 +131,36 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "┌────────────┬─────────┬──────────┬────────────────────────────────────────────┬────────┬────────────────┬───────────┬───────────────────┬──────────────────┬──────────────────┬────────────────────┬───────────┬───────────┬────────────────────┬─────────────────────┬─────────────────────┬───────────────────┬───────────────────┬─────────────────┬─────────────────────────┬────────────────┬─────────────────┬─────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬────────────────────────┬───────────────────────┬───────────────────────┬─────────────────────────┬────────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────┬────────────────────────┬──────────────────────┐\n",
+ "│ dt │ chain │ chain_id │ address │ tx_cnt │ success_tx_cnt │ block_cnt │ success_block_cnt │ block_number_min │ block_number_max │ active_block_range │ nonce_min │ nonce_max │ active_nonce_range │ block_timestamp_min │ block_timestamp_max │ active_time_range │ active_hours_ucnt │ to_address_ucnt │ success_to_address_ucnt │ method_id_ucnt │ l2_gas_used_sum │ success_l2_gas_used_sum │ l1_gas_used_sum │ success_l1_gas_used_sum │ tx_fee_sum_eth │ success_tx_fee_sum_eth │ l2_fee_sum_eth │ l2_base_fee_sum_eth │ l2_priority_fee_sum_eth │ l2_base_legacy_fee_sum_eth │ l1_fee_sum_eth │ l1_base_fee_sum_eth │ l1_blob_fee_sum_eth │ l2_gas_price_avg_gwei │ l2_base_price_avg_gwei │ l2_priority_price_avg_gwei │ l1_base_price_avg_gwei │ l1_blob_fee_avg_gwei │\n",
+ "│ date │ varchar │ int32 │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ int64 │ uint32 │ uint32 │ uint32 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │ decimal(38,10) │\n",
+ "├────────────┼─────────┼──────────┼────────────────────────────────────────────┼────────┼────────────────┼───────────┼───────────────────┼──────────────────┼──────────────────┼────────────────────┼───────────┼───────────┼────────────────────┼─────────────────────┼─────────────────────┼───────────────────┼───────────────────┼─────────────────┼─────────────────────────┼────────────────┼─────────────────┼─────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼────────────────────────┼───────────────────────┼───────────────────────┼─────────────────────────┼────────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────┼────────────────────────┼──────────────────────┤\n",
+ "│ 2024-10-30 │ op │ 10 │ 0xaa971288ea224d94014d7cafd31faa5a6ba34fa9 │ 6099 │ 5980 │ 4637 │ 4584 │ 127323823 │ 127367011 │ 43189 │ 263880 │ 269978 │ 6099 │ 1730246423 │ 1730332799 │ 86376 │ 24 │ 3 │ 3 │ 5 │ 2011866171 │ 1991937468 │ 15349044 │ 15026564 │ 0.0295394861834670890 │ 0.0291519833502175670 │ 0.0271367522283079090 │ 0.0000009284876573830 │ 0.0271358237406505260 │ 0.0000000000000000000 │ 0.0024027339551591800 │ 0.0010233699604265900 │ 0.0013790109078847010 │ 0.0134883490 │ 0.0000004620 │ 0.0134878870 │ 12.7555395470 │ 1.4173502350 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x80c67432656d59144ceff962e8faf8926599bcf8 │ 17702 │ 17702 │ 17633 │ 17633 │ 127323813 │ 127367008 │ 43196 │ 1057544 │ 1075245 │ 17702 │ 1730246403 │ 1730332793 │ 86390 │ 24 │ 8349 │ 8349 │ 2 │ 372007232 │ 372007232 │ 28334322 │ 28334322 │ 0.0047049174966654290 │ 0.0047049174966654290 │ 0.0004465811645339340 │ 0.0000001724861339340 │ 0.0004464086784000000 │ 0.0000000000000000000 │ 0.0042583363321314950 │ 0.0018015727516364060 │ 0.0024567633068750720 │ 0.0012004640 │ 0.0000004640 │ 0.0012000000 │ 12.1642819940 │ 1.3678589040 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x7cda773fc37b31d0f5fb309b5e078a43fd71c4d8 │ 1 │ 1 │ 1 │ 1 │ 127344003 │ 127344003 │ 1 │ 211 │ 211 │ 1 │ 1730286783 │ 1730286783 │ 0 │ 1 │ 1 │ 1 │ 1 │ 211807 │ 211807 │ 1600 │ 1600 │ 0.0000003574901318760 │ 0.0000003574901318760 │ 0.0000000212499608890 │ 0.0000000000692608890 │ 0.0000000211807000000 │ 0.0000000000000000000 │ 0.0000003362401709870 │ 0.0000000940855941590 │ 0.0000002421545768280 │ 0.0001003270 │ 0.0000003270 │ 0.0001000000 │ 11.2499514730 │ 2.3876106580 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x9a9c86edafb44f065c1aa76f03e997f75ec3497a │ 158 │ 158 │ 158 │ 158 │ 127327802 │ 127365302 │ 37501 │ 48638 │ 48795 │ 158 │ 1730254381 │ 1730329381 │ 75000 │ 22 │ 1 │ 1 │ 3 │ 4588854 │ 4588854 │ 252800 │ 252800 │ 0.0000519553863943680 │ 0.0000519553863943680 │ 0.0000045909825292270 │ 0.0000000021285292270 │ 0.0000045888540000000 │ 0.0000000000000000000 │ 0.0000473644038651410 │ 0.0000190663862292320 │ 0.0000282980176359900 │ 0.0010004640 │ 0.0000004640 │ 0.0010000000 │ 14.4290858240 │ 1.7659148270 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x28a3b352f53804c6afb1c08093eaf25ddef9aa14 │ 10 │ 10 │ 10 │ 10 │ 127343963 │ 127344134 │ 172 │ 0 │ 9 │ 10 │ 1730286703 │ 1730287045 │ 342 │ 1 │ 3 │ 3 │ 3 │ 2127359 │ 2127359 │ 53260 │ 53260 │ 0.0000137701522657060 │ 0.0000137701522657060 │ 0.0000003201331506270 │ 0.0000000006925036370 │ 0.0000003194406469900 │ 0.0000000000000000000 │ 0.0000134500191150790 │ 0.0000029457010747910 │ 0.0000105028255853550 │ 0.0001504840 │ 0.0000003260 │ 0.0001501580 │ 10.5812021380 │ 3.1109698420 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x0f2e509e09e02f350a19a7c52c42deed18940f93 │ 3 │ 3 │ 3 │ 3 │ 127342750 │ 127344007 │ 1258 │ 124 │ 126 │ 3 │ 1730284277 │ 1730286791 │ 2514 │ 2 │ 2 │ 2 │ 2 │ 87132 │ 87132 │ 5516 │ 5516 │ 0.0000016285149832490 │ 0.0000016285149832490 │ 0.0000001045923101640 │ 0.0000000000339101640 │ 0.0000001045584000000 │ 0.0000000000000000000 │ 0.0000015239226730850 │ 0.0000002898918134670 │ 0.0000012338838385960 │ 0.0012003890 │ 0.0000003890 │ 0.0012000000 │ 10.0544702510 │ 3.5289119960 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x8f6966f2244f596d107031049d0e134fd4f2cf47 │ 4 │ 4 │ 4 │ 4 │ 127344008 │ 127344760 │ 753 │ 36 │ 39 │ 4 │ 1730286793 │ 1730288297 │ 1504 │ 1 │ 1 │ 1 │ 1 │ 84000 │ 84000 │ 6400 │ 6400 │ 0.0000012836405214330 │ 0.0000012836405214330 │ 0.0000001008278460000 │ 0.0000000000278460000 │ 0.0000001008000000000 │ 0.0000000000000000000 │ 0.0000011828126754330 │ 0.0000003118171294790 │ 0.0000008709955459560 │ 0.0012003320 │ 0.0000003320 │ 0.0012000000 │ 9.3211070370 │ 2.1469739240 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x5fafb81c4cb955a2268d96bddf12b2f228c534b5 │ 69 │ 55 │ 69 │ 55 │ 127323841 │ 127360205 │ 36365 │ 875 │ 943 │ 69 │ 1730246459 │ 1730319187 │ 72728 │ 15 │ 1 │ 1 │ 2 │ 13256726 │ 12926004 │ 120443 │ 98043 │ 0.0000310144657892840 │ 0.0000244561817408950 │ 0.0000018422436719890 │ 0.0000000061961519890 │ 0.0000018360475200000 │ 0.0000000000000000000 │ 0.0000291722221172950 │ 0.0000110937461564040 │ 0.0000180757038473500 │ 0.0001389670 │ 0.0000004670 │ 0.0001384990 │ 17.6215521610 │ 2.3675789090 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0x9b1c1f60243ea8573803f4ea8dd2b7f3c66c26f3 │ 1214 │ 1214 │ 1214 │ 1214 │ 127323819 │ 127367011 │ 43193 │ 9131 │ 10344 │ 1214 │ 1730246415 │ 1730332799 │ 86384 │ 24 │ 1 │ 1 │ 2 │ 64884944 │ 64884944 │ 2824647 │ 2824647 │ 0.0005114662231347030 │ 0.0005114662231347030 │ 0.0000649155637663880 │ 0.0000000306197663880 │ 0.0000648849440000000 │ 0.0000000000000000000 │ 0.0004465506593683150 │ 0.0001844771371566040 │ 0.0002619855991240930 │ 0.0010004720 │ 0.0000004720 │ 0.0010000000 │ 12.4947010340 │ 1.4632011980 │\n",
+ "│ 2024-10-30 │ op │ 10 │ 0xc9bb27e26370993755a9e4b21feeeb003f5a5e08 │ 3 │ 3 │ 3 │ 3 │ 127342916 │ 127344011 │ 1096 │ 37 │ 39 │ 3 │ 1730284609 │ 1730286799 │ 2190 │ 2 │ 2 │ 2 │ 1 │ 63000 │ 63000 │ 4800 │ 4800 │ 0.0000012846498797310 │ 0.0000012846498797310 │ 0.0000000756252630000 │ 0.0000000000252630000 │ 0.0000000756000000000 │ 0.0000000000000000000 │ 0.0000012090246167310 │ 0.0000002550951601520 │ 0.0000009539294565800 │ 0.0012004010 │ 0.0000004010 │ 0.0012000000 │ 10.1673665640 │ 3.1352041980 │\n",
+ "├────────────┴─────────┴──────────┴────────────────────────────────────────────┴────────┴────────────────┴───────────┴───────────────────┴──────────────────┴──────────────────┴────────────────────┴───────────┴───────────┴────────────────────┴─────────────────────┴─────────────────────┴───────────────────┴───────────────────┴─────────────────┴─────────────────────────┴────────────────┴─────────────────┴─────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴────────────────────────┴───────────────────────┴───────────────────────┴─────────────────────────┴────────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────┴────────────────────────┴──────────────────────┤\n",
+ "│ 10 rows 39 columns │\n",
+ "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"SELECT * FROM summary_v1 LIMIT 10\")"
]
@@ -95,9 +174,59 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (5, 39)dt | chain | chain_id | address | tx_cnt | success_tx_cnt | block_cnt | success_block_cnt | block_number_min | block_number_max | active_block_range | nonce_min | nonce_max | active_nonce_range | block_timestamp_min | block_timestamp_max | active_time_range | active_hours_ucnt | to_address_ucnt | success_to_address_ucnt | method_id_ucnt | l2_gas_used_sum | success_l2_gas_used_sum | l1_gas_used_sum | success_l1_gas_used_sum | tx_fee_sum_eth | success_tx_fee_sum_eth | l2_fee_sum_eth | l2_base_fee_sum_eth | l2_priority_fee_sum_eth | l2_base_legacy_fee_sum_eth | l1_fee_sum_eth | l1_base_fee_sum_eth | l1_blob_fee_sum_eth | l2_gas_price_avg_gwei | l2_base_price_avg_gwei | l2_priority_price_avg_gwei | l1_base_price_avg_gwei | l1_blob_fee_avg_gwei |
---|
date | str | i32 | str | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | i64 | u32 | u32 | u32 | i64 | i64 | i64 | i64 | decimal[38,0] | decimal[38,0] | decimal[38,0] | decimal[38,0] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,19] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] | decimal[38,10] |
2024-10-30 | "op" | 10 | "0xaa971288ea224d94014d7cafd31f… | 6099 | 5980 | 4637 | 4584 | 127323823 | 127367011 | 43189 | 263880 | 269978 | 6099 | 1730246423 | 1730332799 | 86376 | 24 | 3 | 3 | 5 | 2011866171 | 1991937468 | 15349044 | 15026564 | 0.0295394861834670890 | 0.0291519833502175670 | 0.0271367522283079090 | 0.0000009284876573830 | 0.0271358237406505260 | 0.0000000000000000000 | 0.0024027339551591800 | 0.0010233699604265900 | 0.0013790109078847010 | 0.0134883490 | 0.0000004620 | 0.0134878870 | 12.7555395470 | 1.4173502350 |
2024-10-30 | "op" | 10 | "0x80c67432656d59144ceff962e8fa… | 17702 | 17702 | 17633 | 17633 | 127323813 | 127367008 | 43196 | 1057544 | 1075245 | 17702 | 1730246403 | 1730332793 | 86390 | 24 | 8349 | 8349 | 2 | 372007232 | 372007232 | 28334322 | 28334322 | 0.0047049174966654290 | 0.0047049174966654290 | 0.0004465811645339340 | 0.0000001724861339340 | 0.0004464086784000000 | 0.0000000000000000000 | 0.0042583363321314950 | 0.0018015727516364060 | 0.0024567633068750720 | 0.0012004640 | 0.0000004640 | 0.0012000000 | 12.1642819940 | 1.3678589040 |
2024-10-30 | "op" | 10 | "0x7cda773fc37b31d0f5fb309b5e07… | 1 | 1 | 1 | 1 | 127344003 | 127344003 | 1 | 211 | 211 | 1 | 1730286783 | 1730286783 | 0 | 1 | 1 | 1 | 1 | 211807 | 211807 | 1600 | 1600 | 0.0000003574901318760 | 0.0000003574901318760 | 0.0000000212499608890 | 0.0000000000692608890 | 0.0000000211807000000 | 0.0000000000000000000 | 0.0000003362401709870 | 0.0000000940855941590 | 0.0000002421545768280 | 0.0001003270 | 0.0000003270 | 0.0001000000 | 11.2499514730 | 2.3876106580 |
2024-10-30 | "op" | 10 | "0x9a9c86edafb44f065c1aa76f03e9… | 158 | 158 | 158 | 158 | 127327802 | 127365302 | 37501 | 48638 | 48795 | 158 | 1730254381 | 1730329381 | 75000 | 22 | 1 | 1 | 3 | 4588854 | 4588854 | 252800 | 252800 | 0.0000519553863943680 | 0.0000519553863943680 | 0.0000045909825292270 | 0.0000000021285292270 | 0.0000045888540000000 | 0.0000000000000000000 | 0.0000473644038651410 | 0.0000190663862292320 | 0.0000282980176359900 | 0.0010004640 | 0.0000004640 | 0.0010000000 | 14.4290858240 | 1.7659148270 |
2024-10-30 | "op" | 10 | "0x28a3b352f53804c6afb1c08093ea… | 10 | 10 | 10 | 10 | 127343963 | 127344134 | 172 | 0 | 9 | 10 | 1730286703 | 1730287045 | 342 | 1 | 3 | 3 | 3 | 2127359 | 2127359 | 53260 | 53260 | 0.0000137701522657060 | 0.0000137701522657060 | 0.0000003201331506270 | 0.0000000006925036370 | 0.0000003194406469900 | 0.0000000000000000000 | 0.0000134500191150790 | 0.0000029457010747910 | 0.0000105028255853550 | 0.0001504840 | 0.0000003260 | 0.0001501580 | 10.5812021380 | 3.1109698420 |
"
+ ],
+ "text/plain": [
+ "shape: (5, 39)\n",
+ "┌────────────┬───────┬──────────┬────────────┬───┬────────────┬────────────┬───────────┬───────────┐\n",
+ "│ dt ┆ chain ┆ chain_id ┆ address ┆ … ┆ l2_base_pr ┆ l2_priorit ┆ l1_base_p ┆ l1_blob_f │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ ice_avg_gw ┆ y_price_av ┆ rice_avg_ ┆ ee_avg_gw │\n",
+ "│ date ┆ str ┆ i32 ┆ str ┆ ┆ ei ┆ g_gwei ┆ gwei ┆ ei │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ decimal[38 ┆ decimal[38 ┆ decimal[3 ┆ decimal[3 │\n",
+ "│ ┆ ┆ ┆ ┆ ┆ ,10] ┆ ,10] ┆ 8,10] ┆ 8,10] │\n",
+ "╞════════════╪═══════╪══════════╪════════════╪═══╪════════════╪════════════╪═══════════╪═══════════╡\n",
+ "│ 2024-10-30 ┆ op ┆ 10 ┆ 0xaa971288 ┆ … ┆ 0.00000046 ┆ 0.01348788 ┆ 12.755539 ┆ 1.4173502 │\n",
+ "│ ┆ ┆ ┆ ea224d9401 ┆ ┆ 20 ┆ 70 ┆ 5470 ┆ 350 │\n",
+ "│ ┆ ┆ ┆ 4d7cafd31f ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x80c67432 ┆ … ┆ 0.00000046 ┆ 0.00120000 ┆ 12.164281 ┆ 1.3678589 │\n",
+ "│ ┆ ┆ ┆ 656d59144c ┆ ┆ 40 ┆ 00 ┆ 9940 ┆ 040 │\n",
+ "│ ┆ ┆ ┆ eff962e8fa ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x7cda773f ┆ … ┆ 0.00000032 ┆ 0.00010000 ┆ 11.249951 ┆ 2.3876106 │\n",
+ "│ ┆ ┆ ┆ c37b31d0f5 ┆ ┆ 70 ┆ 00 ┆ 4730 ┆ 580 │\n",
+ "│ ┆ ┆ ┆ fb309b5e07 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x9a9c86ed ┆ … ┆ 0.00000046 ┆ 0.00100000 ┆ 14.429085 ┆ 1.7659148 │\n",
+ "│ ┆ ┆ ┆ afb44f065c ┆ ┆ 40 ┆ 00 ┆ 8240 ┆ 270 │\n",
+ "│ ┆ ┆ ┆ 1aa76f03e9 ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ 2024-10-30 ┆ op ┆ 10 ┆ 0x28a3b352 ┆ … ┆ 0.00000032 ┆ 0.00015015 ┆ 10.581202 ┆ 3.1109698 │\n",
+ "│ ┆ ┆ ┆ f53804c6af ┆ ┆ 60 ┆ 80 ┆ 1380 ┆ 420 │\n",
+ "│ ┆ ┆ ┆ b1c08093ea ┆ ┆ ┆ ┆ ┆ │\n",
+ "│ ┆ ┆ ┆ … ┆ ┆ ┆ ┆ ┆ │\n",
+ "└────────────┴───────┴──────────┴────────────┴───┴────────────┴────────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"duckdb_client.sql(\"SELECT * FROM summary_v1 LIMIT 10\").pl().head()"
]
@@ -126,7 +255,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.4"
+ "version": "3.12.6"
}
},
"nbformat": 4,
From e2e57aed08d91cb509678bac6db470687dae63b4 Mon Sep 17 00:00:00 2001
From: Pedro M Duarte
Date: Mon, 16 Dec 2024 16:17:57 -0500
Subject: [PATCH 29/32] Apply sqlfluff to refined_transactions_fees.sql.j2
---
.../refined_transactions_fees.sql.j2 | 160 +++++++++---------
1 file changed, 81 insertions(+), 79 deletions(-)
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index c6f6d11e7c1..f21abc4c79c 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -2,69 +2,71 @@ WITH
pb AS (
SELECT
- number,
- base_fee_per_gas
+ number
+ , base_fee_per_gas
FROM
ingestion_blocks_v1
-),
+)
-- Select the columns that we want from transactions joined to blocks.
-- Include some minor transformations that are needed for further calculations.
-pt1 AS (
+, pt1 AS (
SELECT
-- Transaction fields
- t.dt,
- t.chain,
- t.chain_id,
- t.network,
- t.nonce,
- t.transaction_index,
- t.from_address,
- t.to_address,
- t.block_number,
- t.block_timestamp,
- t.hash,
- t.gas_price,
- t.gas AS gas_limit,
- t.receipt_gas_used AS l2_gas_used,
- t.receipt_l1_gas_used,
+ t.dt
+ , t.chain
+ , t.chain_id
+ , t.network
+ , t.nonce
+ , t.transaction_index
+ , t.from_address
+ , t.to_address
+ , t.block_number
+ , t.block_timestamp
+ , t.hash
+ , t.gas_price
+ , t.gas AS gas_limit
+ , t.receipt_gas_used AS l2_gas_used
+ , t.receipt_l1_gas_used
-- Transaction input data - comment out for now to save on data space
-- t.input,
-- Fees
- t.receipt_l1_gas_price AS l1_gas_price,
- t.receipt_l1_blob_base_fee AS l1_blob_base_fee,
- b.base_fee_per_gas,
- t.max_priority_fee_per_gas,
- t.transaction_type,
+ , t.receipt_l1_gas_price AS l1_gas_price
+ , t.receipt_l1_blob_base_fee AS l1_blob_base_fee
+ , b.base_fee_per_gas
+ , t.max_priority_fee_per_gas
+ , t.transaction_type
-- blob reference, comment out for now, but bring in if/when we aplly this to L1, or see L2 blobs
-- t.blob_versioned_hashes
-- L2 Fees and breakdown into BASE and PRIORITY contributions
- t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar,
- CASE WHEN t.gas_price = 0 THEN 0
- ELSE t.receipt_l1_fee END AS l1_fee,
- if(t.max_priority_fee_per_gas = 0 AND t.gas_price > 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas,
+ , t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar
+ , CASE
+ WHEN t.gas_price = 0 THEN 0
+ ELSE t.receipt_l1_fee
+ END AS l1_fee
+ , if(t.max_priority_fee_per_gas = 0 AND t.gas_price > 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas
-- Convenience columns
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee,
- CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee,
+ , CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee
+ , CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee
+ , CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee
-- L1 Fee BASE and BLOB scalars
- micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar,
- micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar,
+ , micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar
+ , micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar
- hexstr_method_id(t.input) AS method_id,
- t.receipt_status = 1 AS success,
- hexstr_bytelen(t.input) AS input_byte_length,
- hexstr_zero_bytes(t.input) AS input_zero_bytes,
- hexstr_nonzero_bytes(t.input) AS input_nonzero_bytes,
- t.transaction_type = 126 OR t.gas_price = 0 AS is_system_transaction,
- ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ , hexstr_method_id(t.input) AS method_id
+ , t.receipt_status = 1 AS success
+ , hexstr_bytelen(t.input) AS input_byte_length
+ , hexstr_zero_bytes(t.input) AS input_zero_bytes
+ , hexstr_nonzero_bytes(t.input) AS input_nonzero_bytes
+ , t.transaction_type = 126 OR t.gas_price = 0 AS is_system_transaction
+ , ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
(t.transaction_type = 126 OR t.gas_price = 0)
AND t.from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
AND t.to_address = lower('0x4200000000000000000000000000000000000015')
- ) AS is_attributes_deposited_transaction,
-
- epoch_to_hour(t.block_timestamp) AS block_hour
+ ) AS is_attributes_deposited_transaction
+
+ , epoch_to_hour(t.block_timestamp) AS block_hour
FROM ingestion_transactions_v1 AS t
INNER JOIN pb AS b
@@ -72,52 +74,52 @@ pt1 AS (
WHERE 1 = 1
-- Optional address filter for faster results when developing.
-- AND from_address LIKE '0x00%'
-),
+)
-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
-- Ecotone+ specs on L1 Fee Calculations: https://specs.optimism.io/protocol/exec-engine.html#l1-cost-fees-l1-fee-vault
-- Fjord+ specs on Estimated Size: https://specs.optimism.io/protocol/fjord/predeploys.html#l1-gas-usage-estimation
-pt2 AS (
+, pt2 AS (
SELECT
- *,
+ *
-- Note that this is the "unified" L1 Gas Used, since the meaning of the field has changed in Fjord.
- coalesce(
- receipt_l1_gas_used,
- 16 * estimated_size
+ , coalesce(
+ receipt_l1_gas_used
+ , 16 * estimated_size
) AS l1_gas_used_unified
FROM (
SELECT
- *,
+ *
-- Estimated Size in bytes calculation, post-Fjord. This is not equivalent to L1 Gas Used
- (l1_fee / (
- (16 * l1_base_fee_scalar * l1_gas_price)
- + (l1_blob_base_fee_scalar * l1_blob_base_fee)
+ , (l1_fee / (
+ (16 * l1_base_fee_scalar * l1_gas_price)
+ + (l1_blob_base_fee_scalar * l1_blob_base_fee)
))::INT64
- AS estimated_size
- FROM pt1
+ AS estimated_size
+ FROM pt1
)
-),
+)
-- Add more fee calculations.
-- Reuses results from the previous CTEs.
-pt3 AS (
+, pt3 AS (
SELECT
- *,
+ *
--
-- Total fee
- l2_fee + l1_fee AS tx_fee,
+ , l2_fee + l1_fee AS tx_fee
--
-- L2 Legacy Fee
- if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee,
+ , if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee
--
-- L1 Base
- div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * l1_gas_price AS l1_base_fee,
- div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) AS l1_base_scaled_size,
+ , div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * l1_gas_price AS l1_base_fee
+ , div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) AS l1_base_scaled_size
--
-- L1 Blob
- coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * l1_blob_base_fee,0) AS l1_blob_fee,
- coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar,0) AS l1_blob_scaled_size
+ , coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * l1_blob_base_fee, 0) AS l1_blob_fee
+ , coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar, 0) AS l1_blob_scaled_size
FROM pt2
)
@@ -126,31 +128,31 @@ pt3 AS (
-- Generate gas fee breakdowns in native terms, for later aggregation
-- Generate gas prices in gwei terms
SELECT
- *,
+ *
-- Fees
- wei_to_eth(tx_fee) AS tx_fee_native,
+ , wei_to_eth(tx_fee) AS tx_fee_native
-- Native Breakdown
- wei_to_eth(l1_fee) AS l1_fee_native,
- wei_to_eth(l2_fee) AS l2_fee_native,
+ , wei_to_eth(l1_fee) AS l1_fee_native
+ , wei_to_eth(l2_fee) AS l2_fee_native
-- L1 Breakdown
- wei_to_eth(l1_base_fee) AS l1_base_fee_native,
- wei_to_eth(l1_blob_fee) AS l1_blob_fee_native,
+ , wei_to_eth(l1_base_fee) AS l1_base_fee_native
+ , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native
-- L2 Breakdown
- wei_to_eth(l2_base_fee) AS l2_base_fee_native,
- wei_to_eth(l2_priority_fee) AS l2_priority_fee_native,
- wei_to_eth(l2_legacy_extra_fee) AS l2_legacy_extra_fee_native,
+ , wei_to_eth(l2_base_fee) AS l2_base_fee_native
+ , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native
+ , wei_to_eth(l2_legacy_extra_fee) AS l2_legacy_extra_fee_native
-- Gas Prices
- wei_to_gwei(gas_price) AS l2_gas_price_gwei,
- wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei,
- wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei,
- wei_to_gwei(legacy_extra_fee_per_gas) AS l2_legacy_extra_gas_price_gwei,
+ , wei_to_gwei(gas_price) AS l2_gas_price_gwei
+ , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei
+ , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei
+ , wei_to_gwei(legacy_extra_fee_per_gas) AS l2_legacy_extra_gas_price_gwei
- wei_to_gwei(l1_gas_price) AS l1_base_gas_price_gwei,
- wei_to_gwei(l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
+ , wei_to_gwei(l1_gas_price) AS l1_base_gas_price_gwei
+ , wei_to_gwei(l1_blob_base_fee) AS l1_blob_base_gas_price_gwei
FROM pt3
From 70b34f5fd8b6f62b2c25c3aff37c04d12a7bcf69 Mon Sep 17 00:00:00 2001
From: Pedro M Duarte
Date: Mon, 16 Dec 2024 17:20:06 -0500
Subject: [PATCH 30/32] Make diff wih main smaller
---
.sqlfluff | 2 +-
.../templates/daily_address_summary.sql.j2 | 116 +++++++++---------
.../refined_transactions_fees.sql.j2 | 27 ++--
3 files changed, 73 insertions(+), 72 deletions(-)
diff --git a/.sqlfluff b/.sqlfluff
index 461d8f41110..b09c5be43fd 100644
--- a/.sqlfluff
+++ b/.sqlfluff
@@ -4,7 +4,7 @@ dialect = duckdb
sql_file_exts = .sql.j2
ignore = templating
runaway_limit = 10
-max_line_length = 120
+max_line_length = 140
# Comma separated list of rules to exclude, or None
# See https://docs.sqlfluff.com/en/stable/perma/rule_disabling.html
diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
index 535e6054621..fe471f3d1b7 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2
@@ -1,110 +1,110 @@
SELECT
- dt,
- chain,
- chain_id,
- network,
- from_address AS address,
+ dt
+ , chain
+ , chain_id
+ , network
+ , from_address AS address
-- Aggregates
- count(*) AS tx_cnt,
+ , count(*) AS tx_cnt
- count(if(success, 1, NULL)) AS success_tx_cnt,
+ , count(if(success, 1, NULL)) AS success_tx_cnt
- count(DISTINCT block_number) AS block_cnt,
+ , count(DISTINCT block_number) AS block_cnt
- count(DISTINCT if(success, block_number, NULL)) AS success_block_cnt,
+ , count(DISTINCT if(success, block_number, NULL)) AS success_block_cnt
- min(block_number) AS block_number_min,
+ , min(block_number) AS block_number_min
- max(block_number) AS block_number_max,
+ , max(block_number) AS block_number_max
- max(block_number) - min(block_number) + 1 AS active_block_range,
+ , max(block_number) - min(block_number) + 1 AS active_block_range
- min(nonce) AS nonce_min,
+ , min(nonce) AS nonce_min
- max(nonce) AS nonce_max,
+ , max(nonce) AS nonce_max
- max(nonce) - min(nonce) + 1 AS active_nonce_range,
+ , max(nonce) - min(nonce) + 1 AS active_nonce_range
- min(block_timestamp) AS block_timestamp_min,
+ , min(block_timestamp) AS block_timestamp_min
- max(block_timestamp) AS block_timestamp_max,
+ , max(block_timestamp) AS block_timestamp_max
- max(block_timestamp) - min(block_timestamp) AS active_time_range,
+ , max(block_timestamp) - min(block_timestamp) AS active_time_range
- count(DISTINCT block_hour) AS active_hours_ucnt,
+ , count(DISTINCT block_hour) AS active_hours_ucnt
- count(DISTINCT to_address) AS to_address_ucnt,
+ , count(DISTINCT to_address) AS to_address_ucnt
- count(DISTINCT if(success, to_address, NULL)) AS success_to_address_ucnt,
+ , count(DISTINCT if(success, to_address, NULL)) AS success_to_address_ucnt
- count(DISTINCT method_id) AS method_id_ucnt,
+ , count(DISTINCT method_id) AS method_id_ucnt
- sum(l2_gas_used) AS l2_gas_used_sum,
+ , sum(l2_gas_used) AS l2_gas_used_sum
- sum(if(success, l2_gas_used, 0)) AS success_l2_gas_used_sum,
+ , sum(if(success, l2_gas_used, 0)) AS success_l2_gas_used_sum
- sum(l1_gas_used_unified) AS l1_gas_used_unified_sum,
+ , sum(l1_gas_used_unified) AS l1_gas_used_unified_sum
- sum(if(success, l1_gas_used_unified, 0)) AS success_l1_gas_used_unified_sum,
+ , sum(if(success, l1_gas_used_unified, 0)) AS success_l1_gas_used_unified_sum
- wei_to_eth(sum(tx_fee)) AS tx_fee_sum_eth,
+ , wei_to_eth(sum(tx_fee)) AS tx_fee_sum_eth
- wei_to_eth(sum(if(success, tx_fee, 0))) AS success_tx_fee_sum_eth,
+ , wei_to_eth(sum(if(success, tx_fee, 0))) AS success_tx_fee_sum_eth
-- L2 Fee and breakdown into BASE + PRIORITY
- wei_to_eth(sum(l2_fee)) AS l2_fee_sum_eth,
+ , wei_to_eth(sum(l2_fee)) AS l2_fee_sum_eth
- wei_to_eth(sum(l2_base_fee)) AS l2_base_fee_sum_eth,
+ , wei_to_eth(sum(l2_base_fee)) AS l2_base_fee_sum_eth
- wei_to_eth(sum(l2_priority_fee)) AS l2_priority_fee_sum_eth,
+ , wei_to_eth(sum(l2_priority_fee)) AS l2_priority_fee_sum_eth
- wei_to_eth(sum(l2_legacy_extra_fee)) AS l2_base_legacy_fee_sum_eth,
+ , wei_to_eth(sum(l2_legacy_extra_fee)) AS l2_base_legacy_fee_sum_eth
-- L1 Fee and breakdown into BASE + BLOB
- wei_to_eth(sum(l1_fee)) AS l1_fee_sum_eth,
+ , wei_to_eth(sum(l1_fee)) AS l1_fee_sum_eth
- wei_to_eth(sum(l1_base_fee)) AS l1_base_fee_sum_eth,
+ , wei_to_eth(sum(l1_base_fee)) AS l1_base_fee_sum_eth
- wei_to_eth(sum(l1_blob_fee)) AS l1_blob_fee_sum_eth,
+ , wei_to_eth(sum(l1_blob_fee)) AS l1_blob_fee_sum_eth
-- L2 Price and breakdown into BASE + PRIORITY
- wei_to_gwei(safe_div(sum(l2_fee), sum(l2_gas_used)))
- AS l2_gas_price_avg_gwei,
+ , wei_to_gwei(safe_div(sum(l2_fee), sum(l2_gas_used)))
+ AS l2_gas_price_avg_gwei
- wei_to_gwei(safe_div(sum(l2_base_fee), sum(l2_gas_used)))
- AS l2_base_price_avg_gwei,
+ , wei_to_gwei(safe_div(sum(l2_base_fee), sum(l2_gas_used)))
+ AS l2_base_price_avg_gwei
- wei_to_gwei(safe_div(sum(l2_priority_fee), sum(l2_gas_used)))
- AS l2_priority_price_avg_gwei,
+ , wei_to_gwei(safe_div(sum(l2_priority_fee), sum(l2_gas_used)))
+ AS l2_priority_price_avg_gwei
-- L1 Price breakdown into BASE + BLOB
- wei_to_gwei(safe_div(sum(l1_base_fee), sum(l1_base_scaled_size))
- ) AS l1_base_price_avg_gwei,
+ , wei_to_gwei(safe_div(sum(l1_base_fee), sum(l1_base_scaled_size))
+ ) AS l1_base_price_avg_gwei
- wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
- AS l1_blob_fee_avg_gwei,
+ , wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size)))
+ AS l1_blob_fee_avg_gwei
-- Data Processed
- sum(input_zero_bytes) AS input_zero_bytes_sum,
- sum(if(success, input_zero_bytes, 0)) AS success_input_zero_bytes_sum,
+ , sum(input_zero_bytes) AS input_zero_bytes_sum
+ , sum(if(success, input_zero_bytes, 0)) AS success_input_zero_bytes_sum
- sum(input_nonzero_bytes) AS input_nonzero_bytes_sum,
- sum(if(success, input_nonzero_bytes, 0)) AS success_input_nonzero_bytes_sum,
+ , sum(input_nonzero_bytes) AS input_nonzero_bytes_sum
+ , sum(if(success, input_nonzero_bytes, 0)) AS success_input_nonzero_bytes_sum
- sum(input_byte_length) AS input_byte_length_sum,
- sum(if(success, input_byte_length, 0)) AS success_input_byte_length_sum,
+ , sum(input_byte_length) AS input_byte_length_sum
+ , sum(if(success, input_byte_length, 0)) AS success_input_byte_length_sum
- sum(estimated_size) AS estimated_size_sum,
- sum(if(success, estimated_size, 0)) AS success_estimated_size_sum
+ , sum(estimated_size) AS estimated_size_sum
+ , sum(if(success, estimated_size, 0)) AS success_estimated_size_sum
FROM
refined_transactions_fees
WHERE
NOT is_system_transaction
GROUP BY
- 1,
- 2,
- 3,
- 4,
- 5
+ 1
+ , 2
+ , 3
+ , 4
+ , 5
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index f21abc4c79c..14f44e55c97 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -24,28 +24,27 @@ pb AS (
, t.block_number
, t.block_timestamp
, t.hash
+ , t.transaction_type
, t.gas_price
, t.gas AS gas_limit
, t.receipt_gas_used AS l2_gas_used
, t.receipt_l1_gas_used
- -- Transaction input data - comment out for now to save on data space
- -- t.input,
- -- Fees
+ -- EXCLUDED
+ -- t.input, --comment out for now to save on data space
+ -- t.blob_versioned_hashes -- bring in if/when we apply this to L1, or see L2 blobs
+ --
+ -- L1 Fees
+ , CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee
, t.receipt_l1_gas_price AS l1_gas_price
, t.receipt_l1_blob_base_fee AS l1_blob_base_fee
, b.base_fee_per_gas
, t.max_priority_fee_per_gas
- , t.transaction_type
- -- blob reference, comment out for now, but bring in if/when we aplly this to L1, or see L2 blobs
- -- t.blob_versioned_hashes
+
+
-- L2 Fees and breakdown into BASE and PRIORITY contributions
, t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar
- , CASE
- WHEN t.gas_price = 0 THEN 0
- ELSE t.receipt_l1_fee
- END AS l1_fee
+
, if(t.max_priority_fee_per_gas = 0 AND t.gas_price > 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas
- -- Convenience columns
, CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee
, CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee
, CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee
@@ -53,14 +52,16 @@ pb AS (
, micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar
, micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar
-
+ -- Transaction Attributes
, hexstr_method_id(t.input) AS method_id
, t.receipt_status = 1 AS success
, hexstr_bytelen(t.input) AS input_byte_length
, hexstr_zero_bytes(t.input) AS input_zero_bytes
, hexstr_nonzero_bytes(t.input) AS input_nonzero_bytes
, t.transaction_type = 126 OR t.gas_price = 0 AS is_system_transaction
- , ( -- Attributes Deposited Spec https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ -- Attributes Deposited Spec:
+ -- https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction
+ , (
(t.transaction_type = 126 OR t.gas_price = 0)
AND t.from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')
AND t.to_address = lower('0x4200000000000000000000000000000000000015')
From a49845ecdc33e41325398cf038213ffffa5adbbc Mon Sep 17 00:00:00 2001
From: Pedro M Duarte
Date: Mon, 16 Dec 2024 21:17:51 -0500
Subject: [PATCH 31/32] Make diff wih main smaller
---
.../refined_transactions_fees.sql.j2 | 34 ++++++++-----------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
index 14f44e55c97..a8588199914 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2
@@ -29,10 +29,11 @@ pb AS (
, t.gas AS gas_limit
, t.receipt_gas_used AS l2_gas_used
, t.receipt_l1_gas_used
+
-- EXCLUDED
-- t.input, --comment out for now to save on data space
-- t.blob_versioned_hashes -- bring in if/when we apply this to L1, or see L2 blobs
- --
+
-- L1 Fees
, CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee
, t.receipt_l1_gas_price AS l1_gas_price
@@ -40,19 +41,18 @@ pb AS (
, b.base_fee_per_gas
, t.max_priority_fee_per_gas
-
- -- L2 Fees and breakdown into BASE and PRIORITY contributions
+ -- L1 Fee Scalars
, t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar
+ , micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar
+ , micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar
+ -- L2 Fees and breakdown into BASE and PRIORITY contributions
, if(t.max_priority_fee_per_gas = 0 AND t.gas_price > 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas
, CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee
, CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee
, CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee
- -- L1 Fee BASE and BLOB scalars
- , micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar
- , micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar
- -- Transaction Attributes
+ -- Transaction Information
, hexstr_method_id(t.input) AS method_id
, t.receipt_status = 1 AS success
, hexstr_bytelen(t.input) AS input_byte_length
@@ -73,8 +73,6 @@ pb AS (
INNER JOIN pb AS b
ON t.block_number = b.number
WHERE 1 = 1
--- Optional address filter for faster results when developing.
--- AND from_address LIKE '0x00%'
)
-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.
@@ -84,14 +82,12 @@ pb AS (
SELECT
*
-- Note that this is the "unified" L1 Gas Used, since the meaning of the field has changed in Fjord.
- , coalesce(
- receipt_l1_gas_used
- , 16 * estimated_size
- ) AS l1_gas_used_unified
+ , coalesce(receipt_l1_gas_used, 16 * estimated_size) AS l1_gas_used_unified
FROM (
SELECT
*
- -- Estimated Size in bytes calculation, post-Fjord. This is not equivalent to L1 Gas Used
+ -- Estimated Size in bytes calculation, post-Fjord.
+ -- This is not equivalent to L1 Gas Used.
, (l1_fee / (
(16 * l1_base_fee_scalar * l1_gas_price)
+ (l1_blob_base_fee_scalar * l1_blob_base_fee)
@@ -107,17 +103,17 @@ pb AS (
, pt3 AS (
SELECT
*
- --
+
-- Total fee
, l2_fee + l1_fee AS tx_fee
- --
+
-- L2 Legacy Fee
, if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee
- --
- -- L1 Base
+
+ -- L1 Base
, div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * l1_gas_price AS l1_base_fee
, div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) AS l1_base_scaled_size
- --
+
-- L1 Blob
, coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * l1_blob_base_fee, 0) AS l1_blob_fee
, coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar, 0) AS l1_blob_scaled_size
From 9226dde14fa33939535b497e373530a8975277c3 Mon Sep 17 00:00:00 2001
From: Pedro M Duarte
Date: Wed, 18 Dec 2024 15:21:48 -0500
Subject: [PATCH 32/32] Format sql
---
.../templates/daily_transactions_tx_to.sql.j2 | 14 +-
.../event_emitting_transactions.sql.j2 | 60 +++---
.../templates/logs_topic0_filters.sql.j2 | 26 +--
.../templates/refined_traces_fees.sql.j2 | 194 +++++++++---------
4 files changed, 149 insertions(+), 145 deletions(-)
diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2
index ec46c0275c1..eb92b3d4b55 100644
--- a/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2
@@ -5,11 +5,11 @@ Downstream, we can use contracts tables to filter for transactions to contracts
*/
SELECT
- dt,
- chain,
- chain_id,
- network,
- to_address
+ dt
+ , chain
+ , chain_id
+ , network
+ , to_address
-- Aggregations
, COUNT(*) AS count_transactions
@@ -61,5 +61,5 @@ FROM refined_transactions_fees
WHERE NOT is_system_transaction
GROUP BY
- dt, chain, chain_id, network,
- to_address
+ dt, chain, chain_id, network
+ , to_address
diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
index f783355e74a..6f0a463b997 100644
--- a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2
@@ -3,19 +3,19 @@
WITH event_emitting AS (
SELECT
- l.dt,
- epoch_to_hour(l.block_timestamp) AS block_hour,
- l.block_timestamp,
- l.network,
- l.chain,
- l.chain_id,
- l.block_number,
- l.transaction_hash,
+ l.dt
+ , epoch_to_hour(l.block_timestamp) AS block_hour
+ , l.block_timestamp
+ , l.network
+ , l.chain
+ , l.chain_id
+ , l.block_number
+ , l.transaction_hash
- count(*) AS count_total_events,
- sum(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events,
- sum(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events,
- sum(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
+ , count(*) AS count_total_events
+ , sum(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events
+ , sum(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events
+ , sum(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events
FROM ingestion_logs_v1 AS l
LEFT JOIN logs_topic0_filters AS f
@@ -25,34 +25,34 @@ WITH event_emitting AS (
)
SELECT
- ee.*,
+ ee.*
- t.transaction_index,
+ , t.transaction_index
- t.transaction_type,
+ , t.transaction_type
-- Join Transaction Fields
- t.tx_fee_native,
- t.l1_fee_native AS tx_l1_fee_native,
+ , t.tx_fee_native
+ , t.l1_fee_native AS tx_l1_fee_native
-- gas fees
- t.l2_fee_native AS tx_l2_fee_native,
+ , t.l2_fee_native AS tx_l2_fee_native
- t.l1_base_fee_native AS tx_l1_base_fee_native,
- t.l1_blob_fee_native AS tx_l1_blob_fee_native,
+ , t.l1_base_fee_native AS tx_l1_base_fee_native
+ , t.l1_blob_fee_native AS tx_l1_blob_fee_native
- t.l2_base_fee_native AS tx_l2_base_fee_native,
- t.l2_priority_fee_native AS tx_l2_priority_fee_native,
+ , t.l2_base_fee_native AS tx_l2_base_fee_native
+ , t.l2_priority_fee_native AS tx_l2_priority_fee_native
- t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native,
- t.input_byte_length AS tx_input_byte_length,
+ , t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native
+ , t.input_byte_length AS tx_input_byte_length
-- transaction attributes
- t.l1_gas_used_unified AS tx_l1_gas_used_unified,
- t.estimated_size AS tx_estimated_size,
- t.l2_gas_used AS tx_l2_gas_used,
- ee.count_total_events
+ , t.l1_gas_used_unified AS tx_l1_gas_used_unified
+ , t.estimated_size AS tx_estimated_size
+ , t.l2_gas_used AS tx_l2_gas_used
+ , ee.count_total_events
> ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events
- AS is_qualified_tx_not_approval_wrapping_transfer,
- ee.count_total_events
+ AS is_qualified_tx_not_approval_wrapping_transfer
+ , ee.count_total_events
> ee.count_approval_events + ee.count_wrapping_events
AS is_qualified_tx_not_approval_wrapping
diff --git a/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2 b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
index d79d1584cef..32beb4623c2 100644
--- a/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2
@@ -1,22 +1,22 @@
WITH topic0_filters AS ( -- list of events that we want to indicate for possible future filtering.
SELECT DISTINCT
- lower(topic) AS topic,
- description,
- category
+ lower(topic) AS topic
+ , description
+ , category
FROM (
VALUES
- ('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', 'ERC20 Approval', 'Approval'),
- ('0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', 'ERC721/ERC1155 Approval', 'Approval'),
+ ('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', 'ERC20 Approval', 'Approval')
+ , ('0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', 'ERC721/ERC1155 Approval', 'Approval')
- ('0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', 'WETH Wrap', 'Wrapping'),
- ('0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65', 'WETH Unwrap', 'Wrapping'),
+ , ('0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', 'WETH Wrap', 'Wrapping')
+ , ('0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65', 'WETH Unwrap', 'Wrapping')
- ('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'ERC20/ERC721 Transfer', 'Transfer'),
- ('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', 'ERC1155 Transfer Single', 'Transfer'),
- ('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer'),
- ('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer'),
- ('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer')
- )a (topic, description, category)
+ , ('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'ERC20/ERC721 Transfer', 'Transfer')
+ , ('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', 'ERC1155 Transfer Single', 'Transfer')
+ , ('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer')
+ , ('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer')
+ , ('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer')
+ )
)
SELECT * FROM topic0_filters
diff --git a/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2
index 1a390db6cea..2abe482823c 100644
--- a/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2
+++ b/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2
@@ -5,68 +5,68 @@ WITH
base_level_traces AS (
SELECT
-- Raw Trace fields
- r.dt,
- r.chain,
- r.chain_id,
- r.network,
- r.block_number,
- r.block_timestamp,
- r.transaction_hash,
- r.transaction_index,
- r.from_address AS trace_from_address,
- r.to_address AS trace_to_address,
- r.gas AS trace_gas_limit,
- r.gas_used AS trace_gas_used,
- r.trace_address,
- r.trace_type,
- r.call_type,
+ r.dt
+ , r.chain
+ , r.chain_id
+ , r.network
+ , r.block_number
+ , r.block_timestamp
+ , r.transaction_hash
+ , r.transaction_index
+ , r.from_address AS trace_from_address
+ , r.to_address AS trace_to_address
+ , r.gas AS trace_gas_limit
+ , r.gas_used AS trace_gas_used
+ , r.trace_address
+ , r.trace_type
+ , r.call_type
-- Trace i/o data - comment out for now to save on data space
-- r.input,
-- r.output,
-- Raw Transaction Fields
- t.l2_gas_used AS tx_l2_gas_used,
- t.l1_gas_used_unified AS tx_l1_gas_used_unified,
- t.estimated_size AS tx_estimated_size,
- t.from_address AS tx_from_address,
- t.to_address AS tx_to_address,
+ , t.l2_gas_used AS tx_l2_gas_used
+ , t.l1_gas_used_unified AS tx_l1_gas_used_unified
+ , t.estimated_size AS tx_estimated_size
+ , t.from_address AS tx_from_address
+ , t.to_address AS tx_to_address
-- Computed Transaction Fee Fields
- t.tx_fee_native,
- t.l1_fee_native AS tx_l1_fee_native,
- t.l2_fee_native AS tx_l2_fee_native,
- t.l2_priority_fee_native AS tx_l2_priority_fee_native,
- t.l2_base_fee_native AS tx_l2_base_fee_native,
- t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native,
+ , t.tx_fee_native
+ , t.l1_fee_native AS tx_l1_fee_native
+ , t.l2_fee_native AS tx_l2_fee_native
+ , t.l2_priority_fee_native AS tx_l2_priority_fee_native
+ , t.l2_base_fee_native AS tx_l2_base_fee_native
+ , t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native
-- Computed Transaction Gas Price Fields
- t.l2_gas_price_gwei AS tx_l2_gas_price_gwei,
- t.l2_base_gas_price_gwei AS tx_l2_base_gas_price_gwei,
- t.l2_priority_gas_price_gwei AS tx_l2_priority_gas_price_gwei,
- t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei,
- t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei,
- t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei,
+ , t.l2_gas_price_gwei AS tx_l2_gas_price_gwei
+ , t.l2_base_gas_price_gwei AS tx_l2_base_gas_price_gwei
+ , t.l2_priority_gas_price_gwei AS tx_l2_priority_gas_price_gwei
+ , t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei
+ , t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei
+ , t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei
-- Computed Transaction Size Fields
- t.input_byte_length AS tx_input_byte_length,
- t.input_zero_bytes AS tx_input_zero_bytes,
- t.input_nonzero_bytes AS tx_input_nonzero_bytes,
- t.l1_base_scaled_size AS tx_l1_base_scaled_size,
- t.l1_blob_scaled_size AS tx_l1_blob_scaled_size,
+ , t.input_byte_length AS tx_input_byte_length
+ , t.input_zero_bytes AS tx_input_zero_bytes
+ , t.input_nonzero_bytes AS tx_input_nonzero_bytes
+ , t.l1_base_scaled_size AS tx_l1_base_scaled_size
+ , t.l1_blob_scaled_size AS tx_l1_blob_scaled_size
- t.method_id AS tx_method_id,
- t.block_hour,
+ , t.method_id AS tx_method_id
+ , t.block_hour
-- Convenience columns
- t.success AS tx_success,
- r.error,
- hexstr_method_id(r.input) AS trace_method_id,
- r.status = 1 AS trace_success,
- t.is_system_transaction,
+ , t.success AS tx_success
+ , r.error
+ , hexstr_method_id(r.input) AS trace_method_id
+ , r.status = 1 AS trace_success
+ , t.is_system_transaction
--Get the next trace level up so that we can subtract subtrace gas
- CASE
+ , CASE
WHEN r.trace_address = '' THEN 0
ELSE length(r.trace_address) - length(replace(r.trace_address, ',', '')) + 1
- END AS trace_address_cardinality,
+ END AS trace_address_cardinality
- CASE
+ , CASE
WHEN r.trace_address = '' THEN '-1'
WHEN strpos(r.trace_address, ',') = 0 THEN '' -- No comma found
WHEN length(r.trace_address) - length(replace(r.trace_address, ',', '')) = 1
@@ -74,16 +74,16 @@ base_level_traces AS (
split_part(r.trace_address, ',', 1) -- Only one comma, return first part
ELSE
substr(
- r.trace_address,
- 1,
- length(r.trace_address)
+ r.trace_address
+ , 1
+ , length(r.trace_address)
- length(split_part(r.trace_address, ',', array_length(string_split(r.trace_address, ','))))
- 1
)
- END AS trace_address_uplevel,
+ END AS trace_address_uplevel
-- get the first trace level, for downstream cases where we want to split by each action
- CASE
+ , CASE
WHEN r.trace_address = '' THEN ''
ELSE split_part(r.trace_address, ',', 1)
END AS trace_address_toplevel
@@ -96,81 +96,85 @@ base_level_traces AS (
r.block_number = t.block_number
AND r.transaction_hash = t.hash
-),
+)
--get amount of calls per transcation, to use for amortizing
-get_traces_per_tansaction AS (
+, get_traces_per_tansaction AS (
SELECT
- dt, chain_id,
- block_number,
- block_timestamp,
- transaction_hash,
- count(*) AS count_traces_in_transaction
+ dt
+ , chain_id
+ , block_number
+ , block_timestamp
+ , transaction_hash
+ , count(*) AS count_traces_in_transaction
FROM base_level_traces
GROUP BY 1, 2, 3, 4, 5
-),
+)
--get subtrace gas used, for isolating each call
-get_subtraces_gas_per_trace AS (
+, get_subtraces_gas_per_trace AS (
SELECT
- dt, chain_id,
- block_number,
- block_timestamp,
- transaction_hash,
- trace_address_uplevel,
- trace_address_cardinality,
- sum(trace_gas_used) AS trace_gas_used_in_subtraces,
- count(*) AS count_subtraces_in_trace
+ dt
+ , chain_id
+ , block_number
+ , block_timestamp
+ , transaction_hash
+ , trace_address_uplevel
+ , trace_address_cardinality
+ , sum(trace_gas_used) AS trace_gas_used_in_subtraces
+ , count(*) AS count_subtraces_in_trace
FROM base_level_traces
GROUP BY 1, 2, 3, 4, 5, 6, 7
)
SELECT
- bl.*,
+ bl.*
--
- tpt.count_traces_in_transaction,
- coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_in_subtraces,
+ , tpt.count_traces_in_transaction
+ , coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_in_subtraces
--
- bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_minus_subtraces,
+ , bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_minus_subtraces
-- the subtraces will never add up to part of whole, but leave as is
- (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_l2_fee_native_minus_subtraces,
- (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_base_gas_price_gwei) AS tx_l2_base_fee_native_minus_subtraces,
- (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei) AS tx_l2_priority_fee_native_minus_subtraces,
- (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
- * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei) AS tx_l2_legacy_base_fee_native_minus_subtraces,
+ , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_l2_fee_native_minus_subtraces
+ , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_base_gas_price_gwei) AS tx_l2_base_fee_native_minus_subtraces
+ , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei) AS tx_l2_priority_fee_native_minus_subtraces
+ , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
+ * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei) AS tx_l2_legacy_base_fee_native_minus_subtraces
-- Amortize evenly across all calls
- bl.tx_l2_gas_used / tpt.count_traces_in_transaction AS tx_l2_gas_used_amortized_by_call,
- bl.tx_l1_gas_used_unified / tpt.count_traces_in_transaction AS tx_l1_gas_used_unified_amortized_by_call,
- bl.tx_l1_base_scaled_size / tpt.count_traces_in_transaction AS tx_l1_base_scaled_size_amortized_by_call,
- bl.tx_l1_blob_scaled_size / tpt.count_traces_in_transaction AS tx_l1_blob_scaled_size_amortized_by_call,
- bl.tx_estimated_size / tpt.count_traces_in_transaction AS tx_estimated_size_amortized_by_call,
-
- bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_amortized_by_call,
- bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_amortized_by_call,
- bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_amortized_by_call,
- bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_amortized_by_call,
- bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_amortized_by_call,
+ , bl.tx_l2_gas_used / tpt.count_traces_in_transaction AS tx_l2_gas_used_amortized_by_call
+ , bl.tx_l1_gas_used_unified / tpt.count_traces_in_transaction AS tx_l1_gas_used_unified_amortized_by_call
+ , bl.tx_l1_base_scaled_size / tpt.count_traces_in_transaction AS tx_l1_base_scaled_size_amortized_by_call
+ , bl.tx_l1_blob_scaled_size / tpt.count_traces_in_transaction AS tx_l1_blob_scaled_size_amortized_by_call
+ , bl.tx_estimated_size / tpt.count_traces_in_transaction AS tx_estimated_size_amortized_by_call
+
+ , bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_amortized_by_call
+ , bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_amortized_by_call
+ , bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_amortized_by_call
+ , bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_amortized_by_call
+ , bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_amortized_by_call
--
- (bl.tx_l1_fee_native / tpt.count_traces_in_transaction)
+ , (bl.tx_l1_fee_native / tpt.count_traces_in_transaction)
+ (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))
* gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_fee_native_l1_amortized_l2_minus_subtraces
FROM base_level_traces AS bl
INNER JOIN get_traces_per_tansaction AS tpt -- join on txn level
- ON bl.dt = tpt.dt
+ ON
+ bl.dt = tpt.dt
AND bl.chain_id = tpt.chain_id
AND bl.block_number = tpt.block_number
AND bl.transaction_hash = tpt.transaction_hash
LEFT JOIN get_subtraces_gas_per_trace AS st -- join on trace level 1 level down
- ON bl.dt = st.dt
+ ON
+ bl.dt = st.dt
AND bl.chain_id = st.chain_id
AND bl.block_number = st.block_number
AND bl.transaction_hash = st.transaction_hash