Skip to content

Commit

Permalink
fix(forrestrie/examples): fix range in binary search
Browse files Browse the repository at this point in the history
  • Loading branch information
suchapalaver committed Oct 22, 2024
1 parent 3eaf795 commit 41cb977
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/forrestrie/examples/match_ethereum_to_beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use firehose_client::client::{Chain, FirehoseClient};
use firehose_protos::beacon_v1::{block, Block as FirehoseBeaconBlock};
use forrestrie::beacon_state::{DENEB_START_SLOT, ETHEREUM_BEACON_DENEB_OFFSET};
use forrestrie::beacon_state::ETHEREUM_BEACON_DENEB_OFFSET;
use std::cmp::Ordering::*;
use tracing::info;
use tracing_subscriber::FmtSubscriber;
Expand All @@ -43,6 +43,8 @@ const EXECUTION_BLOCK_NUMBER: u64 = 20759937;
#[allow(unused)]
const BEACON_SLOT_NUMBER: u64 = 9968872; // Beacon slot 9968872 pairs with Ethereum block 20759937.

const IMAGINARY_CURRENT_SLOT: u64 = 10_000_000;

#[tokio::main]
async fn main() {
let subscriber = FmtSubscriber::builder()
Expand All @@ -52,8 +54,8 @@ async fn main() {

let mut beacon_client = FirehoseClient::new(Chain::Beacon);

let mut low = DENEB_START_SLOT as u64;
let mut high = EXECUTION_BLOCK_NUMBER - ETHEREUM_BEACON_DENEB_OFFSET as u64 + 2_000_000;
let mut low = EXECUTION_BLOCK_NUMBER - ETHEREUM_BEACON_DENEB_OFFSET as u64;
let mut high = IMAGINARY_CURRENT_SLOT;

let mut guesses = 0;

Expand Down

0 comments on commit 41cb977

Please sign in to comment.