Skip to content

Commit e0a10f7

Browse files
authored
chore(core): Lints and Formatting (#129)
* chore(workspace): manifest updates * chore(core): lints
1 parent 909e322 commit e0a10f7

File tree

7 files changed

+26
-11
lines changed

7 files changed

+26
-11
lines changed

crates/core/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
[package]
22
name = "tips-core"
3+
description = "Core primitives and utilities for TIPS"
34
version.workspace = true
5+
edition.workspace = true
46
rust-version.workspace = true
57
license.workspace = true
68
homepage.workspace = true
79
repository.workspace = true
8-
edition.workspace = true
10+
11+
[lints]
12+
workspace = true
913

1014
[features]
1115
test-utils = ["dep:alloy-signer-local", "dep:op-alloy-rpc-types"]

crates/core/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `tips-core`
2+
3+
Core primitives and utilities for TIPS.

crates/core/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#![doc = include_str!("../README.md")]
2+
#![doc(issue_tracker_base_url = "https://github.com/base/tips/issues/")]
3+
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
4+
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
5+
#![allow(missing_docs)]
6+
7+
use alloy_rpc_types as _;
8+
19
pub mod kafka;
210
pub mod logger;
311
pub mod metrics;

crates/core/src/logger.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ impl FromStr for LogFormat {
1414

1515
fn from_str(s: &str) -> Result<Self, Self::Err> {
1616
match s.to_lowercase().as_str() {
17-
"json" => Ok(LogFormat::Json),
18-
"compact" => Ok(LogFormat::Compact),
19-
"pretty" => Ok(LogFormat::Pretty),
17+
"json" => Ok(Self::Json),
18+
"compact" => Ok(Self::Compact),
19+
"pretty" => Ok(Self::Pretty),
2020
_ => {
2121
warn!("Invalid log format '{}', defaulting to 'pretty'", s);
22-
Ok(LogFormat::Pretty)
22+
Ok(Self::Pretty)
2323
}
2424
}
2525
}

crates/core/src/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub const TXN_HASH: TxHash =
1818
pub fn create_bundle_from_txn_data() -> AcceptedBundle {
1919
AcceptedBundle::new(
2020
Bundle {
21-
txs: vec![TXN_DATA.clone()],
21+
txs: vec![TXN_DATA],
2222
..Default::default()
2323
}
2424
.try_into()
@@ -40,7 +40,7 @@ pub fn create_transaction(from: PrivateKeySigner, nonce: u64, to: Address) -> Op
4040
.unwrap();
4141

4242
let sig = from.sign_transaction_sync(&mut txn).unwrap();
43-
OpTxEnvelope::Eip1559(txn.eip1559().cloned().unwrap().into_signed(sig).clone())
43+
OpTxEnvelope::Eip1559(txn.eip1559().cloned().unwrap().into_signed(sig))
4444
}
4545

4646
pub fn create_test_bundle(

crates/core/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl TryFrom<Bundle> for ParsedBundle {
9292
.transpose()
9393
.map_err(|e| format!("Invalid UUID: {e:?}"))?;
9494

95-
Ok(ParsedBundle {
95+
Ok(Self {
9696
txs,
9797
block_number: bundle.block_number,
9898
flashblock_number_min: bundle.flashblock_number_min,
@@ -243,7 +243,7 @@ impl BundleTxs for AcceptedBundle {
243243

244244
impl AcceptedBundle {
245245
pub fn new(bundle: ParsedBundle, meter_bundle_response: MeterBundleResponse) -> Self {
246-
AcceptedBundle {
246+
Self {
247247
uuid: bundle.replacement_uuid.unwrap_or_else(Uuid::new_v4),
248248
txs: bundle.txs,
249249
block_number: bundle.block_number,
@@ -258,7 +258,7 @@ impl AcceptedBundle {
258258
}
259259
}
260260

261-
pub fn uuid(&self) -> &Uuid {
261+
pub const fn uuid(&self) -> &Uuid {
262262
&self.uuid
263263
}
264264
}

crates/ingress-rpc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ alloy-signer-local.workspace = true
2121
reth-optimism-evm.workspace = true
2222
reth-rpc-eth-types.workspace = true
2323
account-abstraction-core.workspace = true
24+
alloy-primitives = { workspace = true, features = ["map-foldhash", "serde"] }
2425
tokio = { workspace = true, features = ["full"] }
2526
tracing = { workspace = true, features = ["std"] }
2627
anyhow = { workspace = true, features = ["std"] }
@@ -33,7 +34,6 @@ backon = { workspace = true, features = ["std", "tokio-sleep"] }
3334
axum = { workspace = true, features = ["tokio", "http1", "json"] }
3435
clap = { version = "4.5.47", features = ["std", "derive", "env"] }
3536
op-alloy-consensus = { workspace = true, features = ["std", "k256", "serde"] }
36-
alloy-primitives = { workspace = true, features = ["map-foldhash", "serde"] }
3737

3838
[dev-dependencies]
3939
mockall = "0.13"

0 commit comments

Comments
 (0)