You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ethexe: typed MB/EB hashes via HashOf<MB> and HashOf<EB> #5507
H256 is the lingua franca for many distinct hash kinds across ethexe — Ethereum block hashes, malachite envelope hashes, payload digests, etc. Mixing them at signature level is dangerous; the most visible footgun today is the MB hash vs the EB (Ethereum block) hash, which both appear in CompactMb, in MalachiteEvent, and in the MbStorageRO/RW trait surface as bare H256. Compiler can't help when a caller swaps one for the other.
Goal
Add ethexe-common as a dep of ethexe-malachite-core (currently leaf-isolated).
Move ethexe_malachite_core::Block to ethexe_common::malachite::MB (carrying parent_hash: HashOf<MB>, height: u64, payload: BlockPayload, reserved: [u8; 64]). BlockPayload moves with it.
Restructure CompactMb: same fields as MB but with payload_hash: H256 in place of BlockPayload. Move it to ethexe_common::malachite alongside MB.
Replace H256 with HashOf<MB> everywhere it represents a malachite block hash: trait sigs in MbStorageRO/RW, DBGlobals::latest_finalized_mb_hash, Externalities callbacks, CommitCertificate::block_hash, MalachiteEvent::*::mb_hash, etc.
Introduce pub type EB = SimpleBlockData; and a SimpleBlockData::typed_hash() -> HashOf<EB> that lifts the existing Ethereum block hash into the typed wrapper without recomputing.
HashOf<T> encodes/decodes as 32 bytes (phantom is #[codec(skip)]), so the wire format stays byte-identical to bare H256.
Non-goals
No data migrations — DB can change shape freely on this branch.
Activity
refactor(vara.eth): introduce typed MB/EB hashes, move MB/BlockPayloa…
refactor(vara.eth): introduce typed MB/EB hashes, move MB/BlockPayloa…