pub struct ShadowStorage<'a> { /* private fields */ }Expand description
ReadStorage implementation backed by 2 different backends:
source_storage – backend that will return values for function calls and be the source of truth
to_check_storage – secondary storage, which will verify it’s own return values against source_storage
Note that if to_check_storage value is different than source value, execution continues and metrics/ logs are emitted.
Implementations§
Source§impl<'a> ShadowStorage<'a>
impl<'a> ShadowStorage<'a>
Sourcepub fn new(
source_storage: Box<dyn ReadStorage + 'a>,
to_check_storage: Box<dyn ReadStorage + 'a>,
l1_batch_number: L1BatchNumber,
) -> Self
pub fn new( source_storage: Box<dyn ReadStorage + 'a>, to_check_storage: Box<dyn ReadStorage + 'a>, l1_batch_number: L1BatchNumber, ) -> Self
Creates a new storage using the 2 underlying ReadStorages, first as source, the second to be checked
against the source.
Trait Implementations§
Source§impl<'a> Debug for ShadowStorage<'a>
impl<'a> Debug for ShadowStorage<'a>
Source§impl ReadStorage for ShadowStorage<'_>
impl ReadStorage for ShadowStorage<'_>
Source§fn read_value(&mut self, key: &StorageKey) -> StorageValue
fn read_value(&mut self, key: &StorageKey) -> StorageValue
Read value of the key.
Source§fn is_write_initial(&mut self, key: &StorageKey) -> bool
fn is_write_initial(&mut self, key: &StorageKey) -> bool
Checks whether a write to this storage at the specified
key would be an initial write.
Roughly speaking, this is the case when the storage doesn’t contain key, although
in case of mutable storage, the caveats apply (a write to a key that is present
in the storage but was not committed is still an initial write).Source§fn load_factory_dep(&mut self, hash: H256) -> Option<Vec<u8>>
fn load_factory_dep(&mut self, hash: H256) -> Option<Vec<u8>>
Load the factory dependency code by its hash.
Source§fn get_enumeration_index(&mut self, key: &StorageKey) -> Option<u64>
fn get_enumeration_index(&mut self, key: &StorageKey) -> Option<u64>
Retrieves the enumeration index for a given
key.Source§fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool
fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool
Returns whether a bytecode hash is “known” to the system.
Auto Trait Implementations§
impl<'a> Freeze for ShadowStorage<'a>
impl<'a> !RefUnwindSafe for ShadowStorage<'a>
impl<'a> !Send for ShadowStorage<'a>
impl<'a> !Sync for ShadowStorage<'a>
impl<'a> Unpin for ShadowStorage<'a>
impl<'a> !UnwindSafe for ShadowStorage<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request