-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor rollup_economics
spell
#6426
Refactor rollup_economics
spell
#6426
Conversation
Workflow run id 10084493257 approved. |
Workflow run id 10084493381 approved. |
Workflow run id 10085945308 approved. |
Workflow run id 10085945661 approved. |
Workflow run id 10086039523 approved. |
Workflow run id 10086039673 approved. |
Workflow run id 10086158665 approved. |
Workflow run id 10086158790 approved. |
Workflow run id 10086243299 approved. |
Workflow run id 10086243545 approved. |
Workflow run id 10086394455 approved. |
Workflow run id 10086395005 approved. |
dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/_schema.yml
Show resolved
Hide resolved
Workflow run id 10151783462 approved. |
Workflow run id 10151783278 approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks very good! ✔️
Can we try to have these as views:
rollup_economics_l1_data_fees.sql
rollup_economics_l1_verification_fees.sql
I don't expect these to be queried directly, and the aggregated data is present in l1_fees
. Trying to reduce the amount we're storing the same data multiple times across models.
RE: blockchain naming. l1_blob_fees pulls from an upstream source with human readable chain names which differ from the standard Dune naming (i.e. should be "zksync", not "zkSync Era"). I have not made the change yet but I would prefer to move to the standard Dune naming model for each of these chains, and potentially change the name column to be blockchain. Let's discuss this further.
I agree on this but would make the changes in a follow up PR to keep the refactor clean.
In the existing model, these are both set as incremental runs. I'm fine changing to views but just want to make sure you're good changing this behavior. RE: naming — sounds good will leave for a later PR |
@lgingerich to prevent having this issue of double source definitions we've come to the following standard: |
Workflow run id 10268546895 approved. |
Workflow run id 10268546538 approved. |
there seems to be some inconsistencies with usage of changing schema names can cause some impact downstream, so likely fine to leave as-is, but wanted to call this out |
@jeff-dude good callout, fixed now |
Workflow run id 10459743612 approved. |
Workflow run id 10459743847 approved. |
Workflow run id 10459821152 approved. |
Workflow run id 10459821145 approved. |
Workflow run id 10459845066 approved. |
Workflow run id 10459845300 approved. |
Background
The
rollup_economics
spell has become quite computationally heavy such that the CI cluster often runs out of memory and crashes. This PR is to attempt a refactor similar to other spellbook designs and get it to a more future-proof design.The main PR discussing optimizations of this spell is #6169, and lesser so #6247.
Changes
The
rollup_economics
spell includes four types of fee categorizations:l2_revenue
,l1_blob_fees
,l1_data_fees
, andl1_verification_fees
.l2_revenue
andl1_blob_fees
: These pull data from already aggregated upstream sources so can be easily handled in a single file. I have another open PR to refactorl2_revenue
(#6408) and I've mirrored that logic here. That PR is ready to merge and I'll reconcile here once it is.l1_data_fees
andl1_verification_fees
: These are the main ones causing heavy load and is what I focused the refactoring on. I tried to mirror the structure ofdex.trades
. For each of these, I've created a single sql file for each chain, then in a downstream model, aggregate all chains together and enrich with USD pricing. This fixes the repeated joins onprices.usd
. It doesn't reduce any queries ofethereum.transactions
but does at least split into multiple files. A table is materialized for each chain-level implementation (e.g.rollup_economics_zksync_l1_data_fees
,rollup_economics_linea_l1_data_fees
, etc.).Notes:
l1_blob_fees
doesn't necessarily need to be in its own folder since it's just a single sql file, but since it's at the same hierarchy in the data lineage asl1_data_fees
andl1_verification_fees
, I thought it made sense to mirror those setups.l1_blob_fees
pulls from an upstream source with human readable chain names which differ from the standard Dune naming (i.e. should be "zksync", not "zkSync Era"). I have not made the change yet but I would prefer to move to the standard Dune naming model for each of these chains, and potentially change thename
column to beblockchain
. Let's discuss this further.@jeff-dude @0xRobin @Hosuke @Jam516 I would appreciate comments/critiques from all of you