2026-03-09 12:31:49 +00:00
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
|
use common::block::Block;
|
2026-01-29 22:20:42 +03:00
|
|
|
use logos_blockchain_key_management_system_service::keys::Ed25519Key;
|
|
|
|
|
use url::Url;
|
|
|
|
|
|
|
|
|
|
use crate::{
|
2026-04-29 14:05:23 +02:00
|
|
|
block_publisher::{BlockPublisherTrait, CheckpointSink, SequencerCheckpoint},
|
|
|
|
|
config::BedrockConfig,
|
|
|
|
|
indexer_client::IndexerClientTrait,
|
2026-01-29 22:20:42 +03:00
|
|
|
};
|
|
|
|
|
|
2026-03-09 12:31:49 +00:00
|
|
|
pub type SequencerCoreWithMockClients = crate::SequencerCore<MockBlockPublisher, MockIndexerClient>;
|
2026-01-29 22:20:42 +03:00
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
2026-03-09 12:31:49 +00:00
|
|
|
pub struct MockBlockPublisher;
|
|
|
|
|
|
|
|
|
|
impl BlockPublisherTrait for MockBlockPublisher {
|
|
|
|
|
async fn new(
|
|
|
|
|
_config: &BedrockConfig,
|
|
|
|
|
_bedrock_signing_key: Ed25519Key,
|
|
|
|
|
_resubmit_interval: Duration,
|
2026-04-29 14:05:23 +02:00
|
|
|
_initial_checkpoint: Option<SequencerCheckpoint>,
|
|
|
|
|
_on_checkpoint: CheckpointSink,
|
2026-03-09 12:31:49 +00:00
|
|
|
) -> Result<Self> {
|
|
|
|
|
Ok(Self)
|
2026-02-12 00:01:00 +03:00
|
|
|
}
|
|
|
|
|
|
2026-04-29 10:33:07 +02:00
|
|
|
async fn publish_block(&self, _block: &Block) -> Result<()> {
|
2026-02-12 00:01:00 +03:00
|
|
|
Ok(())
|
|
|
|
|
}
|
2026-01-29 22:20:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
|
pub struct MockIndexerClient;
|
|
|
|
|
|
|
|
|
|
impl IndexerClientTrait for MockIndexerClient {
|
|
|
|
|
async fn new(_indexer_url: &Url) -> Result<Self> {
|
|
|
|
|
Ok(Self)
|
|
|
|
|
}
|
|
|
|
|
}
|