Skip to content

Commit

Permalink
starkware added to verification_fees table
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenz234 committed Jan 4, 2024
1 parent 3c16b00 commit 69b52a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
11 changes: 5 additions & 6 deletions models/rollup_economics/ethereum/l1_data_fees.sql
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ with tx_batch_appends as (
{% endif %}

UNION ALL SELECT
'imx' AS chain, -- imx posts state updates to L1 which are attested to by data providers through the Data Availability Committee, meaning offchain DA
'imx' AS chain, -- imx state updates to L1 through the Data Availability Committee, imx uses offchain DA
t.block_number,
t.hash,
(cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent,
Expand All @@ -172,9 +172,8 @@ with tx_batch_appends as (
AND p.blockchain is null
AND p.symbol = 'ETH'
AND (
t."from" = 0x9B7f7d0d23d4CAce5A3157752D0D4e4bf25E927e -- Operator, StateUpdate poster
AND t.to = 0x5FDCCA53617f4d2b9134B29090C87D01058e27e9 -- StateUpdate proxy contract
AND cast(t.data as varchar) LIKE '0x538f9406%'
(t.to = 0x5FDCCA53617f4d2b9134B29090C87D01058e27e9 OR t.to = 0x16BA0f221664A5189cf2C1a7AF0d3AbFc70aA295)
AND (cast(t.data as varchar) LIKE '0x538f9406%' OR cast(t.data as varchar) LIKE '0x504f7f6f%') -- StateUpdate & Verify Availability Proof
)
AND t.block_time >= timestamp '2021-03-24' -- mainnet launch date
{% if is_incremental() %}
Expand Down Expand Up @@ -280,7 +279,7 @@ with tx_batch_appends as (
AND p.blockchain is null
AND p.symbol = 'ETH'
AND t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F
AND cast(t.data as varchar) LIKE '0x4165d6dd%' -- Finalize Blocks (unfortunately here the ZK proofs are also included which should rather go into table l1_verification_fees)
AND cast(t.data as varchar) LIKE '0x4165d6dd%' -- Finalize Blocks (proof verified immediately)
AND t.block_time >= timestamp '2023-07-12'
{% if is_incremental() %}
AND t.block_time >= date_trunc('day', now() - interval '7' day)
Expand Down Expand Up @@ -322,7 +321,7 @@ with tx_batch_appends as (
AND p.blockchain is null
AND p.symbol = 'ETH'
AND t.to = 0x153CdDD727e407Cb951f728F24bEB9A5FaaA8512
AND cast(t.data as varchar) LIKE '0xdcb2aa31%' -- submitBlocksWithCallbacks (proof is included)
AND cast(t.data as varchar) LIKE '0xdcb2aa31%' -- submitBlocksWithCallbacks (proof verified immediately)
AND t.block_time >= timestamp '2021-03-23'
{% if is_incremental() %}
AND t.block_time >= date_trunc('day', now() - interval '7' day)
Expand Down
18 changes: 9 additions & 9 deletions models/rollup_economics/ethereum/l1_verification_fees.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ with verify_txns as (
t.hash,
(cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent,
p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd,
1408 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
t.gas_used,
{{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used
FROM {{ source('ethereum','transactions') }} AS t
Expand Down Expand Up @@ -51,35 +51,35 @@ with verify_txns as (
t.hash,
(cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent,
p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd,
768 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
24*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
t.gas_used,
{{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used
FROM {{ source('ethereum','transactions') }} AS t
INNER JOIN {{ source('prices','usd') }} p
ON p.minute = date_trunc('minute', t.block_time)
AND t.to = 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2
AND cast(t.data as varchar) LIKE '0xa50a164b%' -- proveBatches
AND t.block_time >= timestamp '2023-03-01'
AND cast(t.data as varchar) LIKE '0x2b0006fa%' -- verifyBatchesTrustedAggregator
AND t.block_time >= timestamp '2023-03-23'
AND p.blockchain is null
AND p.symbol = 'ETH'
{% if is_incremental() %}
AND t.block_time >= date_trunc('day', now() - interval '7' day)
{% endif %}

UNION ALL SELECT
'imx' AS name, -- not included here is the SHARP Verifier [0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60] as all Starkware chains share it together
'starkware' AS name, -- SHARPVerify used collectively by: Starknet, Sorare, ImmutableX, Apex, Myria, rhino.fi and Canvas Connect
t.block_number,
t.hash,
(cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent,
p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd,
652 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
456*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, -- proof size might get longer with more chains
t.gas_used,
{{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used
FROM {{ source('ethereum','transactions') }} AS t
INNER JOIN {{ source('prices','usd') }} p
ON p.minute = date_trunc('minute', t.block_time)
AND t.to = 0x16BA0f221664A5189cf2C1a7AF0d3AbFc70aA295
AND cast(t.data as varchar) LIKE '0x504f7f6f%' -- Verify Availability Proof, imx committee
AND t.to = 0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60
AND cast(t.data as varchar) LIKE '0x9b3b76cc%' -- Verify Availability Proof, imx committee
AND t.block_time >= timestamp '2021-03-24'
AND p.blockchain is null
AND p.symbol = 'ETH'
Expand All @@ -93,7 +93,7 @@ with verify_txns as (
t.hash,
(cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent,
p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd,
3440 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
110*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb,
t.gas_used,
{{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used
FROM {{ source('ethereum','transactions') }} AS t
Expand Down

0 comments on commit 69b52a2

Please sign in to comment.