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
493 changes: 100 additions & 393 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ borsh = { version = "1.5", default-features = false }
bytes = "1.10.0"
bnum = "0.13.0"
bounded-vec = "0.9.0"
cacache = "12.0.0"
cargo_toml = "0.20.5"
ciborium = { version = "0.2.2", default-features = false }
ciborium-io = { version = "0.2.2", default-features = false }
Expand All @@ -191,7 +190,6 @@ json5 = "0.4.1"
jsonwebtoken = "9.3.1"
hashbrown = { version = "0.13.2" }
hex = "0.4"
httpmock = "0.6.8"
humantime = "2.1.0"
humantime-serde = "1.1.1"
include_dir = "0.7.2"
Expand All @@ -215,9 +213,9 @@ once_cell = "1.18.0"
pin-project = "1.1"
proc-macro2 = "1.0"
prometheus-client = { version = "0.23", default-features = false }
prost = "0.12"
prost-build = "0.12"
prost-types = "0.9"
prost = "0.13"
prost-build = "0.13"
prost-types = "0.13"
quick-protobuf = "0.8"
quick-protobuf-codec = "0.3.1"
quote = "1.0.7"
Expand Down
3 changes: 0 additions & 3 deletions applications/tari_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ tari_template_lib = { workspace = true }
tari_template_manager = { workspace = true }
tari_transaction = { workspace = true }
tari_bor = { workspace = true, default-features = true }
tari_indexer_lib = { workspace = true }
tari_networking = { workspace = true }

