Skip to content

Commit

Permalink
fix integration error
Browse files Browse the repository at this point in the history
  • Loading branch information
so-kkroy22 committed Oct 25, 2024
1 parent a76d469 commit a423b77
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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) =
Expand Down
6 changes: 3 additions & 3 deletions consensus/src/epoch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -760,7 +760,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {

async fn start_round_manager(
&mut self,
consensus_key: Option<Arc<PrivateKey>>,
consensus_key: Option<Arc<Ed25519PrivateKey>>,
recovery_data: RecoveryData,
epoch_state: Arc<EpochState>,
onchain_consensus_config: OnChainConsensusConfig,
Expand Down Expand Up @@ -1314,7 +1314,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {
async fn start_new_epoch_with_dag(
&mut self,
epoch_state: Arc<EpochState>,
loaded_consensus_key: Option<Arc<PrivateKey>>,
loaded_consensus_key: Option<Arc<Ed25519PrivateKey>>,
onchain_consensus_config: OnChainConsensusConfig,
on_chain_execution_config: OnChainExecutionConfig,
onchain_randomness_config: OnChainRandomnessConfig,
Expand Down
9 changes: 5 additions & 4 deletions consensus/src/pipeline/execution_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<PrivateKey>>,
maybe_consensus_key: Option<Arc<Ed25519PrivateKey>>,
epoch_state: Arc<EpochState>,
commit_signer_provider: Arc<dyn CommitSignerProvider>,
payload_manager: Arc<dyn TPayloadManager>,
Expand Down Expand Up @@ -184,7 +185,7 @@ impl ExecutionProxyClient {

fn spawn_decoupled_execution(
&self,
maybe_consensus_key: Option<Arc<PrivateKey>>,
maybe_consensus_key: Option<Arc<Ed25519PrivateKey>>,
commit_signer_provider: Arc<dyn CommitSignerProvider>,
epoch_state: Arc<EpochState>,
rand_config: Option<RandConfig>,
Expand Down Expand Up @@ -298,7 +299,7 @@ impl ExecutionProxyClient {
impl TExecutionClient for ExecutionProxyClient {
async fn start_epoch(
&self,
maybe_consensus_key: Option<Arc<PrivateKey>>,
maybe_consensus_key: Option<Arc<Ed25519PrivateKey>>,
epoch_state: Arc<EpochState>,
commit_signer_provider: Arc<dyn CommitSignerProvider>,
payload_manager: Arc<dyn TPayloadManager>,
Expand Down Expand Up @@ -492,7 +493,7 @@ pub struct DummyExecutionClient;
impl TExecutionClient for DummyExecutionClient {
async fn start_epoch(
&self,
_maybe_consensus_key: Option<Arc<PrivateKey>>,
_maybe_consensus_key: Option<Arc<Ed25519PrivateKey>>,
_epoch_state: Arc<EpochState>,
_commit_signer_provider: Arc<dyn CommitSignerProvider>,
_payload_manager: Arc<dyn TPayloadManager>,
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/quorum_store/batch_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
50 changes: 50 additions & 0 deletions consensus/src/quorum_store/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,46 @@ pub static MAIN_LOOP: Lazy<DurationHistogram> = Lazy::new(|| {
)
});

pub static PROOF_QUEUE_ADD_BATCH_SUMMARIES_DURATION: Lazy<DurationHistogram> = 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<DurationHistogram> = 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<DurationHistogram> = 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<DurationHistogram> = 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<DurationHistogram> = Lazy::new(|| {
DurationHistogram::new(
Expand All @@ -84,6 +124,8 @@ pub static PROOF_MANAGER_MAIN_LOOP: Lazy<DurationHistogram> = Lazy::new(|| {
)
});



/// Duration of each run of the event loop.
pub static BATCH_GENERATOR_MAIN_LOOP: Lazy<DurationHistogram> = Lazy::new(|| {
DurationHistogram::new(
Expand Down Expand Up @@ -397,6 +439,14 @@ pub static NUM_TOTAL_TXNS_LEFT_ON_UPDATE: Lazy<Histogram> = Lazy::new(|| {
)
});

pub static NUM_UNIQUE_TOTAL_TXNS_LEFT_ON_UPDATE: Lazy<Histogram> = 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<Histogram> = Lazy::new(|| {
register_avg_counter(
Expand Down
26 changes: 7 additions & 19 deletions execution/executor-test-helpers/src/integration_test_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -555,7 +543,7 @@ pub fn create_db_and_executor<P: AsRef<std::path::Path>>(
}

pub fn get_account_balance(state_view: &dyn StateView, address: &AccountAddress) -> u64 {
CoinStoreResource::<AptosCoinType>::fetch_move_resource(state_view, address)
CoinStoreResource::<SupraCoinType>::fetch_move_resource(state_view, address)
.unwrap()
.map_or(0, |coin_store| coin_store.coin())
}
Expand Down

0 comments on commit a423b77

Please sign in to comment.