Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ blake3 = "1.8.2"
bytes = "1.10.0"
chrono = "0.4.41"
ciborium = "0.2.2"
clap = "4.5.41"
clap = "4.5.43"
config = "0.14.0"
dashmap = "6.1.0"
dotenvy = "0.15.7"
Expand Down
80 changes: 40 additions & 40 deletions atoma-sui/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ impl Client {
///
/// # Arguments
///
/// * `gas` - Optional ObjectID to use as gas for the transaction. If None, the system will
/// * `gas` - Optional `ObjectID` to use as gas for the transaction. If None, the system will
/// automatically select a gas object.
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// constant (5,000,000 MIST = 0.005 SUI).
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's
/// reference gas price.
Expand Down Expand Up @@ -233,9 +233,9 @@ impl Client {
///
/// * `model_name` - The name of the model to subscribe to
/// * `echelon` - The echelon level for the subscription (0-255)
/// * `node_badge_id` - Optional ObjectID of the node badge. If None, uses the client's stored badge
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
///
/// # Returns
Expand Down Expand Up @@ -347,11 +347,11 @@ impl Client {
/// # Arguments
///
/// * `task_small_id` - The small ID of the task to subscribe to
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `price_per_one_million_compute_units` - The price per compute unit the node is willing to charge
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -461,11 +461,11 @@ impl Client {
/// # Arguments
///
/// * `task_small_id` - The small ID of the task to update the subscription for
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `price_per_one_million_compute_units` - The new price per compute unit for the task subscription
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -582,10 +582,10 @@ impl Client {
/// # Arguments
///
/// * `task_small_id` - The small ID of the task to unsubscribe from
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -689,13 +689,13 @@ impl Client {
/// # Arguments
///
/// * `stack_small_id` - The small ID of the stack to settle
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `num_claimed_compute_units` - The number of compute units being claimed for this stack
/// * `committed_stack_proof` - The proof data for the committed stack
/// * `stack_merkle_leaf` - The merkle leaf data for the stack
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -815,12 +815,12 @@ impl Client {
/// # Arguments
///
/// * `stack_small_id` - The small ID of the stack being attested
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `committed_stack_proof` - The proof data for the committed stack
/// * `stack_merkle_leaf` - The merkle leaf data for the stack
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -936,11 +936,11 @@ impl Client {
/// # Arguments
///
/// * `stack_small_id` - The small ID of the stack being disputed
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `committed_stack_proof` - The proof data for the committed stack that supports the dispute
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -1050,10 +1050,10 @@ impl Client {
/// # Arguments
///
/// * `settled_ticket_ids` - A vector of ticket IDs that have been settled and are ready for claiming
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -1159,11 +1159,11 @@ impl Client {
/// # Arguments
///
/// * `stack_small_ids` - A vector of stack small IDs that have been settled and are ready for claiming
/// * `node_badge_id` - Optional Node badge ID of the node. If None, uses the client's stored badge ID
/// * `node_badge_id` - Optional `ObjectID` of the node badge. If None, uses the client's stored badge ID
/// * `num_claimed_compute_units` - A vector of the number of compute units claimed for each stack
/// * `gas` - Optional ObjectID to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas` - Optional `ObjectID` to use as gas for the transaction
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down Expand Up @@ -1304,10 +1304,10 @@ impl Client {
/// * `key_rotation_counter` - The key rotation counter value
/// * `device_type` - The device type identifier (as a u16)
/// * `task_small_id` - Optional small ID of the task
/// * `gas` - Optional ObjectID to use as gas for the transaction. If None, the system will
/// * `gas` - Optional `ObjectID` to use as gas for the transaction. If None, the system will
/// automatically select a gas object
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to GAS_BUDGET
/// * `gas_price` - Optional gas price for the transaction. If None, uses network's reference price
/// * `gas_budget` - Optional gas budget for the transaction. If None, defaults to `GAS_BUDGET`
/// * `gas_price` - Optional gas price for the transaction. If None, uses the network's reference price
///
/// # Returns
///
Expand Down
32 changes: 16 additions & 16 deletions atoma-sui/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,26 @@ impl Subscriber {
)
}

/// Builds a SuiClient based on the provided configuration.
/// Builds a `SuiClient` based on the provided configuration.
///
/// This asynchronous method creates a new SuiClient instance using the settings
/// specified in the AtomaSuiConfig. It sets up the client with the
/// This asynchronous method creates a new `SuiClient` instance using the settings
/// specified in the `AtomaSuiConfig`. It sets up the client with the
/// configured request timeout and HTTP RPC node address.
///
/// # Arguments
///
/// * `config` - A reference to a AtomaSuiConfig containing the necessary
/// * `config` - A reference to a `AtomaSuiConfig` containing the necessary
/// configuration parameters.
///
/// # Returns
///
/// * `Result<SuiClient>` - A Result containing the newly created SuiClient if successful,
/// or a SuiEventSubscriberError if the client creation fails.
/// * `Result<SuiClient>` - A `Result` containing the newly created `SuiClient` if successful,
/// or a `SuiEventSubscriberError` if the client creation fails.
///
/// # Errors
///
/// This function will return an error if:
/// * The SuiClient cannot be built with the provided configuration.
/// * The `SuiClient` cannot be built with the provided configuration.
/// * There's a network issue when connecting to the specified RPC node.
#[instrument(level = "info", skip_all, fields(
http_rpc_node_addr = %config.http_rpc_node_addr()
Expand All @@ -182,13 +182,13 @@ impl Subscriber {
///
/// 1. Stack Retrieval:
/// - Receives transaction digests and responds with compute units information
/// - Processes StackCreatedEvents from transactions and forwards them to the state manager
/// - Processes `StackCreatedEvents` from transactions and forwards them to the state manager
///
/// 2. Event Processing:
/// - Queries for new events using the configured filter and cursor
/// - Parses and filters events based on node and task IDs
/// - Forwards relevant events to the state manager
/// - Updates the cursor periodically (every CURSOR_FILE_UPDATE_ITERATIONS)
/// - Updates the cursor periodically (every `CURSOR_FILE_UPDATE_ITERATIONS`)
/// - Implements backoff when no new events are available
///
/// 3. Shutdown Handling:
Expand All @@ -202,7 +202,7 @@ impl Subscriber {
/// # Errors
///
/// This method may return an error if:
/// * There's a failure in building the Sui client
/// * There's a failure in building the `SuiClient`
/// * Event querying encounters an error
/// * Stack retrieval operations fail
/// * Event processing fails
Expand All @@ -212,7 +212,7 @@ impl Subscriber {
/// # Errors
///
/// This method may return an error if:
/// * The Sui client cannot be built
/// * The `SuiClient` cannot be built
/// * Event querying encounters an error
/// * Stack retrieval operations fail
/// * Event processing fails
Expand All @@ -222,7 +222,7 @@ impl Subscriber {
/// # Panics
///
/// This method may panic if:
/// * The Sui client cannot be built
/// * The `SuiClient` cannot be built
/// * Event querying encounters an error
/// * Stack retrieval operations fail
#[instrument(level = "trace", skip_all, fields(package_id))]
Expand Down Expand Up @@ -433,7 +433,7 @@ impl Subscriber {
/// # Examples
///
/// ```rust,ignore
/// # use your_crate::{AtomaEventIdentifier, AtomaEvent, SuiEventSubscriber};
/// # use atoma_sui::{AtomaEventIdentifier, AtomaEvent, SuiEventSubscriber};
/// # async fn example(subscriber: &SuiEventSubscriber) -> Result<(), Box<dyn std::error::Error>> {
/// let event_id = AtomaEventIdentifier::TaskRegisteredEvent;
/// let event = AtomaEvent::TaskRegisteredEvent(/* ... */);
Expand Down Expand Up @@ -559,7 +559,7 @@ fn write_cursor_to_toml_file(cursor: Option<EventID>, path: &str) -> Result<()>
///
/// * `event` - A reference to the `AtomaEvent` enum indicating the type of event to handle
/// * `value` - The serialized event data as a `serde_json::Value`
/// * `db` - A reference to the SQLite connection pool for database operations
/// * `db` - A reference to the `SQLite` connection pool for database operations
/// * `node_small_ids` - A slice of node IDs that are relevant for the current context
///
/// # Returns
Expand Down Expand Up @@ -686,15 +686,15 @@ async fn parse_event(
}
}

/// Filters an Atoma event based on a list of node small IDs.
/// Filters an `AtomaEvent` based on a list of node small IDs.
///
/// This function checks if the given event is related to any of the nodes specified by their small IDs.
/// For node-specific events (like registration, subscriptions, etc.), it returns true only if the
/// event's node small ID is in the provided list. For all other event types, it returns true.
///
/// # Arguments
///
/// * `event` - Reference to the Atoma event to filter
/// * `event` - Reference to the `AtomaEvent` to filter
/// * `node_small_ids` - Slice containing the node small IDs to filter by
///
/// # Returns
Expand Down
Loading