Skip to content

Commit

Permalink
Merge pull request #118 from chainbound/fix/sidecar/cli-params
Browse files Browse the repository at this point in the history
fix(sidecar): hex private key
  • Loading branch information
merklefruit authored Jul 5, 2024
2 parents e3e93d0 + 572b8ed commit 8791515
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bolt-sidecar/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ impl TryFrom<Opts> for Config {
.transpose()?;

config.private_key = if let Some(sk) = opts.signing.private_key {
let sk = SecretKey::from_bytes(&hex::decode(sk)?)
// Check if the string starts with "0x" and remove it
let hex_sk = if sk.starts_with("0x") { &sk[2..] } else { &sk };

let sk = SecretKey::from_bytes(&hex::decode(hex_sk)?)
.map_err(|e| eyre::eyre!("Failed decoding BLS secret key: {:?}", e))?;
Some(sk)
} else {
Expand Down Expand Up @@ -206,6 +209,8 @@ impl TryFrom<Opts> for Config {
config.beacon_api_url = opts.beacon_api_url.parse()?;
config.mevboost_url = opts.mevboost_url.parse()?;

config.fee_recipient = opts.fee_recipient;

config.validator_indexes = opts.validator_indexes;

config.chain = opts.chain;
Expand Down

0 comments on commit 8791515

Please sign in to comment.