Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 4fdbf97

Browse files
bkchrandresilva
andauthored
Companion for #7997 (#2345)
* Companion for #7997 paritytech/substrate#7997 * rename slot_number to slot * rename SlotNumber type in overseer docs * "Update Substrate" Co-authored-by: André Silva <[email protected]> Co-authored-by: parity-processbot <>
1 parent 7086091 commit 4fdbf97

File tree

12 files changed

+171
-169
lines changed

12 files changed

+171
-169
lines changed

Cargo.lock

Lines changed: 141 additions & 139 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/core/approval-voting/src/aux_schema/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use polkadot_primitives::v1::{
3939
ValidatorIndex, GroupIndex, CandidateReceipt, SessionIndex, CoreIndex,
4040
BlockNumber, Hash, CandidateHash,
4141
};
42-
use sp_consensus_slots::SlotNumber;
42+
use sp_consensus_slots::Slot;
4343
use parity_scale_codec::{Encode, Decode};
4444

4545
use std::collections::{BTreeMap, HashMap};
@@ -94,7 +94,7 @@ pub(crate) struct CandidateEntry {
9494
pub(crate) struct BlockEntry {
9595
block_hash: Hash,
9696
session: SessionIndex,
97-
slot: SlotNumber,
97+
slot: Slot,
9898
relay_vrf_story: RelayVRF,
9999
// The candidates included as-of this block and the index of the core they are
100100
// leaving. Sorted ascending by core index.

node/core/approval-voting/src/aux_schema/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn make_block_entry(
8989
BlockEntry {
9090
block_hash,
9191
session: 1,
92-
slot: 1,
92+
slot: 1.into(),
9393
relay_vrf_story: RelayVRF([0u8; 32]),
9494
approved_bitfield: make_bitvec(candidates.len()),
9595
candidates,

node/network/approval-distribution/src/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ fn try_import_the_same_assignment() {
202202
parent_hash,
203203
number: 2,
204204
candidates: vec![Default::default(); 1],
205-
slot_number: 1,
205+
slot: 1.into(),
206206
};
207207
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
208208
overseer_send(overseer, msg).await;
@@ -288,7 +288,7 @@ fn spam_attack_results_in_negative_reputation_change() {
288288
parent_hash,
289289
number: 2,
290290
candidates: vec![Default::default(); candidates_count],
291-
slot_number: 1,
291+
slot: 1.into(),
292292
};
293293

294294
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
@@ -363,7 +363,7 @@ fn import_approval_happy_path() {
363363
parent_hash,
364364
number: 1,
365365
candidates: vec![Default::default(); 1],
366-
slot_number: 1,
366+
slot: 1.into(),
367367
};
368368
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
369369
overseer_send(overseer, msg).await;
@@ -447,7 +447,7 @@ fn import_approval_bad() {
447447
parent_hash,
448448
number: 1,
449449
candidates: vec![Default::default(); 1],
450-
slot_number: 1,
450+
slot: 1.into(),
451451
};
452452
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
453453
overseer_send(overseer, msg).await;
@@ -521,21 +521,21 @@ fn update_our_view() {
521521
parent_hash,
522522
number: 1,
523523
candidates: vec![Default::default(); 1],
524-
slot_number: 1,
524+
slot: 1.into(),
525525
};
526526
let meta_b = BlockApprovalMeta {
527527
hash: hash_b,
528528
parent_hash: hash_a,
529529
number: 2,
530530
candidates: vec![Default::default(); 1],
531-
slot_number: 1,
531+
slot: 1.into(),
532532
};
533533
let meta_c = BlockApprovalMeta {
534534
hash: hash_c,
535535
parent_hash: hash_b,
536536
number: 3,
537537
candidates: vec![Default::default(); 1],
538-
slot_number: 1,
538+
slot: 1.into(),
539539
};
540540

541541
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta_a, meta_b, meta_c]);
@@ -591,21 +591,21 @@ fn update_peer_view() {
591591
parent_hash,
592592
number: 1,
593593
candidates: vec![Default::default(); 1],
594-
slot_number: 1,
594+
slot: 1.into(),
595595
};
596596
let meta_b = BlockApprovalMeta {
597597
hash: hash_b,
598598
parent_hash: hash_a,
599599
number: 2,
600600
candidates: vec![Default::default(); 1],
601-
slot_number: 1,
601+
slot: 1.into(),
602602
};
603603
let meta_c = BlockApprovalMeta {
604604
hash: hash_c,
605605
parent_hash: hash_b,
606606
number: 3,
607607
candidates: vec![Default::default(); 1],
608-
slot_number: 1,
608+
slot: 1.into(),
609609
};
610610

611611
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta_a, meta_b, meta_c]);
@@ -742,7 +742,7 @@ fn import_remotely_then_locally() {
742742
parent_hash,
743743
number: 1,
744744
candidates: vec![Default::default(); 1],
745-
slot_number: 1,
745+
slot: 1.into(),
746746
};
747747
let msg = ApprovalDistributionMessage::NewBlocks(vec![meta]);
748748
overseer_send(overseer, msg).await;

