Skip to content

Commit e3233f0

Browse files
author
Solar Mithril
committed
Add make command for op-rbuilder image
Add +nightly for cargo fmt, clippy and fix Run make fmt
1 parent dc7d3fc commit e3233f0

File tree

17 files changed

+97
-86
lines changed

17 files changed

+97
-86
lines changed

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ build: ## Build (debug version)
2828
cargo build --features "$(FEATURES)"
2929

3030
.PHONY: docker-image-rbuilder
31-
docker-image-rubilder: ## Build a rbuilder Docker image
31+
docker-image-rbuilder: ## Build a rbuilder Docker image
3232
docker build --platform linux/amd64 --target rbuilder-runtime --build-arg FEATURES="$(FEATURES)" . -t rbuilder
3333

34+
.PHONY: docker-image-op-rbuilder
35+
docker-image-op-rbuilder: ## Build a rbuilder Docker image
36+
docker build --platform linux/amd64 --target rbuilder-runtime --build-arg FEATURES="$(FEATURES)" --file Dockerfile.op-rbuilder . -t op-rbuilder
37+
3438
.PHONY: docker-image-test-relay
3539
docker-image-test-relay: ## Build a test relay Docker image
3640
docker build --platform linux/amd64 --target test-relay-runtime --build-arg FEATURES="$(FEATURES)" . -t test-relay
@@ -39,9 +43,9 @@ docker-image-test-relay: ## Build a test relay Docker image
3943

4044
.PHONY: lint
4145
lint: ## Run the linters
42-
cargo fmt -- --check
43-
cargo clippy --features "$(FEATURES)" -- -D warnings
44-
cargo clippy -p op-rbuilder --features "$(FEATURES)" -- -D warnings
46+
cargo +nightly fmt -- --check
47+
cargo +nightly clippy --features "$(FEATURES)" -- -D warnings
48+
cargo +nightly clippy -p op-rbuilder --features "$(FEATURES)" -- -D warnings
4549

4650
.PHONY: test
4751
test: ## Run the tests for rbuilder and op-rbuilder
@@ -54,10 +58,10 @@ lt: lint test ## Run "lint" and "test"
5458

5559
.PHONY: fmt
5660
fmt: ## Format the code
57-
cargo fmt
58-
cargo fix --allow-staged
59-
cargo clippy --features "$(FEATURES)" --fix --allow-staged
60-
cargo clippy -p op-rbuilder --features "$(FEATURES)" --fix --allow-staged
61+
cargo +nightly fmt
62+
cargo +nightly fix --allow-staged
63+
cargo +nightly clippy --features "$(FEATURES)" --fix --allow-staged
64+
cargo +nightly clippy -p op-rbuilder --features "$(FEATURES)" --fix --allow-staged
6165

6266
.PHONY: bench
6367
bench: ## Run benchmarks

crates/eth-sparse-mpt/src/reth_sparse_trie/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use reth_provider::{
66
providers::ConsistentDbView, BlockReader, DatabaseProviderFactory, ExecutionOutcome,
77
StateCommitmentProvider,
88
};
9-
use std::sync::Arc;
10-
use std::time::{Duration, Instant};
9+
use std::{
10+
sync::Arc,
11+
time::{Duration, Instant},
12+
};
1113

1214
pub mod change_set;
1315
pub mod hash;

crates/eth-sparse-mpt/src/reth_sparse_trie/shared_cache.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use crate::{
55
sparse_mpt::{AddNodeError, FixedTrie},
66
utils::HashMap,
77
};
8-
use alloy_primitives::Bytes;
9-
use alloy_primitives::B256;
8+
use alloy_primitives::{Bytes, B256};
109
use alloy_trie::Nibbles;
1110

1211
/// SparseTrieSharedCache is a storage for fetched parts of the ethereum tries

