Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

feat(fee): add events gas cost #1458

Merged
merged 1 commit into from
Feb 11, 2024
Merged

Conversation

barak-b-starkware
Copy link
Collaborator

@barak-b-starkware barak-b-starkware commented Feb 7, 2024

This change is Reviewable

@avi-starkware
Copy link
Collaborator

crates/blockifier/src/fee/eth_gas_constants.rs line 31 at r1 (raw file):

// Every key and every data word is a StarkFelt which contains 32 bytes.
pub const MILLI_GAS_PER_KEY: usize = 32 * MILLI_GAS_PER_KEY_BYTE;
pub const MILLI_GAS_PER_DATA_WORD: usize = 32 * MILLI_GAS_PER_DATA_BYTE;

These constants should be moved to versioned_constants.json (see #1426).
The file eth_gas_constants.rs is supposed to only include ETH constants that don't change (are part of the ETH protocol).
Constants that change between versions should be in versioned_constants.json.

Code quote:

// L2 Events.
pub const MILLI_GAS_PER_KEY_BYTE: usize = 40;
pub const MILLI_GAS_PER_DATA_BYTE: usize = 2 * MILLI_GAS_PER_KEY_BYTE;
// TODO(barak, 18/03/2024): Remove calculation per StarkFelt.
// Every key and every data word is a StarkFelt which contains 32 bytes.
pub const MILLI_GAS_PER_KEY: usize = 32 * MILLI_GAS_PER_KEY_BYTE;
pub const MILLI_GAS_PER_DATA_WORD: usize = 32 * MILLI_GAS_PER_DATA_BYTE;

@avi-starkware
Copy link
Collaborator

crates/blockifier/src/fee/gas_usage.rs line 33 at r1 (raw file):

    Ok(get_messages_gas_cost(call_infos.clone(), l1_handler_payload_size)?
        + get_da_gas_cost(state_changes_count, use_kzg_da)
        + get_events_gas_cost(call_infos))

There should be a test where this number is not 0.

Code quote:

        + get_events_gas_cost(call_infos))

Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

How come no test is modified?
Can you add a short unit test?

Reviewed all commit messages.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, and @barak-b-starkware)


crates/blockifier/src/fee/gas_usage.rs line 31 at r1 (raw file):

) -> TransactionExecutionResult<GasVector> {
    // TODO(barak, 18/03/2024): Iterate over call_infos once without cloning.
    Ok(get_messages_gas_cost(call_infos.clone(), l1_handler_payload_size)?

This does not clone the call infos, right?

Code quote:

call_infos.clone()

Copy link
Collaborator

@Yoni-Starkware Yoni-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, 4 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, and @barak-b-starkware)


crates/blockifier/src/fee/gas_usage.rs line 48 at r1 (raw file):

                                + ordered_event.event.data.0.len()
                                    * eth_gas_constants::MILLI_GAS_PER_DATA_WORD,
                        )

Split into a function, get_event_gas_cost

Code quote:

            + call_info.execution.events.iter().fold(
                GasVector { l1_gas: 0, blob_gas: 0 },
                |sum, ordered_event| {
                    sum + GasVector {
                        l1_gas: u128_from_usize(
                            ordered_event.event.keys.len() * eth_gas_constants::MILLI_GAS_PER_KEY
                                + ordered_event.event.data.0.len()
                                    * eth_gas_constants::MILLI_GAS_PER_DATA_WORD,
                        )

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/gas_usage.rs line 48 at r1 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Split into a function, get_event_gas_cost

Done.

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/gas_usage.rs line 31 at r1 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

This does not clone the call infos, right?

AFAIU it doesn't look here, but I can't say I understand 100% what happens there.

@barak-b-starkware
Copy link
Collaborator Author

IIUC the test that runs calculate_tx_gas_usage_vector uses CallInfo without events.
You can see here.

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/eth_gas_constants.rs line 31 at r1 (raw file):

Previously, avi-starkware wrote…

These constants should be moved to versioned_constants.json (see #1426).
The file eth_gas_constants.rs is supposed to only include ETH constants that don't change (are part of the ETH protocol).
Constants that change between versions should be in versioned_constants.json.

Done.

Copy link
Collaborator Author

@barak-b-starkware barak-b-starkware left a comment

Choose a reason for hiding this comment

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

A unit test was added.

Reviewable status: 0 of 7 files reviewed, 4 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, and @Yoni-Starkware)


crates/blockifier/src/fee/gas_usage.rs line 33 at r1 (raw file):

Previously, avi-starkware wrote…

There should be a test where this number is not 0.

Done.

@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (94a81f3) 69.23% compared to head (5207874) 69.35%.

Files Patch % Lines
crates/blockifier/src/fee/gas_usage.rs 97.05% 0 Missing and 1 partial ⚠️
crates/blockifier/src/transaction/objects.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           main-v0.13.1    #1458      +/-   ##
================================================
+ Coverage         69.23%   69.35%   +0.11%     
================================================
  Files                59       59              
  Lines              8059     8089      +30     
  Branches           8059     8089      +30     
================================================
+ Hits               5580     5610      +30     
  Misses             2021     2021              
  Partials            458      458              

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

Copy link
Collaborator

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 7 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, @barak-b-starkware, and @Yoni-Starkware)


crates/blockifier/resources/versioned_constants.json line 11 at r3 (raw file):

    "milligas_per_data_word": 2560,
    "invoke_tx_max_n_steps": 3000000,
    "max_recursion_depth": 50,

Top level keys are alphabetized

Suggestion:

    "invoke_tx_max_n_steps": 3000000,
    "max_recursion_depth": 50,
    "milligas_per_key_byte": 40,
    "milligas_per_data_byte": 80,
    "milligas_per_key": 1280,
    "milligas_per_data_word": 2560,

crates/blockifier/src/versioned_constants.rs line 41 at r3 (raw file):

    pub milligas_per_data_byte: usize,
    pub milligas_per_key: usize,
    pub milligas_per_data_word: usize,

I'm getting confused about the types 😅.

Gas is u128 (based on GasVector's inner types) but miligas is usize? Isn't GasVector also used to represent miligas?

Code quote:

    pub milligas_per_key_byte: usize,
    pub milligas_per_data_byte: usize,
    pub milligas_per_key: usize,
    pub milligas_per_data_word: usize,

crates/blockifier/src/versioned_constants.rs line 41 at r3 (raw file):

    pub milligas_per_data_byte: usize,
    pub milligas_per_key: usize,
    pub milligas_per_data_word: usize,

These smell like tight coupling.

If that's the case plz pack into an appropriate struct with the same derives of VersionedConstants --- in the json this will add a nesting level under the key with the chosen name of the field that holds the new struct.

Code quote:

    pub milligas_per_key_byte: usize,
    pub milligas_per_data_byte: usize,
    pub milligas_per_key: usize,
    pub milligas_per_data_word: usize,

crates/blockifier/src/fee/gas_usage.rs line 31 at r1 (raw file):

Previously, barak-b-starkware wrote…

AFAIU it doesn't look here, but I can't say I understand 100% what happens there.

Yep it's just cloning the iterator, which is a cheap op.
In general though, passing by & is preferred unless the type is Copy or ownership is explicitly needed.

But if it requires changing a bunch of out of scope stuff clone is fine here, otherwise, if passing by & is easy to change, remove the + Clone trait bound.


crates/blockifier/src/fee/gas_usage.rs line 25 at r3 (raw file):

/// e.g., a message from L2 to L1 is followed by a storage write operation in Starknet L1 contract
/// which requires gas.
pub fn calculate_tx_gas_usage_vector<'a>(

Consider moving this as a method on ActualCostBuilder.
It is the only user, and two args appearing multiple times here are its fields.

Code quote:

pub fn calculate_tx_gas_usage_vector<'a>(

crates/blockifier/src/fee/gas_usage.rs line 51 at r3 (raw file):

        l1_gas: milli_gas_vector.l1_gas / 1000,
        l1_data_gas: milli_gas_vector.l1_data_gas / 1000,
    }

Add derive_more::Div to GasVector for this to work (it already has Add/Sum).
Also add Copy, it's applicable.

Prefer sum over fold for summing.

BTW, if this were part of a method on ActualCostBuilder, the map could have been

map(self.get_events_milligas_cost_from_events)

Suggestion:

    let milli_gas_vector: GasVector = call_infos
        .map(|call_info| get_events_milligas_cost_from_events(call_info, versioned_constants))
        .sum();
        
    milli_gas_vector / 1000

crates/blockifier/src/fee/gas_usage.rs line 51 at r3 (raw file):

        l1_gas: milli_gas_vector.l1_gas / 1000,
        l1_data_gas: milli_gas_vector.l1_data_gas / 1000,
    }

GasVector is used to represent both gas units and milli-gas units? Can we use different types?

Code quote:

    GasVector {
        l1_gas: milli_gas_vector.l1_gas / 1000,
        l1_data_gas: milli_gas_vector.l1_data_gas / 1000,
    }

crates/blockifier/src/fee/gas_usage.rs line 70 at r3 (raw file):

                l1_data_gas: 0_u128,
            }
        },

