Skip to content

Commit

Permalink
Step Finance patch
Browse files Browse the repository at this point in the history
Co-authored-by: Dana <[email protected]>

bump docker build version

Add account owners array to messages

Cleaner diff

rename to post_owners
  • Loading branch information
quellen-sol committed Aug 8, 2024
1 parent d86fd65 commit de855b7
Show file tree
Hide file tree
Showing 19 changed files with 363 additions and 16 deletions.
25 changes: 25 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2.1

orbs:
aws-ecr: circleci/[email protected]

executors:
custom:
machine:
image: ubuntu-2204:2022.04.2
resource_class: xlarge

workflows:
run-pipeline:
jobs:
- aws-ecr/build-and-push-image:
executor: custom
dockerfile: _step-finance/Dockerfile
repo: step-solana
region: eu-north-1
tag: ${CIRCLE_BRANCH},${CIRCLE_BRANCH}-<< pipeline.number >>,${CIRCLE_BRANCH}-<< pipeline.number >>-${CIRCLE_SHA1}
context: aws-account
filters:
branches:
only:
- step-release
14 changes: 14 additions & 0 deletions _step-finance/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM rust:1.73-bullseye as builder
RUN apt-get update
RUN apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang cmake make libprotobuf-dev protobuf-compiler
WORKDIR /solana-build
COPY . .
RUN cargo build --release

FROM debian:bullseye-20230522 as runtime
RUN apt-get update
RUN apt-get install -y bzip2
COPY --from=builder --chmod=700 /solana-build/target/release /usr/local/bin

