-
Notifications
You must be signed in to change notification settings - Fork 196
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: Updates to Messaging mechanism #1244
Conversation
…et-docs into steve/L1-L2_messaging
…twork_Architecture/messaging-mechanism.adoc
…ll unanswered or TBD.
d8c15d9
to
7f54e8e
Compare
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
1 similar comment
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Suggestion: . The sequencer attaches the message parameters to the state update that includes the syscall invocation. The message parameters include the address of the sender on L2, the address of the recipient contract on L1, and the message data. |
Oh wait, do you mean the parameters of the |
Previously, avi-starkware wrote…
I'm am not sure about your terminology, but to be more exact, only the block contains the L2 -> L1 messages. The state update only contains the root, storage diffs, nonces, and deployed classes. Here's an example for a state update that has messages, and this is the corresponding block. You can see the messages appear in the json of the block in this example, but not in the corresponding state update. |
Should the numbers in red circles refer to the items above? I think they are mismatched. Code quote: xref:#diagram_l2-l1_messaging_mechanism[] illustrates this flow:
[#diagram_l2-l1_messaging_mechanism]
.L2->L1 Messaging mechanism
image::l2l1.png[L2->L1 message mechanism] |
Suggestion: `from_address` (`felt252`):: The address of the L2 contract sending the message. |
This step also incurs a fee that is similar to the fee charged for L2 -> L1 messages (this is mentioned for L2 -> L1 messages in the NOTE above):
I think these costs are not actually being charged, though... Code quote: . The message is cleared from the Core Contract's storage. At this point, the message is handled. |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
1 similar comment
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Previously, avi-starkware wrote…
Sorry, this is the block I meant to refer you to, and this is the corresponding state update. Look at transaction |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
There was a problem hiding this 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 r1, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ArielElp and @stoobie)
There was a problem hiding this 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, 4 unresolved discussions (waiting on @ArielElp and @avi-starkware)
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 54 at r3 (raw file):
Previously, avi-starkware wrote…
Should the numbers in red circles refer to the items above? I think they are mismatched.
Yeah, I have to update the diagram. I'm going to do that in a separate PR.
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 63 at r3 (raw file):
[horizontal,labelwidth="30",role="stripes-odd"] from_address (`felt252`):: The address of the L2 contract sending the message.
Done.
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 105 at r3 (raw file):
Previously, avi-starkware wrote…
This step also incurs a fee that is similar to the fee charged for L2 -> L1 messages (this is mentioned for L2 -> L1 messages in the NOTE above):
- 5000 gas for clearing the L1 storage to consume the message (instead of the 20000 charged for L2 -> L1 messages).
- This also emits an L1 event logging this consumption.
I think these costs are not actually being charged, though...
@ArielElp, what exactly happens when charging L1 handler fees?
@avi-starkware Is this not covered already in https://starknet-io.github.io/starknet-docs/pr-1244/documentation/architecture_and_concepts/Network_Architecture/messaging-mechanism/#l1_l2_message_structure?
There was a problem hiding this 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, 2 unresolved discussions (waiting on @ArielElp and @stoobie)
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 105 at r3 (raw file):
I don't see it there. All it says is
The fee itself is calculated in the same manner as "regular" L2 transactions. You can use the CLI to get an estimate of an L1 → L2 message fee.
But as I said above, I know that additional L1 costs are added to the calculation, and it's not just the normal fee calculation for "regular" transactions.
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
6 similar comments
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
…->L2 message is handled.
There was a problem hiding this 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 2 files reviewed, 2 unresolved discussions (waiting on @ArielElp and @avi-starkware)
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 23 at r3 (raw file):
@avi-starkware So is this correct:
The sequencer attaches the message parameters to the block that includes the syscall invocation.
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 105 at r3 (raw file):
@avi-starkware I changed this line as follows:
. The message is cleared from the Core Contract's storage to consume the message. Clearing the Core Contract's storage does the following:
- incurs a fixed cost of 5,000 gas
- emits an L1 event logging the message consumption
I'm checking on whether we actually charge the fee.
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ . |
There was a problem hiding this 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 r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArielElp)
* Clarifying messaging-mechanism.adoc. * Merge branch 'dev' into steve/L1-L2_messaging * Removed extraneous space. * Use Cairo for source block label. * Added messaging-reference.adoc * Merge branch 'dev' into steve/L1-L2_messaging * Merge branch 'dev' into steve/L1-L2_messaging * Merge branch 'dev' into steve/L1-L2_messaging * More questions. * Minor edits. * Merge branch 'dev' into steve/L1-L2_messaging * Close some open questions. * Merge branch 'steve/L1-L2_messaging' of github.com:starknet-io/starknet-docs into steve/L1-L2_messaging * Clarification edits. * Clarification edits. * Merge branch 'master' into steve/L1-L2_messaging * Edits. * Edits. * Edits. * Edits. * Merge branch 'main' into steve/L1-L2_messaging * Update components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc * Merge branch 'main' into steve/L1-L2_messaging * More edits. * Merge branch 'main' into steve/L1-L2_messaging * Updates implemented in PR #857, minus questions/comments that are still unanswered or TBD. * Added intro content from the Cairo Book topic on messaging. * Added intro content from the Cairo Book topic on messaging. * SME comments * Added fixed 5,000 gas fee for clearing Core Contract storage after L1->L2 message is handled. Co-Authored-By: JameStark <[email protected]>
Description of the Changes
Updates implemented in PR #857, minus questions/comments that are still unanswered or TBD.
PR Preview URL
L1-L2 Messaging mechanism
Check List
<docs/feat/fix/chore>(optional scope): <description>
, e.g:fix: minor typos in code
This change is