Skip to content

Commit b070599

Browse files
committed
chore: fmt
1 parent 70007ea commit b070599

File tree

2 files changed

+25
-50
lines changed

2 files changed

+25
-50
lines changed

crates/core/src/rpc/surfnet_cheatcodes.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,8 +1860,7 @@ mod tests {
18601860
use solana_pubkey::Pubkey;
18611861
use solana_signer::Signer;
18621862
use solana_system_interface::instruction::create_account;
1863-
use solana_transaction::Transaction;
1864-
use solana_transaction::versioned::VersionedTransaction;
1863+
use solana_transaction::{Transaction, versioned::VersionedTransaction};
18651864
use spl_associated_token_account_interface::{
18661865
address::get_associated_token_address_with_program_id,
18671866
instruction::create_associated_token_account,
@@ -4037,7 +4036,10 @@ mod tests {
40374036

40384037
// Verify written content matches exactly
40394038
let written_data = &account.data[metadata_size..];
4040-
assert_eq!(written_data, &program_data, "Written data should match exactly");
4039+
assert_eq!(
4040+
written_data, &program_data,
4041+
"Written data should match exactly"
4042+
);
40414043

40424044
// Verify no trailing non-zero bytes beyond written data
40434045
assert!(

crates/core/src/surfnet/noop_program.rs

Lines changed: 20 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,41 @@ pub const NOOP_PROGRAM_ELF: &[u8] = &[
1818
// ===== ELF64 Header (64 bytes) =====
1919
// e_ident: EI_MAG0..3, EI_CLASS=2(64-bit), EI_DATA=1(LE), EI_VERSION=1,
2020
// EI_OSABI=0, padding
21-
0x7F, b'E', b'L', b'F', 0x02, 0x01, 0x01, 0x00,
22-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21+
0x7F, b'E', b'L', b'F', 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2322
// e_type=ET_DYN(3), e_machine=EM_SBPF(0x107)
24-
0x03, 0x00, 0x07, 0x01,
25-
// e_version=1
26-
0x01, 0x00, 0x00, 0x00,
27-
// e_entry=0x78 (start of .text)
23+
0x03, 0x00, 0x07, 0x01, // e_version=1
24+
0x01, 0x00, 0x00, 0x00, // e_entry=0x78 (start of .text)
2825
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2926
// e_phoff=0x40 (program headers right after ELF header)
3027
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3128
// e_shoff=0xA0 (section headers at offset 160)
32-
0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33-
// e_flags=0 (SBPFv0)
34-
0x00, 0x00, 0x00, 0x00,
35-
// e_ehsize=64
36-
0x40, 0x00,
37-
// e_phentsize=56
38-
0x38, 0x00,
39-
// e_phnum=1
40-
0x01, 0x00,
41-
// e_shentsize=64
42-
0x40, 0x00,
43-
// e_shnum=3
44-
0x03, 0x00,
45-
// e_shstrndx=2
46-
0x02, 0x00,
47-
48-
// ===== Program Header (56 bytes) =====
29+
0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // e_flags=0 (SBPFv0)
30+
0x00, 0x00, 0x00, 0x00, // e_ehsize=64
31+
0x40, 0x00, // e_phentsize=56
32+
0x38, 0x00, // e_phnum=1
33+
0x01, 0x00, // e_shentsize=64
34+
0x40, 0x00, // e_shnum=3
35+
0x03, 0x00, // e_shstrndx=2
36+
0x02, 0x00, // ===== Program Header (56 bytes) =====
4937
// p_type=PT_LOAD(1)
50-
0x01, 0x00, 0x00, 0x00,
51-
// p_flags=PF_R|PF_X(5)
52-
0x05, 0x00, 0x00, 0x00,
53-
// p_offset=0x78
54-
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55-
// p_vaddr=0x78
56-
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57-
// p_paddr=0x78
58-
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59-
// p_filesz=16
60-
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61-
// p_memsz=16
62-
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63-
// p_align=8
38+
0x01, 0x00, 0x00, 0x00, // p_flags=PF_R|PF_X(5)
39+
0x05, 0x00, 0x00, 0x00, // p_offset=0x78
40+
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // p_vaddr=0x78
41+
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // p_paddr=0x78
42+
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // p_filesz=16
43+
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // p_memsz=16
44+
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // p_align=8
6445
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65-
6646
// ===== .text section (16 bytes at 0x78) =====
6747
// mov64 r0, 0 (opcode=0xb7, dst=r0, src=0, off=0, imm=0)
6848
0xB7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6949
// exit (opcode=0x95, dst=0, src=0, off=0, imm=0)
7050
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71-
7251
// ===== .shstrtab contents (17 bytes at 0x88) =====
7352
// "\0.text\0.shstrtab\0"
74-
0x00,
75-
b'.', b't', b'e', b'x', b't', 0x00,
76-
b'.', b's', b'h', b's', b't', b'r', b't', b'a', b'b', 0x00,
77-
78-
// ===== Padding to align section headers to 8 bytes (7 bytes) =====
53+
0x00, b'.', b't', b'e', b'x', b't', 0x00, b'.', b's', b'h', b's', b't', b'r', b't', b'a', b'b',
54+
0x00, // ===== Padding to align section headers to 8 bytes (7 bytes) =====
7955
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80-
8156
// ===== Section Header [0]: SHT_NULL (64 bytes at 0xA0) =====
8257
0x00, 0x00, 0x00, 0x00, // sh_name=0
8358
0x00, 0x00, 0x00, 0x00, // sh_type=SHT_NULL(0)
@@ -89,7 +64,6 @@ pub const NOOP_PROGRAM_ELF: &[u8] = &[
8964
0x00, 0x00, 0x00, 0x00, // sh_info=0
9065
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sh_addralign=0
9166
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sh_entsize=0
92-
9367
// ===== Section Header [1]: .text (64 bytes at 0xE0) =====
9468
0x01, 0x00, 0x00, 0x00, // sh_name=1 (index into .shstrtab: ".text")
9569
0x01, 0x00, 0x00, 0x00, // sh_type=SHT_PROGBITS(1)
@@ -101,7 +75,6 @@ pub const NOOP_PROGRAM_ELF: &[u8] = &[
10175
0x00, 0x00, 0x00, 0x00, // sh_info=0
10276
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sh_addralign=8
10377
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sh_entsize=0
104-
10578
// ===== Section Header [2]: .shstrtab (64 bytes at 0x120) =====
10679
0x07, 0x00, 0x00, 0x00, // sh_name=7 (index into .shstrtab: ".shstrtab")
10780
0x03, 0x00, 0x00, 0x00, // sh_type=SHT_STRTAB(3)

0 commit comments

Comments
 (0)