Skip to content

Conversation

@guy-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@guy-starkware guy-starkware marked this pull request as ready for review January 6, 2026 13:49
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Collaborator

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama reviewed 1 file and all commit messages, and made 4 comments.
Reviewable status: 1 of 2 files reviewed, 4 unresolved discussions (waiting on @guy-starkware).


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 66 at r1 (raw file):

    }

    pub async fn get_first_block_then_run(&mut self) -> L1GasPriceScraperResult<(), B> {

No need to put run logic in this function. It complicates the name of the function, which in turn reduces the readability at the callsite


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 74 at r1 (raw file):

                    let Ok(latest) = latest else {
                        warn!("Failed to get the latest L1 block number at startup: {latest:?}");
                        tokio::time::sleep(self.config.polling_interval).await;

Shouldn't we increase relevant failure metrics?


crates/apollo_l1_gas_price/src/l1_gas_price_scraper_test.rs line 329 at r1 (raw file):

#[tokio::test]
async fn get_first_block_then_run_fails_then_succeeds() {

The test says "fails then succeeds" but I only see the fails section


crates/apollo_l1_gas_price/src/l1_gas_price_scraper_test.rs line 338 at r1 (raw file):

    // The provider will return an error, indicating the scraper has successfully started running.
    // The error will take us out of the endless loop of scraper.run().

I don't understand why do we need the provider to return an error for this test

@guy-starkware guy-starkware force-pushed the guyn/L1price/startup_loop branch from fa0c17a to 35192be Compare January 8, 2026 11:41
Copy link
Contributor Author

@guy-starkware guy-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guy-starkware made 4 comments.
Reviewable status: 0 of 2 files reviewed, 4 unresolved discussions (waiting on @ShahakShama).


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 66 at r1 (raw file):

Previously, ShahakShama wrote…

No need to put run logic in this function. It complicates the name of the function, which in turn reduces the readability at the callsite

It also makes testing much more complicated. I'm changing it.


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 74 at r1 (raw file):

Previously, ShahakShama wrote…

Shouldn't we increase relevant failure metrics?

Yes!


crates/apollo_l1_gas_price/src/l1_gas_price_scraper_test.rs line 329 at r1 (raw file):

Previously, ShahakShama wrote…

The test says "fails then succeeds" but I only see the fails section

The new, simplified test is much clearer.


crates/apollo_l1_gas_price/src/l1_gas_price_scraper_test.rs line 338 at r1 (raw file):

Previously, ShahakShama wrote…

I don't understand why do we need the provider to return an error for this test

If it returns Ok() we will continue to be in the endless loop if "run". But I will take your advice and separate run from that new function, which will make it all much cleaner.

@guy-starkware guy-starkware force-pushed the guyn/L1price/startup_loop branch from 35192be to dfe2389 Compare January 8, 2026 12:13
Copy link
Collaborator

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama reviewed 2 files and all commit messages, made 5 comments, and resolved 4 discussions.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @guy-starkware).


crates/apollo_l1_gas_price/src/l1_gas_price_scraper_test.rs line 342 at r2 (raw file):

        .returning(move || Err(MockError::MockError));

    // The succeed.

Then


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 66 at r2 (raw file):

    }

    pub async fn get_first_block_number(&mut self) -> L1GasPriceScraperResult<L1BlockNumber, B> {

The return type can be just L1BlockNumber, right?


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 70 at r2 (raw file):

            Some(block) => Ok(block),
            None => {
                loop {

De-nest this. At the beginning of the function write

if let Some(block) = self.config.starting_block {
    return Ok(block)
}
loop {...

crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 73 at r2 (raw file):

                    let latest = self.latest_l1_block_number().await;
                    let Ok(latest) = latest else {
                        warn!("Failed to get the latest L1 block number at startup: {latest:?}");

Consider rephrasing this sentence so that startup appears close to the start of it


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 86 at r2 (raw file):

                            * self.config.startup_num_blocks_multiplier,
                    );
                    break Ok(latest);

Now you can change it from break to return!

@guy-starkware guy-starkware force-pushed the guyn/L1price/startup_loop branch from dfe2389 to 85f8ac6 Compare January 8, 2026 14:57
Copy link
Contributor Author

@guy-starkware guy-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guy-starkware made 5 comments and resolved 2 discussions.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ShahakShama).


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 66 at r2 (raw file):

Previously, ShahakShama wrote…

The return type can be just L1BlockNumber, right?

Yes!


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 70 at r2 (raw file):

Previously, ShahakShama wrote…

De-nest this. At the beginning of the function write

if let Some(block) = self.config.starting_block {
    return Ok(block)
}
loop {...

Good idea.


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 73 at r2 (raw file):

Previously, ShahakShama wrote…

Consider rephrasing this sentence so that startup appears close to the start of it

Done.


crates/apollo_l1_gas_price/src/l1_gas_price_scraper.rs line 86 at r2 (raw file):

Previously, ShahakShama wrote…

Now you can change it from break to return!

Yep.


crates/apollo_l1_gas_price/src/l1_gas_price_scraper_test.rs line 342 at r2 (raw file):

Previously, ShahakShama wrote…

Then

Done.

Copy link
Collaborator

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@ShahakShama reviewed 2 files and all commit messages, made 1 comment, and resolved 3 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @guy-starkware).

@guy-starkware guy-starkware force-pushed the guyn/L1price/startup_loop branch 2 times, most recently from 8955a0d to eb6d59e Compare January 11, 2026 09:56
@guy-starkware guy-starkware force-pushed the guyn/L1price/startup_loop branch from eb6d59e to ffbcfd2 Compare January 11, 2026 11:17
Copy link
Contributor Author

@guy-starkware guy-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guy-starkware partially reviewed 4 files.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @guy-starkware).

Copy link
Contributor Author

@guy-starkware guy-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guy-starkware reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @guy-starkware).

@guy-starkware guy-starkware added this pull request to the merge queue Jan 11, 2026
Merged via the queue into main-v0.14.1-committer with commit 6196bac Jan 11, 2026
19 of 21 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants