Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Aug 16, 2024
1 parent d40c867 commit 5087319
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions bin/host/src/fetcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,19 @@ where
anyhow::bail!("Invalid hint data length: {}", hint_data.len());
}

let data = &hint_data[0..32];
let hash: B256 =
data.try_into().map_err(|e| anyhow!("Failed to convert bytes to B256: {e}"))?;
let data = &hint_data[32..40];
let index = u64::from_be_bytes(
data.try_into().map_err(|e| anyhow!("Failed to convert bytes to u64: {e}"))?,
);
let data = &hint_data[40..48];
let timestamp = u64::from_be_bytes(
data.try_into().map_err(|e| anyhow!("Failed to convert bytes to u64: {e}"))?,
);
let hash_data_bytes: [u8; 32] = hint_data[0..32]
.try_into()
.map_err(|e| anyhow!("Failed to convert bytes to B256: {e}"))?;
let index_data_bytes: [u8; 8] = hint_data[32..40]
.try_into()
.map_err(|e| anyhow!("Failed to convert bytes to u64: {e}"))?;
let timestamp_data_bytes: [u8; 8] = hint_data[40..48]
.try_into()
.map_err(|e| anyhow!("Failed to convert bytes to u64: {e}"))?;

let hash: B256 = hash_data_bytes.into();
let index = u64::from_be_bytes(index_data_bytes);
let timestamp = u64::from_be_bytes(timestamp_data_bytes);

let partial_block_ref = BlockInfo { timestamp, ..Default::default() };
let indexed_hash = IndexedBlobHash { index: index as usize, hash };
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ build-cannon *args='':
--platform linux/amd64 \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/ethereum-optimism/kona/cannon-builder:main cargo build --workspace --all -Zbuild-std $@ --exclude kona-host --exclude trusted-sync
ghcr.io/ethereum-optimism/kona/cannon-builder:main cargo build --workspace --all -Zbuild-std $@ --exclude kona-host --exclude trusted-sync --exclude kdn

# Build for the `asterisc` target. Any crates that require the stdlib are excluded from the build for this target.
build-asterisc *args='':
Expand All @@ -87,7 +87,7 @@ build-asterisc *args='':
--platform linux/amd64 \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/ethereum-optimism/kona/asterisc-builder:main cargo build --workspace --all -Zbuild-std $@ --exclude kona-host --exclude trusted-sync
ghcr.io/ethereum-optimism/kona/asterisc-builder:main cargo build --workspace --all -Zbuild-std $@ --exclude kona-host --exclude trusted-sync --exclude kdn

# Build the `trusted-sync` docker image
docker-build-ts *args='':
Expand Down

0 comments on commit 5087319

Please sign in to comment.