Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
81d2237
Draft of new sessions
gavofyork Jun 5, 2019
4fc86da
Reintroduce tuple impls
gavofyork Jun 5, 2019
d24568a
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 5, 2019
84f1f1c
Move staking module to new session API
gavofyork Jun 5, 2019
5c67469
More work on staking and grandpa.
gavofyork Jun 5, 2019
5acfa04
Use iterator to avoid cloning and tuple macro
gavofyork Jun 5, 2019
fde708d
Make runtime build again
gavofyork Jun 6, 2019
b9b7d42
Polish the OpaqueKeys devex
gavofyork Jun 6, 2019
445df61
Move consensus logic into system & aura.
gavofyork Jun 6, 2019
4db0062
Fix up system module
gavofyork Jun 6, 2019
6696c55
Get build mostly going. Stuck at service.rs
gavofyork Jun 6, 2019
dc9e8c6
Building again
gavofyork Jun 6, 2019
7da4b04
Update srml/staking/src/lib.rs
gavofyork Jun 7, 2019
e2a0f2e
Refactoring out Consensus module, AuthorityIdOf, &c.
gavofyork Jun 7, 2019
6440ca8
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 7, 2019
cfea92a
Refactored out DigestItem::AuthoritiesChanged. Building.
gavofyork Jun 7, 2019
d3de475
Remove tentative code
gavofyork Jun 7, 2019
a061fd7
Remove invalid comment
gavofyork Jun 7, 2019
7f303f9
Make Seal opaque and introduce nice methods for handling opaque items.
gavofyork Jun 7, 2019
a38084d
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 7, 2019
f8b24e0
Start to use proper digest for Aura authorities tracking.
gavofyork Jun 8, 2019
fa47974
Fix up grandpa, remove system::Raw/Log
gavofyork Jun 8, 2019
dd93267
Refactor Grandpa to use new logging infrastructure.
gavofyork Jun 8, 2019
7a2b935
Building again
gavofyork Jun 8, 2019
4f9a5a3
Tidy up some AuthorityIds
gavofyork Jun 9, 2019
4871529
Expunge most of the rest of the AuthorityKey confusion.
gavofyork Jun 9, 2019
afeed88
Remove cruft
gavofyork Jun 9, 2019
d1d25e7
Untangle last of the `AuthorityId`s.
gavofyork Jun 9, 2019
bf081a5
Sort out finality_tracker
gavofyork Jun 9, 2019
77ec1ff
Refactor median getting
gavofyork Jun 9, 2019
a02de97
Apply suggestions from code review
Demi-Marie Jun 10, 2019
1cca243
Session tests works
gavofyork Jun 10, 2019
3bbd5ab
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 10, 2019
6101aae
Update core/sr-primitives/src/generic/digest.rs
gavofyork Jun 10, 2019
5827ab5
Session tests works
gavofyork Jun 10, 2019
f8fa160
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 10, 2019
8a9a4a5
Fix for staking from @dvc94ch
gavofyork Jun 10, 2019
9b4f1a4
log an error
gavofyork Jun 10, 2019
f650fe8
fix test runtime build
gavofyork Jun 10, 2019
ca4dda3
Some test fixes
gavofyork Jun 11, 2019
7b339ef
Fix build.
dvc94ch Jun 11, 2019
730b805
Move OpaqueKeys to primitives.
dvc94ch Jun 11, 2019
8203a7e
Staking mock update to new session api.
dvc94ch Jun 7, 2019
807c284
Use on_initialize instead of check_rotate_session.
dvc94ch Jun 11, 2019
ba4721f
Update tests to new staking api.
dvc94ch Jun 11, 2019
979f3b5
fixup mock
dvc94ch Jun 11, 2019
6e0cf27
Fix bond_extra_and_withdraw_unbonded_works.
dvc94ch Jun 11, 2019
4cafd87
Fix bond_with_little_staked_value_bounded_by_slot_stake.
dvc94ch Jun 11, 2019
4b5bd6b
Fix bond_with_no_staked_value.
dvc94ch Jun 11, 2019
48b0238
Fix change_controller_works.
dvc94ch Jun 11, 2019
379ddc9
Fix less_than_needed_candidates_works.
dvc94ch Jun 11, 2019
7990ce5
Fix multi_era_reward_should_work.
dvc94ch Jun 11, 2019
f3e7f97
Fix nominating_and_rewards_should_work.
dvc94ch Jun 11, 2019
94e58de
Fix nominators_also_get_slashed.
dvc94ch Jun 11, 2019
5404cbf
Fix phragmen_large_scale_test.
dvc94ch Jun 11, 2019
ff246dd
Fix phragmen_poc_works.
dvc94ch Jun 11, 2019
93843f9
Fix phragmen_score_should_be_accurate_on_large_stakes.
dvc94ch Jun 11, 2019
5cc1c44
Fix phragmen_should_not_overflow.
dvc94ch Jun 11, 2019
cfa5237
Fix reward_destination_works.
dvc94ch Jun 11, 2019
d90ffdc
Fix rewards_should_work.
dvc94ch Jun 11, 2019
8692b16
Fix sessions_and_eras_should_work.
dvc94ch Jun 11, 2019
5f1ad03
Fix slot_stake_is_least_staked_validator.
dvc94ch Jun 11, 2019
82946f5
Fix too_many_unbond_calls_should_not_work.
dvc94ch Jun 11, 2019
6b6acd5
Fix wrong_vote_is_null.
dvc94ch Jun 11, 2019
1822167
Fix runtime.
dvc94ch Jun 11, 2019
e87be9d
Fix wasm runtime build.
dvc94ch Jun 11, 2019
5f110d8
Update Cargo.lock
dvc94ch Jun 11, 2019
a5866a6
Fix warnings.
dvc94ch Jun 11, 2019
0378cff
Fix grandpa tests.
dvc94ch Jun 11, 2019
3f4b234
Fix test-runtime build.
dvc94ch Jun 11, 2019
71014e3
Fix template node build.
dvc94ch Jun 11, 2019
a97f98d
Fix stuff.
dvc94ch Jun 11, 2019
a75d3ad
Update Cargo.lock to fix CI
Demi-Marie Jun 11, 2019
3fb729b
Merge branch 'master' into gav-new-sessions
Demi-Marie Jun 12, 2019
cbd8437
Re-add missing AuRa logs
Demi-Marie Jun 12, 2019
99e58a7
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 12, 2019
b8f6500
Update core/consensus/babe/src/digest.rs
gavofyork Jun 12, 2019
8c15101
Kill log trait and all that jazz.
gavofyork Jun 12, 2019
24d175c
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 12, 2019
aa0956a
Refactor staking tests.
dvc94ch Jun 12, 2019
f788794
Fix ci runtime wasm check.
dvc94ch Jun 12, 2019
91a0495
Line length 120.
dvc94ch Jun 12, 2019
0399856
Make tests build again
gavofyork Jun 12, 2019
6ef0cb9
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 12, 2019
b777ba9
Remove trailing commas in function declarations
Demi-Marie Jun 12, 2019
df313e0
Fix type error
Demi-Marie Jun 12, 2019
26f4a2d
Merge remote-tracking branch 'origin/master' into gav-new-sessions
Demi-Marie Jun 12, 2019
988e94d
Fix compilation errors
Demi-Marie Jun 12, 2019
ae7cc46
Fix a test
gavofyork Jun 13, 2019
f82c155
Another couple of fixes
gavofyork Jun 13, 2019
f8af78d
Fix another test
gavofyork Jun 13, 2019
ea77d7d
More test fixes
gavofyork Jun 13, 2019
b6a5548
Another test fix
gavofyork Jun 13, 2019
bb19f0b
Merge branch 'master' into gav-new-sessions
gavofyork Jun 13, 2019
3fcb3a7
Bump runtime.
gavofyork Jun 13, 2019
03249cd
Wrap long line
gavofyork Jun 13, 2019
56f5ac1
Fix build, remove redundant code.
gavofyork Jun 13, 2019
db47886
Issue to track TODO
gavofyork Jun 13, 2019
6b44e5f
Leave the benchmark code alone.
gavofyork Jun 13, 2019
2e8c85f
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 13, 2019
5beee4b
Fix missing `std::time::{Instant, Duration}`
Demi-Marie Jun 13, 2019
3ee9625
Indentation
gavofyork Jun 14, 2019
0ad33b9
Aura ConsensusLog as enum
gavofyork Jun 14, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ cargo-check-subkey:
- cd ./subkey
- time cargo check --release # makes sense to save artifacts for building it
- sccache -s


