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

Open
wants to merge 1 commit into
base: arni/batcher/block_builder_factory/set_gas_prices
Choose a base branch
from

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.84%. Comparing base (37ca509) to head (c65933e).

Additional details and impacted files
@@                                  Coverage Diff                                  @@
##           arni/batcher/block_builder_factory/set_gas_prices    #2342      +/-   ##
=====================================================================================
+ Coverage                                              17.79%   17.84%   +0.04%     
=====================================================================================
  Files                                                    119      119              
  Lines                                                  13878    13886       +8     
  Branches                                               13878    13886       +8     
=====================================================================================
+ Hits                                                    2470     2478       +8     
  Misses                                                 11137    11137              
  Partials                                                 271      271              

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants