mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: implement compact for eof bytecode variant (#9654)
This commit is contained in:
@ -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, &[])
|
||||
|
||||
Reference in New Issue
Block a user