Skip to content

Commit

Permalink
consts
Browse files Browse the repository at this point in the history
  • Loading branch information
distractedm1nd committed Jul 8, 2024
1 parent 473f31c commit 9496811
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/consts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use std::time::Duration;

/// DA_RETRY_COUNT determines how many times to retry epoch submission.
pub const DA_RETRY_COUNT: u64 = 5;
/// DA_RETRY_COUNT determines how long to wait between failed submissions.
pub const DA_RETRY_INTERVAL: Duration = Duration::from_secs(5);
/// CHANNEL_BUFFER_SIZE determines the default channel size.
pub const CHANNEL_BUFFER_SIZE: usize = 5;
4 changes: 2 additions & 2 deletions src/da.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{
consts::CHANNEL_BUFFER_SIZE,
error::{DataAvailabilityError, DatabaseError, DeimosError, GeneralError},
utils::Signable,
zk_snark::{Bls12Proof, VerifyingKey},
Expand Down Expand Up @@ -145,8 +146,7 @@ impl CelestiaConnection {
auth_token: Option<&str>,
namespace_hex: &String,
) -> Result<Self, DataAvailabilityError> {
// TODO: Make buffer size constant
let (tx, rx) = channel(5);
let (tx, rx) = channel(CHANNEL_BUFFER_SIZE);

let client = Client::new(&connection_string, auth_token)
.await
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mod cfg;
pub mod consts;
pub mod da;
pub mod error;
pub mod node_types;
pub mod storage;
pub mod utils;
mod webserver;
pub mod zk_snark;

#[macro_use]
extern crate log;
8 changes: 1 addition & 7 deletions src/node_types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::consts::{CHANNEL_BUFFER_SIZE, DA_RETRY_COUNT, DA_RETRY_INTERVAL};
use crate::error::DataAvailabilityError;
use async_trait::async_trait;
use crypto_hash::{hex_digest, Algorithm};
Expand Down Expand Up @@ -26,13 +27,6 @@ use crate::{
},
};

/// DA_RETRY_COUNT determines how many times to retry epoch submission.
const DA_RETRY_COUNT: u64 = 5;
/// DA_RETRY_COUNT determines how long to wait between failed submissions.
const DA_RETRY_INTERVAL: Duration = Duration::from_secs(5);
/// CHANNEL_BUFFER_SIZE determines the size of the channel buffer for the DA backlog.
const CHANNEL_BUFFER_SIZE: usize = 5;

#[async_trait]
pub trait NodeType {
async fn start(self: Arc<Self>) -> std::result::Result<(), std::io::Error>;
Expand Down

0 comments on commit 9496811

Please sign in to comment.