Fast sync child trie support. (#9239)

* state machine proofs.

* initial implementation

* Remove todo.

* Extend test and fix import.

* fix no proof, with proof ko.

* fix start at logic.

* Restore response size.

* Rework comments.

* Add explicit ref

* Use compact proof.

* ref change

* elaborato on empty change set condition.

* KeyValueState renaming.

* Do not add two time child trie with same root to sync reply.

* rust format

* Fix merge.

* fix warnings and fmt

* fmt

* update protocol id to V2
This commit is contained in:
cheme
2021-11-07 14:13:02 +01:00
committed by GitHub
parent 7827dbb73c
commit ca5b07243f
13 changed files with 855 additions and 140 deletions
@@ -74,22 +74,32 @@ message BlockData {
message StateRequest {
// Block header hash.
bytes block = 1;
// Start from this key. Equivalent to <empty bytes> if omitted.
bytes start = 2; // optional
// Start from this key.
// Multiple keys used for nested state start.
repeated bytes start = 2; // optional
// if 'true' indicates that response should contain raw key-values, rather than proof.
bool no_proof = 3;
}
message StateResponse {
// A collection of keys-values. Only populated if `no_proof` is `true`
repeated StateEntry entries = 1;
// A collection of keys-values states. Only populated if `no_proof` is `true`
repeated KeyValueStateEntry entries = 1;
// If `no_proof` is false in request, this contains proof nodes.
bytes proof = 2;
}
// A key value state.
message KeyValueStateEntry {
// Root of for this level, empty length bytes
// if top level.
bytes state_root = 1;
// A collection of keys-values.
repeated StateEntry entries = 2;
// Set to true when there are no more keys to return.
bool complete = 3;
}
// A key-value pair
// A key-value pair.
message StateEntry {
bytes key = 1;
bytes value = 2;