Skip to content
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

fix: halven the pagination instead of linear #49

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions chain-events/src/l2_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ enum BridgeInitEvents {
}

const PAGINATION_STEP: u64 = 10_000;
const PAGINATION_DECREASE_STEP: u64 = 200;
const PAGINATION_INCREASE_STEP: u64 = 256;
// usually queries break at 10k return results
// if restarted on that limit make sure it is passed.
Expand Down Expand Up @@ -251,8 +250,8 @@ impl L2EventsListener {
match reason {
RunResult::PaginationTooLarge => {
let pagination_old = pagination;
if pagination > PAGINATION_DECREASE_STEP {
pagination -= PAGINATION_DECREASE_STEP;
if pagination > 2 {
pagination /= 2;
vlog::debug!(
"Decreasing pagination from {pagination_old} to {pagination}",
);
Expand Down Expand Up @@ -472,8 +471,7 @@ impl L2EventsListener {
}

fn should_attempt_pagination_increase(pagination_step: u64, successful_logs: i32) -> bool {
pagination_step < PAGINATION_STEP - PAGINATION_DECREASE_STEP
&& successful_logs > SUCCESSFUL_LOGS_TO_UPSCALE
pagination_step < PAGINATION_STEP && successful_logs > SUCCESSFUL_LOGS_TO_UPSCALE
}

fn look_for_bridge_initialize_event(tx: ZksyncTransactionReceipt) -> Option<ZksyncLog> {
Expand Down
Loading