From 43db8bacc6503431d3d0d20fd5bc84db7c1351be Mon Sep 17 00:00:00 2001 From: Vitaly Drogan Date: Tue, 17 Dec 2024 17:07:36 +0100 Subject: [PATCH] use radom coinbase address for simualations --- crates/rbuilder/src/live_builder/simulation/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/rbuilder/src/live_builder/simulation/mod.rs b/crates/rbuilder/src/live_builder/simulation/mod.rs index 963d62f7..05027dc0 100644 --- a/crates/rbuilder/src/live_builder/simulation/mod.rs +++ b/crates/rbuilder/src/live_builder/simulation/mod.rs @@ -8,7 +8,7 @@ use crate::{ }, live_builder::order_input::orderpool::OrdersForBlock, primitives::{OrderId, SimulatedOrder}, - utils::gen_uid, + utils::{gen_uid, Signer}, }; use ahash::HashMap; use parking_lot::Mutex; @@ -107,6 +107,15 @@ where ) -> SlotOrderSimResults { let (slot_sim_results_sender, slot_sim_results_receiver) = mpsc::channel(10_000); + let ctx = { + // use random coinbase for simulations to make top of the block simulation bypass harder + let mut ctx = ctx; + let signer = Signer::random(); + ctx.block_env.coinbase = signer.address; + ctx.builder_signer = Some(signer); + ctx + }; + let provider = self.provider.clone(); let current_contexts = Arc::clone(&self.current_contexts); let block_context: BlockContextId = gen_uid();