Skip to content

Commit

Permalink
RuntimeTransaction: Minor Cleanup (solana-labs#34112)
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge authored Nov 16, 2023
1 parent 7e3b09d commit e589c07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
31 changes: 11 additions & 20 deletions runtime-transaction/src/runtime_transaction.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/// RuntimeTransaction is `runtime` facing representation of transaction, while
/// solana_sdk::SanitizedTransaction is client facing representation.
///
/// It has two states:
/// 1. Statically Loaded: after receiving `packet` from sigverify and deserializing
/// it into `solana_sdk::VersionedTransaction`, then sanitizing into
/// `solana_sdk::SanitizedVersionedTransaction`, `RuntimeTransactionStatic`
/// can be created from it with static transaction metadata extracted.
/// 2. Dynamically Loaded: after successfully loaded account addresses from onchain
/// ALT, RuntimeTransaction transits into Dynamically Loaded state, with
/// its dynamic metadata loaded.
//! RuntimeTransaction is `runtime` facing representation of transaction, while
//! solana_sdk::SanitizedTransaction is client facing representation.
//!
//! It has two states:
//! 1. Statically Loaded: after receiving `packet` from sigverify and deserializing
//! it into `solana_sdk::VersionedTransaction`, then sanitizing into
//! `solana_sdk::SanitizedVersionedTransaction`, `RuntimeTransactionStatic`
//! can be created from it with static transaction metadata extracted.
//! 2. Dynamically Loaded: after successfully loaded account addresses from onchain
//! ALT, RuntimeTransaction transits into Dynamically Loaded state, with
//! its dynamic metadata loaded.
use {
crate::transaction_meta::{DynamicMeta, StaticMeta, TransactionMeta},
solana_sdk::{
Expand All @@ -22,12 +22,8 @@ use {

#[derive(Debug, Clone, Eq, PartialEq)]
pub struct RuntimeTransactionStatic {
// sanitized signatures
signatures: Vec<Signature>,

// sanitized message
message: SanitizedVersionedMessage,

// transaction meta is a collection of fields, it is updated
// during message state transition
meta: TransactionMeta,
Expand Down Expand Up @@ -70,12 +66,8 @@ impl RuntimeTransactionStatic {
/// address_loader, to load accounts from on-chain ALT, then resolve dynamic metadata
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct RuntimeTransactionDynamic {
// sanitized signatures
signatures: Vec<Signature>,

// sanitized message
message: SanitizedMessage,

// transaction meta is a collection of fields, it is updated
// during message state transition
meta: TransactionMeta,
Expand Down Expand Up @@ -110,7 +102,6 @@ impl RuntimeTransactionDynamic {
Ok(tx)
}

// private helpers
fn load_dynamic_metadata(&mut self) -> Result<()> {
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions runtime-transaction/src/transaction_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub struct TransactionMeta {
}

impl TransactionMeta {
pub fn set_message_hash(&mut self, message_hash: Hash) {
pub(crate) fn set_message_hash(&mut self, message_hash: Hash) {
self.message_hash = message_hash;
}

pub fn set_is_simple_vote_tx(&mut self, is_simple_vote_tx: bool) {
pub(crate) fn set_is_simple_vote_tx(&mut self, is_simple_vote_tx: bool) {
self.is_simple_vote_tx = is_simple_vote_tx;
}
}

0 comments on commit e589c07

Please sign in to comment.