This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow usage of different proof formats #4938
Closed
Closed
Changes from 197 commits
Commits
Show all changes
253 commits
Select commit
Hold shift + click to select a range
2845d0e
changes to state-db
cheme a0532d1
change transaction to be by child trie.
cheme eb5961f
slice index fix, many failing tests.
cheme 67687f8
fix state-db tests
cheme 48df830
vec with multiple entry of a same rc prefixeddb did not make sense,
cheme 9e9a684
Merge branch 'master' into split_child_payload
cheme cb4c4a9
change set to btreemap, seems useless (at least do no solve changetrie
cheme a398b82
moving get_1 to get, state-machine needs rework
cheme 7b26a93
Resolve a bit of child trie
cheme 4d1378f
Merge branch 'split_child_payload' into split_child_payload_map2
cheme f39ce3f
small refact
cheme bc4fe52
Merge branch 'master' into split_child_payload
cheme f27a2ec
Merge branch 'split_child_payload' into split_child_payload_map2
cheme 9f0c600
indent
cheme ecb43d0
Use const of null hash check on BackendStorageRef.
cheme d76a316
Merge branch 'split_child_payload_map2' into split_child_payload
cheme ae29df5
Associated null node hash set to a non optional const.
cheme 6a06c0a
Make ChildInfo borrow of OwnedChildInfo.
cheme 25aaa3a
Removing unsafe cast, using ref_cast asumption for borrow case.
cheme 0d45d85
Borrow approach on OwnedChildInfo and ChildInfo did not make sense
cheme 274a923
Factoring map of children code, before switching key.
cheme 2e47a1d
Switching children key from optional to simple ChildInfo.
cheme 328ed66
Merge branch 'master' into split_child_payload
cheme b07d7ca
fix merge test
cheme e5d7b04
clean todos
cheme 3a71669
fix
cheme c846471
End up removing all keypacedDB from code.
cheme 0b557b6
Clean unused struct and useless child info.
cheme 8483da4
remove todo
cheme 64ffcea
actual touch to keyspace prefixing (fail on wrong code asserted).
cheme 2bc3cb6
self review changes.
cheme 3136355
bump impl version.
cheme f655da1
Merge branch 'master' into split_child_payload
cheme bae6523
calculate size for single operation on usize.
cheme 88ed503
Put keyspace logic in its own struct.
cheme 4eb4676
Restrict top trie in ext to the storage key build from an empty key.
cheme 5151471
Implementation basis for this PR, note that child storage key default
cheme 8715446
Resolve prefix from child_info
cheme b72cd9c
Removed all child prefix, next is putting it back on full storage and on
cheme b636687
Prefixing child storage key where needed.
cheme e88631c
Merge branch 'master' into child_trie_w3_change
cheme e5b525f
Merge branch 'master' into split_child_payload
cheme e3cf283
In progress multiple proof format
cheme 728aedf
Remove deprecated check for genesis and fix some test storage builds.
cheme 8329448
Merge branch 'master' into child_trie_w3_change
cheme 864e9ca
Fix contract to stop using the child storage prefix.
cheme c87d19b
Revert changes to state-db and plug keyspace above it for default child
cheme 1f62342
Merge branch 'master' into split_child_payload
cheme 8b901a2
Update client-db benches.
cheme f6efdad
Bump runtime impl version.
cheme c683198
Merge branch 'master' into split_child_payload
cheme 3241607
Merge branch 'split_child_payload' into split_child_proof
cheme 93de960
fix new code
cheme 972574f
Merge branch 'split_child_payload' into split_child_proof
cheme a284921
progress (note that the unpack doing check we could have trie primitive
cheme 4708560
Things stick together, lot of todos remaining.
cheme 09b9afd
propagate api change
cheme 2224e2f
Merge branch 'master' into child_trie_w3_change
cheme c04ba95
Fixing merge.
cheme ffaf9f5
Switch back to using prefix on host function, remove child_id and
cheme 87bd97c
fix polka ref issue.
cheme 17cf613
Switching back to unprefixed in child info (all temporary struct
cheme b3ccc93
bump version
cheme afe85ae
fix tabs and doc.
cheme befe325
Merge branch 'master' into child_trie_w3_change
cheme ed480fa
Apply more consistant naming 'storage_key' instead of
cheme e103c2a
Update primitives/storage/src/lib.rs
cheme 958b626
use prefixed storage key in change trie
cheme 26f8000
Merge branch 'child_trie_w3_change' of github.com:cheme/polkadot into…
cheme f471d56
renaming 'default_child_trie_root' to 'empty_child_trie_root'
cheme 02ff227
apply some renaming, rpc change are really ugly, will revert them
cheme 8fcc112
Switch back to using child_type for rpc (and light client).
cheme b7b347a
Merge branch 'master' into child_trie_w3_change
cheme 3869774
Merge branch 'master' into child_trie_w3_change
cheme 4ebc204
Merge branch 'master' into child_trie_w3_change
cheme 74aa3f8
bump runtime version
cheme dc023d1
merge #4857
cheme 4c40ea7
Resolve merging change of api from #4857
cheme b6b70f3
revert rpc related default renaming.
cheme d563278
fix slice indexing for child root
cheme a85bb38
Switch back to prefixed storage key for rpc.
cheme 5f98fbe
rpc error discrepancy
cheme 320e375
Merge branch 'master' into child_trie_w3_change
cheme f05a576
Merge branch 'child_trie_w3_change' into split_child_payload
cheme d85dec2
Fix test
cheme 9f704c9
use correct parameter in overlay and fix change trie.
cheme c82edbd
Merge branch 'master' into child_trie_w3_change
cheme 7c5d546
bump version
cheme 19ab06b
Merge branch 'master' into child_trie_w3_change
cheme 152f04f
Merge branch 'master' into child_trie_w3_change
cheme e959e0d
Merge branch 'child_trie_w3_change' into split_child_payload
cheme eff1d8c
keeping inner hasher, it is needed at state-machine level.
cheme 0036fd3
Merge branch 'master' into child_trie_w3_change
cheme 29254aa
missing merge
cheme 72cfb6c
Merge branch 'child_trie_w3_change' into split_child_payload
cheme baacffa
fix bench
cheme 160d2ea
Restore previous cli api (will need deprecation in a v2 of rpc), split
cheme c76b433
Merge branch 'child_trie_w3_change' into split_child_payload
cheme 63cf6bd
remove old rpc
cheme 5ed450b
Merge branch 'master' into child_trie_w3_change
cheme f21606f
review change.
cheme 1b2a30c
Using `PrefixedStorageKey` type for child storage key that are prefixed.
cheme 750cdd8
Fix rpc test.
cheme 32e27c9
Merge branch 'master' into child_trie_w3_change
cheme cc65f44
bump spec version
cheme c20cef9
Merge branch 'master' into child_trie_w3_change
cheme 797ad34
Merge branch 'master' into child_trie_w3_change
cheme f1b23df
Apply review suggestion
cheme 9651dd1
Merge branch 'master' into child_trie_w3_change
cheme c631a46
Fix unrelated warning for CI
cheme 217c19b
Merge branch 'master' into child_trie_w3_change
cheme cf7d90e
Merge branch 'child_trie_w3_change' into split_child_payload
cheme 7c8f393
companion fix
cheme b2240f1
Update .maintain/gitlab/check_polkadot_companion_build.sh
cheme f3b9f23
Fix compilation errors.
cheme 63943ee
last attempt
cheme 784cb22
Forcing companion pr.
cheme 4bbb24d
revert ci changes.
cheme 18fa632
Merge branch 'split_child_payload' into split_child_proof
cheme ee679c1
lock update
cheme 5d8ae4e
fix compilation errors
cheme 50c3dd7
Merge branch 'master' into child_trie_w3_change
cheme a7c16eb
Merge branch 'child_trie_w3_change' of github.com:cheme/substrate int…
cheme ca40040
Merge branch 'master' into child_trie_w3_change
cheme 226f7cd
name of children in chain spec change.
cheme 5ab115e
Merge branch 'master' into child_trie_w3_change
cheme 1ad4c5a
Merge branch 'master' into child_trie_w3_change
cheme 94b78f3
Merge branch 'child_trie_w3_change' into split_child_payload
cheme 5938d86
remove terminal space
cheme aa5c6dd
Merge branch 'split_child_payload' into split_child_proof
cheme 30e8192
Merge branch 'master' into child_trie_w3_change
cheme bc2a198
sp-io documentation changes.
cheme 83ff4a0
Merge branch 'master' into child_trie_w3_change
cheme ecb1c39
Merge branch 'master' into child_trie_w3_change
cheme 619b454
Retain compatibility with network protocol.
cheme fa52a8c
Revert "Retain compatibility with network protocol."
cheme 6969c74
Add ChildenProofMap and ChildrenProofInfo to be able to rebase on
cheme 167f20c
Merge branch 'master' into child_trie_w3_change
cheme 48dfe7d
Failure to run this on non split child payload: see non implemented
cheme 38fa2c0
it was actually fine
cheme b7f7ee5
doc
cheme 091ca80
pushing back full backend (will probably be removed with the Full
cheme 87a4903
Merge branch 'split_child_proof_no_split_child_payload' into split_ch…
cheme e10387a
Register full in runtime, otherwhise packing would not be possible,
cheme 557e6ef
passing around a target storage kind
cheme f687fc2
fix compact proof failure.
cheme a83f8e6
moving storage proof to trie as in master
cheme 928fac0
Merge branch 'master' into child_trie_w3_change
gavofyork 69ed118
fix renamed field related error
cheme eebdfe6
rework of storage proof in trie.
cheme 39ba926
adapt rest of code
cheme 60c136d
renaming refactor
cheme b79bd84
Merge branch 'master' into child_trie_w3_change
cheme e4c6289
refact and fix flatten not use.
cheme de305ed
move all pack to storage proof
cheme 7a9098b
fix compile error, remove unused flatten method
cheme 728daf4
add calls to the proof, untested.
cheme 8724b57
Removing proof output and queryplan without value (does not exist in
cheme 4641cbd
more acceptable error management
cheme c2d1cf1
switch root registration to encoded data.
cheme 1a19852
only collect root when needed.
cheme 02128d2
fix
cheme a9c1e65
remove old todos
cheme 4f1e0ac
Set kind at the consumer level (static in rpc)
cheme 869c24f
restore correct legacy encoding of light client
cheme d364381
Merge implementation
cheme 55a12c8
Switch to new proof format and use compact on rpc and light (except head
cheme e542417
missing switches
cheme d3da220
fix merging and into a refactoring
cheme d6c82f5
remove rwlock for collecting roots
cheme f0a8455
triedbmut requiring hashdb block refacto (it should require a variant
cheme facd6f6
Revert "triedbmut requiring hashdb block refacto (it should require a…
cheme 2fdb0f8
actually need rwlock for client backend
cheme 2e4ed7d
fix doc test
cheme 064d117
Merge branch 'child_trie_w3_change' into split_child_proof
cheme 46d436a
Merge branch 'master' into split_child_proof
cheme f465388
Complete merge
cheme 5f9b31b
Merge branch 'master' into split_child_proof
cheme f8a42a6
fix merge
cheme dc3915e
Merge branch 'master' into split_child_proof
cheme 4fe29c0
Merge branch 'master' into split_child_proof
cheme cb93d53
remove unused parameter, rename api proof recorder
cheme be1fc61
restore to default proof
cheme 16554e5
removing Legacy storage proof struct, codec adapters are enough
cheme cb7a0b5
Legacy compatibility. Note that in this state the PR does change
cheme 9a9c982
revert to former light client proof encoding
cheme 109267b
Revert protocol format to.
cheme 6bd1469
also use non breakable finality proof
cheme f298e6b
Switch to compact proof everywhere
cheme 4d5bfa7
Revert "Switch to compact proof everywhere"
cheme a2eca57
Doc improvment, remove dead code, more sensible recurse calls.
cheme e3d2067
Revert "Revert "Switch to compact proof everywhere"" : uses compact
cheme 2e2d90f
Revert "Revert "Revert "Switch to compact proof everywhere"" : non
cheme af26fa8
Merge branch 'master' into split_child_proof
cheme 89154cf
Pre refacto change from review.
cheme d659b2c
Merge branch 'master' into split_child_proof
cheme 830dbf9
Refactoring in progress, base traits.
cheme 83ce879
Trie in shape
cheme 9aca478
Adding query plan variant to multiple for usage without exposing state
cheme 2ec97d5
into partial merge
cheme f425fd5
in progress
cheme 719d2d7
in progress
cheme 30c1aec
refact trie code a bit (hasher instead of h::out mainly and no sync).
cheme bfd5a6d
New proof extract function to implement.
cheme d7f51d6
very messy but got something with right type system for state machine
cheme d5279dd
Test on full backend
cheme cc915c1
basic knownstorageandvalue test.
cheme e087c58
Fix tests remove warnings.
cheme 69ebd39
sp_api using associated rec backend
cheme f4e6cb1
a few more, did not abstract state at client level (direct simpleproof
cheme 4711052
the proof recorde struct is useless when we extract mergeable proof or
cheme 3273887
Switch proof provider to return proofreg, we needed to merge
cheme d390740
test still needs a few updates, builds
cheme a8017b8
test fixed
cheme 9a56fd6
completed query plan test.
cheme d496011
using another proof to register.
cheme f4f21bd
quick renaming
cheme f8185e9
clean warnings
cheme f7b2fba
more warnings
cheme ccfffcc
Merge branch 'master' into split_child_proof
cheme a6e4214
Renamings.
cheme 2e372d3
switch collect of input to be in trait instead of hacky consolidate.
cheme e414fc5
Same state as rec, will remove reg backend state
cheme f5c525b
Removal of associated state type.
cheme 9ef94da
Removing arc and code that could clone a record
cheme ad72850
comment
cheme cb8583d
Fix full backend test
cheme 9a009ab
assert previous encoding is the same as SimpleProof.
cheme 078576c
Remove temporary variants of multiple proof
cheme 9c3c299
remove some proofs todos
cheme 3000ea6
renaming reg 'registering' to rec 'recording'
cheme dba2bb1
minor doc change
cheme e1eafe7
Merge branch 'master' into split_child_proof
cheme 2bc0dad
rename trieskiphashes to compact
cheme 522775c
Break lines.
cheme a78b648
Merge branch 'master' into split_child_proof
cheme 75d03f7
test ui line mismatch
cheme de341c1
restore doc test
cheme f9474f6
Expose proof from in memory backend type.
cheme 10ec408
line breaks.
cheme 7c789c9
few style fix
cheme ead9c0f
Merge branch 'master' into split_child_proof
cheme 5974650
Fix trait issue from merge.
cheme 53988c4
New lines break (from merge)
cheme 996efa4
doc update
cheme 45c5fcf
Remove todo
cheme e4e74bd
Merge branch 'master' into split_child_proof, expect issue with client
cheme 5a25f15
Merge branch 'master' into split_child_proof
cheme c63cadb
Merge branch 'master' into split_child_proof
cheme 2114ee9
Merge branch 'master' into split_child_proof
cheme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ use log::{trace, warn}; | |
|
||
use sp_blockchain::{Backend as BlockchainBackend, Error as ClientError, Result as ClientResult}; | ||
use sc_client_api::{ | ||
backend::Backend, StorageProof, | ||
backend::Backend, StorageProof, StorageProofKind, | ||
light::{FetchChecker, RemoteReadRequest}, | ||
StorageProvider, ProofProvider, | ||
}; | ||
|
@@ -97,7 +97,7 @@ impl<BE, Block: BlockT> AuthoritySetForFinalityProver<Block> for Arc<dyn Storage | |
} | ||
|
||
fn prove_authorities(&self, block: &BlockId<Block>) -> ClientResult<StorageProof> { | ||
self.read_proof(block, &mut std::iter::once(GRANDPA_AUTHORITIES_KEY)) | ||
self.read_proof(block, &mut std::iter::once(GRANDPA_AUTHORITIES_KEY), StorageProofKind::Flatten) | ||
} | ||
} | ||
|
||
|
@@ -228,7 +228,7 @@ pub(crate) struct FinalityProofFragment<Header: HeaderT> { | |
/// The set of headers in the range (U; F] that we believe are unknown to the caller. Ordered. | ||
pub unknown_headers: Vec<Header>, | ||
/// Optional proof of execution of GRANDPA::authorities() at the `block`. | ||
pub authorities_proof: Option<StorageProof>, | ||
pub authorities_proof: Option<Vec<Vec<u8>>>, | ||
} | ||
|
||
/// Proof of finality is the ordered set of finality fragments, where: | ||
|
@@ -344,7 +344,7 @@ pub(crate) fn prove_finality<Block: BlockT, B: BlockchainBackend<Block>, J>( | |
block: current, | ||
justification, | ||
unknown_headers: ::std::mem::take(&mut unknown_headers), | ||
authorities_proof: new_authorities_proof, | ||
authorities_proof: new_authorities_proof.map(StorageProof::expect_flatten_content), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a panicker, we should rather have |
||
}; | ||
|
||
// append justification to finality proof if required | ||
|
@@ -511,7 +511,7 @@ fn check_finality_proof_fragment<Block: BlockT, B, J>( | |
current_authorities = authorities_provider.check_authorities_proof( | ||
proof_fragment.block, | ||
header, | ||
new_authorities_proof, | ||
StorageProof::Flatten(new_authorities_proof), | ||
)?; | ||
|
||
current_set_id += 1; | ||
|
@@ -836,8 +836,8 @@ pub(crate) mod tests { | |
_ => unreachable!("no other authorities should be fetched: {:?}", block_id), | ||
}, | ||
|block_id| match block_id { | ||
BlockId::Number(5) => Ok(StorageProof::new(vec![vec![50]])), | ||
BlockId::Number(7) => Ok(StorageProof::new(vec![vec![70]])), | ||
BlockId::Number(5) => Ok(StorageProof::Flatten(vec![vec![50]])), | ||
BlockId::Number(7) => Ok(StorageProof::Flatten(vec![vec![70]])), | ||
_ => unreachable!("no other authorities should be proved: {:?}", block_id), | ||
}, | ||
), | ||
|
@@ -853,14 +853,14 @@ pub(crate) mod tests { | |
block: header(5).hash(), | ||
justification: just5, | ||
unknown_headers: Vec::new(), | ||
authorities_proof: Some(StorageProof::new(vec![vec![50]])), | ||
authorities_proof: Some(vec![vec![50]]), | ||
}, | ||
// last fragment provides justification for #7 && unknown#7 | ||
FinalityProofFragment { | ||
block: header(7).hash(), | ||
justification: just7.clone(), | ||
unknown_headers: vec![header(7)], | ||
authorities_proof: Some(StorageProof::new(vec![vec![70]])), | ||
authorities_proof: Some(vec![vec![70]]), | ||
}, | ||
]); | ||
|
||
|
@@ -874,7 +874,7 @@ pub(crate) mod tests { | |
0, | ||
auth3, | ||
&ClosureAuthoritySetForFinalityChecker( | ||
|hash, _header, proof: StorageProof| match proof.clone().iter_nodes().next().map(|x| x[0]) { | ||
|hash, _header, proof: StorageProof| match proof.clone().iter_nodes_flatten().next().map(|x| x[0]) { | ||
Some(50) => Ok(auth5.clone()), | ||
Some(70) => Ok(auth7.clone()), | ||
_ => unreachable!("no other proofs should be checked: {}", hash), | ||
|
@@ -935,7 +935,7 @@ pub(crate) mod tests { | |
block: header(4).hash(), | ||
justification: TestJustification((0, authorities.clone()), vec![7]).encode(), | ||
unknown_headers: vec![header(4)], | ||
authorities_proof: Some(StorageProof::new(vec![vec![42]])), | ||
authorities_proof: Some(vec![vec![42]]), | ||
}, FinalityProofFragment { | ||
block: header(5).hash(), | ||
justification: TestJustification((0, authorities), vec![8]).encode(), | ||
|
@@ -985,7 +985,7 @@ pub(crate) mod tests { | |
block: header(2).hash(), | ||
justification: TestJustification((1, initial_authorities.clone()), vec![7]).encode(), | ||
unknown_headers: Vec::new(), | ||
authorities_proof: Some(StorageProof::new(vec![vec![42]])), | ||
authorities_proof: Some(vec![vec![42]]), | ||
}, FinalityProofFragment { | ||
block: header(4).hash(), | ||
justification: TestJustification((2, next_authorities.clone()), vec![8]).encode(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code here would greatly benefit from using strong-typing instead of opaque
Vec<u8>
or evenVec<Vec<u8>>
. The previous code hadStorageProof
, why not introduceFlatProof
struct that is wrapped in theStorageProof
enum, but used in a type-safety fashion here?