pub struct CapsuleStore { /* private fields */ }Expand description
Stores ephemeral capsule data that is consumed during execution.
Capsules are private data blobs passed to contract functions via oracle calls. They are consumed (deleted) after being read.
Implementations§
Source§impl CapsuleStore
impl CapsuleStore
pub fn new(kv: Arc<dyn KvStore>) -> Self
Sourcepub async fn add(&self, contract: &Fr, capsule: &[Vec<Fr>]) -> Result<(), Error>
pub async fn add(&self, contract: &Fr, capsule: &[Vec<Fr>]) -> Result<(), Error>
Store a capsule (a list of field element arrays).
Sourcepub async fn pop(&self, contract: &Fr) -> Result<Option<Vec<Vec<Fr>>>, Error>
pub async fn pop(&self, contract: &Fr) -> Result<Option<Vec<Vec<Fr>>>, Error>
Pop a capsule for the given contract (consumes it).
Sourcepub async fn store_capsule(
&self,
contract_address: &AztecAddress,
slot: &Fr,
capsule: &[Fr],
) -> Result<(), Error>
pub async fn store_capsule( &self, contract_address: &AztecAddress, slot: &Fr, capsule: &[Fr], ) -> Result<(), Error>
Store capsule data in a contract-scoped slot.
Sourcepub async fn load_capsule(
&self,
contract_address: &AztecAddress,
slot: &Fr,
) -> Result<Option<Vec<Fr>>, Error>
pub async fn load_capsule( &self, contract_address: &AztecAddress, slot: &Fr, ) -> Result<Option<Vec<Fr>>, Error>
Load capsule data from a contract-scoped slot.
Sourcepub async fn delete_capsule(
&self,
contract_address: &AztecAddress,
slot: &Fr,
) -> Result<(), Error>
pub async fn delete_capsule( &self, contract_address: &AztecAddress, slot: &Fr, ) -> Result<(), Error>
Delete capsule data from a contract-scoped slot.
Sourcepub async fn copy_capsule(
&self,
contract_address: &AztecAddress,
src_slot: &Fr,
dst_slot: &Fr,
num_entries: usize,
) -> Result<(), Error>
pub async fn copy_capsule( &self, contract_address: &AztecAddress, src_slot: &Fr, dst_slot: &Fr, num_entries: usize, ) -> Result<(), Error>
Copy a contiguous region of contract-scoped slots.
Sourcepub async fn append_to_capsule_array(
&self,
contract_address: &AztecAddress,
base_slot: &Fr,
content: &[Vec<Fr>],
) -> Result<(), Error>
pub async fn append_to_capsule_array( &self, contract_address: &AztecAddress, base_slot: &Fr, content: &[Vec<Fr>], ) -> Result<(), Error>
Append entries to a capsule array stored at base_slot.
Sourcepub async fn read_capsule_array(
&self,
contract_address: &AztecAddress,
base_slot: &Fr,
) -> Result<Vec<Vec<Fr>>, Error>
pub async fn read_capsule_array( &self, contract_address: &AztecAddress, base_slot: &Fr, ) -> Result<Vec<Vec<Fr>>, Error>
Read all entries from a capsule array stored at base_slot.
Sourcepub async fn set_capsule_array(
&self,
contract_address: &AztecAddress,
base_slot: &Fr,
content: &[Vec<Fr>],
) -> Result<(), Error>
pub async fn set_capsule_array( &self, contract_address: &AztecAddress, base_slot: &Fr, content: &[Vec<Fr>], ) -> Result<(), Error>
Replace the entire capsule array stored at base_slot.
Auto Trait Implementations§
impl Freeze for CapsuleStore
impl !RefUnwindSafe for CapsuleStore
impl Send for CapsuleStore
impl Sync for CapsuleStore
impl Unpin for CapsuleStore
impl !UnwindSafe for CapsuleStore
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more