Context
Flagged in PR #35 code review (comment).
Problem
crates/common/types/genesis.rs — native_token_scale_factor() can panic on user-supplied config when native_token_l1_decimals > 18, which can crash nodes at runtime (e.g., when reading genesis JSON).
Current Code
10u64.pow(18 - self.native_token_l1_decimals.unwrap())
This will panic with underflow if decimals > 18.
Proposed Fix
Return Result<Option<U256>, _> (or validate config during deserialization/initialization) so invalid configs surface as structured errors instead of panics.
Note: The bridge contract already rejects >18 decimals, but defense-in-depth at the Rust layer is still valuable.
Context
Flagged in PR #35 code review (comment).
Problem
crates/common/types/genesis.rs—native_token_scale_factor()can panic on user-supplied config whennative_token_l1_decimals > 18, which can crash nodes at runtime (e.g., when reading genesis JSON).Current Code
This will panic with underflow if decimals > 18.
Proposed Fix
Return
Result<Option<U256>, _>(or validate config during deserialization/initialization) so invalid configs surface as structured errors instead of panics.Note: The bridge contract already rejects >18 decimals, but defense-in-depth at the Rust layer is still valuable.