Skip to content

Commit

Permalink
Bumps solana_rbpf to v0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Dec 9, 2024
1 parent c45a1eb commit 8bed666
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 197 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ solana-zk-keygen = { path = "zk-keygen", version = "=2.2.0" }
solana-zk-sdk = { path = "zk-sdk", version = "=2.2.0" }
solana-zk-token-proof-program = { path = "programs/zk-token-proof", version = "=2.2.0" }
solana-zk-token-sdk = { path = "zk-token-sdk", version = "=2.2.0" }
solana_rbpf = "=0.8.5"
solana_rbpf = { git = "https://github.com/solana-labs/rbpf.git" }
spl-associated-token-account = "=6.0.0"
spl-instruction-padding = "0.3"
spl-memo = "=6.0.0"
Expand Down
6 changes: 3 additions & 3 deletions program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ impl<'a> InvokeContext<'a> {
.ok_or(InstructionError::UnsupportedProgramId)?;
let function = match &entry.program {
ProgramCacheEntryType::Builtin(program) => program
.get_function_registry()
.get_function_registry(SBPFVersion::V0)
.lookup_by_key(ENTRYPOINT_KEY)
.map(|(_name, function)| function),
_ => None,
Expand All @@ -555,13 +555,13 @@ impl<'a> InvokeContext<'a> {
// For now, only built-ins are invoked from here, so the VM and its Config are irrelevant.
let mock_config = Config::default();
let empty_memory_mapping =
MemoryMapping::new(Vec::new(), &mock_config, &SBPFVersion::V1).unwrap();
MemoryMapping::new(Vec::new(), &mock_config, SBPFVersion::V1).unwrap();
let mut vm = EbpfVm::new(
self.program_cache_for_tx_batch
.environments
.program_runtime_v2
.clone(),
&SBPFVersion::V1,
SBPFVersion::V0,
// Removes lifetime tracking
unsafe { std::mem::transmute::<&mut InvokeContext, &mut InvokeContext>(self) },
empty_memory_mapping,
Expand Down
14 changes: 7 additions & 7 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ macro_rules! mock_create_vm {
let loader = solana_type_overrides::sync::Arc::new(BuiltinProgram::new_mock());
let function_registry = solana_rbpf::program::FunctionRegistry::default();
let executable = solana_rbpf::elf::Executable::<InvokeContext>::from_text_bytes(
&[0x95, 0, 0, 0, 0, 0, 0, 0],
&[0x9D, 0, 0, 0, 0, 0, 0, 0],
loader,
SBPFVersion::V2,
SBPFVersion::V3,
function_registry,
)
.unwrap();
Expand Down Expand Up @@ -1696,7 +1696,7 @@ mod tests {
let loader_id = bpf_loader::id();
let program_id = Pubkey::new_unique();
let program_account =
load_program_account_from_elf(&loader_id, "test_elfs/out/noop_aligned.so");
load_program_account_from_elf(&loader_id, "test_elfs/out/sbpfv3_return_ok.so");
let parameter_id = Pubkey::new_unique();
let parameter_account = AccountSharedData::new(1, 0, &loader_id);
let parameter_meta = AccountMeta {
Expand Down Expand Up @@ -2184,10 +2184,10 @@ mod tests {

#[test]
fn test_bpf_loader_upgradeable_upgrade() {
let mut file = File::open("test_elfs/out/noop_aligned.so").expect("file open failed");
let mut file = File::open("test_elfs/out/sbpfv3_return_ok.so").expect("file open failed");
let mut elf_orig = Vec::new();
file.read_to_end(&mut elf_orig).unwrap();
let mut file = File::open("test_elfs/out/noop_unaligned.so").expect("file open failed");
let mut file = File::open("test_elfs/out/sbpfv3_return_err.so").expect("file open failed");
let mut elf_new = Vec::new();
file.read_to_end(&mut elf_new).unwrap();
assert_ne!(elf_orig.len(), elf_new.len());
Expand Down Expand Up @@ -3783,7 +3783,7 @@ mod tests {
let program_id = Pubkey::new_unique();

// Create program account
let mut file = File::open("test_elfs/out/noop_aligned.so").expect("file open failed");
let mut file = File::open("test_elfs/out/sbpfv3_return_ok.so").expect("file open failed");
let mut elf = Vec::new();
file.read_to_end(&mut elf).unwrap();

Expand Down Expand Up @@ -3833,7 +3833,7 @@ mod tests {
invoke_context: &mut InvokeContext,
program_id: Pubkey,
) -> Result<(), InstructionError> {
let mut file = File::open("test_elfs/out/noop_unaligned.so").expect("file open failed");
let mut file = File::open("test_elfs/out/sbpfv3_return_ok.so").expect("file open failed");
let mut elf = Vec::new();
file.read_to_end(&mut elf).unwrap();
deploy_program!(
Expand Down
24 changes: 12 additions & 12 deletions programs/bpf_loader/src/syscalls/cpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ mod tests {
aligned_memory_mapping: false,
..Config::default()
};
let memory_mapping = MemoryMapping::new(vec![region], &config, &SBPFVersion::V2).unwrap();
let memory_mapping = MemoryMapping::new(vec![region], &config, SBPFVersion::V3).unwrap();

let ins = SyscallInvokeSignedRust::translate_instruction(
vm_addr,
Expand Down Expand Up @@ -1746,7 +1746,7 @@ mod tests {
aligned_memory_mapping: false,
..Config::default()
};
let memory_mapping = MemoryMapping::new(vec![region], &config, &SBPFVersion::V2).unwrap();
let memory_mapping = MemoryMapping::new(vec![region], &config, SBPFVersion::V3).unwrap();

let signers = SyscallInvokeSignedRust::translate_signers(
&program_id,
Expand Down Expand Up @@ -1782,7 +1782,7 @@ mod tests {
aligned_memory_mapping: false,
..Config::default()
};
let memory_mapping = MemoryMapping::new(vec![region], &config, &SBPFVersion::V2).unwrap();
let memory_mapping = MemoryMapping::new(vec![region], &config, SBPFVersion::V3).unwrap();

let account_info = translate_type::<AccountInfo>(&memory_mapping, vm_addr, false).unwrap();

Expand Down Expand Up @@ -1832,7 +1832,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -1890,7 +1890,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2018,7 +2018,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2193,7 +2193,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2263,7 +2263,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2319,7 +2319,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2392,7 +2392,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2480,7 +2480,7 @@ mod tests {
let memory_mapping = MemoryMapping::new(
mock_caller_account.regions.split_off(0),
&config,
&SBPFVersion::V2,
SBPFVersion::V3,
)
.unwrap();

Expand Down Expand Up @@ -2558,7 +2558,7 @@ mod tests {
aligned_memory_mapping: false,
..Config::default()
};
let memory_mapping = MemoryMapping::new(vec![region], &config, &SBPFVersion::V2).unwrap();
let memory_mapping = MemoryMapping::new(vec![region], &config, SBPFVersion::V3).unwrap();

mock_invoke_context!(
invoke_context,
Expand Down
Loading

0 comments on commit 8bed666

Please sign in to comment.