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 28, 2024
1 parent 86ed3d1 commit 3f1f382
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1121,9 +1121,9 @@ pub enum EntryFunctionCall {

VestingWithoutStakingCreateVestingContractWithAmounts {
shareholders: Vec<AccountAddress>,
amounts: Vec<u64>,
schedule_numerator: Vec<u64>,
schedule_denominator: u64,
shares: Vec<u64>,
vesting_numerators: Vec<u64>,
vesting_denominator: u64,
start_timestamp_secs: u64,
period_duration: u64,
withdrawal_address: AccountAddress,
Expand Down Expand Up @@ -1850,18 +1850,18 @@ impl EntryFunctionCall {
},
VestingWithoutStakingCreateVestingContractWithAmounts {
shareholders,
amounts,
schedule_numerator,
schedule_denominator,
shares,
vesting_numerators,
vesting_denominator,
start_timestamp_secs,
period_duration,
withdrawal_address,
contract_creation_seed,
} => vesting_without_staking_create_vesting_contract_with_amounts(
shareholders,
amounts,
schedule_numerator,
schedule_denominator,
shares,
vesting_numerators,
vesting_denominator,
start_timestamp_secs,
period_duration,
withdrawal_address,
Expand Down Expand Up @@ -5068,9 +5068,9 @@ pub fn vesting_without_staking_admin_withdraw(

pub fn vesting_without_staking_create_vesting_contract_with_amounts(
shareholders: Vec<AccountAddress>,
amounts: Vec<u64>,
schedule_numerator: Vec<u64>,
schedule_denominator: u64,
shares: Vec<u64>,
vesting_numerators: Vec<u64>,
vesting_denominator: u64,
start_timestamp_secs: u64,
period_duration: u64,
withdrawal_address: AccountAddress,
Expand All @@ -5088,9 +5088,9 @@ pub fn vesting_without_staking_create_vesting_contract_with_amounts(
vec![],
vec![
bcs::to_bytes(&shareholders).unwrap(),
bcs::to_bytes(&amounts).unwrap(),
bcs::to_bytes(&schedule_numerator).unwrap(),
bcs::to_bytes(&schedule_denominator).unwrap(),
bcs::to_bytes(&shares).unwrap(),
bcs::to_bytes(&vesting_numerators).unwrap(),
bcs::to_bytes(&vesting_denominator).unwrap(),
bcs::to_bytes(&start_timestamp_secs).unwrap(),
bcs::to_bytes(&period_duration).unwrap(),
bcs::to_bytes(&withdrawal_address).unwrap(),
Expand Down Expand Up @@ -7069,9 +7069,9 @@ mod decoder {
Some(
EntryFunctionCall::VestingWithoutStakingCreateVestingContractWithAmounts {
shareholders: bcs::from_bytes(script.args().get(0)?).ok()?,
amounts: bcs::from_bytes(script.args().get(1)?).ok()?,
schedule_numerator: bcs::from_bytes(script.args().get(2)?).ok()?,
schedule_denominator: bcs::from_bytes(script.args().get(3)?).ok()?,
shares: bcs::from_bytes(script.args().get(1)?).ok()?,
vesting_numerators: bcs::from_bytes(script.args().get(2)?).ok()?,
vesting_denominator: bcs::from_bytes(script.args().get(3)?).ok()?,
start_timestamp_secs: bcs::from_bytes(script.args().get(4)?).ok()?,
period_duration: bcs::from_bytes(script.args().get(5)?).ok()?,
withdrawal_address: bcs::from_bytes(script.args().get(6)?).ok()?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ Create a vesting schedule with the given schedule of distributions, a vesting st



<pre><code><b>public</b> entry <b>fun</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_with_amounts">create_vesting_contract_with_amounts</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, shareholders: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<b>address</b>&gt;, amounts: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, schedule_numerator: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, schedule_denominator: u64, start_timestamp_secs: u64, period_duration: u64, withdrawal_address: <b>address</b>, contract_creation_seed: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
<pre><code><b>public</b> entry <b>fun</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_with_amounts">create_vesting_contract_with_amounts</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, shareholders: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<b>address</b>&gt;, shares: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, vesting_numerators: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;, vesting_denominator: u64, start_timestamp_secs: u64, period_duration: u64, withdrawal_address: <b>address</b>, contract_creation_seed: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
</code></pre>


Expand All @@ -1126,21 +1126,21 @@ Create a vesting schedule with the given schedule of distributions, a vesting st
<pre><code><b>public</b> entry <b>fun</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_with_amounts">create_vesting_contract_with_amounts</a> (
admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>,
shareholders: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<b>address</b>&gt;,
amounts: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
schedule_numerator: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
schedule_denominator: u64,
shares: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
vesting_numerators: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u64&gt;,
vesting_denominator: u64,
start_timestamp_secs: u64,
period_duration: u64,
withdrawal_address: <b>address</b>,
contract_creation_seed: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;,
) <b>acquires</b> <a href="vesting_without_staking.md#0x1_vesting_without_staking_AdminStore">AdminStore</a> {
<b>assert</b>!(!<a href="system_addresses.md#0x1_system_addresses_is_reserved_address">system_addresses::is_reserved_address</a>(withdrawal_address),
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="vesting_without_staking.md#0x1_vesting_without_staking_EINVALID_WITHDRAWAL_ADDRESS">EINVALID_WITHDRAWAL_ADDRESS</a>),);
assert_account_is_registered_for_apt(withdrawal_address);
assert_account_is_registered_for_supra(withdrawal_address);
<b>assert</b>!(<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shareholders) &gt; 0,
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="vesting_without_staking.md#0x1_vesting_without_staking_ENO_SHAREHOLDERS">ENO_SHAREHOLDERS</a>));
<b>assert</b>!(
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shareholders) == <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&amounts),
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shareholders) == <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_length">vector::length</a>(&shares),
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="vesting_without_staking.md#0x1_vesting_without_staking_ESHARES_LENGTH_MISMATCH">ESHARES_LENGTH_MISMATCH</a>),
);

Expand All @@ -1160,15 +1160,15 @@ Create a vesting schedule with the given schedule of distributions, a vesting st
<b>let</b> (contract_signer, contract_signer_cap) = <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_contract_account">create_vesting_contract_account</a>(admin,
contract_creation_seed);
<b>let</b> contract_signer_address = <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of">signer::address_of</a>(&contract_signer);
<b>let</b> schedule = <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_map_ref">vector::map_ref</a>(&schedule_numerator, |numerator| {
<b>let</b> <a href="event.md#0x1_event">event</a> = <a href="../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_create_from_rational">fixed_point32::create_from_rational</a>(*numerator, schedule_denominator);
<b>let</b> schedule = <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_map_ref">vector::map_ref</a>(&vesting_numerators, |numerator| {
<b>let</b> <a href="event.md#0x1_event">event</a> = <a href="../../aptos-stdlib/../move-stdlib/doc/fixed_point32.md#0x1_fixed_point32_create_from_rational">fixed_point32::create_from_rational</a>(*numerator, vesting_denominator);
<a href="event.md#0x1_event">event</a>
});

