Configure supermajority threshold via envvars (#471)

This commit is contained in:
gusto 2023-10-30 09:38:57 +01:00 committed by GitHub
parent ef243b0ee5
commit 7fcfe890be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# Environment variables for compose.yml file config. # Environment variables for compose.yml file config.
DOCKER_COMPOSE_LIBP2P_REPLICAS=1 DOCKER_COMPOSE_LIBP2P_REPLICAS=1
DOCKER_COMPOSE_LIBP2P_NODE_KEY_MASK=2000000000000000000000000000000000000000000000000000000000000000 DOCKER_COMPOSE_LIBP2P_NODE_KEY_MASK=2000000000000000000000000000000000000000000000000000000000000000
DOCKER_COMPOSE_SUPER_MAJORITY_THRESHOLD=1
DOCKER_COMPOSE_ETCDCTL_ENDPOINTS=etcd:2379 DOCKER_COMPOSE_ETCDCTL_ENDPOINTS=etcd:2379
DOCKER_COMPOSE_ETCDCTL_API=3 DOCKER_COMPOSE_ETCDCTL_API=3
DOCKER_COMPOSE_BOOSTRAP_NET_NODE_KEY=1000000000000000000000000000000000000000000000000000000000000000 DOCKER_COMPOSE_BOOSTRAP_NET_NODE_KEY=1000000000000000000000000000000000000000000000000000000000000000

View File

@ -10,6 +10,7 @@ services:
volumes: volumes:
- ./testnet:/etc/nomos - ./testnet:/etc/nomos
environment: environment:
- OVERLAY_SUPER_MAJORITY_THRESHOLD=${DOCKER_COMPOSE_SUPER_MAJORITY_THRESHOLD:-1}
- NET_NODE_KEY=${DOCKER_COMPOSE_BOOSTRAP_NET_NODE_KEY:-1000000000000000000000000000000000000000000000000000000000000000} - NET_NODE_KEY=${DOCKER_COMPOSE_BOOSTRAP_NET_NODE_KEY:-1000000000000000000000000000000000000000000000000000000000000000}
command: /etc/nomos/bootstrap_config.yaml command: /etc/nomos/bootstrap_config.yaml
@ -28,6 +29,7 @@ services:
- mix-node-1 - mix-node-1
- mix-node-2 - mix-node-2
environment: environment:
- OVERLAY_SUPER_MAJORITY_THRESHOLD=${DOCKER_COMPOSE_SUPER_MAJORITY_THRESHOLD:-1}
- LIBP2P_REPLICAS=${DOCKER_COMPOSE_LIBP2P_REPLICAS:-1} - LIBP2P_REPLICAS=${DOCKER_COMPOSE_LIBP2P_REPLICAS:-1}
- ETCDCTL_ENDPOINTS=${DOCKER_COMPOSE_ETCDCTL_ENDPOINTS:-etcd:2379} - ETCDCTL_ENDPOINTS=${DOCKER_COMPOSE_ETCDCTL_ENDPOINTS:-etcd:2379}
- ETCDCTL_API=${DOCKER_COMPOSE_ETCDCTL_API:-3} - ETCDCTL_API=${DOCKER_COMPOSE_ETCDCTL_API:-3}

View File

@ -13,6 +13,7 @@ consensus:
cur: 0 cur: 0
committee_membership: !Sad committee_membership: !Sad
entropy: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] entropy: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
super_majority_threshold: 1
network: network:
backend: backend:

View File

@ -96,10 +96,16 @@ pub struct OverlayArgs {
pub overlay_leader: Option<String>, pub overlay_leader: Option<String>,
#[clap( #[clap(
long = "overlay-leader-super-majority-threshold", long = "overlay-number-of-committees",
env = "OVERLAY_NUMBER_OF_COMMITTEES" env = "OVERLAY_NUMBER_OF_COMMITTEES"
)] )]
pub overlay_number_of_committees: Option<usize>, pub overlay_number_of_committees: Option<usize>,
#[clap(
long = "overlay-super-majority-threshold",
env = "OVERLAY_SUPER_MAJORITY_THRESHOLD"
)]
pub overlay_super_majority_threshold: Option<f32>,
} }
#[derive(Deserialize, Debug, Clone, Serialize)] #[derive(Deserialize, Debug, Clone, Serialize)]
@ -228,6 +234,7 @@ impl Config {
overlay_nodes, overlay_nodes,
overlay_leader, overlay_leader,
overlay_number_of_committees, overlay_number_of_committees,
overlay_super_majority_threshold,
} = overlay_args; } = overlay_args;
if let Some(nodes) = overlay_nodes { if let Some(nodes) = overlay_nodes {
@ -250,6 +257,11 @@ impl Config {
self.consensus.overlay_settings.number_of_committees = committees; self.consensus.overlay_settings.number_of_committees = committees;
} }
if let Some(super_majority_threshold) = overlay_super_majority_threshold {
self.consensus.overlay_settings.super_majority_threshold =
Some(super_majority_threshold.into());
}
Ok(self) Ok(self)
} }
} }