-
Notifications
You must be signed in to change notification settings - Fork 257
Check the execution receipt received from network properly #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8e11150
Include the list of storage roots in ExecutionReceipt
liuchengxu 7493a63
Only authorty executors are allowed to broadcast ER
liuchengxu 4934c1c
Reduce Executor generics by merging `runtime_api` into `client`
liuchengxu 2856ded
Write local ER to disk and check external ER against the local one
liuchengxu d983d4d
Remove the validated local execution receipt from disk
liuchengxu 992cfb2
Apply the suggestions from code review
liuchengxu 0098a20
Use Merkle Tree instead of Merkle Patricia Tree for execution trace
liuchengxu c383418
Prune the too old execution receipts while writing a new one
liuchengxu 6eb1c30
Store Execution Receipt Keyed by block hash
liuchengxu b22f827
Replicate the state root when constructing the trace merkle tree from…
liuchengxu 9ccc995
Merge the `BS` generic parameter into `Client` in Executor struct
liuchengxu be7a07c
Use the new best_hash instead of parent_hash when calling `intermedia…
liuchengxu 872b1b4
Apply the suggstions from code review
liuchengxu 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
Use Merkle Tree instead of Merkle Patricia Tree for execution trace
Fixes #236 (comment)
- Loading branch information
commit 0098a20eaff255795cbbfe21c9d29345fe1dfdc1
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| use merkletree::hash::Algorithm; | ||
| use sha2::{Digest, Sha256}; | ||
| use std::hash::Hasher; | ||
| use subspace_core_primitives::Sha256Hash; | ||
|
|
||
| #[derive(Default, Clone)] | ||
| pub(super) struct Sha256Algorithm(Sha256); | ||
|
|
||
| impl Hasher for Sha256Algorithm { | ||
| #[inline] | ||
| fn write(&mut self, msg: &[u8]) { | ||
| self.0.update(msg); | ||
| } | ||
|
|
||
| #[inline] | ||
| fn finish(&self) -> u64 { | ||
| unimplemented!() | ||
| } | ||
| } | ||
|
|
||
| impl Algorithm<Sha256Hash> for Sha256Algorithm { | ||
| #[inline] | ||
| fn hash(&mut self) -> Sha256Hash { | ||
| self.0 | ||
| .clone() | ||
| .finalize() | ||
| .as_slice() | ||
| .try_into() | ||
| .expect("Sha256 output is always 32 bytes; qed") | ||
| } | ||
|
|
||
| #[inline] | ||
| fn reset(&mut self) { | ||
| self.0.reset(); | ||
| } | ||
| } | ||
|
|
||
| /// Merkle tree type for execution trace. | ||
| pub(super) type MerkleTree = merkletree::merkle::MerkleTree< | ||
| Sha256Hash, | ||
| Sha256Algorithm, | ||
| merkletree::store::VecStore<Sha256Hash>, | ||
| >; |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.