Skip to content

Commit

Permalink
Chapter 02 and 03 reviewed
Browse files Browse the repository at this point in the history
  • Loading branch information
drskalman committed Mar 17, 2021
1 parent 4007ecf commit e6ef39e
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 70 deletions.
22 changes: 14 additions & 8 deletions host-spec/c02-state.tm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<TeXmacs|1.99.14>
<TeXmacs|1.99.17>

<project|host-spec.tm>

Expand Down Expand Up @@ -409,10 +409,10 @@
The Merkle value of each node should depend on the Merkle value of all its
children as well as on its corresponding data in the state storage. This
recursive dependancy is encompassed into the subvalue part of the node
value which recursively depends on the Merkle value of its
children. Additionally, as Section <reference|sect-child-trie-structure>
clarifies, the Merkle proof of each <strong|child trie> must be updated first
before the final Polkadot state root can be calculated.
value which recursively depends on the Merkle value of its children.
Additionally, as Section <reference|sect-child-trie-structure> clarifies,
the Merkle proof of each <strong|child trie> must be updated first before
the final Polkadot state root can be calculated.

We use the auxilary function introduced in Definition
<reference|defn-children-bitmap> to encode and decode information stored in
Expand Down Expand Up @@ -542,8 +542,14 @@
\;
</body>

<initial|<\collection>
</collection>>
<\initial>
<\collection>
<associate|chapter-nr|1>
<associate|page-first|15>
<associate|section-nr|2<uninit>>
<associate|subsection-nr|1>
</collection>
</initial>

<\references>
<\collection>
Expand All @@ -552,7 +558,7 @@
<associate|auto-1|<tuple|2|17>>
<associate|auto-2|<tuple|2.1|17>>
<associate|auto-3|<tuple|2.1.1|17>>
<associate|auto-4|<tuple|2.1|17>>
<associate|auto-4|<tuple|StoredValue|17>>
<associate|auto-5|<tuple|2.1.2|17>>
<associate|auto-6|<tuple|2.1.3|18>>
<associate|auto-7|<tuple|2.1.4|19>>
Expand Down
136 changes: 74 additions & 62 deletions host-spec/c03-transition.tm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<TeXmacs|1.99.16>
<TeXmacs|1.99.17>

<project|host-spec.tm>

Expand Down Expand Up @@ -428,9 +428,10 @@
and as a result are not stored in the transaction pool or gossiped across
the network. Instead they are generated by the Polkadot Host by passing the
required inherent data, as listted in Table <reference|tabl-inherent-data>,
to the Runtime method <name|BlockBuilder_inherent_extrinsics> (Section
<reference|defn-rt-builder-inherent-extrinsics>). The then returned
extrinsics should be included in the current block. <todo|define uncles>
to the Runtime method <samp|<verbatim|BlockBuilder_inherent_extrinsics>>
(Section <reference|defn-rt-builder-inherent-extrinsics>). The then
returned extrinsics should be included in the current block as explained in
Algorithm <reference|algo-build-block>. <todo|define uncles>

<\big-table|<tabular|<tformat|<cwith|1|-1|1|-1|cell-tborder|0ln>|<cwith|1|-1|1|-1|cell-bborder|0ln>|<cwith|1|-1|1|-1|cell-lborder|0ln>|<cwith|1|-1|1|-1|cell-rborder|0ln>|<cwith|3|3|1|-1|cell-bborder|1ln>|<cwith|1|-1|1|1|cell-lborder|0ln>|<cwith|1|-1|3|3|cell-rborder|0ln>|<cwith|1|1|1|-1|cell-tborder|1ln>|<cwith|1|1|1|-1|cell-bborder|1ln>|<cwith|2|2|1|-1|cell-tborder|1ln>|<cwith|1|1|1|1|cell-lborder|0ln>|<cwith|1|1|3|3|cell-rborder|0ln>|<table|<row|<cell|Identifier>|<cell|Value
type >|<cell|Description>>|<row|<cell|timstap0>|<cell|u64>|<cell|Unix epoch
Expand Down Expand Up @@ -549,7 +550,7 @@
\;

Where <math|E<rsub|id>> is the unique consensus engine identifier defined
in <reference|defn-consensus-message-digest> and
in Section <reference|defn-consensus-message-digest> and

<\itemize-dot>
<item><strong|Changes trie root> contains the root of the Changes Trie
Expand Down Expand Up @@ -1002,8 +1003,14 @@
and every block.
</body>

<initial|<\collection>
</collection>>
<\initial>
<\collection>
<associate|chapter-nr|2>
<associate|page-first|21>
<associate|section-nr|2<uninit>>
<associate|subsection-nr|1>
</collection>
</initial>

