Repository: aptos-labs/aptos-core
File: crates/aptos/src/move_tool/mod.rs (Rust)

Code before:
                package,
                PublishType::ObjectDeploy,
                Some(object_address),
            )?
            .payload;

            let size = bcs::serialized_size(&payload)?;
            println!("package size {} bytes", size);

            if !self.override_size_check_option.override_size_check
                && size > MAX_PUBLISH_PACKAGE_SIZE
            {
                return Err(CliError::PackageSizeExceeded(
                    size,
                    MAX_PUBLISH_PACKAGE_SIZE,
                ));
            }
            dispatch_transaction(payload, &self.txn_options).await
        };

        if let Ok(tx_summary) = &mut result {
            println!(
                "Code was successfully deployed to object address {}",
                object_address
            );
            tx_summary.object_address = Some(object_address);
        }

        result
    }
}

/// Upgrades the modules in a Move package deployed under an object.
#[derive(Parser)]
pub struct UpgradeCodeObject {
    /// The named address for compiling and using in the contract
    #[clap(long)]
    pub(crate) address_name: String,
    /// Address of the object the package was deployed to
    ///
    /// This must be an already deployed object containing the package
    /// if the package is not already created, it will fail.
    #[clap(long, value_parser = crate::common::types::load_account_arg)]
    pub(crate) object_address: AccountAddress,
    #[clap(flatten)]
    pub(crate) override_size_check_option: OverrideSizeCheckOption,
    #[clap(flatten)]
    pub(crate) chunked_publish_option: ChunkedPublishOption,
    #[clap(flatten)]
    pub(crate) included_artifacts_args: IncludedArtifactsArgs,
    #[clap(flatten)]

Review comment (suggestion):
Now I see, `object_address` is where code is deployed? Probably it is better to change the name to reflect this.

Code after:
        } else {
            let payload = create_package_publication_data(
                package,
                PublishType::ObjectDeploy,
                Some(object_address),
            )?
            .payload;

            let size = bcs::serialized_size(&payload)?;
            println!("package size {} bytes", size);

            if !self.override_size_check_option.override_size_check
                && size > MAX_PUBLISH_PACKAGE_SIZE
            {
                return Err(CliError::PackageSizeExceeded(
                    size,
                    MAX_PUBLISH_PACKAGE_SIZE,
                ));
            }
            dispatch_transaction(payload, &self.txn_options).await
        };

        if let Ok(tx_summary) = &mut result {
            if let Some(true) = tx_summary.success {
                println!(
                    "Code was successfully deployed to object address {}",
                    object_address
                );
                tx_summary.deployed_object_address = Some(object_address);
            }
        }

        result
    }
}

/// Upgrades the modules in a Move package deployed under an object.
#[derive(Parser)]
pub struct UpgradeCodeObject {
    /// The named address for compiling and using in the contract
    #[clap(long)]
    pub(crate) address_name: String,
    /// Address of the object the package was deployed to
    ///
    /// This must be an already deployed object containing the package
    /// if the package is not already created, it will fail.
    #[clap(long, value_parser = crate::common::types::load_account_arg)]
    pub(crate) object_address: AccountAddress,
    #[clap(flatten)]
    pub(crate) override_size_check_option: OverrideSizeCheckOption,
    #[clap(flatten)]