From 5504dcf961cd56956cd28e3f0e244565a8607d0c Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sat, 9 Jul 2022 01:23:27 +0200 Subject: [PATCH] Fix sol_get_processed_sibling_instruction on 32-bit hosts --- programs/bpf_loader/src/syscalls.rs | 9 +++++---- sdk/program/src/instruction.rs | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/programs/bpf_loader/src/syscalls.rs b/programs/bpf_loader/src/syscalls.rs index 9485904f547b96..81c22dc2fae43b 100644 --- a/programs/bpf_loader/src/syscalls.rs +++ b/programs/bpf_loader/src/syscalls.rs @@ -3223,8 +3223,9 @@ declare_syscall!( result ); - if *data_len == instruction_context.get_instruction_data().len() - && *accounts_len == instruction_context.get_number_of_instruction_accounts() + if *data_len == (instruction_context.get_instruction_data().len() as u64) + && *accounts_len + == (instruction_context.get_number_of_instruction_accounts() as u64) { let program_id = question_mark!( translate_type_mut::( @@ -3282,8 +3283,8 @@ declare_syscall!( ); accounts.clone_from_slice(account_metas.as_slice()); } - *data_len = instruction_context.get_instruction_data().len(); - *accounts_len = instruction_context.get_number_of_instruction_accounts(); + *data_len = instruction_context.get_instruction_data().len() as u64; + *accounts_len = instruction_context.get_number_of_instruction_accounts() as u64; *result = Ok(true as u64); return; } diff --git a/sdk/program/src/instruction.rs b/sdk/program/src/instruction.rs index 49de9dcc86d1fd..c971db78dd27ec 100644 --- a/sdk/program/src/instruction.rs +++ b/sdk/program/src/instruction.rs @@ -664,9 +664,9 @@ impl CompiledInstruction { #[derive(Default, Debug, Clone, Copy)] pub struct ProcessedSiblingInstruction { /// Length of the instruction data - pub data_len: usize, + pub data_len: u64, /// Number of AccountMeta structures - pub accounts_len: usize, + pub accounts_len: u64, } /// Returns a sibling instruction from the processed sibling instruction list.