mirror of
https://github.com/FlipsideCrypto/ethereum-models.git
synced 2026-02-06 13:06:51 +00:00
35 lines
549 B
SQL
35 lines
549 B
SQL
{% test blobs_behind(
|
|
model,
|
|
threshold
|
|
) %}
|
|
WITH slots AS (
|
|
SELECT
|
|
MAX(slot_number) AS max_slot
|
|
FROM
|
|
{{ ref('silver__beacon_blocks') }}
|
|
),
|
|
blobs AS (
|
|
SELECT
|
|
MAX(slot_number) AS max_blob_slot
|
|
FROM
|
|
{{ model }}
|
|
),
|
|
difference AS (
|
|
SELECT
|
|
max_slot,
|
|
max_blob_slot,
|
|
max_slot - max_blob_slot AS slots_behind
|
|
FROM
|
|
slots
|
|
JOIN blobs
|
|
ON 1 = 1
|
|
)
|
|
SELECT
|
|
slots_behind
|
|
FROM
|
|
difference
|
|
WHERE
|
|
slots_behind > {{ threshold }}
|
|
|
|
{% endtest %}
|