Skip to content

Commit

Permalink
Simulation: added "writeLog" parsing when SC results doesn't contain …
Browse files Browse the repository at this point in the history
…the result
  • Loading branch information
gfusee committed Oct 12, 2024
1 parent 5abe4a5 commit 57fe09b
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 3 deletions.
6 changes: 5 additions & 1 deletion executor/src/network/models/simulate/response.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;
use serde::Deserialize;
use crate::network::models::generic::response::GatewayResponse;
use crate::TransactionOnNetworkTransactionLogs;

/// Type alias for `GatewayResponse` specialized for simulation responses.
/// It encapsulates the data specific to the simulation of blockchain transactions.
Expand All @@ -18,7 +19,10 @@ pub struct SimulationGatewayResponseData {

/// A collection of results from smart contracts invoked during the simulation.
/// Each entry in the map corresponds to a smart contract result, keyed by a unique identifier.
pub smart_contract_results: SimulationGatewayResponseDataScResults
pub smart_contract_results: SimulationGatewayResponseDataScResults,

/// A collection of logs from smart contracts invoked during the simulation.
pub logs: Option<TransactionOnNetworkTransactionLogs>
}

/// Type alias for a map holding smart contract results as part of the simulation response.
Expand Down
2 changes: 1 addition & 1 deletion executor/src/network/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<Client: GatewayClient> TransactionExecutor for BaseSimulationNetworkExecuto
})
.collect();

let mut raw_result = find_smart_contract_result(&Some(scrs), None)?
let mut raw_result = find_smart_contract_result(&Some(scrs), data.logs.as_ref())?
.unwrap_or_default();

let Ok(output_managed) = OutputManaged::multi_decode(&mut raw_result) else {
Expand Down
Loading

0 comments on commit 57fe09b

Please sign in to comment.