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

chore(starknet_batcher): set block timestamp in build block input #2342

Merged

Conversation

ArniStarkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 17.98%. Comparing base (e3165c4) to head (5e5126a).
Report is 655 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2342       +/-   ##
===========================================
- Coverage   40.10%   17.98%   -22.13%     
===========================================
  Files          26      119       +93     
  Lines        1895    13954    +12059     
  Branches     1895    13954    +12059     
===========================================
+ Hits          760     2509     +1749     
- Misses       1100    11174    +10074     
- Partials       35      271      +236     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @ArniStarkware)


crates/starknet_batcher/src/block_builder.rs line 321 at r1 (raw file):

                    .try_into()
                    .map_err(BlockBuilderError::BadTimestamp)?,
            ),

why did you change it?
I think the previous version was easier to read.

This code will be deleted anyway, right?

Code quote:

            block_timestamp: BlockTimestamp(
                chrono::Utc::now()
                    .timestamp()
                    .try_into()
                    .map_err(BlockBuilderError::BadTimestamp)?,
            ),

crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs line 163 at r1 (raw file):

                gas_prices: TEMPORARY_GAS_PRICES,
                block_timestamp: BlockTimestamp(
                    now.timestamp().try_into().expect("Failed to convert timestamp"),

same for the next change.

Suggestion:

chrono::Utc::now().timestamp().try_into().expect("Failed to convert timestamp"),

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware)


crates/starknet_batcher/src/block_builder.rs line 49 at r1 (raw file):

pub enum BlockBuilderError {
    #[error(transparent)]
    BadTimestamp(#[from] std::num::TryFromIntError),

Why this change?

@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_gas_prices branch from 6158a58 to 37ca509 Compare December 1, 2024 12:39
@ArniStarkware
Copy link
Contributor Author

crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs line 163 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

same for the next change.

So, Should I have two invocations of chorono::Utc::now() five lines apart? Once for deadline and once for block_timestamp.

In my opinion, it is bad - as these will be slightly different from each other - based on how long these lines take to execute.

@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_block_timestamp branch from 3bb7ed9 to c65933e Compare December 1, 2024 12:43
Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Dismissed @alonh5 from a discussion.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @Yael-Starkware)


crates/starknet_batcher/src/block_builder.rs line 49 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Why this change?

As @Yael-Starkware pointed out - this will be deleted by the next PR anyway.
Reverted.


crates/starknet_batcher/src/block_builder.rs line 321 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

why did you change it?
I think the previous version was easier to read.

This code will be deleted anyway, right?

  1. Yes - the code will be deleted anyway. Reverted.
  2. I think it is bad that a generic TryFromIntError is always converted to a BadTimestamp. (Again - in theory), what happens if another conversion from integer happens in the scope of Block-build, but has nothing to do with timestamp?

@ArniStarkware ArniStarkware changed the title chore(batcher): set block timestamp in build block input chore(starknet_batcher): set block timestamp in build block input Dec 1, 2024
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Yael-Starkware)

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

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

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


crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs line 163 at r1 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

So, Should I have two invocations of chorono::Utc::now() five lines apart? Once for deadline and once for block_timestamp.

In my opinion, it is bad - as these will be slightly different from each other - based on how long these lines take to execute.

oh sorry I missed the deadline usage. retracting.

@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_gas_prices branch from 37ca509 to 3564bee Compare December 2, 2024 09:23
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_block_timestamp branch from c65933e to 5e58a58 Compare December 2, 2024 09:23
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_gas_prices branch from 3564bee to 5b58ea9 Compare December 2, 2024 13:23
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_block_timestamp branch from 5e58a58 to 83b3f3e Compare December 2, 2024 13:23
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_gas_prices branch 2 times, most recently from 7b83d10 to 71bf431 Compare December 2, 2024 14:00
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_block_timestamp branch from 83b3f3e to 3d7428d Compare December 2, 2024 14:00
@ArniStarkware ArniStarkware force-pushed the arni/batcher/block_builder_factory/set_block_timestamp branch from 3d7428d to 5e5126a Compare December 2, 2024 14:33
@ArniStarkware ArniStarkware changed the base branch from arni/batcher/block_builder_factory/set_gas_prices to main December 2, 2024 14:33
@ArniStarkware ArniStarkware requested a review from alonh5 December 2, 2024 15:03
Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r3, all commit messages.
Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @alonh5)

Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @alonh5)

@ArniStarkware ArniStarkware merged commit 26bd6aa into main Dec 2, 2024
16 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2024
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