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

docs: Clarifying info on the compiled class hash. #1067

Merged
merged 3 commits into from
Jan 30, 2024

Conversation

stoobie
Copy link
Collaborator

@stoobie stoobie commented Jan 4, 2024

Description of the Changes

Questions to answer about the compiled class hash

PR Preview URL

https://starknet-io.github.io/starknet-docs/pr-1067/documentation/architecture_and_concepts/Network_Architecture/starknet-state/#classes_trie

Paste here the specific URL(s) of the content that this PR addresses.

Check List

  • Changes have been done against main branch, and PR does not conflict
  • PR title follows the convention: <docs/feat/fix/chore>(optional scope): <description>, e.g: fix: minor typos in code

This change is Reviewable

Copy link

github-actions bot commented Jan 4, 2024

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

@stoobie stoobie force-pushed the steve/explain_compiled_class_hash branch 2 times, most recently from a7c93ea to 906bf7e Compare January 4, 2024 14:12
Copy link

github-actions bot commented Jan 4, 2024

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

@stoobie stoobie force-pushed the steve/explain_compiled_class_hash branch from 906bf7e to 0023b08 Compare January 4, 2024 14:34
Copy link

github-actions bot commented Jan 4, 2024

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

@stoobie stoobie force-pushed the steve/explain_compiled_class_hash branch from 0023b08 to 48c5303 Compare January 4, 2024 14:39
Copy link

github-actions bot commented Jan 4, 2024

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .


* It sounds like the prover decodes the hash to get that information. Is that correct---Can the prover decode the hash to get that information?
+
Or is the Casm also stored in Starknet storage, and the compiled class hash is an identifier for the leaf in the trie that also includes the storage address for the Casm code?
Copy link
Contributor

Choose a reason for hiding this comment

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

It depends on what you call the StarknetStorage.
The Casm is stored by the sequencer, we load it to execute the contract entrypoints.
But it is not in the Starknet State (aka what is pushed to l1). So the .casm contracts are not part of the storage trie. Only their hash is.

. The sequencer assembles the Casm from the Sierra code, stores it on the Starknet blockchain's storage, and generates a hash of the compiled class.
--
+
This doesn't make sense, though, because when submitting the `DECLARE` transaction to declare the class, which is before you have the compiled class hash, you need to specify the `compiled_class_hash` as a transaction fied. Sounds like a Catch 22.
Copy link
Contributor

@tdelabro tdelabro Jan 4, 2024

Choose a reason for hiding this comment

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

The idea is for the caller to have on his side both the sierra and the casm hash, and submit both in his tx, along with the sierra code.
The sequencer compiles Sierra to casm then checks that the casm code outputted is the one the user really intended to deploy by computing the hash of his casm output and making sure it is the same as the one passed in the tx.

. The sequencer assembles the Casm from the Sierra code, stores it on the Starknet blockchain's storage, and generates a hash of the compiled class.
--
+
This doesn't make sense, though, because when submitting the `DECLARE` transaction to declare the class, which is before you have the compiled class hash, you need to specify the `compiled_class_hash` as a transaction fied. Sounds like a Catch 22.
Copy link
Contributor

Choose a reason for hiding this comment

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

typos warning: "fied" should be "field".

Suggested change
This doesn't make sense, though, because when submitting the `DECLARE` transaction to declare the class, which is before you have the compiled class hash, you need to specify the `compiled_class_hash` as a transaction fied. Sounds like a Catch 22.
This doesn't make sense, though, because when submitting the `DECLARE` transaction to declare the class, which is before you have the compiled class hash, you need to specify the `compiled_class_hash` as a transaction field. Sounds like a Catch 22.

@stoobie stoobie requested a review from ArielElp January 7, 2024 09:27
@stoobie stoobie force-pushed the steve/explain_compiled_class_hash branch from 48c5303 to bd77967 Compare January 10, 2024 14:45
Copy link

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

Copy link

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

Copy link

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

@stoobie stoobie force-pushed the steve/explain_compiled_class_hash branch from 6415912 to bc419f6 Compare January 29, 2024 13:21
Copy link

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

Copy link

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

…art_Contracts/class-hash.adoc


Revert typo in id of class-hash.adoc
@stoobie stoobie requested a review from tdelabro January 30, 2024 08:15
Copy link

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1067/documentation/ .

Copy link
Collaborator

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

:lgtm:

Reviewed 1 of 2 files at r4, 1 of 1 files at r5.
Reviewable status: 2 of 3 files reviewed, 8 unresolved discussions (waiting on @ArielElp, @stoobie, and @tdelabro)

@stoobie stoobie merged commit b504810 into main Jan 30, 2024
2 of 4 checks passed
@stoobie stoobie deleted the steve/explain_compiled_class_hash branch January 30, 2024 11:03
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