From a423b77608759312967cc3dcf72e0b9444b62106 Mon Sep 17 00:00:00 2001 From: so-kkroy22 Date: Fri, 25 Oct 2024 11:21:31 +0530 Subject: [PATCH] fix integration error --- .../observer/consensus_observer.rs | 4 +- consensus/src/epoch_manager.rs | 6 +-- consensus/src/pipeline/execution_client.rs | 9 ++-- .../src/quorum_store/batch_coordinator.rs | 2 +- consensus/src/quorum_store/counters.rs | 50 +++++++++++++++++++ .../src/integration_test_impl.rs | 26 +++------- 6 files changed, 68 insertions(+), 29 deletions(-) diff --git a/consensus/src/consensus_observer/observer/consensus_observer.rs b/consensus/src/consensus_observer/observer/consensus_observer.rs index 032a3fa38f8bcf..5a47cb1912e0b7 100644 --- a/consensus/src/consensus_observer/observer/consensus_observer.rs +++ b/consensus/src/consensus_observer/observer/consensus_observer.rs @@ -33,7 +33,7 @@ use aptos_config::{ network_id::PeerNetworkId, }; use aptos_consensus_types::{pipeline, pipelined_block::PipelinedBlock}; -use aptos_crypto::{bls12381, Genesis}; +use aptos_crypto::{bls12381, ed25519, Genesis}; use aptos_event_notifications::{DbBackedOnChainConfig, ReconfigNotificationListener}; use aptos_infallible::Mutex; use aptos_logger::{debug, error, info, warn}; @@ -790,7 +790,7 @@ impl ConsensusObserver { let epoch_state = self.get_epoch_state(); // Start the new epoch - let sk = Arc::new(bls12381::PrivateKey::genesis()); + let sk = Arc::new(ed25519::PrivateKey::genesis()); let signer = Arc::new(ValidatorSigner::new(AccountAddress::ZERO, sk.clone())); let dummy_signer = Arc::new(DagCommitSigner::new(signer.clone())); let (_, rand_msg_rx) = diff --git a/consensus/src/epoch_manager.rs b/consensus/src/epoch_manager.rs index 3d5100fef872dd..26fb2a855554a9 100644 --- a/consensus/src/epoch_manager.rs +++ b/consensus/src/epoch_manager.rs @@ -66,7 +66,7 @@ use aptos_consensus_types::{ proof_of_store::ProofCache, utils::PayloadTxnsSize, }; -use aptos_crypto::ed25519::PrivateKey; +use aptos_crypto::ed25519::{Ed25519PrivateKey, PrivateKey}; use aptos_dkg::{ pvss::{traits::Transcript, Player}, weighted_vuf::traits::WeightedVUF, @@ -760,7 +760,7 @@ impl EpochManager

{ async fn start_round_manager( &mut self, - consensus_key: Option>, + consensus_key: Option>, recovery_data: RecoveryData, epoch_state: Arc, onchain_consensus_config: OnChainConsensusConfig, @@ -1314,7 +1314,7 @@ impl EpochManager

{ async fn start_new_epoch_with_dag( &mut self, epoch_state: Arc, - loaded_consensus_key: Option>, + loaded_consensus_key: Option>, onchain_consensus_config: OnChainConsensusConfig, on_chain_execution_config: OnChainExecutionConfig, onchain_randomness_config: OnChainRandomnessConfig, diff --git a/consensus/src/pipeline/execution_client.rs b/consensus/src/pipeline/execution_client.rs index 9d50fe08e4a3fe..31156e2e7d3993 100644 --- a/consensus/src/pipeline/execution_client.rs +++ b/consensus/src/pipeline/execution_client.rs @@ -52,13 +52,14 @@ use futures::{ use futures_channel::mpsc::unbounded; use move_core_types::account_address::AccountAddress; use std::sync::Arc; +use aptos_crypto::ed25519::Ed25519PrivateKey; #[async_trait::async_trait] pub trait TExecutionClient: Send + Sync { /// Initialize the execution phase for a new epoch. async fn start_epoch( &self, - maybe_consensus_key: Option>, + maybe_consensus_key: Option>, epoch_state: Arc, commit_signer_provider: Arc, payload_manager: Arc, @@ -184,7 +185,7 @@ impl ExecutionProxyClient { fn spawn_decoupled_execution( &self, - maybe_consensus_key: Option>, + maybe_consensus_key: Option>, commit_signer_provider: Arc, epoch_state: Arc, rand_config: Option, @@ -298,7 +299,7 @@ impl ExecutionProxyClient { impl TExecutionClient for ExecutionProxyClient { async fn start_epoch( &self, - maybe_consensus_key: Option>, + maybe_consensus_key: Option>, epoch_state: Arc, commit_signer_provider: Arc, payload_manager: Arc, @@ -492,7 +493,7 @@ pub struct DummyExecutionClient; impl TExecutionClient for DummyExecutionClient { async fn start_epoch( &self, - _maybe_consensus_key: Option>, + _maybe_consensus_key: Option>, _epoch_state: Arc, _commit_signer_provider: Arc, _payload_manager: Arc, diff --git a/consensus/src/quorum_store/batch_coordinator.rs b/consensus/src/quorum_store/batch_coordinator.rs index 177e8d102c6e94..72f02ae6497af6 100644 --- a/consensus/src/quorum_store/batch_coordinator.rs +++ b/consensus/src/quorum_store/batch_coordinator.rs @@ -76,7 +76,7 @@ impl BatchCoordinator { let peer_id = persist_requests[0].author(); let batches = persist_requests .iter() - .map(|persisted_value| persisted_value.batch_info().clone()) + .map(|persisted_value| (persisted_value.batch_info().clone(), persisted_value.clone().summary())) .collect(); let signed_batch_infos = batch_store.persist(persist_requests); if !signed_batch_infos.is_empty() { diff --git a/consensus/src/quorum_store/counters.rs b/consensus/src/quorum_store/counters.rs index a1de3764c869e9..30db4beddd5b53 100644 --- a/consensus/src/quorum_store/counters.rs +++ b/consensus/src/quorum_store/counters.rs @@ -73,6 +73,46 @@ pub static MAIN_LOOP: Lazy = Lazy::new(|| { ) }); +pub static PROOF_QUEUE_ADD_BATCH_SUMMARIES_DURATION: Lazy = Lazy::new(|| { + DurationHistogram::new( + register_histogram!( + "quorum_store_proof_queue_add_batch_summaries_duration", + "Duration of adding batch summaries to proof queue" + ) + .unwrap(), + ) +}); + +pub static PROOF_QUEUE_COMMIT_DURATION: Lazy = Lazy::new(|| { + DurationHistogram::new( + register_histogram!( + "quorum_store_proof_queue_commit_duration", + "Duration of committing proofs from proof queue" + ) + .unwrap(), + ) +}); + +pub static PROOF_QUEUE_UPDATE_TIMESTAMP_DURATION: Lazy = Lazy::new(|| { + DurationHistogram::new( + register_histogram!( + "quorum_store_proof_queue_update_block_timestamp_duration", + "Duration of updating block timestamp in proof queue" + ) + .unwrap(), + ) +}); + +pub static PROOF_QUEUE_REMAINING_TXNS_DURATION: Lazy = Lazy::new(|| { + DurationHistogram::new( + register_histogram!( + "quorum_store_proof_queue_remaining_txns_duration", + "Duration of calculating remaining txns in proof queue" + ) + .unwrap(), + ) +}); + /// Duration of each run of the event loop. pub static PROOF_MANAGER_MAIN_LOOP: Lazy = Lazy::new(|| { DurationHistogram::new( @@ -84,6 +124,8 @@ pub static PROOF_MANAGER_MAIN_LOOP: Lazy = Lazy::new(|| { ) }); + + /// Duration of each run of the event loop. pub static BATCH_GENERATOR_MAIN_LOOP: Lazy = Lazy::new(|| { DurationHistogram::new( @@ -397,6 +439,14 @@ pub static NUM_TOTAL_TXNS_LEFT_ON_UPDATE: Lazy = Lazy::new(|| { ) }); +pub static NUM_UNIQUE_TOTAL_TXNS_LEFT_ON_UPDATE: Lazy = Lazy::new(|| { + register_histogram!( + "quorum_store_num_unique_total_txns_left_on_update", + "Histogram for the number of total txns left after adding or cleaning batches, without duplicates.", + TRANSACTION_COUNT_BUCKETS.clone() + ).unwrap() +}); + /// Histogram for the number of total batches/PoS left after adding or cleaning batches. pub static NUM_TOTAL_PROOFS_LEFT_ON_UPDATE: Lazy = Lazy::new(|| { register_avg_counter( diff --git a/execution/executor-test-helpers/src/integration_test_impl.rs b/execution/executor-test-helpers/src/integration_test_impl.rs index e466dfb0f5ed16..0163f08e07915f 100644 --- a/execution/executor-test-helpers/src/integration_test_impl.rs +++ b/execution/executor-test-helpers/src/integration_test_impl.rs @@ -19,25 +19,13 @@ use aptos_storage_interface::{ state_view::{DbStateViewAtVersion, VerifiedStateViewAtVersion}, DbReaderWriter, Order, }; -use aptos_types::{ - account_config::{aptos_test_root_address, AccountResource, CoinStoreResource}, - block_metadata::BlockMetadata, - chain_id::ChainId, - event::EventKey, - ledger_info::LedgerInfo, - state_store::{MoveResourceExt, StateView}, - test_helpers::transaction_test_helpers::{block, TEST_BLOCK_EXECUTOR_ONCHAIN_CONFIG}, - transaction::{ - signature_verified_transaction::{ - into_signature_verified_block, SignatureVerifiedTransaction, - }, - Transaction::{self, UserTransaction}, - TransactionListWithProof, TransactionWithProof, WriteSetPayload, +use aptos_types::{account_config::{aptos_test_root_address, AccountResource, CoinStoreResource}, block_metadata::BlockMetadata, chain_id::ChainId, event::EventKey, ledger_info::LedgerInfo, state_store::{MoveResourceExt, StateView}, test_helpers::transaction_test_helpers::{block, TEST_BLOCK_EXECUTOR_ONCHAIN_CONFIG}, transaction::{ + signature_verified_transaction::{ + into_signature_verified_block, SignatureVerifiedTransaction, }, - trusted_state::{TrustedState, TrustedStateChange}, - waypoint::Waypoint, - AptosCoinType, -}; + Transaction::{self, UserTransaction}, + TransactionListWithProof, TransactionWithProof, WriteSetPayload, +}, trusted_state::{TrustedState, TrustedStateChange}, waypoint::Waypoint, SupraCoinType}; use aptos_vm::AptosVM; use rand::SeedableRng; use std::{path::Path, sync::Arc}; @@ -555,7 +543,7 @@ pub fn create_db_and_executor>( } pub fn get_account_balance(state_view: &dyn StateView, address: &AccountAddress) -> u64 { - CoinStoreResource::::fetch_move_resource(state_view, address) + CoinStoreResource::::fetch_move_resource(state_view, address) .unwrap() .map_or(0, |coin_store| coin_store.coin()) }