mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-02-14 10:23:08 +00:00
fix: dep updated, merge fix
This commit is contained in:
parent
516feee101
commit
4c4e30864b
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -927,11 +927,13 @@ name = "bedrock_client"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures",
|
||||
"log",
|
||||
"logos-blockchain-chain-broadcast-service",
|
||||
"logos-blockchain-common-http-client",
|
||||
"logos-blockchain-core",
|
||||
"reqwest",
|
||||
"tokio-retry",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2707,7 +2709,7 @@ dependencies = [
|
||||
"common",
|
||||
"futures",
|
||||
"log",
|
||||
"nomos-core",
|
||||
"logos-blockchain-core",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
@ -3362,7 +3364,7 @@ source = "git+https://github.com/logos-blockchain/logos-blockchain.git#451df112f
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.111",
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -6729,3 +6731,9 @@ dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65"
|
||||
|
||||
@ -85,6 +85,7 @@ tokio-retry = "0.3.0"
|
||||
logos-blockchain-common-http-client = { git = "https://github.com/logos-blockchain/logos-blockchain.git" }
|
||||
logos-blockchain-key-management-system-service = { git = "https://github.com/logos-blockchain/logos-blockchain.git" }
|
||||
logos-blockchain-core = { git = "https://github.com/logos-blockchain/logos-blockchain.git" }
|
||||
logos-blockchain-chain-broadcast-service = { git = "https://github.com/logos-blockchain/logos-blockchain.git" }
|
||||
|
||||
rocksdb = { version = "0.24.0", default-features = false, features = [
|
||||
"snappy",
|
||||
|
||||
@ -6,5 +6,9 @@ edition = "2024"
|
||||
[dependencies]
|
||||
reqwest.workspace = true
|
||||
anyhow.workspace = true
|
||||
tokio-retry.workspace = true
|
||||
futures.workspace = true
|
||||
log.workspace = true
|
||||
logos-blockchain-common-http-client.workspace = true
|
||||
logos-blockchain-core.workspace = true
|
||||
logos-blockchain-chain-broadcast-service.workspace = true
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
use anyhow::Result;
|
||||
use futures::{Stream, TryFutureExt};
|
||||
use log::warn;
|
||||
use logos_blockchain_chain_broadcast_service::BlockInfo;
|
||||
pub use logos_blockchain_common_http_client::{BasicAuthCredentials, CommonHttpClient, Error};
|
||||
use logos_blockchain_core::mantle::SignedMantleTx;
|
||||
use logos_blockchain_core::{block::Block, header::HeaderId, mantle::SignedMantleTx};
|
||||
use reqwest::{Client, Url};
|
||||
use tokio_retry::Retry;
|
||||
|
||||
// Simple wrapper
|
||||
// maybe extend in the future for our purposes
|
||||
@ -30,13 +34,12 @@ impl BedrockClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_lib_stream(&self, url: Url) -> Result<impl Stream<Item = BlockInfo>, Error> {
|
||||
self.0.get_lib_stream(url).await
|
||||
pub async fn get_lib_stream(&self) -> Result<impl Stream<Item = BlockInfo>, Error> {
|
||||
self.http_client.get_lib_stream(self.node_url.clone()).await
|
||||
}
|
||||
|
||||
pub async fn get_block_by_id(
|
||||
&self,
|
||||
url: &Url,
|
||||
header_id: HeaderId,
|
||||
start_delay_millis: u64,
|
||||
max_retries: usize,
|
||||
@ -45,8 +48,8 @@ impl BedrockClient {
|
||||
.take(max_retries);
|
||||
|
||||
Retry::spawn(strategy, || {
|
||||
self.0
|
||||
.get_block_by_id(url.clone(), header_id)
|
||||
self.http_client
|
||||
.get_block_by_id(self.node_url.clone(), header_id)
|
||||
.inspect_err(|err| warn!("Block fetching failed with err: {err:#?}"))
|
||||
})
|
||||
.await
|
||||
|
||||
@ -14,5 +14,5 @@ tokio.workspace = true
|
||||
borsh.workspace = true
|
||||
futures.workspace = true
|
||||
url.workspace = true
|
||||
nomos-core.workspace = true
|
||||
logos-blockchain-core.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use std::{fs::File, io::BufReader, path::Path};
|
||||
|
||||
use anyhow::Result;
|
||||
use nomos_core::mantle::ops::channel::ChannelId;
|
||||
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use bedrock_client::{BasicAuthCredentials, BedrockClient};
|
||||
use common::{
|
||||
block::HashableBlockData, communication::indexer::Message,
|
||||
@ -8,7 +8,7 @@ use common::{
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use log::info;
|
||||
use nomos_core::mantle::{
|
||||
use logos_blockchain_core::mantle::{
|
||||
Op, SignedMantleTx,
|
||||
ops::channel::{ChannelId, inscribe::InscriptionOp},
|
||||
};
|
||||
@ -24,8 +24,6 @@ pub struct IndexerCore {
|
||||
pub bedrock_client: BedrockClient,
|
||||
pub sequencer_client: SequencerClient,
|
||||
pub config: IndexerConfig,
|
||||
// ToDo: Remove this duplication by unifying addr representation in all clients.
|
||||
pub bedrock_url: Url,
|
||||
pub state: IndexerState,
|
||||
}
|
||||
|
||||
@ -38,8 +36,9 @@ impl IndexerCore {
|
||||
.auth
|
||||
.clone()
|
||||
.map(|auth| BasicAuthCredentials::new(auth.0, auth.1)),
|
||||
Url::parse(&config.bedrock_client_config.addr)
|
||||
.context("Bedrock node addr is not a valid url")?,
|
||||
)?,
|
||||
bedrock_url: Url::parse(&config.bedrock_client_config.addr)?,
|
||||
sequencer_client: SequencerClient::new_with_auth(
|
||||
config.sequencer_client_config.addr.clone(),
|
||||
config.sequencer_client_config.auth.clone(),
|
||||
@ -54,11 +53,7 @@ impl IndexerCore {
|
||||
|
||||
pub async fn subscribe_parse_block_stream(&self) -> Result<()> {
|
||||
loop {
|
||||
let mut stream_pinned = Box::pin(
|
||||
self.bedrock_client
|
||||
.get_lib_stream(self.bedrock_url.clone())
|
||||
.await?,
|
||||
);
|
||||
let mut stream_pinned = Box::pin(self.bedrock_client.get_lib_stream().await?);
|
||||
|
||||
info!("Block stream joined");
|
||||
|
||||
@ -70,7 +65,6 @@ impl IndexerCore {
|
||||
if let Some(l1_block) = self
|
||||
.bedrock_client
|
||||
.get_block_by_id(
|
||||
&self.bedrock_url,
|
||||
header_id,
|
||||
self.config.start_delay_millis,
|
||||
self.config.max_retries,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use std::{fs, path::Path};
|
||||
use std::{fs, path::Path, str::FromStr};
|
||||
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use bedrock_client::BedrockClient;
|
||||
@ -10,6 +10,7 @@ use logos_blockchain_core::mantle::{
|
||||
use logos_blockchain_key_management_system_service::keys::{
|
||||
ED25519_SECRET_KEY_SIZE, Ed25519Key, Ed25519PublicKey,
|
||||
};
|
||||
use reqwest::Url;
|
||||
|
||||
use crate::config::BedrockConfig;
|
||||
|
||||
@ -26,8 +27,10 @@ impl BlockSettlementClient {
|
||||
let bedrock_signing_key = load_or_create_signing_key(&home.join("bedrock_signing_key"))
|
||||
.context("Failed to load or create signing key")?;
|
||||
let bedrock_channel_id = ChannelId::from(config.channel_id);
|
||||
let bedrock_client = BedrockClient::new(None, config.node_url.clone())
|
||||
.context("Failed to initialize bedrock client")?;
|
||||
let bedrock_url = Url::from_str(config.node_url.as_ref())
|
||||
.context("Bedrock node address is not a valid url")?;
|
||||
let bedrock_client =
|
||||
BedrockClient::new(None, bedrock_url).context("Failed to initialize bedrock client")?;
|
||||
let channel_genesis_msg = MsgId::from([0; 32]);
|
||||
Ok(Self {
|
||||
bedrock_client,
|
||||
|
||||
@ -5,7 +5,7 @@ use std::{
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use reqwest::Url;
|
||||
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@ -57,7 +57,11 @@ pub struct BedrockConfig {
|
||||
/// Bedrock channel ID
|
||||
pub channel_id: ChannelId,
|
||||
/// Bedrock Url
|
||||
pub node_url: Url,
|
||||
pub node_url: String,
|
||||
/// Bedrock user
|
||||
pub user: String,
|
||||
/// Bedrock password
|
||||
pub password: Option<String>,
|
||||
}
|
||||
|
||||
impl SequencerConfig {
|
||||
|
||||
@ -159,11 +159,6 @@
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
"node_url": "http://localhost:8080",
|
||||
"user": "user",
|
||||
"password": null,
|
||||
"indexer_config": {
|
||||
"resubscribe_interval": 1000,
|
||||
"start_delay": 1000,
|
||||
"limit_retry": 10
|
||||
}
|
||||
"password": null
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user