-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: Improve the BlockCommitterHttpApi
client to use url
apis better
#2599
Changes from 5 commits
83bf21a
b9977d4
e8d72c8
968fd69
cdfec32
c57b645
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,11 +128,12 @@ impl BlockCommitterApi for BlockCommitterHttpApi { | |
&self, | ||
l2_block_number: u32, | ||
) -> DaBlockCostsResult<Vec<RawDaBlockCosts>> { | ||
// Specific: http://localhost:8080/v1/costs?variant=specific&value=19098935&limit=5 | ||
// Specific: http://committer.url/v1/costs?variant=specific&value=19098935&limit=5 | ||
if let Some(url) = &self.url { | ||
tracing::debug!("getting da costs by l2 block number: {l2_block_number}"); | ||
let formatted_url = format!("{url}/v1/costs?variant=specific&value={l2_block_number}&limit={NUMBER_OF_BUNDLES}"); | ||
let response = self.client.get(formatted_url).send().await?; | ||
let path = format!("/v1/costs?variant=specific&value={l2_block_number}&limit={NUMBER_OF_BUNDLES}"); | ||
let full_path = url.join(&path)?; | ||
Comment on lines
+134
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what path was it constructing previously? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was getting "//v1". |
||
let response = self.client.get(full_path).send().await?; | ||
let parsed = response.json::<Vec<RawDaBlockCosts>>().await?; | ||
Ok(parsed) | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
use anyhow::Context; | ||
use base64::prelude::*; | ||
use cosmrs::AccountId; | ||
use url::Url; | ||
|
||
mod api_types { | ||
use serde::Deserialize; | ||
|
@@ -87,8 +88,10 @@ pub async fn estimate_transaction( | |
let request = SimulateRequest { | ||
tx_bytes: tx_bytes.to_string(), | ||
}; | ||
let path = "/cosmos/tx/v1beta1/simulate"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah.. I just found the first one. Didn't look farther. |
||
let full_url = Url::parse(api_url)?.join(path).unwrap(); | ||
let r = reqwest::Client::new() | ||
.post(format!("{api_url}/cosmos/tx/v1beta1/simulate")) | ||
.post(full_url) | ||
.json(&request) | ||
.send() | ||
.await?; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have the same issue with SS service, could you also apply it there please?=D