node/primitives/src/approval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Types relevant for approval.
1818
1919
pub use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof};
20-
pub use sp_consensus_slots::SlotNumber;
20+
pub use sp_consensus_slots::Slot;
2121

2222
use polkadot_primitives::v1::{
2323
CandidateHash, Hash, ValidatorIndex, Signed, ValidatorSignature, CoreIndex,
@@ -118,6 +118,6 @@ pub struct BlockApprovalMeta {
118118
/// The candidates included by the block.
119119
/// Note that these are not the same as the candidates that appear within the block body.
120120
pub candidates: Vec<CandidateHash>,
121-
/// The consensus slot number of the block.
122-
pub slot_number: SlotNumber,
121+
/// The consensus slot of the block.
122+
pub slot: Slot,
123123
}

roadmap/implementers-guide/src/node/approval/approval-voting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct CandidateEntry {
7171
struct BlockEntry {
7272
block_hash: Hash,
7373
session: SessionIndex,
74-
slot: SlotNumber,
74+
slot: Slot,
7575
// random bytes derived from the VRF submitted within the block by the block
7676
// author as a credential and used as input to approval assignment criteria.
7777
relay_vrf_story: [u8; 32],

roadmap/implementers-guide/src/types/overseer-protocol.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ struct BlockApprovalMeta {
101101
/// The candidates included by the block. Note that these are not the same as the candidates that appear within the
102102
/// block body.
103103
candidates: Vec<CandidateHash>,
104-
/// The consensus slot number of the block.
105-
slot_number: SlotNumber,
104+
/// The consensus slot of the block.
105+
slot: Slot,
106106
}
107107

108108
enum ApprovalDistributionMessage {

runtime/kusama/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ sp_api::impl_runtime_apis! {
12401240
}
12411241
}
12421242

1243-
fn current_epoch_start() -> babe_primitives::SlotNumber {
1243+
fn current_epoch_start() -> babe_primitives::Slot {
12441244
Babe::current_epoch_start()
12451245
}
12461246

@@ -1253,7 +1253,7 @@ sp_api::impl_runtime_apis! {
12531253
}
12541254

12551255
fn generate_key_ownership_proof(
1256-
_slot_number: babe_primitives::SlotNumber,
1256+
_slot: babe_primitives::Slot,
12571257
authority_id: babe_primitives::AuthorityId,
12581258
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
12591259
use parity_scale_codec::Encode;

runtime/polkadot/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ sp_api::impl_runtime_apis! {
12351235
}
12361236
}
12371237

1238-
fn current_epoch_start() -> babe_primitives::SlotNumber {
1238+
fn current_epoch_start() -> babe_primitives::Slot {
12391239
Babe::current_epoch_start()
12401240
}
12411241

@@ -1248,7 +1248,7 @@ sp_api::impl_runtime_apis! {
12481248
}
12491249

12501250
fn generate_key_ownership_proof(
1251-
_slot_number: babe_primitives::SlotNumber,
1251+
_slot: babe_primitives::Slot,
12521252
authority_id: babe_primitives::AuthorityId,
12531253
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
12541254
use parity_scale_codec::Encode;

runtime/rococo/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ sp_api::impl_runtime_apis! {
804804
}
805805
}
806806

807-
fn current_epoch_start() -> babe_primitives::SlotNumber {
807+
fn current_epoch_start() -> babe_primitives::Slot {
808808
Babe::current_epoch_start()
809809
}
810810

@@ -817,7 +817,7 @@ sp_api::impl_runtime_apis! {
817817
}
818818

819819
fn generate_key_ownership_proof(
820-
_slot_number: babe_primitives::SlotNumber,
820+
_slot: babe_primitives::Slot,
821821
authority_id: babe_primitives::AuthorityId,
822822
) -> Option<babe_primitives::OpaqueKeyOwnershipProof> {
823823
use parity_scale_codec::Encode;

0 commit comments

Comments
 (0)