pub struct AuthorityStore { /* private fields */ }
Expand description

ALL_OBJ_VER determines whether we want to store all past versions of every object in the store. Authority doesn’t store them, but other entities such as replicas will. S is a template on Authority signature state. This allows SuiDataStore to be used on either authorities or non-authorities. Specifically, when storing transactions and effects, S allows SuiDataStore to either store the authority signed version or unsigned version.

Implementations§

source§

impl AuthorityStore

source

pub async fn open( perpetual_tables: Arc<AuthorityPerpetualTables>, genesis: &Genesis, indirect_objects_threshold: usize, enable_epoch_sui_conservation_check: bool, registry: &Registry ) -> SuiResult<Arc<Self>>

Open an authority store by directory path. If the store is empty, initialize it using genesis.

source

pub fn update_epoch_flags_metrics(&self, old: &[EpochFlag], new: &[EpochFlag])

source

pub fn clear_object_per_epoch_marker_table( &self, _execution_guard: &RwLockWriteGuard<'_, EpochId> ) -> SuiResult<()>

source

pub async fn open_with_committee_for_testing( perpetual_tables: Arc<AuthorityPerpetualTables>, committee: &Committee, genesis: &Genesis, indirect_objects_threshold: usize ) -> SuiResult<Arc<Self>>

source

pub fn open_no_genesis( perpetual_tables: Arc<AuthorityPerpetualTables>, indirect_objects_threshold: usize, enable_epoch_sui_conservation_check: bool, registry: &Registry ) -> SuiResult<Arc<Self>>

Open authority store without any operations that require genesis, such as constructing EpochStartConfiguration or inserting genesis objects.

source

pub fn get_recovery_epoch_at_restart(&self) -> SuiResult<EpochId>

source

pub fn get_effects( &self, effects_digest: &TransactionEffectsDigest ) -> SuiResult<Option<TransactionEffects>>

source

pub fn effects_exists( &self, effects_digest: &TransactionEffectsDigest ) -> SuiResult<bool>

Returns true if we have an effects structure for this transaction digest

source

pub fn get_events( &self, event_digest: &TransactionEventsDigest ) -> Result<Option<TransactionEvents>, TypedStoreError>

source

pub fn multi_get_events( &self, event_digests: &[TransactionEventsDigest] ) -> SuiResult<Vec<Option<TransactionEvents>>>

source

pub fn multi_get_effects<'a>( &self, effects_digests: impl Iterator<Item = &'a TransactionEffectsDigest> ) -> SuiResult<Vec<Option<TransactionEffects>>>

source

pub fn get_executed_effects( &self, tx_digest: &TransactionDigest ) -> SuiResult<Option<TransactionEffects>>

source

pub fn multi_get_executed_effects_digests( &self, digests: &[TransactionDigest] ) -> SuiResult<Vec<Option<TransactionEffectsDigest>>>

Given a list of transaction digests, returns a list of the corresponding effects only if they have been executed. For transactions that have not been executed, None is returned.

source

pub fn multi_get_executed_effects( &self, digests: &[TransactionDigest] ) -> SuiResult<Vec<Option<TransactionEffects>>>

Given a list of transaction digests, returns a list of the corresponding effects only if they have been executed. For transactions that have not been executed, None is returned.

source

pub fn is_tx_already_executed( &self, digest: &TransactionDigest ) -> SuiResult<bool>

source

pub fn get_marker_value( &self, object_id: &ObjectID, version: &SequenceNumber, epoch_id: EpochId ) -> SuiResult<Option<MarkerValue>>

source

pub fn get_latest_marker( &self, object_id: &ObjectID, epoch_id: EpochId ) -> SuiResult<Option<(SequenceNumber, MarkerValue)>>

source

pub async fn notify_read_root_state_hash( &self, epoch: EpochId ) -> SuiResult<(CheckpointSequenceNumber, Accumulator)>

Returns future containing the state hash for the given epoch once available

source

pub fn deprecated_insert_finalized_transactions( &self, digests: &[TransactionDigest], epoch: EpochId, sequence: CheckpointSequenceNumber ) -> SuiResult

