Skip to content

Commit fc8f4d5

Browse files
committed
chore: remove constants
1 parent 2144a3f commit fc8f4d5

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/tasks/submit/flashbots.rs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Flashbots Task receives simulated blocks from an upstream channel and
22
//! submits them to the Flashbots relay as bundles.
33
use crate::{
4-
config::{HostProvider, ZenithInstance},
4+
config::{BuilderConfig, HostProvider, ZenithInstance},
55
quincey::Quincey,
66
tasks::{block::sim::SimResult, submit::SubmitPrep},
77
utils,
@@ -16,7 +16,6 @@ use init4_bin_base::{
1616
deps::tracing::{debug, error},
1717
utils::flashbots::Flashbots,
1818
};
19-
use signet_constants::SignetSystemConstants;
2019
use signet_types::SignRequest;
2120
use signet_zenith::{Alloy2718Coder, Zenith::BlockHeader, ZenithBlock};
2221
use tokio::{sync::mpsc, task::JoinHandle};
@@ -38,11 +37,9 @@ pub enum FlashbotsError {
3837
#[derive(Debug)]
3938
pub struct FlashbotsTask {
4039
/// Builder configuration for the task.
41-
config: crate::config::BuilderConfig,
40+
config: BuilderConfig,
4241
/// Flashbots RPC provider.
4342
flashbots: Flashbots,
44-
/// System constants for the rollup and host chain.
45-
constants: SignetSystemConstants,
4643
/// Quincey instance for block signing.
4744
quincey: Quincey,
4845
/// Zenith instance.
@@ -59,8 +56,7 @@ impl FlashbotsTask {
5956
/// Returns a new `FlashbotsTask` instance that receives `SimResult` types from the given
6057
/// channel and handles their preparation, submission to the Flashbots network.
6158
pub async fn new(
62-
config: crate::config::BuilderConfig,
63-
constants: SignetSystemConstants,
59+
config: BuilderConfig,
6460
outbound: mpsc::UnboundedSender<TxHash>,
6561
bundle_helper: bool,
6662
) -> eyre::Result<FlashbotsTask> {
@@ -72,15 +68,7 @@ impl FlashbotsTask {
7268

7369
let zenith = config.connect_zenith(host_provider);
7470

75-
Ok(Self {
76-
config,
77-
constants,
78-
flashbots,
79-
quincey,
80-
zenith,
81-
_outbound: outbound,
82-
bundle_helper,
83-
})
71+
Ok(Self { config, flashbots, quincey, zenith, _outbound: outbound, bundle_helper })
8472
}
8573

8674
/// Returns a reference to the inner `HostProvider`
@@ -111,7 +99,7 @@ impl FlashbotsTask {
11199
);
112100

113101
let tx = prep.prep_transaction(&sim_result.sim_env.prev_header).await.map_err(|err| {
114-
error!(?err, "failed to prepare bumpable transaction");
102+
error!(%err, "failed to prepare bumpable transaction");
115103
FlashbotsError::PreparationError(err.to_string())
116104
})?;
117105

@@ -137,11 +125,11 @@ impl FlashbotsTask {
137125
sim_result: &SimResult,
138126
) -> Result<MevSendBundle, FlashbotsError> {
139127
let target_block = sim_result.block.block_number();
140-
let host_block_number = self.constants.rollup_block_to_host_block_num(target_block);
128+
let host_block_number = self.config.constants.rollup_block_to_host_block_num(target_block);
141129

142130
// Create Zenith block header
143131
let header = BlockHeader {
144-
rollupChainId: U256::from(self.constants.ru_chain_id()),
132+
rollupChainId: U256::from(self.config.constants.ru_chain_id()),
145133
hostBlockNumber: U256::from(host_block_number),
146134
gasLimit: U256::from(self.config.rollup_block_gas_limit),
147135
rewardAddress: self.config.builder_rewards_address,
@@ -163,8 +151,8 @@ impl FlashbotsTask {
163151
.quincey
164152
.get_signature(&SignRequest {
165153
host_block_number: U256::from(host_block_number),
166-
host_chain_id: U256::from(self.constants.host_chain_id()),
167-
ru_chain_id: U256::from(self.constants.ru_chain_id()),
154+
host_chain_id: U256::from(self.config.constants.host_chain_id()),
155+
ru_chain_id: U256::from(self.config.constants.ru_chain_id()),
168156
gas_limit: U256::from(self.config.rollup_block_gas_limit),
169157
ru_reward_address: self.config.builder_rewards_address,
170158
contents: *sim_result.block.contents_hash(),
@@ -183,7 +171,7 @@ impl FlashbotsTask {
183171
let host_fills = sim_result.block.host_fills();
184172
for fill in host_fills {
185173
// Create a host fill transaction with the rollup orders contract and sign it
186-
let tx_req = fill.to_fill_tx(self.constants.ru_orders());
174+
let tx_req = fill.to_fill_tx(self.config.constants.ru_orders());
187175
let sendable = self.host_provider().fill(tx_req).await.map_err(|err| {
188176
error!(?err, "failed to fill transaction");
189177
FlashbotsError::PreparationError(err.to_string())

0 commit comments

Comments
 (0)