Skip to content
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
213aa20
refactor(l1): improve error handling in set_sync_block with eyre::Result
emirongrr Apr 10, 2026
bf8ae2f
fix(l1): preserve optional guard in set_sync_block
emirongrr Apr 10, 2026
3621fb1
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Apr 10, 2026
d261142
use wrap_err for cleaner error propagation
emirongrr Apr 13, 2026
b1062b6
Merge branch 'refactor/sync-block-error-handling' of https://github.c…
emirongrr Apr 13, 2026
58b8d07
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Apr 13, 2026
acbab61
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Apr 15, 2026
88eb6f8
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Apr 19, 2026
c5b364e
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr May 12, 2026
51dded4
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 2, 2026
5f9822e
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 3, 2026
4a07f68
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 4, 2026
37991a9
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 5, 2026
5f3776a
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 7, 2026
c8b2fd0
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 8, 2026
efa7d88
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 8, 2026
640da1f
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 9, 2026
86ca555
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 9, 2026
1c9b37e
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 10, 2026
f3bb034
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 10, 2026
d8fa078
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 10, 2026
5844869
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 11, 2026
4cff3a1
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 11, 2026
21c43c8
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 12, 2026
0e8362d
Merge branch 'main' into refactor/sync-block-error-handling
emirongrr Jun 14, 2026
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
21 changes: 14 additions & 7 deletions cmd/ethrex/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,21 +553,28 @@ pub fn get_ws_socket_addr(opts: &Options) -> SocketAddr {
}

#[cfg(feature = "sync-test")]
async fn set_sync_block(store: &Store) {
async fn set_sync_block(store: &Store) -> eyre::Result<()> {
if let Ok(block_number) = env::var("SYNC_BLOCK_NUM") {
let block_number = block_number
let block_number: u64 = block_number
.parse()
.expect("Block number provided by environment is not numeric");
.wrap_err("Block number provided by environment is not numeric")?;

let block_hash = store
.get_canonical_block_hash(block_number)
.await
.expect("Could not get hash for block number provided by env variable")
.expect("Could not get hash for block number provided by env variable");
.wrap_err("Failed to query block hash from store")?
.ok_or_else(|| {
eyre::eyre!(
"Could not get hash for block number provided by env variable {block_number}"
)
})?;

store
.forkchoice_update(vec![], block_number, block_hash, None, None)
.await
.expect("Could not set sync block");
.wrap_err("Could not set sync block")?;
}
Ok(())
}

pub async fn init_l1(
Expand Down Expand Up @@ -619,7 +626,7 @@ pub async fn init_l1(
}

#[cfg(feature = "sync-test")]
set_sync_block(&store).await;
set_sync_block(&store).await?;

let blockchain = init_blockchain(
store.clone(),
Expand Down
Loading