Skip to content

Commit 9b121c9

Browse files
authored
perf: optimize get_unsealed_l1_batch_inner (#3491)
## What ❔ optimize get_unsealed_l1_batch_inner ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`.
1 parent 7463636 commit 9b121c9

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

core/lib/dal/.sqlx/query-8435ed4ee2a9b962116ecfa522f4ba52c9a0e64d1badc39cc2fef29b1468621a.json renamed to core/lib/dal/.sqlx/query-970c457cc4513615d9bb6ecd6f1a69128b9f77d7ce3b898e44c497dc56a40149.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/lib/dal/src/blocks_dal.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,21 @@ impl BlocksDal<'_, '_> {
835835
l1_gas_price,
836836
l2_fair_gas_price,
837837
fair_pubdata_price
838-
FROM
839-
l1_batches
840-
WHERE
841-
NOT is_sealed
838+
FROM (
839+
SELECT
840+
number,
841+
timestamp,
842+
protocol_version,
843+
fee_address,
844+
l1_gas_price,
845+
l2_fair_gas_price,
846+
fair_pubdata_price,
847+
is_sealed
848+
FROM l1_batches
849+
ORDER BY number DESC
850+
LIMIT 1
851+
) AS u
852+
WHERE NOT is_sealed
842853
"#,
843854
)
844855
.instrument("get_unsealed_l1_batch")

0 commit comments

Comments
 (0)