Module: Longfellow::C

Extended by:
FFI::Library
Defined in:
lib/longfellow/c.rb

Overview

Low-level FFI binding to the longfellow-zk C ABI declared in ‘lib/circuits/mdoc/mdoc_zk.h`. Application code should prefer the high-level helpers on Longfellow; this module mirrors the C surface one-to-one and performs no validation or memory management of its own.

Defined Under Namespace

Classes: RequestedAttribute, ZkSpecStruct

Constant Summary collapse

LIBRARY_PATH =

The shared object produced by ext/longfellow during installation lives next to this file.

File.expand_path(
  "liblongfellow_native.#{FFI::Platform::LIBSUFFIX}", __dir__
)
NUM_ZK_SPECS =

enum { kNumZkSpecs = 12 };

12
CIRCUIT_ID_SIZE =

kSHA256DigestSize

32

Class Method Summary collapse

Class Method Details

.zk_specsObject

The hardcoded ‘kZkSpecs` global. Returns the FFI structs that point into the library’s static storage (do not free or mutate them).



98
99
100
101
102
103
# File 'lib/longfellow/c.rb', line 98

def self.zk_specs
  base = ffi_libraries.first.find_variable("kZkSpecs")
  Array.new(NUM_ZK_SPECS) do |i|
    ZkSpecStruct.new(base + (i * ZkSpecStruct.size))
  end
end