Skip to content

Commit 29ff650

Browse files
authored
Merge pull request #11850 from lgaroche/fix/6860
Correct example trie structure [Fixes #6860]
2 parents fdfaaec + 76872fd commit 29ff650

File tree

8 files changed

+48
-48
lines changed
  • public/content
    • developers/docs/data-structures-and-encoding/patricia-merkle-trie
    • translations
      • es/developers/docs/data-structures-and-encoding/patricia-merkle-trie
      • fr/developers/docs/data-structures-and-encoding/patricia-merkle-trie
      • it/developers/docs/data-structures-and-encoding/patricia-merkle-trie
      • ja/developers/docs/data-structures-and-encoding/patricia-merkle-trie
      • pt-br/developers/docs/data-structures-and-encoding/patricia-merkle-trie
      • tr/developers/docs/data-structures-and-encoding/patricia-merkle-trie
      • zh/developers/docs/data-structures-and-encoding/patricia-merkle-trie

8 files changed

+48
-48
lines changed

public/content/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ Here is the extended code for getting a node in the Merkle Patricia trie:
162162

163163
### Example Trie {#example-trie}
164164

165-
Suppose we want a trie containing four path/value pairs `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coin')`, `('horse', 'stallion')`.
165+
Suppose we want a trie containing four path/value pairs `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coins')`, `('horse', 'stallion')`.
166166

167167
First, we convert both paths and values to `bytes`. Below, actual byte representations for _paths_ are denoted by `<>`, although _values_ are still shown as strings, denoted by `''`, for easier comprehension (they, too, would actually be `bytes`):
168168

169169
```
170170
<64 6f> : 'verb'
171171
<64 6f 67> : 'puppy'
172-
<64 6f 67 65> : 'coin'
172+
<64 6f 67 65> : 'coins'
173173
<68 6f 72 73 65> : 'stallion'
174174
```
175175

@@ -178,12 +178,12 @@ Now, we build such a trie with the following key/value pairs in the underlying D
178178
```
179179
rootHash: [ <16>, hashA ]
180180
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
181-
hashB: [ <00 6f>, hashD ]
182-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
183-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
181+
hashB: [ <00 6f>, hashC ]
182+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
183+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
184184
```
185185

186-
When one node is referenced inside another node, what is included is `H(rlp.encode(x))`, where `H(x) = keccak256(x) if len(x) >= 32 else x` and `rlp.encode` is the [RLP](/developers/docs/data-structures-and-encoding/rlp) encoding function.
186+
When one node is referenced inside another node, what is included is `H(rlp.encode(node))`, where `H(x) = keccak256(x) if len(x) >= 32 else x` and `rlp.encode` is the [RLP](/developers/docs/data-structures-and-encoding/rlp) encoding function.
187187

188188
Note that when updating a trie, one needs to store the key/value pair `(keccak256(x), x)` in a persistent lookup table _if_ the newly-created node has length >= 32. However, if the node is shorter than that, one does not need to store anything, since the function f(x) = x is reversible.
189189

public/content/translations/es/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ Aquí está el código extendido para obtener un nodo en el Merkle Patricia trie
164164

165165
### Ejemplo de Trie {#example-trie}
166166

167-
Supongamos que queremos un trie que contenga cuatro pares ruta/valor `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coin')`, `('horse', 'stallion')`.
167+
Supongamos que queremos un trie que contenga cuatro pares ruta/valor `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coins')`, `('horse', 'stallion')`.
168168

169169
En primer lugar, convertimos tanto las rutas como los valores en `bytes`. A continuación, las representaciones reales de bytes para _rutas_ se denotan con `<>`, aunque los _valores_ todavía se muestran como cadenas, denotadas por `''`, para facilitar la comprensión (estos también en realidad serían `bytes`):
170170

171171
```
172172
<64 6f> : 'verb'
173173
<64 6f 67> : 'puppy'
174-
<64 6f 67 65> : 'coin'
174+
<64 6f 67 65> : 'coins'
175175
<68 6f 72 73 65> : 'stallion'
176176
```
177177

@@ -180,12 +180,12 @@ Ahora, construimos un trie con los siguientes pares clave/valor en la base de da
180180
```
181181
rootHash: [ <16>, hashA ]
182182
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
183-
hashB: [ <00 6f>, hashD ]
184-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
185-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
183+
hashB: [ <00 6f>, hashC ]
184+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
185+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
186186
```
187187

188-
Cuando se hace referencia a un nodo dentro de otro nodo, lo que se incluye es `H(rlp.encode(x))`, donde `H(x) = keccak256(x) if len(x) >= 32 else x` y `rlp.encode` es la función de codificación [RLP](/developers/docs/data-structures-and-encoding/rlp).
188+
Cuando se hace referencia a un nodo dentro de otro nodo, lo que se incluye es `H(rlp.encode(node))`, donde `H(x) = keccak256(x) if len(x) >= 32 else x` y `rlp.encode` es la función de codificación [RLP](/developers/docs/data-structures-and-encoding/rlp).
189189

190190
Tenga en cuenta que al actualizar un trie, es necesario almacenar el par clave/valor `(keccak256(x), x)` en una tabla de búsqueda persistente _si_ el nodo recién creado tiene una longitud >= 32. Sin embargo, si el nodo es más corto, no es necesario almacenar nada, ya que la función f(x) = x es reversible.
191191

public/content/translations/fr/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ Voici le code étendu pour obtenir un nœud dans l'arbre de Merkle Patricia :
160160

161161
### Exemple d'arbre {#example-trie}
162162

163-
Supposons que nous voulions un tableau contenant quatre couples chemin/valeur `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coin')`, `('horse', 'stallion')`.
163+
Supposons que nous voulions un tableau contenant quatre couples chemin/valeur `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coins')`, `('horse', 'stallion')`.
164164

165165
Tout d'abord, nous convertissons les chemins et les valeurs en `bytes` (octets). Ci-dessous, les représentations réelles d'octets pour les _chemins_ sont désignées par `<>`, bien que les _valeurs_ soient toujours représentées sous forme de chaînes, désignées par `''`, pour une compréhension plus facile (elles aussi seraient en fait des `octets`) :
166166

167167
```
168168
<64 6f> : 'verb'
169169
<64 6f 67> : 'puppy'
170-
<64 6f 67 65> : 'coin'
170+
<64 6f 67 65> : 'coins'
171171
<68 6f 72 73 65> : 'stallion'
172172
```
173173

@@ -176,12 +176,12 @@ Nous construisons un tel arbre avec les paires clé/valeur suivantes dans la bas
176176
```
177177
rootHash: [ <16>, hashA ]
178178
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
179-
hashB: [ <00 6f>, hashD ]
180-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
179+
hashB: [ <00 6f>, hashC ]
180+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
182182
```
183183

184-
Lorsqu'un nœud est référencé à l'intérieur d'un autre nœud, ce qui est inclus est `H(rlp.encode(x))`, où `H(x) = keccak256(x) if len(x) >= 32 else x` et `rlp.encode` est la fonction d'encodage [RLP](/developers/docs/data-structures-and-encoding/rlp).
184+
Lorsqu'un nœud est référencé à l'intérieur d'un autre nœud, ce qui est inclus est `H(rlp.encode(node))`, où `H(x) = keccak256(x) if len(x) >= 32 else x` et `rlp.encode` est la fonction d'encodage [RLP](/developers/docs/data-structures-and-encoding/rlp).
185185

186186
Notez que lors de la mise à jour d'un arbre, on doit stocker la paire clé/valeur `(keccak256(x), x)`dans une table de consultation persistante _si_ le nœud nouvellement créé a une longueur >= 32. Toutefois, si le nœud est plus court que cela, il n'est pas nécessaire de stocker quoi que ce soit, puisque la fonction f(x) = x est réversible.
187187

public/content/translations/it/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ Ecco il codice esteso per ottenere un nodo nel trie di Patricia Merkle:
160160

161161
### Esempio di Trie {#example-trie}
162162

163-
Supponiamo di volere un trie contenente quattro coppie percorso/valore `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coin')`, `('horse', 'stallion')`.
163+
Supponiamo di volere un trie contenente quattro coppie percorso/valore `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coins')`, `('horse', 'stallion')`.
164164

165165
Per prima cosa, convertiamo sia i percorsi che i valori in `bytes`. Di seguito, le rappresentazioni reali dei byte per i _percorsi_ sono denotate da `<>`, sebbene i _valori_ siano mostrati ancora come stringhe, denotate da `"`, per maggiore facilità di comprensione (anch'essi, sarebbero in realtà `bytes`):
166166

167167
```
168168
<64 6f> : 'verb'
169169
<64 6f 67> : 'puppy'
170-
<64 6f 67 65> : 'coin'
170+
<64 6f 67 65> : 'coins'
171171
<68 6f 72 73 65> : 'stallion'
172172
```
173173

@@ -176,12 +176,12 @@ Ora, costruiamo un trie di questo tipo con le seguenti coppie chiave/valore nel
176176
```
177177
rootHash: [ <16>, hashA ]
178178
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
179-
hashB: [ <00 6f>, hashD ]
180-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
179+
hashB: [ <00 6f>, hashC ]
180+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
182182
```
183183

184-
Quando in un nodo si fa riferimento a un altro nodo, viene inserito `H(rlp.encode(x))`, dove `H(x) = keccak256(x) if len(x) >= 32 else x` e `rlp.encode` è la funzione di codifica [RLP](/developers/docs/data-structures-and-encoding/rlp).
184+
Quando in un nodo si fa riferimento a un altro nodo, viene inserito `H(rlp.encode(node))`, dove `H(x) = keccak256(x) if len(x) >= 32 else x` e `rlp.encode` è la funzione di codifica [RLP](/developers/docs/data-structures-and-encoding/rlp).
185185

186186
Nota che, aggiornando un trie, si deve memorizzare la coppia chiave/valore `(keccak256(x), x)` in una tabella di ricerca persistente _se_ il nodo appena creato ha una lunghezza >= 32. Se invece il nodo è inferiore a questo valore, non è necessario memorizzare nulla, poiché la funzione f(x) = x è reversibile.
187187

public/content/translations/ja/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ sidebarDepth: 2
160160

161161
### ツリーの例 {#example-trie}
162162

163-
次の4つのパスバリューのペアを含むツリーが必要だとします。 `('do', 'verb')``('dog', 'puppy')``('doge', 'coin')``('horse', 'stallion')`
163+
次の4つのパスバリューのペアを含むツリーが必要だとします。 `('do', 'verb')``('dog', 'puppy')``('doge', 'coins')``('horse', 'stallion')`
164164

165165
まず、パスと値(バリュー)の両方を`bytes`に変換します。 以下では、_paths_を実際のバイト表現 `<>`によって表示しています。しかし、 _values_は、分かりやすいように文字列として`''`で表示しています(実際は`bytes`) 。
166166

167167
```
168168
<64 6f> : 'verb'
169169
<64 6f 67> : 'puppy'
170-
<64 6f 67 65> : 'coin'
170+
<64 6f 67 65> : 'coins'
171171
<68 6f 72 73 65> : 'stallion'
172172
```
173173

@@ -176,12 +176,12 @@ sidebarDepth: 2
176176
```
177177
rootHash: [ <16>, hashA ]
178178
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
179-
hashB: [ <00 6f>, hashD ]
180-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
179+
hashB: [ <00 6f>, hashC ]
180+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
182182
```
183183

184-
1つのノードが内部の別のノードから参照されるとき、含まれているのは、`H(rlp.encode(x))`であり、`H(x) = keccak256(x) if len(x) >= 32 else x``rlp.encode`は、[RLP](/developers/docs/data-structures-and-encoding/rlp)エンコーディング関数です。
184+
1つのノードが内部の別のノードから参照されるとき、含まれているのは、`H(rlp.encode(node))`であり、`H(x) = keccak256(x) if len(x) >= 32 else x``rlp.encode`は、[RLP](/developers/docs/data-structures-and-encoding/rlp)エンコーディング関数です。
185185

186186
ツリーを更新するとき、新しく作成されたノードの長さが32以上の_場合_、キーバリューのペア`(keccak256(x), x)`を永続的なルックアップテーブルに格納する必要があることに注意してください。 ただし、ノードがそれよりも短い場合、関数 function f(x) = x は可逆であるため、何も格納する必要はありません。
187187

public/content/translations/pt-br/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ Aqui está o código estendido para obter um nó na árvore Merkle Patricia:
160160

161161
### Árvore de exemplo {#example-trie}
162162

163-
Suponha que nós queremos uma árvore contendo quatro pares de caminho/valor `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coin')`, `('horse', 'stallion')`.
163+
Suponha que nós queremos uma árvore contendo quatro pares de caminho/valor `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coins')`, `('horse', 'stallion')`.
164164

165165
Primeiro, convertemos ambos caminhos e valores para `bytes`. Abaixo, representações reais em bytes para _caminhos_ são indicadas por `<>`, embora _valores_ ainda sejam mostrados como strings, denotado por `''`, para melhor compreensão (eles, também, seriam `bytes`):
166166

167167
```
168168
<64 6f> : 'verb'
169169
<64 6f 67> : 'puppy'
170-
<64 6f 67 65> : 'coin'
170+
<64 6f 67 65> : 'coins'
171171
<68 6f 72 73 65> : 'stallion'
172172
```
173173

@@ -176,12 +176,12 @@ Agora, construímos uma árvore com os seguintes pares chave/valor no banco de d
176176
```
177177
rootHash: [ <16>, hashA ]
178178
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
179-
hashB: [ <00 6f>, hashD ]
180-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
179+
hashB: [ <00 6f>, hashC ]
180+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
182182
```
183183

184-
Quando um nó é referenciado dentro de outro nó, o que é incluído é `H(rlp. ncode(x))`, onde `H(x) = keccak256(x) if len(x) >= 32 else x` e `rlp. ncode` é a função de codificação [RLP](/developers/docs/data-structures-and-encoding/rlp).
184+
Quando um nó é referenciado dentro de outro nó, o que é incluído é `H(rlp. ncode(node))`, onde `H(x) = keccak256(x) if len(x) >= 32 else x` e `rlp. ncode` é a função de codificação [RLP](/developers/docs/data-structures-and-encoding/rlp).
185185

186186
Observe que, ao atualizar uma árvore, é necessário armazenar o par chave/valor `(keccak256(x), x)` em uma tabela de pesquisa persistente _se_ o nó recém-criado tem comprimento >= 32. Entretanto, se o nó é menor do que isso, não é preciso armazenar nada, já que a função f(x) = x é reversível.
187187

public/content/translations/tr/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ Merkle Patricia dijital ağacında bir düğüm almak için genişletilmiş kod:
160160

161161
### Örnek Dijital Ağaç {#example-trie}
162162

163-
Dört yol/değer çifti içeren bir dijital ağaç istediğimizi varsayalım: `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coin')`, `('horse', 'stallion')`.
163+
Dört yol/değer çifti içeren bir dijital ağaç istediğimizi varsayalım: `('do', 'verb')`, `('dog', 'puppy')`, `('doge', 'coins')`, `('horse', 'stallion')`.
164164

165165
İlk olarak, hem yolları hem de değerleri `bytes`' dönüştürürüz. Aşağıda, daha kolay anlaşılması için _yollar_ için gerçek bayt gösterimleri `<>` ile gösterilirken _değerler_ hala `''` dizeler olarak gösterilir(bunlar da aslında `byte` olacaktır):
166166

167167
```
168168
<64 6f> : 'verb'
169169
<64 6f 67> : 'puppy'
170-
<64 6f 67 65> : 'coin'
170+
<64 6f 67 65> : 'coins'
171171
<68 6f 72 73 65> : 'stallion'
172172
```
173173

@@ -176,12 +176,12 @@ Dört yol/değer çifti içeren bir dijital ağaç istediğimizi varsayalım: `(
176176
```
177177
rootHash: [ <16>, hashA ]
178178
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
179-
hashB: [ <00 6f>, hashD ]
180-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
179+
hashB: [ <00 6f>, hashC ]
180+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
181+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
182182
```
183183

184-
Bir düğüme başka bir düğüm içinde başvurulduğunda, dahil edilenler `H(rlp.encode(x))` olur, burada `H(x) = keccak256(x) if len(x) > = 32 else x` ve `rlp.encode`, [RLP](/developers/docs/data-structures-and-encoding/rlp) kodlama işlevidir.
184+
Bir düğüme başka bir düğüm içinde başvurulduğunda, dahil edilenler `H(rlp.encode(node))` olur, burada `H(x) = keccak256(x) if len(x) > = 32 else x` ve `rlp.encode`, [RLP](/developers/docs/data-structures-and-encoding/rlp) kodlama işlevidir.
185185

186186
Bir dijital ağacı güncellerken _eğer_ yeni oluşturulan düğümün uzunluğu >= 32 ise, `(keccak 256 (x), x)` anahtar/değer çiftini kalıcı bir arama tablosunda saklamanız gerektiğini unutmayın. Bununla birlikte düğüm bundan daha kısaysa, f (x) = x işlevi tersine çevrilebilir olduğundan hiçbir şeyin depolanmasına gerek yoktur.
187187

public/content/translations/zh/developers/docs/data-structures-and-encoding/patricia-merkle-trie/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ sidebarDepth: 2
164164

165165
### 前缀树示例 {#example-trie}
166166

167-
假定我们想要包含四个路径/值对 `('do', 'verb')``('dog', 'puppy')``('doge', 'coin')``('horse', 'stallion')` 的前缀树。
167+
假定我们想要包含四个路径/值对 `('do', 'verb')``('dog', 'puppy')``('doge', 'coins')``('horse', 'stallion')` 的前缀树。
168168

169169
首先,我们将路径和值都转换为 `bytes`。 在下方代码中,_路径_的实际字节代表用 `<>` 表示。而_值_仍然显示为字符串,用 `''` 表示,以便于理解(值也应为 `bytes`):
170170

171171
```
172172
<64 6f> : 'verb'
173173
<64 6f 67> : 'puppy'
174-
<64 6f 67 65> : 'coin'
174+
<64 6f 67 65> : 'coins'
175175
<68 6f 72 73 65> : 'stallion'
176176
```
177177

@@ -180,12 +180,12 @@ sidebarDepth: 2
180180
```
181181
rootHash: [ <16>, hashA ]
182182
hashA: [ <>, <>, <>, <>, hashB, <>, <>, <>, [ <20 6f 72 73 65>, 'stallion' ], <>, <>, <>, <>, <>, <>, <>, <> ]
183-
hashB: [ <00 6f>, hashD ]
184-
hashD: [ <>, <>, <>, <>, <>, <>, hashE, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
185-
hashE: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coin' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
183+
hashB: [ <00 6f>, hashC ]
184+
hashC: [ <>, <>, <>, <>, <>, <>, hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, 'verb' ]
185+
hashD: [ <17>, [ <>, <>, <>, <>, <>, <>, [ <35>, 'coins' ], <>, <>, <>, <>, <>, <>, <>, <>, <>, 'puppy' ] ]
186186
```
187187

188-
当一个节点在另一个节点内部引用时,包含的是 `H(rlp.encode(x))`,其中 `H(x) = keccak256(x) if len(x) > > = 32 else x``rlp.encode`[递归长度前缀](/developers/docs/data-structures-and-encoding/rlp)编码函数。
188+
当一个节点在另一个节点内部引用时,包含的是 `H(rlp.encode(node))`,其中 `H(x) = keccak256(x) if len(x) > > = 32 else x``rlp.encode`[递归长度前缀](/developers/docs/data-structures-and-encoding/rlp)编码函数。
189189

190190
请注意,更新前缀树时,_如果_新创建节点的长度 >= 32,则需要将键/值对 `(keccak256(x), x)` 存储在一个持久的查询表中。 然而,如果节点比这短,则不需要存储任何数据,因为函数 f(x) = x 是可逆的。
191191

0 commit comments

Comments
 (0)