Skip to content

Commit

Permalink
Remove Option type in large_packages.move (#14930)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjunha authored Oct 25, 2024
1 parent cd49e1c commit bb0a7c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions aptos-move/framework/src/chunked_publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -159,7 +159,7 @@ fn large_packages_stage_code_chunk_and_upgrade_object_code(
metadata_chunk: Vec<u8>,
code_indices: Vec<u16>,
code_chunks: Vec<Vec<u8>>,
code_object: Option<AccountAddress>,
code_object: AccountAddress,
) -> TransactionPayload {
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -66,10 +65,10 @@ module large_packages::large_packages {
metadata_chunk: vector<u8>,
code_indices: vector<u16>,
code_chunks: vector<vector<u8>>,
code_object: Option<Object<PackageRegistry>>,
code_object: Object<PackageRegistry>,
) 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);
}

Expand Down Expand Up @@ -148,8 +147,8 @@ module large_packages::large_packages {
staging_area: &mut StagingArea,
): vector<vector<u8>> {
let last_module_idx = staging_area.last_module_idx;
let code: vector<vector<u8>> = vector[];
let i: u64 = 0;
let code = vector[];
let i = 0;
while (i <= last_module_idx) {
vector::push_back(
&mut code,
Expand Down

0 comments on commit bb0a7c2

Please sign in to comment.