Skip to content

Commit dc064fb

Browse files
committed
ci: enforce strict formatting and clippy compliance 🏮
1 parent 8a77c40 commit dc064fb

5 files changed

Lines changed: 532 additions & 131 deletions

File tree

bin/flashstat-server/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use flashstat_common::{
55
Config, FlashBlock, ReorgEvent, ReorgSeverity, SequencerStats, SystemHealth,
66
};
77
use flashstat_db::FlashStorage;
8-
use jsonrpsee::core::{RpcResult, async_trait};
8+
use jsonrpsee::core::{async_trait, RpcResult};
99
use jsonrpsee::server::ServerBuilder;
1010
use jsonrpsee::types::error::ErrorObjectOwned;
1111
use std::sync::Arc;
@@ -97,10 +97,7 @@ impl FlashApiServer for FlashServer {
9797
Ok(stats)
9898
}
9999

100-
async fn ingest_block(
101-
&self,
102-
block: ethers::types::Block<ethers::types::H256>,
103-
) -> RpcResult<()> {
100+
async fn ingest_block(&self, block: ethers::types::Block<ethers::types::H256>) -> RpcResult<()> {
104101
self.monitor
105102
.handle_new_block(block)
106103
.await

bin/flashstat-tui/src/main.rs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
use crossterm::{
22
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode},
33
execute,
4-
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
4+
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
55
};
66
use eyre::Result;
77
use flashstat_api::FlashApiClient;
88
use flashstat_common::{FlashBlock, ReorgEvent, SequencerStats, SystemHealth};
99
use jsonrpsee::http_client::HttpClientBuilder;
1010
use ratatui::{
11-
Frame, Terminal,
1211
backend::CrosstermBackend,
1312
layout::{Constraint, Direction, Layout},
1413
style::{Color, Modifier, Style},
1514
text::{Line, Span},
1615
widgets::{Block, Borders, List, ListItem, Paragraph},
16+
Frame, Terminal,
1717
};
1818
use std::{
1919
io,
@@ -202,18 +202,27 @@ fn ui(f: &mut Frame, app: &App) {
202202
.iter()
203203
.map(|b| {
204204
let content = vec![Line::from(vec![
205-
Span::styled(format!("#{:<10}", b.number), Style::default().fg(Color::Cyan)),
205+
Span::styled(
206+
format!("#{:<10}", b.number),
207+
Style::default().fg(Color::Cyan),
208+
),
206209
Span::raw(" | "),
207-
Span::styled(format!("{:.2}%", b.confidence), Style::default().fg(Color::Yellow)),
210+
Span::styled(
211+
format!("{:.2}%", b.confidence),
212+
Style::default().fg(Color::Yellow),
213+
),
208214
Span::raw(" | "),
209215
Span::raw(format!("{}", b.hash)),
210216
])];
211217
ListItem::new(content)
212218
})
213219
.collect();
214220

215-
let block_list =
216-
List::new(blocks).block(Block::default().borders(Borders::ALL).title("Live Block Feed"));
221+
let block_list = List::new(blocks).block(
222+
Block::default()
223+
.borders(Borders::ALL)
224+
.title("Live Block Feed"),
225+
);
217226
f.render_widget(block_list, main_chunks[0]);
218227

219228
// Sequencer Reputation
@@ -227,7 +236,10 @@ fn ui(f: &mut Frame, app: &App) {
227236
Color::Red
228237
};
229238
let content = vec![Line::from(vec![
230-
Span::styled(format!("{:.4}… ", s.address), Style::default().fg(Color::Gray)),
239+
Span::styled(
240+
format!("{:.4}… ", s.address),
241+
Style::default().fg(Color::Gray),
242+
),
231243
Span::styled(
232244
format!("Score: {:<5}", s.reputation_score),
233245
Style::default().fg(score_color),
@@ -254,9 +266,9 @@ fn ui(f: &mut Frame, app: &App) {
254266
flashstat_common::ReorgSeverity::Deep => {
255267
Style::default().fg(Color::Red).add_modifier(Modifier::BOLD)
256268
}
257-
flashstat_common::ReorgSeverity::Equivocation => {
258-
Style::default().fg(Color::Magenta).add_modifier(Modifier::BOLD)
259-
}
269+
flashstat_common::ReorgSeverity::Equivocation => Style::default()
270+
.fg(Color::Magenta)
271+
.add_modifier(Modifier::BOLD),
260272
};
261273

262274
let content = vec![Line::from(vec![
@@ -268,7 +280,11 @@ fn ui(f: &mut Frame, app: &App) {
268280
.collect();
269281

270282
let reorg_list = List::new(reorgs)
271-
.block(Block::default().borders(Borders::ALL).title("Security Alerts"))
283+
.block(
284+
Block::default()
285+
.borders(Borders::ALL)
286+
.title("Security Alerts"),
287+
)
272288
.highlight_style(
273289
Style::default()
274290
.add_modifier(Modifier::BOLD)

bin/flashstat/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async fn main() -> Result<()> {
3232
let storage = std::sync::Arc::new(flashstat_db::RedbStorage::new(&config.storage.db_path)?);
3333

3434
// 6. Run Monitor
35-
let mut monitor = FlashMonitor::new(config, storage, shutdown_tx.subscribe()).await?;
35+
let monitor = FlashMonitor::new(config, storage, shutdown_tx.subscribe()).await?;
3636

3737
if let Err(e) = monitor.run().await {
3838
error!("Fatal monitor error: {:?}", e);

crates/flashstat-api/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use ethers::types::H256;
2-
use flashstat_api::FlashApiServer;
3-
use flashstat_common::FlashBlock;
4-
use jsonrpsee::core::RpcResult;
2+
use flashstat_common::{FlashBlock, ReorgEvent};
53
use jsonrpsee::proc_macros::rpc;
64

5+
use jsonrpsee::core::RpcResult;
6+
77
#[rpc(server, client, namespace = "flash")]
88
pub trait FlashApi {
99
#[method(name = "getConfidence")]
@@ -16,10 +16,10 @@ pub trait FlashApi {
1616
async fn get_recent_blocks(&self, limit: usize) -> RpcResult<Vec<FlashBlock>>;
1717

1818
#[method(name = "getRecentReorgs")]
19-
async fn get_recent_reorgs(&self, limit: usize) -> RpcResult<Vec<flashstat_common::ReorgEvent>>;
19+
async fn get_recent_reorgs(&self, limit: usize) -> RpcResult<Vec<ReorgEvent>>;
2020

2121
#[method(name = "getEquivocations")]
22-
async fn get_equivocations(&self, limit: usize) -> RpcResult<Vec<flashstat_common::ReorgEvent>>;
22+
async fn get_equivocations(&self, limit: usize) -> RpcResult<Vec<ReorgEvent>>;
2323

2424
#[method(name = "getHealth")]
2525
async fn get_health(&self) -> RpcResult<flashstat_common::SystemHealth>;
@@ -33,6 +33,6 @@ pub trait FlashApi {
3333
#[subscription(name = "subscribeBlocks", item = FlashBlock)]
3434
async fn subscribe_blocks(&self) -> jsonrpsee::core::SubscriptionResult;
3535

36-
#[subscription(name = "subscribeEvents", item = flashstat_common::ReorgEvent)]
36+
#[subscription(name = "subscribeEvents", item = ReorgEvent)]
3737
async fn subscribe_events(&self) -> jsonrpsee::core::SubscriptionResult;
3838
}

0 commit comments

Comments
 (0)