diff --git a/Cargo.lock b/Cargo.lock index 6f05bbc1f87f3..f6307b7b8d82a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1933,6 +1933,7 @@ dependencies = [ "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "clap 3.2.17", "futures", + "move-binary-format", "move-core-types", "move-model", "serde 1.0.149", diff --git a/aptos-move/aptos-release-builder/Cargo.toml b/aptos-move/aptos-release-builder/Cargo.toml index 237f7f05a4e25..bbda7a7ea823b 100644 --- a/aptos-move/aptos-release-builder/Cargo.toml +++ b/aptos-move/aptos-release-builder/Cargo.toml @@ -22,6 +22,7 @@ aptos-types = { workspace = true } bcs = { workspace = true } clap = { workspace = true } futures = { workspace = true } +move-binary-format = { workspace = true } move-core-types = { workspace = true } move-model = { workspace = true } serde = { workspace = true } diff --git a/aptos-move/aptos-release-builder/data/v1.2.0-testnet.yaml b/aptos-move/aptos-release-builder/data/v1.2.0-testnet.yaml new file mode 100644 index 0000000000000..17c3faae31c36 --- /dev/null +++ b/aptos-move/aptos-release-builder/data/v1.2.0-testnet.yaml @@ -0,0 +1,507 @@ +--- +testnet: true +is_multi_step: false +framework_release: + bytecode_version: 5 +gas_schedule: + feature_version: 5 + entries: + - - instr.nop + - 200 + - - instr.ret + - 1200 + - - instr.abort + - 1200 + - - instr.br_true + - 2400 + - - instr.br_false + - 2400 + - - instr.branch + - 1600 + - - instr.pop + - 800 + - - instr.ld_u8 + - 1200 + - - instr.ld_u16 + - 1200 + - - instr.ld_u32 + - 1200 + - - instr.ld_u64 + - 1200 + - - instr.ld_u128 + - 1600 + - - instr.ld_u256 + - 1600 + - - instr.ld_true + - 1200 + - - instr.ld_false + - 1200 + - - instr.ld_const.base + - 13000 + - - instr.ld_const.per_byte + - 700 + - - instr.imm_borrow_loc + - 1200 + - - instr.mut_borrow_loc + - 1200 + - - instr.imm_borrow_field + - 4000 + - - instr.mut_borrow_field + - 4000 + - - instr.imm_borrow_field_generic + - 4000 + - - instr.mut_borrow_field_generic + - 4000 + - - instr.copy_loc.base + - 1600 + - - instr.copy_loc.per_abs_val_unit + - 80 + - - instr.move_loc.base + - 2400 + - - instr.st_loc.base + - 2400 + - - instr.call.base + - 20000 + - - instr.call.per_arg + - 2000 + - - instr.call.per_local + - 2000 + - - instr.call_generic.base + - 20000 + - - instr.call_generic.per_ty_arg + - 2000 + - - instr.call_generic.per_arg + - 2000 + - - instr.call_generic.per_local + - 2000 + - - instr.pack.base + - 4400 + - - instr.pack.per_field + - 800 + - - instr.pack_generic.base + - 4400 + - - instr.pack_generic.per_field + - 800 + - - instr.unpack.base + - 4400 + - - instr.unpack.per_field + - 800 + - - instr.unpack_generic.base + - 4400 + - - instr.unpack_generic.per_field + - 800 + - - instr.read_ref.base + - 4000 + - - instr.read_ref.per_abs_val_unit + - 80 + - - instr.write_ref.base + - 4000 + - - instr.freeze_ref + - 200 + - - instr.cast_u8 + - 2400 + - - instr.cast_u16 + - 2400 + - - instr.cast_u32 + - 2400 + - - instr.cast_u64 + - 2400 + - - instr.cast_u128 + - 2400 + - - instr.cast_u256 + - 2400 + - - instr.add + - 3200 + - - instr.sub + - 3200 + - - instr.mul + - 3200 + - - instr.mod + - 3200 + - - instr.div + - 3200 + - - instr.bit_or + - 3200 + - - instr.bit_and + - 3200 + - - instr.bit_xor + - 3200 + - - instr.bit_shl + - 3200 + - - instr.bit_shr + - 3200 + - - instr.or + - 3200 + - - instr.and + - 3200 + - - instr.not + - 3200 + - - instr.lt + - 3200 + - - instr.gt + - 3200 + - - instr.le + - 3200 + - - instr.ge + - 3200 + - - instr.eq.base + - 2000 + - - instr.eq.per_abs_val_unit + - 80 + - - instr.neq.base + - 2000 + - - instr.neq.per_abs_val_unit + - 80 + - - instr.imm_borrow_global.base + - 10000 + - - instr.imm_borrow_global_generic.base + - 10000 + - - instr.mut_borrow_global.base + - 10000 + - - instr.mut_borrow_global_generic.base + - 10000 + - - instr.exists.base + - 5000 + - - instr.exists_generic.base + - 5000 + - - instr.move_from.base + - 7000 + - - instr.move_from_generic.base + - 7000 + - - instr.move_to.base + - 10000 + - - instr.move_to_generic.base + - 10000 + - - instr.vec_len.base + - 4400 + - - instr.vec_imm_borrow.base + - 6600 + - - instr.vec_mut_borrow.base + - 6600 + - - instr.vec_push_back.base + - 7600 + - - instr.vec_pop_back.base + - 5200 + - - instr.vec_swap.base + - 6000 + - - instr.vec_pack.base + - 12000 + - - instr.vec_pack.per_elem + - 800 + - - instr.vec_unpack.base + - 10000 + - - instr.vec_unpack.per_expected_elem + - 800 + - - txn.min_transaction_gas_units + - 1500000 + - - txn.large_transaction_cutoff + - 600 + - - txn.intrinsic_gas_per_byte + - 2000 + - - txn.maximum_number_of_gas_units + - 2000000 + - - txn.min_price_per_gas_unit + - 100 + - - txn.max_price_per_gas_unit + - 10000000000 + - - txn.max_transaction_size_in_bytes + - 65536 + - - txn.gas_unit_scaling_factor + - 10000 + - - txn.load_data.base + - 16000 + - - txn.load_data.per_byte + - 1000 + - - txn.load_data.failure + - 0 + - - txn.write_data.per_op + - 160000 + - - txn.write_data.new_item + - 1280000 + - - txn.write_data.per_byte_in_key + - 10000 + - - txn.write_data.per_byte_in_val + - 10000 + - - txn.memory_quota + - 10000000 + - - txn.free_write_bytes_quota + - 1024 + - - txn.max_bytes_per_write_op + - 1048576 + - - txn.max_bytes_all_write_ops_per_transaction + - 10485760 + - - txn.max_bytes_per_event + - 1048576 + - - txn.max_bytes_all_events_per_transaction + - 10485760 + - - move_stdlib.bcs.to_bytes.per_byte_serialized + - 200 + - - move_stdlib.bcs.to_bytes.failure + - 20000 + - - move_stdlib.hash.sha2_256.base + - 60000 + - - move_stdlib.hash.sha2_256.per_byte + - 1000 + - - move_stdlib.hash.sha3_256.base + - 80000 + - - move_stdlib.hash.sha3_256.per_byte + - 900 + - - move_stdlib.signer.borrow_address.base + - 4000 + - - move_stdlib.string.check_utf8.base + - 6000 + - - move_stdlib.string.check_utf8.per_byte + - 160 + - - move_stdlib.string.is_char_boundary.base + - 6000 + - - move_stdlib.string.sub_string.base + - 8000 + - - move_stdlib.string.sub_string.per_byte + - 60 + - - move_stdlib.string.index_of.base + - 8000 + - - move_stdlib.string.index_of.per_byte_pattern + - 400 + - - move_stdlib.string.index_of.per_byte_searched + - 200 + - - aptos_framework.account.create_address.base + - 6000 + - - aptos_framework.account.create_signer.base + - 6000 + - - aptos_framework.bls12381.base + - 3000 + - - aptos_framework.bls12381.per_pubkey_deserialize + - 2180000 + - - aptos_framework.bls12381.per_pubkey_aggregate + - 84000 + - - aptos_framework.bls12381.per_pubkey_subgroup_check + - 7400000 + - - aptos_framework.bls12381.per_sig_deserialize + - 4440000 + - - aptos_framework.bls12381.per_sig_aggregate + - 233000 + - - aptos_framework.bls12381.per_sig_subgroup_check + - 9210000 + - - aptos_framework.bls12381.per_sig_verify + - 169700000 + - - aptos_framework.bls12381.per_pop_verify + - 206000000 + - - aptos_framework.bls12381.per_pairing + - 80260000 + - - aptos_framework.bls12381.per_msg_hashing + - 30800000 + - - aptos_framework.bls12381.per_byte_hashing + - 1000 + - - aptos_framework.signature.base + - 3000 + - - aptos_framework.signature.per_pubkey_deserialize + - 760000 + - - aptos_framework.signature.per_pubkey_small_order_check + - 127000 + - - aptos_framework.signature.per_sig_deserialize + - 7500 + - - aptos_framework.signature.per_sig_strict_verify + - 5340000 + - - aptos_framework.signature.per_msg_hashing_base + - 64800 + - - aptos_framework.signature.per_msg_byte_hashing + - 1200 + - - aptos_framework.secp256k1.base + - 3000 + - - aptos_framework.secp256k1.ecdsa_recover + - 32200000 + - - aptos_framework.ristretto255.basepoint_mul + - 2560000 + - - aptos_framework.ristretto255.basepoint_double_mul + - 8800000 + - - aptos_framework.ristretto255.point_add + - 42700 + - - aptos_framework.ristretto255.point_compress + - 800000 + - - aptos_framework.ristretto255.point_decompress + - 810000 + - - aptos_framework.ristretto255.point_equals + - 46000 + - - aptos_framework.ristretto255.point_from_64_uniform_bytes + - 1630000 + - - aptos_framework.ristretto255.point_identity + - 3000 + - - aptos_framework.ristretto255.point_mul + - 9420000 + - - aptos_framework.ristretto255.point_neg + - 7200 + - - aptos_framework.ristretto255.point_sub + - 42600 + - - aptos_framework.ristretto255.point_parse_arg + - 3000 + - - aptos_framework.ristretto255.scalar_sha512_per_byte + - 1200 + - - aptos_framework.ristretto255.scalar_sha512_per_hash + - 64800 + - - aptos_framework.ristretto255.scalar_add + - 15400 + - - aptos_framework.ristretto255.scalar_reduced_from_32_bytes + - 14200 + - - aptos_framework.ristretto255.scalar_uniform_from_64_bytes + - 24900 + - - aptos_framework.ristretto255.scalar_from_u128 + - 3500 + - - aptos_framework.ristretto255.scalar_from_u64 + - 3500 + - - aptos_framework.ristretto255.scalar_invert + - 2200000 + - - aptos_framework.ristretto255.scalar_is_canonical + - 23000 + - - aptos_framework.ristretto255.scalar_mul + - 21300 + - - aptos_framework.ristretto255.scalar_neg + - 14500 + - - aptos_framework.ristretto255.scalar_sub + - 21200 + - - aptos_framework.ristretto255.scalar_parse_arg + - 3000 + - - aptos_framework.hash.sip_hash.base + - 20000 + - - aptos_framework.hash.sip_hash.per_byte + - 400 + - - aptos_framework.hash.keccak256.base + - 80000 + - - aptos_framework.hash.keccak256.per_byte + - 900 + - - aptos_framework.type_info.type_of.base + - 6000 + - - aptos_framework.type_info.type_of.per_abstract_memory_unit + - 100 + - - aptos_framework.type_info.type_name.base + - 6000 + - - aptos_framework.type_info.type_name.per_abstract_memory_unit + - 100 + - - aptos_framework.type_info.chain_id.base + - 3000 + - - aptos_framework.hash.sha2_512.base + - 3240 + - - aptos_framework.hash.sha2_512.per_byte + - 60 + - - aptos_framework.hash.sha3_512.base + - 4500 + - - aptos_framework.hash.sha3_512.per_byte + - 50 + - - aptos_framework.hash.ripemd160.base + - 3000 + - - aptos_framework.hash.ripemd160.per_byte + - 50 + - - aptos_framework.util.from_bytes.base + - 6000 + - - aptos_framework.util.from_bytes.per_byte + - 100 + - - aptos_framework.transaction_context.get_script_hash.base + - 4000 + - - aptos_framework.code.request_publish.base + - 10000 + - - aptos_framework.code.request_publish.per_byte + - 40 + - - aptos_framework.event.write_to_event_store.base + - 500000 + - - aptos_framework.event.write_to_event_store.per_abstract_memory_unit + - 5000 + - - aptos_framework.state_storage.get_usage.base + - 10000 + - - aptos_framework.aggregator.add.base + - 6000 + - - aptos_framework.aggregator.read.base + - 6000 + - - aptos_framework.aggregator.sub.base + - 6000 + - - aptos_framework.aggregator.destroy.base + - 10000 + - - aptos_framework.aggregator_factory.new_aggregator.base + - 10000 + - - table.common.load.base + - 8000 + - - table.common.load.per_byte + - 1000 + - - table.common.load.failure + - 0 + - - table.new_table_handle.base + - 20000 + - - table.add_box.base + - 24000 + - - table.add_box.per_byte_serialized + - 200 + - - table.borrow_box.base + - 24000 + - - table.borrow_box.per_byte_serialized + - 200 + - - table.contains_box.base + - 24000 + - - table.contains_box.per_byte_serialized + - 200 + - - table.remove_box.base + - 24000 + - - table.remove_box.per_byte_serialized + - 200 + - - table.destroy_empty_box.base + - 24000 + - - table.drop_unchecked_box.base + - 2000 + - - misc.abs_val.u8 + - 40 + - - misc.abs_val.u16 + - 40 + - - misc.abs_val.u32 + - 40 + - - misc.abs_val.u64 + - 40 + - - misc.abs_val.u128 + - 40 + - - misc.abs_val.u256 + - 40 + - - misc.abs_val.bool + - 40 + - - misc.abs_val.address + - 40 + - - misc.abs_val.struct + - 40 + - - misc.abs_val.vector + - 40 + - - misc.abs_val.reference + - 40 + - - misc.abs_val.per_u8_packed + - 1 + - - misc.abs_val.per_u16_packed + - 2 + - - misc.abs_val.per_u32_packed + - 4 + - - misc.abs_val.per_u64_packed + - 8 + - - misc.abs_val.per_u128_packed + - 16 + - - misc.abs_val.per_u256_packed + - 32 + - - misc.abs_val.per_bool_packed + - 1 + - - misc.abs_val.per_address_packed + - 32 +consensus_config: + V1: + decoupled_execution: true + back_pressure_limit: 10 + exclude_round: 20 + proposer_election_type: + leader_reputation: + proposer_and_voter_v2: + active_weight: 1000 + inactive_weight: 10 + failed_weight: 1 + failure_threshold_percent: 10 + proposer_window_num_validators_multiplier: 10 + voter_window_num_validators_multiplier: 1 + weight_by_voting_power: true + use_history_from_previous_epoch_max_count: 5 + max_failed_authors_to_store: 10 +feature_flags: + enabled: + - code_dependency_check + - treat_friend_as_private + - v_m_binary_format_v6 + disabled: [] \ No newline at end of file diff --git a/aptos-move/aptos-release-builder/src/components/framework.rs b/aptos-move/aptos-release-builder/src/components/framework.rs index db238b0e3cb4e..26f61542c8ff7 100644 --- a/aptos-move/aptos-release-builder/src/components/framework.rs +++ b/aptos-move/aptos-release-builder/src/components/framework.rs @@ -4,9 +4,16 @@ use anyhow::Result; use aptos_crypto::HashValue; use aptos_temppath::TempPath; +use serde::{Deserialize, Serialize}; use std::process::Command; +#[derive(Serialize, Deserialize, Clone, Eq, PartialEq)] +pub struct FrameworkReleaseConfig { + pub bytecode_version: u32, +} + pub fn generate_upgrade_proposals( + config: &FrameworkReleaseConfig, is_testnet: bool, next_execution_hash: String, ) -> Result> { @@ -46,6 +53,8 @@ pub fn generate_upgrade_proposals( .unwrap() .to_string(); + let bytecode_version = format!("{:?}", config.bytecode_version); + let mut args = vec![ "run", "--bin", @@ -59,6 +68,8 @@ pub fn generate_upgrade_proposals( move_script_path.to_str().unwrap(), "--package-dir", package_path.to_str().unwrap(), + "--bytecode-version", + bytecode_version.as_str(), ]; if is_testnet { diff --git a/aptos-move/aptos-release-builder/src/components/mod.rs b/aptos-move/aptos-release-builder/src/components/mod.rs index 3ca1f486c37fa..5b54caa08c5bf 100644 --- a/aptos-move/aptos-release-builder/src/components/mod.rs +++ b/aptos-move/aptos-release-builder/src/components/mod.rs @@ -1,6 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use self::framework::FrameworkReleaseConfig; use crate::components::feature_flags::Features; use anyhow::{anyhow, Result}; use aptos_crypto::HashValue; @@ -28,7 +29,7 @@ pub mod version; pub struct ReleaseConfig { pub testnet: bool, pub remote_endpoint: Option, - pub framework_release: bool, + pub framework_release: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub gas_schedule: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -122,8 +123,9 @@ impl ReleaseConfig { _client: &Option, result: &mut Vec<(String, String)>, ) -> Result<()> { - if self.framework_release { + if let Some(framework_release) = &self.framework_release { result.append(&mut framework::generate_upgrade_proposals( + framework_release, self.testnet, if self.is_multi_step { Self::get_execution_hash(result) @@ -183,7 +185,7 @@ impl ReleaseConfig { result: &mut Vec<(String, String)>, ) -> Result<()> { if let Some(feature_flags) = &self.feature_flags { - let mut needs_update = false; + let mut needs_update = true; if let Some(client) = client { let features = block_on(async { client @@ -217,7 +219,7 @@ impl ReleaseConfig { result: &mut Vec<(String, String)>, ) -> Result<()> { if let Some(consensus_config) = &self.consensus_config { - if fetch_and_equals(client, consensus_config)? { + if !fetch_and_equals(client, consensus_config)? { result.append(&mut consensus_config::generate_consensus_upgrade_proposal( consensus_config, self.testnet, @@ -282,7 +284,9 @@ impl Default for ReleaseConfig { fn default() -> Self { ReleaseConfig { testnet: true, - framework_release: true, + framework_release: Some(FrameworkReleaseConfig { + bytecode_version: 5, + }), gas_schedule: Some(aptos_gas::gen::current_gas_schedule()), version: None, feature_flags: None,