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

build(fee): current tx_info holds validResourceBounds #505

Merged

Conversation

nimrod-starkware
Copy link
Contributor

@nimrod-starkware nimrod-starkware commented Aug 19, 2024

This change is Reviewable

Copy link
Contributor Author

@nimrod-starkware nimrod-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 5 files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)


crates/blockifier/src/execution/syscalls/hint_processor.rs line 480 at r1 (raw file):

                    l2_gas_as_felt,
                    Felt::ZERO,
                    Felt::ZERO,

WDYT?
l2_gas should always be zero.

Code quote:

                    l2_gas_as_felt,
                    Felt::ZERO,
                    Felt::ZERO,

crates/blockifier/src/transaction/transactions.rs line 299 at r1 (raw file):

                TransactionInfo::Current(CurrentTransactionInfo {
                    common_fields,
                    resource_bounds: tx.resource_bounds.0.clone().try_into().expect("todo"),

treated in an upper branch on the stack

Code quote:

try_into().expect("todo")

crates/blockifier/src/transaction/transactions.rs line 404 at r1 (raw file):

                TransactionInfo::Current(CurrentTransactionInfo {
                    common_fields,
                    resource_bounds: tx.resource_bounds.0.clone().try_into().expect("todo"),

ditto

Code quote:

0.clone().try_into().expect("todo"),

crates/blockifier/src/transaction/transactions.rs line 522 at r1 (raw file):

                TransactionInfo::Current(CurrentTransactionInfo {
                    common_fields,
                    resource_bounds: tx.resource_bounds.0.clone().try_into().expect("todo"),

ditto

Code quote:

.0.clone().try_into().expect("todo"),

@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch from 643aa9e to dfa48cb Compare August 19, 2024 11:43
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/rename_resource_bounds_mapping branch from 24e0819 to b1beef0 Compare August 19, 2024 11:55
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch from dfa48cb to 284b275 Compare August 19, 2024 11:55
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/rename_resource_bounds_mapping branch from b1beef0 to 8139ddb Compare August 19, 2024 12:38
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch 2 times, most recently from 5c1091f to 656eb85 Compare August 19, 2024 13:16
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/rename_resource_bounds_mapping branch from 8139ddb to 59b3b0b Compare August 20, 2024 08:38
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch 2 times, most recently from 69c29c6 to c8be06a Compare August 20, 2024 08:52
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 2 of 5 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @nimrod-starkware, @noaov1, and @TzahiTaub)


crates/blockifier/src/execution/syscalls/hint_processor.rs line 480 at r1 (raw file):

Previously, nimrod-starkware wrote…

WDYT?
l2_gas should always be zero.

I like it.
@noaov1 ?


crates/blockifier/src/execution/syscalls/hint_processor.rs line 209 at r2 (raw file):

pub const L2_GAS: &str = "0x00000000000000000000000000000000000000000000000000004c325f474153";
// "L1_DATA_GAS"
pub const L1_DATA_GAS: &str = "0x0000000000000000000000000000000000000000004c315f444154415f474153";

how did you compute this?
i see there is no test for these values... is it simple to add?

Code quote:

// "L1_DATA_GAS"
pub const L1_DATA_GAS: &str = "0x0000000000000000000000000000000000000000004c315f444154415f474153";

crates/blockifier/src/transaction/objects.rs line 142 at r2 (raw file):

        match self.resource_bounds {
            ValidResourceBounds::L1Gas(bounds) => Ok(bounds),
            ValidResourceBounds::AllResources { .. } => todo!(),

why todo? you can implement now

Suggestion:

 ValidResourceBounds::AllResources { l1_gas, .. } => l1_gas,

crates/blockifier/src/transaction/transactions.rs line 299 at r1 (raw file):

Previously, nimrod-starkware wrote…

treated in an upper branch on the stack

I think it's redundant... you can implement this in this PR,
however if this messes up your stack, LMK and I'll unblock


crates/blockifier/src/transaction/transactions.rs line 404 at r1 (raw file):

Previously, nimrod-starkware wrote…

ditto

ditto


crates/blockifier/src/transaction/transactions.rs line 522 at r1 (raw file):

Previously, nimrod-starkware wrote…

ditto

ditto

Copy link
Collaborator

@dorimedini-starkware dorimedini-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: all files reviewed, 6 unresolved discussions (waiting on @nimrod-starkware, @noaov1, and @TzahiTaub)


crates/blockifier/src/transaction/objects.rs line 142 at r2 (raw file):

Previously, dorimedini-starkware wrote…

why todo? you can implement now

also, I see it isn't implemented at the top of the stack either

Copy link
Collaborator

@dorimedini-starkware dorimedini-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: all files reviewed, 7 unresolved discussions (waiting on @nimrod-starkware, @noaov1, and @TzahiTaub)


crates/blockifier/src/transaction/objects.rs line 144 at r2 (raw file):

            ValidResourceBounds::AllResources { .. } => todo!(),
        }
    }

this function always succeeds (or panics, but after implementing you will always succeed).
No need to return a Result

Suggestion:

    pub fn l1_resource_bounds(&self) -> ResourceBounds {
        match self.resource_bounds {
            ValidResourceBounds::L1Gas(bounds) => bounds,
            ValidResourceBounds::AllResources { .. } => todo!(),
        }
    }

@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/rename_resource_bounds_mapping branch from 59b3b0b to f902df7 Compare August 20, 2024 10:10
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch from c8be06a to fa091b8 Compare August 20, 2024 10:10
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 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: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, @noaov1, and @TzahiTaub)


crates/mempool_test_utils/src/starknet_api_test_utils.rs line 52 at r12 (raw file):

Previously, nimrod-starkware wrote…

I reverted VALID_L2_GAS_MAX_AMOUNT & VALID_L2_GAS_MAX_PRICE_PER_UNIT.
VALID_L1_DATA_GAS_MAX_AMOUNT & VALID_L1_DATA_GAS_MAX_PRICE_PER_UNIT is a copy paste.
IDK if it makes sense... @MohammadNassar1 ?

These are the values used for testing, specifically the L2 values that I recently added.
We used these values to establish resource bounds for testing. I believe no change is necessary here.

@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/remove_from_rpc branch from abe3c27 to 394bd85 Compare August 26, 2024 08:11
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch from ab8f232 to 00cdc07 Compare August 26, 2024 08:11
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 5 of 5 files at r14, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @MohammadNassar1, @nimrod-starkware, @noaov1, and @TzahiTaub)

Copy link
Collaborator

@dorimedini-starkware dorimedini-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 r15, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @MohammadNassar1, @nimrod-starkware, @noaov1, and @TzahiTaub)


crates/blockifier/src/execution/syscalls/hint_processor.rs line 209 at r15 (raw file):

pub const L2_GAS: &str = "0x00000000000000000000000000000000000000000000000000004c325f474153";
// "L1_DATA";
pub const L1_DATA: &str = "0x000000000000000000000000000000000000000000000000004c315f44415441";

why drop the _GAS?

Code quote:

// "L1_DATA";
pub const L1_DATA: &str = "0x000000000000000000000000000000000000000000000000004c315f44415441";

Copy link
Contributor Author

@nimrod-starkware nimrod-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: all files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware, @MohammadNassar1, @noaov1, and @TzahiTaub)


