From 0afc273fbfc748c83d98726c118250dc26f5bcde Mon Sep 17 00:00:00 2001 From: Martin Stefcek <35243812+Cifko@users.noreply.github.com> Date: Tue, 7 May 2024 12:17:06 +0200 Subject: [PATCH] chore: change firebase url to base58 (#73) --- atoma-client/src/client.rs | 6 ++++-- atoma-event-subscribe/sui/src/main.rs | 6 ++++-- atoma-output-manager/src/lib.rs | 4 +--- atoma-types/src/lib.rs | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/atoma-client/src/client.rs b/atoma-client/src/client.rs index 1b78a0eb..a13dea70 100644 --- a/atoma-client/src/client.rs +++ b/atoma-client/src/client.rs @@ -135,12 +135,14 @@ impl AtomaSuiClient { debug!("Submitted transaction with response: {:?}", tx_response); - let tx_digest = tx_response.digest.into_inner(); + let tx_digest = tx_response.digest.base58_encode(); if let Some(events) = tx_response.events { for event in events.data.iter() { debug!("Got a transaction event: {:?}", event.type_.name.as_str()); if event.type_.name.as_str() == "FirstSubmissionEvent" { - self.output_manager_tx.send((tx_digest, response)).await?; + self.output_manager_tx + .send((tx_digest.clone(), response)) + .await?; break; // we don't need to check other events, as at this point the node knows it has been selected for } } diff --git a/atoma-event-subscribe/sui/src/main.rs b/atoma-event-subscribe/sui/src/main.rs index cf52591e..ee9bb6a5 100644 --- a/atoma-event-subscribe/sui/src/main.rs +++ b/atoma-event-subscribe/sui/src/main.rs @@ -3,7 +3,7 @@ use std::time::Duration; use atoma_sui::subscriber::{SuiSubscriber, SuiSubscriberError}; use clap::Parser; use sui_sdk::types::base_types::ObjectID; -use tracing::info; +use tracing::{error, info}; #[derive(Debug, Parser)] struct Args { @@ -41,7 +41,9 @@ async fn main() -> Result<(), SuiSubscriberError> { tokio::spawn(async move { info!("initializing subscribe"); - event_subscriber.subscribe().await.unwrap(); + if let Err(err) = event_subscriber.subscribe().await { + error!("Failed to subscribe: {:?}", err); + } Ok::<_, SuiSubscriberError>(()) }); diff --git a/atoma-output-manager/src/lib.rs b/atoma-output-manager/src/lib.rs index ad2f66df..9dfb8105 100644 --- a/atoma-output-manager/src/lib.rs +++ b/atoma-output-manager/src/lib.rs @@ -44,9 +44,7 @@ impl AtomaOutputManager { ) -> Result<(), AtomaOutputManagerError> { let client = Client::new(); let mut url = self.firebase_uri.clone(); - let mut suffix = hex::encode(tx_digest); - suffix.push_str(".json"); - url.push(suffix); + url.push(format!("{tx_digest}.json")); info!("Firebase's output url: {:?}", url); debug!( "Submitting to Firebase's real time storage, the data: {}", diff --git a/atoma-types/src/lib.rs b/atoma-types/src/lib.rs index 894b2ad4..24ec8b00 100644 --- a/atoma-types/src/lib.rs +++ b/atoma-types/src/lib.rs @@ -2,7 +2,7 @@ use anyhow::{anyhow, Error, Result}; use serde::{Deserialize, Serialize}; use serde_json::Value; -pub type Digest = [u8; 32]; +pub type Digest = String; pub type SmallId = u64; /// Represents a request object containing information about a request