Skip to main content
FHE programs require a custom allocator for large ciphertexts.

setup_fhe_allocator!

privora_sdk_program::setup_fhe_allocator!();
Set up the FHE allocator with default ~1MB heap.

With Custom Size

privora_sdk_program::setup_fhe_allocator!(2 * 1024 * 1024);

FheBumpAllocator

use privora_sdk_program::memory::allocator::FheBumpAllocator;

new

pub const fn new() -> Self
Create with default heap size (~1MB).

with_heap_size

pub const fn with_heap_size(heap_size: usize) -> Self
Create with custom heap size.

Constants

/// Default heap size (~1MB)
pub const FHE_HEAP_SIZE: usize = 1024 * 1024 - 16;

Usage

use privora_sdk_program::prelude::*;

// Must be at crate root!
privora_sdk_program::setup_fhe_allocator!();

solana_program::entrypoint!(process_instruction);

pub fn process_instruction(...) -> ProgramResult {
    // FHE operations now have ~1MB heap
    Ok(())
}

Important Notes

  • Must be called at crate root
  • Must be before any other code
  • Only active on target_os = "solana"