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
This commit is contained in:
@@ -59,6 +59,8 @@ pub struct TransactionStatusMeta {
|
||||
pub post_balances: ::std::vec::Vec<u64>,
|
||||
#[prost(message, repeated, tag = "5")]
|
||||
pub inner_instructions: ::std::vec::Vec<InnerInstructions>,
|
||||
#[prost(message, repeated, tag = "6")]
|
||||
pub log_messages: ::std::vec::Vec<String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TransactionError {
|
||||
|
@@ -654,6 +654,7 @@ mod tests {
|
||||
pre_balances: vec![43, 0, 1],
|
||||
post_balances: vec![0, 42, 1],
|
||||
inner_instructions: Some(vec![]),
|
||||
log_messages: Some(vec![]),
|
||||
}),
|
||||
};
|
||||
let block = ConfirmedBlock {
|
||||
@@ -701,7 +702,8 @@ mod tests {
|
||||
if let CellData::Bincode(bincode_block) = deserialized {
|
||||
let mut block = block;
|
||||
if let Some(meta) = &mut block.transactions[0].meta {
|
||||
meta.inner_instructions = None; // Legacy bincode implementation does not suport inner_instructions
|
||||
meta.inner_instructions = None; // Legacy bincode implementation does not support inner_instructions
|
||||
meta.log_messages = None; // Legacy bincode implementation does not support log_messages
|
||||
}
|
||||
assert_eq!(block, bincode_block.into());
|
||||
} else {
|
||||
|
@@ -201,6 +201,7 @@ impl From<TransactionStatusMeta> for generated::TransactionStatusMeta {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
} = value;
|
||||
let err = match status {
|
||||
Ok(()) => None,
|
||||
@@ -213,12 +214,14 @@ impl From<TransactionStatusMeta> for generated::TransactionStatusMeta {
|
||||
.into_iter()
|
||||
.map(|ii| ii.into())
|
||||
.collect();
|
||||
let log_messages = log_messages.unwrap_or_default();
|
||||
Self {
|
||||
err,
|
||||
fee,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -233,6 +236,7 @@ impl TryFrom<generated::TransactionStatusMeta> for TransactionStatusMeta {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
} = value;
|
||||
let status = match &err {
|
||||
None => Ok(()),
|
||||
@@ -244,12 +248,14 @@ impl TryFrom<generated::TransactionStatusMeta> for TransactionStatusMeta {
|
||||
.map(|inner| inner.into())
|
||||
.collect(),
|
||||
);
|
||||
let log_messages = Some(log_messages);
|
||||
Ok(Self {
|
||||
status,
|
||||
fee,
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions,
|
||||
log_messages,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -184,6 +184,7 @@ impl From<StoredConfirmedBlockTransactionStatusMeta> for TransactionStatusMeta {
|
||||
pre_balances,
|
||||
post_balances,
|
||||
inner_instructions: None,
|
||||
log_messages: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user