Skip to content

Commit 2e46d27

Browse files
committed
Add make command for op-rbuilder image
Add +nightly for cargo fmt, clippy and fix Run make fmt
1 parent 5a0732c commit 2e46d27

File tree

19 files changed

+108
-99
lines changed

19 files changed

+108
-99
lines changed

Diff for: Makefile

+12-8
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

Diff for: crates/eth-sparse-mpt/src/reth_sparse_trie/mod.rs

+4-2
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;

Diff for: crates/eth-sparse-mpt/src/reth_sparse_trie/shared_cache.rs

+1-2
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

Diff for: crates/op-rbuilder/src/generator.rs

+23-21
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() {

Diff for: crates/op-rbuilder/src/integration/mod.rs

+2-3
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
};

Diff for: crates/op-rbuilder/src/main.rs

+1-2
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;

Diff for: crates/op-rbuilder/src/metrics.rs

+4-1
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)]

Diff for: crates/op-rbuilder/src/tester/mod.rs

+17-23
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 {

Diff for: crates/rbuilder/src/building/builders/mock_block_building_helper.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
use crate::live_builder::simulation::SimulatedOrderCommand;
2-
use crate::primitives::SimValue;
3-
use crate::provider::RootHasher;
4-
use crate::roothash::RootHashError;
51
use crate::{
62
building::{
73
BlockBuildingContext, BuiltBlockTrace, CriticalCommitOrderError, ExecutionError,
84
ExecutionResult,
95
},
10-
primitives::SimulatedOrder,
6+
live_builder::simulation::SimulatedOrderCommand,
7+
primitives::{SimValue, SimulatedOrder},
8+
provider::RootHasher,
9+
roothash::RootHashError,
1110
};
12-
use alloy_primitives::B256;
13-
use alloy_primitives::U256;
14-
use reth::providers::ExecutionOutcome;
15-
use reth::revm::cached::CachedReads;
11+
use alloy_primitives::{B256, U256};
12+
use reth::{providers::ExecutionOutcome, revm::cached::CachedReads};
1613
use reth_primitives::SealedBlock;
1714
use time::OffsetDateTime;
1815
use tokio::sync::broadcast;

Diff for: crates/rbuilder/src/building/builders/parallel_builder/conflict_resolving_pool.rs

+1-2
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

Diff for: crates/rbuilder/src/building/builders/parallel_builder/conflict_task_generator.rs

+1-1
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
}

Diff for: crates/rbuilder/src/live_builder/block_output/bidding/wallet_balance_watcher.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use time::{error, OffsetDateTime};
66
use tracing::{error, info, warn};
77

88
use super::interfaces::LandedBlockInfo;
9-
use crate::provider::StateProviderFactory;
10-
use crate::telemetry::{add_subsidy_value, inc_subsidized_blocks};
9+
use crate::{
10+
provider::StateProviderFactory,
11+
telemetry::{add_subsidy_value, inc_subsidized_blocks},
12+
};
1113

1214
/// Allows to monitor the evolution of our wallet for the landed blocks.
1315
/// It's useful for bidders to detect profit and subsidies.

