Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Strong Error Typing #187

Merged
merged 3 commits into from
May 29, 2024
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
2 changes: 1 addition & 1 deletion crates/derive/src/types/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl Channel {
(0..=self.last_frame_number).try_for_each(|i| {
let frame = self.inputs.get(&i).ok_or_else(|| anyhow!("Frame not found"))?;
data.extend_from_slice(&frame.data);
Ok(())
Ok::<(), anyhow::Error>(())
})?;
Ok(data.into())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/block_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl L1BlockInfoTx {
let scalar = system_config.l1_fee_scalar.to_be_bytes::<32>();
let blob_base_fee_scalar = (scalar[0] == L1_SCALAR_ECOTONE)
.then(|| {
Ok(u32::from_be_bytes(
Ok::<u32, anyhow::Error>(u32::from_be_bytes(
scalar[24..28]
.try_into()
.map_err(|_| anyhow!("Failed to parse L1 blob base fee scalar"))?,
Expand Down
8 changes: 5 additions & 3 deletions crates/primitives/src/system_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ impl SystemConfig {
!topics.is_empty() &&
topics[0] == CONFIG_UPDATE_TOPIC
{
self.process_config_update_log(log, rollup_config, l1_time)?;
if let Err(e) = self.process_config_update_log(log, rollup_config, l1_time) {
anyhow::bail!("Failed to process config update log: {:?}", e);
}
}
Ok(())
Ok::<(), anyhow::Error>(())
})?;
}
Ok(())
Ok::<(), anyhow::Error>(())
}

/// Decodes an EVM log entry emitted by the system config contract and applies it as a
Expand Down
Loading