Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore compat. with mainnet-beta #12166

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions programs/bpf_loader/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ macro_rules! translate {
#[macro_export]
macro_rules! translate_type_mut {
($t:ty, $vm_addr:expr, $regions:expr) => {{
if ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
if false && ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
Err(SyscallError::UnalignedPointer.into())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackcmay It seems that some of mainnet-beta's programs executes Ok on v1.2, but fails with UnalignedPointer on master.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 bank] result: 673XSffuWqYJ6TQeSYZrWXjRZmQqqGxbreUP75jo7TtJ1tk58JiHRCuNCsrEMr8vH1qB19UxQdkgzzetVSUrJRfp => Ok(())
-bank] result: 8vNyVCumvrNzdHrbRNgQkpDG1syXELCxqF9SCd5ukexhr4RgENxbZAJkbeFvWdPoEK9RzFDLJrVyf8QPN2pkroj => Ok(())
+bank] result: 8vNyVCumvrNzdHrbRNgQkpDG1syXELCxqF9SCd5ukexhr4RgENxbZAJkbeFvWdPoEK9RzFDLJrVyf8QPN2pkroj => Err(InstructionError(1, Custom(194969602)))
 bank] result: 97Teou5Ef3TZ2PiPm11ftvFqfgWpynhuMEGcCxmmHbf7wXGFbY9qdgdZUm6LpXAAL9gD8W6c1wbGXYcD6CrpBvL => Ok(())
$ printf "%016x\n" 194969602
000000000b9f0002

$ git grep -C1 b9f_0002
programs/bpf/rust/invoke/src/lib.rs-                invoke(&invoked_instruction, accounts),
programs/bpf/rust/invoke/src/lib.rs:                Err(ProgramError::Custom(0x0b9f_0002))
programs/bpf/rust/invoke/src/lib.rs-            );
--
programs/bpf/rust/invoke/src/lib.rs-                invoke(&invoked_instruction, accounts),
programs/bpf/rust/invoke/src/lib.rs:                Err(ProgramError::Custom(0x0b9f_0002))
programs/bpf/rust/invoke/src/lib.rs-            );
--
programs/bpf_loader/src/lib.rs-    #[error("virtual machine failed to run the program to completion")]
programs/bpf_loader/src/lib.rs:    VirtualMachineFailedToRunProgram = 0x0b9f_0002,
programs/bpf_loader/src/lib.rs-}
[2020-09-10T07:29:17.868465223Z INFO  solana_runtime::message_processor] BPF program 4ckmDgGdxQoPDLUkDT3vHgSAkzA3QRdNq5ywwY4sUSJn failed: Unaligned pointer

} else {
unsafe {
Expand Down Expand Up @@ -200,7 +200,7 @@ macro_rules! translate_type {
#[macro_export]
macro_rules! translate_slice_mut {
($t:ty, $vm_addr:expr, $len: expr, $regions:expr) => {{
if ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
if false && ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
Err(SyscallError::UnalignedPointer.into())
} else {
match translate_addr::<BPFError>(
Expand Down
6 changes: 6 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,12 @@ impl Bank {
&self.rent_collector,
log_collector.clone(),
);
trace!(
"bank (slot: {}) executed a transaction with result: {} => {:?}",
self.slot(),
tx.signatures[0],
process_result
);

Self::refcells_to_accounts(
accounts,
Expand Down