From c65078efc6ed3aa3a38014d6bfd4e1ea40a38559 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 05:41:21 +0000 Subject: [PATCH 001/163] save --- ledger/benches/blockstore_processor.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index b5d83144a66..e4878a457c0 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -130,7 +130,6 @@ fn bench_execute_batch( let mut timing = ExecuteTimings::default(); bencher.iter({ let bank = bank.clone(); - move || { let batch = batches_iter.next().unwrap(); execute_batch( &batch, @@ -141,7 +140,6 @@ fn bench_execute_batch( None, &prioritization_fee_cache, ) - } }); } From 67bca6a87e3df2557c409aeb82d87c7609d55e49 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 05:42:26 +0000 Subject: [PATCH 002/163] save --- ledger/benches/blockstore_processor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index e4878a457c0..733bcd17ed8 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -129,7 +129,7 @@ fn bench_execute_batch( let mut timing = ExecuteTimings::default(); bencher.iter({ - let bank = bank.clone(); + move || { let batch = batches_iter.next().unwrap(); execute_batch( &batch, @@ -140,6 +140,7 @@ fn bench_execute_batch( None, &prioritization_fee_cache, ) + } }); } From d847b35df439af59867706157639bfe805ca95a9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 05:43:55 +0000 Subject: [PATCH 003/163] save --- ledger/benches/blockstore_processor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 733bcd17ed8..35e64895c28 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,11 +113,12 @@ fn bench_execute_batch( prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); let transactions = create_transactions(&bank, 2_usize.pow(20)); + let bank2 = bank.clone() let batches: Vec<_> = transactions .chunks(batch_size) .map(|txs| { let mut batch = - TransactionBatch::new(vec![Ok(()); txs.len()], &bank, Cow::Borrowed(txs)); + TransactionBatch::new(vec![Ok(()); txs.len()], &bank2, Cow::Borrowed(txs)); batch.set_needs_unlock(false); TransactionBatchWithIndexes { batch, From 2e875e801f84d69a4c8d85d0748a0b0a47fb3972 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 05:44:32 +0000 Subject: [PATCH 004/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 35e64895c28..2cf9738ac18 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,7 +113,7 @@ fn bench_execute_batch( prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); let transactions = create_transactions(&bank, 2_usize.pow(20)); - let bank2 = bank.clone() + let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) .map(|txs| { From 0155178189dae222eb0b719b6c3e092f2a2ae092 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 05:46:20 +0000 Subject: [PATCH 005/163] save --- ledger/benches/blockstore_processor.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 2cf9738ac18..e0d19853feb 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -129,19 +129,17 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - bencher.iter({ - move || { - let batch = batches_iter.next().unwrap(); - execute_batch( - &batch, - &bank, - None, - None, - &mut timing, - None, - &prioritization_fee_cache, - ) - } + bencher.iter(|| { + let batch = batches_iter.next().unwrap(); + execute_batch( + &batch, + &bank, + None, + None, + &mut timing, + None, + &prioritization_fee_cache, + ) }); } From 0d5db3f028a371dbecbeb07483e9018d3c3e06eb Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:13:28 +0000 Subject: [PATCH 006/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index e0d19853feb..133b1999981 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -129,7 +129,7 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - bencher.iter(|| { + for _ in 0..100 { let batch = batches_iter.next().unwrap(); execute_batch( &batch, @@ -140,7 +140,7 @@ fn bench_execute_batch( None, &prioritization_fee_cache, ) - }); + } } #[bench] From d7b49cc896dd4c24c84b40e98f3e2b621853602b Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:14:13 +0000 Subject: [PATCH 007/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 133b1999981..dd20a29f98e 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -139,7 +139,7 @@ fn bench_execute_batch( &mut timing, None, &prioritization_fee_cache, - ) + ); } } From ccde07ae82341284dc7fb8ac1b049d44681cffdb Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:17:58 +0000 Subject: [PATCH 008/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index dd20a29f98e..ee1c83ec9e9 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -112,7 +112,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(20)); + let transactions = create_transactions(&bank, 64_usize.pow(6)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -129,7 +129,7 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - for _ in 0..100 { + for _ in 0..64 { let batch = batches_iter.next().unwrap(); execute_batch( &batch, From 952c8248fcfef958e9fb006697026832b08d7685 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:18:40 +0000 Subject: [PATCH 009/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index ee1c83ec9e9..24bf589e079 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -139,7 +139,7 @@ fn bench_execute_batch( &mut timing, None, &prioritization_fee_cache, - ); + ).unwrap(); } } From 31a17750834d1d4ee844710bcbe66f66396fa04d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:19:54 +0000 Subject: [PATCH 010/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 24bf589e079..2ba3ba3f793 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -112,7 +112,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 64_usize.pow(6)); + let transactions = create_transactions(&bank, 64_usize.pow(8)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) From 23d9f0bd4e461fbf9be5b5aa515adad6dc900927 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:20:28 +0000 Subject: [PATCH 011/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 2ba3ba3f793..77275e3cf44 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -112,7 +112,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 64_usize.pow(8)); + let transactions = create_transactions(&bank, 64_usize.pow(2)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) From 6ae370b59e1b7e4183bd86667515dde5b90f3bac Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:33:25 +0000 Subject: [PATCH 012/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 77275e3cf44..0f4d6c7a4ad 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -129,7 +129,7 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - for _ in 0..64 { + for _ in 0..(64*64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( &batch, From 8ccf45d006a37d32d04878dca38c67f37770b46a Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:53:18 +0000 Subject: [PATCH 013/163] save --- ledger/benches/blockstore_processor.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 0f4d6c7a4ad..e0d19853feb 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -112,7 +112,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 64_usize.pow(2)); + let transactions = create_transactions(&bank, 2_usize.pow(20)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -129,7 +129,7 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - for _ in 0..(64*64/batch_size) { + bencher.iter(|| { let batch = batches_iter.next().unwrap(); execute_batch( &batch, @@ -139,8 +139,8 @@ fn bench_execute_batch( &mut timing, None, &prioritization_fee_cache, - ).unwrap(); - } + ) + }); } #[bench] From 23be7040feef12d0ba88dd4111833bf91c0072ad Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:53:57 +0000 Subject: [PATCH 014/163] save --- ledger/benches/blockstore_processor.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index e0d19853feb..7eb87689f0a 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -130,16 +130,18 @@ fn bench_execute_batch( let mut timing = ExecuteTimings::default(); bencher.iter(|| { - let batch = batches_iter.next().unwrap(); - execute_batch( - &batch, - &bank, - None, - None, - &mut timing, - None, - &prioritization_fee_cache, - ) + for _ in 0..(64/batch_size) { + let batch = batches_iter.next().unwrap(); + execute_batch( + &batch, + &bank, + None, + None, + &mut timing, + None, + &prioritization_fee_cache, + ) + } }); } From 06e13201dc9b5c503271f75aac8e2d89bd26229d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:54:36 +0000 Subject: [PATCH 015/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 7eb87689f0a..ab2ed4d5e8a 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -140,7 +140,7 @@ fn bench_execute_batch( &mut timing, None, &prioritization_fee_cache, - ) + ); } }); } From 9be33069b5655c766bfbebfafbc5cf6c4a924836 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 06:55:15 +0000 Subject: [PATCH 016/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index ab2ed4d5e8a..7ec2b17d97b 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -140,7 +140,7 @@ fn bench_execute_batch( &mut timing, None, &prioritization_fee_cache, - ); + ).unwrap(); } }); } From 9cf254d699186b10232514ab44dc6a20ee351580 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 07:22:21 +0000 Subject: [PATCH 017/163] save --- ledger/benches/blockstore_processor.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 7ec2b17d97b..a4af5ba1463 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -129,6 +129,9 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); + eprintln!("profile me!: {}", std::process::id()); + std::thread::sleep(std::time::Duration::from_secs(10)); + bencher.iter(|| { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); From 367ff1d407c5228f8dc167d3be32ac3af0209897 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 07:48:47 +0000 Subject: [PATCH 018/163] save --- ledger/benches/blockstore_processor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index a4af5ba1463..ff609aad036 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -146,6 +146,7 @@ fn bench_execute_batch( ).unwrap(); } }); + eprintln!("{:?}", timing); } #[bench] From 88797805bc60e650dd3cbc23f72dd1b6a3c7a480 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:03:18 +0000 Subject: [PATCH 019/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index ff609aad036..c2beb272e42 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -129,8 +129,8 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - eprintln!("profile me!: {}", std::process::id()); - std::thread::sleep(std::time::Duration::from_secs(10)); + //eprintln!("profile me!: {}", std::process::id()); + //std::thread::sleep(std::time::Duration::from_secs(10)); bencher.iter(|| { for _ in 0..(64/batch_size) { From 599c7d38588360a4f7fe1e2ce33dc578faaa80ae Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:26:14 +0000 Subject: [PATCH 020/163] save --- runtime/src/bank.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9d0342fb2fc..26fdd126d91 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5537,6 +5537,7 @@ impl Bank { let mut write_time = Measure::start("write_time"); let durable_nonce = DurableNonce::from_blockhash(&last_blockhash); + /* self.rc.accounts.store_cached( self.slot(), sanitized_txs, @@ -5546,6 +5547,7 @@ impl Bank { &durable_nonce, lamports_per_signature, ); + */ let rent_debits = self.collect_rent(&execution_results, loaded_txs); // Cached vote and stake accounts are synchronized with accounts-db From 0a4d8f2c6fd7cdbbe4a8453224cc2fc9bb8951a7 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:29:05 +0000 Subject: [PATCH 021/163] save --- runtime/src/bank.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 26fdd126d91..d9a6cb4058a 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5548,8 +5548,9 @@ impl Bank { lamports_per_signature, ); */ - let rent_debits = self.collect_rent(&execution_results, loaded_txs); + let rent_debits = vec![]; //self.collect_rent(&execution_results, loaded_txs); + /* // Cached vote and stake accounts are synchronized with accounts-db // after each transaction. let mut update_stakes_cache_time = Measure::start("update_stakes_cache_time"); @@ -5609,11 +5610,12 @@ impl Bank { ExecuteTimingType::UpdateTransactionStatuses, update_transaction_statuses_time.as_us(), ); + */ TransactionResults { - fee_collection_results, - execution_results, - rent_debits, + fee_collection_results: vec![], + execution_results: vec![], + rent_debits: vec![], } } From 8422f694541ee84f4b5f1b0873d1d3c47684c343 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:29:18 +0000 Subject: [PATCH 022/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d9a6cb4058a..dc89659a044 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5548,7 +5548,7 @@ impl Bank { lamports_per_signature, ); */ - let rent_debits = vec![]; //self.collect_rent(&execution_results, loaded_txs); + //let rent_debits = self.collect_rent(&execution_results, loaded_txs); /* // Cached vote and stake accounts are synchronized with accounts-db From a3adb81cac115ccf255ce7b4054d0ad6407ddf21 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:31:19 +0000 Subject: [PATCH 023/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index dc89659a044..5701996fe5f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5504,6 +5504,7 @@ impl Bank { counts: CommitTransactionCounts, timings: &mut ExecuteTimings, ) -> TransactionResults { + /* assert!( !self.freeze_started(), "commit_transactions() working on a bank that is already frozen or is undergoing freezing!" @@ -5537,7 +5538,6 @@ impl Bank { let mut write_time = Measure::start("write_time"); let durable_nonce = DurableNonce::from_blockhash(&last_blockhash); - /* self.rc.accounts.store_cached( self.slot(), sanitized_txs, From 262ee342b14f98097acaac77e5a5a88057ba88c1 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:35:05 +0000 Subject: [PATCH 024/163] save --- runtime/src/bank.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 5701996fe5f..ef6d6e90b8b 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5219,6 +5219,7 @@ impl Bank { execution_time.stop(); + /* const SHRINK_LOADED_PROGRAMS_TO_PERCENTAGE: u8 = 90; self.loaded_programs_cache .write() @@ -5227,6 +5228,7 @@ impl Bank { Percentage::from(SHRINK_LOADED_PROGRAMS_TO_PERCENTAGE), self.slot(), ); + */ debug!( "check: {}us load: {}us execute: {}us txs_len={}", From aa2b41962e89bd062d04624bd9e02cd70d5f5937 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:37:41 +0000 Subject: [PATCH 025/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index ef6d6e90b8b..ca698787aa1 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5118,7 +5118,7 @@ impl Bank { ); check_time.stop(); - let mut program_accounts_map = self.filter_executable_program_accounts( + let mut program_accounts_map: usize = self.filter_executable_program_accounts( &self.ancestors, sanitized_txs, &mut check_results, From 9e7db82f50dfd3224818dae885c6c209ff2e1792 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:38:00 +0000 Subject: [PATCH 026/163] save --- runtime/src/bank.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index ca698787aa1..b9a58c0fea3 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5118,13 +5118,13 @@ impl Bank { ); check_time.stop(); - let mut program_accounts_map: usize = self.filter_executable_program_accounts( + let mut program_accounts_map = Default::default(); /*self.filter_executable_program_accounts( &self.ancestors, sanitized_txs, &mut check_results, PROGRAM_OWNERS, &self.blockhash_queue.read().unwrap(), - ); + );*/ let native_loader = native_loader::id(); for builtin_program in self.builtin_programs.iter() { program_accounts_map.insert(*builtin_program, (&native_loader, 0)); From 5243b85898fbba1ecfd164b83635b73cb49300e9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:38:24 +0000 Subject: [PATCH 027/163] save --- runtime/src/bank.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index b9a58c0fea3..9e880244a9e 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5015,6 +5015,7 @@ impl Bank { hash_queue: &BlockhashQueue, ) -> HashMap { let mut result: HashMap = HashMap::new(); + return result; lock_results.iter_mut().zip(txs).for_each(|etx| { if let ((Ok(()), nonce), tx) = etx { if nonce @@ -5118,13 +5119,13 @@ impl Bank { ); check_time.stop(); - let mut program_accounts_map = Default::default(); /*self.filter_executable_program_accounts( + let mut program_accounts_map = self.filter_executable_program_accounts( &self.ancestors, sanitized_txs, &mut check_results, PROGRAM_OWNERS, &self.blockhash_queue.read().unwrap(), - );*/ + ); let native_loader = native_loader::id(); for builtin_program in self.builtin_programs.iter() { program_accounts_map.insert(*builtin_program, (&native_loader, 0)); From 3ce17f734e87b50bf48af7aa32ac6ff625f2129a Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:43:06 +0000 Subject: [PATCH 028/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9e880244a9e..510a8541cf9 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5264,7 +5264,7 @@ impl Bank { let is_vote = tx.is_simple_vote_transaction(); - if execution_result.was_executed() // Skip log collection for unprocessed transactions + if false && execution_result.was_executed() // Skip log collection for unprocessed transactions && transaction_log_collector_config.filter != TransactionLogCollectorFilter::None { let mut filtered_mentioned_addresses = Vec::new(); From 83e1631d87571083394e9a2951eda413c4e474a8 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:47:37 +0000 Subject: [PATCH 029/163] save --- ledger/benches/blockstore_processor.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index c2beb272e42..c852b1c1f7b 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -150,23 +150,13 @@ fn bench_execute_batch( } #[bench] -fn bench_execute_batch_unbatched(bencher: &mut Bencher) { - bench_execute_batch(bencher, 1, true); -} - -#[bench] -fn bench_execute_batch_half_batch(bencher: &mut Bencher) { - bench_execute_batch(bencher, 32, true); -} - -#[bench] -fn bench_execute_batch_full_batch(bencher: &mut Bencher) { - bench_execute_batch(bencher, 64, true); +fn bench_execute_batch_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch(bencher, 1, false); } #[bench] -fn bench_execute_batch_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 1, false); +fn bench_execute_batch_tx2_batch_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch(bencher, 2, false); } #[bench] From e335046f94cda3ff941641b77c473003e47aaebb Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:50:04 +0000 Subject: [PATCH 030/163] save --- ledger/benches/blockstore_processor.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index c852b1c1f7b..734cf1bfa5a 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -150,21 +150,36 @@ fn bench_execute_batch( } #[bench] -fn bench_execute_batch_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { +fn bench_execute_batch_01_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 1, false); } #[bench] -fn bench_execute_batch_tx2_batch_disable_tx_cost_update(bencher: &mut Bencher) { +fn bench_execute_batch_02_tx2_batch_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 2, false); } #[bench] -fn bench_execute_batch_half_batch_disable_tx_cost_update(bencher: &mut Bencher) { +fn bench_execute_batch_04_tx4_batch_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch(bencher, 4, false); +} + +#[bench] +fn bench_execute_batch_08_tx8_batch_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch(bencher, 8, false); +} + +#[bench] +fn bench_execute_batch_16_tx8_batch_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch(bencher, 16, false); +} + +#[bench] +fn bench_execute_batch_32_half_batch_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 32, false); } #[bench] -fn bench_execute_batch_full_batch_disable_tx_cost_update(bencher: &mut Bencher) { +fn bench_execute_batch_64_full_batch_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 64, false); } From be76a2c05cafd57571ac1855993ffaf4a0f5af21 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:50:14 +0000 Subject: [PATCH 031/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 734cf1bfa5a..e2d1ce419f8 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -146,7 +146,7 @@ fn bench_execute_batch( ).unwrap(); } }); - eprintln!("{:?}", timing); + //eprintln!("{:?}", timing); } #[bench] From 3d07af94091c35e37e96272a93dc8484227c6332 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:52:24 +0000 Subject: [PATCH 032/163] save --- runtime/src/bank.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 510a8541cf9..c0e2b161c47 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5074,7 +5074,7 @@ impl Bank { debug!("processing transactions: {}", sanitized_txs.len()); let mut error_counters = TransactionErrorMetrics::default(); - let retryable_transaction_indexes: Vec<_> = batch + let retryable_transaction_indexes: Vec<_> = vec![]; /*batch .lock_results() .iter() .enumerate() @@ -5109,6 +5109,7 @@ impl Bank { Ok(_) => None, }) .collect(); + */ let mut check_time = Measure::start("check_transactions"); let mut check_results = self.check_transactions( From 9d520e90a9a015f317c28fe7f4f7cea369f0db9b Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:56:39 +0000 Subject: [PATCH 033/163] save --- runtime/src/bank.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index c0e2b161c47..9a03af17a42 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5368,6 +5368,24 @@ impl Bank { } } + #[allow(clippy::type_complexity)] + pub fn load_and_execute_transactions2( + &self, + batch: &TransactionBatch, + max_age: usize, + enable_cpi_recording: bool, + enable_log_recording: bool, + enable_return_data_recording: bool, + timings: &mut ExecuteTimings, + account_overrides: Option<&AccountOverrides>, + log_messages_bytes_limit: Option, + ) -> LoadAndExecuteTransactionsOutput { + let sanitized_txs = batch.sanitized_transactions(); + for sanitized_tx in sanitized_txs { + } + todo!(); + } + /// The maximum allowed size, in bytes, of the accounts data pub fn accounts_data_size_limit(&self) -> u64 { MAX_ACCOUNTS_DATA_LEN From 8d58e9b8604fcfbab534c8e49ca5c0e556890887 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:57:37 +0000 Subject: [PATCH 034/163] save --- runtime/src/bank.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9a03af17a42..2cf67830461 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5382,6 +5382,9 @@ impl Bank { ) -> LoadAndExecuteTransactionsOutput { let sanitized_txs = batch.sanitized_transactions(); for sanitized_tx in sanitized_txs { + let hash_queue = self.blockhash_queue.read().unwrap(); + let last_blockhash = hash_queue.last_hash(); + let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); } todo!(); } From 943a84be83addcc89463aa068e4febc077b180e8 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:58:22 +0000 Subject: [PATCH 035/163] save --- runtime/src/bank.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 2cf67830461..5a69999dc9d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5385,6 +5385,13 @@ impl Bank { let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); + self.check_transaction_age( + sanitized_tx.borrow(), + max_age, + &next_durable_nonce, + &hash_queue, + error_counters, + ).unwrap(); } todo!(); } From 64e2d1b6728a2b0df39780d49fd25edde7d4cd25 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:58:35 +0000 Subject: [PATCH 036/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 5a69999dc9d..4f79dfc9807 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5386,7 +5386,7 @@ impl Bank { let last_blockhash = hash_queue.last_hash(); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); self.check_transaction_age( - sanitized_tx.borrow(), + &sanitized_tx, max_age, &next_durable_nonce, &hash_queue, From 999267c86d2fc541c470d446a48752610bb29725 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:58:50 +0000 Subject: [PATCH 037/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 4f79dfc9807..6db715f8c19 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5391,7 +5391,7 @@ impl Bank { &next_durable_nonce, &hash_queue, error_counters, - ).unwrap(); + ).0.unwrap(); } todo!(); } From 1dfeff8a08ac655b46a7ccfd3492bdbd462966de Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:59:15 +0000 Subject: [PATCH 038/163] save --- runtime/src/bank.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6db715f8c19..a736dae2b7a 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5381,6 +5381,7 @@ impl Bank { log_messages_bytes_limit: Option, ) -> LoadAndExecuteTransactionsOutput { let sanitized_txs = batch.sanitized_transactions(); + let mut error_counters = TransactionErrorMetrics::default(); for sanitized_tx in sanitized_txs { let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); From 4a0b6ef885e6c63325650570442a674ce624fca5 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 13:59:29 +0000 Subject: [PATCH 039/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index a736dae2b7a..df903602a30 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5391,7 +5391,7 @@ impl Bank { max_age, &next_durable_nonce, &hash_queue, - error_counters, + &mut error_counters, ).0.unwrap(); } todo!(); From bf53020e0c8732736cd2bed21e26d6373fcecca2 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:00:37 +0000 Subject: [PATCH 040/163] save --- runtime/src/bank.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index df903602a30..6d8620b633d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5379,7 +5379,7 @@ impl Bank { timings: &mut ExecuteTimings, account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, - ) -> LoadAndExecuteTransactionsOutput { + ) { let sanitized_txs = batch.sanitized_transactions(); let mut error_counters = TransactionErrorMetrics::default(); for sanitized_tx in sanitized_txs { @@ -5394,7 +5394,6 @@ impl Bank { &mut error_counters, ).0.unwrap(); } - todo!(); } /// The maximum allowed size, in bytes, of the accounts data From 05e0275d05e1d04c116056cc1c1eaef7b6c0650d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:01:58 +0000 Subject: [PATCH 041/163] save --- runtime/src/bank.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6d8620b633d..b7d1a144174 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5069,7 +5069,7 @@ impl Bank { timings: &mut ExecuteTimings, account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, - ) -> LoadAndExecuteTransactionsOutput { + ) { let sanitized_txs = batch.sanitized_transactions(); debug!("processing transactions: {}", sanitized_txs.len()); let mut error_counters = TransactionErrorMetrics::default(); @@ -5356,16 +5356,6 @@ impl Bank { *err_count + executed_with_successful_result_count ); } - LoadAndExecuteTransactionsOutput { - loaded_transactions, - execution_results, - retryable_transaction_indexes, - executed_transactions_count, - executed_non_vote_transactions_count, - executed_with_successful_result_count, - signature_count, - error_counters, - } } #[allow(clippy::type_complexity)] From 8e9c45c7af0be8463b262c3ba12ed117f7993800 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:02:28 +0000 Subject: [PATCH 042/163] save --- runtime/src/bank.rs | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index b7d1a144174..9850297f7ae 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6294,22 +6294,14 @@ impl Bank { enable_return_data_recording: bool, timings: &mut ExecuteTimings, log_messages_bytes_limit: Option, - ) -> (TransactionResults, TransactionBalancesSet) { + ) { let pre_balances = if collect_balances { self.collect_balances(batch) } else { vec![] }; - let LoadAndExecuteTransactionsOutput { - mut loaded_transactions, - execution_results, - executed_transactions_count, - executed_non_vote_transactions_count, - executed_with_successful_result_count, - signature_count, - .. - } = self.load_and_execute_transactions( + self.load_and_execute_transactions( batch, max_age, enable_cpi_recording, @@ -6319,34 +6311,6 @@ impl Bank { None, log_messages_bytes_limit, ); - - let (last_blockhash, lamports_per_signature) = - self.last_blockhash_and_lamports_per_signature(); - let results = self.commit_transactions( - batch.sanitized_transactions(), - &mut loaded_transactions, - execution_results, - last_blockhash, - lamports_per_signature, - CommitTransactionCounts { - committed_transactions_count: executed_transactions_count as u64, - committed_non_vote_transactions_count: executed_non_vote_transactions_count as u64, - committed_with_failure_result_count: executed_transactions_count - .saturating_sub(executed_with_successful_result_count) - as u64, - signature_count, - }, - timings, - ); - let post_balances = if collect_balances { - self.collect_balances(batch) - } else { - vec![] - }; - ( - results, - TransactionBalancesSet::new(pre_balances, post_balances), - ) } /// Process a Transaction. This is used for unit tests and simply calls the vector From 8ce6fa89a7bf34d466eb7632918fee15c97c0411 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:02:52 +0000 Subject: [PATCH 043/163] save --- runtime/src/bank.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9850297f7ae..834cacd0cb9 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6329,30 +6329,7 @@ impl Bank { &self, tx: impl Into, ) -> TransactionExecutionResult { - let txs = vec![tx.into()]; - let batch = match self.prepare_entry_batch(txs) { - Ok(batch) => batch, - Err(err) => return TransactionExecutionResult::NotExecuted(err), - }; - - let ( - TransactionResults { - mut execution_results, - .. - }, - .., - ) = self.load_execute_and_commit_transactions( - &batch, - MAX_PROCESSING_AGE, - false, // collect_balances - false, // enable_cpi_recording - true, // enable_log_recording - true, // enable_return_data_recording - &mut ExecuteTimings::default(), - Some(1000 * 1000), - ); - - execution_results.remove(0) + todo!(); } /// Process multiple transaction in a single batch. This is used for benches and unit tests. From e34dd75df20bb7c62b93495c0c0288cc8d58adbd Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:03:10 +0000 Subject: [PATCH 044/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 834cacd0cb9..bd7f4e8c24f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5074,7 +5074,7 @@ impl Bank { debug!("processing transactions: {}", sanitized_txs.len()); let mut error_counters = TransactionErrorMetrics::default(); - let retryable_transaction_indexes: Vec<_> = vec![]; /*batch + /*let retryable_transaction_indexes: Vec<_> = batch .lock_results() .iter() .enumerate() From 8ee42f86f5c78d777e49f257f2536adb76fafc80 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:03:35 +0000 Subject: [PATCH 045/163] save --- runtime/src/bank.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index bd7f4e8c24f..326861d84de 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6356,18 +6356,7 @@ impl Bank { #[must_use] fn process_transaction_batch(&self, batch: &TransactionBatch) -> Vec> { - self.load_execute_and_commit_transactions( - batch, - MAX_PROCESSING_AGE, - false, - false, - false, - false, - &mut ExecuteTimings::default(), - None, - ) - .0 - .fee_collection_results + todo!(); } /// Create, sign, and process a Transaction from `keypair` to `to` of From 575c25ac94b6cff5e5e43e297baa43601fdff7b3 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:03:51 +0000 Subject: [PATCH 046/163] save --- runtime/src/bank.rs | 72 +-------------------------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 326861d84de..d1e1d5edfef 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4262,77 +4262,7 @@ impl Bank { transaction: &SanitizedTransaction, enable_cpi_recording: bool, ) -> TransactionSimulationResult { - let account_keys = transaction.message().account_keys(); - let number_of_accounts = account_keys.len(); - let account_overrides = self.get_account_overrides_for_simulation(&account_keys); - let batch = self.prepare_unlocked_batch_from_single_tx(transaction); - let mut timings = ExecuteTimings::default(); - - let LoadAndExecuteTransactionsOutput { - loaded_transactions, - mut execution_results, - .. - } = self.load_and_execute_transactions( - &batch, - // After simulation, transactions will need to be forwarded to the leader - // for processing. During forwarding, the transaction could expire if the - // delay is not accounted for. - MAX_PROCESSING_AGE - MAX_TRANSACTION_FORWARDING_DELAY, - enable_cpi_recording, - true, - true, - &mut timings, - Some(&account_overrides), - None, - ); - - let post_simulation_accounts = loaded_transactions - .into_iter() - .next() - .unwrap() - .0 - .ok() - .map(|loaded_transaction| { - loaded_transaction - .accounts - .into_iter() - .take(number_of_accounts) - .collect::>() - }) - .unwrap_or_default(); - - let units_consumed = - timings - .details - .per_program_timings - .iter() - .fold(0, |acc: u64, (_, program_timing)| { - acc.saturating_add(program_timing.accumulated_units) - .saturating_add(program_timing.total_errored_units) - }); - - debug!("simulate_transaction: {:?}", timings); - - let execution_result = execution_results.pop().unwrap(); - let flattened_result = execution_result.flattened_result(); - let (logs, return_data, inner_instructions) = match execution_result { - TransactionExecutionResult::Executed { details, .. } => ( - details.log_messages, - details.return_data, - details.inner_instructions, - ), - TransactionExecutionResult::NotExecuted(_) => (None, None, None), - }; - let logs = logs.unwrap_or_default(); - - TransactionSimulationResult { - result: flattened_result, - logs, - post_simulation_accounts, - units_consumed, - return_data, - inner_instructions, - } + todo!(); } fn get_account_overrides_for_simulation(&self, account_keys: &AccountKeys) -> AccountOverrides { From ba8b9c835b26017730eca1ae05dfe7121fd7689c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:04:38 +0000 Subject: [PATCH 047/163] save --- ledger/src/blockstore_processor.rs | 48 ++---------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index cc8a4e5cb60..66720e08c94 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -157,7 +157,7 @@ pub fn execute_batch( vec![] }; - let (tx_results, balances) = batch.bank().load_execute_and_commit_transactions( + batch.bank().load_execute_and_commit_transactions( batch, MAX_PROCESSING_AGE, transaction_status_sender.is_some(), @@ -168,51 +168,7 @@ pub fn execute_batch( log_messages_bytes_limit, ); - bank_utils::find_and_send_votes( - batch.sanitized_transactions(), - &tx_results, - replay_vote_sender, - ); - - let TransactionResults { - fee_collection_results, - execution_results, - rent_debits, - .. - } = tx_results; - - let executed_transactions = execution_results - .iter() - .zip(batch.sanitized_transactions()) - .filter_map(|(execution_result, tx)| execution_result.was_executed().then_some(tx)) - .collect_vec(); - - if let Some(transaction_status_sender) = transaction_status_sender { - let transactions = batch.sanitized_transactions().to_vec(); - let post_token_balances = if record_token_balances { - collect_token_balances(bank, batch, &mut mint_decimals) - } else { - vec![] - }; - - let token_balances = - TransactionTokenBalancesSet::new(pre_token_balances, post_token_balances); - - transaction_status_sender.send_transaction_status_batch( - bank.clone(), - transactions, - execution_results, - balances, - token_balances, - rent_debits, - transaction_indexes.to_vec(), - ); - } - - prioritization_fee_cache.update(bank, executed_transactions.into_iter()); - - let first_err = get_first_error(batch, fee_collection_results); - first_err.map(|(result, _)| result).unwrap_or(Ok(())) + Ok(()); } #[derive(Default)] From e12eac8a8a4716c9bdc1f9b37491f16664ba3069 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:04:50 +0000 Subject: [PATCH 048/163] save --- ledger/src/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 66720e08c94..90e7dce4e4a 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -168,7 +168,7 @@ pub fn execute_batch( log_messages_bytes_limit, ); - Ok(()); + Ok(()) } #[derive(Default)] From 645739bb1b648381ed180315888817a3e0d8ae46 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:05:16 +0000 Subject: [PATCH 049/163] save --- ledger/src/blockstore_processor.rs | 49 +----------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 90e7dce4e4a..a44a7e6d412 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -3870,54 +3870,7 @@ pub mod tests { #[test] fn test_get_first_error() { - let GenesisConfigInfo { - genesis_config, - mint_keypair, - .. - } = create_genesis_config(1_000_000_000); - let bank = Bank::new_with_bank_forks_for_tests(&genesis_config).0; - - let present_account_key = Keypair::new(); - let present_account = AccountSharedData::new(1, 10, &Pubkey::default()); - bank.store_account(&present_account_key.pubkey(), &present_account); - - let keypair = Keypair::new(); - - // Create array of two transactions which throw different errors - let account_not_found_tx = system_transaction::transfer( - &keypair, - &solana_sdk::pubkey::new_rand(), - 42, - bank.last_blockhash(), - ); - let account_not_found_sig = account_not_found_tx.signatures[0]; - let invalid_blockhash_tx = system_transaction::transfer( - &mint_keypair, - &solana_sdk::pubkey::new_rand(), - 42, - Hash::default(), - ); - let txs = vec![account_not_found_tx, invalid_blockhash_tx]; - let batch = bank.prepare_batch_for_tests(txs); - let ( - TransactionResults { - fee_collection_results, - .. - }, - _balances, - ) = batch.bank().load_execute_and_commit_transactions( - &batch, - MAX_PROCESSING_AGE, - false, - false, - false, - false, - &mut ExecuteTimings::default(), - None, - ); - let (err, signature) = get_first_error(&batch, fee_collection_results).unwrap(); - assert_eq!(err.unwrap_err(), TransactionError::AccountNotFound); - assert_eq!(signature, account_not_found_sig); + todo!(); } #[test] From d2f0cf95283353a5f30d0ad50ecc0d91d1caaac0 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:08:31 +0000 Subject: [PATCH 050/163] save --- ledger/benches/blockstore_processor.rs | 51 ++++++++++++++++++++++++++ ledger/src/blockstore_processor.rs | 37 +++++++++++++++++++ runtime/src/bank.rs | 30 +++++++++++++++ 3 files changed, 118 insertions(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index e2d1ce419f8..0d805a173aa 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -149,11 +149,62 @@ fn bench_execute_batch( //eprintln!("{:?}", timing); } +fn bench_execute_batch2( + bencher: &mut Bencher, + batch_size: usize, + apply_cost_tracker_during_replay: bool, +) { + let BenchFrame { + bank, + prioritization_fee_cache, + } = setup(apply_cost_tracker_during_replay); + let transactions = create_transactions(&bank, 2_usize.pow(20)); + let bank2 = bank.clone(); + let batches: Vec<_> = transactions + .chunks(batch_size) + .map(|txs| { + let mut batch = + TransactionBatch::new(vec![Ok(()); txs.len()], &bank2, Cow::Borrowed(txs)); + batch.set_needs_unlock(false); + TransactionBatchWithIndexes { + batch, + transaction_indexes: (0..batch_size).collect(), + } + }) + .collect(); + let mut batches_iter = batches.into_iter(); + + let mut timing = ExecuteTimings::default(); + //eprintln!("profile me!: {}", std::process::id()); + //std::thread::sleep(std::time::Duration::from_secs(10)); + + bencher.iter(|| { + for _ in 0..(64/batch_size) { + let batch = batches_iter.next().unwrap(); + execute_batch2( + &batch, + &bank, + None, + None, + &mut timing, + None, + &prioritization_fee_cache, + ).unwrap(); + } + }); + //eprintln!("{:?}", timing); +} + #[bench] fn bench_execute_batch_01_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 1, false); } +#[bench] +fn bench_execute_batch_00000_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 1, false); +} + #[bench] fn bench_execute_batch_02_tx2_batch_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 2, false); diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index a44a7e6d412..4eaf80e29ea 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -171,6 +171,43 @@ pub fn execute_batch( Ok(()) } +pub fn execute_batch2( + batch: &TransactionBatchWithIndexes, + bank: &Arc, + transaction_status_sender: Option<&TransactionStatusSender>, + replay_vote_sender: Option<&ReplayVoteSender>, + timings: &mut ExecuteTimings, + log_messages_bytes_limit: Option, + prioritization_fee_cache: &PrioritizationFeeCache, +) -> Result<()> { + let TransactionBatchWithIndexes { + batch, + transaction_indexes, + } = batch; + let record_token_balances = transaction_status_sender.is_some(); + + let mut mint_decimals: HashMap = HashMap::new(); + + let pre_token_balances = if record_token_balances { + collect_token_balances(bank, batch, &mut mint_decimals) + } else { + vec![] + }; + + batch.bank().load_execute_and_commit_transactions2( + batch, + MAX_PROCESSING_AGE, + transaction_status_sender.is_some(), + transaction_status_sender.is_some(), + transaction_status_sender.is_some(), + transaction_status_sender.is_some(), + timings, + log_messages_bytes_limit, + ); + + Ok(()) +} + #[derive(Default)] pub struct ExecuteBatchesInternalMetrics { execution_timings_per_thread: HashMap, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d1e1d5edfef..9675935b647 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6243,6 +6243,36 @@ impl Bank { ); } + #[must_use] + pub fn load_execute_and_commit_transactions2( + &self, + batch: &TransactionBatch, + max_age: usize, + collect_balances: bool, + enable_cpi_recording: bool, + enable_log_recording: bool, + enable_return_data_recording: bool, + timings: &mut ExecuteTimings, + log_messages_bytes_limit: Option, + ) { + let pre_balances = if collect_balances { + self.collect_balances(batch) + } else { + vec![] + }; + + self.load_and_execute_transactions2( + batch, + max_age, + enable_cpi_recording, + enable_log_recording, + enable_return_data_recording, + timings, + None, + log_messages_bytes_limit, + ); + } + /// Process a Transaction. This is used for unit tests and simply calls the vector /// Bank::process_transactions method. pub fn process_transaction(&self, tx: &Transaction) -> Result<()> { From 478dfcbbeeaed6147e6b123835300609ac201112 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:09:25 +0000 Subject: [PATCH 051/163] save --- ledger/benches/blockstore_processor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 0d805a173aa..94e185cc743 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -23,6 +23,7 @@ use { std::{borrow::Cow, sync::Arc}, test::Bencher, }; +use solana_ledger::blockstore_processor::execute_batch2; extern crate test; From 22f42364106324fa4435cf0b51ffdddc75ec7bed Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:11:22 +0000 Subject: [PATCH 052/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 94e185cc743..b0c1293e9fe 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -159,7 +159,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(20)); + let transactions = create_transactions(&bank, 2_usize.pow(24)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) From 84f7544c0d990588fc724a2541acccc676f7a633 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:13:59 +0000 Subject: [PATCH 053/163] save --- runtime/src/bank.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9675935b647..d419009c5e4 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5313,6 +5313,7 @@ impl Bank { &hash_queue, &mut error_counters, ).0.unwrap(); + std::thread::sleep(std::time::Duration::from_millis(100)); } } From 2ff975f1778823c50b52e872b44dd0ecb52a48e2 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:15:28 +0000 Subject: [PATCH 054/163] save --- ledger/benches/blockstore_processor.rs | 2 +- runtime/src/bank.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index b0c1293e9fe..94e185cc743 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -159,7 +159,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(24)); + let transactions = create_transactions(&bank, 2_usize.pow(20)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d419009c5e4..5886dbdcd0b 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5313,6 +5313,11 @@ impl Bank { &hash_queue, &mut error_counters, ).0.unwrap(); + let rcache = self.status_cache.read().unwrap(); + if self.is_transaction_already_processed(sanitized_tx, &rcache) + { + panic!(); + } std::thread::sleep(std::time::Duration::from_millis(100)); } } From 23a98dc8b3f324ca5672410ba201d6d14ab1a413 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:16:26 +0000 Subject: [PATCH 055/163] save --- runtime/src/bank.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 5886dbdcd0b..c8cfce1aae7 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5318,6 +5318,21 @@ impl Bank { { panic!(); } + let mut program_accounts_map = self.filter_executable_program_accounts( + &self.ancestors, + sanitized_txs, + &mut check_results, + PROGRAM_OWNERS, + &hash_queue, + ); + let native_loader = native_loader::id(); + for builtin_program in self.builtin_programs.iter() { + program_accounts_map.insert(*builtin_program, (&native_loader, 0)); + } + + let programs_loaded_for_tx_batch = Rc::new(RefCell::new( + self.replenish_program_cache(&program_accounts_map), + )); std::thread::sleep(std::time::Duration::from_millis(100)); } } From 93480e18ffc55f851c6e2a470f07f4b447d99f02 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:16:43 +0000 Subject: [PATCH 056/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index c8cfce1aae7..548669fb300 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5321,7 +5321,7 @@ impl Bank { let mut program_accounts_map = self.filter_executable_program_accounts( &self.ancestors, sanitized_txs, - &mut check_results, + &mut [], PROGRAM_OWNERS, &hash_queue, ); From dd18856ba1a0a8da7afca87f4dcdb94bb5c89bb6 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:19:21 +0000 Subject: [PATCH 057/163] save --- runtime/src/bank.rs | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 548669fb300..686d2ed095f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5333,7 +5333,46 @@ impl Bank { let programs_loaded_for_tx_batch = Rc::new(RefCell::new( self.replenish_program_cache(&program_accounts_map), )); - std::thread::sleep(std::time::Duration::from_millis(100)); + let lamports_per_signature = nonce + .as_ref() + .map(|nonce| nonce.lamports_per_signature()) + .unwrap_or_else(|| { + hash_queue.get_lamports_per_signature(tx.message().recent_blockhash()) + }); + let fee = if let Some(lamports_per_signature) = lamports_per_signature { + fee_structure.calculate_fee( + tx.message(), + lamports_per_signature, + &process_compute_budget_instructions( + tx.message().program_instructions_iter(), + ) + .unwrap_or_default() + .into(), + feature_set + .is_active(&include_loaded_accounts_data_size_in_fee_calculation::id()), + ) + } else { + return (Err(TransactionError::BlockhashNotFound), None); + }; + + // load transactions + let loaded_transaction = match load_transaction_accounts( + accounts_db, + ancestors, + tx, + fee, + error_counters, + rent_collector, + feature_set, + account_overrides, + in_reward_interval, + program_accounts, + loaded_programs, + should_collect_rent, + ) { + Ok(loaded_transaction) => loaded_transaction, + Err(e) => return (Err(e), None), + }; } } From 71620a6c63089b60d3a51a1ccf3935df706544e4 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:20:12 +0000 Subject: [PATCH 058/163] save --- runtime/src/bank.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 686d2ed095f..1b7af3640f9 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5333,18 +5333,19 @@ impl Bank { let programs_loaded_for_tx_batch = Rc::new(RefCell::new( self.replenish_program_cache(&program_accounts_map), )); + let nonce = None; let lamports_per_signature = nonce .as_ref() .map(|nonce| nonce.lamports_per_signature()) .unwrap_or_else(|| { - hash_queue.get_lamports_per_signature(tx.message().recent_blockhash()) + hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()) }); let fee = if let Some(lamports_per_signature) = lamports_per_signature { fee_structure.calculate_fee( - tx.message(), + sanitized_tx.message(), lamports_per_signature, &process_compute_budget_instructions( - tx.message().program_instructions_iter(), + sanitized_tx.message().program_instructions_iter(), ) .unwrap_or_default() .into(), @@ -5359,7 +5360,7 @@ impl Bank { let loaded_transaction = match load_transaction_accounts( accounts_db, ancestors, - tx, + sanitized_tx, fee, error_counters, rent_collector, From b5e5f1ecbb575f464fd1c8ce4adbecb4fac6dea1 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:20:33 +0000 Subject: [PATCH 059/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 1b7af3640f9..3b8763b339e 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5353,7 +5353,7 @@ impl Bank { .is_active(&include_loaded_accounts_data_size_in_fee_calculation::id()), ) } else { - return (Err(TransactionError::BlockhashNotFound), None); + panic!(); }; // load transactions From 0879a933a3163077edab86f8d4228978f6a29f38 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:20:46 +0000 Subject: [PATCH 060/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 3b8763b339e..fa92fe4ecf7 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5372,7 +5372,7 @@ impl Bank { should_collect_rent, ) { Ok(loaded_transaction) => loaded_transaction, - Err(e) => return (Err(e), None), + Err(e) => panic!(); }; } } From 84a4d8855d318a4bb1f474e2b83b17abb21c2756 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:21:10 +0000 Subject: [PATCH 061/163] save --- runtime/src/bank.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index fa92fe4ecf7..02c0a43df5f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5334,12 +5334,7 @@ impl Bank { self.replenish_program_cache(&program_accounts_map), )); let nonce = None; - let lamports_per_signature = nonce - .as_ref() - .map(|nonce| nonce.lamports_per_signature()) - .unwrap_or_else(|| { - hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()) - }); + let lamports_per_signature = hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { fee_structure.calculate_fee( sanitized_tx.message(), From 2a54ddff3112b113712efc1a800b7dd51476d64b Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:21:53 +0000 Subject: [PATCH 062/163] save --- runtime/src/bank.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 02c0a43df5f..6f03b4490ad 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5336,7 +5336,7 @@ impl Bank { let nonce = None; let lamports_per_signature = hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { - fee_structure.calculate_fee( + self.fee_structure.calculate_fee( sanitized_tx.message(), lamports_per_signature, &process_compute_budget_instructions( @@ -5344,7 +5344,7 @@ impl Bank { ) .unwrap_or_default() .into(), - feature_set + self.feature_set .is_active(&include_loaded_accounts_data_size_in_fee_calculation::id()), ) } else { @@ -5367,7 +5367,7 @@ impl Bank { should_collect_rent, ) { Ok(loaded_transaction) => loaded_transaction, - Err(e) => panic!(); + Err(e) => panic!(), }; } } From 440fb2228faf351aa4d465e9bc94886000cfe77f Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:22:12 +0000 Subject: [PATCH 063/163] save --- runtime/src/bank.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6f03b4490ad..cd3cd3cc3e1 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5358,8 +5358,8 @@ impl Bank { sanitized_tx, fee, error_counters, - rent_collector, - feature_set, + self.rent_collector, + self.feature_set, account_overrides, in_reward_interval, program_accounts, From 7bbba8cfa6a17c9355105abc0c245e2daeb7eac9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:22:27 +0000 Subject: [PATCH 064/163] save --- runtime/src/bank.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index cd3cd3cc3e1..d67170ff676 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5353,8 +5353,8 @@ impl Bank { // load transactions let loaded_transaction = match load_transaction_accounts( - accounts_db, - ancestors, + self.accounts_db, + self.ancestors, sanitized_tx, fee, error_counters, From 68c052647e86ffe1efaff15f556f26e0947612b7 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:22:34 +0000 Subject: [PATCH 065/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d67170ff676..a3f60b4b228 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5353,7 +5353,7 @@ impl Bank { // load transactions let loaded_transaction = match load_transaction_accounts( - self.accounts_db, + self.rc.accounts.accounts_db, self.ancestors, sanitized_tx, fee, From 24817d281bad25d16b1525cd01a78c011800bbc9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:23:03 +0000 Subject: [PATCH 066/163] save --- runtime/src/accounts/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/accounts/mod.rs b/runtime/src/accounts/mod.rs index ef801be65ab..4639605723b 100644 --- a/runtime/src/accounts/mod.rs +++ b/runtime/src/accounts/mod.rs @@ -134,7 +134,7 @@ pub(super) fn load_accounts( } #[allow(clippy::too_many_arguments)] -fn load_transaction_accounts( +pub(super) fn load_transaction_accounts( accounts_db: &AccountsDb, ancestors: &Ancestors, tx: &SanitizedTransaction, From a50e8fa7c0753855d070bbc9f614e9a943f3796c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:23:18 +0000 Subject: [PATCH 067/163] save --- runtime/src/bank.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index a3f60b4b228..3eafa05d2d3 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5352,6 +5352,7 @@ impl Bank { }; // load transactions + use crate::accounts::load_transaction_accounts; let loaded_transaction = match load_transaction_accounts( self.rc.accounts.accounts_db, self.ancestors, From 55c8998ea2eafd0c86472f73c07affc5c0c1bc07 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:23:37 +0000 Subject: [PATCH 068/163] save --- runtime/src/bank.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 3eafa05d2d3..bb61358b031 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5355,12 +5355,12 @@ impl Bank { use crate::accounts::load_transaction_accounts; let loaded_transaction = match load_transaction_accounts( self.rc.accounts.accounts_db, - self.ancestors, + &self.ancestors, sanitized_tx, fee, error_counters, - self.rent_collector, - self.feature_set, + &self.rent_collector, + &self.feature_set, account_overrides, in_reward_interval, program_accounts, From e39626a44e46d08fdd54f206c1b65f4c883f08bf Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:23:57 +0000 Subject: [PATCH 069/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index bb61358b031..3c3468c5fea 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5358,7 +5358,7 @@ impl Bank { &self.ancestors, sanitized_tx, fee, - error_counters, + &mut error_counters, &self.rent_collector, &self.feature_set, account_overrides, From ed80b771a81cca1d5080d230c4787e9f56291b67 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:24:11 +0000 Subject: [PATCH 070/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 3c3468c5fea..0e1769d803b 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5354,7 +5354,7 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; let loaded_transaction = match load_transaction_accounts( - self.rc.accounts.accounts_db, + &self.rc.accounts.accounts_db, &self.ancestors, sanitized_tx, fee, From b68cd989ba8e6b902d6404df8c1bbc685d8f51a6 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:25:32 +0000 Subject: [PATCH 071/163] save --- runtime/src/bank.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 0e1769d803b..341f91fe1cf 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5353,6 +5353,7 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; + let in_reward_interval = self.get_reward_interval() == RewardInterval::InsideInterval; let loaded_transaction = match load_transaction_accounts( &self.rc.accounts.accounts_db, &self.ancestors, From 548330bc91951473565fd29661fc0479cb7d85e2 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:25:53 +0000 Subject: [PATCH 072/163] save --- runtime/src/bank.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 341f91fe1cf..321cb4d26cb 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5353,7 +5353,6 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; - let in_reward_interval = self.get_reward_interval() == RewardInterval::InsideInterval; let loaded_transaction = match load_transaction_accounts( &self.rc.accounts.accounts_db, &self.ancestors, @@ -5363,7 +5362,7 @@ impl Bank { &self.rent_collector, &self.feature_set, account_overrides, - in_reward_interval, + self.get_reward_interval(), program_accounts, loaded_programs, should_collect_rent, From 2b80f635bd6ca219b29ca5e16fbedc245c57ba0c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:26:09 +0000 Subject: [PATCH 073/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 321cb4d26cb..f9120581dd5 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5363,7 +5363,7 @@ impl Bank { &self.feature_set, account_overrides, self.get_reward_interval(), - program_accounts, + program_account_map, loaded_programs, should_collect_rent, ) { From c2388e33ecfd051d6fdbc4e97cba7fe715774e4f Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:27:09 +0000 Subject: [PATCH 074/163] save --- runtime/src/bank.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index f9120581dd5..899e20dbbb7 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5364,8 +5364,8 @@ impl Bank { account_overrides, self.get_reward_interval(), program_account_map, - loaded_programs, - should_collect_rent, + programs_loaded_for_tx_batch.borrow(), + self.should_collect_rent(), ) { Ok(loaded_transaction) => loaded_transaction, Err(e) => panic!(), From 75b245f2e5afcb585e8b2d19a1f033860e8a12dc Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:27:17 +0000 Subject: [PATCH 075/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 899e20dbbb7..e004845c433 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5363,7 +5363,7 @@ impl Bank { &self.feature_set, account_overrides, self.get_reward_interval(), - program_account_map, + &program_account_map, programs_loaded_for_tx_batch.borrow(), self.should_collect_rent(), ) { From 25b5c35646f03ee17a6dd4a575c10187b88ddcb3 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:27:23 +0000 Subject: [PATCH 076/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index e004845c433..97f7a0f3db3 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5363,7 +5363,7 @@ impl Bank { &self.feature_set, account_overrides, self.get_reward_interval(), - &program_account_map, + program_account_map.borrow(), programs_loaded_for_tx_batch.borrow(), self.should_collect_rent(), ) { From 760a56d09555cc6a248ab5656b89df7ee39c8525 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:27:44 +0000 Subject: [PATCH 077/163] save --- runtime/src/bank.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 97f7a0f3db3..6d482c58ecc 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5363,8 +5363,8 @@ impl Bank { &self.feature_set, account_overrides, self.get_reward_interval(), - program_account_map.borrow(), - programs_loaded_for_tx_batch.borrow(), + &program_account_map, + &programs_loaded_for_tx_batch.borrow(), self.should_collect_rent(), ) { Ok(loaded_transaction) => loaded_transaction, From 3a5fd7ef8818bfc3034b6fac83cb58f4d47500e0 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:27:51 +0000 Subject: [PATCH 078/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6d482c58ecc..22fd78266e1 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5363,7 +5363,7 @@ impl Bank { &self.feature_set, account_overrides, self.get_reward_interval(), - &program_account_map, + &program_accounts_map, &programs_loaded_for_tx_batch.borrow(), self.should_collect_rent(), ) { From 5c03919ef421cb008d03e8db26fb4d9839489a8d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:28:05 +0000 Subject: [PATCH 079/163] save --- runtime/src/bank.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 22fd78266e1..2c3be17fc22 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5333,7 +5333,6 @@ impl Bank { let programs_loaded_for_tx_batch = Rc::new(RefCell::new( self.replenish_program_cache(&program_accounts_map), )); - let nonce = None; let lamports_per_signature = hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { self.fee_structure.calculate_fee( From 839d0b648767a999d2e5f513151d9434ceb35d53 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:30:14 +0000 Subject: [PATCH 080/163] save --- runtime/src/accounts/mod.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/runtime/src/accounts/mod.rs b/runtime/src/accounts/mod.rs index 4639605723b..55ca2757bb7 100644 --- a/runtime/src/accounts/mod.rs +++ b/runtime/src/accounts/mod.rs @@ -70,12 +70,7 @@ pub(super) fn load_accounts( .zip(lock_results) .map(|etx| match etx { (tx, (Ok(()), nonce)) => { - let lamports_per_signature = nonce - .as_ref() - .map(|nonce| nonce.lamports_per_signature()) - .unwrap_or_else(|| { - hash_queue.get_lamports_per_signature(tx.message().recent_blockhash()) - }); + let lamports_per_signature = hash_queue.get_lamports_per_signature(tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { fee_structure.calculate_fee( tx.message(), From 43a23cc1cc94c04a02722b6d423250f0b15248fb Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:30:45 +0000 Subject: [PATCH 081/163] save --- runtime/src/accounts/mod.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/runtime/src/accounts/mod.rs b/runtime/src/accounts/mod.rs index 55ca2757bb7..fc1f63e7e60 100644 --- a/runtime/src/accounts/mod.rs +++ b/runtime/src/accounts/mod.rs @@ -106,21 +106,6 @@ pub(super) fn load_accounts( Err(e) => return (Err(e), None), }; - // Update nonce with fee-subtracted accounts - let nonce = if let Some(nonce) = nonce { - match NonceFull::from_partial( - nonce, - tx.message(), - &loaded_transaction.accounts, - &loaded_transaction.rent_debits, - ) { - Ok(nonce) => Some(nonce), - Err(e) => return (Err(e), None), - } - } else { - None - }; - (Ok(loaded_transaction), nonce) } (_, (Err(e), _nonce)) => (Err(e), None), From 6c4bb778705bb65b55a849765945ef1f4cc85fa3 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:32:27 +0000 Subject: [PATCH 082/163] save --- runtime/src/accounts/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/accounts/mod.rs b/runtime/src/accounts/mod.rs index fc1f63e7e60..2f7e5e7f5ad 100644 --- a/runtime/src/accounts/mod.rs +++ b/runtime/src/accounts/mod.rs @@ -106,7 +106,7 @@ pub(super) fn load_accounts( Err(e) => return (Err(e), None), }; - (Ok(loaded_transaction), nonce) + (Ok(loaded_transaction), None) } (_, (Err(e), _nonce)) => (Err(e), None), }) From 469773ac6f5a0afb008096cec03bab3e4c23472c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:34:03 +0000 Subject: [PATCH 083/163] save --- runtime/src/bank.rs | 136 -------------------------------------------- 1 file changed, 136 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 2c3be17fc22..3952feb2ead 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5150,142 +5150,6 @@ impl Bank { .collect(); execution_time.stop(); - - /* - const SHRINK_LOADED_PROGRAMS_TO_PERCENTAGE: u8 = 90; - self.loaded_programs_cache - .write() - .unwrap() - .evict_using_2s_random_selection( - Percentage::from(SHRINK_LOADED_PROGRAMS_TO_PERCENTAGE), - self.slot(), - ); - */ - - debug!( - "check: {}us load: {}us execute: {}us txs_len={}", - check_time.as_us(), - load_time.as_us(), - execution_time.as_us(), - sanitized_txs.len(), - ); - - timings.saturating_add_in_place(ExecuteTimingType::CheckUs, check_time.as_us()); - timings.saturating_add_in_place(ExecuteTimingType::LoadUs, load_time.as_us()); - timings.saturating_add_in_place(ExecuteTimingType::ExecuteUs, execution_time.as_us()); - - let mut executed_transactions_count: usize = 0; - let mut executed_non_vote_transactions_count: usize = 0; - let mut executed_with_successful_result_count: usize = 0; - let err_count = &mut error_counters.total; - let transaction_log_collector_config = - self.transaction_log_collector_config.read().unwrap(); - - let mut collect_logs_time = Measure::start("collect_logs_time"); - for (execution_result, tx) in execution_results.iter().zip(sanitized_txs) { - if let Some(debug_keys) = &self.transaction_debug_keys { - for key in tx.message().account_keys().iter() { - if debug_keys.contains(key) { - let result = execution_result.flattened_result(); - info!("slot: {} result: {:?} tx: {:?}", self.slot, result, tx); - break; - } - } - } - - let is_vote = tx.is_simple_vote_transaction(); - - if false && execution_result.was_executed() // Skip log collection for unprocessed transactions - && transaction_log_collector_config.filter != TransactionLogCollectorFilter::None - { - let mut filtered_mentioned_addresses = Vec::new(); - if !transaction_log_collector_config - .mentioned_addresses - .is_empty() - { - for key in tx.message().account_keys().iter() { - if transaction_log_collector_config - .mentioned_addresses - .contains(key) - { - filtered_mentioned_addresses.push(*key); - } - } - } - - let store = match transaction_log_collector_config.filter { - TransactionLogCollectorFilter::All => { - !is_vote || !filtered_mentioned_addresses.is_empty() - } - TransactionLogCollectorFilter::AllWithVotes => true, - TransactionLogCollectorFilter::None => false, - TransactionLogCollectorFilter::OnlyMentionedAddresses => { - !filtered_mentioned_addresses.is_empty() - } - }; - - if store { - if let Some(TransactionExecutionDetails { - status, - log_messages: Some(log_messages), - .. - }) = execution_result.details() - { - let mut transaction_log_collector = - self.transaction_log_collector.write().unwrap(); - let transaction_log_index = transaction_log_collector.logs.len(); - - transaction_log_collector.logs.push(TransactionLogInfo { - signature: *tx.signature(), - result: status.clone(), - is_vote, - log_messages: log_messages.clone(), - }); - for key in filtered_mentioned_addresses.into_iter() { - transaction_log_collector - .mentioned_address_map - .entry(key) - .or_default() - .push(transaction_log_index); - } - } - } - } - - if execution_result.was_executed() { - // Signature count must be accumulated only if the transaction - // is executed, otherwise a mismatched count between banking and - // replay could occur - signature_count += u64::from(tx.message().header().num_required_signatures); - executed_transactions_count += 1; - } - - match execution_result.flattened_result() { - Ok(()) => { - if !is_vote { - executed_non_vote_transactions_count += 1; - } - executed_with_successful_result_count += 1; - } - Err(err) => { - if *err_count == 0 { - debug!("tx error: {:?} {:?}", err, tx); - } - *err_count += 1; - } - } - } - collect_logs_time.stop(); - timings - .saturating_add_in_place(ExecuteTimingType::CollectLogsUs, collect_logs_time.as_us()); - - if *err_count > 0 { - debug!( - "{} errors of {} txs", - *err_count, - *err_count + executed_with_successful_result_count - ); - } } #[allow(clippy::type_complexity)] From a30933dcc07ca981f5e9526cfdf461177588e726 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:35:52 +0000 Subject: [PATCH 084/163] save --- runtime/src/bank.rs | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 3952feb2ead..84ba4123022 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5116,7 +5116,7 @@ impl Bank { maybe_compute_budget.unwrap() }; - let result = self.execute_loaded_transaction( + self.execute_loaded_transaction( tx, loaded_transaction, compute_budget, @@ -5129,22 +5129,6 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ); - - if let TransactionExecutionResult::Executed { - details, - programs_modified_by_tx, - } = &result - { - // Update batch specific cache of the loaded programs with the modifications - // made by the transaction, if it executed successfully. - if details.status.is_ok() { - programs_loaded_for_tx_batch - .borrow_mut() - .merge(programs_modified_by_tx); - } - } - - result } }) .collect(); @@ -5233,6 +5217,28 @@ impl Bank { Ok(loaded_transaction) => loaded_transaction, Err(e) => panic!(), }; + + let compute_budget = + if let Some(compute_budget) = self.runtime_config.compute_budget { + compute_budget + } else { + let mut compute_budget_process_transaction_time = + Measure::start("compute_budget_process_transaction_time"); + let maybe_compute_budget = ComputeBudget::try_from_instructions( + tx.message().program_instructions_iter(), + ); + compute_budget_process_transaction_time.stop(); + saturating_add_assign!( + timings + .execute_accessories + .compute_budget_process_transaction_us, + compute_budget_process_transaction_time.as_us() + ); + if let Err(err) = maybe_compute_budget { + return TransactionExecutionResult::NotExecuted(err); + } + maybe_compute_budget.unwrap() + }; } } From f4f19b95e3b5f42d7cba19e13451faff49e6881e Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:36:12 +0000 Subject: [PATCH 085/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 84ba4123022..6ed9dc3855d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5225,7 +5225,7 @@ impl Bank { let mut compute_budget_process_transaction_time = Measure::start("compute_budget_process_transaction_time"); let maybe_compute_budget = ComputeBudget::try_from_instructions( - tx.message().program_instructions_iter(), + sanitized_tx.message().program_instructions_iter(), ); compute_budget_process_transaction_time.stop(); saturating_add_assign!( From f8af3e2e9c661dffe02a72484acbb22829170ee0 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:36:50 +0000 Subject: [PATCH 086/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6ed9dc3855d..ee9132a45c8 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5128,7 +5128,7 @@ impl Bank { &mut error_counters, log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), - ); + ) } }) .collect(); From c25cc56f9095c96169acb19d80c011fc62fb61f9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:37:11 +0000 Subject: [PATCH 087/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index ee9132a45c8..d5691be9a28 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5235,7 +5235,7 @@ impl Bank { compute_budget_process_transaction_time.as_us() ); if let Err(err) = maybe_compute_budget { - return TransactionExecutionResult::NotExecuted(err); + panic!(); } maybe_compute_budget.unwrap() }; From 3e2dfc2c4fcea92e8d330f0c0340f9d2d2b1c263 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:37:33 +0000 Subject: [PATCH 088/163] save --- runtime/src/bank.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d5691be9a28..f534d1893a2 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5239,6 +5239,19 @@ impl Bank { } maybe_compute_budget.unwrap() }; + self.execute_loaded_transaction( + tx, + loaded_transaction, + compute_budget, + nonce.as_ref().map(DurableNonceFee::from), + enable_cpi_recording, + enable_log_recording, + enable_return_data_recording, + timings, + &mut error_counters, + log_messages_bytes_limit, + &programs_loaded_for_tx_batch.borrow(), + ) } } From ab0b460211cb4c8f5590221b5609b154962f8b6c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:37:45 +0000 Subject: [PATCH 089/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index f534d1893a2..18b3707ed2b 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5241,7 +5241,7 @@ impl Bank { }; self.execute_loaded_transaction( tx, - loaded_transaction, + &mut loaded_transaction, compute_budget, nonce.as_ref().map(DurableNonceFee::from), enable_cpi_recording, From adb79d889b51676029a7b9d0f46c04030d679fc9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:37:55 +0000 Subject: [PATCH 090/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 18b3707ed2b..6a8500b337d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5251,7 +5251,7 @@ impl Bank { &mut error_counters, log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), - ) + ); } } From 438ad49a02953eaf09df392b6d0a2482a26519eb Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:38:05 +0000 Subject: [PATCH 091/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6a8500b337d..f61d40e4b0d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5240,7 +5240,7 @@ impl Bank { maybe_compute_budget.unwrap() }; self.execute_loaded_transaction( - tx, + sanitized_tx, &mut loaded_transaction, compute_budget, nonce.as_ref().map(DurableNonceFee::from), From e7d3fba10a6994621e736d63d963ea0fd9592f4d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:38:18 +0000 Subject: [PATCH 092/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index f61d40e4b0d..8072e16a953 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5243,7 +5243,7 @@ impl Bank { sanitized_tx, &mut loaded_transaction, compute_budget, - nonce.as_ref().map(DurableNonceFee::from), + None.as_ref().map(DurableNonceFee::from), enable_cpi_recording, enable_log_recording, enable_return_data_recording, From a7bcb93d7a785a90ddbc1f373193b0fce4e1d041 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:38:38 +0000 Subject: [PATCH 093/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 8072e16a953..1671f02cfab 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5200,7 +5200,7 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; - let loaded_transaction = match load_transaction_accounts( + let mut loaded_transaction = match load_transaction_accounts( &self.rc.accounts.accounts_db, &self.ancestors, sanitized_tx, From 37ba7eb01421ae2dfe4eb50a61371c4624b252c9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:42:46 +0000 Subject: [PATCH 094/163] save --- ledger/benches/blockstore_processor.rs | 10 ++++++++++ runtime/src/bank.rs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 94e185cc743..52c79848971 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -206,6 +206,16 @@ fn bench_execute_batch_00000_unbatched_disable_tx_cost_update(bencher: &mut Benc bench_execute_batch2(bencher, 1, false); } +#[bench] +fn bench_execute_batch_00004_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 4, false); +} + +#[bench] +fn bench_execute_batch_00064_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 64, false); +} + #[bench] fn bench_execute_batch_02_tx2_batch_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch(bencher, 2, false); diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 1671f02cfab..7f377291d8f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5116,6 +5116,7 @@ impl Bank { maybe_compute_budget.unwrap() }; + /* self.execute_loaded_transaction( tx, loaded_transaction, @@ -5129,6 +5130,7 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ) + */ } }) .collect(); From 8825467c8d7f840926320b9624c655476897e27c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:43:33 +0000 Subject: [PATCH 095/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 7f377291d8f..9a5242e6169 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5088,7 +5088,7 @@ impl Bank { let mut execution_time = Measure::start("execution_time"); let mut signature_count: u64 = 0; - let execution_results: Vec = loaded_transactions + let execution_results: Vec<_> = loaded_transactions .iter_mut() .zip(sanitized_txs.iter()) .map(|(accs, tx)| match accs { From 74c604e8d745a88f5e45d6693befcc1cb1db199a Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:43:48 +0000 Subject: [PATCH 096/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 9a5242e6169..fc89156ddc5 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5092,7 +5092,7 @@ impl Bank { .iter_mut() .zip(sanitized_txs.iter()) .map(|(accs, tx)| match accs { - (Err(e), _nonce) => TransactionExecutionResult::NotExecuted(e.clone()), + (Err(e), _nonce) => todo!(), (Ok(loaded_transaction), nonce) => { let compute_budget = if let Some(compute_budget) = self.runtime_config.compute_budget { From dd0ee3088b7c1f11d6675b87ef25bdfc42115ada Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:44:06 +0000 Subject: [PATCH 097/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index fc89156ddc5..034aed4c901 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5111,7 +5111,7 @@ impl Bank { compute_budget_process_transaction_time.as_us() ); if let Err(err) = maybe_compute_budget { - return TransactionExecutionResult::NotExecuted(err); + panic!(); } maybe_compute_budget.unwrap() }; From 6a8ecd3be7976fa40613bddea0cbc47d4de8af86 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:49:19 +0000 Subject: [PATCH 098/163] save --- runtime/src/bank.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 034aed4c901..c984752ad68 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5241,6 +5241,7 @@ impl Bank { } maybe_compute_budget.unwrap() }; + /* self.execute_loaded_transaction( sanitized_tx, &mut loaded_transaction, @@ -5254,6 +5255,7 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ); + */ } } From a763bcf4f2ae36252ae567b3baab91d0735e6d08 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:51:51 +0000 Subject: [PATCH 099/163] save --- runtime/src/bank.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index c984752ad68..7a00b26663c 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5152,6 +5152,21 @@ impl Bank { ) { let sanitized_txs = batch.sanitized_transactions(); let mut error_counters = TransactionErrorMetrics::default(); + let mut program_accounts_map = self.filter_executable_program_accounts( + &self.ancestors, + sanitized_txs, + &mut [], + PROGRAM_OWNERS, + &hash_queue, + ); + let native_loader = native_loader::id(); + for builtin_program in self.builtin_programs.iter() { + program_accounts_map.insert(*builtin_program, (&native_loader, 0)); + } + + let programs_loaded_for_tx_batch = Rc::new(RefCell::new( + self.replenish_program_cache(&program_accounts_map), + )); for sanitized_tx in sanitized_txs { let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); @@ -5168,21 +5183,6 @@ impl Bank { { panic!(); } - let mut program_accounts_map = self.filter_executable_program_accounts( - &self.ancestors, - sanitized_txs, - &mut [], - PROGRAM_OWNERS, - &hash_queue, - ); - let native_loader = native_loader::id(); - for builtin_program in self.builtin_programs.iter() { - program_accounts_map.insert(*builtin_program, (&native_loader, 0)); - } - - let programs_loaded_for_tx_batch = Rc::new(RefCell::new( - self.replenish_program_cache(&program_accounts_map), - )); let lamports_per_signature = hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { self.fee_structure.calculate_fee( From e1b9bc239951a7c083b6216eaa2a83bf3c5bb302 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:52:09 +0000 Subject: [PATCH 100/163] save --- runtime/src/bank.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 7a00b26663c..71c20da79a7 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5150,6 +5150,7 @@ impl Bank { account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, ) { + let hash_queue = self.blockhash_queue.read().unwrap(); let sanitized_txs = batch.sanitized_transactions(); let mut error_counters = TransactionErrorMetrics::default(); let mut program_accounts_map = self.filter_executable_program_accounts( @@ -5167,8 +5168,8 @@ impl Bank { let programs_loaded_for_tx_batch = Rc::new(RefCell::new( self.replenish_program_cache(&program_accounts_map), )); + for sanitized_tx in sanitized_txs { - let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); self.check_transaction_age( From 042001623f4acae4bbffe22d93abd5b416dabb87 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:55:26 +0000 Subject: [PATCH 101/163] save --- runtime/src/bank.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 71c20da79a7..c385bc4ef77 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5150,21 +5150,6 @@ impl Bank { account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, ) { - let hash_queue = self.blockhash_queue.read().unwrap(); - let sanitized_txs = batch.sanitized_transactions(); - let mut error_counters = TransactionErrorMetrics::default(); - let mut program_accounts_map = self.filter_executable_program_accounts( - &self.ancestors, - sanitized_txs, - &mut [], - PROGRAM_OWNERS, - &hash_queue, - ); - let native_loader = native_loader::id(); - for builtin_program in self.builtin_programs.iter() { - program_accounts_map.insert(*builtin_program, (&native_loader, 0)); - } - let programs_loaded_for_tx_batch = Rc::new(RefCell::new( self.replenish_program_cache(&program_accounts_map), )); @@ -6204,6 +6189,21 @@ impl Bank { } else { vec![] }; + let hash_queue = self.blockhash_queue.read().unwrap(); + let sanitized_txs = batch.sanitized_transactions(); + let mut error_counters = TransactionErrorMetrics::default(); + let mut program_accounts_map = self.filter_executable_program_accounts( + &self.ancestors, + sanitized_txs, + &mut [], + PROGRAM_OWNERS, + &hash_queue, + ); + let native_loader = native_loader::id(); + for builtin_program in self.builtin_programs.iter() { + program_accounts_map.insert(*builtin_program, (&native_loader, 0)); + } + self.load_and_execute_transactions2( batch, From 3f21e4edb15c1106090d2065a7c4840ca82e89f8 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:56:18 +0000 Subject: [PATCH 102/163] save --- runtime/src/bank.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index c385bc4ef77..588051f09fb 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5150,9 +5150,7 @@ impl Bank { account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, ) { - let programs_loaded_for_tx_batch = Rc::new(RefCell::new( - self.replenish_program_cache(&program_accounts_map), - )); + let sanitized_txs = batch.sanitized_transactions(); for sanitized_tx in sanitized_txs { let last_blockhash = hash_queue.last_hash(); @@ -6189,8 +6187,8 @@ impl Bank { } else { vec![] }; + let hash_queue = self.blockhash_queue.read().unwrap(); - let sanitized_txs = batch.sanitized_transactions(); let mut error_counters = TransactionErrorMetrics::default(); let mut program_accounts_map = self.filter_executable_program_accounts( &self.ancestors, @@ -6204,7 +6202,9 @@ impl Bank { program_accounts_map.insert(*builtin_program, (&native_loader, 0)); } - + let programs_loaded_for_tx_batch = Rc::new(RefCell::new( + self.replenish_program_cache(&program_accounts_map), + )); self.load_and_execute_transactions2( batch, max_age, From 84806d2e142bd516299009d1831887c29cd0b962 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:56:36 +0000 Subject: [PATCH 103/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 588051f09fb..7e076016aa6 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6192,7 +6192,7 @@ impl Bank { let mut error_counters = TransactionErrorMetrics::default(); let mut program_accounts_map = self.filter_executable_program_accounts( &self.ancestors, - sanitized_txs, + &[], &mut [], PROGRAM_OWNERS, &hash_queue, From 102f6dcd32679440c71ebfafa80b44f0f4c17019 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:58:44 +0000 Subject: [PATCH 104/163] save --- runtime/src/bank.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 7e076016aa6..b9facd15845 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5149,6 +5149,10 @@ impl Bank { timings: &mut ExecuteTimings, account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, + hash_queue: usize, + error_counters: usize, + program_accounts_map: usize, + programs_loaded_for_tx_batch: usize, ) { let sanitized_txs = batch.sanitized_transactions(); @@ -6214,6 +6218,10 @@ impl Bank { timings, None, log_messages_bytes_limit, + hash_queue, + error_counters, + program_accounts_map, + programs_loaded_for_tx_batch, ); } From 959f9371278e3021e4d6e2f9521bdf1136a04292 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 14:59:54 +0000 Subject: [PATCH 105/163] save --- runtime/src/bank.rs | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index b9facd15845..0380e98306d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5149,10 +5149,6 @@ impl Bank { timings: &mut ExecuteTimings, account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option, - hash_queue: usize, - error_counters: usize, - program_accounts_map: usize, - programs_loaded_for_tx_batch: usize, ) { let sanitized_txs = batch.sanitized_transactions(); @@ -6192,23 +6188,6 @@ impl Bank { vec![] }; - let hash_queue = self.blockhash_queue.read().unwrap(); - let mut error_counters = TransactionErrorMetrics::default(); - let mut program_accounts_map = self.filter_executable_program_accounts( - &self.ancestors, - &[], - &mut [], - PROGRAM_OWNERS, - &hash_queue, - ); - let native_loader = native_loader::id(); - for builtin_program in self.builtin_programs.iter() { - program_accounts_map.insert(*builtin_program, (&native_loader, 0)); - } - - let programs_loaded_for_tx_batch = Rc::new(RefCell::new( - self.replenish_program_cache(&program_accounts_map), - )); self.load_and_execute_transactions2( batch, max_age, @@ -6218,10 +6197,6 @@ impl Bank { timings, None, log_messages_bytes_limit, - hash_queue, - error_counters, - program_accounts_map, - programs_loaded_for_tx_batch, ); } From 0c1c15e42ab7487c6ac0d71598c5ea2eb7a5625e Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:00:56 +0000 Subject: [PATCH 106/163] save --- runtime/src/bank.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 0380e98306d..abacd264c54 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5151,8 +5151,9 @@ impl Bank { log_messages_bytes_limit: Option, ) { let sanitized_txs = batch.sanitized_transactions(); - + let mut error_counters = TransactionErrorMetrics::default(); for sanitized_tx in sanitized_txs { + let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); self.check_transaction_age( @@ -5167,6 +5168,21 @@ impl Bank { { panic!(); } + let mut program_accounts_map = self.filter_executable_program_accounts( + &self.ancestors, + sanitized_txs, + &mut [], + PROGRAM_OWNERS, + &hash_queue, + ); + let native_loader = native_loader::id(); + for builtin_program in self.builtin_programs.iter() { + program_accounts_map.insert(*builtin_program, (&native_loader, 0)); + } + + let programs_loaded_for_tx_batch = Rc::new(RefCell::new( + 3 //self.replenish_program_cache(&program_accounts_map), + )); let lamports_per_signature = hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { self.fee_structure.calculate_fee( From 39da15998f4e34badb0987322bc7b62905876a09 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:03:57 +0000 Subject: [PATCH 107/163] save --- runtime/src/bank.rs | 76 +-------------------------------------------- 1 file changed, 1 insertion(+), 75 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index abacd264c54..fbfa98ef693 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4856,81 +4856,7 @@ impl Bank { &self, program_accounts_map: &HashMap, ) -> LoadedProgramsForTxBatch { - let mut missing_programs: Vec<(Pubkey, (LoadedProgramMatchCriteria, u64))> = - if self.check_program_modification_slot { - program_accounts_map - .iter() - .map(|(pubkey, (_, count))| { - ( - *pubkey, - ( - self.program_modification_slot(pubkey) - .map_or(LoadedProgramMatchCriteria::Tombstone, |slot| { - LoadedProgramMatchCriteria::DeployedOnOrAfterSlot(slot) - }), - *count, - ), - ) - }) - .collect() - } else { - program_accounts_map - .iter() - .map(|(pubkey, (_, count))| { - (*pubkey, (LoadedProgramMatchCriteria::NoCriteria, *count)) - }) - .collect() - }; - - let mut loaded_programs_for_txs = None; - let mut program_to_store = None; - loop { - let (program_to_load, task_cookie, task_waiter) = { - // Lock the global cache. - let mut loaded_programs_cache = self.loaded_programs_cache.write().unwrap(); - // Initialize our local cache. - if loaded_programs_for_txs.is_none() { - loaded_programs_for_txs = Some(LoadedProgramsForTxBatch::new( - self.slot, - loaded_programs_cache - .get_environments_for_epoch(self.epoch) - .clone(), - )); - } - // Submit our last completed loading task. - if let Some((key, program)) = program_to_store.take() { - loaded_programs_cache.finish_cooperative_loading_task( - self.slot(), - key, - program, - ); - } - // Figure out which program needs to be loaded next. - let program_to_load = loaded_programs_cache.extract( - &mut missing_programs, - loaded_programs_for_txs.as_mut().unwrap(), - ); - let task_waiter = Arc::clone(&loaded_programs_cache.loading_task_waiter); - (program_to_load, task_waiter.cookie(), task_waiter) - // Unlock the global cache again. - }; - - if let Some((key, count)) = program_to_load { - // Load, verify and compile one program. - let program = self.load_program(&key, false, None); - program.tx_usage_counter.store(count, Ordering::Relaxed); - program_to_store = Some((key, program)); - } else if missing_programs.is_empty() { - break; - } else { - // Sleep until the next finish_cooperative_loading_task() call. - // Once a task completes we'll wake up and try to load the - // missing programs inside the tx batch again. - let _new_cookie = task_waiter.wait(task_cookie); - } - } - - loaded_programs_for_txs.unwrap() + Default::default() } /// Returns a hash map of executable program accounts (program accounts that are not writable From aa1b475f3da5b9bf1f60605936847d1ae6193f26 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:04:29 +0000 Subject: [PATCH 108/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index fbfa98ef693..332eac4e4e0 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5107,7 +5107,7 @@ impl Bank { } let programs_loaded_for_tx_batch = Rc::new(RefCell::new( - 3 //self.replenish_program_cache(&program_accounts_map), + self.replenish_program_cache(&program_accounts_map), )); let lamports_per_signature = hash_queue.get_lamports_per_signature(sanitized_tx.message().recent_blockhash()); let fee = if let Some(lamports_per_signature) = lamports_per_signature { From a6e2fb7efa823622054519c70e6b54526ac0b7ad Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:06:32 +0000 Subject: [PATCH 109/163] save --- runtime/src/bank.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 332eac4e4e0..6f33bc8e6c1 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5042,7 +5042,6 @@ impl Bank { maybe_compute_budget.unwrap() }; - /* self.execute_loaded_transaction( tx, loaded_transaction, @@ -5056,7 +5055,6 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ) - */ } }) .collect(); @@ -5167,7 +5165,6 @@ impl Bank { } maybe_compute_budget.unwrap() }; - /* self.execute_loaded_transaction( sanitized_tx, &mut loaded_transaction, @@ -5181,7 +5178,6 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ); - */ } } From af161fbf497757bd058bd97139339f83ee9fb31d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:12:25 +0000 Subject: [PATCH 110/163] save --- ledger/benches/blockstore_processor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 52c79848971..04247c7c16e 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -202,7 +202,7 @@ fn bench_execute_batch_01_unbatched_disable_tx_cost_update(bencher: &mut Bencher } #[bench] -fn bench_execute_batch_00000_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { +fn bench_execute_batch_00001_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch2(bencher, 1, false); } @@ -211,6 +211,11 @@ fn bench_execute_batch_00004_unbatched_disable_tx_cost_update(bencher: &mut Benc bench_execute_batch2(bencher, 4, false); } +#[bench] +fn bench_execute_batch_00016_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 16, false); +} + #[bench] fn bench_execute_batch_00064_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { bench_execute_batch2(bencher, 64, false); From 65d11fe02dbba0be8499f1092fea17eacfdf09f4 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:15:37 +0000 Subject: [PATCH 111/163] save --- runtime/src/bank.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6f33bc8e6c1..332eac4e4e0 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5042,6 +5042,7 @@ impl Bank { maybe_compute_budget.unwrap() }; + /* self.execute_loaded_transaction( tx, loaded_transaction, @@ -5055,6 +5056,7 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ) + */ } }) .collect(); @@ -5165,6 +5167,7 @@ impl Bank { } maybe_compute_budget.unwrap() }; + /* self.execute_loaded_transaction( sanitized_tx, &mut loaded_transaction, @@ -5178,6 +5181,7 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ); + */ } } From b488a064bc6930fd04360dbae6430b0b193fd0b7 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:26:41 +0000 Subject: [PATCH 112/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- runtime/src/bank.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 04247c7c16e..7a2e9fbb1dd 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,7 +113,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(20)); + let transactions = create_transactions(&bank, 2_usize.pow(21)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -159,7 +159,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(20)); + let transactions = create_transactions(&bank, 2_usize.pow(21)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 332eac4e4e0..cd43d89ebf8 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5128,6 +5128,7 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; + /* let mut loaded_transaction = match load_transaction_accounts( &self.rc.accounts.accounts_db, &self.ancestors, @@ -5145,6 +5146,7 @@ impl Bank { Ok(loaded_transaction) => loaded_transaction, Err(e) => panic!(), }; + */ let compute_budget = if let Some(compute_budget) = self.runtime_config.compute_budget { From 36b8ce9a27f72386205c0c9181ab5ab62c8bbbff Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:29:43 +0000 Subject: [PATCH 113/163] save --- runtime/src/bank.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index cd43d89ebf8..d93c6d45654 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4993,6 +4993,7 @@ impl Bank { )); let mut load_time = Measure::start("accounts_load"); + /* let mut loaded_transactions = load_accounts( &self.rc.accounts.accounts_db, &self.ancestors, @@ -5060,6 +5061,7 @@ impl Bank { } }) .collect(); + */ execution_time.stop(); } From a0c364de1f4566859db2401a4532f91edecb3a11 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:30:00 +0000 Subject: [PATCH 114/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d93c6d45654..e1fb0f76fc9 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5061,9 +5061,9 @@ impl Bank { } }) .collect(); - */ execution_time.stop(); + */ } #[allow(clippy::type_complexity)] From 46463abd53d883003f4d6f1f869150603d139a8a Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:32:40 +0000 Subject: [PATCH 115/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 7a2e9fbb1dd..ffdac325444 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,7 +113,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(21)); + let transactions = create_transactions(&bank, 2_usize.pow(22)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -159,7 +159,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(21)); + let transactions = create_transactions(&bank, 2_usize.pow(22)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) From d8e3ad07b2a0a58dd19f1e05b324ec90a8e060a6 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:36:51 +0000 Subject: [PATCH 116/163] save --- accounts-db/src/accounts_db.rs | 2 +- runtime/src/bank.rs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 570ff8c26a4..c882b2a6f59 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -5118,7 +5118,7 @@ impl AccountsDb { ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)> { - self.load(ancestors, pubkey, LoadHint::FixedMaxRoot) + Some((Default::default(), 3))//self.load(ancestors, pubkey, LoadHint::FixedMaxRoot) } fn read_index_for_accessor_or_load_slow<'a>( diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index e1fb0f76fc9..332eac4e4e0 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4993,7 +4993,6 @@ impl Bank { )); let mut load_time = Measure::start("accounts_load"); - /* let mut loaded_transactions = load_accounts( &self.rc.accounts.accounts_db, &self.ancestors, @@ -5063,7 +5062,6 @@ impl Bank { .collect(); execution_time.stop(); - */ } #[allow(clippy::type_complexity)] @@ -5130,7 +5128,6 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; - /* let mut loaded_transaction = match load_transaction_accounts( &self.rc.accounts.accounts_db, &self.ancestors, @@ -5148,7 +5145,6 @@ impl Bank { Ok(loaded_transaction) => loaded_transaction, Err(e) => panic!(), }; - */ let compute_budget = if let Some(compute_budget) = self.runtime_config.compute_budget { From 1b436b31a77702acbcf5f0e17bc77f8276a122aa Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:37:19 +0000 Subject: [PATCH 117/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index ffdac325444..04247c7c16e 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,7 +113,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(22)); + let transactions = create_transactions(&bank, 2_usize.pow(20)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -159,7 +159,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(22)); + let transactions = create_transactions(&bank, 2_usize.pow(20)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) From 2764d850a56bd85961cc9179223632e511e361a7 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:41:23 +0000 Subject: [PATCH 118/163] save --- accounts-db/src/accounts_db.rs | 2 +- runtime/src/bank.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index c882b2a6f59..aa513bed884 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -5118,7 +5118,7 @@ impl AccountsDb { ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)> { - Some((Default::default(), 3))//self.load(ancestors, pubkey, LoadHint::FixedMaxRoot) + Some((AccountSharedData::new(1111111, 0, Default::default()), 3))//self.load(ancestors, pubkey, LoadHint::FixedMaxRoot) } fn read_index_for_accessor_or_load_slow<'a>( diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 332eac4e4e0..78eaea339b3 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5141,10 +5141,7 @@ impl Bank { &program_accounts_map, &programs_loaded_for_tx_batch.borrow(), self.should_collect_rent(), - ) { - Ok(loaded_transaction) => loaded_transaction, - Err(e) => panic!(), - }; + ).unwrap(); let compute_budget = if let Some(compute_budget) = self.runtime_config.compute_budget { From 5c2fe994b8747f6a30a7e92146d1e48794b2b338 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:41:34 +0000 Subject: [PATCH 119/163] save --- accounts-db/src/accounts_db.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index aa513bed884..a6097ed1ee7 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -5118,7 +5118,7 @@ impl AccountsDb { ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)> { - Some((AccountSharedData::new(1111111, 0, Default::default()), 3))//self.load(ancestors, pubkey, LoadHint::FixedMaxRoot) + Some((AccountSharedData::new(1111111, 0, &Default::default()), 3))//self.load(ancestors, pubkey, LoadHint::FixedMaxRoot) } fn read_index_for_accessor_or_load_slow<'a>( From a8be061a46ab59f4877b0bd449e8624320d44326 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:41:55 +0000 Subject: [PATCH 120/163] save --- runtime/src/bank.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 78eaea339b3..fe5a15930dd 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5128,7 +5128,7 @@ impl Bank { // load transactions use crate::accounts::load_transaction_accounts; - let mut loaded_transaction = match load_transaction_accounts( + let mut loaded_transaction = load_transaction_accounts( &self.rc.accounts.accounts_db, &self.ancestors, sanitized_tx, From 2c87a2e36061d92b9c1755fbbf5a912e162bf0f5 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:45:15 +0000 Subject: [PATCH 121/163] save --- runtime/src/accounts/mod.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/runtime/src/accounts/mod.rs b/runtime/src/accounts/mod.rs index 2f7e5e7f5ad..9a046a42fab 100644 --- a/runtime/src/accounts/mod.rs +++ b/runtime/src/accounts/mod.rs @@ -361,27 +361,6 @@ pub(super) fn load_transaction_accounts( builtins_start_index.saturating_add(owner_index) } else { let owner_index = accounts.len(); - if let Some((owner_account, _)) = - accounts_db.load_with_fixed_root(ancestors, owner_id) - { - if !native_loader::check_id(owner_account.owner()) - || !(is_builtin(&owner_account) - || is_executable(&owner_account, feature_set)) - { - error_counters.invalid_program_for_execution += 1; - return Err(TransactionError::InvalidProgramForExecution); - } - accumulate_and_check_loaded_account_data_size( - &mut accumulated_accounts_data_size, - owner_account.data().len(), - requested_loaded_accounts_data_size_limit, - error_counters, - )?; - accounts.push((*owner_id, owner_account)); - } else { - error_counters.account_not_found += 1; - return Err(TransactionError::ProgramAccountNotFound); - } owner_index }; account_indices.insert(0, program_index as IndexOfAccount); From d1b68b6bb6b9d06105f2b1a5691f779b78b4dc62 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:46:46 +0000 Subject: [PATCH 122/163] save --- runtime/src/accounts/mod.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/runtime/src/accounts/mod.rs b/runtime/src/accounts/mod.rs index 9a046a42fab..eec7f2b83fe 100644 --- a/runtime/src/accounts/mod.rs +++ b/runtime/src/accounts/mod.rs @@ -343,10 +343,6 @@ pub(super) fn load_transaction_accounts( return Err(TransactionError::ProgramAccountNotFound); } - if !(is_builtin(program_account) || is_executable(program_account, feature_set)) { - error_counters.invalid_program_for_execution += 1; - return Err(TransactionError::InvalidProgramForExecution); - } account_indices.insert(0, program_index as IndexOfAccount); let owner_id = program_account.owner(); if native_loader::check_id(owner_id) { From a5c6b2f306e41cc4d11614e40d12765bfc8d9d4d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:48:38 +0000 Subject: [PATCH 123/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 04247c7c16e..7a2e9fbb1dd 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,7 +113,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(20)); + let transactions = create_transactions(&bank, 2_usize.pow(21)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -159,7 +159,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(20)); + let transactions = create_transactions(&bank, 2_usize.pow(21)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) From 9a7ecd312495f36f7a8e7fd2327e751b57689c9c Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 11 Jan 2024 15:51:13 +0000 Subject: [PATCH 124/163] save --- runtime/src/bank.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index fe5a15930dd..bc1afff6156 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5042,7 +5042,6 @@ impl Bank { maybe_compute_budget.unwrap() }; - /* self.execute_loaded_transaction( tx, loaded_transaction, @@ -5056,7 +5055,6 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ) - */ } }) .collect(); @@ -5164,7 +5162,6 @@ impl Bank { } maybe_compute_budget.unwrap() }; - /* self.execute_loaded_transaction( sanitized_tx, &mut loaded_transaction, @@ -5178,7 +5175,6 @@ impl Bank { log_messages_bytes_limit, &programs_loaded_for_tx_batch.borrow(), ); - */ } } From d46a83e5a6b4c60db198d30ba6e4fdeea676c890 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 00:18:36 +0000 Subject: [PATCH 125/163] save --- runtime/src/bank.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index bc1afff6156..253ce26d013 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5076,8 +5076,10 @@ impl Bank { ) { let sanitized_txs = batch.sanitized_transactions(); let mut error_counters = TransactionErrorMetrics::default(); + let hash_queue = self.blockhash_queue.read().unwrap(); + let rcache = self.status_cache.read().unwrap(); + for sanitized_tx in sanitized_txs { - let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); self.check_transaction_age( @@ -5087,7 +5089,6 @@ impl Bank { &hash_queue, &mut error_counters, ).0.unwrap(); - let rcache = self.status_cache.read().unwrap(); if self.is_transaction_already_processed(sanitized_tx, &rcache) { panic!(); From c6dc3c4754426f472866a52f477702a331d8fe56 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 00:22:02 +0000 Subject: [PATCH 126/163] save --- runtime/src/bank.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 253ce26d013..bc1afff6156 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5076,10 +5076,8 @@ impl Bank { ) { let sanitized_txs = batch.sanitized_transactions(); let mut error_counters = TransactionErrorMetrics::default(); - let hash_queue = self.blockhash_queue.read().unwrap(); - let rcache = self.status_cache.read().unwrap(); - for sanitized_tx in sanitized_txs { + let hash_queue = self.blockhash_queue.read().unwrap(); let last_blockhash = hash_queue.last_hash(); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); self.check_transaction_age( @@ -5089,6 +5087,7 @@ impl Bank { &hash_queue, &mut error_counters, ).0.unwrap(); + let rcache = self.status_cache.read().unwrap(); if self.is_transaction_already_processed(sanitized_tx, &rcache) { panic!(); From a9c36159b8b39639b465f9d5f66b0338ed8a1bbc Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 04:51:11 +0000 Subject: [PATCH 127/163] save --- ledger/benches/blockstore_processor.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 7a2e9fbb1dd..202fc6ef788 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -176,8 +176,9 @@ fn bench_execute_batch2( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - //eprintln!("profile me!: {}", std::process::id()); - //std::thread::sleep(std::time::Duration::from_secs(10)); + + eprintln!("profile me!: {}", std::process::id()); + std::thread::sleep(std::time::Duration::from_secs(10)); bencher.iter(|| { for _ in 0..(64/batch_size) { From 9df74b4f2c12e3a6c9d89dfa2a5a3c3133619e72 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 04:51:52 +0000 Subject: [PATCH 128/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 202fc6ef788..698a98a8670 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -180,7 +180,7 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", std::process::id()); std::thread::sleep(std::time::Duration::from_secs(10)); - bencher.iter(|| { + for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( @@ -193,7 +193,7 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - }); + } //eprintln!("{:?}", timing); } From 8baa1b2d903c29afb9ccbce1125edcd067a5d3e5 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 04:52:25 +0000 Subject: [PATCH 129/163] save --- ledger/src/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 4eaf80e29ea..e808fdd6ac3 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -166,7 +166,7 @@ pub fn execute_batch( transaction_status_sender.is_some(), timings, log_messages_bytes_limit, - ); + ).unwrap(); Ok(()) } @@ -203,7 +203,7 @@ pub fn execute_batch2( transaction_status_sender.is_some(), timings, log_messages_bytes_limit, - ); + ).unwrap(); Ok(()) } From 57cc00775c5a9d3234291e6788e7219383b7d1a9 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 04:52:33 +0000 Subject: [PATCH 130/163] save --- ledger/src/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index e808fdd6ac3..f6f86abed73 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -203,7 +203,7 @@ pub fn execute_batch2( transaction_status_sender.is_some(), timings, log_messages_bytes_limit, - ).unwrap(); + ); Ok(()) } From be0766c2a0f46894f6365f07e293aa8fb64384c0 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 04:52:41 +0000 Subject: [PATCH 131/163] save --- ledger/src/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index f6f86abed73..4eaf80e29ea 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -166,7 +166,7 @@ pub fn execute_batch( transaction_status_sender.is_some(), timings, log_messages_bytes_limit, - ).unwrap(); + ); Ok(()) } From c98c5768d42a25840e8f18b3354696fa29d054c2 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 04:53:10 +0000 Subject: [PATCH 132/163] save --- runtime/src/bank.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index bc1afff6156..0f65812f6ae 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6075,7 +6075,6 @@ impl Bank { } /// Process a batch of transactions. - #[must_use] pub fn load_execute_and_commit_transactions( &self, batch: &TransactionBatch, @@ -6105,7 +6104,6 @@ impl Bank { ); } - #[must_use] pub fn load_execute_and_commit_transactions2( &self, batch: &TransactionBatch, From 9f1de5e3a2403546fe011ab9306c892398d69f39 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:01:39 +0000 Subject: [PATCH 133/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 698a98a8670..16481cf0abe 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -130,8 +130,8 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - //eprintln!("profile me!: {}", std::process::id()); - //std::thread::sleep(std::time::Duration::from_secs(10)); + eprintln!("profile me!: {}", std::process::id()); + std::thread::sleep(std::time::Duration::from_secs(10)); bencher.iter(|| { for _ in 0..(64/batch_size) { From 38321fbc158895907fe8fbb0f50c8ec75520a67b Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:03:56 +0000 Subject: [PATCH 134/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 16481cf0abe..16938653758 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -133,7 +133,7 @@ fn bench_execute_batch( eprintln!("profile me!: {}", std::process::id()); std::thread::sleep(std::time::Duration::from_secs(10)); - bencher.iter(|| { + for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -146,7 +146,7 @@ fn bench_execute_batch( &prioritization_fee_cache, ).unwrap(); } - }); + }; //eprintln!("{:?}", timing); } From 9dfecae009f953c62ecb200c3e32f9ab6ffc17a8 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:35:19 +0000 Subject: [PATCH 135/163] save --- runtime/src/bank.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 0f65812f6ae..356b5d975b0 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6091,6 +6091,7 @@ impl Bank { } else { vec![] }; + return; self.load_and_execute_transactions( batch, @@ -6120,6 +6121,7 @@ impl Bank { } else { vec![] }; + return; self.load_and_execute_transactions2( batch, From 185186734af4309ee2b2e3af0cfdbcb7f53a660d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:46:38 +0000 Subject: [PATCH 136/163] save --- ledger/benches/blockstore_processor.rs | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 16938653758..b096d187ee6 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -180,20 +180,22 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", std::process::id()); std::thread::sleep(std::time::Duration::from_secs(10)); - for _ in 0..100 { - for _ in 0..(64/batch_size) { - let batch = batches_iter.next().unwrap(); - execute_batch2( - &batch, - &bank, - None, - None, - &mut timing, - None, - &prioritization_fee_cache, - ).unwrap(); + std::thread::spawn(|| { + for _ in 0..100 { + for _ in 0..(64/batch_size) { + let batch = batches_iter.next().unwrap(); + execute_batch2( + &batch, + &bank, + None, + None, + &mut timing, + None, + &prioritization_fee_cache, + ).unwrap(); + } } - } + }); //eprintln!("{:?}", timing); } From 308e8c654092eb00cacab775e6df9260988abf20 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:47:15 +0000 Subject: [PATCH 137/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index b096d187ee6..0ad6e74000a 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -180,7 +180,7 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", std::process::id()); std::thread::sleep(std::time::Duration::from_secs(10)); - std::thread::spawn(|| { + std::thread::spawn(move || { for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); From 9d742621eb930a55f378cd2119dda35e513cae83 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:47:37 +0000 Subject: [PATCH 138/163] save --- ledger/benches/blockstore_processor.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 0ad6e74000a..56a0d5a00d6 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -180,7 +180,8 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", std::process::id()); std::thread::sleep(std::time::Duration::from_secs(10)); - std::thread::spawn(move || { + std::thread::scoped(move |scope| { + scope::spawn(|| { for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); @@ -194,7 +195,7 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - } + }}); }); //eprintln!("{:?}", timing); } From 07ff2f0a6aadafae390800bb066a5880ec7e5100 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:48:12 +0000 Subject: [PATCH 139/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 56a0d5a00d6..a0c9129fc30 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -180,8 +180,8 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", std::process::id()); std::thread::sleep(std::time::Duration::from_secs(10)); - std::thread::scoped(move |scope| { - scope::spawn(|| { + std::thread::scope(move |scope| { + scope.spawn(|| { for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); From 6eb6ec78b840128c655c9d73f1b15fd9f05765e1 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:49:03 +0000 Subject: [PATCH 140/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index a0c9129fc30..217d2375cd8 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -181,7 +181,7 @@ fn bench_execute_batch2( std::thread::sleep(std::time::Duration::from_secs(10)); std::thread::scope(move |scope| { - scope.spawn(|| { + scope.spawn(move || { for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); From 720a38f149ca7b238cb24d6200272b9da128b16e Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:50:09 +0000 Subject: [PATCH 141/163] save --- ledger/benches/blockstore_processor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 217d2375cd8..4de2e766d2d 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -197,6 +197,7 @@ fn bench_execute_batch2( } }}); }); + drop(batches); //eprintln!("{:?}", timing); } From 6cfc072169804ef152c0cbca4a413983e469329b Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:50:41 +0000 Subject: [PATCH 142/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 4de2e766d2d..d05f924c4dd 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -173,7 +173,7 @@ fn bench_execute_batch2( } }) .collect(); - let mut batches_iter = batches.into_iter(); + let mut batches_iter = batches.iter(); let mut timing = ExecuteTimings::default(); From 0e72c4aa3a358e10a661e4d011daaf8070346b07 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:54:09 +0000 Subject: [PATCH 143/163] save --- ledger/benches/blockstore_processor.rs | 31 +++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index d05f924c4dd..4c8c88b30f0 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -177,25 +177,26 @@ fn bench_execute_batch2( let mut timing = ExecuteTimings::default(); - eprintln!("profile me!: {}", std::process::id()); - std::thread::sleep(std::time::Duration::from_secs(10)); std::thread::scope(move |scope| { scope.spawn(move || { - for _ in 0..100 { - for _ in 0..(64/batch_size) { - let batch = batches_iter.next().unwrap(); - execute_batch2( - &batch, - &bank, - None, - None, - &mut timing, - None, - &prioritization_fee_cache, - ).unwrap(); + eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + std::thread::sleep(std::time::Duration::from_secs(10)); + for _ in 0..100 { + for _ in 0..(64/batch_size) { + let batch = batches_iter.next().unwrap(); + execute_batch2( + &batch, + &bank, + None, + None, + &mut timing, + None, + &prioritization_fee_cache, + ).unwrap(); + } } - }}); + }); }); drop(batches); //eprintln!("{:?}", timing); From 6f0d6567d6b70ec042d40075649eedbccf0f4a8f Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:55:23 +0000 Subject: [PATCH 144/163] save --- ledger/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 87ba0c39235..72930eae05b 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -33,6 +33,7 @@ rand = { workspace = true } rand_chacha = { workspace = true } rayon = { workspace = true } reed-solomon-erasure = { workspace = true, features = ["simd-accel"] } +rustix = "0.38.28" scopeguard = { workspace = true } serde = { workspace = true } serde_bytes = { workspace = true } From a9fa4c147694cfd92beb42d82f82faecbc6f4eaa Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:59:43 +0000 Subject: [PATCH 145/163] save --- Cargo.lock | 1 + ledger/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ebff3c23834..8f689e85a5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6341,6 +6341,7 @@ dependencies = [ "reed-solomon-erasure", "rocksdb", "rustc_version 0.4.0", + "rustix", "scopeguard", "serde", "serde_bytes", diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 72930eae05b..d9912623fa0 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -33,7 +33,7 @@ rand = { workspace = true } rand_chacha = { workspace = true } rayon = { workspace = true } reed-solomon-erasure = { workspace = true, features = ["simd-accel"] } -rustix = "0.38.28" +rustix = { version = "0.38.28", features = ["threads"] } scopeguard = { workspace = true } serde = { workspace = true } serde_bytes = { workspace = true } From e46eba58064074f74d364a3582fb39194affdd55 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 05:59:55 +0000 Subject: [PATCH 146/163] save --- ledger/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index d9912623fa0..4914336b678 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -33,7 +33,7 @@ rand = { workspace = true } rand_chacha = { workspace = true } rayon = { workspace = true } reed-solomon-erasure = { workspace = true, features = ["simd-accel"] } -rustix = { version = "0.38.28", features = ["threads"] } +rustix = { version = "0.38.28", features = ["thread"] } scopeguard = { workspace = true } serde = { workspace = true } serde_bytes = { workspace = true } From 578a43f32ced0e235cad0f7f0c227b29960d0565 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:04:03 +0000 Subject: [PATCH 147/163] save --- runtime/src/bank.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 356b5d975b0..0f65812f6ae 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6091,7 +6091,6 @@ impl Bank { } else { vec![] }; - return; self.load_and_execute_transactions( batch, @@ -6121,7 +6120,6 @@ impl Bank { } else { vec![] }; - return; self.load_and_execute_transactions2( batch, From 58b7d7062d31d88e31dec99c4414deaeba36962d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:11:16 +0000 Subject: [PATCH 148/163] save --- ledger/benches/blockstore_processor.rs | 38 ++++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 4c8c88b30f0..1329c4f1f0e 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -130,23 +130,28 @@ fn bench_execute_batch( let mut batches_iter = batches.into_iter(); let mut timing = ExecuteTimings::default(); - eprintln!("profile me!: {}", std::process::id()); - std::thread::sleep(std::time::Duration::from_secs(10)); - for _ in 0..100 { - for _ in 0..(64/batch_size) { - let batch = batches_iter.next().unwrap(); - execute_batch( - &batch, - &bank, - None, - None, - &mut timing, - None, - &prioritization_fee_cache, - ).unwrap(); - } - }; + std::thread::scope(move |scope| { + scope.spawn(move || { + eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + std::thread::sleep(std::time::Duration::from_secs(10)); + for _ in 0..100 { + for _ in 0..(64/batch_size) { + let batch = batches_iter.next().unwrap(); + execute_batch( + &batch, + &bank, + None, + None, + &mut timing, + None, + &prioritization_fee_cache, + ).unwrap(); + } + } + }); + }); + drop(batches); //eprintln!("{:?}", timing); } @@ -177,7 +182,6 @@ fn bench_execute_batch2( let mut timing = ExecuteTimings::default(); - std::thread::scope(move |scope| { scope.spawn(move || { eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); From 42f8e4bc57cbb1c124e2da302618480ad278bfa4 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:12:08 +0000 Subject: [PATCH 149/163] save --- ledger/benches/blockstore_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 1329c4f1f0e..afa9a24d0de 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -127,7 +127,7 @@ fn bench_execute_batch( } }) .collect(); - let mut batches_iter = batches.into_iter(); + let mut batches_iter = batches.iter(); let mut timing = ExecuteTimings::default(); From 607dfc761a79eda2515402d7fcd96f8c085916e1 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:24:04 +0000 Subject: [PATCH 150/163] save --- ledger/benches/blockstore_processor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index afa9a24d0de..02c2b948a33 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -186,7 +186,8 @@ fn bench_execute_batch2( scope.spawn(move || { eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); - for _ in 0..100 { + bencher.iter(|| { + //for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( @@ -199,7 +200,8 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - } + //} + }); }); }); drop(batches); From 2516063272bad0fa24292ad9ba328827c3a30a2d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:25:15 +0000 Subject: [PATCH 151/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 02c2b948a33..8fe949b630d 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -184,8 +184,8 @@ fn bench_execute_batch2( std::thread::scope(move |scope| { scope.spawn(move || { - eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - std::thread::sleep(std::time::Duration::from_secs(10)); + //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + //std::thread::sleep(std::time::Duration::from_secs(10)); bencher.iter(|| { //for _ in 0..100 { for _ in 0..(64/batch_size) { From d9747e90e8ac82cd08c6f8580ab12991a1c1c729 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:27:32 +0000 Subject: [PATCH 152/163] save --- ledger/benches/blockstore_processor.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 8fe949b630d..96618695ee6 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -133,9 +133,10 @@ fn bench_execute_batch( std::thread::scope(move |scope| { scope.spawn(move || { - eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - std::thread::sleep(std::time::Duration::from_secs(10)); - for _ in 0..100 { + //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + //std::thread::sleep(std::time::Duration::from_secs(10)); + bencher.iter(|| { + //for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -148,7 +149,8 @@ fn bench_execute_batch( &prioritization_fee_cache, ).unwrap(); } - } + //} + }); }); }); drop(batches); From 4c4fe809578c958b87ce957eafbb5e787e8be306 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:34:42 +0000 Subject: [PATCH 153/163] save --- ledger/benches/blockstore_processor.rs | 45 +++++++++----------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 96618695ee6..59262c00ead 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -211,56 +211,41 @@ fn bench_execute_batch2( } #[bench] -fn bench_execute_batch_01_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { +fn bench_execute_batch_01_txes_per_batch(bencher: &mut Bencher) { bench_execute_batch(bencher, 1, false); } #[bench] -fn bench_execute_batch_00001_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch2(bencher, 1, false); -} - -#[bench] -fn bench_execute_batch_00004_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch2(bencher, 4, false); -} - -#[bench] -fn bench_execute_batch_00016_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch2(bencher, 16, false); -} - -#[bench] -fn bench_execute_batch_00064_unbatched_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch2(bencher, 64, false); +fn bench_execute_batch_04_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch(bencher, 4, false); } #[bench] -fn bench_execute_batch_02_tx2_batch_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 2, false); +fn bench_execute_batch_16_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch(bencher, 16, false); } #[bench] -fn bench_execute_batch_04_tx4_batch_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 4, false); +fn bench_execute_batch_64_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch(bencher, 64, false); } #[bench] -fn bench_execute_batch_08_tx8_batch_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 8, false); +fn bench_execute_batch_flattend_01_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 1, false); } #[bench] -fn bench_execute_batch_16_tx8_batch_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 16, false); +fn bench_execute_batch_flattend_04_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 4, false); } #[bench] -fn bench_execute_batch_32_half_batch_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 32, false); +fn bench_execute_batch_flattend_16_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 16, false); } #[bench] -fn bench_execute_batch_64_full_batch_disable_tx_cost_update(bencher: &mut Bencher) { - bench_execute_batch(bencher, 64, false); +fn bench_execute_batch_flattend_64_txes_per_batch(bencher: &mut Bencher) { + bench_execute_batch2(bencher, 64, false); } From b99db6719a788386e0f8640e637bf1a0e6145605 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:43:24 +0000 Subject: [PATCH 154/163] save --- ledger/benches/blockstore_processor.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 59262c00ead..8f1492a5b05 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -133,10 +133,10 @@ fn bench_execute_batch( std::thread::scope(move |scope| { scope.spawn(move || { - //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - //std::thread::sleep(std::time::Duration::from_secs(10)); - bencher.iter(|| { - //for _ in 0..100 { + eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + std::thread::sleep(std::time::Duration::from_secs(10)); + //bencher.iter(|| { + for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -149,8 +149,8 @@ fn bench_execute_batch( &prioritization_fee_cache, ).unwrap(); } - //} - }); + } + //}); }); }); drop(batches); @@ -186,10 +186,10 @@ fn bench_execute_batch2( std::thread::scope(move |scope| { scope.spawn(move || { - //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - //std::thread::sleep(std::time::Duration::from_secs(10)); - bencher.iter(|| { - //for _ in 0..100 { + eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + std::thread::sleep(std::time::Duration::from_secs(10)); + //bencher.iter(|| { + for _ in 0..100 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( @@ -202,8 +202,8 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - //} - }); + } + //}); }); }); drop(batches); From 8dfd96c0ec39584efcc59b25f196eccc80d9b0f3 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:47:51 +0000 Subject: [PATCH 155/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 8f1492a5b05..5109cfdb3a9 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -136,7 +136,7 @@ fn bench_execute_batch( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..100 { + for _ in 0..1000 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -189,7 +189,7 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..100 { + for _ in 0..1000 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( From 3a6ab92f2488e1533f9202966f35a0e79ffdaebf Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 06:58:47 +0000 Subject: [PATCH 156/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 5109cfdb3a9..44c9380de44 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -136,7 +136,7 @@ fn bench_execute_batch( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..1000 { + for _ in 0..10 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -189,7 +189,7 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..1000 { + for _ in 0..10 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( From 9b7cec4389b75afe65ce3a0d0216efe43ac6f836 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 07:01:18 +0000 Subject: [PATCH 157/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 44c9380de44..f0e4b17daf3 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -136,7 +136,7 @@ fn bench_execute_batch( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..10 { + for _ in 0..20 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -189,7 +189,7 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..10 { + for _ in 0..20 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( From f94dfadfd3be14506f3fa922e1276eac9d76371d Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 07:03:33 +0000 Subject: [PATCH 158/163] save --- ledger/benches/blockstore_processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index f0e4b17daf3..db425c92ede 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -136,7 +136,7 @@ fn bench_execute_batch( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..20 { + for _ in 0..40 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -189,7 +189,7 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..20 { + for _ in 0..40 { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( From 39f6845499c11d9ae1e3ef3b22c4f162cfd583fd Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 07:16:58 +0000 Subject: [PATCH 159/163] save --- ledger/benches/blockstore_processor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index db425c92ede..b4bb04620d9 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -136,7 +136,8 @@ fn bench_execute_batch( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..40 { + let iteration_count = 40; + for _ in 0..iteration_count { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch( @@ -189,7 +190,8 @@ fn bench_execute_batch2( eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - for _ in 0..40 { + let iteration_count = 40; + for _ in 0..iteration_count { for _ in 0..(64/batch_size) { let batch = batches_iter.next().unwrap(); execute_batch2( From dc2d89d64654ba5c8b6a0a9a5f47df86b01c17e5 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 22:26:42 +0900 Subject: [PATCH 160/163] save --- ledger/benches/blockstore_processor.rs | 32 +++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index b4bb04620d9..1a4a2e3dbd1 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -113,7 +113,7 @@ fn bench_execute_batch( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(21)); + let transactions = create_transactions(&bank, 2_usize.pow(19)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -130,16 +130,17 @@ fn bench_execute_batch( let mut batches_iter = batches.iter(); let mut timing = ExecuteTimings::default(); + let batch = batches_iter.next().unwrap(); std::thread::scope(move |scope| { scope.spawn(move || { - eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - std::thread::sleep(std::time::Duration::from_secs(10)); + //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + //std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - let iteration_count = 40; - for _ in 0..iteration_count { + let now = std::time::Instant::now(); + //let iteration_count = 100; + //for _ in 0..iteration_count { for _ in 0..(64/batch_size) { - let batch = batches_iter.next().unwrap(); execute_batch( &batch, &bank, @@ -150,8 +151,9 @@ fn bench_execute_batch( &prioritization_fee_cache, ).unwrap(); } - } + //} //}); + dbg!(now.elapsed()); }); }); drop(batches); @@ -167,7 +169,7 @@ fn bench_execute_batch2( bank, prioritization_fee_cache, } = setup(apply_cost_tracker_during_replay); - let transactions = create_transactions(&bank, 2_usize.pow(21)); + let transactions = create_transactions(&bank, 2_usize.pow(19)); let bank2 = bank.clone(); let batches: Vec<_> = transactions .chunks(batch_size) @@ -184,16 +186,17 @@ fn bench_execute_batch2( let mut batches_iter = batches.iter(); let mut timing = ExecuteTimings::default(); + let batch = batches_iter.next().unwrap(); std::thread::scope(move |scope| { scope.spawn(move || { - eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - std::thread::sleep(std::time::Duration::from_secs(10)); + //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + //std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { - let iteration_count = 40; - for _ in 0..iteration_count { + let now = std::time::Instant::now(); + //let iteration_count = 100; + //for _ in 0..iteration_count { for _ in 0..(64/batch_size) { - let batch = batches_iter.next().unwrap(); execute_batch2( &batch, &bank, @@ -204,8 +207,9 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - } + //} //}); + dbg!(now.elapsed()); }); }); drop(batches); From bbaa3e373b401c380f82b9458100e55a21d7d452 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 22:33:39 +0900 Subject: [PATCH 161/163] save --- ledger/benches/blockstore_processor.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 1a4a2e3dbd1..4bb254411ce 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -137,6 +137,7 @@ fn bench_execute_batch( //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); //std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { + for _ in 0..3 { let now = std::time::Instant::now(); //let iteration_count = 100; //for _ in 0..iteration_count { @@ -154,6 +155,7 @@ fn bench_execute_batch( //} //}); dbg!(now.elapsed()); + } }); }); drop(batches); @@ -193,6 +195,7 @@ fn bench_execute_batch2( //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); //std::thread::sleep(std::time::Duration::from_secs(10)); //bencher.iter(|| { + for _ in 0..3 { let now = std::time::Instant::now(); //let iteration_count = 100; //for _ in 0..iteration_count { @@ -210,6 +213,7 @@ fn bench_execute_batch2( //} //}); dbg!(now.elapsed()); + } }); }); drop(batches); From ce1d43b34e31cc6edb12072b3518c1def57f7f11 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 22:41:44 +0900 Subject: [PATCH 162/163] save --- ledger/benches/blockstore_processor.rs | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 4bb254411ce..0d14e8f823b 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -134,13 +134,13 @@ fn bench_execute_batch( std::thread::scope(move |scope| { scope.spawn(move || { - //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - //std::thread::sleep(std::time::Duration::from_secs(10)); - //bencher.iter(|| { - for _ in 0..3 { - let now = std::time::Instant::now(); - //let iteration_count = 100; - //for _ in 0..iteration_count { + eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + std::thread::sleep(std::time::Duration::from_secs(10)); + bencher.iter(|| { + //for _ in 0..3 { + //let now = std::time::Instant::now(); + let iteration_count = 100; + for _ in 0..iteration_count { for _ in 0..(64/batch_size) { execute_batch( &batch, @@ -152,10 +152,10 @@ fn bench_execute_batch( &prioritization_fee_cache, ).unwrap(); } - //} - //}); - dbg!(now.elapsed()); } + }); + //dbg!(now.elapsed()); + //} }); }); drop(batches); @@ -192,13 +192,13 @@ fn bench_execute_batch2( std::thread::scope(move |scope| { scope.spawn(move || { - //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - //std::thread::sleep(std::time::Duration::from_secs(10)); - //bencher.iter(|| { - for _ in 0..3 { - let now = std::time::Instant::now(); - //let iteration_count = 100; - //for _ in 0..iteration_count { + eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + std::thread::sleep(std::time::Duration::from_secs(10)); + bencher.iter(|| { + //for _ in 0..3 { + //let now = std::time::Instant::now(); + let iteration_count = 100; + for _ in 0..iteration_count { for _ in 0..(64/batch_size) { execute_batch2( &batch, @@ -210,10 +210,10 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - //} - //}); - dbg!(now.elapsed()); } + }); + //dbg!(now.elapsed()); + //} }); }); drop(batches); From cc1ae729c404dee182f4183580232daccc3eeaa4 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 12 Jan 2024 23:47:42 +0900 Subject: [PATCH 163/163] save --- ledger/benches/blockstore_processor.rs | 20 ++++----- runtime/src/builtins.rs | 60 -------------------------- 2 files changed, 10 insertions(+), 70 deletions(-) diff --git a/ledger/benches/blockstore_processor.rs b/ledger/benches/blockstore_processor.rs index 0d14e8f823b..cb330fdfce5 100644 --- a/ledger/benches/blockstore_processor.rs +++ b/ledger/benches/blockstore_processor.rs @@ -134,13 +134,13 @@ fn bench_execute_batch( std::thread::scope(move |scope| { scope.spawn(move || { - eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - std::thread::sleep(std::time::Duration::from_secs(10)); + //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + //std::thread::sleep(std::time::Duration::from_secs(10)); bencher.iter(|| { //for _ in 0..3 { //let now = std::time::Instant::now(); - let iteration_count = 100; - for _ in 0..iteration_count { + //let iteration_count_for_profiling = 100; + //for _ in 0..iteration_count_for_profiling { for _ in 0..(64/batch_size) { execute_batch( &batch, @@ -152,7 +152,7 @@ fn bench_execute_batch( &prioritization_fee_cache, ).unwrap(); } - } + //} }); //dbg!(now.elapsed()); //} @@ -192,13 +192,13 @@ fn bench_execute_batch2( std::thread::scope(move |scope| { scope.spawn(move || { - eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); - std::thread::sleep(std::time::Duration::from_secs(10)); + //eprintln!("profile me!: {}", rustix::thread::gettid().as_raw_nonzero().get()); + //std::thread::sleep(std::time::Duration::from_secs(10)); bencher.iter(|| { //for _ in 0..3 { //let now = std::time::Instant::now(); - let iteration_count = 100; - for _ in 0..iteration_count { + //let iteration_count_for_profiling = 100; + //for _ in 0..iteration_count_for_profiling { for _ in 0..(64/batch_size) { execute_batch2( &batch, @@ -210,7 +210,7 @@ fn bench_execute_batch2( &prioritization_fee_cache, ).unwrap(); } - } + //} }); //dbg!(now.elapsed()); //} diff --git a/runtime/src/builtins.rs b/runtime/src/builtins.rs index 2c7c36fa0ec..ca228170e7d 100644 --- a/runtime/src/builtins.rs +++ b/runtime/src/builtins.rs @@ -47,64 +47,4 @@ pub static BUILTINS: &[BuiltinPrototype] = &[ name: "system_program", entrypoint: solana_system_program::system_processor::Entrypoint::vm, }, - BuiltinPrototype { - feature_id: None, - program_id: solana_vote_program::id(), - name: "vote_program", - entrypoint: solana_vote_program::vote_processor::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: solana_stake_program::id(), - name: "stake_program", - entrypoint: solana_stake_program::stake_instruction::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: solana_config_program::id(), - name: "config_program", - entrypoint: solana_config_program::config_processor::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: bpf_loader_deprecated::id(), - name: "solana_bpf_loader_deprecated_program", - entrypoint: solana_bpf_loader_program::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: bpf_loader::id(), - name: "solana_bpf_loader_program", - entrypoint: solana_bpf_loader_program::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: bpf_loader_upgradeable::id(), - name: "solana_bpf_loader_upgradeable_program", - entrypoint: solana_bpf_loader_program::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: solana_sdk::compute_budget::id(), - name: "compute_budget_program", - entrypoint: solana_compute_budget_program::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: None, - program_id: solana_sdk::address_lookup_table::program::id(), - name: "address_lookup_table_program", - entrypoint: solana_address_lookup_table_program::processor::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: Some(feature_set::zk_token_sdk_enabled::id()), - program_id: solana_zk_token_sdk::zk_token_proof_program::id(), - name: "zk_token_proof_program", - entrypoint: solana_zk_token_proof_program::Entrypoint::vm, - }, - BuiltinPrototype { - feature_id: Some(feature_set::enable_program_runtime_v2_and_loader_v4::id()), - program_id: solana_sdk::loader_v4::id(), - name: "loader_v4", - entrypoint: solana_loader_v4_program::Entrypoint::vm, - }, ];