Diff for: crates/rbuilder/src/live_builder/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ use reth_primitives::StaticFileSegment;
6363
use reth_provider::StaticFileProviderFactory;
6464
use serde::Deserialize;
6565
use serde_with::{serde_as, OneOrMany};
66-
use std::collections::HashMap;
6766
use std::{
67+
collections::HashMap,
6868
fmt::Debug,
6969
path::{Path, PathBuf},
7070
str::FromStr,

Diff for: crates/rbuilder/src/live_builder/order_input/mod.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ use self::{
1111
orderpool::{OrderPool, OrderPoolSubscriptionId},
1212
replaceable_order_sink::ReplaceableOrderSink,
1313
};
14-
use crate::primitives::{serialize::CancelShareBundle, BundleReplacementData, Order};
15-
use crate::provider::StateProviderFactory;
16-
use crate::telemetry::{set_current_block, set_ordepool_count};
14+
use crate::{
15+
primitives::{serialize::CancelShareBundle, BundleReplacementData, Order},
16+
provider::StateProviderFactory,
17+
telemetry::{set_current_block, set_ordepool_count},
18+
};
1719
use alloy_consensus::Header;
1820
use jsonrpsee::RpcModule;
1921
use parking_lot::Mutex;
20-
use std::{net::Ipv4Addr, path::PathBuf, sync::Arc, time::Duration};
21-
use std::{path::Path, time::Instant};
22+
use std::{
23+
net::Ipv4Addr,
24+
path::{Path, PathBuf},
25+
sync::Arc,
26+
time::{Duration, Instant},
27+
};
2228
use tokio::{sync::mpsc, task::JoinHandle};
2329
use tokio_util::sync::CancellationToken;
2430
use tracing::{debug, error, info, trace, warn};

Diff for: crates/rbuilder/src/mev_boost/sign_payload.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ use super::submission::{
33
SubmitBlockRequest,
44
};
55
use crate::utils::u256decimal_serde_helper;
6-
use alloy_eips::eip7685::Requests;
7-
use alloy_eips::{eip2718::Encodable2718, eip4844::BlobTransactionSidecar};
6+
use alloy_eips::{eip2718::Encodable2718, eip4844::BlobTransactionSidecar, eip7685::Requests};
87
use alloy_primitives::{Address, BlockHash, Bytes, FixedBytes, B256, U256};
9-
use alloy_rpc_types_beacon::requests::ExecutionRequestsV4;
108
use alloy_rpc_types_beacon::{
119
events::PayloadAttributesData,
1210
relay::{BidTrace, SignedBidSubmissionV2, SignedBidSubmissionV3, SignedBidSubmissionV4},
11+
requests::ExecutionRequestsV4,
1312
BlsPublicKey,
1413
};
1514
use alloy_rpc_types_engine::{

Diff for: crates/rbuilder/src/provider/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::live_builder::simulation::SimulatedOrderCommand;
2-
use crate::roothash::RootHashError;
1+
use crate::{live_builder::simulation::SimulatedOrderCommand, roothash::RootHashError};
32
use alloy_consensus::Header;
43
use alloy_eips::BlockNumHash;
54
use alloy_primitives::{BlockHash, BlockNumber, B256};

Diff for: crates/rbuilder/src/provider/reth_prov.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use crate::roothash::RootHashContext;
2-
use crate::utils::RootHasherImpl;
1+
use crate::{roothash::RootHashContext, utils::RootHasherImpl};
32
use alloy_consensus::Header;
43
use alloy_eips::BlockNumHash;
54
use alloy_primitives::{BlockHash, BlockNumber, B256};
65
use reth_errors::ProviderResult;
7-
use reth_provider::{BlockReader, DatabaseProviderFactory, HeaderProvider};
8-
use reth_provider::{StateCommitmentProvider, StateProviderBox};
6+
use reth_provider::{
7+
BlockReader, DatabaseProviderFactory, HeaderProvider, StateCommitmentProvider, StateProviderBox,
8+
};
99
use tracing::error;
1010

1111
use super::{RootHasher, StateProviderFactory};

Diff for: crates/rbuilder/src/telemetry/metrics/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//! When metric server is spawned is serves prometheus metrics at: /debug/metrics/prometheus
77
88
#![allow(unexpected_cfgs)]
9-
use crate::building::BuiltBlockTrace;
109
use crate::{
10+
building::BuiltBlockTrace,
1111
live_builder::block_list_provider::{blocklist_hash, BlockList},
1212
primitives::mev_boost::MevBoostRelayID,
1313
utils::build_info::Version,
@@ -21,9 +21,10 @@ use prometheus::{
2121
Counter, HistogramOpts, HistogramVec, IntCounter, IntCounterVec, IntGauge, IntGaugeVec, Opts,
2222
Registry,
2323
};
24-
use std::sync::{Arc, Mutex};
25-
use std::time::Duration;
26-
use std::time::Instant;
24+
use std::{
25+
sync::{Arc, Mutex},
26+
time::{Duration, Instant},
27+
};
2728
use time::OffsetDateTime;
2829
use tracing::error;
2930

Diff for: crates/test-relay/src/relay.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ use rbuilder::{
2020
primitives::mev_boost::MevBoostRelaySlotInfoProvider,
2121
};
2222
use serde::{Deserialize, Serialize};
23-
use std::time::Instant;
24-
use std::{collections::hash_map::Entry, sync::Arc, time::Duration};
25-
use std::{io::Read, net::SocketAddr};
23+
use std::{
24+
collections::hash_map::Entry,
25+
io::Read,
26+
net::SocketAddr,
27+
sync::Arc,
28+
time::{Duration, Instant},
29+
};
2630
use time::OffsetDateTime;
2731
use tokio::sync::mpsc;
2832
use tokio_util::sync::CancellationToken;
2933
use tracing::{debug, error, info, warn};
30-
use warp::body;
3134
use warp::{
35+
body,
3236
http::status::StatusCode,
3337
query,
3438
reply::{self, Reply},

0 commit comments

Comments
 (0)