Skip to content

Commit

Permalink
chore: docs (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhani-cw authored Mar 15, 2024
1 parent 8514762 commit 384f8e5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/bin/importer_offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async fn execute_block_importer(
let start = Instant::now();

match csv {
// when exporting to csv, only persist temporary changes because permanent will be bulk loaded at the end
// when exporting to csv, only persist temporary changes because permanent will be bulk loaded at the end of the process
Some(ref mut csv) => {
let block = executor.import_external_to_temp(block, &mut receipts).await?;
let number = *block.number();
Expand All @@ -107,7 +107,7 @@ async fn execute_block_importer(
stratus_storage.flush_account_changes_to_temp().await?;
}
}
// when not exporting to csv, persist the entire block to permanent immediatly
// when not exporting to csv, persist the entire block to permanent immediately
None => {
executor.import_external_to_perm(block, &mut receipts).await?;
}
Expand Down
4 changes: 2 additions & 2 deletions src/eth/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl EthExecutor {
// Transaction execution
// -------------------------------------------------------------------------

/// Re-executes an external block locally and imports it to the storage.
/// Re-executes an external block locally and imports it to the permanent storage.
pub async fn import_external_to_perm(&self, block: ExternalBlock, receipts: &mut ExternalReceipts) -> anyhow::Result<Block> {
// import block
let block = self.import_external_to_temp(block, receipts).await?;
Expand All @@ -85,7 +85,7 @@ impl EthExecutor {
Ok(block)
}

/// Re-executes an external block locally.
/// Re-executes an external block locally and imports it to the temporary storage.
pub async fn import_external_to_temp(&self, block: ExternalBlock, receipts: &mut ExternalReceipts) -> anyhow::Result<Block> {
let start = Instant::now();
let mut block_metrics = ExecutionMetrics::default();
Expand Down
2 changes: 1 addition & 1 deletion src/eth/storage/permanent_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub trait PermanentStorage: Send + Sync {

/// Atomically increments the block number, returning the new value.
///
/// TODO: this will probably be removed because set_ and read_ may be enough.
/// TODO: this can probably be removed because set_mined_block_number and set_active_block_number may be enough.
async fn increment_block_number(&self) -> anyhow::Result<BlockNumber>;

/// Retrieves an account from the storage. Returns Option when not found.
Expand Down
2 changes: 0 additions & 2 deletions src/eth/storage/sled/sled_temporary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use crate::eth::storage::TemporaryStorage;
use crate::log_and_err;

pub struct SledTemporary {
// keep transactional data in here until flush is called
// sled supports transactions, but I still have to learn how to use it because it accepts a closure instead of returning an object
temp: InMemoryTemporaryStorage,
db: sled::Db,
}
Expand Down
4 changes: 2 additions & 2 deletions src/eth/storage/temporary_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use crate::eth::primitives::SlotIndex;
/// Temporary storage (in-between blocks) operations
#[async_trait]
pub trait TemporaryStorage: Send + Sync {
/// Sets the block number being mined.
/// Sets the block number activelly being mined.
async fn set_active_block_number(&self, number: BlockNumber) -> anyhow::Result<()>;

// Retrieves the block number being mined.
// Retrieves the block number activelly being mined.
async fn read_active_block_number(&self) -> anyhow::Result<Option<BlockNumber>>;

/// Retrieves an account from the storage. Returns Option when not found.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_import_offline_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async fn test_import_offline_snapshot() {
// init executor and execute
let storage = Arc::new(StratusStorage::new(Arc::new(InMemoryTemporaryStorage::default()), Arc::new(pg)));
let executor = config.init_executor(storage);
executor.import_external_to_temp(block, &mut receipts).await.unwrap();
executor.import_external_to_perm(block, &mut receipts).await.unwrap();

// get metrics from prometheus
// sleep to ensure prometheus collected
Expand Down

0 comments on commit 384f8e5

Please sign in to comment.