Skip to content

Commit

Permalink
Merge branch 'listener-refined' into symbotic-bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay111meher committed Nov 14, 2024
2 parents 396ff0e + 085b438 commit 1208678
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions matching_engine/src/ask_lib/ask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct LocalAsk {
pub reward: U256,
pub expiry: U256,
pub deadline: U256,
pub time_requested_for_proof_generation: U256,
pub prover_refund_address: Address,
pub prover_data: Bytes,
pub has_private_inputs: bool,
Expand Down
10 changes: 10 additions & 0 deletions matching_engine/src/generator_lib/generator_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ impl<'a> GeneratorQueryResult<'a> {
self
}

pub fn filter_by_time(mut self, task_time: U256) -> Self {
log::debug!("Filter by time");
self.generator_markets = self
.generator_markets
.into_iter()
.filter(|&gen| gen.proposed_time.lt(&task_time))
.collect();
self
}

// Filter by state
pub fn filter_by_state(mut self, states: Vec<GeneratorState>) -> Self {
let states_set: std::collections::HashSet<_> = states.into_iter().collect(); // Convert Vec to HashSet for fast lookup
Expand Down
6 changes: 4 additions & 2 deletions matching_engine/src/jobs/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ impl LogParser {
let generator_query = generator_store
.query_by_market_id(&random_pending_ask.market_id)
.filter_by_state(vec![GeneratorState::Joined, GeneratorState::Wip])
.filter_by_reward(task_reward);
.filter_by_reward(task_reward)
.filter_by_time(random_pending_ask.time_requested_for_proof_generation);

let generator_with_idle_compute =
generator_store.filter_by_has_idle_compute(generator_query);
Expand All @@ -693,7 +694,8 @@ impl LogParser {
let generator_query = generator_store
.query_by_market_id(&random_pending_ask.market_id)
.filter_by_state(vec![GeneratorState::Joined, GeneratorState::Wip])
.filter_by_reward(task_reward);
.filter_by_reward(task_reward)
.filter_by_time(random_pending_ask.time_requested_for_proof_generation);

let generator_with_idle_compute =
generator_store.filter_by_has_idle_compute(generator_query);
Expand Down
1 change: 1 addition & 0 deletions matching_engine/src/log_processor/pm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub async fn process_proof_market_place_logs(
generator: None,
invalid_secret_flag: false,
created_on: created_on_l1,
time_requested_for_proof_generation: ask_data.0.time_taken_for_proof_generation,
};

if parsed_ask_created_log.has_private_inputs {
Expand Down

0 comments on commit 1208678

Please sign in to comment.