Skip to content

Commit be5ac38

Browse files
authored
Merge branch 'main' into vk/assign-optimize
2 parents 427f426 + 9c1f69c commit be5ac38

File tree

67 files changed

+734
-410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+734
-410
lines changed

.github/workflows/provision-replay-verify-archive-disks.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
provision-testnet:
4747
if: |
4848
github.event_name == 'schedule' ||
49-
github.event_name == 'push' ||
5049
github.event_name == 'workflow_dispatch' && (inputs.NETWORK == 'testnet' || inputs.NETWORK == 'all')
5150
needs: determine-test-metadata
5251
uses: ./.github/workflows/workflow-run-replay-verify-archive-storage-provision.yaml

.github/workflows/replay-verify-on-archive.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
replay-testnet:
5959
if: |
6060
github.event_name == 'schedule' ||
61-
github.event_name == 'push' ||
6261
github.event_name == 'workflow_dispatch' && (inputs.NETWORK == 'testnet' || inputs.NETWORK == 'all')
6362
needs: determine-test-metadata
6463
uses: ./.github/workflows/workflow-run-replay-verify-on-archive.yaml
@@ -72,8 +71,6 @@ jobs:
7271
replay-mainnet:
7372
if: |
7473
github.event_name == 'schedule' ||
75-
github.event_name == 'push' ||
76-
github.event_name == 'pull_request' ||
7774
github.event_name == 'workflow_dispatch' && (inputs.NETWORK == 'mainnet' || inputs.NETWORK == 'all' )
7875
needs: determine-test-metadata
7976
uses: ./.github/workflows/workflow-run-replay-verify-on-archive.yaml

.github/workflows/workflow-run-replay-verify-archive-storage-provision.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
2323
with:
24-
ref: ${{ github.event.inputs.BRANCH || 'add_replay_verify_workflow' }}
24+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
2525

2626
# Authenticate to Google Cloud the project is aptos-ci
2727
- name: Authenticate to Google Cloud

.github/workflows/workflow-run-replay-verify-on-archive.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: Checkout code
4747
uses: actions/checkout@v4
4848
with:
49-
ref: ${{ github.event.inputs.BRANCH || 'add_replay_verify_workflow' }}
49+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
5050

5151
- uses: aptos-labs/aptos-core/.github/actions/docker-setup@main
5252
id: docker-setup
@@ -113,6 +113,7 @@ jobs:
113113
run: |
114114
cd testsuite/replay-verify
115115
poetry run python main.py --network ${{ inputs.NETWORK }} --cleanup
116+
echo "Cleanup completed"
116117
117118
118119

Cargo.lock