WORKDIR /solana
ENTRYPOINT ["solana-test-validator"]
2 changes: 2 additions & 0 deletions _step-finance/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
_step-finance/
11 changes: 9 additions & 2 deletions core/src/banking_stage/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use {
},
solana_measure::measure_us,
solana_runtime::{
bank::{Bank, CommitTransactionCounts, TransactionBalancesSet},
bank::{Bank, CommitTransactionCounts, TransactionBalancesSet, TransactionDatumSet, TransactionOwnersSet},
bank_utils,
prioritization_fee_cache::PrioritizationFeeCache,
program_inclusions::PreOrPostDatum,
transaction_batch::TransactionBatch,
},
solana_sdk::{hash::Hash, pubkey::Pubkey, saturating_add_assign},
Expand All @@ -32,6 +33,7 @@ pub enum CommitTransactionDetails {
#[derive(Default)]
pub(super) struct PreBalanceInfo {
pub native: Vec<Vec<u64>>,
pub datum: Vec<Vec<Option<Vec<u8>>>>,
pub token: Vec<Vec<TransactionTokenBalance>>,
pub mint_decimals: HashMap<Pubkey, u8>,
}
Expand Down Expand Up @@ -142,7 +144,8 @@ impl Committer {
) {
if let Some(transaction_status_sender) = &self.transaction_status_sender {
let txs = batch.sanitized_transactions().to_vec();
let post_balances = bank.collect_balances(batch);
let (post_balances, post_datum, owners) =
bank.collect_balances_and_datum(batch, PreOrPostDatum::PostDatum);
let post_token_balances =
collect_token_balances(bank, batch, &mut pre_balance_info.mint_decimals);
let mut transaction_index = starting_transaction_index.unwrap_or_default();
Expand All @@ -167,6 +170,10 @@ impl Committer {
std::mem::take(&mut pre_balance_info.native),
post_balances,
),
TransactionOwnersSet {
owners,
},
TransactionDatumSet::new(std::mem::take(&mut pre_balance_info.datum), post_datum),
TransactionTokenBalancesSet::new(
std::mem::take(&mut pre_balance_info.token),
post_token_balances,
Expand Down
4 changes: 3 additions & 1 deletion core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use {
solana_runtime::{
accounts::validate_fee_payer,
bank::{Bank, LoadAndExecuteTransactionsOutput},
program_inclusions::PreOrPostDatum,
transaction_batch::TransactionBatch,
},
solana_sdk::{
Expand Down Expand Up @@ -570,7 +571,8 @@ impl Consumer {
// If the extra meta-data services are enabled for RPC, collect the
// pre-balances for native and token programs.
if transaction_status_sender_enabled {
pre_balance_info.native = bank.collect_balances(batch);
(pre_balance_info.native, pre_balance_info.datum, ..) =
bank.collect_balances_and_datum(batch, PreOrPostDatum::PreDatum);
pre_balance_info.token =
collect_token_balances(bank, batch, &mut pre_balance_info.mint_decimals)
}
Expand Down
14 changes: 12 additions & 2 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use {
solana_rayon_threadlimit::{get_max_thread_count, get_thread_count},
solana_runtime::{
accounts_background_service::{AbsRequestSender, SnapshotRequestKind},
bank::{Bank, TransactionBalancesSet},
bank::{Bank, TransactionBalancesSet, TransactionDatumSet, TransactionOwnersSet},
bank_forks::BankForks,
bank_utils,
commitment::VOTE_THRESHOLD_SIZE,
Expand Down Expand Up @@ -157,7 +157,7 @@ pub fn execute_batch(
vec![]
};

let (tx_results, balances) = batch.bank().load_execute_and_commit_transactions(
let (tx_results, balances, datum, owners) = batch.bank().load_execute_and_commit_transactions(
batch,
MAX_PROCESSING_AGE,
transaction_status_sender.is_some(),
Expand Down Expand Up @@ -203,6 +203,8 @@ pub fn execute_batch(
transactions,
execution_results,
balances,
owners,
datum,
token_balances,
rent_debits,
transaction_indexes.to_vec(),
Expand Down Expand Up @@ -1828,6 +1830,8 @@ pub struct TransactionStatusBatch {
pub transactions: Vec<SanitizedTransaction>,
pub execution_results: Vec<Option<TransactionExecutionDetails>>,
pub balances: TransactionBalancesSet,
pub owners: TransactionOwnersSet,
pub datum: TransactionDatumSet,
pub token_balances: TransactionTokenBalancesSet,
pub rent_debits: Vec<RentDebits>,
pub transaction_indexes: Vec<usize>,
Expand All @@ -1845,6 +1849,8 @@ impl TransactionStatusSender {
transactions: Vec<SanitizedTransaction>,
execution_results: Vec<TransactionExecutionResult>,
balances: TransactionBalancesSet,
owners: TransactionOwnersSet,
datum: TransactionDatumSet,
token_balances: TransactionTokenBalancesSet,
rent_debits: Vec<RentDebits>,
transaction_indexes: Vec<usize>,
Expand All @@ -1864,6 +1870,8 @@ impl TransactionStatusSender {
})
.collect(),
balances,
owners,
datum,
token_balances,
rent_debits,
transaction_indexes,
Expand Down Expand Up @@ -3951,6 +3959,8 @@ pub mod tests {
..
},
_balances,
_datums,
_owners,
) = batch.bank().load_execute_and_commit_transactions(
&batch,
MAX_PROCESSING_AGE,
Expand Down
3 changes: 3 additions & 0 deletions rpc-client/src/mock_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ impl RpcSender for MockSender {
fee: 0,
pre_balances: vec![499999999999999950, 50, 1],
post_balances: vec![499999999999999950, 50, 1],
post_owners: None,
pre_datum: None,
post_datum: None,
inner_instructions: OptionSerializer::None,
log_messages: OptionSerializer::None,
pre_token_balances: OptionSerializer::None,
Expand Down
21 changes: 20 additions & 1 deletion rpc/src/transaction_status_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ impl TransactionStatusService {
bank,
transactions,
execution_results,
owners,
datum,
balances,
token_balances,
rent_debits,
Expand All @@ -80,6 +82,9 @@ impl TransactionStatusService {
execution_result,
pre_balances,
post_balances,
owners,
pre_datum,
post_datum,
pre_token_balances,
post_token_balances,
rent_debits,
Expand All @@ -89,6 +94,9 @@ impl TransactionStatusService {
execution_results,
balances.pre_balances,
balances.post_balances,
owners.owners,
datum.pre_datum,
datum.post_datum,
token_balances.pre_token_balances,
token_balances.post_token_balances,
rent_debits,
Expand Down Expand Up @@ -144,6 +152,9 @@ impl TransactionStatusService {
fee,
pre_balances,
post_balances,
post_owners: Some(owners),
pre_datum: Some(pre_datum),
post_datum: Some(post_datum),
inner_instructions,
log_messages,
pre_token_balances,
Expand Down Expand Up @@ -206,6 +217,7 @@ impl TransactionStatusService {

#[cfg(test)]
pub(crate) mod tests {

use {
super::*,
crate::transaction_notifier_interface::TransactionNotifier,
Expand All @@ -217,7 +229,9 @@ pub(crate) mod tests {
rent_debits::RentDebits,
},
solana_ledger::{genesis_utils::create_genesis_config, get_tmp_ledger_path_auto_delete},
solana_runtime::bank::{Bank, TransactionBalancesSet},
solana_runtime::bank::{
Bank, TransactionBalancesSet, TransactionDatumSet, TransactionOwnersSet,
},
solana_sdk::{
account_utils::StateMut,
clock::Slot,
Expand Down Expand Up @@ -410,6 +424,11 @@ pub(crate) mod tests {
let transaction_index: usize = bank.transaction_count().try_into().unwrap();
let transaction_status_batch = TransactionStatusBatch {
bank,
owners: TransactionOwnersSet { owners: vec![] },
datum: TransactionDatumSet {
post_datum: vec![vec![Some(vec![0x69])]],
pre_datum: vec![vec![Some(vec![0x04, 0x20])]],
},
transactions: vec![transaction],
execution_results: vec![transaction_result],
balances,
Expand Down
Loading

0 comments on commit de855b7

Please sign in to comment.