Skip to content

Commit

Permalink
More bidding mocks (#208)
Browse files Browse the repository at this point in the history
## πŸ“ Summary

More mocking and debug stuff.

## πŸ’‘ Motivation and Context

Allow better tests!

---

## βœ… I have completed the following steps:

* [X] Run `make lint`
* [X] Run `make test`
* [ ] Added tests (if applicable)
  • Loading branch information
ZanCorDX authored Oct 3, 2024
1 parent 412ff88 commit 83e0b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use alloy_primitives::U256;
use mockall::automock;
use std::sync::Arc;

/// Sync + Send to allow to be called from another thread.
#[automock]
pub trait BidValueObs: std::fmt::Debug + Sync + Send {
/// @Pending: add source of the bid.
fn update_new_bid(&self, bid: U256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
live_builder::block_output::bid_value_source::interfaces::BidValueObs,
};
use alloy_primitives::U256;
use mockall::automock;
use reth_primitives::BlockNumber;
use time::OffsetDateTime;
use tokio_util::sync::CancellationToken;
Expand Down Expand Up @@ -57,6 +58,7 @@ pub trait BidMaker: std::fmt::Debug {
}

/// Info about a onchain block from reth.
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct LandedBlockInfo {
pub block_number: BlockNumber,
pub block_timestamp: OffsetDateTime,
Expand Down Expand Up @@ -95,6 +97,7 @@ pub trait BiddingService: std::fmt::Debug + Send + Sync {

/// Trait to control the must_win_block feature of the BiddingService.
/// It allows to use BiddingService as a Box (single threaded mutable access) but be able to call must_win_block from another thread.
#[automock]
pub trait BiddingServiceWinControl: Send + Sync + std::fmt::Debug {
/// If called, any current or future SlotBidder working on that block will bid more aggressively to win the block.
fn must_win_block(&self, block: u64);
Expand Down

0 comments on commit 83e0b64

Please sign in to comment.