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
3 changes: 2 additions & 1 deletion crates/core/src/decode/contract_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ async fn resolve_with_network(
error_code,
error_name: error_entry.map(|e| e.name.clone()),
doc_comment: error_entry.and_then(|e| e.doc.clone()),
})
learn_more: "https://developers.stellar.org/docs/learn/smart-contracts/errors#contract-specific-errors".to_string(),
})
}

async fn fetch_contract_wasm(contract_id: &str, network: &NetworkConfig) -> PrismResult<Vec<u8>> {
Expand Down
5 changes: 3 additions & 2 deletions crates/core/src/decode/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

pub mod auth;
pub mod auth_signature;
pub mod context;
pub mod decode_context;
pub mod contract_error;
pub mod cross_contract;
pub mod diagnostic;
Expand Down Expand Up @@ -173,6 +173,7 @@ pub async fn decode_transaction_with_op_filter(
None => (0..num_ops).collect(),
};

let ctx = decode_context::DecodeContextBuilder::new(network.clone()).build();
for i in indices {
let mut tx_data = base_tx_data.clone();
filter_transaction_by_operation(&mut tx_data, i)?;
Expand All @@ -193,7 +194,7 @@ pub async fn decode_transaction_with_op_filter(
}

diagnostic::enrich_report(&mut report, &tx_data)?;
context::enrich_report(&mut report, &tx_data)?;
decode_context::enrich_report(&mut report, &tx_data)?;
cross_contract::attribute_failure(&mut report, &tx_data)?;
reports.push(report);
}
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/decode/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub fn build_report(error: &ClassifiedError) -> PrismResult<DiagnosticReport> {
related_errors: entry.related_errors.clone(),
cross_contract_attribution: None,
auth_signatures: Vec::new(),
learn_more: "https://developers.stellar.org/docs/learn/smart-contracts/errors".to_string(),
};

Ok(report)
Expand Down
7 changes: 6 additions & 1 deletion crates/core/src/types/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub struct ContractErrorInfo {
pub error_name: Option<String>,

pub doc_comment: Option<String>,

pub learn_more: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -131,6 +133,8 @@ pub struct DiagnosticReport {
/// Malformed or empty byte sequences produce a human-readable error label.
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub auth_signatures: Vec<String>,

pub learn_more: String,
}

impl DiagnosticReport {
Expand All @@ -150,6 +154,7 @@ impl DiagnosticReport {
related_errors: Vec::new(),
cross_contract_attribution: None,
auth_signatures: Vec::new(),
}
learn_more: "https://developers.stellar.org/docs/learn/smart-contracts/errors".to_string(),
}
}
}