Skip to content

Commit

Permalink
Use radom coinbase address for simualations (#291)
Browse files Browse the repository at this point in the history
## 📝 Summary

This PR makes top of the block simulations use random coinbase address
to make top of the block simulations harder to bypass.

## 💡 Motivation and Context

<!--- (Optional) Why is this change required? What problem does it
solve? Remove this section if not applicable. -->

---

## ✅ I have completed the following steps:

* [ ] Run `make lint`
* [ ] Run `make test`
* [ ] Added tests (if applicable)
  • Loading branch information
dvush authored Dec 19, 2024
1 parent 7c4ce77 commit 3e8b7c6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/rbuilder/src/live_builder/simulation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 3e8b7c6

Please sign in to comment.