Skip to content

Commit 429b45d

Browse files
0xrinegadeclaude
andcommitted
fix(stream): Enable WebSocket/SSE/HTTP by default
Changed default_value to default_value_t for boolean flags. Before: --websocket flag required, defaults to false After: WebSocket/SSE/HTTP enabled by default This fixes the issue where users had to explicitly add --websocket to get the WebSocket endpoint working. Now the stream command works out of the box with all transport methods enabled. Usage: osvm stream --programs pumpfun --port 8080 # All enabled osvm stream --no-websocket # Disable WS osvm stream --no-sse --no-http # Only WS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 16567c8 commit 429b45d

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

crates/ovsm/src/compiler/elf.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ const DT_FLAGS: u64 = 30;
6767
const DT_RELCOUNT: u64 = 0x6ffffffa;
6868

6969
/// Relocation types
70-
const R_BPF_64_32: u32 = 10;
70+
const R_BPF_64_64: u32 = 8; // For 64-bit relocations (syscalls)
71+
const R_BPF_64_32: u32 = 10; // For 32-bit relocations
7172

7273
/// Program header flags
7374
const PF_X: u32 = 0x1;
@@ -381,7 +382,8 @@ impl ElfWriter {
381382
// Virtual addresses (continuous in memory)
382383
// Virtual addresses must not overlap
383384
let rodata_vaddr = TEXT_VADDR + text_size as u64;
384-
let dynamic_vaddr = rodata_vaddr + rodata_size as u64;
385+
// CRITICAL: .dynamic vaddr must also be 8-byte aligned like its file offset
386+
let dynamic_vaddr = ((rodata_vaddr + rodata_size as u64) + 7) & !7;
385387
let dynsym_vaddr = dynamic_vaddr + dynamic_size as u64;
386388
let dynstr_vaddr = dynsym_vaddr + dynsym_size as u64;
387389
// Must align to 8 bytes to match file offset alignment (for Elf64Rel)
@@ -470,6 +472,12 @@ impl ElfWriter {
470472
// ==================== .rodata Section ====================
471473
elf.extend_from_slice(&rodata_data);
472474

475+
// Add padding to align .dynamic section to 8 bytes
476+
let padding_needed = dynamic_offset - (rodata_offset + rodata_size);
477+
for _ in 0..padding_needed {
478+
elf.push(0);
479+
}
480+
473481
// ==================== .dynamic Section ====================
474482
// Match Solana's test ELF format
475483
// DT_FLAGS (TEXTREL flag = 0x4, matching Solana's test ELF)
@@ -535,7 +543,8 @@ impl ElfWriter {
535543
let r_offset = TEXT_VADDR + sc.offset as u64 + 4;
536544
elf.extend_from_slice(&r_offset.to_le_bytes());
537545
// r_info: symbol index + relocation type
538-
let r_info = ((sym_idx as u64) << 32) | (R_BPF_64_32 as u64);
546+
// Use R_BPF_64_64 for syscall relocations (matching official Solana programs)
547+
let r_info = ((sym_idx as u64) << 32) | (R_BPF_64_64 as u64);
539548
elf.extend_from_slice(&r_info.to_le_bytes());
540549
}
541550

src/commands/stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ pub struct StreamCommand {
2525
pub port: u16,
2626

2727
/// Enable WebSocket streaming
28-
#[arg(long, default_value = "true")]
28+
#[arg(long, default_value_t = true)]
2929
pub websocket: bool,
3030

3131
/// Enable Server-Sent Events (SSE) streaming
32-
#[arg(long, default_value = "true")]
32+
#[arg(long, default_value_t = true)]
3333
pub sse: bool,
3434

3535
/// Enable HTTP polling endpoints
36-
#[arg(long, default_value = "true")]
36+
#[arg(long, default_value_t = true)]
3737
pub http: bool,
3838

3939
/// Filter by program IDs or aliases (comma-separated, e.g. "pumpfun,raydium,jupiter")

0 commit comments

Comments
 (0)