anyhow = { workspace = true }
async-trait = { workspace = true }
cacache = { workspace = true }
json5 = { workspace = true }
libp2p-identity = { workspace = true }
log = { workspace = true, features = ["std"] }
Expand Down
1 change: 0 additions & 1 deletion applications/tari_app_utilities/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub mod epoch_oracle_config;
pub mod keypair;
pub mod p2p_config;
pub mod seed_peer;
pub mod substate_file_cache;
pub mod template_download_queue;
pub mod transaction_executor;
pub mod utxo_store;
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl ExecutionOutput {
&self,
inputs: I,
) -> Vec<VersionedSubstateIdLockIntent> {
if let Some(diff) = self.result.finalize.accept() {
if let Some(diff) = self.result.finalize.any_accept() {
inputs
.into_iter()
.map(|(substate_req, substate)| {
Expand Down
26 changes: 14 additions & 12 deletions applications/tari_indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ license.workspace = true

[dependencies]
minotari_app_utilities = { workspace = true }
tari_base_node_client = { workspace = true }
tari_bor = { workspace = true }
tari_common = { workspace = true }
tari_common_types = { workspace = true }
tari_consensus = { workspace = true }
tari_consensus_types = { workspace = true }
tari_crypto = { workspace = true }
tari_shutdown = { workspace = true }
tari_ootle_app_utilities = { workspace = true }
tari_epoch_oracles = { workspace = true, features = ["base_layer"] }
tari_ootle_common_types = { workspace = true }
tari_base_node_client = { workspace = true }
tari_engine = { workspace = true }
tari_ootle_storage = { workspace = true }
tari_ootle_storage_sqlite = { workspace = true }
tari_epoch_manager = { workspace = true }
tari_engine_types = { workspace = true }
tari_epoch_manager = { workspace = true }
tari_epoch_oracles = { workspace = true, features = ["base_layer"] }
tari_indexer_client = { workspace = true, default-features = false }
tari_indexer_lib = { workspace = true }
tari_networking = { workspace = true }
tari_ootle_app_utilities = { workspace = true }
tari_ootle_common_types = { workspace = true }
tari_ootle_p2p = { workspace = true }
tari_ootle_storage = { workspace = true }
tari_ootle_storage_sqlite = { workspace = true }
tari_rpc_framework = { workspace = true }
tari_shutdown = { workspace = true }
tari_template_lib = { workspace = true }
tari_template_manager = { workspace = true }
tari_transaction = { workspace = true }
tari_ootle_p2p = { workspace = true }
tari_consensus = { workspace = true }
tari_validator_node_rpc = { workspace = true }
tari_rpc_framework = { workspace = true }
tari_networking = { workspace = true }

anyhow = { workspace = true }
axum = { workspace = true }
Expand Down Expand Up @@ -72,6 +73,7 @@ tokio = { workspace = true, features = [
] }
tower-http = { workspace = true, features = ["default", "cors"] }
url = { workspace = true, features = ["serde"] }
cacache = { version = "13.1.0", default-features = false, features = ["mmap", "tokio-runtime"] }

[package.metadata.cargo-machete]
ignored = [
Expand Down
11 changes: 11 additions & 0 deletions applications/tari_indexer/src/json_rpc/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,17 @@ impl JsonRpcHandlers {
),
)
},
TransactionManagerError::InvalidTransaction {
transaction_id,
details,
} => JsonRpcResponse::error(
answer_id,
JsonRpcError::new(
JsonRpcErrorReason::ApplicationError(400),
format!("Transaction {} is invalid: {}", transaction_id, details),
json::Value::Null,
),
),
e => Self::internal_error(answer_id, e),
})?;

Expand Down
8 changes: 3 additions & 5 deletions applications/tari_indexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ mod json_rpc;
mod network_client;
mod network_state_sync;
mod storage_sqlite;
mod substate_file_cache;
mod substate_manager;
mod transaction_manager;

Expand All @@ -61,11 +62,7 @@ use tari_epoch_manager::{
use tari_epoch_oracles::EpochOracle;
use tari_indexer_lib::substate_scanner::SubstateScanner;
use tari_networking::NetworkingService;
use tari_ootle_app_utilities::{
keypair::setup_keypair_prompt,
substate_file_cache::SubstateFileCache,
template_download_queue::TemplateDownloadQueue,
};
use tari_ootle_app_utilities::{keypair::setup_keypair_prompt, template_download_queue::TemplateDownloadQueue};
use tari_ootle_common_types::{layer_one_transaction::LayerOneTransactionDef, Epoch, PeerAddress};
use tari_ootle_storage::global::{DbFactory, GlobalDb};
use tari_ootle_storage_sqlite::{global::SqliteGlobalDbAdapter, SqliteDbFactory};
Expand All @@ -79,6 +76,7 @@ use crate::{
event_manager::EventManager,
graphql::server::run_graphql,
json_rpc::{spawn_json_rpc, JsonRpcHandlers},
substate_file_cache::SubstateFileCache,
transaction_manager::TransactionManager,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
// Copyright 2023. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copyright 2025 The Tari Project
// SPDX-License-Identifier: BSD-3-Clause

use std::{fs, path::PathBuf};

use async_trait::async_trait;
use tari_bor::{decode, encode};
use tari_indexer_lib::substate_cache::{SubstateCache, SubstateCacheEntry, SubstateCacheError};

Expand All @@ -45,7 +25,6 @@ impl SubstateFileCache {
}
}

#[async_trait]
impl SubstateCache for SubstateFileCache {
async fn read(&self, address: String) -> Result<Option<SubstateCacheEntry>, SubstateCacheError> {
let res = cacache::read(&self.cache_dir_path, address).await;
Expand Down
6 changes: 4 additions & 2 deletions applications/tari_indexer/src/substate_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use tari_engine_types::substate::{SubstateId, SubstateValue};
use tari_epoch_manager::service::EpochManagerHandle;
use tari_indexer_client::types::ListSubstateItem;
use tari_indexer_lib::{substate_scanner::SubstateScanner, NonFungibleSubstate};
use tari_ootle_app_utilities::substate_file_cache::SubstateFileCache;
use tari_ootle_common_types::{
shard::Shard,
substate_type::SubstateType,
Expand All @@ -43,7 +42,10 @@ use tari_template_lib::{
};
use tari_validator_node_rpc::client::{SubstateResult, TariValidatorNodeRpcClientFactory};

use crate::storage_sqlite::store_factory::{IndexerStore, IndexerStoreReadTransaction, SqliteIndexerStore};
use crate::{
storage_sqlite::store_factory::{IndexerStore, IndexerStoreReadTransaction, SqliteIndexerStore},
substate_file_cache::SubstateFileCache,
};

#[derive(Debug, Serialize, Deserialize)]
pub struct SubstateResponse {
Expand Down
6 changes: 6 additions & 0 deletions applications/tari_indexer/src/transaction_manager/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
use tari_indexer_lib::error::IndexerError;
use tari_ootle_common_types::optional::IsNotFoundError;
use tari_ootle_storage::StorageError;
use tari_transaction::TransactionId;

use crate::network_client::NetworkClientError;

#[derive(Debug, thiserror::Error)]
pub enum TransactionManagerError {
#[error("Transaction {transaction_id} is invalid: {details}")]
InvalidTransaction {
transaction_id: TransactionId,
details: String,
},
#[error(transparent)]
NetworkClientError(#[from] NetworkClientError),
#[error("{entity} not found: {key}")]
Expand Down
8 changes: 8 additions & 0 deletions applications/tari_indexer/src/transaction_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ where
}

pub async fn submit_transaction(&self, transaction: Transaction) -> Result<TransactionId, TransactionManagerError> {
if !transaction.verify_all_signatures() {
// DEV note: If signatures are invalid here (but they should be valid), this probably indicates an issue
// with the JSON decoding (crates/engine_types/src/argument_parser.rs)
return Err(TransactionManagerError::InvalidTransaction {
transaction_id: transaction.calculate_id(),
details: "Transaction has one or more invalid signature(s)".to_string(),
});
}
self.store
.with_write_tx(|tx| tx.insert_or_ignore_transaction(&transaction))?;
let id = self.network_client.submit_transaction(transaction).await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ interface FeeInformationProps extends FeeReceipt {
}

function FeeInformation({
total_fee_payment,
total_fees_paid,
cost_breakdown,
expandAllTrigger = 0,
collapseAllTrigger = 0,
onExpandedChange,
}: FeeInformationProps) {
total_fee_payment,
total_fees_paid,
total_fee_overcharge,
cost_breakdown,
expandAllTrigger = 0,
collapseAllTrigger = 0,
onExpandedChange,
}: FeeInformationProps) {
const [expanded, setExpanded] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -91,7 +92,7 @@ function FeeInformation({
</TableRow>
<TableRow>
<TableCell>Total Fees Paid</TableCell>
<DataTableCell>{formatXTM(total_fees_paid)}</DataTableCell>
<DataTableCell>{formatXTM(total_fees_paid)}{total_fee_overcharge > 0 ? ` Overcharge: ${total_fee_overcharge}` : ""}</DataTableCell>
</TableRow>
<TableRow>
<TableCell>Cost Breakdown</TableCell>
Expand All @@ -105,7 +106,7 @@ function FeeInformation({
variant="filled"
color="default"
/>
)
),
)}
</Stack>
</DataTableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { validateHash } from "../../../utils/helpers";

// Type guard to check if result is finalized
const isFinalized = (
result: IndexerTransactionFinalizedResult
result: IndexerTransactionFinalizedResult,
): result is { Finalized: any } => {
return typeof result === "object" && result !== null && "Finalized" in result;
};
Expand All @@ -59,7 +59,7 @@ function Result({ transaction_id }: IndexerGetTransactionResultRequest) {
const normalizedTransactionId = transaction_id.toLowerCase();
const isValidHash = validateHash(normalizedTransactionId);
const { data, isLoading, error, isError } = useGetTransactionResult(
normalizedTransactionId
normalizedTransactionId,
);

if (!isValidHash) {
Expand Down Expand Up @@ -105,12 +105,12 @@ function Result({ transaction_id }: IndexerGetTransactionResultRequest) {
<DataTableCell>
{data.result.Finalized.execution_result?.execution_time
? `${
data.result.Finalized.execution_result
.execution_time.secs
}s ${Math.round(
data.result.Finalized.execution_result
.execution_time.nanos / 1000000
)}ms`
data.result.Finalized.execution_result
.execution_time.secs
}s ${Math.round(
data.result.Finalized.execution_result
.execution_time.nanos / 1000000,
)}ms`
: "N/A"}
</DataTableCell>
</TableRow>
Expand All @@ -121,10 +121,7 @@ function Result({ transaction_id }: IndexerGetTransactionResultRequest) {
<AccordionGroup>
{data.result.Finalized.execution_result?.finalize
?.fee_receipt && (
<FeeInformation
{...data.result.Finalized.execution_result.finalize
.fee_receipt}
/>
<FeeInformation {...data.result.Finalized.execution_result.finalize.fee_receipt} />
)}

<Events
Expand All @@ -142,7 +139,7 @@ function Result({ transaction_id }: IndexerGetTransactionResultRequest) {

{data.result.Finalized.execution_result?.finalize?.result &&
isAcceptResult(
data.result.Finalized.execution_result.finalize.result
data.result.Finalized.execution_result.finalize.result,
) && (
<SubstateChanges
result={
Expand Down
1 change: 1 addition & 0 deletions applications/tari_swarm_daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tari_wallet_daemon_client = { workspace = true }
tari_engine = { workspace = true }
tari_template_lib_types = { workspace = true }
tari_ootle_app_utilities = { workspace = true }
tari_ootle_wallet_sdk = { workspace = true }

anyhow = { workspace = true }
async-trait = { workspace = true }
Expand Down
8 changes: 6 additions & 2 deletions applications/tari_swarm_daemon/src/process_manager/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use tari_ootle_common_types::Network;
use tari_shutdown::ShutdownSignal;
use tari_template_lib_types::TemplateAddress;
use tari_validator_node_client::types::{AddPeerRequest, GetTemplatesRequest};
use tari_wallet_daemon_client::types::ExtClaimBurnProof;
use tokio::{sync::mpsc, time, time::sleep};
use url::Url;

Expand Down Expand Up @@ -603,7 +604,7 @@ impl ProcessManager {
"No wallet daemon instances {wallet_instance_id} found. Please start a wallet before burning funds"
)
})?;
let claim_public_key = wallet.get_account_public_key(account_name.clone(), None).await?;
let (claim_public_key, nonce_key_index) = wallet.create_nonce_key().await?;
let wallet = self
.instance_manager
.minotari_wallets()
Expand All @@ -615,7 +616,10 @@ impl ProcessManager {
let file_name = PathBuf::from(format!("burn_proof-{}.json", proof.tx_id));
let path = out_path.join(&file_name);
let mut file = File::create(path)?;
serde_json::to_writer_pretty(&mut file, &proof)?;
serde_json::to_writer_pretty(&mut file, &ExtClaimBurnProof {
claim_proof: proof.claim_proof,
owner_nonce_key_index: nonce_key_index,
})?;

info!("🔥 Burned {amount} Tari to account {account_name}");
Ok(file_name)
Expand Down
Loading
Loading