-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Storing multiple Justifications per block #7640
Changes from 43 commits
b1561e7
16bfd2c
d72b5eb
88d1e1a
12f8f7e
75dc977
9920319
1f7f2d1
523038a
52a0dff
a25d33d
f023cca
2a6e9cd
46b4584
544c8e2
6aabece
10e9f22
3613fdb
ce5dad9
b0f9b5c
4dc856e
2e23810
66b2c4e
0b69a39
b91f821
9301c86
63291b5
206447c
4185aa5
d0adabb
5cae4b1
1d7e50b
4d1ed93
a0cb5e3
c32e538
2545ed2
45f9e20
47bda20
b65b38a
c69833e
1019de3
8391a9d
c9cc2c8
7bbc156
a42122b
356176f
609bbe0
037e0a4
c5fe8f2
5c4a735
693757f
1667e41
d7ea7bd
87cf0d3
b266679
7f8e0b3
ad05998
bcc69ce
3af1962
3f5e07c
a829791
dda0b2d
711984f
9a2ba3c
e405ce9
aaac8c5
3e4443f
340e092
5c5449e
c338058
ed93ea0
File filter
Filter by extension
Conversations
Jump to
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.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,8 @@ | |
| use std::sync::Arc; | ||
| use std::collections::{HashMap, HashSet}; | ||
| use sp_core::ChangesTrieConfigurationRange; | ||
| use sp_core::offchain::OffchainStorage; | ||
| use sp_runtime::{generic::BlockId, Justification, Storage}; | ||
| use sp_core::offchain::{OffchainStorage}; | ||
| use sp_runtime::{generic::BlockId, Justification, Justifications, Storage}; | ||
| use sp_runtime::traits::{Block as BlockT, NumberFor, HashFor}; | ||
| use sp_state_machine::{ | ||
| ChangesTrieState, ChangesTrieStorage as StateChangesTrieStorage, ChangesTrieTransaction, | ||
|
|
@@ -148,7 +148,7 @@ pub trait BlockImportOperation<Block: BlockT> { | |
| &mut self, | ||
| header: Block::Header, | ||
| body: Option<Vec<Block::Extrinsic>>, | ||
| justification: Option<Justification>, | ||
| justifications: Option<Justifications>, | ||
| state: NewBlockState, | ||
| ) -> sp_blockchain::Result<()>; | ||
|
|
||
|
|
@@ -195,8 +195,9 @@ pub trait BlockImportOperation<Block: BlockT> { | |
| fn mark_finalized( | ||
| &mut self, | ||
| id: BlockId<Block>, | ||
| justification: Option<Justification>, | ||
| justifications: Option<Justifications>, | ||
|
Contributor
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. I think this should be kept as it was. I don't see a situation where you need to finalize an existing block and you have multiple justifications at hand. |
||
| ) -> sp_blockchain::Result<()>; | ||
|
|
||
| /// Mark a block as new head. If both block import and set head are specified, set head | ||
| /// overrides block import's best block rule. | ||
| fn mark_head(&mut self, id: BlockId<Block>) -> sp_blockchain::Result<()>; | ||
|
|
@@ -226,11 +227,10 @@ pub trait Finalizer<Block: BlockT, B: Backend<Block>> { | |
| &self, | ||
| operation: &mut ClientImportOperation<Block, B>, | ||
| id: BlockId<Block>, | ||
| justification: Option<Justification>, | ||
| justifications: Option<Justifications>, | ||
|
Contributor
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. Same as above. |
||
| notify: bool, | ||
| ) -> sp_blockchain::Result<()>; | ||
|
|
||
|
|
||
| /// Finalize a block. | ||
| /// | ||
| /// This will implicitly finalize all blocks up to it and | ||
|
|
@@ -247,10 +247,9 @@ pub trait Finalizer<Block: BlockT, B: Backend<Block>> { | |
| fn finalize_block( | ||
| &self, | ||
| id: BlockId<Block>, | ||
| justification: Option<Justification>, | ||
| justifications: Option<Justifications>, | ||
|
Contributor
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. Same as above. |
||
| notify: bool, | ||
| ) -> sp_blockchain::Result<()>; | ||
|
|
||
| } | ||
|
|
||
| /// Provides access to an auxiliary database. | ||
|
|
@@ -429,7 +428,16 @@ pub trait Backend<Block: BlockT>: AuxStore + Send + Sync { | |
| fn finalize_block( | ||
| &self, | ||
| block: BlockId<Block>, | ||
| justification: Option<Justification>, | ||
| justifications: Option<Justifications>, | ||
|
Contributor
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. Same as above. |
||
| ) -> sp_blockchain::Result<()>; | ||
|
|
||
| /// Append justification to the block with the given Id. | ||
| /// | ||
| /// This should only be called for blocks that are already finalized. | ||
| fn append_justification( | ||
| &self, | ||
| block: BlockId<Block>, | ||
| justification: Justification, | ||
| ) -> sp_blockchain::Result<()>; | ||
|
|
||
| /// Returns reference to blockchain backend. | ||
|
|
||
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.