Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions keeper/src/l2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy::primitives::{Address, B256, Bytes, U256};
use alloy::primitives::{Address, B256, Bytes};
use std::collections::HashMap;

mod escalator;
Expand All @@ -21,41 +21,12 @@ struct RoundState {
raw_htx: Option<Bytes>,
deadline: Option<u64>,
outcome: Option<u8>,
round_info: Option<RoundInfoView>,
rewards_done: bool,
reward_sync_attempted: bool,
jailing_done: bool,
}

#[derive(Debug, Clone, Copy)]
struct RoundInfoView {
reward: Address,
valid_stake: U256,
invalid_stake: U256,
}

#[derive(Debug, Clone)]
struct RewardPolicyCache {
last_checked_at: Option<u64>,
last_budget: Option<U256>,
last_remaining: Option<U256>,
last_sync_attempt_at: Option<u64>,
}

impl RewardPolicyCache {
fn new() -> Self {
Self {
last_checked_at: None,
last_budget: None,
last_remaining: None,
last_sync_attempt_at: None,
}
}
}

#[derive(Default)]
pub struct KeeperState {
raw_htx_by_heartbeat: HashMap<B256, Bytes>,
rounds: HashMap<RoundKey, RoundState>,
reward_policies: HashMap<Address, RewardPolicyCache>,
}
Loading