diff --git a/crates/primitives-traits/src/account.rs b/crates/primitives-traits/src/account.rs index 8ecbf19a91..6099e71311 100644 --- a/crates/primitives-traits/src/account.rs +++ b/crates/primitives-traits/src/account.rs @@ -61,6 +61,10 @@ impl Bytecode { /// Create new bytecode from raw bytes. /// /// No analysis will be performed. + /// + /// # Panics + /// + /// Panics if bytecode is EOF and has incorrect format. pub fn new_raw(bytes: Bytes) -> Self { Self(RevmBytecode::new_raw(bytes)) } @@ -87,10 +91,10 @@ impl Compact for Bytecode { buf.put_slice(map); 1 + 8 + map.len() } - RevmBytecode::Eof(_) => { - // buf.put_u8(3); - // TODO(EOF) - todo!("EOF") + RevmBytecode::Eof(eof) => { + buf.put_u8(3); + buf.put_slice(eof.raw().as_ref()); + 1 + eof.raw().as_ref().len() } }; len + bytecode.len() + 4 @@ -114,8 +118,10 @@ impl Compact for Bytecode { JumpTable::from_slice(buf), ) }), - // TODO(EOF) - 3 => todo!("EOF"), + 3 => { + // EOF bytecode object will be decoded from the raw bytecode + Self(RevmBytecode::new_raw(bytes)) + } _ => unreachable!("Junk data in database: unknown Bytecode variant"), }; (decoded, &[])