Skip to content

Commit

Permalink
docs: Clarify that event_commitment and transaction_commitment ha…
Browse files Browse the repository at this point in the history
…ve separate trees. (#902)

* Clarify that `event_commitment` and `transaction_commitment` have separate trees.

* Update components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/header.adoc

* Update components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/header.adoc

* Update components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/header.adoc

* Fixed some stem formatting.

* Update components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/header.adoc

* Minor edits

* Update components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/header.adoc
  • Loading branch information
stoobie authored Nov 28, 2023
1 parent cced478 commit e8b672e
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[id="block_structure"]
= Block structure

In Starknet, the block is defined as a list of transactions and a block header containing the following fields:
In Starknet, a block is a list of transactions, and a block header that contains the following fields:


[%autowidth]
Expand All @@ -23,24 +23,24 @@ In Starknet, the block is defined as a list of transactions and a block header c
| `extra data` | `FieldElement` | Extraneous data that might be useful for running transactions |
|===

[NOTE]
====
The commitment fields `event_commitment` and `transaction_commitment` are the roots of a height 64 binary Merkle Patricia tree.
Where:

For `event_commitment`, the leaf at index stem:[$i$] corresponds to the hash of the stem:[$i'th$] event.

For `transaction_commitment`, the leaf at index stem:[$i$] corresponds to stem:[$h(transaction \ hash, signature)$] if the stem:[$i'th$] transaction is an `invoke` transaction and stem:[$h(0,0)$] otherwise.
[horizontal,labelwidth='30']
`event_commitment`:: is the root of a 64-bit high binary Merkle Patricia tree. The leaf at index stem:[$i$] corresponds to the hash of the stem:[$i'th$] event.
`transaction_commitment`:: is the root of a 64-bit high binary Merkle Patricia tree. The leaf at index stem:[$i$] corresponds to stem:[$${h(transaction \space hash, signature)}$$] if the stem:[$i'th$] transaction is an `invoke` transaction and stem:[$h(0,0)$] otherwise.

====

[id="block_hash"]


[#block_hash]
== Block hash

The block hash is defined as the Pedersen hash over the header's elements.
A block hash is defined as the Pedersen hash of the header's fields, as follows:

[source,cairo]
[,,subs="quotes"]
----
(𝐵) = (
_h_(𝐵) = _h_(
block_number,
global_state_root,
sequencer_address,
Expand All @@ -55,9 +55,9 @@ The block hash is defined as the Pedersen hash over the header's elements.
)
----

Where stem:[$h$] is the xref:../../Cryptography/hash-functions.adoc#pedersen-hash[Pedersen] hash.
Where `_h_` is the xref:../../Cryptography/hash-functions.adoc#pedersen-hash[Pedersen hash].

[NOTE]
====
Zeros inside the hash computation of an object are used as placeholders, to be replaced in the future by meaningful fields.
====
====

0 comments on commit e8b672e

Please sign in to comment.