+9-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+9
Original file line numberDiff line numberDiff line change
@@ -916,3 +916,12 @@ serde-reflection = { git = "https://github.com/aptos-labs/serde-reflection", rev
916916
merlin = { git = "https://github.com/aptos-labs/merlin" }
917917
x25519-dalek = { git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1" }
918918
tonic = { git = "https://github.com/aptos-labs/tonic.git", rev = "0da1ba8b1751d6e19eb55be24cccf9ae933c666e" }
919+
futures = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
920+
futures-channel = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
921+
futures-executor = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
922+
futures-core = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
923+
futures-util = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
924+
futures-sink = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
925+
futures-io = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
926+
futures-task = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
927+
futures-macro = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }

api/src/transactions.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ use aptos_api_types::{
2525
AsConverter, EncodeSubmissionRequest, GasEstimation, GasEstimationBcs, HashValue,
2626
HexEncodedBytes, LedgerInfo, MoveType, PendingTransaction, SubmitTransactionRequest,
2727
Transaction, TransactionData, TransactionOnChainData, TransactionsBatchSingleSubmissionFailure,
28-
TransactionsBatchSubmissionResult, UserTransaction, VerifyInput, VerifyInputWithRecursion,
29-
MAX_RECURSIVE_TYPES_ALLOWED, U64,
28+
TransactionsBatchSubmissionResult, UserTransaction, VerifyInput, VerifyInputWithRecursion, U64,
3029
};
3130
use aptos_crypto::{hash::CryptoHash, signing_message};
3231
use aptos_types::{
@@ -1041,10 +1040,12 @@ impl TransactionsApi {
10411040
ledger_info: &LedgerInfo,
10421041
data: SubmitTransactionPost,
10431042
) -> Result<SignedTransaction, SubmitTransactionError> {
1043+
pub const MAX_SIGNED_TRANSACTION_DEPTH: usize = 16;
1044+
10441045
match data {
10451046
SubmitTransactionPost::Bcs(data) => {
10461047
let signed_transaction: SignedTransaction =
1047-
bcs::from_bytes_with_limit(&data.0, MAX_RECURSIVE_TYPES_ALLOWED as usize)
1048+
bcs::from_bytes_with_limit(&data.0, MAX_SIGNED_TRANSACTION_DEPTH)
10481049
.context("Failed to deserialize input into SignedTransaction")
10491050
.map_err(|err| {
10501051
SubmitTransactionError::bad_request_with_code(

api/types/src/move_types.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,9 @@ pub enum MoveType {
521521
Unparsable(String),
522522
}
523523

524-
/// Maximum number of recursive types
525-
/// Currently, this is allowed up to the serde limit of 16
526-
///
527-
/// TODO: Should this number be re-evaluated
528-
pub const MAX_RECURSIVE_TYPES_ALLOWED: u8 = 16;
524+
/// Maximum number of recursive types - Same as (non-public)
525+
/// move_core_types::safe_serialize::MAX_TYPE_TAG_NESTING
526+
pub const MAX_RECURSIVE_TYPES_ALLOWED: u8 = 8;
529527

530528
impl VerifyInputWithRecursion for MoveType {
531529
fn verify(&self, recursion_count: u8) -> anyhow::Result<()> {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Loop { loop_count: Some(100000), loop_type: NoOp } 60 0.960 1.119 42122.6
2+
Loop { loop_count: Some(10000), loop_type: Arithmetic } 60 0.956 1.074 26240.7
3+
CreateObjects { num_objects: 10, object_payload_size: 0 } 60 0.938 1.168 156.6
4+
CreateObjects { num_objects: 10, object_payload_size: 10240 } 60 0.924 1.086 9713.2
5+
CreateObjects { num_objects: 100, object_payload_size: 0 } 60 0.922 1.275 1577.0
6+
CreateObjects { num_objects: 100, object_payload_size: 10240 } 60 0.935 1.070 11728.7
7+
InitializeVectorPicture { length: 128 } 60 0.926 1.069 169.4
8+
VectorPicture { length: 128 } 60 0.908 1.075 50.2
9+
VectorPictureRead { length: 128 } 60 0.919 1.059 48.0
10+
InitializeVectorPicture { length: 30720 } 60 0.939 1.127 28404.4
11+
VectorPicture { length: 30720 } 60 0.936 1.095 6935.6
12+
VectorPictureRead { length: 30720 } 60 0.939 1.093 6948.2
13+
SmartTablePicture { length: 30720, num_points_per_txn: 200 } 60 0.947 1.080 43673.3
14+
SmartTablePicture { length: 1048576, num_points_per_txn: 300 } 60 0.947 1.111 74145.8
15+
ResourceGroupsSenderWriteTag { string_length: 1024 } 60 0.918 1.075 15.8
16+
ResourceGroupsSenderMultiChange { string_length: 1024 } 60 0.909 1.169 32.9
17+
TokenV1MintAndTransferFT 60 0.953 1.069 384.6
18+
TokenV1MintAndTransferNFTSequential 60 0.938 1.064 600.3
19+
TokenV2AmbassadorMint { numbered: true } 60 0.951 1.057 516.6
20+
LiquidityPoolSwap { is_stable: true } 60 0.961 1.139 582.6
21+
LiquidityPoolSwap { is_stable: false } 60 0.929 1.099 563.0
22+
CoinInitAndMint 60 0.928 1.130 205.0
23+
FungibleAssetMint 60 0.930 1.098 235.8
24+
IncGlobalMilestoneAggV2 { milestone_every: 1 } 60 0.914 1.051 33.5
25+
IncGlobalMilestoneAggV2 { milestone_every: 2 } 60 0.914 1.105 19.0
26+
EmitEvents { count: 1000 } 60 0.937 1.158 8818.7

aptos-move/e2e-benchmark/src/main.rs

+5-31
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use aptos_transaction_generator_lib::{
1515
use aptos_types::{account_address::AccountAddress, transaction::TransactionPayload};
1616
use rand::{rngs::StdRng, SeedableRng};
1717
use serde_json::json;
18-
use std::{collections::HashMap, process::exit};
18+
use std::{collections::HashMap, fs, process::exit};
1919

2020
// bump after a bigger test or perf change, so you can easily distinguish runs
2121
// that are on top of this commit
@@ -85,42 +85,16 @@ const ALLOWED_REGRESSION: f64 = 0.15;
8585
const ALLOWED_IMPROVEMENT: f64 = 0.15;
8686
const ABSOLUTE_BUFFER_US: f64 = 2.0;
8787

88-
const CALIBRATION_VALUES: &str = "
89-
Loop { loop_count: Some(100000), loop_type: NoOp } 60 0.955 1.074 41893.7
90-
Loop { loop_count: Some(10000), loop_type: Arithmetic } 60 0.965 1.078 25915.0
91-
CreateObjects { num_objects: 10, object_payload_size: 0 } 60 0.924 1.082 158.1
92-
CreateObjects { num_objects: 10, object_payload_size: 10240 } 60 0.951 1.118 9356.2
93-
CreateObjects { num_objects: 100, object_payload_size: 0 } 60 0.926 1.082 1574.2
94-
CreateObjects { num_objects: 100, object_payload_size: 10240 } 60 0.952 1.092 11541.9
95-
InitializeVectorPicture { length: 128 } 10 0.965 1.038 163.3
96-
VectorPicture { length: 128 } 10 0.938 1.060 48.8
97-
VectorPictureRead { length: 128 } 10 0.977 1.077 46.4
98-
InitializeVectorPicture { length: 30720 } 60 0.948 1.123 27893.4
99-
VectorPicture { length: 30720 } 60 0.931 1.125 6923.1
100-
VectorPictureRead { length: 30720 } 60 0.934 1.102 6923.1
101-
SmartTablePicture { length: 30720, num_points_per_txn: 200 } 60 0.952 1.109 43594.7
102-
SmartTablePicture { length: 1048576, num_points_per_txn: 300 } 60 0.957 1.120 73865.4
103-
ResourceGroupsSenderWriteTag { string_length: 1024 } 60 0.934 1.134 15.0
104-
ResourceGroupsSenderMultiChange { string_length: 1024 } 60 0.929 1.122 32.3
105-
TokenV1MintAndTransferFT 60 0.958 1.093 385.2
106-
TokenV1MintAndTransferNFTSequential 60 0.973 1.139 588.1
107-
TokenV2AmbassadorMint { numbered: true } 60 0.960 1.141 512.5
108-
LiquidityPoolSwap { is_stable: true } 60 0.961 1.103 590.3
109-
LiquidityPoolSwap { is_stable: false } 60 0.954 1.134 552.2
110-
CoinInitAndMint 10 0.975 1.043 199.6
111-
FungibleAssetMint 10 0.954 1.038 236.3
112-
IncGlobalMilestoneAggV2 { milestone_every: 1 } 10 0.960 1.047 32.9
113-
IncGlobalMilestoneAggV2 { milestone_every: 2 } 10 0.971 1.066 18.1
114-
EmitEvents { count: 1000 } 10 0.969 1.052 8615.5
115-
";
116-
11788
struct CalibrationInfo {
11889
// count: usize,
11990
expected_time_micros: f64,
12091
}
12192

12293
fn get_parsed_calibration_values() -> HashMap<String, CalibrationInfo> {
123-
CALIBRATION_VALUES
94+
let calibration_values =
95+
fs::read_to_string("aptos-move/e2e-benchmark/data/calibration_values.tsv")
96+
.expect("Unable to read file");
97+
calibration_values
12498
.trim()
12599
.split('\n')
126100
.map(|line| {

aptos-move/framework/aptos-framework/sources/account.move

-1
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,6 @@ module aptos_framework::account {
15901590
create_account_unchecked(addr);
15911591
register_coin<FakeCoin>(addr);
15921592

1593-
let eventhandle = &borrow_global<Account>(addr).coin_register_events;
15941593
let event = CoinRegister { account: addr, type_info: type_info::type_of<FakeCoin>() };
15951594

15961595
let events = event::emitted_events<CoinRegister>();

config/src/config/consensus_config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl Default for ConsensusConfig {
322322
num_bounded_executor_tasks: 16,
323323
enable_pre_commit: true,
324324
max_pending_rounds_in_commit_vote_cache: 100,
325-
optimistic_sig_verification: false,
325+
optimistic_sig_verification: true,
326326
enable_round_timeout_msg: true,
327327
enable_pipeline: false,
328328
}

consensus/consensus-types/src/order_vote_msg.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Parts of the project are originally copyright © Meta Platforms, Inc.
33
// SPDX-License-Identifier: Apache-2.0
44

5-
use crate::{order_vote::OrderVote, quorum_cert::QuorumCert};
5+
use crate::{common::Author, order_vote::OrderVote, quorum_cert::QuorumCert};
66
use anyhow::{ensure, Context};
77
use aptos_types::validator_verifier::ValidatorVerifier;
88
use serde::{Deserialize, Serialize};
@@ -46,7 +46,17 @@ impl OrderVoteMsg {
4646

4747
/// This function verifies the order_vote component in the order_vote_msg.
4848
/// The quorum cert is verified in the round manager when the quorum certificate is used.
49-
pub fn verify_order_vote(&self, validator: &ValidatorVerifier) -> anyhow::Result<()> {
49+
pub fn verify_order_vote(
50+
&self,
51+
sender: Author,
52+
validator: &ValidatorVerifier,
53+
) -> anyhow::Result<()> {
54+
ensure!(
55+
self.order_vote.author() == sender,
56+
"Order vote author {:?} is different from the sender {:?}",
57+
self.order_vote.author(),
58+
sender
59+
);
5060
ensure!(
5161
self.quorum_cert().certified_block() == self.order_vote().ledger_info().commit_info(),
5262
"QuorumCert and OrderVote do not match"

consensus/consensus-types/src/pipeline/commit_vote.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
use crate::common::{Author, Round};
6-
use anyhow::Context;
6+
use anyhow::{ensure, Context};
77
use aptos_crypto::{bls12381, CryptoMaterialError};
88
use aptos_short_hex_str::AsShortHexStr;
99
use aptos_types::{
@@ -101,7 +101,13 @@ impl CommitVote {
101101

102102
/// Verifies that the consensus data hash of LedgerInfo corresponds to the commit proposal,
103103
/// and then verifies the signature.
104-
pub fn verify(&self, validator: &ValidatorVerifier) -> anyhow::Result<()> {
104+
pub fn verify(&self, sender: Author, validator: &ValidatorVerifier) -> anyhow::Result<()> {
105+
ensure!(
106+
self.author() == sender,
107+
"Commit vote author {:?} doesn't match with the sender {:?}",
108+
self.author(),
109+
sender
110+
);
105111
validator
106112
.optimistic_verify(self.author(), &self.ledger_info, &self.signature)
107113
.context("Failed to verify Commit Vote")

consensus/consensus-types/src/pipelined_block.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ impl PipelineFutures {
107107
pub struct PipelineInputTx {
108108
pub rand_tx: Option<oneshot::Sender<Option<Randomness>>>,
109109
pub order_vote_tx: Option<oneshot::Sender<()>>,
110-
pub order_proof_tx: tokio::sync::broadcast::Sender<()>,
111-
pub commit_proof_tx: tokio::sync::broadcast::Sender<LedgerInfoWithSignatures>,
110+
pub order_proof_tx: Option<oneshot::Sender<()>>,
111+
pub commit_proof_tx: Option<oneshot::Sender<LedgerInfoWithSignatures>>,
112112
}
113113

114114
pub struct PipelineInputRx {
115115
pub rand_rx: oneshot::Receiver<Option<Randomness>>,
116116
pub order_vote_rx: oneshot::Receiver<()>,
117-
pub order_proof_rx: tokio::sync::broadcast::Receiver<()>,
118-
pub commit_proof_rx: tokio::sync::broadcast::Receiver<LedgerInfoWithSignatures>,
117+
pub order_proof_fut: TaskFuture<()>,
118+
pub commit_proof_fut: TaskFuture<LedgerInfoWithSignatures>,
119119
}
120120

121121
/// A representation of a block that has been added to the execution pipeline. It might either be in ordered

consensus/consensus-types/src/proposal_msg.rs

+9
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,19 @@ impl ProposalMsg {
8282

8383
pub fn verify(
8484
&self,
85+
sender: Author,
8586
validator: &ValidatorVerifier,
8687
proof_cache: &ProofCache,
8788
quorum_store_enabled: bool,
8889
) -> Result<()> {
90+
if let Some(proposal_author) = self.proposal.author() {
91+
ensure!(
92+
proposal_author == sender,
93+
"Proposal author {:?} doesn't match sender {:?}",
94+
proposal_author,
95+
sender
96+
);
97+
}
8998
self.proposal().payload().map_or(Ok(()), |p| {
9099
p.verify(validator, proof_cache, quorum_store_enabled)
91100
})?;

0 commit comments

Comments
 (0)