transaction-status: Add return data to meta (#23688)
* transaction-status: Add return data to meta * Add return data to simulation results * Use pretty-hex for printing return data * Update arg name, make TransactionRecord struct * Rename TransactionRecord -> ExecutionRecord
This commit is contained in:
@ -143,7 +143,7 @@ fn is_finalized(
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct JsonRpcConfig {
|
||||
pub enable_rpc_transaction_history: bool,
|
||||
pub enable_cpi_and_log_storage: bool,
|
||||
pub enable_extended_tx_metadata_storage: bool,
|
||||
pub faucet_addr: Option<SocketAddr>,
|
||||
pub health_check_slot_distance: u64,
|
||||
pub rpc_bigtable_config: Option<RpcBigtableConfig>,
|
||||
@ -3551,6 +3551,7 @@ pub mod rpc_full {
|
||||
logs,
|
||||
post_simulation_accounts: _,
|
||||
units_consumed,
|
||||
return_data,
|
||||
} = preflight_bank.simulate_transaction(transaction)
|
||||
{
|
||||
match err {
|
||||
@ -3568,6 +3569,7 @@ pub mod rpc_full {
|
||||
logs: Some(logs),
|
||||
accounts: None,
|
||||
units_consumed: Some(units_consumed),
|
||||
return_data,
|
||||
},
|
||||
}
|
||||
.into());
|
||||
@ -3625,6 +3627,7 @@ pub mod rpc_full {
|
||||
logs,
|
||||
post_simulation_accounts,
|
||||
units_consumed,
|
||||
return_data,
|
||||
} = bank.simulate_transaction(transaction);
|
||||
|
||||
let accounts = if let Some(config_accounts) = config.accounts {
|
||||
@ -3676,6 +3679,7 @@ pub mod rpc_full {
|
||||
logs: Some(logs),
|
||||
accounts,
|
||||
units_consumed: Some(units_consumed),
|
||||
return_data,
|
||||
},
|
||||
))
|
||||
}
|
||||
@ -5574,6 +5578,7 @@ pub mod tests {
|
||||
"Program 11111111111111111111111111111111 invoke [1]",
|
||||
"Program 11111111111111111111111111111111 success"
|
||||
],
|
||||
"returnData":null,
|
||||
"unitsConsumed":0
|
||||
}
|
||||
},
|
||||
@ -5660,6 +5665,7 @@ pub mod tests {
|
||||
"Program 11111111111111111111111111111111 invoke [1]",
|
||||
"Program 11111111111111111111111111111111 success"
|
||||
],
|
||||
"returnData":null,
|
||||
"unitsConsumed":0
|
||||
}
|
||||
},
|
||||
@ -5688,6 +5694,7 @@ pub mod tests {
|
||||
"Program 11111111111111111111111111111111 invoke [1]",
|
||||
"Program 11111111111111111111111111111111 success"
|
||||
],
|
||||
"returnData":null,
|
||||
"unitsConsumed":0
|
||||
}
|
||||
},
|
||||
@ -5737,6 +5744,7 @@ pub mod tests {
|
||||
"err":"BlockhashNotFound",
|
||||
"accounts":null,
|
||||
"logs":[],
|
||||
"returnData":null,
|
||||
"unitsConsumed":0
|
||||
}
|
||||
},
|
||||
@ -5766,6 +5774,7 @@ pub mod tests {
|
||||
"Program 11111111111111111111111111111111 invoke [1]",
|
||||
"Program 11111111111111111111111111111111 success"
|
||||
],
|
||||
"returnData":null,
|
||||
"unitsConsumed":0
|
||||
}
|
||||
},
|
||||
@ -6123,7 +6132,7 @@ pub mod tests {
|
||||
assert_eq!(
|
||||
res,
|
||||
Some(
|
||||
r#"{"jsonrpc":"2.0","error":{"code":-32002,"message":"Transaction simulation failed: Blockhash not found","data":{"accounts":null,"err":"BlockhashNotFound","logs":[],"unitsConsumed":0}},"id":1}"#.to_string(),
|
||||
r#"{"jsonrpc":"2.0","error":{"code":-32002,"message":"Transaction simulation failed: Blockhash not found","data":{"accounts":null,"err":"BlockhashNotFound","logs":[],"returnData":null,"unitsConsumed":0}},"id":1}"#.to_string(),
|
||||
)
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user