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(),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -34,7 +34,7 @@ impl TransactionStatusService {
|
||||
enable_rpc_transaction_history: bool,
|
||||
transaction_notifier: Option<TransactionNotifierLock>,
|
||||
blockstore: Arc<Blockstore>,
|
||||
enable_cpi_and_log_storage: bool,
|
||||
enable_extended_tx_metadata_storage: bool,
|
||||
exit: &Arc<AtomicBool>,
|
||||
) -> Self {
|
||||
let exit = exit.clone();
|
||||
@ -51,7 +51,7 @@ impl TransactionStatusService {
|
||||
enable_rpc_transaction_history,
|
||||
transaction_notifier.clone(),
|
||||
&blockstore,
|
||||
enable_cpi_and_log_storage,
|
||||
enable_extended_tx_metadata_storage,
|
||||
) {
|
||||
break;
|
||||
}
|
||||
@ -66,7 +66,7 @@ impl TransactionStatusService {
|
||||
enable_rpc_transaction_history: bool,
|
||||
transaction_notifier: Option<TransactionNotifierLock>,
|
||||
blockstore: &Arc<Blockstore>,
|
||||
enable_cpi_and_log_storage: bool,
|
||||
enable_extended_tx_metadata_storage: bool,
|
||||
) -> Result<(), RecvTimeoutError> {
|
||||
match write_transaction_status_receiver.recv_timeout(Duration::from_secs(1))? {
|
||||
TransactionStatusMessage::Batch(TransactionStatusBatch {
|
||||
@ -101,6 +101,7 @@ impl TransactionStatusService {
|
||||
log_messages,
|
||||
inner_instructions,
|
||||
durable_nonce_fee,
|
||||
return_data,
|
||||
} = details;
|
||||
let lamports_per_signature = match durable_nonce_fee {
|
||||
Some(DurableNonceFee::Valid(lamports_per_signature)) => {
|
||||
@ -156,6 +157,7 @@ impl TransactionStatusService {
|
||||
post_token_balances,
|
||||
rewards,
|
||||
loaded_addresses,
|
||||
return_data,
|
||||
};
|
||||
|
||||
if let Some(transaction_notifier) = transaction_notifier.as_ref() {
|
||||
@ -167,9 +169,11 @@ impl TransactionStatusService {
|
||||
);
|
||||
}
|
||||
|
||||
if !(enable_cpi_and_log_storage || transaction_notifier.is_some()) {
|
||||
if !(enable_extended_tx_metadata_storage || transaction_notifier.is_some())
|
||||
{
|
||||
transaction_status_meta.log_messages.take();
|
||||
transaction_status_meta.inner_instructions.take();
|
||||
transaction_status_meta.return_data.take();
|
||||
}
|
||||
|
||||
if enable_rpc_transaction_history {
|
||||
@ -347,6 +351,7 @@ pub(crate) mod tests {
|
||||
)
|
||||
.unwrap(),
|
||||
)),
|
||||
return_data: None,
|
||||
});
|
||||
|
||||
let balances = TransactionBalancesSet {
|
||||
|
Reference in New Issue
Block a user