Skip to content

Commit

Permalink
- make cost_tracker a member of bank, remove shared instance from TPU;
Browse files Browse the repository at this point in the history
- decouple cost_model from cost_tracker; allowing one cost_model
  instance being shared within a validator;
- update cost_model api to calculate_cost(&self...)->transaction_cost
  • Loading branch information
tao-stones committed Oct 12, 2021
1 parent 005d686 commit d91c8e3
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 295 deletions.
6 changes: 2 additions & 4 deletions banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use solana_perf::packet::to_packets_chunked;
use solana_poh::poh_recorder::{create_test_recorder, PohRecorder, WorkingBankEntry};
use solana_runtime::{
accounts_background_service::AbsRequestSender, bank::Bank, bank_forks::BankForks,
cost_model::CostModel, cost_tracker::CostTracker,
cost_model::CostModel,
};
use solana_sdk::{
hash::Hash,
Expand Down Expand Up @@ -233,9 +233,7 @@ fn main() {
vote_receiver,
None,
replay_vote_sender,
Arc::new(RwLock::new(CostTracker::new(Arc::new(RwLock::new(
CostModel::default(),
))))),
Arc::new(RwLock::new(CostModel::default())),
);
poh_recorder.lock().unwrap().set_bank(&bank);

Expand Down
9 changes: 2 additions & 7 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use solana_perf::test_tx::test_tx;
use solana_poh::poh_recorder::{create_test_recorder, WorkingBankEntry};
use solana_runtime::bank::Bank;
use solana_runtime::cost_model::CostModel;
use solana_runtime::cost_tracker::CostTracker;
use solana_runtime::cost_tracker_stats::CostTrackerStats;
use solana_sdk::genesis_config::GenesisConfig;
use solana_sdk::hash::Hash;
Expand Down Expand Up @@ -95,9 +94,7 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
None::<Box<dyn Fn()>>,
&BankingStageStats::default(),
&recorder,
&Arc::new(RwLock::new(CostTracker::new(Arc::new(RwLock::new(
CostModel::new(std::u64::MAX, std::u64::MAX),
))))),
&Arc::new(RwLock::new(CostModel::new(std::u64::MAX, std::u64::MAX))),
&mut CostTrackerStats::default(),
);
});
Expand Down Expand Up @@ -225,9 +222,7 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
vote_receiver,
None,
s,
Arc::new(RwLock::new(CostTracker::new(Arc::new(RwLock::new(
CostModel::new(std::u64::MAX, std::u64::MAX),
))))),
Arc::new(RwLock::new(CostModel::new(std::u64::MAX, std::u64::MAX))),
);
poh_recorder.lock().unwrap().set_bank(&bank);

Expand Down
Loading

0 comments on commit d91c8e3

Please sign in to comment.