Skip to content

Commit

Permalink
[move-vm] Increase bytecode VERSION_MAX to v8
Browse files Browse the repository at this point in the history
This creates a lot of diffs in baselines allover the codebase, so putting it into its own PR. No functional change expected, as this only sets VERSION_MAX but not VERSION_DEFAULT, and the bytecode version on chain is furthermore controlled by feature flags.
  • Loading branch information
wrwg committed Jan 21, 2025
1 parent 4125bd8 commit eb9de68
Show file tree
Hide file tree
Showing 289 changed files with 417 additions and 397 deletions.
2 changes: 1 addition & 1 deletion aptos-move/aptos-e2e-comparison-testing/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl Execution {
// Update features if needed to the correct binary format used by V2 compiler.
let mut features = Features::fetch_config(&state).unwrap_or_default();
if v2_flag {
features.enable(FeatureFlag::VM_BINARY_FORMAT_V7);
features.enable(FeatureFlag::VM_BINARY_FORMAT_V8);
} else {
features.enable(FeatureFlag::VM_BINARY_FORMAT_V6);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub enum FeatureFlag {
EnableCallTreeAndInstructionVMCache,
PermissionedSigner,
AccountAbstraction,
VMBinaryFormatV8,
}

fn generate_features_blob(writer: &CodeWriter, data: &[u64]) {
Expand Down Expand Up @@ -229,6 +230,7 @@ impl From<FeatureFlag> for AptosFeatureFlag {
FeatureFlag::AptosStdChainIdNatives => AptosFeatureFlag::APTOS_STD_CHAIN_ID_NATIVES,
FeatureFlag::VMBinaryFormatV6 => AptosFeatureFlag::VM_BINARY_FORMAT_V6,
FeatureFlag::VMBinaryFormatV7 => AptosFeatureFlag::VM_BINARY_FORMAT_V7,
FeatureFlag::VMBinaryFormatV8 => AptosFeatureFlag::VM_BINARY_FORMAT_V8,
FeatureFlag::MultiEd25519PkValidateV2Natives => {
AptosFeatureFlag::MULTI_ED25519_PK_VALIDATE_V2_NATIVES
},
Expand Down Expand Up @@ -384,6 +386,7 @@ impl From<AptosFeatureFlag> for FeatureFlag {
AptosFeatureFlag::APTOS_STD_CHAIN_ID_NATIVES => FeatureFlag::AptosStdChainIdNatives,
AptosFeatureFlag::VM_BINARY_FORMAT_V6 => FeatureFlag::VMBinaryFormatV6,
AptosFeatureFlag::VM_BINARY_FORMAT_V7 => FeatureFlag::VMBinaryFormatV7,
AptosFeatureFlag::VM_BINARY_FORMAT_V8 => FeatureFlag::VMBinaryFormatV8,
AptosFeatureFlag::MULTI_ED25519_PK_VALIDATE_V2_NATIVES => {
FeatureFlag::MultiEd25519PkValidateV2Natives
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
processed 4 tasks

task 1 'print-bytecode'. lines 4-35:
// Move bytecode v7
// Move bytecode v8
module f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6.game {
use 0000000000000000000000000000000000000000000000000000000000000001::signer;
use 0000000000000000000000000000000000000000000000000000000000000001::debug;
Expand Down
7 changes: 1 addition & 6 deletions aptos-move/aptos-vm/src/move_vm_ext/warm_vm_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use aptos_gas_schedule::AptosGasParameters;
use aptos_infallible::RwLock;
use aptos_metrics_core::TimerHelper;
use aptos_native_interface::SafeNativeBuilder;
use aptos_types::{
on_chain_config::{FeatureFlag, OnChainConfig},
state_store::state_key::StateKey,
};
use aptos_types::{on_chain_config::OnChainConfig, state_store::state_key::StateKey};
use aptos_vm_environment::environment::AptosEnvironment;
use bytes::Bytes;
use move_binary_format::errors::{Location, PartialVMError, VMResult};
Expand Down Expand Up @@ -102,7 +99,6 @@ struct WarmVmId {
natives: Bytes,
vm_config: Bytes,
core_packages_registry: Option<Bytes>,
bin_v7_enabled: bool,
inject_create_signer_for_gov_sim: bool,
}

Expand Down Expand Up @@ -137,7 +133,6 @@ impl WarmVmId {
natives,
vm_config: Self::vm_config_bytes(env.vm_config()),
core_packages_registry: Self::core_packages_id_bytes(resolver)?,
bin_v7_enabled: env.features().is_enabled(FeatureFlag::VM_BINARY_FORMAT_V7),
inject_create_signer_for_gov_sim,
})
}
Expand Down
3 changes: 1 addition & 2 deletions aptos-move/framework/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ impl ProverOptions {
|| base_opts.prover.check_inconsistency,
unconditional_abort_as_inconsistency: self.unconditional_abort_as_inconsistency
|| base_opts.prover.unconditional_abort_as_inconsistency,
skip_loop_analysis: self.keep_loops
|| base_opts.prover.unconditional_abort_as_inconsistency,
skip_loop_analysis: self.keep_loops || base_opts.prover.skip_loop_analysis,
..base_opts.prover.clone()
},
backend: move_prover_boogie_backend::options::BoogieOptions {
Expand Down
10 changes: 10 additions & 0 deletions third_party/move/move-binary-format/src/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use crate::{
access::{ModuleAccess, ScriptAccess},
errors::{PartialVMError, PartialVMResult},
file_format_common,
file_format_common::VERSION_DEFAULT,
internals::ModuleIndex,
IndexKind,
};
Expand Down Expand Up @@ -3397,6 +3398,15 @@ impl Arbitrary for CompiledModule {
}

impl CompiledModule {
/// Sets the version of this module to VERSION_DEFAULT.The default initial value
/// is VERSION_MAX.
pub fn set_default_version(self) -> Self {
Self {
version: VERSION_DEFAULT,
..self
}
}

/// Returns the count of a specific `IndexKind`
pub fn kind_count(&self, kind: IndexKind) -> usize {
debug_assert!(!matches!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ pub const VERSION_8: u32 = 8;

/// Mark which version is the latest version. Should be set to v8 once features
/// are added.
pub const VERSION_MAX: u32 = VERSION_7;
pub const VERSION_MAX: u32 = VERSION_8;

/// Mark which version is the default version. This is the version used by default by tools like
/// the compiler. Notice that this version might be different from the one supported on nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ fun m::f($t0: u8, $t1: &vector<u64>): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.m {
struct R has key {
data: vector<u64>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,7 @@ fun <SELF>_0::check() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
script {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public fun M::g($t0: &signer) {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.M {
struct R has key {
f: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fun explicate_drop::test0(): u8 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.explicate_drop {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ fun m::g() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.m {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ fun m::drop_after_loop() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.m {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fun explicate_drop::drop_at_branch($t0: bool): u8 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.explicate_drop {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ fun m::test_for_each_mut() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.m {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fun m::g<#0>($t0: &mut vector<#0>) {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module c0ffee.m {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public fun m::scalar_zero(): 0x42::m::Scalar {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.m {
struct Scalar has copy, drop, store {
data: vector<u8>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fun assign::assign_struct($t0: &mut 0x42::assign::S) {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.assign {
struct T has drop {
h: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public fun assign::main(): (u64, u64) {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.assign {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fun borrow::mut_param($t0: u64): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.borrow {
struct S {
f: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fun test::optimize_vector() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.test {
struct X has copy, drop, key {
value: bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fun m::update_non_common_field(): u32 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 815.m {
enum CommonFields has drop {
Foo{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fun m::test_common_access(): u8 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 815.m {
enum Positional has drop {
A{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public fun m::add_when_missing($t0: address, $t1: u64) {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 815.m {
struct MyMap has key {
table: Table<address, ValueWrap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fun M::t0_u128() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 8675309.M {
struct R<Ty0: key> {
r: Ty0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public fun M::testb(): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 8675.M {
struct S has copy, drop {
f: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fun m::will_autoref(): address {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.m {
struct Object has copy, drop {
inner: address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ fun fields::write_val($t0: 0x42::fields::S): 0x42::fields::S {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.fields {
struct T has drop {
h: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ warning: Unused assignment to `x`. Consider removing or prefixing with an unders


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.freeze_mut_ref {
struct G {
f: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fun globals::write($t0: address, $t1: u64): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.globals {
struct R has store, key {
f: u64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fun if_else::if_else_nested($t0: bool, $t1: u64): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.if_else {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fun inline_specs::succ($t0: u64): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.inline_specs {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fun loops::while_loop_with_break_and_continue($t0: u64): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.loops {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fun test::f1() {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 815.test {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fun m::t($t0: 0x815::m::E): u64 {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 815.m {
enum E {
None{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fun operators::order($t0: u64, $t1: u64): bool {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.operators {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fun pack_unpack::pack6($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.pack_unpack {
struct S {
f1: u8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fun pack_unpack::unpack($t0: 0x42::pack_unpack::S): (u64, u64) {


============ disassembled file-format ==================
// Move bytecode v7
// Move bytecode v8
module 42.pack_unpack {
struct T {
h: u64
Expand Down
Loading

0 comments on commit eb9de68

Please sign in to comment.