Finality votes cache (#116)

* removeInMemoryStorage + extract Kovan stuff to runtime

* removed comment from the future

* remove redundant conversions

* remove redundant `u8 as usize`

* remove redundant `u8 as usize`

* Update modules/ethereum/src/mock.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* use hex-literal in kovan config

* cargo fmt --all

* extracted insert_header

* cargo fmt --all

* finality cache

* cargo fmt --all

* cargo fmt --all

* impl Default for FinalityVotes

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Hernando Castano <castano.ha@gmail.com>
This commit is contained in:
Svyatoslav Nikolsky
2020-06-10 10:56:47 +03:00
committed by Bastian Köcher
parent ca8b370de2
commit 643075f7fa
8 changed files with 818 additions and 276 deletions
+5 -1
View File
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use crate::finality::FinalityVotes;
use crate::validators::{ValidatorsConfiguration, ValidatorsSource};
use crate::{AuraConfiguration, GenesisConfig, HeaderToImport, HeadersByNumber, Storage, Trait};
use frame_support::StorageMap;
@@ -70,12 +71,14 @@ impl frame_system::Trait for TestRuntime {
}
parameter_types! {
pub const TestFinalityVotesCachingInterval: Option<u64> = Some(16);
pub const TestAuraConfiguration: AuraConfiguration = test_aura_config();
pub const TestValidatorsConfiguration: ValidatorsConfiguration = test_validators_config();
}
impl Trait for TestRuntime {
type AuraConfiguration = TestAuraConfiguration;
type FinalityVotesCachingInterval = TestFinalityVotesCachingInterval;
type ValidatorsConfiguration = TestValidatorsConfiguration;
type OnHeadersSubmitted = ();
}
@@ -171,10 +174,11 @@ pub fn insert_header<S: Storage>(storage: &mut S, header: Header) {
storage.insert_header(HeaderToImport {
context: storage.import_context(None, &header.parent_hash).unwrap(),
is_best: true,
hash: header.hash(),
id: header.compute_id(),
header,
total_difficulty: 0.into(),
enacted_change: None,
scheduled_change: None,
finality_votes: FinalityVotes::default(),
});
}