Prefer chaining and iterators whenever possible (unless it's forced), and try keeping nesting depth low.

Rust iterators are lazy: they do nothing until they are consumed (so this iterates only once even though there are two maps).

Also, if the lengths of both of these fields has meaning (i'm not well acquainted with this type),
consider adding to OrderedEvent something like pub fn length(&self) -> (usize, usize) to hide the len logic.

Suggestion:

let total_gas_vector = call_info
    .execution
    .events
    .iter()
    .map(|OrderedEvent { event, .. }| {
        let keys_gas = event.keys.len() * versioned_constants.milligas_per_key;
        let data_gas = event.data.0.len() * versioned_constants.milligas_per_data_word;
        u128_from_usize(keys_gas + data_gas)
            .expect("Could not convert starknet gas usage from usize to u128.")
    })
    .map(|l1_gas| GasVector { l1_gas, ..Default::default() })
    .sum();

crates/blockifier/src/fee/gas_usage_test.rs line 25 at r3 (raw file):

    serde_json::from_str(DEFAULT_CONSTANTS_JSON)
        .expect("Versioned constants JSON file is malformed")
});

or if you need ownership:

#[fixture]
#[once]
fn versioned_constants() -> VersionedConstants {
    VersionedConstants::latest_constants().clone()
}

Suggestion:

#[fixture]
fn versioned_constants() -> &'static VersionedConstants {
    VersionedConstants::latest_constants()
}

crates/blockifier/src/fee/gas_usage_test.rs line 113 at r3 (raw file):

)
]
fn test_get_events_gas_cost(#[case] call_infos: Vec<CallInfo>, #[case] expected: GasVector) {

Plz split into two separate tests without parameterization.

Unparameterized tests are easier to debug in general (less macros == easier debugging), and if there isn't too much duplication in the test itself (which is the case here) the complicated parameterization isn't worth it.

Copy link
Collaborator

@giladchase giladchase left a comment

Choose a reason for hiding this comment

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

I added a bunch of blocking comments, but due to the time constraints for this release, if you have no time to implement/challange the feel free to dismiss them all and add a monday task to revisit them, even for the sake of discussion.

Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, @barak-b-starkware, and @Yoni-Starkware)


crates/blockifier/src/fee/gas_usage.rs line 51 at r3 (raw file):

Previously, giladchase wrote…

Add derive_more::Div to GasVector for this to work (it already has Add/Sum).
Also add Copy, it's applicable.

Prefer sum over fold for summing.

BTW, if this were part of a method on ActualCostBuilder, the map could have been

map(self.get_events_milligas_cost_from_events)

maybe even

...
let gas_vector = milli_gas_vector / 1000
gas_vector

for more readability

Copy link
Collaborator

@Yoni-Starkware Yoni-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 6 of 7 files at r2.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, and @barak-b-starkware)


