Unverified Commit 4fdbf977 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Companion for #7997 (#2345)

* Companion for #7997

https://github.com/paritytech/substrate/pull/7997



* rename slot_number to slot

* rename SlotNumber type in overseer docs

* "Update Substrate"
Co-authored-by: default avatarAndré Silva <andrerfosilva@gmail.com>
Co-authored-by: parity-processbot <>
parent 70860910
Pipeline #122244 passed with stages
in 29 minutes and 27 seconds
This diff is collapsed.
......@@ -39,7 +39,7 @@ use polkadot_primitives::v1::{
ValidatorIndex, GroupIndex, CandidateReceipt, SessionIndex, CoreIndex,
BlockNumber, Hash, CandidateHash,
};
use sp_consensus_slots::SlotNumber;
use sp_consensus_slots::Slot;
use parity_scale_codec::{Encode, Decode};
use std::collections::{BTreeMap, HashMap};
......@@ -94,7 +94,7 @@ pub(crate) struct CandidateEntry {
pub(crate) struct BlockEntry {
block_hash: Hash,
session: SessionIndex,
slot: SlotNumber,
slot: Slot,
relay_vrf_story: RelayVRF,
// The candidates included as-of this block and the index of the core they are
// leaving. Sorted ascending by core index.
......
......@@ -89,7 +89,7 @@ fn make_block_entry(
BlockEntry {
block_hash,
session: 1,
slot: 1,
slot: 1.into(),
relay_vrf_story: RelayVRF([0u8; 32]),
approved_bitfield: make_bitvec(candidates.len()),
candidates,
......
......@@ -202,7 +202,7 @@ fn try_import_the_same_assignment() {
parent_hash,
number: 2,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
overseer_send(overseer, msg).await;
......@@ -288,7 +288,7 @@ fn spam_attack_results_in_negative_reputation_change() {
parent_hash,
number: 2,
candidates: vec![Default::default(); candidates_count],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
......@@ -363,7 +363,7 @@ fn import_approval_happy_path() {
parent_hash,
number: 1,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
overseer_send(overseer, msg).await;
......@@ -447,7 +447,7 @@ fn import_approval_bad() {
parent_hash,
number: 1,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
overseer_send(overseer, msg).await;
......@@ -521,21 +521,21 @@ fn update_our_view() {
parent_hash,
number: 1,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let meta_b = BlockApprovalMeta {
hash: hash_b,
parent_hash: hash_a,
number: 2,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let meta_c = BlockApprovalMeta {
hash: hash_c,
parent_hash: hash_b,
number: 3,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta_a, meta_b, meta_c]);
......@@ -591,21 +591,21 @@ fn update_peer_view() {
parent_hash,
number: 1,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let meta_b = BlockApprovalMeta {
hash: hash_b,
parent_hash: hash_a,
number: 2,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let meta_c = BlockApprovalMeta {
hash: hash_c,
parent_hash: hash_b,
number: 3,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta_a, meta_b, meta_c]);
......@@ -742,7 +742,7 @@ fn import_remotely_then_locally() {
parent_hash,
number: 1,
candidates: vec![Default::default(); 1],
slot_number: 1,
slot: 1.into(),
};
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
overseer_send(overseer, msg).await;
......
......@@ -17,7 +17,7 @@
//! Types relevant for approval.
pub use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof};
pub use sp_consensus_slots::SlotNumber;
pub use sp_consensus_slots::Slot;
use polkadot_primitives::v1::{
CandidateHash, Hash, ValidatorIndex, Signed, ValidatorSignature, CoreIndex,
......@@ -118,6 +118,6 @@ pub struct BlockApprovalMeta {
/// The candidates included by the block.
/// Note that these are not the same as the candidates that appear within the block body.
pub candidates: Vec<CandidateHash>,
/// The consensus slot number of the block.
pub slot_number: SlotNumber,
/// The consensus slot of the block.
pub slot: Slot,
}
......@@ -71,7 +71,7 @@ struct CandidateEntry {
struct BlockEntry {
block_hash: Hash,
session: SessionIndex,
slot: SlotNumber,
slot: Slot,
// random bytes derived from the VRF submitted within the block by the block
// author as a credential and used as input to approval assignment criteria.
relay_vrf_story: [u8; 32],
......
......@@ -101,8 +101,8 @@ struct BlockApprovalMeta {
/// The candidates included by the block. Note that these are not the same as the candidates that appear within the
/// block body.
candidates: Vec<CandidateHash>,
/// The consensus slot number of the block.
slot_number: SlotNumber,
/// The consensus slot of the block.
slot: Slot,
}
enum ApprovalDistributionMessage {
......
......@@ -1240,7 +1240,7 @@ sp_api::impl_runtime_apis! {
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
fn current_epoch_start() -> babe_primitives::Slot {
Babe::current_epoch_start()
}
......@@ -1253,7 +1253,7 @@ sp_api::impl_runtime_apis! {
}
fn generate_key_ownership_proof(
_slot_number: babe_primitives::SlotNumber,
_slot: babe_primitives::Slot,
authority_id: babe_primitives::AuthorityId,
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
use parity_scale_codec::Encode;
......
......@@ -1235,7 +1235,7 @@ sp_api::impl_runtime_apis! {
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
fn current_epoch_start() -> babe_primitives::Slot {
Babe::current_epoch_start()
}
......@@ -1248,7 +1248,7 @@ sp_api::impl_runtime_apis! {
}
fn generate_key_ownership_proof(
_slot_number: babe_primitives::SlotNumber,
_slot: babe_primitives::Slot,
authority_id: babe_primitives::AuthorityId,
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
use parity_scale_codec::Encode;
......
......@@ -804,7 +804,7 @@ sp_api::impl_runtime_apis! {
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
fn current_epoch_start() -> babe_primitives::Slot {
Babe::current_epoch_start()
}
......@@ -817,7 +817,7 @@ sp_api::impl_runtime_apis! {
}
fn generate_key_ownership_proof(
_slot_number: babe_primitives::SlotNumber,
_slot: babe_primitives::Slot,
authority_id: babe_primitives::AuthorityId,
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
use parity_scale_codec::Encode;
......
......@@ -735,7 +735,7 @@ sp_api::impl_runtime_apis! {
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
fn current_epoch_start() -> babe_primitives::Slot {
Babe::current_epoch_start()
}
......@@ -748,7 +748,7 @@ sp_api::impl_runtime_apis! {
}
fn generate_key_ownership_proof(
_slot_number: babe_primitives::SlotNumber,
_slot: babe_primitives::Slot,
_authority_id: babe_primitives::AuthorityId,
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
None
......
......@@ -950,7 +950,7 @@ sp_api::impl_runtime_apis! {
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
fn current_epoch_start() -> babe_primitives::Slot {
Babe::current_epoch_start()
}
......@@ -963,7 +963,7 @@ sp_api::impl_runtime_apis! {
}
fn generate_key_ownership_proof(
_slot_number: babe_primitives::SlotNumber,
_slot: babe_primitives::Slot,
authority_id: babe_primitives::AuthorityId,
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
use parity_scale_codec::Encode;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment