mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-05 23:03:06 +00:00
refactor: remove RpcRollingConfig
This commit is contained in:
parent
95ec42bba7
commit
110589d332
@ -1,5 +1,3 @@
|
|||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
@ -7,21 +5,6 @@ pub mod message;
|
|||||||
pub mod parser;
|
pub mod parser;
|
||||||
pub mod requests;
|
pub mod requests;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
|
|
||||||
pub struct RpcPollingConfig {
|
|
||||||
pub polling_interval: Duration,
|
|
||||||
pub polling_timeout: Duration,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for RpcPollingConfig {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
polling_interval: Duration::from_millis(500),
|
|
||||||
polling_timeout: Duration::from_secs(10),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct RpcLimitsConfig {
|
pub struct RpcLimitsConfig {
|
||||||
/// Maximum byte size of the json payload.
|
/// Maximum byte size of the json payload.
|
||||||
@ -40,7 +23,6 @@ impl Default for RpcLimitsConfig {
|
|||||||
pub struct RpcConfig {
|
pub struct RpcConfig {
|
||||||
pub addr: String,
|
pub addr: String,
|
||||||
pub cors_allowed_origins: Vec<String>,
|
pub cors_allowed_origins: Vec<String>,
|
||||||
pub polling_config: RpcPollingConfig,
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub limits_config: RpcLimitsConfig,
|
pub limits_config: RpcLimitsConfig,
|
||||||
}
|
}
|
||||||
@ -50,7 +32,6 @@ impl Default for RpcConfig {
|
|||||||
RpcConfig {
|
RpcConfig {
|
||||||
addr: "0.0.0.0:3040".to_owned(),
|
addr: "0.0.0.0:3040".to_owned(),
|
||||||
cors_allowed_origins: vec!["*".to_owned()],
|
cors_allowed_origins: vec!["*".to_owned()],
|
||||||
polling_config: RpcPollingConfig::default(),
|
|
||||||
limits_config: RpcLimitsConfig::default(),
|
limits_config: RpcLimitsConfig::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,7 @@ pub mod types;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use common::{
|
use common::{
|
||||||
rpc_primitives::{
|
rpc_primitives::errors::{RpcError, RpcErrorKind},
|
||||||
RpcPollingConfig,
|
|
||||||
errors::{RpcError, RpcErrorKind},
|
|
||||||
},
|
|
||||||
transaction::EncodedTransaction,
|
transaction::EncodedTransaction,
|
||||||
};
|
};
|
||||||
use mempool::MemPoolHandle;
|
use mempool::MemPoolHandle;
|
||||||
@ -23,11 +20,6 @@ use self::types::err_rpc::RpcErr;
|
|||||||
|
|
||||||
//ToDo: Add necessary fields
|
//ToDo: Add necessary fields
|
||||||
pub struct JsonHandler {
|
pub struct JsonHandler {
|
||||||
#[expect(
|
|
||||||
dead_code,
|
|
||||||
reason = "Decided to keep it just in case, should we remove it?"
|
|
||||||
)]
|
|
||||||
polling_config: RpcPollingConfig,
|
|
||||||
sequencer_state: Arc<Mutex<SequencerCore>>,
|
sequencer_state: Arc<Mutex<SequencerCore>>,
|
||||||
mempool_handle: MemPoolHandle<EncodedTransaction>,
|
mempool_handle: MemPoolHandle<EncodedTransaction>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,12 +53,10 @@ pub fn new_http_server(
|
|||||||
let RpcConfig {
|
let RpcConfig {
|
||||||
addr,
|
addr,
|
||||||
cors_allowed_origins,
|
cors_allowed_origins,
|
||||||
polling_config,
|
|
||||||
limits_config,
|
limits_config,
|
||||||
} = config;
|
} = config;
|
||||||
info!(target:NETWORK, "Starting http server at {addr}");
|
info!(target:NETWORK, "Starting http server at {addr}");
|
||||||
let handler = web::Data::new(JsonHandler {
|
let handler = web::Data::new(JsonHandler {
|
||||||
polling_config,
|
|
||||||
sequencer_state: seuquencer_core.clone(),
|
sequencer_state: seuquencer_core.clone(),
|
||||||
mempool_handle,
|
mempool_handle,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -321,10 +321,7 @@ mod tests {
|
|||||||
use crate::{JsonHandler, rpc_handler};
|
use crate::{JsonHandler, rpc_handler};
|
||||||
use base58::ToBase58;
|
use base58::ToBase58;
|
||||||
use base64::{Engine, engine::general_purpose};
|
use base64::{Engine, engine::general_purpose};
|
||||||
use common::{
|
use common::{test_utils::sequencer_sign_key_for_testing, transaction::EncodedTransaction};
|
||||||
rpc_primitives::RpcPollingConfig, test_utils::sequencer_sign_key_for_testing,
|
|
||||||
transaction::EncodedTransaction,
|
|
||||||
};
|
|
||||||
|
|
||||||
use sequencer_core::{
|
use sequencer_core::{
|
||||||
SequencerCore,
|
SequencerCore,
|
||||||
@ -405,7 +402,6 @@ mod tests {
|
|||||||
|
|
||||||
(
|
(
|
||||||
JsonHandler {
|
JsonHandler {
|
||||||
polling_config: RpcPollingConfig::default(),
|
|
||||||
sequencer_state: sequencer_core,
|
sequencer_state: sequencer_core,
|
||||||
mempool_handle,
|
mempool_handle,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user