mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-08 08:19:26 +00:00
BREAKING CHANGE: LEZ crates have been moved from top-level directories into
a dedicated `lez/` subdirectory. The following crates were relocated:
common → lez/common
indexer → lez/indexer
explorer_service→ lez/explorer_service
keycard_wallet → lez/keycard_wallet
mempool → lez/mempool
sequencer → lez/sequencer
storage → lez/storage
testnet_initial_state → lez/testnet_initial_state
wallet → lez/wallet
wallet-ffi → lez/wallet-ffi
Any external tooling, scripts, or paths referencing these crates at their
previous top-level locations must be updated.
80 lines
2.2 KiB
Rust
80 lines
2.2 KiB
Rust
use std::{
|
|
fs::File,
|
|
io::BufReader,
|
|
path::{Path, PathBuf},
|
|
time::Duration,
|
|
};
|
|
|
|
use anyhow::Result;
|
|
use bytesize::ByteSize;
|
|
use common::config::BasicAuth;
|
|
use humantime_serde;
|
|
use lee::AccountId;
|
|
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
|
use serde::{Deserialize, Serialize};
|
|
use url::Url;
|
|
|
|
/// A transaction to be applied at genesis to supply initial balances.
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum GenesisAction {
|
|
SupplyAccount {
|
|
account_id: AccountId,
|
|
balance: u128,
|
|
},
|
|
SupplyBridgeAccount {
|
|
balance: u128,
|
|
},
|
|
}
|
|
|
|
// TODO: Provide default values
|
|
#[derive(Clone, Serialize, Deserialize)]
|
|
pub struct SequencerConfig {
|
|
/// Home dir of sequencer storage.
|
|
pub home: PathBuf,
|
|
/// Maximum number of user transactions in a block (excludes the mandatory clock transaction).
|
|
pub max_num_tx_in_block: usize,
|
|
/// Maximum block size (includes header, user transactions, and the mandatory clock
|
|
/// transaction).
|
|
#[serde(default = "default_max_block_size")]
|
|
pub max_block_size: ByteSize,
|
|
/// Mempool maximum size.
|
|
pub mempool_max_size: usize,
|
|
/// Interval in which blocks produced.
|
|
#[serde(with = "humantime_serde")]
|
|
pub block_create_timeout: Duration,
|
|
/// Interval in which pending blocks are retried.
|
|
#[serde(with = "humantime_serde")]
|
|
pub retry_pending_blocks_timeout: Duration,
|
|
/// Sequencer own signing key.
|
|
pub signing_key: [u8; 32],
|
|
/// Bedrock configuration options.
|
|
pub bedrock_config: BedrockConfig,
|
|
/// Genesis configuration.
|
|
#[serde(default)]
|
|
pub genesis: Vec<GenesisAction>,
|
|
}
|
|
|
|
#[derive(Clone, Serialize, Deserialize)]
|
|
pub struct BedrockConfig {
|
|
/// Bedrock channel ID.
|
|
pub channel_id: ChannelId,
|
|
/// Bedrock Url.
|
|
pub node_url: Url,
|
|
/// Bedrock auth.
|
|
pub auth: Option<BasicAuth>,
|
|
}
|
|
|
|
impl SequencerConfig {
|
|
pub fn from_path(config_home: &Path) -> Result<Self> {
|
|
let file = File::open(config_home)?;
|
|
let reader = BufReader::new(file);
|
|
|
|
Ok(serde_json::from_reader(reader)?)
|
|
}
|
|
}
|
|
|
|
const fn default_max_block_size() -> ByteSize {
|
|
ByteSize::mib(1)
|
|
}
|