From 65f6df57546bf8e7fbfdedc47b5a990959b24786 Mon Sep 17 00:00:00 2001 From: Junha Park <0xjunha@gmail.com> Date: Thu, 10 Oct 2024 20:00:08 +0900 Subject: [PATCH] Remove Option type in large_packages.move and update Move module address in chunked_publish.rs to the latest version --- aptos-move/framework/src/chunked_publish.rs | 6 +++--- .../large_packages/sources/large_packages.move | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/aptos-move/framework/src/chunked_publish.rs b/aptos-move/framework/src/chunked_publish.rs index fcf14bbb08cebe..aa79b70e521347 100644 --- a/aptos-move/framework/src/chunked_publish.rs +++ b/aptos-move/framework/src/chunked_publish.rs @@ -5,7 +5,7 @@ use aptos_types::transaction::{EntryFunction, TransactionPayload}; use move_core_types::{account_address::AccountAddress, ident_str, language_storage::ModuleId}; pub const LARGE_PACKAGES_MODULE_ADDRESS: &str = - "0xa29df848eebfe5d981f708c2a5b06d31af2be53bbd8ddc94c8523f4b903f7adb"; // mainnet and testnet + "0x0e1ca3011bdd07246d4d16d909dbb2d6953a86c4735d5acf5865d962c630cce7"; // mainnet and testnet /// Maximum code & metadata chunk size to be included in a transaction pub const MAX_CHUNK_SIZE_IN_BYTES: usize = 60_000; @@ -76,7 +76,7 @@ pub fn chunk_package_and_create_payloads( metadata_chunk, code_indices, code_chunks, - object_address, + object_address.expect("ObjectAddress is missing"), ), }; payloads.push(payload); @@ -159,7 +159,7 @@ fn large_packages_stage_code_chunk_and_upgrade_object_code( metadata_chunk: Vec, code_indices: Vec, code_chunks: Vec>, - code_object: Option, + code_object: AccountAddress, ) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( diff --git a/aptos-move/move-examples/large_packages/sources/large_packages.move b/aptos-move/move-examples/large_packages/sources/large_packages.move index cf3f4314cc821d..b7cf288c3bee62 100644 --- a/aptos-move/move-examples/large_packages/sources/large_packages.move +++ b/aptos-move/move-examples/large_packages/sources/large_packages.move @@ -10,7 +10,6 @@ /// Any missing index in this range will cause the function to fail. module large_packages::large_packages { use std::error; - use std::option::{Self, Option}; use std::signer; use std::vector; use aptos_std::smart_table::{Self, SmartTable}; @@ -66,10 +65,10 @@ module large_packages::large_packages { metadata_chunk: vector, code_indices: vector, code_chunks: vector>, - code_object: Option>, + code_object: Object, ) acquires StagingArea { let staging_area = stage_code_chunk_internal(owner, metadata_chunk, code_indices, code_chunks); - upgrade_object_code(owner, staging_area, option::extract(&mut code_object)); + upgrade_object_code(owner, staging_area, code_object); cleanup_staging_area(owner); } @@ -148,8 +147,8 @@ module large_packages::large_packages { staging_area: &mut StagingArea, ): vector> { let last_module_idx = staging_area.last_module_idx; - let code: vector> = vector[]; - let i: u64 = 0; + let code = vector[]; + let i = 0; while (i <= last_module_idx) { vector::push_back( &mut code,