Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit 24a5a41

Browse files
committed
bolt-cli: update more commands
1 parent 16378ce commit 24a5a41

6 files changed

Lines changed: 129 additions & 57 deletions

File tree

bolt-cli/src/cli.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ pub enum EigenLayerSubcommand {
304304
/// The URL of the operator RPC.
305305
#[clap(long, env = "OPERATOR_RPC")]
306306
operator_rpc: Url,
307+
308+
/// Run the command in "dry run" mode, run all steps without broadcast.
309+
/// Useful for testing and debugging purposes.
310+
#[clap(short, long, env = "DRY_RUN", default_value = "false")]
311+
dry_run: bool,
307312
},
308313

309314
/// Check the status of an operator in the bolt AVS.
@@ -363,6 +368,11 @@ pub enum SymbioticSubcommand {
363368
/// The URL of the operator RPC.
364369
#[clap(long, env = "OPERATOR_RPC")]
365370
operator_rpc: Url,
371+
372+
/// Run the command in "dry run" mode, run all steps without broadcast.
373+
/// Useful for testing and debugging purposes.
374+
#[clap(short, long, env = "DRY_RUN", default_value = "false")]
375+
dry_run: bool,
366376
},
367377

368378
/// Check the status of a Symbiotic operator.

bolt-cli/src/commands/operators/eigenlayer.rs

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
cli::{Chain, EigenLayerSubcommand},
1919
common::{
2020
bolt_manager::BoltManagerContract::{self, BoltManagerContractErrors},
21-
request_confirmation, try_parse_contract_error,
21+
handle_rpc_dry_run, request_confirmation, shutdown_anvil, try_parse_contract_error,
2222
},
2323
contracts::{
2424
bolt::{
@@ -43,10 +43,12 @@ impl EigenLayerSubcommand {
4343
.wrap_err("valid private key")?;
4444
let operator = signer.address();
4545

46+
let (rpc, anvil) = handle_rpc_dry_run(rpc_url, dry_run)?;
47+
4648
let provider = ProviderBuilder::new()
4749
.with_recommended_fillers()
4850
.wallet(EthereumWallet::from(signer))
49-
.on_http(rpc_url);
51+
.on_http(rpc);
5052

5153
let chain = Chain::try_from_provider(&provider).await?;
5254

@@ -91,7 +93,9 @@ impl EigenLayerSubcommand {
9193
eyre::bail!("Transaction failed: {:?}", receipt)
9294
}
9395

94-
info!("Succesfully deposited collateral into strategy");
96+
info!("Successfully deposited collateral into strategy");
97+
98+
shutdown_anvil(anvil);
9599

96100
Ok(())
97101
}
@@ -100,10 +104,12 @@ impl EigenLayerSubcommand {
100104
let signer = PrivateKeySigner::from_bytes(&operator_private_key)
101105
.wrap_err("valid private key")?;
102106

107+
let (rpc, anvil) = handle_rpc_dry_run(rpc_url, dry_run)?;
108+
103109
let provider = ProviderBuilder::new()
104110
.with_recommended_fillers()
105111
.wallet(EthereumWallet::from(signer.clone()))
106-
.on_http(rpc_url);
112+
.on_http(rpc);
107113

108114
let chain = Chain::try_from_provider(&provider).await?;
109115

@@ -138,7 +144,7 @@ impl EigenLayerSubcommand {
138144
Bytes::from(signer.sign_hash_sync(&signature_digest_hash)?.as_bytes());
139145
let signature = SignatureWithSaltAndExpiry { signature, expiry, salt };
140146

141-
match bolt_eigenlayer_middleware
147+
let result = match bolt_eigenlayer_middleware
142148
.registerOperator(operator_rpc.to_string(), signature)
143149
.send()
144150
.await
@@ -154,7 +160,9 @@ impl EigenLayerSubcommand {
154160
eyre::bail!("Transaction failed: {:?}", receipt)
155161
}
156162

157-
info!("Succesfully registered EigenLayer operator");
163+
info!("Successfully registered EigenLayer operator");
164+
165+
Ok(())
158166
}
159167
Err(e) => {
160168
match try_parse_contract_error::<BoltEigenLayerMiddlewareErrors>(e)? {
@@ -173,20 +181,24 @@ impl EigenLayerSubcommand {
173181
),
174182
}
175183
}
176-
}
184+
};
177185

178-
Ok(())
186+
shutdown_anvil(anvil);
187+
188+
result
179189
}
180190