crates/op-rbuilder/src/generator.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
use futures_util::Future;
2-
use futures_util::FutureExt;
3-
use reth::providers::BlockReaderIdExt;
4-
use reth::{providers::StateProviderFactory, tasks::TaskSpawner};
5-
use reth_basic_payload_builder::HeaderForPayload;
6-
use reth_basic_payload_builder::{BasicPayloadJobGeneratorConfig, PayloadConfig};
7-
use reth_node_api::PayloadBuilderAttributes;
8-
use reth_node_api::PayloadKind;
9-
use reth_payload_builder::PayloadJobGenerator;
10-
use reth_payload_builder::{KeepPayloadJobAlive, PayloadBuilderError, PayloadJob};
1+
use futures_util::{Future, FutureExt};
2+
use reth::{
3+
providers::{BlockReaderIdExt, StateProviderFactory},
4+
tasks::TaskSpawner,
5+
};
6+
use reth_basic_payload_builder::{BasicPayloadJobGeneratorConfig, HeaderForPayload, PayloadConfig};
7+
use reth_node_api::{PayloadBuilderAttributes, PayloadKind};
8+
use reth_payload_builder::{
9+
KeepPayloadJobAlive, PayloadBuilderError, PayloadJob, PayloadJobGenerator,
10+
};
1111
use reth_payload_primitives::BuiltPayload;
1212
use reth_primitives_traits::HeaderTy;
1313
use reth_revm::cached::CachedReads;
14-
use std::sync::{Arc, Mutex};
15-
use std::time::SystemTime;
16-
use std::time::UNIX_EPOCH;
17-
use tokio::sync::oneshot;
18-
use tokio::sync::Notify;
19-
use tokio::time::Duration;
20-
use tokio::time::Sleep;
14+
use std::{
15+
sync::{Arc, Mutex},
16+
time::{SystemTime, UNIX_EPOCH},
17+
};
18+
use tokio::{
19+
sync::{oneshot, Notify},
20+
time::{Duration, Sleep},
21+
};
2122
use tokio_util::sync::CancellationToken;
2223
use tracing::info;
2324

