Da voter config for docker compose (#513)
* Readd docker build context * Configurable da protocol voter * Do not use private key naming for da voter
This commit is contained in:
parent
df683ad154
commit
c14998bb9a
|
@ -3,7 +3,9 @@ services:
|
|||
|
||||
bootstrap:
|
||||
container_name: bootstrap
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
ports:
|
||||
- "3000:3000/tcp"
|
||||
- "18080:8080/tcp"
|
||||
|
@ -22,7 +24,9 @@ services:
|
|||
|
||||
libp2p-node-1:
|
||||
container_name: libp2p_node_1
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
volumes:
|
||||
- ./testnet:/etc/nomos
|
||||
depends_on:
|
||||
|
@ -46,7 +50,9 @@ services:
|
|||
|
||||
libp2p-node-2:
|
||||
container_name: libp2p_node_2
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
volumes:
|
||||
- ./testnet:/etc/nomos
|
||||
depends_on:
|
||||
|
@ -70,7 +76,9 @@ services:
|
|||
|
||||
libp2p-node-3:
|
||||
container_name: libp2p_node_3
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
volumes:
|
||||
- ./testnet:/etc/nomos
|
||||
depends_on:
|
||||
|
@ -94,7 +102,9 @@ services:
|
|||
|
||||
mix-node-0:
|
||||
container_name: mix_node_0
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
volumes:
|
||||
- ./testnet:/etc/nomos
|
||||
ports:
|
||||
|
@ -105,7 +115,9 @@ services:
|
|||
|
||||
mix-node-1:
|
||||
container_name: mix_node_1
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
volumes:
|
||||
- ./testnet:/etc/nomos
|
||||
ports:
|
||||
|
@ -116,7 +128,9 @@ services:
|
|||
|
||||
mix-node-2:
|
||||
container_name: mix_node_2
|
||||
build: "testnet"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: testnet/Dockerfile
|
||||
volumes:
|
||||
- ./testnet:/etc/nomos
|
||||
ports:
|
||||
|
|
|
@ -108,6 +108,12 @@ pub struct OverlayArgs {
|
|||
pub overlay_super_majority_threshold: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
pub struct DaArgs {
|
||||
#[clap(long = "da-voter", env = "DA_VOTER")]
|
||||
da_voter: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone, Serialize)]
|
||||
pub struct Config {
|
||||
pub log: <Logger as ServiceData>::Settings,
|
||||
|
@ -264,4 +270,15 @@ impl Config {
|
|||
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub fn update_da(mut self, da_args: DaArgs) -> Result<Self> {
|
||||
let DaArgs { da_voter } = da_args;
|
||||
|
||||
if let Some(voter) = da_voter {
|
||||
let bytes = <[u8; 32]>::from_hex(voter)?;
|
||||
self.da.da_protocol.voter = bytes;
|
||||
}
|
||||
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ use nomos_storage::{
|
|||
StorageService,
|
||||
};
|
||||
|
||||
pub use config::{Config, ConsensusArgs, HttpArgs, LogArgs, NetworkArgs, OverlayArgs};
|
||||
pub use config::{Config, ConsensusArgs, DaArgs, HttpArgs, LogArgs, NetworkArgs, OverlayArgs};
|
||||
use nomos_core::{
|
||||
da::certificate::select::FillSize as FillSizeWithBlobsCertificate,
|
||||
tx::select::FillSize as FillSizeWithTx,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use full_replication::{Blob, Certificate};
|
||||
use nomos_node::{
|
||||
Config, ConsensusArgs, HttpArgs, LogArgs, NetworkArgs, Nomos, NomosServiceSettings,
|
||||
Config, ConsensusArgs, DaArgs, HttpArgs, LogArgs, NetworkArgs, Nomos, NomosServiceSettings,
|
||||
OverlayArgs, Tx,
|
||||
};
|
||||
|
||||
|
@ -40,11 +40,15 @@ struct Args {
|
|||
/// Overrides overlay config.
|
||||
#[clap(flatten)]
|
||||
overlay_args: OverlayArgs,
|
||||
/// Overrides da config.
|
||||
#[clap(flatten)]
|
||||
da_args: DaArgs,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let Args {
|
||||
config,
|
||||
da_args,
|
||||
log_args,
|
||||
http_args,
|
||||
network_args,
|
||||
|
@ -52,6 +56,7 @@ fn main() -> Result<()> {
|
|||
overlay_args,
|
||||
} = Args::parse();
|
||||
let config = serde_yaml::from_reader::<_, Config>(std::fs::File::open(config)?)?
|
||||
.update_da(da_args)?
|
||||
.update_log(log_args)?
|
||||
.update_http(http_args)?
|
||||
.update_consensus(consensus_args)?
|
||||
|
|
|
@ -70,6 +70,7 @@ http:
|
|||
|
||||
da:
|
||||
da_protocol:
|
||||
voter: [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]
|
||||
num_attestations: 1
|
||||
backend:
|
||||
max_capacity: 10
|
||||
|
|
|
@ -70,6 +70,7 @@ http:
|
|||
|
||||
da:
|
||||
da_protocol:
|
||||
voter: [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]
|
||||
num_attestations: 1
|
||||
backend:
|
||||
max_capacity: 10
|
||||
|
|
|
@ -3,15 +3,18 @@
|
|||
set -e
|
||||
|
||||
CONSENSUS_PRIV_KEY=$BOOTSTRAP_NODE_KEY
|
||||
DA_VOTER_KEY=$BOOTSTRAP_NODE_KEY
|
||||
NET_NODE_KEY=$BOOTSTRAP_NODE_KEY
|
||||
OVERLAY_NODES=$(/etc/nomos/scripts/consensus_node_list.sh)
|
||||
|
||||
export CONSENSUS_PRIV_KEY \
|
||||
DA_VOTER_KEY \
|
||||
OVERLAY_NODES \
|
||||
NET_NODE_KEY
|
||||
|
||||
echo "I am a container ${HOSTNAME} node ${NET_NODE_KEY}"
|
||||
echo "CONSENSUS_PRIV_KEY: ${CONSENSUS_PRIV_KEY}"
|
||||
echo "DA_VOTER_KEY: ${DA_VOTER_KEY}"
|
||||
echo "OVERLAY_NODES: ${OVERLAY_NODES}"
|
||||
|
||||
exec /usr/bin/nomos-node /etc/nomos/bootstrap_config.yaml
|
||||
|
|
|
@ -5,6 +5,7 @@ set -e
|
|||
# Set env variables for nomos-node.
|
||||
NET_NODE_KEY=$(/etc/nomos/scripts/register_node.sh)
|
||||
CONSENSUS_PRIV_KEY=$NET_NODE_KEY
|
||||
DA_VOTER_KEY=$CONSENSUS_PRIV_KEY
|
||||
OVERLAY_NODES=$(/etc/nomos/scripts/consensus_node_list.sh)
|
||||
|
||||
node_ids=$(etcdctl get "/node/" --prefix --keys-only)
|
||||
|
@ -21,12 +22,14 @@ for node_id in $node_ids; do
|
|||
done
|
||||
|
||||
export CONSENSUS_PRIV_KEY \
|
||||
DA_VOTER_KEY \
|
||||
OVERLAY_NODES \
|
||||
NET_NODE_KEY \
|
||||
NET_INITIAL_PEERS
|
||||
|
||||
echo "I am a container ${HOSTNAME} node ${NET_NODE_KEY}"
|
||||
echo "CONSENSUS_PRIV_KEY: ${CONSENSUS_PRIV_KEY}"
|
||||
echo "DA_VOTER_KEY: ${DA_VOTER_KEY}"
|
||||
echo "OVERLAY_NODES: ${OVERLAY_NODES}"
|
||||
echo "NET_INITIAL_PEERS: ${NET_INITIAL_PEERS}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue