Skip to content

Commit

Permalink
perf: optimize get_unsealed_l1_batch_inner (#3491)
Browse files Browse the repository at this point in the history
## 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`.
  • Loading branch information
perekopskiy authored Jan 17, 2025
1 parent 7463636 commit 9b121c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions core/lib/dal/src/blocks_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,21 @@ impl BlocksDal<'_, '_> {
l1_gas_price,
l2_fair_gas_price,
fair_pubdata_price
FROM
l1_batches
WHERE
NOT is_sealed
FROM (
SELECT
number,
timestamp,
protocol_version,
fee_address,
l1_gas_price,
l2_fair_gas_price,
fair_pubdata_price,
is_sealed
FROM l1_batches
ORDER BY number DESC
LIMIT 1
) AS u
WHERE NOT is_sealed
"#,
)
.instrument("get_unsealed_l1_batch")
Expand Down

0 comments on commit 9b121c9

Please sign in to comment.