From 6aea9305280e349ba2a451c6e520b3d00e83df16 Mon Sep 17 00:00:00 2001 From: Joe C Date: Mon, 25 Mar 2024 21:51:52 -0500 Subject: [PATCH] drop `total_size` --- .../core_bpf_migration/source_upgradeable_bpf.rs | 14 -------------- .../builtins/core_bpf_migration/target_builtin.rs | 7 ------- 2 files changed, 21 deletions(-) diff --git a/runtime/src/bank/builtins/core_bpf_migration/source_upgradeable_bpf.rs b/runtime/src/bank/builtins/core_bpf_migration/source_upgradeable_bpf.rs index ffda3db96fc289..67642a69604fb6 100644 --- a/runtime/src/bank/builtins/core_bpf_migration/source_upgradeable_bpf.rs +++ b/runtime/src/bank/builtins/core_bpf_migration/source_upgradeable_bpf.rs @@ -18,7 +18,6 @@ pub(crate) struct SourceUpgradeableBpf { pub program_account: AccountSharedData, pub program_data_address: Pubkey, pub program_data_account: AccountSharedData, - pub total_data_size: usize, } impl SourceUpgradeableBpf { @@ -91,20 +90,11 @@ impl SourceUpgradeableBpf { *program_address, ))?; - // The total data size is the size of the program account's data plus - // the size of the program data account's data. - let total_data_size = program_account - .data() - .len() - .checked_add(program_data_account.data().len()) - .ok_or(CoreBpfMigrationError::ArithmeticOverflow)?; - let source_upgradeable_bpf = Self { program_address: *program_address, program_account, program_data_address, program_data_account, - total_data_size, }; source_upgradeable_bpf.check_program_account()?; @@ -235,10 +225,6 @@ mod tests { source_upgradeable_bpf.program_data_account, check_program_data_account ); - assert_eq!( - source_upgradeable_bpf.total_data_size, - check_program_account_data_len + check_program_data_account_data_len - ); } #[test] diff --git a/runtime/src/bank/builtins/core_bpf_migration/target_builtin.rs b/runtime/src/bank/builtins/core_bpf_migration/target_builtin.rs index 1b17b60bf25b55..fdd8c3279fd54f 100644 --- a/runtime/src/bank/builtins/core_bpf_migration/target_builtin.rs +++ b/runtime/src/bank/builtins/core_bpf_migration/target_builtin.rs @@ -15,7 +15,6 @@ pub(crate) struct TargetBuiltin { pub program_address: Pubkey, pub program_account: AccountSharedData, pub program_data_address: Pubkey, - pub total_data_size: usize, } impl TargetBuiltin { @@ -62,14 +61,10 @@ impl TargetBuiltin { )); } - // The total data size is the size of the program account's data. - let total_data_size = program_account.data().len(); - Ok(Self { program_address: *program_address, program_account, program_data_address, - total_data_size, }) } } @@ -150,7 +145,6 @@ mod tests { assert_eq!(target_builtin.program_address, program_address); assert_eq!(target_builtin.program_account, program_account); assert_eq!(target_builtin.program_data_address, program_data_address); - assert_eq!(target_builtin.total_data_size, program_account.data().len()); // Fail if the program account is not owned by the native loader store_account( @@ -214,7 +208,6 @@ mod tests { assert_eq!(target_builtin.program_address, program_address); assert_eq!(target_builtin.program_account, program_account); assert_eq!(target_builtin.program_data_address, program_data_address); - assert_eq!(target_builtin.total_data_size, program_account.data().len()); // Fail if the program data account exists store_account(