@corpus-core/colibri-stateless 2.0.6 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/wasm_cjs.js CHANGED
@@ -56,6 +56,7 @@ export const loadC4WModule = api.loadC4WModule;
56
56
  export const getC4w = api.getC4w;
57
57
  export const get_prover_config_hex = api.get_prover_config_hex;
58
58
  export const set_trusted_checkpoint = api.set_trusted_checkpoint;
59
+ export const reset_caches = api.reset_caches;
59
60
  export const decode_proof = api.decode_proof;
60
61
  /**
61
62
  * Returns the directory of the compiled module. Used in Node to locate
package/wasm_shared.d.ts CHANGED
@@ -37,6 +37,7 @@ export interface C4W {
37
37
  _c4w_execute_rpc_ctx: (ctx: number) => number;
38
38
  _c4w_free_rpc_ctx: (ctx: number) => void;
39
39
  _c4w_set_checkpoint: (chainId: bigint, checkpoint: number) => void;
40
+ _c4w_reset_caches: () => void;
40
41
  _c4w_rpc_ctx_set_witness_keys: (ctx: number, keys: number) => void;
41
42
  _c4w_rpc_ctx_set_proxy_urls: (ctx: number, rpc_urls: number, beacon_urls: number) => void;
42
43
  _c4w_rpc_ctx_set_min_latest_block_ts: (ctx: number, ts: bigint) => void;
@@ -74,5 +75,6 @@ export declare function createC4wApi(options: {
74
75
  getC4w: () => Promise<C4W>;
75
76
  get_prover_config_hex: (chainId: number) => Promise<string>;
76
77
  set_trusted_checkpoint: (chainId: number, checkpoint: string) => Promise<void>;
78
+ reset_caches: () => Promise<void>;
77
79
  decode_proof: (proof: Uint8Array) => Promise<any>;
78
80
  };
package/wasm_shared.js CHANGED
@@ -246,6 +246,14 @@ export function createC4wApi(options) {
246
246
  c4w._c4w_set_checkpoint(BigInt(chainId), as_char_ptr(checkpoint, c4w, free_buffers));
247
247
  free_buffers.forEach(ptr => c4w._free(ptr));
248
248
  }
249
+ /**
250
+ * Clears in-process prover/verifier caches (header tags, EL headers, PAP
251
+ * tx cache, prover cache). Persistent storage is left to the host.
252
+ */
253
+ async function reset_caches() {
254
+ const c4w = await getC4w();
255
+ c4w._c4w_reset_caches();
256
+ }
249
257
  async function decode_proof(proof) {
250
258
  const c4w = await getC4w();
251
259
  const ptr = copy_to_c(proof, c4w);
@@ -261,6 +269,7 @@ export function createC4wApi(options) {
261
269
  getC4w,
262
270
  get_prover_config_hex,
263
271
  set_trusted_checkpoint,
272
+ reset_caches,
264
273
  decode_proof,
265
274
  };
266
275
  }