source

pub fn deprecated_get_transaction_checkpoint( &self, digest: &TransactionDigest ) -> SuiResult<Option<(EpochId, CheckpointSequenceNumber)>>

source

pub fn deprecated_multi_get_transaction_checkpoint( &self, digests: &[TransactionDigest] ) -> SuiResult<Vec<Option<(EpochId, CheckpointSequenceNumber)>>>

source

pub fn database_is_empty(&self) -> SuiResult<bool>

Returns true if there are no objects in the database

source

pub fn object_exists_by_key( &self, object_id: &ObjectID, version: VersionNumber ) -> SuiResult<bool>

source

pub fn multi_object_exists_by_key( &self, object_keys: &[ObjectKey] ) -> SuiResult<Vec<bool>>

source

pub fn multi_get_objects_by_key( &self, object_keys: &[ObjectKey] ) -> Result<Vec<Option<Object>>, SuiError>

source

pub fn get_objects( &self, objects: &[ObjectID] ) -> Result<Vec<Option<Object>>, SuiError>

Get many objects

source

pub fn have_deleted_owned_object_at_version_or_after( &self, object_id: &ObjectID, version: VersionNumber, epoch_id: EpochId ) -> Result<bool, SuiError>

source

pub fn bulk_insert_live_objects( perpetual_db: &AuthorityPerpetualTables, live_objects: impl Iterator<Item = LiveObject>, indirect_objects_threshold: usize, expected_sha3_digest: &[u8; 32] ) -> SuiResult<()>

source

pub fn set_epoch_start_configuration( &self, epoch_start_configuration: &EpochStartConfiguration ) -> SuiResult

source

pub fn get_epoch_start_configuration( &self ) -> SuiResult<Option<EpochStartConfiguration>>

source

pub async fn write_transaction_outputs( &self, epoch_id: EpochId, tx_outputs: &[Arc<TransactionOutputs>] ) -> SuiResult

Updates the state resulting from the execution of a certificate.

Internally it checks that all locks for active inputs are at the correct version, and then writes objects, certificates, parents and clean up locks atomically.

source

pub fn check_owned_objects_are_live(&self, objects: &[ObjectRef]) -> SuiResult

Checks multiple object locks exist. Returns UserInputError::ObjectNotFound if cannot find lock record for at least one of the objects. Returns UserInputError::ObjectVersionUnavailableForConsumption if at least one object lock is not initialized at the given version.

source

pub fn initialize_live_object_markers( live_object_marker_table: &DBMap<ObjectRef, Option<LockDetailsWrapperDeprecated>>, write_batch: &mut DBBatch, objects: &[ObjectRef], is_force_reset: bool ) -> SuiResult

source

pub fn revert_state_update(&self, tx_digest: &TransactionDigest) -> SuiResult

This function is called at the end of epoch for each transaction that’s executed locally on the validator but didn’t make to the last checkpoint. The effects of the execution is reverted here. The following things are reverted:

  1. All new object states are deleted.
  2. owner_index table change is reverted.

NOTE: transaction and effects are intentionally not deleted. It’s possible that if this node is behind, the network will execute the transaction in a later epoch. In that case, we need to keep it saved so that when we receive the checkpoint that includes it from state sync, we are able to execute the checkpoint. TODO: implement GC for transactions that are no longer needed.

source

pub fn find_object_lt_or_eq_version( &self, object_id: ObjectID, version: SequenceNumber ) -> SuiResult<Option<Object>>

Return the object with version less then or eq to the provided seq number. This is used by indexer to find the correct version of dynamic field child object. We do not store the version of the child object, but because of lamport timestamp, we know the child must have version number less then or eq to the parent.

source

pub fn get_latest_object_ref_or_tombstone( &self, object_id: ObjectID ) -> Result<Option<ObjectRef>, SuiError>

Returns the latest object reference we have for this object_id in the objects table.

The method may also return the reference to a deleted object with a digest of ObjectDigest::deleted() or ObjectDigest::wrapped() and lamport version of a transaction that deleted the object. Note that a deleted object may re-appear if the deletion was the result of the object being wrapped in another object.

