mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-03 22: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};
|
||||
|
||||
pub mod errors;
|
||||
@ -7,21 +5,6 @@ pub mod message;
|
||||
pub mod parser;
|
||||
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)]
|
||||
pub struct RpcLimitsConfig {
|
||||
/// Maximum byte size of the json payload.
|
||||
@ -40,7 +23,6 @@ impl Default for RpcLimitsConfig {
|
||||
pub struct RpcConfig {
|
||||
pub addr: String,
|
||||
pub cors_allowed_origins: Vec<String>,
|
||||
pub polling_config: RpcPollingConfig,
|
||||
#[serde(default)]
|
||||
pub limits_config: RpcLimitsConfig,
|
||||
}
|
||||
@ -50,7 +32,6 @@ impl Default for RpcConfig {
|
||||
RpcConfig {
|
||||
addr: "0.0.0.0:3040".to_owned(),
|
||||
cors_allowed_origins: vec!["*".to_owned()],
|
||||
polling_config: RpcPollingConfig::default(),
|
||||
limits_config: RpcLimitsConfig::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,10 +5,7 @@ pub mod types;
|
||||
use std::sync::Arc;
|
||||
|
||||
use common::{
|
||||
rpc_primitives::{
|
||||
RpcPollingConfig,
|
||||
errors::{RpcError, RpcErrorKind},
|
||||
},
|
||||
rpc_primitives::errors::{RpcError, RpcErrorKind},
|
||||
transaction::EncodedTransaction,
|
||||
};
|
||||
use mempool::MemPoolHandle;
|
||||
@ -23,11 +20,6 @@ use self::types::err_rpc::RpcErr;
|
||||
|
||||
//ToDo: Add necessary fields
|
||||
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>>,
|
||||
mempool_handle: MemPoolHandle<EncodedTransaction>,
|
||||
}
|
||||
|
||||
@ -53,12 +53,10 @@ pub fn new_http_server(
|
||||
let RpcConfig {
|
||||
addr,
|
||||
cors_allowed_origins,
|
||||
polling_config,
|
||||
limits_config,
|
||||
} = config;
|
||||
info!(target:NETWORK, "Starting http server at {addr}");
|
||||
let handler = web::Data::new(JsonHandler {
|
||||
polling_config,
|
||||
sequencer_state: seuquencer_core.clone(),
|
||||
mempool_handle,
|
||||
});
|
||||
|
||||
@ -321,10 +321,7 @@ mod tests {
|
||||
use crate::{JsonHandler, rpc_handler};
|
||||
use base58::ToBase58;
|
||||
use base64::{Engine, engine::general_purpose};
|
||||
use common::{
|
||||
rpc_primitives::RpcPollingConfig, test_utils::sequencer_sign_key_for_testing,
|
||||
transaction::EncodedTransaction,
|
||||
};
|
||||
use common::{test_utils::sequencer_sign_key_for_testing, transaction::EncodedTransaction};
|
||||
|
||||
use sequencer_core::{
|
||||
SequencerCore,
|
||||
@ -405,7 +402,6 @@ mod tests {
|
||||
|
||||
(
|
||||
JsonHandler {
|
||||
polling_config: RpcPollingConfig::default(),
|
||||
sequencer_state: sequencer_core,
|
||||
mempool_handle,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user