ethereum-models/macros/tests/state_hash_gaps.sql
Matt Romano 49fbdcbf3d
AN-4239/add-state-hash-test (#776)
* create state_hash test and add to OP + Base

* allow for dupes
2023-12-06 11:17:11 -08:00

34 lines
633 B
SQL

{% test state_hash_gaps(
model
) %}
WITH batch_check AS (
SELECT
state_batch_index,
state_max_block,
LAG(
state_max_block,
1
) over (
ORDER BY
state_batch_index
) AS previous_state_max_block,
state_max_block - LAG(
state_max_block,
1
) over (
ORDER BY
state_batch_index
) AS difference
FROM
{{ model }}
)
SELECT
*
FROM
batch_check
WHERE
difference <> 1800
AND
difference <> 0 --allows for dupes batches
{% endtest %}