crates/blockifier/src/fee/gas_usage.rs line 42 at r2 (raw file):

    versioned_constants: &VersionedConstants,
) -> GasVector {
    let milli_gas_vector = call_infos.fold(

I think you should work here with an integer (rather than gas vector)
And wrap it up just to return

Suggestion:

milligas_vector = call_infos.fold(

Copy link
Collaborator Author

@barak-b-starkware barak-b-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: 1 of 10 files reviewed, 11 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, @giladchase, and @Yoni-Starkware)


crates/blockifier/resources/versioned_constants.json line 11 at r3 (raw file):

Previously, giladchase wrote…

Top level keys are alphabetized

Done.


crates/blockifier/src/versioned_constants.rs line 41 at r3 (raw file):

Previously, giladchase wrote…

I'm getting confused about the types 😅.

Gas is u128 (based on GasVector's inner types) but miligas is usize? Isn't GasVector also used to represent miligas?

Done.


crates/blockifier/src/versioned_constants.rs line 41 at r3 (raw file):

Previously, giladchase wrote…

These smell like tight coupling.

If that's the case plz pack into an appropriate struct with the same derives of VersionedConstants --- in the json this will add a nesting level under the key with the chosen name of the field that holds the new struct.

Done.


crates/blockifier/src/fee/gas_usage.rs line 31 at r1 (raw file):

Previously, giladchase wrote…

Yep it's just cloning the iterator, which is a cheap op.
In general though, passing by & is preferred unless the type is Copy or ownership is explicitly needed.

But if it requires changing a bunch of out of scope stuff clone is fine here, otherwise, if passing by & is easy to change, remove the + Clone trait bound.

Passing by reference is possible, but it should be passed twice, and the first time will consume the iterator, so what do you prefer here?


crates/blockifier/src/fee/gas_usage.rs line 42 at r2 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

I think you should work here with an integer (rather than gas vector)
And wrap it up just to return

Changed according to @giladchase's suggestion. LMK if you like it or not (:


crates/blockifier/src/fee/gas_usage.rs line 25 at r3 (raw file):

Previously, giladchase wrote…

Consider moving this as a method on ActualCostBuilder.
It is the only user, and two args appearing multiple times here are its fields.

Done.


crates/blockifier/src/fee/gas_usage.rs line 51 at r3 (raw file):

Previously, giladchase wrote…

maybe even

...
let gas_vector = milli_gas_vector / 1000
gas_vector

for more readability

Done.
I added Copy but why to do that if it's not necessary right now?
Regarding your second suggestion, Clippy complains of unnecessary 'let' binding.


crates/blockifier/src/fee/gas_usage.rs line 51 at r3 (raw file):

Previously, giladchase wrote…

GasVector is used to represent both gas units and milli-gas units? Can we use different types?

Done.


crates/blockifier/src/fee/gas_usage.rs line 70 at r3 (raw file):

Previously, giladchase wrote…

Prefer chaining and iterators whenever possible (unless it's forced), and try keeping nesting depth low.

Rust iterators are lazy: they do nothing until they are consumed (so this iterates only once even though there are two maps).

Also, if the lengths of both of these fields has meaning (i'm not well acquainted with this type),
consider adding to OrderedEvent something like pub fn length(&self) -> (usize, usize) to hide the len logic.

Done.


crates/blockifier/src/fee/gas_usage_test.rs line 25 at r3 (raw file):

Previously, giladchase wrote…

or if you need ownership:

#[fixture]
#[once]
fn versioned_constants() -> VersionedConstants {
    VersionedConstants::latest_constants().clone()
}

Done.
Didn't find any documentation or examples in our repo for #[once], WDYM?


crates/blockifier/src/fee/gas_usage_test.rs line 113 at r3 (raw file):

Previously, giladchase wrote…

Plz split into two separate tests without parameterization.

Unparameterized tests are easier to debug in general (less macros == easier debugging), and if there isn't too much duplication in the test itself (which is the case here) the complicated parameterization isn't worth it.

Done.

@barak-b-starkware barak-b-starkware force-pushed the barak/events_gas_cost branch 2 times, most recently from 5544e47 to 5f98a03 Compare February 11, 2024 06:53
@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/gas_usage.rs line 51 at r3 (raw file):

Previously, barak-b-starkware wrote…

Done.
I added Copy but why to do that if it's not necessary right now?
Regarding your second suggestion, Clippy complains of unnecessary 'let' binding.

I agree that adding the Copy derivation is a good thing to do, it saves some redundant "clones" and it holds only two u128 which are Copy too... good idea (:

@barak-b-starkware barak-b-starkware force-pushed the barak/events_gas_cost branch 3 times, most recently from 9c413d8 to 4d31291 Compare February 11, 2024 08:16
Copy link
Collaborator

@Yoni-Starkware Yoni-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: 1 of 10 files reviewed, 17 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, @barak-b-starkware, and @giladchase)


crates/blockifier/resources/versioned_constants.json line 8 at r5 (raw file):

    "event_gas_cost": {
        "milligas_per_data_word": 2560,
        "milligas_per_key": 1280

Suggestion:

"event_key_factor": 2

crates/blockifier/resources/versioned_constants.json line 9 at r5 (raw file):

        "milligas_per_data_word": 2560,
        "milligas_per_key": 1280
    },

L2_resources

Code quote:

    "event_gas_cost": {
        "milligas_per_data_word": 2560,
        "milligas_per_key": 1280
    },

crates/blockifier/src/versioned_constants.rs line 55 at r6 (raw file):

    os_constants: Arc<OSConstants>,

    event_gas_cost: Arc<EventGasCost>,

Suggestion:

 l2_resource_gas_costs: Arc<EventGasCost>,

crates/blockifier/src/fee/gas_usage.rs line 21 at r5 (raw file):

pub mod test;

pub fn get_events_gas_cost<'a>(

Suggestion:

pub fn get_tx_events_gas_cost<'a>(

crates/blockifier/src/fee/gas_usage.rs line 31 at r5 (raw file):

}

pub fn get_events_milligas_cost_from_events(

Suggestion:

pub fn get_events_milligas_cost(

crates/blockifier/src/fee/gas_usage.rs line 32 at r5 (raw file):

pub fn get_events_milligas_cost_from_events(
    call_info: &CallInfo,

Suggestion:

events: &Vec<...>,

@barak-b-starkware barak-b-starkware force-pushed the barak/events_gas_cost branch 2 times, most recently from 9e4bdfc to 179965f Compare February 11, 2024 13:16
@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/gas_usage_test.rs line 54 at r7 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Move this call to be an inner call of the first one (to check iteration)

Done.

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/versioned_constants.rs line 55 at r4 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Avi changed it to pub l2_resource_gas_costs: L2ResourceGasCosts

Done.

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/actual_cost.rs line 163 at r4 (raw file):

            + get_da_gas_cost(state_changes_count, use_kzg_da)
            + get_events_gas_cost(call_infos, versioned_constants))
    }

At @Yoni-Starkware 's request, it moved back, so the changes you requested can't be done (using self).

Copy link
Collaborator

@Yoni-Starkware Yoni-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 1 of 5 files at r10.
Reviewable status: 2 of 12 files reviewed, 8 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, @barak-b-starkware, and @giladchase)


crates/blockifier/src/fee/gas_usage.rs line 24 at r15 (raw file):

/// Returns an estimation of the L1 gas amount that will be used (by Starknet's state update and
/// the Verifier) following the addition of a transaction with the given parameters to a batch;
/// e.g., a message from L2 to L1 is followed by a storage write operation in Starknet L1 contract

Document as follows:

Suggestion:

/// Returns the gas usage of a transaction, specifically: 
/// * L1 gas, used by Starknet's state update and the Verifier, 
///   e.g., a message from L2 to L1 is followed by a storage write operation on L1.
/// * L1 data gas, for publishing data availability.
/// * L2 resources cost, e.g., for storing transaction calldata.

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/gas_usage.rs line 24 at r15 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Document as follows:

Done.

Copy link
Collaborator

@Yoni-Starkware Yoni-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 1 of 3 files at r15.
Reviewable status: 2 of 12 files reviewed, 9 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, @barak-b-starkware, and @giladchase)


crates/blockifier/src/fee/gas_usage_test.rs line 37 at r17 (raw file):

    assert_eq!(GasVector::default(), get_tx_events_gas_cost(call_infos, versioned_constants));

    let create_trivial_ordered_event_from_keys_and_data_sizes =

Suggestion:

create_event

@barak-b-starkware
Copy link
Collaborator Author

crates/blockifier/src/fee/gas_usage_test.rs line 37 at r17 (raw file):

    assert_eq!(GasVector::default(), get_tx_events_gas_cost(call_infos, versioned_constants));

    let create_trivial_ordered_event_from_keys_and_data_sizes =

Done.

Yoni-Starkware
Yoni-Starkware previously approved these changes Feb 11, 2024
Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware 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 1 of 6 files at r7, 1 of 5 files at r10, 6 of 7 files at r12, 1 of 3 files at r15, 1 of 1 files at r16, 1 of 1 files at r17, 1 of 1 files at r18, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, and @giladchase)

@barak-b-starkware barak-b-starkware changed the base branch from avi/fees/charge-for-code to main-v0.13.1 February 11, 2024 15:18
@barak-b-starkware barak-b-starkware dismissed Yoni-Starkware’s stale review February 11, 2024 15:18

The base branch was changed.

Copy link
Collaborator

@Yoni-Starkware Yoni-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 3 of 3 files at r19, all commit messages.
Dismissed @giladchase from 4 discussions.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @avi-starkware, and @giladchase)

Copy link
Collaborator

@Yoni-Starkware Yoni-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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware, @avi-starkware, and @giladchase)