<b>let</b> vesting_schedule = <a href="vesting_without_staking.md#0x1_vesting_without_staking_create_vesting_schedule">create_vesting_schedule</a>(schedule, start_timestamp_secs, period_duration);
<b>let</b> shareholders_map = <a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_create">simple_map::create</a>&lt;<b>address</b>, <a href="vesting_without_staking.md#0x1_vesting_without_staking_VestingRecord">VestingRecord</a>&gt;();
<b>let</b> grant_amount = 0;
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_for_each_reverse">vector::for_each_reverse</a>(amounts, |amount| {
<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_for_each_reverse">vector::for_each_reverse</a>(shares, |amount| {
<b>let</b> shareholder = <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_pop_back">vector::pop_back</a>(&<b>mut</b> shareholders);
<a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_add">simple_map::add</a>(&<b>mut</b> shareholders_map,
shareholder,
Expand Down
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
58 changes: 58 additions & 0 deletions consensus/src/quorum_store/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ static TRANSACTION_COUNT_BUCKETS: Lazy<Vec<f64>> = Lazy::new(|| {
.unwrap()
});

static PROOF_COUNT_BUCKETS: Lazy<Vec<f64>> = Lazy::new(|| {
[
1.0, 3.0, 5.0, 7.0, 10.0, 12.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 75.0, 100.0,
125.0, 150.0, 200.0, 250.0, 300.0, 500.0,
]
.to_vec()
});

static BYTE_BUCKETS: Lazy<Vec<f64>> = Lazy::new(|| {
exponential_buckets(
/*start=*/ 500.0, /*factor=*/ 1.5, /*count=*/ 25,
Expand Down Expand Up @@ -73,6 +81,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 +132,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 +447,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
Loading

0 comments on commit 3f1f382

Please sign in to comment.