From 08bd112c34385224ba0e9f9304be50776da606d5 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Fri, 29 Nov 2024 11:25:32 +0000 Subject: [PATCH 1/2] Add a single CometBFT dummy validator Only writes a dummy validator to CometBFT's genesis if the number of validators present is lower than 2. --- crates/node/src/tendermint_node.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/node/src/tendermint_node.rs b/crates/node/src/tendermint_node.rs index 68698590be..7e26c36b83 100644 --- a/crates/node/src/tendermint_node.rs +++ b/crates/node/src/tendermint_node.rs @@ -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. From 10216251dc8b9d5bfbe4fbdbb832406408054328 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Fri, 29 Nov 2024 11:28:25 +0000 Subject: [PATCH 2/2] Changelog --- .../unreleased/bug-fixes/4116-comet-genesis-validator-set.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/4116-comet-genesis-validator-set.md diff --git a/.changelog/unreleased/bug-fixes/4116-comet-genesis-validator-set.md b/.changelog/unreleased/bug-fixes/4116-comet-genesis-validator-set.md new file mode 100644 index 0000000000..21ae76c1ee --- /dev/null +++ b/.changelog/unreleased/bug-fixes/4116-comet-genesis-validator-set.md @@ -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)) \ No newline at end of file