crates/blockifier/src/execution/syscalls/hint_processor.rs line 209 at r15 (raw file):

Previously, dorimedini-starkware wrote…

why drop the _GAS?

Discussed it with @AvivYossef-starkware .
L1_DATA_GAS introduces some overflow (he can explain better what that is)

Copy link
Collaborator

@dorimedini-starkware dorimedini-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: all files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware, @MohammadNassar1, @nimrod-starkware, @noaov1, and @TzahiTaub)


crates/blockifier/src/execution/syscalls/hint_processor.rs line 209 at r15 (raw file):

Previously, nimrod-starkware wrote…

Discussed it with @AvivYossef-starkware .
L1_DATA_GAS introduces some overflow (he can explain better what that is)

@AvivYossef-starkware can you explain?

@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/remove_from_rpc branch from 394bd85 to 49b37f8 Compare August 27, 2024 07:24
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch from 582f4b3 to cf259fe Compare August 27, 2024 07:24
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 2 of 2 files at r16, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware, @MohammadNassar1, @nimrod-starkware, @noaov1, and @TzahiTaub)

Copy link
Contributor

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

Copy link
Collaborator

@dorimedini-starkware dorimedini-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:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)

Copy link
Collaborator

@dorimedini-starkware dorimedini-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 1 files at r17, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)

Copy link
Contributor Author

nimrod-starkware commented Aug 28, 2024

Merge activity

@nimrod-starkware nimrod-starkware changed the base branch from nimrod/resources_enum/remove_from_rpc to graphite-base/505 August 28, 2024 13:25
@nimrod-starkware nimrod-starkware changed the base branch from graphite-base/505 to main August 28, 2024 13:26
@nimrod-starkware nimrod-starkware force-pushed the nimrod/resources_enum/hold_validResourceBounds branch from 50712c6 to 6364dcd Compare August 28, 2024 13:26
@nimrod-starkware nimrod-starkware merged commit c0a128c into main Aug 28, 2024
26 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 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