If no entry for the object_id is found, return None.

source

pub fn get_latest_object_ref_if_alive( &self, object_id: ObjectID ) -> Result<Option<ObjectRef>, SuiError>

Returns the latest object reference if and only if the object is still live (i.e. it does not return tombstones)

source

pub fn get_latest_object_or_tombstone( &self, object_id: ObjectID ) -> Result<Option<(ObjectKey, ObjectOrTombstone)>, SuiError>

Returns the latest object we have for this object_id in the objects table.

If no entry for the object_id is found, return None.

source

pub fn insert_transaction_and_effects( &self, transaction: &VerifiedTransaction, transaction_effects: &TransactionEffects ) -> Result<(), TypedStoreError>

source

pub fn multi_insert_transaction_and_effects<'a>( &self, transactions: impl Iterator<Item = &'a VerifiedExecutionData> ) -> Result<(), TypedStoreError>

source

pub fn multi_get_transaction_blocks( &self, tx_digests: &[TransactionDigest] ) -> SuiResult<Vec<Option<VerifiedTransaction>>>

source

pub fn get_transaction_block( &self, tx_digest: &TransactionDigest ) -> Result<Option<VerifiedTransaction>, TypedStoreError>

source

pub fn get_sui_system_state_object_unsafe(&self) -> SuiResult<SuiSystemState>

This function reads the DB directly to get the system state object. If reconfiguration is happening at the same time, there is no guarantee whether we would be getting the old or the new system state object. Hence this function should only be called during RPC reads where data race is not a major concern. In general we should avoid this as much as possible. If the intent is for testing, you can use AuthorityState:: get_sui_system_state_object_for_testing.

source

pub fn expensive_check_sui_conservation<T>( self: &Arc<Self>, type_layout_store: T, old_epoch_store: &AuthorityPerEpochStore ) -> SuiResult
where T: TypeLayoutStore + Send + Copy,

source

pub fn maybe_reaccumulate_state_hash( &self, cur_epoch_store: &AuthorityPerEpochStore, new_protocol_version: ProtocolVersion )

This is a temporary method to be used when we enable simplified_unwrap_then_delete. It re-accumulates state hash for the new epoch if simplified_unwrap_then_delete is enabled.

Trait Implementations§

source§

impl AccumulatorStore for AuthorityStore

source§

fn get_object_ref_prior_to_key_deprecated( &self, object_id: &ObjectID, version: VersionNumber ) -> SuiResult<Option<ObjectRef>>

This function is only called in older protocol versions, and should no longer be used. It creates an explicit dependency to tombstones which is not desired.
source§

fn get_root_state_accumulator_for_epoch( &self, epoch: EpochId ) -> SuiResult<Option<(CheckpointSequenceNumber, Accumulator)>>

source§

fn get_root_state_accumulator_for_highest_epoch( &self ) -> SuiResult<Option<(EpochId, (CheckpointSequenceNumber, Accumulator))>>

source§

fn insert_state_accumulator_for_epoch( &self, epoch: EpochId, last_checkpoint_of_epoch: &CheckpointSequenceNumber, acc: &Accumulator ) -> SuiResult

source§

fn iter_live_object_set( &self, include_wrapped_object: bool ) -> Box<dyn Iterator<Item = LiveObject> + '_>

source§

fn iter_cached_live_object_set_for_testing( &self, include_wrapped_tombstone: bool ) -> Box<dyn Iterator<Item = LiveObject> + '_>

source§

impl ObjectStore for AuthorityStore

source§

fn get_object(&self, object_id: &ObjectID) -> Result<Option<Object>, Error>

Read an object and return it, or Ok(None) if the object was not found.

source§

fn get_object_by_key( &self, object_id: &ObjectID, version: VersionNumber ) -> Result<Option<Object>, Error>

source§

fn multi_get_objects( &self, object_ids: &[ObjectID] ) -> Result<Vec<Option<Object>>, Error>

source§

fn multi_get_objects_by_key( &self, object_keys: &[ObjectKey] ) -> Result<Vec<Option<Object>>, Error>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a Request
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more