11use crate :: journal:: { BundleStateIndex , JournalDecode , JournalDecodeError , JournalEncode } ;
2- use alloy:: primitives:: { keccak256, B256 } ;
2+ use alloy:: primitives:: { keccak256, Bytes , B256 } ;
33use std:: sync:: OnceLock ;
44
55/// Journal associated with a block
@@ -15,7 +15,7 @@ pub struct BlockUpdate<'a> {
1515 journal : BundleStateIndex < ' a > ,
1616
1717 /// The serialized journal
18- serialized : OnceLock < Vec < u8 > > ,
18+ serialized : OnceLock < Bytes > ,
1919
2020 /// The hash of the serialized journal
2121 hash : OnceLock < B256 > ,
@@ -50,7 +50,7 @@ impl<'a> BlockUpdate<'a> {
5050
5151 /// Serialize the block update.
5252 pub fn serialized ( & self ) -> & [ u8 ] {
53- self . serialized . get_or_init ( || JournalEncode :: encoded ( self ) ) . as_slice ( )
53+ self . serialized . get_or_init ( || JournalEncode :: encoded ( self ) ) . as_ref ( )
5454 }
5555
5656 /// Serialize and hash the block update.
@@ -78,7 +78,7 @@ impl JournalDecode for BlockUpdate<'static> {
7878 height : JournalDecode :: decode ( buf) ?,
7979 prev_journal_hash : JournalDecode :: decode ( buf) ?,
8080 journal : JournalDecode :: decode ( buf) ?,
81- serialized : OnceLock :: from ( original . to_vec ( ) ) ,
81+ serialized : OnceLock :: from ( Bytes :: copy_from_slice ( original ) ) ,
8282 hash : OnceLock :: from ( keccak256 ( original) ) ,
8383 } )
8484 }
0 commit comments