starknet-docs
starknet-docs copied to clipboard
docs: Updates to Messaging mechanism
Description of the Changes
Updates implemented in PR #857, minus questions/comments that are still unanswered or TBD.
PR Preview URL
Check List
- [x] Changes have been done against main branch, and PR does not conflict
- [x] PR title follows the convention:
<docs/feat/fix/chore>(optional scope): <description>
, e.g:fix: minor typos in code
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/ .
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/ .
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 23 at r3 (raw file):
. During the execution of a transaction, a contract on Starknet sends a message from L2 to L1 by calling the `send_message_to_L1` syscall. . The sequencer attaches the message parameters to the state update that includes the syscall invocation. The message parameters include the address of the recipient contract on L1 and the message data.
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.
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 23 at r3 (raw file):
. During the execution of a transaction, a contract on Starknet sends a message from L2 to L1 by calling the `send_message_to_L1` syscall. . The sequencer attaches the message parameters to the state update that includes the syscall invocation. The message parameters include the address of the recipient contract on L1 and the message data.
Oh wait, do you mean the parameters of the send_message_to_l1_syscall
(as in the example below), or the parameters of the message itself as it appears in the block? From the first sentence of this bullet, it seems you mean the block / state update and it does include the sender address as well.
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 23 at r3 (raw file):
Previously, avi-starkware wrote…
Oh wait, do you mean the parameters of the
send_message_to_l1_syscall
(as in the example below), or the parameters of the message itself as it appears in the block? From the first sentence of this bullet, it seems you mean the block / state update and it does include the sender address as well.
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. (Use a chrome extension such as JSON Formatting, to see the json in a readable format in the browser.)
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 54 at r3 (raw file):
[#diagram_l2-l1_messaging_mechanism] .L2->L1 Messaging mechanism image::l2l1.png[L2->L1 message mechanism]
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]
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.
Suggestion:
`from_address` (`felt252`):: The address of the L2 contract sending the message.
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 105 at r3 (raw file):
. The L1 Handler transaction that was created in the previous step is added to a proof. . The Core Contract receives the state update. . The message is cleared from the Core Contract's storage. At this point, the message is handled.
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?
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/ .
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1244/documentation/ .
components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/messaging-mechanism.adoc
line 23 at r3 (raw file):
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. (Use a chrome extension such as JSON Formatting, to see the json in a readable format in the browser.)
Sorry, this is the block I meant to refer you to, and this is the corresponding state update.
Look at transaction 0xecd259e52ef5061081559c80c0b5f1560caaca7f198a6bf90a74d866593b1
to find a non-empty message.
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/ .
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/ .