<\references>
<\collection>
Expand All @@ -1012,36 +1019,37 @@
<associate|algo-runtime-interaction|<tuple|3.1|21>>
<associate|algo-validate-transactions|<tuple|3.2|24>>
<associate|auto-1|<tuple|3|21>>
<associate|auto-10|<tuple|3.2.1|23>>
<associate|auto-11|<tuple|3.2.2|23>>
<associate|auto-12|<tuple|3.2.2.1|23>>
<associate|auto-13|<tuple|3.2.3|24>>
<associate|auto-14|<tuple|Transaction Message|24>>
<associate|auto-15|<tuple|transaction pool|24>>
<associate|auto-16|<tuple|transaction queue|24>>
<associate|auto-17|<tuple|3.2.3.1|25>>
<associate|auto-18|<tuple|3.1|25>>
<associate|auto-19|<tuple|3.3|25>>
<associate|auto-10|<tuple|3.2|23>>
<associate|auto-11|<tuple|3.2.1|23>>
<associate|auto-12|<tuple|3.2.2|23>>
<associate|auto-13|<tuple|3.2.2.1|24>>
<associate|auto-14|<tuple|3.2.3|24>>
<associate|auto-15|<tuple|Transaction Message|24>>
<associate|auto-16|<tuple|transaction pool|24>>
<associate|auto-17|<tuple|transaction queue|25>>
<associate|auto-18|<tuple|3.2.3.1|25>>
<associate|auto-19|<tuple|3.1|25>>
<associate|auto-2|<tuple|3.1|21>>
<associate|auto-20|<tuple|3.3.1|25>>
<associate|auto-21|<tuple|3.3.1.1|25>>
<associate|auto-22|<tuple|3.2|26>>
<associate|auto-23|<tuple|3.3.1.2|26>>
<associate|auto-24|<tuple|3.3.1.3|27>>
<associate|auto-25|<tuple|3.3.2|27>>
<associate|auto-26|<tuple|3.3.3|28>>
<associate|auto-27|<tuple|3.3.4|28>>
<associate|auto-28|<tuple|3.3|29>>
<associate|auto-29|<tuple|3.3.4.1|29>>
<associate|auto-20|<tuple|3.3|25>>
<associate|auto-21|<tuple|3.3.1|25>>
<associate|auto-22|<tuple|3.3.1.1|26>>
<associate|auto-23|<tuple|3.2|26>>
<associate|auto-24|<tuple|3.3.1.2|27>>
<associate|auto-25|<tuple|3.3.1.3|27>>
<associate|auto-26|<tuple|3.3.2|28>>
<associate|auto-27|<tuple|3.3.3|28>>
<associate|auto-28|<tuple|3.3.4|29>>
<associate|auto-29|<tuple|3.3|29>>
<associate|auto-3|<tuple|3.1.1|21>>
<associate|auto-30|<tuple|3.3.4.2|29>>
<associate|auto-31|<tuple|3.3.4.3|30>>
<associate|auto-30|<tuple|3.3.4.1|29>>
<associate|auto-31|<tuple|3.3.4.2|30>>
<associate|auto-32|<tuple|3.3.4.3|?>>
<associate|auto-4|<tuple|3.1.2|22>>
<associate|auto-5|<tuple|3.1.2.1|22>>
<associate|auto-6|<tuple|3.1.2.2|22>>
<associate|auto-7|<tuple|3.1.2.3|23>>
<associate|auto-8|<tuple|3.1.2.4|23>>
<associate|auto-9|<tuple|3.2|23>>
<associate|auto-9|<tuple|3.1.2.5|23>>
<associate|block|<tuple|3.3.1.1|25>>
<associate|chap-state-transit|<tuple|3|21>>
<associate|defn-block-body|<tuple|3.9|27>>
Expand All @@ -1064,13 +1072,13 @@
<associate|sect-code-executor|<tuple|3.1.2|?>>
<associate|sect-entries-into-runtime|<tuple|3.1|21>>
<associate|sect-extrinsics|<tuple|3.2|23>>
<associate|sect-handling-runtime-state-update|<tuple|3.1.2.4|23>>
<associate|sect-handling-runtime-state-update|<tuple|3.1.2.5|23>>
<associate|sect-inherents|<tuple|3.2.3.1|25>>
<associate|sect-justified-block-header|<tuple|3.3.1.2|26>>
<associate|sect-loading-runtime-code|<tuple|3.1.1|21>>
<associate|sect-managing-multiple-states|<tuple|3.3.3|28>>
<associate|sect-runtime-return-value|<tuple|3.1.2.3|23>>
<associate|sect-runtime-send-args-to-runtime-enteries|<tuple|3.1.2.2|22>>
<associate|sect-runtime-return-value|<tuple|3.1.2.4|23>>
<associate|sect-runtime-send-args-to-runtime-enteries|<tuple|3.1.2.3|22>>
<associate|sect-state-replication|<tuple|3.3|25>>
<associate|tabl-digest-items|<tuple|3.2|26>>
<associate|tabl-inherent-data|<tuple|3.1|25>>
Expand All @@ -1081,23 +1089,23 @@
<\auxiliary>
<\collection>
<\associate|idx>
<tuple|<tuple|Transaction Message>|<pageref|auto-14>>
<tuple|<tuple|Transaction Message>|<pageref|auto-15>>

