-
Notifications
You must be signed in to change notification settings - Fork 166
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
fix: transaction hash computation #1303
Conversation
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
7 similar comments
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
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.
Made some comments
...arknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc
Outdated
Show resolved
Hide resolved
...arknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc
Outdated
Show resolved
Hide resolved
@@ -222,7 +223,7 @@ Where: | |||
|
|||
- `l1_handler` is a constant prefix, encoded in bytes (ASCII), as big-endian. | |||
- `chain_id` is a constant value that specifies the network to which this transaction is sent. | |||
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash | |||
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash (note that since we're hashing an array, the # of inputs needs to be appended to the hash). |
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.
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash (note that since we're hashing an array, the # of inputs needs to be appended to the hash). | |
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash. Be aware that because an array is hashed, you need to append the number of inputs to the hash. |
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.
If it's a serialized array, appended
may be misleading. The length of the array must be the first element of the array to be hashed.
[len, c1, c2, c3, ...]
.
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.
@glihm Good catch. How about this:
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash (note that since we're hashing an array, the # of inputs needs to be appended to the hash). | |
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash. Be aware that because an array is hashed, the length of the array must be the first element of the array. |
...arknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc
Outdated
Show resolved
Hide resolved
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.
@odednaor I made a couple of change requests.
...arknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc
Outdated
Show resolved
Hide resolved
@@ -209,10 +209,11 @@ The hash of the corresponding L1 handler transaction on L2 is computed as follow | |||
---- | |||
l1_handler_tx_hash = ℎ( | |||
"l1_handler", | |||
version, | |||
version, // at the moment only version 0 is supported | |||
contract_address, | |||
entry_point_selector, | |||
ℎ(calldata), |
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.
ℎ(calldata), | |
_h_(calldata), |
Co-authored-by: odednaor <odednaor@gmail.com>
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.
@odednaor Please check my suggestion for line 227. It should be clear who/what is appending the number of inputs to the hash.
@@ -222,7 +223,7 @@ Where: | |||
|
|||
- `l1_handler` is a constant prefix, encoded in bytes (ASCII), as big-endian. | |||
- `chain_id` is a constant value that specifies the network to which this transaction is sent. | |||
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash | |||
- _h_ is the xref:architecture-and-concepts:cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash (note that since we're hashing an array, the # of inputs needs to be appended to the hash). |
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.
If it's a serialized array, appended
may be misleading. The length of the array must be the first element of the array to be hashed.
[len, c1, c2, c3, ...]
.
@@ -221,8 +222,9 @@ l1_handler_tx_hash = ℎ( | |||
Where: | |||
|
|||
- `l1_handler` is a constant prefix, encoded in bytes (ASCII), as big-endian. | |||
- `version` is the transaction version. Only version 0 is currently supported. |
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.
We may refer to the new table to have this being true forever, even if a new version shows up?
...arknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc
Show resolved
Hide resolved
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.
@ArielElp There a few comments and suggestions. PTAL.
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
4 similar comments
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1303/ . |
None of the comments and suggestions seemed crucial and @ArielElp is OOO until September
Description of the Changes
Minor fixes to transaction hashes computation
PR Preview URL
After you push a commit to this PR, a preview is built and a URL to the root of the preview appears in the comment feed.
Paste here the specific URL(s) of the content that this PR addresses.
Check List
<docs/feat/fix/chore>(optional scope): <description>
, e.g:fix: minor typos in code
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)