Skip to content

Commit 642ee2f

Browse files
committed
export new func with ffi
1 parent 8fcd273 commit 642ee2f

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

coordinator/internal/logic/libzkp/lib.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,10 @@ func DumpVk(forkName, filePath string) error {
140140

141141
return nil
142142
}
143+
144+
// Set dynamic feature flags that control libzkp runtime behavior
145+
func SetDynamicFeature(feats string) {
146+
cFeats := goToCString(feats)
147+
defer freeCString(cFeats)
148+
C.set_dynamic_feature(cFeats)
149+
}

coordinator/internal/logic/libzkp/libzkp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ char* gen_wrapped_proof(char* proof_json, char* metadata, char* vk, size_t vk_le
5454
// Release memory allocated for a string returned by gen_wrapped_proof
5555
void release_string(char* string_ptr);
5656

57+
void set_dynamic_feature(const char* feats);
58+
59+
5760
#endif /* LIBZKP_H */

crates/libzkp/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ use tasks::chunk_interpreter::{ChunkInterpreter, TryFromWithInterpreter};
1414
/// global features: use legacy encoding for witness
1515
pub(crate) static LEGACY_WITNESS_ENCODING: bool = false;
1616

17+
pub fn set_dynamic_feature(feats: &str){
18+
19+
}
20+
21+
1722
/// Turn the coordinator's chunk task into a json string for formal chunk proving
1823
/// task (with full witnesses)
1924
pub fn checkout_chunk_task(

crates/libzkp_c/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,10 @@ pub unsafe extern "C" fn release_string(ptr: *mut c_char) {
249249
let _ = CString::from_raw(ptr);
250250
}
251251
}
252+
253+
/// # Safety
254+
#[no_mangle]
255+
pub unsafe extern "C" fn set_dynamic_feature(feats: *const c_char) {
256+
let feats_str = c_char_to_str(feats);
257+
libzkp::set_dynamic_feature(feats_str);
258+
}

0 commit comments

Comments
 (0)