<tuple|<tuple|transaction pool>|<pageref|auto-15>>
<tuple|<tuple|transaction pool>|<pageref|auto-16>>

<tuple|<tuple|transaction queue>|<pageref|auto-16>>
<tuple|<tuple|transaction queue>|<pageref|auto-17>>
</associate>
<\associate|table>
<tuple|normal|<\surround|<hidden-binding|<tuple>|3.1>|>
List of inherent data
</surround>|<pageref|auto-18>>
</surround>|<pageref|auto-19>>

<tuple|normal|<surround|<hidden-binding|<tuple>|3.2>||The detail of the
varying type that a digest item can hold.>|<pageref|auto-22>>
varying type that a digest item can hold.>|<pageref|auto-23>>

<tuple|normal|<\surround|<hidden-binding|<tuple>|3.3>|>
Possible types of keys of mappings in the Changes Trie
</surround>|<pageref|auto-28>>
</surround>|<pageref|auto-29>>
</associate>
<\associate|toc>
<vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|3<space|2spc>State
Expand All @@ -1120,83 +1128,87 @@
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-5>>

<with|par-left|<quote|2tab>|3.1.2.2<space|2spc>Sending Arguments to
Runtime \ <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<with|par-left|<quote|2tab>|3.1.2.2<space|2spc>Memory Management
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-6>>

<with|par-left|<quote|2tab>|3.1.2.3<space|2spc>The Return Value from a
Runtime Entry <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<with|par-left|<quote|2tab>|3.1.2.3<space|2spc>Sending Arguments to
Runtime \ <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-7>>

<with|par-left|<quote|2tab>|3.1.2.4<space|2spc>Handling Runtimes update
to the State <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<with|par-left|<quote|2tab>|3.1.2.4<space|2spc>The Return Value from a
Runtime Entry <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-8>>

<with|par-left|<quote|2tab>|3.1.2.5<space|2spc>Handling Runtimes update
to the State <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-9>>

3.2<space|2spc>Extrinsics <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-9>
<no-break><pageref|auto-10>

<with|par-left|<quote|1tab>|3.2.1<space|2spc>Preliminaries
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-10>>
<no-break><pageref|auto-11>>

<with|par-left|<quote|1tab>|3.2.2<space|2spc>Transactions
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-11>>
<no-break><pageref|auto-12>>

<with|par-left|<quote|2tab>|3.2.2.1<space|2spc>Transaction Submission
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-12>>
<no-break><pageref|auto-13>>

<with|par-left|<quote|1tab>|3.2.3<space|2spc>Transaction Queue
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-13>>
<no-break><pageref|auto-14>>

<with|par-left|<quote|2tab>|3.2.3.1<space|2spc>Inherents
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-17>>
<no-break><pageref|auto-18>>

3.3<space|2spc>State Replication <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-19>
<no-break><pageref|auto-20>

<with|par-left|<quote|1tab>|3.3.1<space|2spc>Block Format
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-20>>
<no-break><pageref|auto-21>>

<with|par-left|<quote|2tab>|3.3.1.1<space|2spc>Block Header
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-21>>
<no-break><pageref|auto-22>>

<with|par-left|<quote|2tab>|3.3.1.2<space|2spc>Justified Block Header
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-23>>
<no-break><pageref|auto-24>>

<with|par-left|<quote|2tab>|3.3.1.3<space|2spc>Block Body
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-24>>
<no-break><pageref|auto-25>>

<with|par-left|<quote|1tab>|3.3.2<space|2spc>Importing and Validating
Block <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-25>>
<no-break><pageref|auto-26>>

<with|par-left|<quote|1tab>|3.3.3<space|2spc>Managaing Multiple
Variants of State <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-26>>
<no-break><pageref|auto-27>>

<with|par-left|<quote|1tab>|3.3.4<space|2spc>Changes Trie
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-27>>
<no-break><pageref|auto-28>>

<with|par-left|<quote|2tab>|3.3.4.1<space|2spc>Key to extrinsics pairs
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-29>>
<no-break><pageref|auto-30>>

<with|par-left|<quote|2tab>|3.3.4.2<space|2spc>Key to block pairs
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-30>>
<no-break><pageref|auto-31>>

<with|par-left|<quote|2tab>|3.3.4.3<space|2spc>Key to Child Changes
Trie pairs <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-31>>
<no-break><pageref|auto-32>>
</associate>
</collection>
</auxiliary>

0 comments on commit e6ef39e

Please sign in to comment.