* Store program logs in blockstore / bigtable (TransactionWithStatusMeta) (#12678)
* introduce store program logs in blockstore / bigtable
* fix test, transaction logs created for successful transactions
* fix test for legacy bincode implementation around log_messages
* only api nodes should record logs
* truncate transaction logs to 100KB
* refactor log truncate for improved coverage
(cherry picked from commit 8f5431551e
)
# Conflicts:
# runtime/src/bank.rs
* Resolve merge conflicts in bank.rs
* rerun cargo fmt
Co-authored-by: Josh <josh.hundley@gmail.com>
This commit is contained in:
@@ -5680,6 +5680,7 @@ pub mod tests {
|
||||
pre_balances: pre_balances.clone(),
|
||||
post_balances: post_balances.clone(),
|
||||
inner_instructions: Some(vec![]),
|
||||
log_messages: Some(vec![]),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
@@ -5693,6 +5694,7 @@ pub mod tests {
|
||||
pre_balances: pre_balances.clone(),
|
||||
post_balances: post_balances.clone(),
|
||||
inner_instructions: Some(vec![]),
|
||||
log_messages: Some(vec![]),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
@@ -5704,6 +5706,7 @@ pub mod tests {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions: Some(vec![]),
|
||||
log_messages: Some(vec![]),
|
||||
}),
|
||||
}
|
||||
})
|
||||
@@ -6000,6 +6003,7 @@ pub mod tests {
|
||||
index: 0,
|
||||
instructions: vec![CompiledInstruction::new(1, &(), vec![0])],
|
||||
}];
|
||||
let log_messages_vec = vec![String::from("Test message\n")];
|
||||
|
||||
// result not found
|
||||
assert!(transaction_status_cf
|
||||
@@ -6019,6 +6023,7 @@ pub mod tests {
|
||||
pre_balances: pre_balances_vec.clone(),
|
||||
post_balances: post_balances_vec.clone(),
|
||||
inner_instructions: Some(inner_instructions_vec.clone()),
|
||||
log_messages: Some(log_messages_vec.clone()),
|
||||
},
|
||||
)
|
||||
.is_ok());
|
||||
@@ -6030,6 +6035,7 @@ pub mod tests {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
} = transaction_status_cf
|
||||
.get((0, Signature::default(), 0))
|
||||
.unwrap()
|
||||
@@ -6039,6 +6045,7 @@ pub mod tests {
|
||||
assert_eq!(pre_balances, pre_balances_vec);
|
||||
assert_eq!(post_balances, post_balances_vec);
|
||||
assert_eq!(inner_instructions.unwrap(), inner_instructions_vec);
|
||||
assert_eq!(log_messages.unwrap(), log_messages_vec);
|
||||
|
||||
// insert value
|
||||
assert!(transaction_status_cf
|
||||
@@ -6050,6 +6057,7 @@ pub mod tests {
|
||||
pre_balances: pre_balances_vec.clone(),
|
||||
post_balances: post_balances_vec.clone(),
|
||||
inner_instructions: Some(inner_instructions_vec.clone()),
|
||||
log_messages: Some(log_messages_vec.clone()),
|
||||
},
|
||||
)
|
||||
.is_ok());
|
||||
@@ -6061,6 +6069,7 @@ pub mod tests {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
} = transaction_status_cf
|
||||
.get((0, Signature::new(&[2u8; 64]), 9))
|
||||
.unwrap()
|
||||
@@ -6072,6 +6081,7 @@ pub mod tests {
|
||||
assert_eq!(pre_balances, pre_balances_vec);
|
||||
assert_eq!(post_balances, post_balances_vec);
|
||||
assert_eq!(inner_instructions.unwrap(), inner_instructions_vec);
|
||||
assert_eq!(log_messages.unwrap(), log_messages_vec);
|
||||
}
|
||||
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
|
||||
}
|
||||
@@ -6299,6 +6309,7 @@ pub mod tests {
|
||||
pre_balances: pre_balances_vec,
|
||||
post_balances: post_balances_vec,
|
||||
inner_instructions: Some(vec![]),
|
||||
log_messages: Some(vec![]),
|
||||
};
|
||||
|
||||
let signature1 = Signature::new(&[1u8; 64]);
|
||||
@@ -6432,6 +6443,7 @@ pub mod tests {
|
||||
index: 0,
|
||||
instructions: vec![CompiledInstruction::new(1, &(), vec![0])],
|
||||
}]);
|
||||
let log_messages = Some(vec![String::from("Test message\n")]);
|
||||
let signature = transaction.signatures[0];
|
||||
blockstore
|
||||
.transaction_status_cf
|
||||
@@ -6443,6 +6455,7 @@ pub mod tests {
|
||||
pre_balances: pre_balances.clone(),
|
||||
post_balances: post_balances.clone(),
|
||||
inner_instructions: inner_instructions.clone(),
|
||||
log_messages: log_messages.clone(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
@@ -6454,6 +6467,7 @@ pub mod tests {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
}),
|
||||
}
|
||||
})
|
||||
@@ -6893,6 +6907,7 @@ pub mod tests {
|
||||
pre_balances: vec![],
|
||||
post_balances: vec![],
|
||||
inner_instructions: Some(vec![]),
|
||||
log_messages: Some(vec![]),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
@@ -16,8 +16,8 @@ use solana_metrics::{datapoint_error, inc_new_counter_debug};
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_runtime::{
|
||||
bank::{
|
||||
Bank, InnerInstructionsList, TransactionBalancesSet, TransactionProcessResult,
|
||||
TransactionResults,
|
||||
Bank, InnerInstructionsList, TransactionBalancesSet, TransactionLogMessages,
|
||||
TransactionProcessResult, TransactionResults,
|
||||
},
|
||||
bank_forks::BankForks,
|
||||
bank_utils,
|
||||
@@ -103,12 +103,13 @@ fn execute_batch(
|
||||
transaction_status_sender: Option<TransactionStatusSender>,
|
||||
replay_vote_sender: Option<&ReplayVoteSender>,
|
||||
) -> Result<()> {
|
||||
let (tx_results, balances, inner_instructions) =
|
||||
let (tx_results, balances, inner_instructions, transaction_logs) =
|
||||
batch.bank().load_execute_and_commit_transactions(
|
||||
batch,
|
||||
MAX_PROCESSING_AGE,
|
||||
transaction_status_sender.is_some(),
|
||||
transaction_status_sender.is_some(),
|
||||
transaction_status_sender.is_some(),
|
||||
);
|
||||
|
||||
bank_utils::find_and_send_votes(batch.transactions(), &tx_results, replay_vote_sender);
|
||||
@@ -127,6 +128,7 @@ fn execute_batch(
|
||||
processing_results,
|
||||
balances,
|
||||
inner_instructions,
|
||||
transaction_logs,
|
||||
sender,
|
||||
);
|
||||
}
|
||||
@@ -1030,6 +1032,7 @@ pub struct TransactionStatusBatch {
|
||||
pub statuses: Vec<TransactionProcessResult>,
|
||||
pub balances: TransactionBalancesSet,
|
||||
pub inner_instructions: Vec<Option<InnerInstructionsList>>,
|
||||
pub transaction_logs: Vec<TransactionLogMessages>,
|
||||
}
|
||||
|
||||
pub type TransactionStatusSender = Sender<TransactionStatusBatch>;
|
||||
@@ -1041,6 +1044,7 @@ pub fn send_transaction_status_batch(
|
||||
statuses: Vec<TransactionProcessResult>,
|
||||
balances: TransactionBalancesSet,
|
||||
inner_instructions: Vec<Option<InnerInstructionsList>>,
|
||||
transaction_logs: Vec<TransactionLogMessages>,
|
||||
transaction_status_sender: TransactionStatusSender,
|
||||
) {
|
||||
let slot = bank.slot();
|
||||
@@ -1051,6 +1055,7 @@ pub fn send_transaction_status_batch(
|
||||
statuses,
|
||||
balances,
|
||||
inner_instructions,
|
||||
transaction_logs,
|
||||
}) {
|
||||
trace!(
|
||||
"Slot {} transaction_status send batch failed: {:?}",
|
||||
@@ -2890,11 +2895,13 @@ pub mod tests {
|
||||
},
|
||||
_balances,
|
||||
_inner_instructions,
|
||||
_log_messages,
|
||||
) = batch.bank().load_execute_and_commit_transactions(
|
||||
&batch,
|
||||
MAX_PROCESSING_AGE,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
);
|
||||
let (err, signature) = get_first_error(&batch, fee_collection_results).unwrap();
|
||||
// First error found should be for the 2nd transaction, due to iteration_order
|
||||
|
Reference in New Issue
Block a user