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

Add a single CometBFT dummy validator #4116

Merged
merged 2 commits into from
Nov 29, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Only write a dummy validator to CometBFT's genesis if the number of validators
present is lower than 2. ([\#4116](https://github.com/anoma/namada/pull/4116))
18 changes: 10 additions & 8 deletions crates/node/src/tendermint_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,16 @@ async fn write_tm_genesis(
// validator unless we insert a dummy. If cometbft thinks a node is the
// only validator, it won't start state sync. These validators are
// overwritten after init chain is called.
const DUMMY_VALIDATOR: [u8; 32] = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
];
genesis.validators.push(Info::new(
PublicKey::from_raw_ed25519(&DUMMY_VALIDATOR).unwrap(),
10u32.into(),
));
if genesis.validators.len() < 2 {
const DUMMY_VALIDATOR: [u8; 32] = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
];
genesis.validators.push(Info::new(
PublicKey::from_raw_ed25519(&DUMMY_VALIDATOR).unwrap(),
10u32.into(),
));
}
const EVIDENCE_AND_PROTOBUF_OVERHEAD: u64 = 10 * 1024 * 1024;
let size = block::Size {
// maximum size of a serialized Tendermint block.
Expand Down