181191
Self::Deregister { rpc_url, operator_private_key, dry_run } => {
182192
let signer = PrivateKeySigner::from_bytes(&operator_private_key)
183193
.wrap_err("valid private key")?;
184194
let address = signer.address();
185195

196+
let (rpc, anvil) = handle_rpc_dry_run(rpc_url, dry_run)?;
197+
186198
let provider = ProviderBuilder::new()
187199
.with_recommended_fillers()
188200
.wallet(EthereumWallet::from(signer))
189-
.on_http(rpc_url);
201+
.on_http(rpc);
190202

191203
let chain = Chain::try_from_provider(&provider).await?;
192204

@@ -200,7 +212,7 @@ impl EigenLayerSubcommand {
200212
let bolt_eigenlayer_middleware =
201213
BoltEigenLayerMiddleware::new(bolt_avs_address, provider);
202214

203-
match bolt_eigenlayer_middleware.deregisterOperator().send().await {
215+
let result = match bolt_eigenlayer_middleware.deregisterOperator().send().await {
204216
Ok(pending) => {
205217
info!(
206218
hash = ?pending.tx_hash(),
@@ -212,7 +224,9 @@ impl EigenLayerSubcommand {
212224
eyre::bail!("Transaction failed: {:?}", receipt)
213225
}
214226

215-
info!("Succesfully deregistered EigenLayer operator");
227+
info!("Successfully deregistered EigenLayer operator");
228+
229+
Ok(())
216230
}
217231
Err(e) => {
218232
match try_parse_contract_error::<BoltEigenLayerMiddlewareErrors>(e)? {
@@ -225,20 +239,24 @@ impl EigenLayerSubcommand {
225239
),
226240
}
227241
}
228-
}
242+
};
229243

230-
Ok(())
244+
shutdown_anvil(anvil);
245+
246+
result
231247
}
232248

233-
Self::UpdateRpc { rpc_url, operator_private_key, operator_rpc } => {
249+
Self::UpdateRpc { rpc_url, operator_private_key, operator_rpc, dry_run } => {
234250
let signer = PrivateKeySigner::from_bytes(&operator_private_key)
235251
.wrap_err("valid private key")?;
236252
let address = signer.address();
237253

254+
let (rpc, anvil) = handle_rpc_dry_run(rpc_url, dry_run)?;
255+
238256
let provider = ProviderBuilder::new()
239257
.with_recommended_fillers()
240258
.wallet(EthereumWallet::from(signer))
241-
.on_http(rpc_url);
259+
.on_http(rpc);
242260

243261
let chain = Chain::try_from_provider(&provider).await?;
244262

@@ -257,7 +275,11 @@ impl EigenLayerSubcommand {
257275
return Ok(());
258276
}
259277

260-
match bolt_manager.updateOperatorRPC(operator_rpc.to_string()).send().await {
278+
let result = match bolt_manager
279+
.updateOperatorRPC(operator_rpc.to_string())
280+
.send()
281+
.await
282+
{
261283
Ok(pending) => {
262284
info!(
263285
hash = ?pending.tx_hash(),
@@ -269,7 +291,9 @@ impl EigenLayerSubcommand {
269291
eyre::bail!("Transaction failed: {:?}", receipt)
270292
}
271293

272-
info!("Succesfully updated EigenLayer operator RPC");
294+
info!("Successfully updated EigenLayer operator RPC");
295+
296+
Ok(())
273297
}
274298
Err(e) => match try_parse_contract_error::<BoltManagerContractErrors>(e)? {
275299
BoltManagerContractErrors::OperatorNotRegistered(_) => {
@@ -279,8 +303,11 @@ impl EigenLayerSubcommand {
279303
unreachable!("Unexpected error with selector {:?}", other.selector())
280304
}
281305
},
282-
}
283-
Ok(())
306+
};
307+
308+
shutdown_anvil(anvil);
309+
310+
result
284311
}
285312

286313
Self::Status { rpc_url: rpc, address } => {
@@ -295,7 +322,7 @@ impl EigenLayerSubcommand {
295322
info!(?address, "EigenLayer operator is registered");
296323
} else {
297324
warn!(?address, "Operator not registered");
298-
return Ok(())
325+
return Ok(());
299326
}
300327

301328
match bolt_manager.getOperatorData(address).call().await {
@@ -444,7 +471,7 @@ mod tests {
444471
operator_private_key: secret_key,
445472
strategy: EigenLayerStrategy::WEth,
446473
amount: U256::from(1),
447-
dry_run: true,
474+
dry_run: false,
448475
},
449476
},
450477
};
@@ -460,7 +487,7 @@ mod tests {
460487
operator_private_key: secret_key,
461488
operator_rpc: "https://bolt.chainbound.io/rpc".parse().expect("valid url"),
462489
salt: B256::ZERO,
463-
dry_run: true,
490+
dry_run: false,
464491
},
465492
},
466493
};
@@ -485,6 +512,7 @@ mod tests {
485512
rpc_url: anvil_url.clone(),
486513
operator_private_key: secret_key,
487514
operator_rpc: "https://boooooolt.chainbound.io/rpc".parse().expect("valid url"),
515+
dry_run: false,
488516
},
489517
},
490518
};
@@ -507,7 +535,7 @@ mod tests {
507535
subcommand: EigenLayerSubcommand::Deregister {
508536
rpc_url: anvil_url.clone(),
509537
operator_private_key: secret_key,
510-
dry_run: true,
538+
dry_run: false,
511539
},
512540
},
513541
};

0 commit comments

Comments
 (0)