@@ -424,14 +425,15 @@ mod tests {
424425
use reth::tasks::TokioTaskExecutor;
425426
use reth_chain_state::ExecutedBlockWithTrieUpdates;
426427
use reth_node_api::NodePrimitives;
427-
use reth_optimism_payload_builder::payload::OpPayloadBuilderAttributes;
428-
use reth_optimism_payload_builder::OpPayloadPrimitives;
428+
use reth_optimism_payload_builder::{payload::OpPayloadBuilderAttributes, OpPayloadPrimitives};
429429
use reth_optimism_primitives::OpPrimitives;
430430
use reth_primitives::SealedBlock;
431431
use reth_provider::test_utils::MockEthProvider;
432432
use reth_testing_utils::generators::{random_block_range, BlockRangeParams};
433-
use tokio::task;
434-
use tokio::time::{sleep, Duration};
433+
use tokio::{
434+
task,
435+
time::{sleep, Duration},
436+
};
435437

436438
#[tokio::test]
437439
async fn test_block_cell_wait_for_value() {

crates/op-rbuilder/src/integration/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
use std::future::Future;
2-
use std::path::Path;
31
use std::{
42
fs::{File, OpenOptions},
3+
future::Future,
54
io,
65
io::prelude::*,
7-
path::PathBuf,
6+
path::{Path, PathBuf},
87
process::{Child, Command},
98
time::{Duration, SystemTime},
109
};

crates/op-rbuilder/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use clap::Parser;
22
use monitoring::Monitoring;
33
use reth::providers::CanonStateSubscriptions;
44
use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
5-
use reth_optimism_node::node::OpAddOnsBuilder;
6-
use reth_optimism_node::OpNode;
5+
use reth_optimism_node::{node::OpAddOnsBuilder, OpNode};
76

87
#[cfg(feature = "flashblocks")]
98
use payload_builder::CustomOpPayloadBuilder;

crates/op-rbuilder/src/metrics.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use reth_metrics::{metrics::Counter, metrics::Gauge, metrics::Histogram, Metrics};
1+
use reth_metrics::{
2+
metrics::{Counter, Gauge, Histogram},
3+
Metrics,
4+
};
25

36
/// op-rbuilder metrics
47
#[derive(Metrics, Clone)]

crates/op-rbuilder/src/tester/mod.rs

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
use crate::tx_signer::Signer;
2-
use alloy_eips::eip2718::Encodable2718;
3-
use alloy_eips::BlockNumberOrTag;
4-
use alloy_primitives::address;
5-
use alloy_primitives::Address;
6-
use alloy_primitives::Bytes;
7-
use alloy_primitives::TxKind;
8-
use alloy_primitives::B256;
9-
use alloy_primitives::{hex, U256};
10-
use alloy_rpc_types_engine::ExecutionPayloadV1;
11-
use alloy_rpc_types_engine::ExecutionPayloadV2;
12-
use alloy_rpc_types_engine::PayloadAttributes;
13-
use alloy_rpc_types_engine::PayloadStatusEnum;
14-
use alloy_rpc_types_engine::{ExecutionPayloadV3, ForkchoiceUpdated, PayloadStatus};
2+
use alloy_eips::{eip2718::Encodable2718, BlockNumberOrTag};
3+
use alloy_primitives::{address, hex, Address, Bytes, TxKind, B256, U256};
4+
use alloy_rpc_types_engine::{
5+
ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, ForkchoiceUpdated,
6+
PayloadAttributes, PayloadStatus, PayloadStatusEnum,
7+
};
158
use alloy_rpc_types_eth::Block;
16-
use jsonrpsee::core::RpcResult;
17-
use jsonrpsee::http_client::{transport::HttpBackend, HttpClient};
18-
use jsonrpsee::proc_macros::rpc;
19-
use op_alloy_consensus::OpTypedTransaction;
20-
use op_alloy_consensus::TxDeposit;
9+
use jsonrpsee::{
10+
core::RpcResult,
11+
http_client::{transport::HttpBackend, HttpClient},
12+
proc_macros::rpc,
13+
};
14+
use op_alloy_consensus::{OpTypedTransaction, TxDeposit};
2115
use op_alloy_rpc_types_engine::OpPayloadAttributes;
2216
use reth::rpc::{api::EngineApiClient, types::engine::ForkchoiceState};
2317
use reth_node_api::{EngineTypes, PayloadTypes};
2418
use reth_optimism_node::OpEngineTypes;
2519
use reth_payload_builder::PayloadId;
2620
use reth_rpc_layer::{AuthClientLayer, AuthClientService, JwtSecret};
27-
use rollup_boost::flashblocks::FlashblocksService;
28-
use rollup_boost::Flashblocks;
21+
use rollup_boost::{flashblocks::FlashblocksService, Flashblocks};
2922
use serde_json::Value;
30-
use std::str::FromStr;
31-
use std::time::SystemTime;
32-
use std::time::UNIX_EPOCH;
23+
use std::{
24+
str::FromStr,
25+
time::{SystemTime, UNIX_EPOCH},
26+
};
3327

3428
/// Helper for engine api operations
3529
pub struct EngineApi {

crates/rbuilder/src/building/builders/parallel_builder/conflict_resolving_pool.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ use super::{
1515
simulation_cache::SharedSimulationCache, ConflictGroup, ConflictResolutionResultPerGroup,
1616
ConflictTask, GroupId, ResolutionResult, TaskPriority,
1717
};
18-
use crate::building::BlockBuildingContext;
19-
use crate::provider::StateProviderFactory;
18+
use crate::{building::BlockBuildingContext, provider::StateProviderFactory};
2019

2120
pub type TaskQueue = Arc<SegQueue<ConflictTask>>;
2221

crates/rbuilder/src/building/builders/parallel_builder/conflict_task_generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl ConflictTaskGenerator {
6565
self.add_processed_groups(&new_group, &mut processed_groups);
6666

6767
// Remove all subset groups
68-
if new_group.conflicting_group_ids.len() > 0 {
68+
if !new_group.conflicting_group_ids.is_empty() {
6969
self.remove_conflicting_subset_groups(&new_group);
7070
}
7171
}

0 commit comments

Comments
 (0)