From 4f2148c2bc1e8ae526e2bd8c8366c178bd058eb4 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Sun, 7 Jan 2024 08:20:39 -0700 Subject: [PATCH 1/7] initial definition of recursive gossip --- state-network.md | 104 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 8 deletions(-) diff --git a/state-network.md b/state-network.md index 47af12d..4e56b83 100644 --- a/state-network.md +++ b/state-network.md @@ -189,11 +189,10 @@ content_id := sha256(content_key) ## Gossip -### Overview +As each new block is added to the chain, the state from that block must be gossiped into the network. +The state network defines a specific gossip algorithm which is referred to as "Recursive Gossip". This +section of the specification defines how this gossip mechanism works. -A bridge node composes proofs for altered (i.e. created/modified/deleted) state data based on the latest block. -These proofs are tied to the latest block by the state root. -The bridge node gossips each proof to some (bounded-size) subset of its peers who are closest to the data based on the distance metric. ### Terminology @@ -226,11 +225,11 @@ We define the following terms when referring to state data. #### *"state root"* -The node labeled `X` in the diagram. +The node labeled `X` in the diagram found at level 0 or the "root" of the trie. #### *"trie node"* -Any of the individual nodes in the trie. +Any of the individual nodes in the trie represented by either `X` for the state root node, or a `1` or `0` for trie nodes. #### *"intermediate node"* @@ -240,9 +239,98 @@ Any of the nodes in the trie which are computed from other nodes in the trie. T Any node in the trie that represents a value stored in the trie. The nodes in the diagram at level 4 are leaf nodes. -#### *"leaf proof"* +#### *"merkle proof"* or *"proof"* + +A collection of nodes from the trie sufficient to recompute the state root and proove that one or more nodes are part of the trie defined by that state root. + +> A proof is considered to be "minimal" if it contains only the minimumm set of trie nodes needed to recompute the state root. + + +### Overview + +The goal of the "recursive gossip" mechanism is to reduce the burden of +responsibility placed on bridge nodes for injecting new state data into the +network while simultaniously spreading the responsibility for gossiping new +state data across the nodes in the network. + +At each block we construct a proof against the new state root which contains +all of the state changes which occured within that block. + +This proof would *explicitely* contains a mixed set of leaf and intermediate +nodes, as well as implicitely contains a set of intermediate nodes which can be +computed from the nodes that are part of the proof. + +``` +EXAMPLE: Recursive Gossip Inception + +0: A* + / \ + / \ + / \ + / \ + / \ + / \ + / \ +1: B* C + / \ + / \ + / \ +2: D E* + / \ + / \ +3: F G* + / \ +4: H* I + +- "*" denotes trie node modified +``` + +In the example proof diagramed here we can see a *leaf* node `H` which +represents the only modified leaf state in this proof. Note that all of the +nodes along the path leading to `H` are also modified. + +The *minimal* proof would contain the nodes `[D, F, H, I, C]` + +The bridge node would search the DHT for nodes that are *inderested* in storing +the node `H` and gossip this proof to those nodes. + +The recipients of this gossip are then responsible for gossiping the parent +intermediate node `G`. To do so, they would strip off the `H` and `I` nodes +from this proof resulting in the following: + +``` +EXAMPLE: Recursive Gossip Round 1 + +0: A* + / \ + / \ + / \ + / \ + / \ + / \ + / \ +1: B* C + / \ + / \ + / \ +2: D E* + / \ + / \ +3: F G* + +4: +``` + +At this stage, the minimal proof for `G` would be `[D, F, G, C]`. The nodes +which received the initial gossip message for `H` would constructe this proof +by removing the un-necessary nodes, after which they would searcch the DHT for +nodes that are interested in `F` and gossip this proof to them.. + +The receipients of that gossip are then responsible for gossiping the parent +intermediate node `E`. This process repeats until it terminates at the state +root, with the final round of gossip only containing the `[A]` which is the +state root node of the trie. -The merkle proof which contains a leaf node and the intermediate trie nodes necessary to compute the state root of the trie. ### Gossip From 06be7da48accf6c22dca56474141e99f1c5419ad Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Mon, 8 Jan 2024 10:27:10 -0700 Subject: [PATCH 2/7] Update state-network.md Co-authored-by: Kim De Mey --- state-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-network.md b/state-network.md index 4e56b83..35c0544 100644 --- a/state-network.md +++ b/state-network.md @@ -241,7 +241,7 @@ Any node in the trie that represents a value stored in the trie. The nodes in t #### *"merkle proof"* or *"proof"* -A collection of nodes from the trie sufficient to recompute the state root and proove that one or more nodes are part of the trie defined by that state root. +A collection of nodes from the trie sufficient to recompute the state root and prove that one or more nodes are part of the trie defined by that state root. > A proof is considered to be "minimal" if it contains only the minimumm set of trie nodes needed to recompute the state root. From e6c1d0dcd8f8c2ac1fe541bb616d2271fbe7382c Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Mon, 8 Jan 2024 10:27:15 -0700 Subject: [PATCH 3/7] Update state-network.md Co-authored-by: Kim De Mey --- state-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-network.md b/state-network.md index 35c0544..13664fe 100644 --- a/state-network.md +++ b/state-network.md @@ -243,7 +243,7 @@ Any node in the trie that represents a value stored in the trie. The nodes in t A collection of nodes from the trie sufficient to recompute the state root and prove that one or more nodes are part of the trie defined by that state root. -> A proof is considered to be "minimal" if it contains only the minimumm set of trie nodes needed to recompute the state root. +> A proof is considered to be "minimal" if it contains only the minimum set of trie nodes needed to recompute the state root. ### Overview From 4ec451fb84d1b055cf895fb50bf87b9111584e21 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Mon, 8 Jan 2024 10:27:22 -0700 Subject: [PATCH 4/7] Update state-network.md Co-authored-by: Kim De Mey --- state-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-network.md b/state-network.md index 13664fe..ed5e94f 100644 --- a/state-network.md +++ b/state-network.md @@ -291,7 +291,7 @@ nodes along the path leading to `H` are also modified. The *minimal* proof would contain the nodes `[D, F, H, I, C]` -The bridge node would search the DHT for nodes that are *inderested* in storing +The bridge node would search the DHT for nodes that are *interested* in storing the node `H` and gossip this proof to those nodes. The recipients of this gossip are then responsible for gossiping the parent From 33fea29bb53af31808c77e164363917b9dd53b26 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Mon, 8 Jan 2024 10:27:28 -0700 Subject: [PATCH 5/7] Update state-network.md Co-authored-by: Kim De Mey --- state-network.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/state-network.md b/state-network.md index ed5e94f..68b81d2 100644 --- a/state-network.md +++ b/state-network.md @@ -322,8 +322,8 @@ EXAMPLE: Recursive Gossip Round 1 ``` At this stage, the minimal proof for `G` would be `[D, F, G, C]`. The nodes -which received the initial gossip message for `H` would constructe this proof -by removing the un-necessary nodes, after which they would searcch the DHT for +which received the initial gossip message for `H` would construct this proof +by removing the un-necessary nodes, after which they would search the DHT for nodes that are interested in `F` and gossip this proof to them.. The receipients of that gossip are then responsible for gossiping the parent From 99824a9815bb1b6d1cfb01962a516de4a9d3429a Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Mon, 8 Jan 2024 10:27:34 -0700 Subject: [PATCH 6/7] Update state-network.md Co-authored-by: Kim De Mey --- state-network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-network.md b/state-network.md index 68b81d2..97609ca 100644 --- a/state-network.md +++ b/state-network.md @@ -326,7 +326,7 @@ which received the initial gossip message for `H` would construct this proof by removing the un-necessary nodes, after which they would search the DHT for nodes that are interested in `F` and gossip this proof to them.. -The receipients of that gossip are then responsible for gossiping the parent +The recipients of that gossip are then responsible for gossiping the parent intermediate node `E`. This process repeats until it terminates at the state root, with the final round of gossip only containing the `[A]` which is the state root node of the trie. From 989fd3350c3261b1e01098df00b5aaefa8076cc0 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Mon, 8 Jan 2024 10:27:53 -0700 Subject: [PATCH 7/7] Update state-network.md Co-authored-by: Kim De Mey --- state-network.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/state-network.md b/state-network.md index 97609ca..d14eafa 100644 --- a/state-network.md +++ b/state-network.md @@ -256,8 +256,8 @@ state data across the nodes in the network. At each block we construct a proof against the new state root which contains all of the state changes which occured within that block. -This proof would *explicitely* contains a mixed set of leaf and intermediate -nodes, as well as implicitely contains a set of intermediate nodes which can be +This proof contains *explicitly* a mixed set of leaf and intermediate +nodes, as well as implicitly a set of intermediate nodes which can be computed from the nodes that are part of the proof. ```