Skip to content

Commit

Permalink
fix!: remove json_results conversion from transaction results (#1292)
Browse files Browse the repository at this point in the history
Description
---
fix!: remove json_results conversion from transaction results

Motivation and Context
---
When a component returns a map that does not have string keys (e.g.
`indexMap<(u32, u32), MyVal>`) the indexer errors because it cannot
convert it to the "special" json format. I have not been able to find
any usage of this format so I have removed it in the PR.

How Has This Been Tested?
---
Manually, CI

What process can a PR reviewer use to test or verify this change?
---
N/A

Breaking Changes
---

- [ ] None
- [ ] Requires data directory to be deleted
- [x] Other - Please specify

BREAKING CHANGE: Indexer and wallet results no longer have the
`json_result` field
  • Loading branch information
sdbondi authored Feb 14, 2025
1 parent 19ca081 commit 7e8fe11
Show file tree
Hide file tree
Showing 24 changed files with 21 additions and 277 deletions.
3 changes: 0 additions & 3 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions applications/tari_dan_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ tari_transaction = { workspace = true }
tari_bor = { workspace = true, default-features = true }
tari_indexer_lib = { workspace = true }
tari_networking = { workspace = true }
tari_validator_node_rpc = { workspace = true }

anyhow = { workspace = true }
async-trait = { workspace = true }
Expand All @@ -39,7 +38,6 @@ multiaddr = { workspace = true }
rand = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true, features = ["default", "derive"] }
serde_json = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = [
"default",
Expand Down
192 changes: 0 additions & 192 deletions applications/tari_dan_app_utilities/src/json_encoding.rs

This file was deleted.

1 change: 0 additions & 1 deletion applications/tari_dan_app_utilities/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
pub mod base_layer_scanner;
pub mod common;
pub mod configuration;
pub mod json_encoding;
pub mod keypair;
pub mod p2p_config;
pub mod seed_peer;
Expand Down
18 changes: 0 additions & 18 deletions applications/tari_dan_wallet_daemon/src/handlers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use anyhow::anyhow;
use axum_jrpc::error::{JsonRpcError, JsonRpcErrorReason};
use futures::{future, future::Either};
use log::*;
use tari_dan_app_utilities::json_encoding;
use tari_dan_common_types::{optional::Optional, Epoch};
use tari_dan_wallet_sdk::apis::{jwt::JrpcPermission, key_manager};
use tari_template_lib::{args, models::Amount};
Expand Down Expand Up @@ -226,12 +225,9 @@ pub async fn handle_submit_dry_run(
.submit_dry_run_transaction(transaction, autofill_inputs)
.await?;

let json_result = json_encoding::encode_finalize_result_into_json(&exec_result.finalize)?;

Ok(TransactionSubmitDryRunResponse {
transaction_id: exec_result.finalize.transaction_hash.into_array().into(),
result: exec_result,
json_result,
})
}

Expand Down Expand Up @@ -296,17 +292,10 @@ pub async fn handle_get_result(
.optional()?
.ok_or(HandlerError::NotFound)?;

let json_result = transaction
.finalize
.as_ref()
.map(json_encoding::encode_finalize_result_into_json)
.transpose()?;

Ok(TransactionGetResultResponse {
transaction_id: req.transaction_id,
result: transaction.finalize,
status: transaction.status,
json_result,
})
}

Expand All @@ -328,15 +317,12 @@ pub async fn handle_wait_result(
.ok_or(HandlerError::NotFound)?;

if let Some(result) = transaction.finalize {
let json_result = json_encoding::encode_finalize_result_into_json(&result)?;

return Ok(TransactionWaitResultResponse {
transaction_id: req.transaction_id,
result: Some(result),
status: transaction.status,
final_fee: transaction.final_fee.unwrap_or_default(),
timed_out: false,
json_result: Some(json_result),
});
}

Expand All @@ -359,14 +345,12 @@ pub async fn handle_wait_result(

match evt_or_timeout {
Some(WalletEvent::TransactionFinalized(event)) if event.transaction_id == req.transaction_id => {
let json_result = json_encoding::encode_finalize_result_into_json(&event.finalize)?;
return Ok(TransactionWaitResultResponse {
transaction_id: req.transaction_id,
result: Some(event.finalize),
status: event.status,
final_fee: event.final_fee,
timed_out: false,
json_result: Some(json_result),
});
},
Some(WalletEvent::TransactionInvalid(event)) if event.transaction_id == req.transaction_id => {
Expand All @@ -376,7 +360,6 @@ pub async fn handle_wait_result(
status: event.status,
final_fee: event.final_fee.unwrap_or_default(),
timed_out: false,
json_result: None,
});
},
Some(_) => continue,
Expand All @@ -387,7 +370,6 @@ pub async fn handle_wait_result(
status: transaction.status,
final_fee: Amount::zero(),
timed_out: true,
json_result: None,
});
},
};
Expand Down
2 changes: 0 additions & 2 deletions applications/tari_dan_wallet_daemon/src/indexer_jrpc_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,12 @@ fn convert_indexer_result_to_wallet_result(result: IndexerTransactionFinalizedRe
finalized_time,
execution_time,
abort_details,
json_results,
} => TransactionFinalizedResult::Finalized {
final_decision,
execution_result,
execution_time,
finalized_time,
abort_details,
json_results,
},
}
}
4 changes: 2 additions & 2 deletions applications/tari_dan_wallet_web_ui/package-lock.json

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

Loading

0 comments on commit 7e8fe11

Please sign in to comment.