From 95ea77a030cfc23dea946429ecd619303517aa54 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:16:27 +0100 Subject: [PATCH 1/2] fix: query lookahead before sending --- bolt-cli/src/cli.rs | 6 +----- bolt-cli/src/commands/send.rs | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bolt-cli/src/cli.rs b/bolt-cli/src/cli.rs index d54665b6..399e613e 100644 --- a/bolt-cli/src/cli.rs +++ b/bolt-cli/src/cli.rs @@ -79,11 +79,7 @@ pub struct PubkeysCommand { #[derive(Debug, Clone, Parser)] pub struct SendCommand { /// Bolt RPC URL to send requests to and fetch lookahead info from. - #[clap( - long, - env = "BOLT_RPC_URL", - default_value = "https://rpc-holesky.bolt.chainbound.io/rpc" - )] + #[clap(long, env = "BOLT_RPC_URL", default_value = "https://rpc-holesky.bolt.chainbound.io")] pub bolt_rpc_url: Url, /// The private key to sign the transaction with. diff --git a/bolt-cli/src/commands/send.rs b/bolt-cli/src/commands/send.rs index 116ced38..d9d5cc79 100644 --- a/bolt-cli/src/commands/send.rs +++ b/bolt-cli/src/commands/send.rs @@ -42,7 +42,7 @@ impl SendCommand { let provider = ProviderBuilder::new() .with_recommended_fillers() .wallet(transaction_signer) - .on_http(self.bolt_rpc_url.clone()); + .on_http(self.bolt_rpc_url.join("/rpc")?); // Fetch the lookahead info from the Bolt RPC server let mut lookahead_url = self.bolt_rpc_url.join(BOLT_LOOKAHEAD_PATH)?; @@ -50,15 +50,15 @@ impl SendCommand { // Note: it's possible for users to override the target sidecar URL // for testing and development purposes. In most cases, the sidecar will // reject a request for a slot that it is not responsible for. - let target_url = if let Some(sidecar_url) = &self.override_bolt_sidecar_url { + let target_url = if let Some(sidecar_url) = self.override_bolt_sidecar_url { // If using the override URL, we don't need to fetch the active proposers only. // we will set the next slot as the target slot. - sidecar_url.clone() + sidecar_url } else { // Filter out slots that are not active or in the past, to fetch the next // active proposer slot. lookahead_url.set_query(Some("activeOnly=true&futureOnly=true")); - self.bolt_rpc_url.clone() + self.bolt_rpc_url }; let lookahead_res = reqwest::get(lookahead_url).await?.json::>().await?; From 7f1c3cb53e5f16408ac7373e3068534f864b46cb Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:34:50 +0100 Subject: [PATCH 2/2] fix: use /rpc endpoint as target sidecar url --- bolt-cli/src/commands/send.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bolt-cli/src/commands/send.rs b/bolt-cli/src/commands/send.rs index d9d5cc79..7039d255 100644 --- a/bolt-cli/src/commands/send.rs +++ b/bolt-cli/src/commands/send.rs @@ -58,7 +58,7 @@ impl SendCommand { // Filter out slots that are not active or in the past, to fetch the next // active proposer slot. lookahead_url.set_query(Some("activeOnly=true&futureOnly=true")); - self.bolt_rpc_url + self.bolt_rpc_url.join("/rpc")? }; let lookahead_res = reqwest::get(lookahead_url).await?.json::>().await?;