test-linux-stable: &test-linux
stage: test
Expand All @@ -127,7 +127,7 @@ test-linux-stable-int:
- $DEPLOY_TAG
script:
- ./scripts/build.sh --locked
- time RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace
- time RUST_LOG=sync=trace,consensus=trace,client=trace,state-db=trace,db=trace,forks=trace,state_db=trace,storage_cache=trace
cargo test -p node-cli --release --verbose --locked -- --ignored --test-threads=1
- sccache -s
allow_failure: true
Expand Down
51 changes: 7 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ members = [
"srml/assets",
"srml/aura",
"srml/balances",
"srml/consensus",
"srml/contract",
"srml/council",
"srml/democracy",
Expand Down
4 changes: 1 addition & 3 deletions core/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use consensus_common::{self, evaluation};
use primitives::{H256, Blake2Hasher, ExecutionContext};
use runtime_primitives::traits::{
Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi,
AuthorityIdFor, DigestFor,
DigestFor,
};
use runtime_primitives::generic::BlockId;
use runtime_primitives::ApplyError;
Expand Down Expand Up @@ -134,7 +134,6 @@ impl<C, A> consensus_common::Environment<<C as AuthoringApi>::Block> for Propose
fn init(
&self,
parent_header: &<<C as AuthoringApi>::Block as BlockT>::Header,
_: &[AuthorityIdFor<<C as AuthoringApi>::Block>],
) -> Result<Self::Proposer, error::Error> {
let parent_hash = parent_header.hash();

Expand Down Expand Up @@ -320,7 +319,6 @@ mod tests {

let mut proposer = proposer_factory.init(
&client.header(&BlockId::number(0)).unwrap().unwrap(),
&[]
).unwrap();

// when
Expand Down
24 changes: 17 additions & 7 deletions core/client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ use trie::{MemoryDB, PrefixedMemoryDB, prefixed_key};
use parking_lot::{Mutex, RwLock};
use primitives::{H256, Blake2Hasher, ChangesTrieConfiguration, convert_hash};
use primitives::storage::well_known_keys;
use runtime_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
use runtime_primitives::{
generic::{BlockId, DigestItem}, Justification, StorageOverlay, ChildrenStorageOverlay,
BuildStorage
};
use runtime_primitives::traits::{
Block as BlockT, Header as HeaderT, NumberFor, Zero, One, Digest, DigestItem,
SaturatedConversion
Block as BlockT, Header as HeaderT, NumberFor, Zero, One, SaturatedConversion
};
use runtime_primitives::BuildStorage;
use state_machine::backend::Backend as StateBackend;
use executor::RuntimeInfo;
use state_machine::{CodeExecutor, DBValue};
Expand Down Expand Up @@ -418,7 +419,11 @@ where Block: BlockT<Hash=H256>,
Ok(())
}

fn reset_storage(&mut self, top: StorageOverlay, children: ChildrenStorageOverlay) -> Result<H256, client::error::Error> {
fn reset_storage(
&mut self,
top: StorageOverlay,
children: ChildrenStorageOverlay
) -> Result<H256, client::error::Error> {

if top.iter().any(|(k, _)| well_known_keys::is_child_storage_key(k)) {
return Err(client::error::Error::GenesisInvalid.into());
Expand Down Expand Up @@ -527,7 +532,13 @@ impl<Block: BlockT<Hash=H256>> DbChangesTrieStorage<Block> {
}

/// Prune obsolete changes tries.
pub fn prune(&self, config: &ChangesTrieConfiguration, tx: &mut DBTransaction, block_hash: Block::Hash, block_num: NumberFor<Block>) {
pub fn prune(
&self,
config: &ChangesTrieConfiguration,
tx: &mut DBTransaction,
block_hash: Block::Hash,
block_num: NumberFor<Block>,
) {
// never prune on archive nodes
let min_blocks_to_keep = match self.min_blocks_to_keep {
Some(min_blocks_to_keep) => min_blocks_to_keep,
Expand Down Expand Up @@ -1399,7 +1410,6 @@ mod tests {
changes: Vec<(Vec<u8>, Vec<u8>)>,
extrinsics_root: H256,
) -> H256 {
use runtime_primitives::generic::DigestItem;
use runtime_primitives::testing::Digest;

let (changes_root, changes_trie_update) = prepare_changes(changes);
Expand Down
12 changes: 4 additions & 8 deletions core/client/db/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ use client::error::{Error as ClientError, Result as ClientResult};
use client::light::blockchain::Storage as LightBlockchainStorage;
use parity_codec::{Decode, Encode};
use primitives::Blake2Hasher;
use runtime_primitives::generic::BlockId;
use runtime_primitives::traits::{
Block as BlockT, Header as HeaderT,
Zero, One, NumberFor, Digest, DigestItem,
};
use runtime_primitives::generic::{DigestItem, BlockId};
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, One, NumberFor};
use consensus_common::well_known_cache_keys;
use crate::cache::{DbCacheSync, DbCache, ComplexBlockId, EntryType as CacheEntryType};
use crate::utils::{self, meta_keys, Meta, db_err, read_db, block_id_to_lookup_key, read_meta};
Expand Down Expand Up @@ -574,11 +571,10 @@ pub(crate) mod tests {
use client::cht;
use runtime_primitives::generic::DigestItem;
use runtime_primitives::testing::{H256 as Hash, Header, Block as RawBlock, ExtrinsicWrapper};
use runtime_primitives::traits::AuthorityIdFor;
use super::*;

type Block = RawBlock<ExtrinsicWrapper<u32>>;
type AuthorityId = AuthorityIdFor<Block>;
type AuthorityId = primitives::ed25519::Public;

pub fn default_header(parent: &Hash, number: u64) -> Header {
Header {
Expand Down Expand Up @@ -871,7 +867,7 @@ pub(crate) mod tests {
fn authorities_are_cached() {
let db = LightStorage::new_test();

fn run_checks(db: &LightStorage<Block>, max: u64, checks: &[(u64, Option<Vec<AuthorityIdFor<Block>>>)]) {
fn run_checks(db: &LightStorage<Block>, max: u64, checks: &[(u64, Option<Vec<AuthorityId>>)]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @svyatonik are there plans to replace this with the generic runtime cache system?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what do you mean by generic runtime cache system, but the it is generic enough to hold anything that is Encode + Decode

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that this function references AuthorityId, which we don't want. What steps need to be taken to generalize that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just the test :) It uses AuthorityId by historical reasons. I think we could easily switch it to use u64 instead.

for (at, expected) in checks.iter().take_while(|(at, _)| *at <= max) {
let actual = get_authorities(db.cache(), BlockId::Number(*at));
assert_eq!(*expected, actual);
Expand Down
6 changes: 3 additions & 3 deletions core/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ use consensus::{
};
use runtime_primitives::traits::{
Block as BlockT, Header as HeaderT, Zero, NumberFor, CurrentHeight,
BlockNumberToHash, ApiRef, ProvideRuntimeApi, Digest, DigestItem,
BlockNumberToHash, ApiRef, ProvideRuntimeApi,
SaturatedConversion, One, DigestFor,
};
use runtime_primitives::generic::DigestItem;
use runtime_primitives::BuildStorage;
use crate::runtime_api::{
CallRuntimeAt, ConstructRuntimeApi, Core as CoreApi, ProofRecorder,
Expand Down Expand Up @@ -1705,8 +1706,7 @@ pub(crate) mod tests {
use std::collections::HashMap;
use super::*;
use primitives::blake2_256;
use runtime_primitives::traits::DigestItem as DigestItemT;
use runtime_primitives::generic::DigestItem;
use runtime_primitives::DigestItem;
use consensus::{BlockOrigin, SelectChain};
use test_client::{
prelude::*,
Expand Down
Loading