Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit a3e7499

Browse files
fguthmannfannyguthmann
andauthored
Add documentation to document-execute/os_usage module (#897)
* Added comments to document-execute/os_usage.rs * Added comments to document-execute/os_usage.rs --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il>
1 parent f58cc4f commit a3e7499

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/execution/os_usage.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ pub(crate) const ESTIMATED_DEPLOY_STEPS: usize = 0;
1010
pub(crate) const ESTIMATED_DEPLOY_ACCOUNT_STEPS: usize = 3612;
1111
pub(crate) const ESTIMATED_L1_HANDLER_STEPS: usize = 1068;
1212

13+
/// Represents the operating system resources associated with syscalls and transactions.
1314
#[derive(Debug, Clone)]
1415
pub struct OsResources {
1516
execute_syscalls: HashMap<String, ExecutionResources>,
1617
execute_txs_inner: HashMap<TransactionType, ExecutionResources>,
1718
}
1819

1920
impl Default for OsResources {
21+
/// Provide default values for `OsResources`.
2022
fn default() -> Self {
2123
let execute_txs_inner: HashMap<TransactionType, ExecutionResources> = HashMap::from([
2224
(
@@ -261,6 +263,8 @@ impl Default for OsResources {
261263
}
262264
}
263265

266+
/// Calculate the additional operating system resources required to execute a transaction
267+
/// given a set of syscalls invoked and a transaction type.
264268
pub fn get_additional_os_resources(
265269
syscall_counter: HashMap<String, u64>,
266270
tx_type: &TransactionType,
@@ -289,6 +293,7 @@ pub fn get_additional_os_resources(
289293
Ok(additional_os_resources)
290294
}
291295

296+
/// Test for the `get_additional_os_resources` function.
292297
#[test]
293298
fn get_additional_os_resources_test() {
294299
let syscall_counter = HashMap::from([("storage_read".into(), 2), ("storage_write".into(), 3)]);

0 commit comments

Comments
 (0)