Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(consensus): use non zero values as validator id #2436

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"consensus.validator_id": {
"description": "The validator id of the node.",
"privacy": "Public",
"value": "0x0"
"value": "0x64"
},
"monitoring_gateway.collect_metrics": {
"description": "If true, collect and return metrics in the monitoring gateway.",
Expand Down Expand Up @@ -509,4 +509,4 @@
"privacy": "Public",
"value": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ expression: dumped_default_config
},
"consensus.validator_id": {
"description": "The validator id of the node.",
"value": "0x0",
"value": "0x64",
"privacy": "Public"
},
"monitoring_gateway.collect_metrics": {
Expand Down
2 changes: 1 addition & 1 deletion crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl Default for ConsensusConfig {
..Default::default()
};
Self {
validator_id: ValidatorId::default(),
validator_id: ValidatorId::from(100_u32),
network_topic: "consensus".to_string(),
start_height: BlockNumber::default(),
num_validators: 1,
Expand Down
2 changes: 1 addition & 1 deletion crates/sequencing/papyrus_consensus/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl TryFrom<MockProposalPart> for ProposalInit {
Ok(ProposalInit {
height: BlockNumber(part.0),
round: 0,
proposer: ValidatorId::default(),
proposer: ValidatorId::from(100_u32),
valid_round: None,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn build_proposal() {
let proposal_init = ProposalInit {
height: block_number,
round: 0,
proposer: ValidatorId::default(),
proposer: ValidatorId::from(100_u32),
valid_round: None,
};
// TODO(Asmaa): Test proposal content.
Expand Down Expand Up @@ -70,7 +70,7 @@ async fn validate_proposal_success() {
.validate_proposal(
block_number,
0,
ValidatorId::default(),
ValidatorId::from(100_u32),
Duration::MAX,
validate_receiver,
)
Expand Down Expand Up @@ -101,7 +101,7 @@ async fn validate_proposal_fail() {
.validate_proposal(
block_number,
0,
ValidatorId::default(),
ValidatorId::from(100_u32),
Duration::MAX,
validate_receiver,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async fn build_proposal() {
let init = ProposalInit {
height: BlockNumber(0),
round: 0,
proposer: ValidatorId::default(),
proposer: ValidatorId::from(100_u32),
valid_round: None,
};
// TODO(Asmaa): Test proposal content.
Expand Down Expand Up @@ -208,7 +208,7 @@ async fn validate_proposal_success() {
.await
.unwrap();
let fin_receiver = context
.validate_proposal(BlockNumber(0), 0, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 0, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;
content_sender.close_channel();
assert_eq!(fin_receiver.await.unwrap().0.0, STATE_DIFF_COMMITMENT.0.0);
Expand Down Expand Up @@ -269,7 +269,7 @@ async fn repropose() {
});
content_sender.send(prop_part).await.unwrap();
let fin_receiver = context
.validate_proposal(BlockNumber(0), 0, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 0, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;
content_sender.close_channel();
assert_eq!(fin_receiver.await.unwrap().0.0, STATE_DIFF_COMMITMENT.0.0);
Expand Down Expand Up @@ -351,7 +351,7 @@ async fn proposals_from_different_rounds() {
content_sender.send(prop_part_txs.clone()).await.unwrap();

let fin_receiver_past_round = context
.validate_proposal(BlockNumber(0), 0, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 0, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;
// No fin was sent, channel remains open.
assert!(fin_receiver_past_round.await.is_err());
Expand All @@ -361,7 +361,7 @@ async fn proposals_from_different_rounds() {
content_sender.send(prop_part_txs.clone()).await.unwrap();
content_sender.send(prop_part_fin.clone()).await.unwrap();
let fin_receiver_curr_round = context
.validate_proposal(BlockNumber(0), 1, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 1, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;
assert_eq!(fin_receiver_curr_round.await.unwrap().0.0, STATE_DIFF_COMMITMENT.0.0);

Expand All @@ -370,7 +370,7 @@ async fn proposals_from_different_rounds() {
content_sender.send(prop_part_txs.clone()).await.unwrap();
content_sender.send(prop_part_fin.clone()).await.unwrap();
let fin_receiver_future_round = context
.validate_proposal(BlockNumber(0), 2, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 2, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;
content_sender.close_channel();
// Even with sending fin and closing the channel.
Expand Down Expand Up @@ -439,7 +439,7 @@ async fn interrupt_active_proposal() {
// without needing interrupt.
let (mut _content_sender_0, content_receiver) = mpsc::channel(CHANNEL_SIZE);
let fin_receiver_0 = context
.validate_proposal(BlockNumber(0), 0, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 0, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;

let (mut content_sender_1, content_receiver) = mpsc::channel(CHANNEL_SIZE);
Expand All @@ -457,7 +457,7 @@ async fn interrupt_active_proposal() {
.await
.unwrap();
let fin_receiver_1 = context
.validate_proposal(BlockNumber(0), 1, ValidatorId::default(), TIMEOUT, content_receiver)
.validate_proposal(BlockNumber(0), 1, ValidatorId::from(100_u32), TIMEOUT, content_receiver)
.await;
// Move the context to the next round.
context.set_height_and_round(BlockNumber(0), 1).await;
Expand Down
Loading