@Yoni-Starkware Yoni-Starkware merged commit fcd671b into main-v0.13.1 Feb 11, 2024
7 checks passed
@barak-b-starkware barak-b-starkware deleted the barak/events_gas_cost branch February 11, 2024 15:39
rodrigo-pino added a commit to NethermindEth/blockifier that referenced this pull request Mar 7, 2024
* Run cargo update

Signed-off-by: Dori Medini <dori@starkware.co>

* Detach native_blockifier

* Bump cairo-vm and cairo compiler

New cairo-vm version includes performance optimizations.
New cairo version only includes the new vm version.

* Release 0.4.1-rc.0

* Re-attach native_blockifier, bump papyrus_storage

* native_blockifier: Allow querying for `Blockifier` version. (starkware-libs#1249)

This allows one to do:
```
import native_blockifier
native_blockifier.blockifier_version()
```
And get the version the native was compiled with.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* Add updated version of estimate_casm_hash_computation_resources(). (starkware-libs#1314)

* Resolve conflicts.

* Reconnect nnative-blockifier

Signed-off-by: Dori Medini <dori@starkware.co>

* Add the field kzg_resources to PyBouncerInfo. (starkware-libs#1321)

* Add use_kzg_da flag to PyBlockInfo. (starkware-libs#1319)

* Merge `main-v0.13.0` into `main` (resolve conflicts).

* Remove gas price bounds from general config (starkware-libs#1329)

Signed-off-by: Dori Medini <dori@starkware.co>

* Bump cairo-vm version (starkware-libs#1330)

Signed-off-by: Dori Medini <dori@starkware.co>

* Update cairo compiler version and fix related TODOs. (starkware-libs#1332)

* Small fix in into_block_context. (starkware-libs#1337)

* Data gas prices in block context (starkware-libs#1336)

Signed-off-by: Dori Medini <dori@starkware.co>

* Use try_from instead of as (starkware-libs#1322)

* Use into instead of as (starkware-libs#1333)

* Add MAX_L1_GAS_AMOUNT_U128 (starkware-libs#1335)

* Refactor calculate_tx_gas_usage (starkware-libs#1320)

* Change additional as to try_from and try_to (starkware-libs#1342)

* Remove PyKzgResources. Reveal the state diff size. (starkware-libs#1341)

* Make `BlockContext` a newtype around `BlockInfo` (starkware-libs#1323)

The crux of this commit is the change in `block_context.rs`, which
converts `BlockContext` into a wrapper around `BlockInfo` (which used to be
`BlockContext`).

Everything else is just delegating the accessors to the internal block_info, made
by search-and-replace (no other changes).

Motivation:
- This change the groundwork for future refactor and consolidation of
contexts.
- Subsequent commits will extract non block-specific constants from
`BlockInfo` into separate `ChainInfo` and `VersionedConstants` structs,
which will be siblings of `block_info` inside `BlockContext`.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* Extract from `BlockInfo` into `ChainInfo` (starkware-libs#1344)

`BlockInfo` should only contain block-level info, whereas chain-level
information should be held at the `BlockContext` level, encapsulated in
a dedicated `ChainInfo` struct.

Changes:
Only extract from `BlockInfo` and store in `BlockContext.chain_info:
ChainInfo`. All other changes are search-replace + moving the
fee_token_address getter into `ChainInfo`.

TODO: extract more stuff from BlockInfo: version-dependant constants should
be extracted into a dedicated VersionedConstants, which will be a member of BlockContext

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* Revert changes of 776d7a5 (starkware-libs#1352)

* fix(native_blockifier): Remove `PyGasPrices` (starkware-libs#1353)

`PyX` types are intended to represent (a subset) of the real
structure of object in Python.
Currently Python is broken do to PyBlockInfo's FromPyObject expecting
there to be a `PyGasPrices`, which doesn't exist in Ptyhon

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* Rename `{into,to}_actual_cost_builder` (starkware-libs#1355)

`into` implies `owned -> owned` cast, whereas `to` can imply `borrowed
-> owned`.

See this reference for naming convention: https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* add missing internal panic in cairo1 (starkware-libs#1340)

* add missing internal panic in cairo1

* update `test_stack_trace` and make it work with Cairo1 as well as Cairo0

* Align block info fields (starkware-libs#1358)

Signed-off-by: Dori Medini <dori@starkware.co>

* ci: add commitlint in CI (starkware-libs#1313)

Signed-off-by: Dori Medini <dori@starkware.co>

* Create the function calculate_tx_blob_gas_usage. (starkware-libs#1346)

* Add direct cast from PyFelt into ContractAddress + Deref (starkware-libs#1345)

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* fix: revert "Add direct cast from PyFelt into ContractAddress + Deref (starkware-libs#1345)" (starkware-libs#1364)

This reverts commit 6b524c9.

Python is fussy about derive_more, will TAL at it again later

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* refactor(fee): split tx l1 gas computation to da and non-da sum, add fee test for empty transaction (starkware-libs#1339)

* test: add stack trace regressions tests in Cairo1 for various call chains (starkware-libs#1367)

* feat(fee): preparation-add the calldata length to the resource calcaultion (starkware-libs#1361)

* build(fee): added new struct and field in preparation for using blob_gas (starkware-libs#1356)

* feat(fee): modified calculate_tx_l1_gas_usage(s) added calculate_tx_gas_and_blob_gas_usage (starkware-libs#1357)

* style: remove some unnecessary variables (starkware-libs#1366)

* feat(fee): modified calculate_tx_l1_gas_usage(s), added calculate_tx_gas_and_blob_gas_usage (starkware-libs#1370)

* refactor(state): replace GlobalContractCache default with GlobalContractCache new (starkware-libs#1368)

* feat(fee): check gas amount including discounted data gas (starkware-libs#1374)

Signed-off-by: Dori Medini <dori@starkware.co>

* test: add cairo0 variants to the new stack trace regression tests (starkware-libs#1371)

* feat(fee): calculates messages size field (starkware-libs#1290)

* fix(native_blockifier): change failure_flag type to bool (starkware-libs#1334)

* fix(execution): convert all local errors to stack trace (starkware-libs#1378)

Signed-off-by: Dori Medini <dori@starkware.co>

* fix(execution): change additional as to from (starkware-libs#1373)

* Merge `main-v0.13.1` into `main` (resolve conflicts).

* fix(native_blockifier): use PyCallType and PyEntryPointType instead of as (starkware-libs#1383)

* ci: prevent PR title check on merges

Signed-off-by: Dori Medini <dori@starkware.co>

* ci: ignore merge PRs when linting PR titles (starkware-libs#1388)

Signed-off-by: Dori Medini <dori@starkware.co>

* refactor(native_blockifier): pybouncerinfo tx_weights field (starkware-libs#1347)

* style(fee): fix error handle unpack (starkware-libs#1390)

* feat(fee): add linear combination for gas and blob_gas (starkware-libs#1360)

* refactor: change CustomHint error usage into VirtualMachineError::Other(anyhow::Error) (starkware-libs#1397)

* refactor(state): use get_nonce_updates (starkware-libs#1398)

* refactor: make the BlockContext constructor private as preparation for pre_process_block changes (starkware-libs#1385)

* refactor: change variable and function names for gas_vector (starkware-libs#1400)

* fix(fee): modified estimate_minimal_gas_vector, extracted compute_discounted_gas_from_gas_vector (starkware-libs#1401)

* refactor: modified extraction in extract_l1_blob_gas_usage (from unwrap_or(0) to expect) (starkware-libs#1402)

* test: update test_call_contract to new infra (starkware-libs#1404)

Signed-off-by: Dori Medini <dori@starkware.co>

* feat: add VersionedConstants

- Currently only covers the constants previously contained in `BlockInfo`.
TODO: Add check if this covers all chain ids, which might have different
contstants
- Remove `BlockContextArgs`: no longer needed now that BlockContext can
  be initialized by 3 args of public types.

* test: update test_replace_class to new infra (starkware-libs#1405)

Signed-off-by: Dori Medini <dori@starkware.co>

* refactor: restructure old_block_number_and_hash as a struct (starkware-libs#1403)

* chore(fee): gas computation refactor (starkware-libs#1408)

Changes:
1. Implemented get_da_gas_cost, which returns a GasVector (depending on
   use_kzg_da flag).
2. Deleted calculate_tx_gas_usage_vector, because
   calculate_tx_l1_gas_usage does the same thing.
3. Derived derive_more::Add for GasVector to easily sum up gas costs.

Signed-off-by: Dori Medini <dori@starkware.co>

* chore(fee): use GasVector as a return type for gas computations (starkware-libs#1409)

Signed-off-by: Dori Medini <dori@starkware.co>

* refactor: rename context modules

- Rename block_context.rs -> context.rs. This will hold all context
  types.
- Rename block_execution.rs -> block.rs and move `BlockInfo` and
  `GasPrices` there (`GasPrices` is only used inside `BlockInfo`).

No other changes.

* chore(fee): integer VM gas usage (starkware-libs#1410)

* chore(fee): use GasVector as a return type for gas computations

Signed-off-by: Dori Medini <dori@starkware.co>

* chore(fee): integer VM gas usage

Signed-off-by: Dori Medini <dori@starkware.co>

* perf(native_blockifier): transaction execution info add serialize (starkware-libs#1315)

* feat(fee): adding a slope paramters to the os resources (starkware-libs#1362)

* feat(fee): set the resources slope values (starkware-libs#1363)

* refactor: make `AccountTransactionContext` hold BlockContext

- Rename `AccountTransactionContext` into `TransactionInfo`: i want to
  use `Context` for something else, and `Account` is a misnomer, since
  L1Transactions also generate this instance.
- Create a new `AccountTransactionContext`, which holds `BlockContext`
  and `TransactionInfo`: This mirrors `BlockContext`, which holds
  `BlockInfo` as well as higher level contexts.
- Remove all unnecessary `get_account_tx` calls.
- Replace all functions that take both `block_context` and `tx_info` with
a single `TransactionContext`.
- Make `EntryPointExecutionContext` hold an `Arc<TransactionContext>`
  instead of both a block_context and `tx_info`: previously every entry
  point cloned the blockContext and generated a new tx_info, now they
  all share the same (identical) one.

* feat: add more constants to`VersionedConstants`

- Add gateway constants, these are only for transparency, and aren't
  used directly by the Blockifier whatsoever.
- Pass `validate_max_n_steps` into the blockifier via native_blockifier,
  to override versioned constants defaults.
- Sort json

* fix: remove dead code `block_context.rs` (starkware-libs#1423)

The module has already taken out of lib.rs in
`8ba2662f93999b526ef7fd0a7fc49d1314657184` (making this module
dead-code), but the file wasn't actually deleted there.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* fix: delete dead code block_execution.rs (starkware-libs#1425)

Was already removed from lib.rs.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* chore(execution): enforce nonzero gas prices (starkware-libs#1391)

Signed-off-by: Dori Medini <dori@starkware.co>

* refactor(execution)!: pre_process_block refactor for full_nodes simulate transaction (starkware-libs#1387)

* refactor(native_blockifier): flat fields in bouncerinfo (starkware-libs#1394)

* feat: add Starknet OS constants to `VersionedConstants` - unused

1. Currently not using the new consts, just adding
the deserialization logic and tests.
In upcoming commits this will replace the gas costs in `constants.rs`.

The idea is that values inside `cairo_constants` that are json objects,
that is, have the form:
```json
"step_gas_cost": {
  foo_cost: x,
  bar_cost: y,
  ...
}
```
should be parsed as:
```
step_gas_cost = foo_cost*x + bar_cost*y + ...,
```
where {x,y} must be unsigned integers (otherwise an error is thrown),
and where {foo_cost, bar_cost,...} must correspond to keys that
have already* been parsed in the JSON.

Note: JSON standard doesn't enforce order on the keys, but our
implementation does; we should consider using a format that ensures
order, rather than relying on serde's implementation and `IndexMap`.

2. validate the os costs on creation (except for in tests): under
this assumption `get_gas_cost` will _panic_ if given a non-whitelisted
gas cost name.

3. hide the two hashmaps inside `VersionedConstants`, they have
invariants, set accessors accordingly.

* chore(execution): saturate step bound on overflow (starkware-libs#1429)

Signed-off-by: Dori Medini <dori@starkware.co>

* feat(fee): add signature length to ActualCostBuilder (starkware-libs#1431)

* feat(execution): use gas costs only from `VersionedConstants`

- Remove from constants module and replace all usages with
  `VersionedConstants#gas_cost(..)`
  - Move all comments from the constants module into the const whitelist
    in `VersionedConstants`.
- Add gas cost getter to `EntryPointExecutionContext`, for readability
  - enclose in closure inside hint_processor.rs for even more brevity.
- Move `Transaction::Initial_gas` into `VersionedConstants`: it is now
  derived from the constants json.
- No other logic changes.

* feat(fee): add os resources to versioned constants

- Move hardcoded os resources json into the versioned constants json,
  move `OsResources` into into `OsResources` module.
- Indent versioned_constants.json at 4.
- Delete os_usage.rs: all logic is now called from methods in
  `VersionedConstants`(todo: extract into submodules, currently
  just a big module).
- Delete os_usage_test.rs: these are not post-deserialize validations of
  `OsResources`.
- sorted versioned_constants (where possible, which is everywhere except
  for inside os_constants keys).

* chore(execution): fix the tests using create_state_changes_for_test for readability and correctness (starkware-libs#1430)

* refactor(execution, native_blockifier): make TransactionExecutor.execute() work w/o Py objects (starkware-libs#1414)

* refactor(execution, native_blockifier): make TransactionExecutor.finalize() work without Py objects (starkware-libs#1418)

* refactor(execution, native_blockifier): decouple BouncerInfo from Python (starkware-libs#1428)

* refactor: split InnerCallExecutionError into CallContractExecutionError & LibraryCallExecutionError.
Add storage_address to both new types and class_hash to LibraryCallExecutionError (starkware-libs#1432)

* feat(execution): moved global max step limit to input validation (starkware-libs#1415)

Signed-off-by: Dori Medini <dori@starkware.co>

* test(execution): improve covrage of test_count_actual_storage_changes (starkware-libs#1436)

* refactor(execution): the struct state changes and state changes count (starkware-libs#1417)

* chore(fee): update os resources and fix expected

* fix(native_blockifier): fix unused imports (starkware-libs#1442)

* chore(execution): consume state_changes on state_changes_count from (starkware-libs#1443)

* feat(execution): calculate the syscall resources for every entry point (starkware-libs#1437)

* feat(execution): add entry_point_syscall_counter (starkware-libs#1407)

* refactor(execution): split get_additional_os_resources (starkware-libs#1411)

* feat(execution): add the syscall resources to vm_resources (starkware-libs#1412)

* fix(fee): fix doc of usize u128 conversions (starkware-libs#1446)

* fix: memory holes tests (starkware-libs#1451)

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* fix: remove unused dep ctor (starkware-libs#1455)

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* refactor(execution): replace StateChangesCount::from with state_changes.count() (starkware-libs#1452)

* refactor(transaction): make DeclareTransaction fields public (starkware-libs#1441)

* refactor: remove enum VirtualMachineExecutionError (starkware-libs#1453)

* fix(native_blockifier): fix build for mac + unused import (starkware-libs#1406)

* feat(fee): add ClassInfo struct (starkware-libs#1434)

* Merge `main-v0.13.1` into `main` (resolve conflicts).

* feat(fee): add GasVector to TransactionExecutionInfo (starkware-libs#1399)

* feat(fee): add DA GasVector to TransactionExecutionInfo

Signed-off-by: Dori Medini <dori@starkware.co>

* chore(fee): rename blob_gas to l1_data_gas

Signed-off-by: Dori Medini <dori@starkware.co>

* chore(fee): delete unused PyGasVector

Signed-off-by: Dori Medini <dori@starkware.co>

* refactor(execution): remove syscall_counter from ExecutionResources (starkware-libs#1424)

* Update syscall resources (starkware-libs#1459)

* fix: os resources (starkware-libs#1465)

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* feat(state): bouncer DA count: define StateWriteKeys (starkware-libs#1461)

* chore: alphabetize top level keys in versioned constants (starkware-libs#1466)

Co-authored-by: Gilad Chase <gilad@starkware.com>

* feat(state): bouncer DA count: use StateWriteKeys to count state diff size (starkware-libs#1462)

* refactor(execution, native_blockifier): move Bouncer to blockifier crate (starkware-libs#1445)

* refactor(transaction): use ClassInfo in Declare transaction (starkware-libs#1456)

* feat(fee): add gas cost for calldata bytes (starkware-libs#1426)

* chore: bump CI versions (starkware-libs#1473)

- Remove the deprecated `actions-rs/toolchain@v1` wherever it is still
  used.
- Bump everything to latest versions.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* refactor(execution): delete enrty point ExecutionResources (starkware-libs#1447)

* fix: limit the syscall emit_event resources, keys, data and number of events (starkware-libs#1463)

* fix(transaction): set l1 hanlder payload size to None for non-l1 hanlder txs (bouncer count) (starkware-libs#1470)

* feat(fee): charge for signatures per byte (starkware-libs#1474)

* Merge `main-v0.13.0-hotfix` into `main-v0.13.1` (resolve conflicts).

* feat(execution): round block_number and timestamp for the execution info syscall in validate_mode (starkware-libs#1467)

* feat(fee): add gas cost for code bytes (starkware-libs#1475)

* feat(fee): add events gas cost (starkware-libs#1458)

* chore(execution): increase invoke_tx_max_n_steps (starkware-libs#1477)

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* chore(fee): update vm resource and l2 resource costs (starkware-libs#1479)

* chore: upgrade cairo and sn-api versions (starkware-libs#1454)

* chore: upgrade cairo and sn-api versions

* chore: upgrade cairo and sn-api versions (starkware-libs#1460)

* fix: fix cargo.lock - remove cargo update (starkware-libs#1481)

* fix: undo cargo update from previous commit 984431a

* fix: update cargo.lock to take into account changes in 984431a

they wered reverted in previous commit.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* fix: fix versioned_constants.json

* chore(fee): small fixes (starkware-libs#1484)

* refactor(fee): moving calculate_tx_gas_usage_vector to ActualCostBuilder (starkware-libs#1478)

* Release v0.5.0-rc.1

* refactor(execution): remove fee weights from config (starkware-libs#1487)

* fix: update the event limit constants (starkware-libs#1483)

* Merge `main-v0.13.0-hotfix` into `main-v0.13.1` (resolve conflicts).

* refactor(execution, native_blockifier): move TransactionExecutor to blockifier (starkware-libs#1497)

* refactor(state): remove unnecessary derive (starkware-libs#1505)

* refactor(execution): move bouncer, block and block_test to blockifier dir (starkware-libs#1502)

* feat(fee): add n_events field to BouncerInfo (starkware-libs#1489)

* refactor: move the event size limit constants into versioned_constants (starkware-libs#1490)

* refactor(transaction): remove public fields, add new function (starkware-libs#1480)

* refactor(execution): type of additional_data in test_validate_accounts_tx (starkware-libs#1485)

* refactor: move validate_block_number_rounding and validate_timestamp_rounding to versioned_constants (starkware-libs#1506)

* test(execution): add get_execution_info scenario to test_validate_accounts_tx (starkware-libs#1486)

* test(execution): get_sequencer_address in test_validate_accounts_tx (starkware-libs#1496)

* refactor: use versioned_constants function when possible (starkware-libs#1508)

* test(execution): get_block_number and get_block_timestamp in test_validate_accounts_tx for Cairo0 (starkware-libs#1512)

* chore(fee): Update os resources to include 4844 calculations (starkware-libs#1498)

* refactor: replaced default_invoke_tx_args with macro that enforces to explicitly define max_fee (starkware-libs#1510)

* feat(fee): calculate n_events field for BouncerInfo in a naive way (starkware-libs#1499)

* fix: state trait does not require &mut self (starkware-libs#1325)

* fix: state trait does not require &mut self

fix: sachedState use interior mutability

* chore: remove clippy allow

* fix: small review fix

* fix: remove to_state_diff from StateApi (starkware-libs#1326)

* chore: merge branch main-v0.13.1 into main (resolve conflicts)

* feat: add merge_branches script (starkware-libs#1513)

* chore: bump compiler version to 2.6.0-rc.1 (starkware-libs#1525)

Signed-off-by: Dori Medini <dori@starkware.co>

* chore: move validate consts into os constants (starkware-libs#1523)

* chore: move validate consts into os constants

Had to bump serde_json due to some apparent bug with the recent stable
rust.

* feat: make 13_1 consts backwards compatible

Assign the following defaults for keys missing in versioned_constants
files (for example, they are missing in versioned_constants_13_0.json).

- EventSizeLimit => max values
- L2ResourceGasCosts => 0 values
- validate rounding numbers => 1 (to preserve past no-rounding
  behavior). This required bundling them up in a specialized struct in
  order to define a custom default as 1 (rather than 0).
- Add test for default values: required extracting validation logic of
  `OsResources` so it won't trigger automatically in tests.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* chore!: limit pointer width in both crates (starkware-libs#1527)

Signed-off-by: Dori Medini <dori@starkware.co>

* feat: backwards compatibility for calldata_factor

If os resources' inner tx is missing `constant` and `calldata_factor`
keys, then:
- assume it is a flat `ExecutionResources` instance, and put its
  contents inside a `constant` key.
- initialize calldata_factor as default (all zeros).

* feat: add versioned_constants_13_0.json (starkware-libs#1520)

Changes between this and the current versioned_constants:
- no `event_size_limit`
- invoke_tx_max_n_steps is 3_000_000 instead of 4_000_000
- no `l2_resource_gas_costs`
- multiple value changes in os_resources
- `vm_resource_fee_cost` is X2 for all values
- no constants for validate's block number and timestamp rounding

No other changes (in particular, os constants is indeed _unchanged_)

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* Merge `main-v0.13.1` into `main` (resolve conflicts).

* fix: versioned constants validate (starkware-libs#1537)

- validate invocation had a syntax error, which was hidden by the cfg
- remove `testing` from the cfg, since we all compile with `testing`
  during development, and it's just not what we want.

Co-Authored-By: Gilad Chase <gilad@starkware.com>

* fix: update the tx event limit constants (starkware-libs#1517)

* chore: release 0.5.0-rc.2: 13_0.json support

* fix: generate_starknet_os_resources python target fix (starkware-libs#1541)

* No conflicts in main-v0.13.1 -> main merge, this commit is for any change needed to pass the CI.

* fix: generate_starknet_os_resources python target fix (starkware-libs#1548)

* refactor: remove some magic numbers from tests (starkware-libs#1547)

* fix!: update max_contract_bytecode_size to 81k (starkware-libs#1549)

* chore: add merge_status.py script (starkware-libs#1543)

Signed-off-by: Dori Medini <dori@starkware.co>

* chore: merge branch main-v0.13.1 into main (resolve conflicts)

* ci: advance setup-python action version (starkware-libs#1555)

* refactor(native_blockifier): rename l1_gas_amount to gas_weight in bouncerInfo (starkware-libs#1524)

* chore: release v0.5.0-rc.3

* chore: panic if u128_from_usize fails (starkware-libs#1522)

Signed-off-by: Dori Medini <dori@starkware.co>

* refactor: make StateError::UndeclaredClassHash a one-line error (starkware-libs#1563)

Change previous error which prints out as:
```
Class with hash ClassHash(
    StarkFelt(
        "0x00000000000000000000000000000000000000000000000000000000000004d2",
    ),
) is not declared.
```
into:
```
Class with hash 0x00000000000000000000000000000000000000000000000000000000000004d2 is not declared.
```

* test(fee): test get_message_segment_length function (starkware-libs#1471)

* refactor: add BlockWeights for the future bouncer (starkware-libs#1444)

* refactor: remove f64 usage at blockifier (starkware-libs#1519)

* fix: unwrap called on u128 (starkware-libs#1570)

Signed-off-by: Dori Medini <dori@starkware.co>

* test: use FeatureContract in create_test_state and tests which uses it (starkware-libs#1556)

* No conflicts in main-v0.13.1 -> main merge, this commit is for any change needed to pass the CI.

* chore: remove final f64s (starkware-libs#1574)

Signed-off-by: Dori Medini <dori@starkware.co>

* chore: remove some 'as' conversions and enforce no 'as' conversions (starkware-libs#1575)

* chore: remove final f64s

Signed-off-by: Dori Medini <dori@starkware.co>

* chore: remove some 'as' conversions and enforce no 'as' conversions

Signed-off-by: Dori Medini <dori@starkware.co>

* Restore workflow

* Rename ci

* Add commit lint rules

* nightly format

* update .env

* Test global env and composite action

* attemp fix to composite action

* Minor fix

* Modify .github structure

* Add composite action to jobs?

* Minor yaml fix

* Fix compilation errors

* WIP

* Storage_read_write_gas

* add tests for vm & native

* modify test_get_execution_info

* Review tests

* rename syscalls_test.rs -> syscall_tests.rs

* Fix minor compilation bug

* Update dependencies

---------

Signed-off-by: Dori Medini <dori@starkware.co>
Co-authored-by: Dori Medini <dori@starkware.co>
Co-authored-by: Gilad Chase <gilad@starkware.com>
Co-authored-by: giladchase <gilad@starkware.co>
Co-authored-by: Lior Goldberg <lior@starkware.co>
Co-authored-by: liorgold2 <38202661+liorgold2@users.noreply.github.com>
Co-authored-by: Arnon Hod <arnon@starkware.co>
Co-authored-by: Elin Tulchinsky <elin@starkware.co>
Co-authored-by: OriStarkware <76900983+OriStarkware@users.noreply.github.com>
Co-authored-by: Ayelet Zilber <138376632+ayeletstarkware@users.noreply.github.com>
Co-authored-by: zuphitf <51879558+zuphitf@users.noreply.github.com>
Co-authored-by: aner-starkware <147302140+aner-starkware@users.noreply.github.com>
Co-authored-by: Noa Oved <104720318+noaov1@users.noreply.github.com>
Co-authored-by: Yoni <78365039+Yoni-Starkware@users.noreply.github.com>
Co-authored-by: YaelD <70628564+Yael-Starkware@users.noreply.github.com>
Co-authored-by: mohammad-starkware <130282237+MohammadNassar1@users.noreply.github.com>
Co-authored-by: barak-b-starkware <110763103+barak-b-starkware@users.noreply.github.com>
Co-authored-by: Lucas @ StarkWare <70894690+LucasLvy@users.noreply.github.com>
Co-authored-by: dafnamatsry <92669167+dafnamatsry@users.noreply.github.com>
Co-authored-by: avi-starkware <avi.cohen@starkware.co>
Co-authored-by: Tzahi <tzahi@starkware.co>
Co-authored-by: nimrod-starkware <143319383+nimrod-starkware@users.noreply.github.com>
Co-authored-by: Timothée Delabrouille <34384633+tdelabro@users.noreply.github.com>
Co-authored-by: Barak <barakb@starkware.co>
Co-authored-by: Yonatan Iluz <yonatan@starkware.co>
Co-authored-by: Rodrigo <rodrodpino@gmail.com>
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.

5 participants