Module papyrus_storage::body
source · Expand description
Interface for handling data related to Starknet block bodies.
The block body is the part of the block that contains the transactions and the transaction
outputs.
Import BodyStorageReader
and BodyStorageWriter
to read and write data related
to the block bodies using a StorageTxn
.
See events
module for the interface for handling events.
§Example
use papyrus_storage::open_storage;
use starknet_api::block::{Block, BlockNumber};
use papyrus_storage::body::{BodyStorageReader, BodyStorageWriter};
let block = Block::default();
let (reader, mut writer) = open_storage(storage_config)?;
writer
.begin_rw_txn()? // Start a RW transaction.
.append_body(BlockNumber(0), block.body)? // Append the block body (consumes the body at the current version).
.commit()?;
let stored_body_transactions = reader.begin_ro_txn()?.get_block_transactions(BlockNumber(0))?;
assert_eq!(stored_body_transactions, Some(Block::default().body.transactions));
Modules§
- Interface for iterating over events from the storage.
Structs§
- The index of a transaction in a block.
Traits§
- Interface for reading data related to the block body.
- Interface for updating data related to the block body.