This guide walks you through setting up the on-chain program and config account to control gossip push active set behavior in a Solana validator.
./multinode-demo/setup.sh
./multinode-demo/faucet.shsolana-keygen new -o config-authority.json
solana airdrop 100 --keypair config-authority.json --ul./multinode-demo/bootstrap-validator.sh --log ~/mnode-demo.logcd update-config
cargo build-sbf
cd ../target/deploy/
solana program deploy ./update_config.so -ul --keypair ~/accounts-control/config-authority.json
config-authority.jsonis the funded keypair used to deploy the program.
Sample output:
Program Id: 2dGCYowSix7WWkDUgcxAxyazNkCBZAfrCUxZUGAsTyXh
Signature: uWpodzBXFE135ynGSrj2NQ18cSpQwnKm2xxnzjeCZefP...
solana-keygen new -o gossip-weighting-config-account.jsonGet the config account pubkey:
solana address -k gossip-weighting-config-account.jsonSample output:
9aFDtRxwS1EjG8JnUnzpwRRvN47xNApF1hPY3GAu8kVp
Update your validator code:
mod weighting_config_control_pubkey {
solana_pubkey::declare_id!("9aFDtRxwS1EjG8JnUnzpwRRvN47xNApF1hPY3GAu8kVp");
}You'll have to restart your validators.
cargo run -p create-config-account./multinode-demo/validator-x.sh
./multinode-demo/validator-x.shEdit push-new-weight-config to set the appropriate WeightingConfig, then run:
cargo run -p push-new-weight-configYou can pass in keypair files, weighting-mode, and tc_ms as well. Run:
cargo run -p push-new-weight-config -- --helpEvery 7.5 seconds (at each PushActiveSet refresh), the validator should load the config account and log:
greg: apply_cfg: WeightingConfig { weighting_mode: 1, tc_ms: 30000 }