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

feat(starknet_os): implement hint cache_contract_storage_request_key #4630

Open
wants to merge 4 commits into
base: aner/hint_write_old_block_to_storage
Choose a base branch
from

Conversation

aner-starkware
Copy link
Contributor

No description provided.

@aner-starkware aner-starkware self-assigned this Mar 4, 2025
@reviewable-StarkWare
Copy link

This change is Reviewable

@aner-starkware aner-starkware force-pushed the aner/hint_cache_contract_storage_request_key branch 2 times, most recently from e1548f5 to b7c2297 Compare March 4, 2025 08:43
@aner-starkware aner-starkware force-pushed the aner/hint_write_old_block_to_storage branch from eb759e7 to ee0b4d4 Compare March 4, 2025 09:07
@aner-starkware aner-starkware force-pushed the aner/hint_cache_contract_storage_request_key branch from b7c2297 to f976926 Compare March 4, 2025 09:07
@aner-starkware aner-starkware force-pushed the aner/hint_write_old_block_to_storage branch from ee0b4d4 to 26a342b Compare March 4, 2025 09:26
@aner-starkware aner-starkware force-pushed the aner/hint_cache_contract_storage_request_key branch from f976926 to 39c733c Compare March 4, 2025 09:35
@aner-starkware aner-starkware force-pushed the aner/hint_write_old_block_to_storage branch from 26a342b to 4abdd91 Compare March 4, 2025 09:37
@aner-starkware aner-starkware force-pushed the aner/hint_cache_contract_storage_request_key branch 2 times, most recently from 305603c to 2501cd5 Compare March 4, 2025 10:39
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 3 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nimrod-starkware)


crates/starknet_os/src/hints/error.rs line 34 at r2 (raw file):

    InconsistentValue { actual: Felt, expected: Felt },
    #[error(transparent)]
    StarknetApi(#[from] StarknetApiError),

keep these alphabetized

Code quote:

    #[error("{error:?} for json value {value}.")]
    SerdeJsonError { error: serde_json::Error, value: serde_json::value::Value },
    #[error("Inconsistent storage value. Actual: {actual}, expected: {expected}.")]
    InconsistentValue { actual: Felt, expected: Felt },
    #[error(transparent)]
    StarknetApi(#[from] StarknetApiError),

crates/starknet_os/src/hints/vars.rs line 54 at r2 (raw file):

    CompressedStart,
    ContractStateChanges,
    ContractAddress,

Suggestion:

    ContractAddress,
    ContractStateChanges,

crates/starknet_os/src/hints/vars.rs line 80 at r2 (raw file):

            Ids::CompressedStart => "compressed_start",
            Ids::ContractStateChanges => "contract_state_changes",
            Ids::ContractAddress => "contract_address",

swap order

Code quote:

            Ids::ContractStateChanges => "contract_state_changes",
            Ids::ContractAddress => "contract_address",

Copy link
Contributor Author

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


crates/starknet_os/src/hints/error.rs line 34 at r2 (raw file):

Previously, dorimedini-starkware wrote…

keep these alphabetized

Done.


crates/starknet_os/src/hints/vars.rs line 80 at r2 (raw file):

Previously, dorimedini-starkware wrote…

swap order

Done.


crates/starknet_os/src/hints/vars.rs line 54 at r2 (raw file):

    CompressedStart,
    ContractStateChanges,
    ContractAddress,

Done.

Copy link
Contributor

@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: 1 of 3 files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware)


crates/starknet_os/src/hints/hint_implementation/execution.rs line 323 at r2 (raw file):

        ids_data,
        Ids::Request,
        CairoStruct::DictAccess,

This isn't the right type, the type is StorageReadRequest*.
The function i wrote does not support the case where the base struct is a pointer.
Let me first solve it

Code quote:

CairoStruct::DictAccess

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 r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware)


crates/starknet_os/src/hints/hint_implementation/execution.rs line 323 at r2 (raw file):

Previously, nimrod-starkware wrote…

This isn't the right type, the type is StorageReadRequest*.
The function i wrote does not support the case where the base struct is a pointer.
Let me first solve it

WDYM? don't you support it? you have logic to remove the * and dereference, no?

Copy link
Contributor

@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, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/starknet_os/src/hints/hint_implementation/execution.rs line 323 at r2 (raw file):

Previously, dorimedini-starkware wrote…

WDYM? don't you support it? you have logic to remove the * and dereference, no?

But it works only for the nested fields

Copy link
Contributor

@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, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/starknet_os/src/hints/hint_implementation/execution.rs line 323 at r2 (raw file):

Previously, nimrod-starkware wrote…

But it works only for the nested fields

If i have for example ids.x.y
and x is a pointer, adding the offset of y won't give me anything.

@aner-starkware aner-starkware force-pushed the aner/hint_write_old_block_to_storage branch 2 times, most recently from 3452828 to e530163 Compare March 4, 2025 15:08
@aner-starkware aner-starkware force-pushed the aner/hint_cache_contract_storage_request_key branch from d66624c to 9597e79 Compare March 4, 2025 15:13
@aner-starkware
Copy link
Contributor Author

crates/starknet_os/src/hints/hint_implementation/execution.rs line 323 at r2 (raw file):

Previously, nimrod-starkware wrote…

If i have for example ids.x.y
and x is a pointer, adding the offset of y won't give me anything.

@nimrod-starkware you mean like this? If not, how do I make a pointer type?

@aner-starkware aner-starkware force-pushed the aner/hint_write_old_block_to_storage branch from e530163 to 706d7b2 Compare March 4, 2025 15:48
@aner-starkware aner-starkware force-pushed the aner/hint_cache_contract_storage_request_key branch from 5d748ad to 197dc81 Compare March 4, 2025 15:48
Copy link
Contributor

@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 3 files reviewed, 1 unresolved discussion (waiting on @aner-starkware and @dorimedini-starkware)


crates/starknet_os/src/hints/hint_implementation/execution.rs line 323 at r2 (raw file):

Previously, aner-starkware wrote…

@nimrod-starkware you mean like this? If not, how do I make a pointer type?

exactly :)

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 2 files at r6, 2 of 2 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @aner-starkware)

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