@corpus-core/colibri-stateless 1.1.25 → 1.1.27

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/README.md CHANGED
@@ -311,6 +311,19 @@ The constructor of the colibri client accepts a configuration-object, which may
311
311
  new Colibri({ privacy_mode: "basic" })
312
312
  ```
313
313
 
314
+ - `oblivious_nodes` - TEE RPC endpoints for private `eth_getProof` (default: empty). Sets `VERIFY_FLAG_OBLIVIOUS` and **PAP** automatically. For a privacy-preserving `eth_call`, also use `privacy_mode: "basic"` (or rely on auto-PAP when oblivious is set), `prover_mode: "hybrid"`, and oblivious nodes — see below.
315
+ ```js
316
+ // Privacy-preserving eth_call (https://rpc.safe-node.com/ needs an API key for testing)
317
+ new Colibri({
318
+ privacy_mode: "basic",
319
+ prover_mode: "hybrid",
320
+ oblivious_nodes: ["https://rpc.safe-node.com/"],
321
+ })
322
+ ```
323
+ **Why:** `hybrid` fetches only the block proof from the prover; storage values come from RPC/oblivious node and are verified locally. `basic` (PAP) avoids `eth_createAccessList` on the prover (which would leak intent); the EVM discovers storage optimistically so only `eth_getProof` requests leave the client.
324
+
325
+ TEE/ORAM details: [Oblivious Labs](https://www.obliviouslabs.com/).
326
+
314
327
  - `verify`- a function to decide which request should be verified and which should be fetched from the default RPC-Provider. It allows you to speed up performance for requests which are not critical.
315
328
  ```js
316
329
  new Colibri({ verify: (method, args) => method != 'eth_blockNumber' })
package/c4w.js CHANGED
@@ -5,7 +5,7 @@ var c4w = (() => {
5
5
  async function(moduleArg = {}) {
6
6
  var moduleRtn;
7
7
 
8
- var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.slice(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["s"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("c4w.wasm")}return new URL("c4w.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{a:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["r"];updateMemoryViews();removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(mod,inst)=>{receiveInstance(mod,inst);resolve(mod.exports)})})}wasmBinaryFile??=findWasmBinary();try{var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}catch(e){readyPromiseReject(e);return Promise.reject(e)}}var ASM_CONSTS={199564:($0,$1)=>{var keyStr=UTF8ToString($0);var data=Module.storage.get(keyStr);if(data){var bufferPtr=_c4w_buffer_alloc($1,data.length);HEAPU8.set(data,bufferPtr);return 1}return 0},199752:($0,$1,$2)=>{var keyStr=UTF8ToString($0);var array=new Uint8Array($2);array.set(HEAPU8.subarray($1,$1+$2));Module.storage.set(keyStr,array)},199895:$0=>{var keyStr=UTF8ToString($0);Module.storage.del(keyStr)}};class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.unshift(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.unshift(cb);var noExitRuntime=Module["noExitRuntime"]||true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var SYSCALLS={varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;return 0}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;return 0}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs}var __abort_js=()=>abort("");var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var _emscripten_date_now=()=>Date.now();var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){HEAP8[buffer++]=str.charCodeAt(i)}HEAP8[buffer]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var _fd_close=fd=>52;var _fd_read=(fd,iov,iovcnt,pnum)=>52;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};var wasmImports={a:___assert_fail,b:___cxa_throw,f:___syscall_fcntl64,j:___syscall_ioctl,k:___syscall_openat,m:__abort_js,l:__tzset_js,d:_emscripten_asm_const_int,g:_emscripten_date_now,n:_emscripten_resize_heap,p:_environ_get,q:_environ_sizes_get,c:_exit,h:_fd_close,i:_fd_read,o:_fd_seek,e:_fd_write};var wasmExports=await createWasm();var ___wasm_call_ctors=wasmExports["s"];var _c4w_create_proof_ctx=Module["_c4w_create_proof_ctx"]=wasmExports["t"];var _c4w_free_proof_ctx=Module["_c4w_free_proof_ctx"]=wasmExports["u"];var _c4w_execute_proof_ctx=Module["_c4w_execute_proof_ctx"]=wasmExports["v"];var _c4w_req_set_response=Module["_c4w_req_set_response"]=wasmExports["w"];var _c4w_req_set_error=Module["_c4w_req_set_error"]=wasmExports["x"];var _c4w_create_verify_ctx=Module["_c4w_create_verify_ctx"]=wasmExports["y"];var _c4w_free_verify_ctx=Module["_c4w_free_verify_ctx"]=wasmExports["z"];var _free=Module["_free"]=wasmExports["A"];var _c4w_verify_proof=Module["_c4w_verify_proof"]=wasmExports["B"];var _c4w_get_method_type=Module["_c4w_get_method_type"]=wasmExports["C"];var _c4w_create_rpc_ctx=Module["_c4w_create_rpc_ctx"]=wasmExports["D"];var _c4w_execute_rpc_ctx=Module["_c4w_execute_rpc_ctx"]=wasmExports["E"];var _c4w_free_rpc_ctx=Module["_c4w_free_rpc_ctx"]=wasmExports["F"];var _c4w_set_checkpoint=Module["_c4w_set_checkpoint"]=wasmExports["G"];var _c4w_rpc_ctx_set_witness_keys=Module["_c4w_rpc_ctx_set_witness_keys"]=wasmExports["H"];var _c4w_rpc_ctx_set_proxy_urls=Module["_c4w_rpc_ctx_set_proxy_urls"]=wasmExports["I"];var _c4w_decode_proof=Module["_c4w_decode_proof"]=wasmExports["J"];var _c4w_req_free=Module["_c4w_req_free"]=wasmExports["K"];var _c4w_buffer_alloc=Module["_c4w_buffer_alloc"]=wasmExports["L"];var _init_storage=Module["_init_storage"]=wasmExports["M"];var _c4w_get_current_version_number=Module["_c4w_get_current_version_number"]=wasmExports["N"];var _malloc=Module["_malloc"]=wasmExports["P"];var __emscripten_stack_restore=wasmExports["Q"];var __emscripten_stack_alloc=wasmExports["R"];var _emscripten_stack_get_current=wasmExports["S"];Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();moduleRtn=readyPromise;
8
+ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.slice(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["s"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("c4w.wasm")}return new URL("c4w.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{a:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["r"];updateMemoryViews();removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(mod,inst)=>{receiveInstance(mod,inst);resolve(mod.exports)})})}wasmBinaryFile??=findWasmBinary();try{var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}catch(e){readyPromiseReject(e);return Promise.reject(e)}}var ASM_CONSTS={200892:($0,$1)=>{var keyStr=UTF8ToString($0);var data=Module.storage.get(keyStr);if(data){var bufferPtr=_c4w_buffer_alloc($1,data.length);HEAPU8.set(data,bufferPtr);return 1}return 0},201080:($0,$1,$2)=>{var keyStr=UTF8ToString($0);var array=new Uint8Array($2);array.set(HEAPU8.subarray($1,$1+$2));Module.storage.set(keyStr,array)},201223:$0=>{var keyStr=UTF8ToString($0);Module.storage.del(keyStr)}};class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.unshift(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.unshift(cb);var noExitRuntime=Module["noExitRuntime"]||true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var SYSCALLS={varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;return 0}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;return 0}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs}var __abort_js=()=>abort("");var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var _emscripten_date_now=()=>Date.now();var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){HEAP8[buffer++]=str.charCodeAt(i)}HEAP8[buffer]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var _fd_close=fd=>52;var _fd_read=(fd,iov,iovcnt,pnum)=>52;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};var wasmImports={a:___assert_fail,b:___cxa_throw,f:___syscall_fcntl64,j:___syscall_ioctl,k:___syscall_openat,m:__abort_js,l:__tzset_js,d:_emscripten_asm_const_int,g:_emscripten_date_now,n:_emscripten_resize_heap,p:_environ_get,q:_environ_sizes_get,c:_exit,h:_fd_close,i:_fd_read,o:_fd_seek,e:_fd_write};var wasmExports=await createWasm();var ___wasm_call_ctors=wasmExports["s"];var _c4w_create_proof_ctx=Module["_c4w_create_proof_ctx"]=wasmExports["t"];var _c4w_free_proof_ctx=Module["_c4w_free_proof_ctx"]=wasmExports["u"];var _c4w_execute_proof_ctx=Module["_c4w_execute_proof_ctx"]=wasmExports["v"];var _c4w_req_set_response=Module["_c4w_req_set_response"]=wasmExports["w"];var _c4w_req_set_error=Module["_c4w_req_set_error"]=wasmExports["x"];var _c4w_create_verify_ctx=Module["_c4w_create_verify_ctx"]=wasmExports["y"];var _c4w_free_verify_ctx=Module["_c4w_free_verify_ctx"]=wasmExports["z"];var _free=Module["_free"]=wasmExports["A"];var _c4w_verify_proof=Module["_c4w_verify_proof"]=wasmExports["B"];var _c4w_get_method_type=Module["_c4w_get_method_type"]=wasmExports["C"];var _c4w_create_rpc_ctx=Module["_c4w_create_rpc_ctx"]=wasmExports["D"];var _c4w_execute_rpc_ctx=Module["_c4w_execute_rpc_ctx"]=wasmExports["E"];var _c4w_free_rpc_ctx=Module["_c4w_free_rpc_ctx"]=wasmExports["F"];var _c4w_set_checkpoint=Module["_c4w_set_checkpoint"]=wasmExports["G"];var _c4w_rpc_ctx_set_witness_keys=Module["_c4w_rpc_ctx_set_witness_keys"]=wasmExports["H"];var _c4w_rpc_ctx_set_proxy_urls=Module["_c4w_rpc_ctx_set_proxy_urls"]=wasmExports["I"];var _c4w_rpc_ctx_set_min_latest_block_ts=Module["_c4w_rpc_ctx_set_min_latest_block_ts"]=wasmExports["J"];var _c4w_decode_proof=Module["_c4w_decode_proof"]=wasmExports["K"];var _c4w_req_free=Module["_c4w_req_free"]=wasmExports["L"];var _c4w_buffer_alloc=Module["_c4w_buffer_alloc"]=wasmExports["M"];var _init_storage=Module["_init_storage"]=wasmExports["N"];var _c4w_get_current_version_number=Module["_c4w_get_current_version_number"]=wasmExports["O"];var _malloc=Module["_malloc"]=wasmExports["Q"];var __emscripten_stack_restore=wasmExports["R"];var __emscripten_stack_alloc=wasmExports["S"];var _emscripten_stack_get_current=wasmExports["T"];Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();moduleRtn=readyPromise;
9
9
 
10
10
 
11
11
  return moduleRtn;
package/c4w.wasm CHANGED
Binary file
package/chains.js CHANGED
@@ -26,7 +26,12 @@ export const default_config = {
26
26
  rpcs: ["https://mainnet1.colibri-proof.tech/execution"],
27
27
  beacon_apis: ["https://mainnet1.colibri-proof.tech/consensus/"],
28
28
  prover: ["https://mainnet1.colibri-proof.tech"],
29
- checkpointz: [], //"https://sync-mainnet.beaconcha.in", "https://beaconstate.info", "https://sync.invis.tools", "https://beaconstate.ethstaker.cc"],
29
+ checkpointz: [
30
+ "https://sync-mainnet.beaconcha.in",
31
+ "https://beaconstate.info",
32
+ "https://sync.invis.tools",
33
+ "https://beaconstate.ethstaker.cc",
34
+ ],
30
35
  pollingInterval: 12000,
31
36
  },
32
37
  '11155111': {
@@ -34,7 +39,10 @@ export const default_config = {
34
39
  beacon_apis: ["https://ethereum-sepolia-beacon-api.publicnode.com"],
35
40
  rpcs: ["https://ethereum-sepolia-rpc.publicnode.com"],
36
41
  prover: ["https://sepolia.colibri-proof.tech"],
37
- checkpointz: [], // No public checkpointz for Sepolia yet
42
+ checkpointz: [
43
+ "https://sepolia.beaconstate.info",
44
+ "https://checkpoint-sync.sepolia.ethpandaops.io",
45
+ ],
38
46
  pollingInterval: 12000,
39
47
  },
40
48
  '100': {
@@ -42,7 +50,7 @@ export const default_config = {
42
50
  beacon_apis: ["https://gnosis.colibri-proof.tech"],
43
51
  rpcs: ["https://rpc.ankr.com/gnosis"],
44
52
  prover: ["https://gnosis.colibri-proof.tech"],
45
- checkpointz: [], // TODO: Add Gnosis checkpointz servers
53
+ checkpointz: ["https://checkpoint.gnosischain.com"],
46
54
  pollingInterval: 5000,
47
55
  },
48
56
  '10200': {
@@ -50,7 +58,10 @@ export const default_config = {
50
58
  beacon_apis: ["https://chiado.colibri-proof.tech/consensus/"],
51
59
  rpcs: ["https://gnosis-chiado-rpc.publicnode.com"],
52
60
  prover: ["https://chiado.colibri-proof.tech"],
53
- checkpointz: ["https://chiado.colibri-proof.tech/consensus/"], // No public checkpointz for Chiado yet
61
+ checkpointz: [
62
+ "https://checkpoint.chiadochain.net",
63
+ "https://chiado.colibri-proof.tech/consensus/",
64
+ ],
54
65
  pollingInterval: 5000,
55
66
  },
56
67
  };
package/cjs/chains.js CHANGED
@@ -31,7 +31,12 @@ exports.default_config = {
31
31
  rpcs: ["https://mainnet1.colibri-proof.tech/execution"],
32
32
  beacon_apis: ["https://mainnet1.colibri-proof.tech/consensus/"],
33
33
  prover: ["https://mainnet1.colibri-proof.tech"],
34
- checkpointz: [], //"https://sync-mainnet.beaconcha.in", "https://beaconstate.info", "https://sync.invis.tools", "https://beaconstate.ethstaker.cc"],
34
+ checkpointz: [
35
+ "https://sync-mainnet.beaconcha.in",
36
+ "https://beaconstate.info",
37
+ "https://sync.invis.tools",
38
+ "https://beaconstate.ethstaker.cc",
39
+ ],
35
40
  pollingInterval: 12000,
36
41
  },
37
42
  '11155111': {
@@ -39,7 +44,10 @@ exports.default_config = {
39
44
  beacon_apis: ["https://ethereum-sepolia-beacon-api.publicnode.com"],
40
45
  rpcs: ["https://ethereum-sepolia-rpc.publicnode.com"],
41
46
  prover: ["https://sepolia.colibri-proof.tech"],
42
- checkpointz: [], // No public checkpointz for Sepolia yet
47
+ checkpointz: [
48
+ "https://sepolia.beaconstate.info",
49
+ "https://checkpoint-sync.sepolia.ethpandaops.io",
50
+ ],
43
51
  pollingInterval: 12000,
44
52
  },
45
53
  '100': {
@@ -47,7 +55,7 @@ exports.default_config = {
47
55
  beacon_apis: ["https://gnosis.colibri-proof.tech"],
48
56
  rpcs: ["https://rpc.ankr.com/gnosis"],
49
57
  prover: ["https://gnosis.colibri-proof.tech"],
50
- checkpointz: [], // TODO: Add Gnosis checkpointz servers
58
+ checkpointz: ["https://checkpoint.gnosischain.com"],
51
59
  pollingInterval: 5000,
52
60
  },
53
61
  '10200': {
@@ -55,7 +63,10 @@ exports.default_config = {
55
63
  beacon_apis: ["https://chiado.colibri-proof.tech/consensus/"],
56
64
  rpcs: ["https://gnosis-chiado-rpc.publicnode.com"],
57
65
  prover: ["https://chiado.colibri-proof.tech"],
58
- checkpointz: ["https://chiado.colibri-proof.tech/consensus/"], // No public checkpointz for Chiado yet
66
+ checkpointz: [
67
+ "https://checkpoint.chiadochain.net",
68
+ "https://chiado.colibri-proof.tech/consensus/",
69
+ ],
59
70
  pollingInterval: 5000,
60
71
  },
61
72
  };
package/cjs/http.js CHANGED
@@ -158,20 +158,24 @@ async function fetch_rpc(urls, payload, as_proof = false, fetchFn = globalThis.f
158
158
  async function handle_request(req, conf) {
159
159
  const free_buffers = [];
160
160
  let servers = [];
161
- switch (req.type) {
162
- case 'checkpointz':
163
- servers = [...(conf.checkpointz || []), ...(conf.beacon_apis || []), ...(conf.prover || [])];
164
- break;
165
- case 'beacon_api':
166
- servers = [...(conf.beacon_apis || []), ...(conf.prover || [])];
167
- break;
168
- case 'prover':
169
- servers = [...(conf.prover || [])];
170
- break;
171
- default:
172
- servers = conf.rpcs || [...((conf.prover || []).map(p => p + (p.endsWith('/') ? '' : '/') + 'unverified_rpc'))];
173
- break;
161
+ if (req.type === 'eth_rpc' && req.payload?.method === 'eth_getProof' && conf.oblivious_nodes?.length) {
162
+ servers = [...conf.oblivious_nodes];
174
163
  }
164
+ else
165
+ switch (req.type) {
166
+ case 'checkpointz':
167
+ servers = [...(conf.checkpointz || []), ...(conf.beacon_apis || []), ...(conf.prover || [])];
168
+ break;
169
+ case 'beacon_api':
170
+ servers = [...(conf.beacon_apis || []), ...(conf.prover || [])];
171
+ break;
172
+ case 'prover':
173
+ servers = [...(conf.prover || [])];
174
+ break;
175
+ default:
176
+ servers = conf.rpcs || [...((conf.prover || []).map(p => p + (p.endsWith('/') ? '' : '/') + 'unverified_rpc'))];
177
+ break;
178
+ }
175
179
  const c4w = await (0, wasm_js_1.getC4w)();
176
180
  let path = (req.type == 'eth_rpc' && req.payload)
177
181
  ? `rpc: ${req.payload?.method}(${req.payload?.params.join(',')})`
package/cjs/index.js CHANGED
@@ -88,8 +88,12 @@ class C4Client {
88
88
  this.flags |= 1;
89
89
  if (this.config.use_accesslist)
90
90
  this.flags |= (1 << 6);
91
- if (this.config.privacy_mode === 'basic')
91
+ if (this.config.privacy_mode === 'basic' || this.config.oblivious_nodes?.length)
92
92
  this.verify_flags |= 2;
93
+ if (this.config.oblivious_nodes?.length)
94
+ this.verify_flags |= (1 << 6);
95
+ if (this.config.skip_wsp_check)
96
+ this.verify_flags |= (1 << 7);
93
97
  if (!this.config.warningHandler)
94
98
  this.config.warningHandler = async (req, message) => console.warn(message);
95
99
  if (!this.config.proofStrategy)
@@ -102,6 +106,21 @@ class C4Client {
102
106
  pollingInterval: this.config.pollingInterval || (0, chains_js_1.chain_conf)(this.config, this.config.chainId)?.pollingInterval || 12000
103
107
  });
104
108
  }
109
+ /**
110
+ * Computes the lower bound for `block.timestamp` accepted on `"latest"`
111
+ * proofs as `now - max_latest_age_seconds`. Returns `0n` when the host
112
+ * disables the check (`max_latest_age_seconds === 0`). The platform
113
+ * wallclock is read here in the binding so the C/WASM core stays
114
+ * clock-free (relevant for embedded/WASM portability).
115
+ */
116
+ get_min_latest_block_ts() {
117
+ const maxAge = this.config.max_latest_age_seconds ?? C4Client.DEFAULT_MAX_LATEST_AGE_SECONDS;
118
+ if (maxAge <= 0)
119
+ return 0n;
120
+ const nowSec = Math.floor(Date.now() / 1000);
121
+ const lower = nowSec - maxAge;
122
+ return BigInt(lower > 0 ? lower : 0);
123
+ }
105
124
  /**
106
125
  * Checks whether the RPC method is supported or proofable.
107
126
  * @param method - The method to check
@@ -168,7 +187,7 @@ class C4Client {
168
187
  const witness_keys_ptr = this.config.checkpoint_witness_keys
169
188
  ? (0, wasm_js_1.as_char_ptr)(this.config.checkpoint_witness_keys, c4w, free_buffers)
170
189
  : 0;
171
- ctx = c4w._c4w_create_verify_ctx((0, wasm_js_1.copy_to_c)(proof, c4w, free_buffers), proof.length, (0, wasm_js_1.as_char_ptr)(method, c4w, free_buffers), (0, wasm_js_1.as_char_ptr)(JSON.stringify(args), c4w, free_buffers), BigInt(this.config.chainId), checkpoint_ptr, witness_keys_ptr, this.verify_flags);
190
+ ctx = c4w._c4w_create_verify_ctx((0, wasm_js_1.copy_to_c)(proof, c4w, free_buffers), proof.length, (0, wasm_js_1.as_char_ptr)(method, c4w, free_buffers), (0, wasm_js_1.as_char_ptr)(JSON.stringify(args), c4w, free_buffers), BigInt(this.config.chainId), checkpoint_ptr, witness_keys_ptr, this.verify_flags, this.get_min_latest_block_ts());
172
191
  while (true) {
173
192
  const state = (0, wasm_js_1.as_json)(c4w._c4w_verify_proof(ctx), c4w, true);
174
193
  switch (state.status) {
@@ -230,6 +249,7 @@ class C4Client {
230
249
  c4w._c4w_set_checkpoint(BigInt(this.config.chainId), (0, wasm_js_1.as_char_ptr)(this.config.trusted_checkpoint, c4w, free_buffers));
231
250
  if (this.config.checkpoint_witness_keys)
232
251
  c4w._c4w_rpc_ctx_set_witness_keys(ctx, (0, wasm_js_1.as_char_ptr)(this.config.checkpoint_witness_keys, c4w, free_buffers));
252
+ c4w._c4w_rpc_ctx_set_min_latest_block_ts(ctx, this.get_min_latest_block_ts());
233
253
  while (true) {
234
254
  const state = (0, wasm_js_1.as_json)(c4w._c4w_execute_rpc_ctx(ctx), c4w, true);
235
255
  switch (state.status) {
@@ -348,6 +368,8 @@ class C4Client {
348
368
  }
349
369
  }
350
370
  }
371
+ /** Default freshness window for `latest` proofs in seconds (≈5 Ethereum slots). */
372
+ C4Client.DEFAULT_MAX_LATEST_AGE_SECONDS = 60;
351
373
  // Protect against prototype pollution by freezing critical methods
352
374
  C4Client.CRITICAL_METHODS = ['rpc', 'request', 'verifyProof', 'createProof'];
353
375
  (() => {
package/http.js CHANGED
@@ -153,20 +153,24 @@ export async function fetch_rpc(urls, payload, as_proof = false, fetchFn = globa
153
153
  export async function handle_request(req, conf) {
154
154
  const free_buffers = [];
155
155
  let servers = [];
156
- switch (req.type) {
157
- case 'checkpointz':
158
- servers = [...(conf.checkpointz || []), ...(conf.beacon_apis || []), ...(conf.prover || [])];
159
- break;
160
- case 'beacon_api':
161
- servers = [...(conf.beacon_apis || []), ...(conf.prover || [])];
162
- break;
163
- case 'prover':
164
- servers = [...(conf.prover || [])];
165
- break;
166
- default:
167
- servers = conf.rpcs || [...((conf.prover || []).map(p => p + (p.endsWith('/') ? '' : '/') + 'unverified_rpc'))];
168
- break;
156
+ if (req.type === 'eth_rpc' && req.payload?.method === 'eth_getProof' && conf.oblivious_nodes?.length) {
157
+ servers = [...conf.oblivious_nodes];
169
158
  }
159
+ else
160
+ switch (req.type) {
161
+ case 'checkpointz':
162
+ servers = [...(conf.checkpointz || []), ...(conf.beacon_apis || []), ...(conf.prover || [])];
163
+ break;
164
+ case 'beacon_api':
165
+ servers = [...(conf.beacon_apis || []), ...(conf.prover || [])];
166
+ break;
167
+ case 'prover':
168
+ servers = [...(conf.prover || [])];
169
+ break;
170
+ default:
171
+ servers = conf.rpcs || [...((conf.prover || []).map(p => p + (p.endsWith('/') ? '' : '/') + 'unverified_rpc'))];
172
+ break;
173
+ }
170
174
  const c4w = await getC4w();
171
175
  let path = (req.type == 'eth_rpc' && req.payload)
172
176
  ? `rpc: ${req.payload?.method}(${req.payload?.params.join(',')})`
package/index.d.ts CHANGED
@@ -36,6 +36,8 @@ export default class C4Client {
36
36
  private flags;
37
37
  private verify_flags;
38
38
  private _lightClientTimer;
39
+ /** Default freshness window for `latest` proofs in seconds (≈5 Ethereum slots). */
40
+ private static readonly DEFAULT_MAX_LATEST_AGE_SECONDS;
39
41
  private static readonly CRITICAL_METHODS;
40
42
  /**
41
43
  * Creates a new Colibri client instance.
@@ -50,6 +52,14 @@ export default class C4Client {
50
52
  * @param config Optional partial configuration; user config overrides defaults.
51
53
  */
52
54
  constructor(config?: Partial<C4Config>);
55
+ /**
56
+ * Computes the lower bound for `block.timestamp` accepted on `"latest"`
57
+ * proofs as `now - max_latest_age_seconds`. Returns `0n` when the host
58
+ * disables the check (`max_latest_age_seconds === 0`). The platform
59
+ * wallclock is read here in the binding so the C/WASM core stays
60
+ * clock-free (relevant for embedded/WASM portability).
61
+ */
62
+ private get_min_latest_block_ts;
53
63
  /**
54
64
  * Checks whether the RPC method is supported or proofable.
55
65
  * @param method - The method to check
package/index.js CHANGED
@@ -81,8 +81,12 @@ class C4Client {
81
81
  this.flags |= 1;
82
82
  if (this.config.use_accesslist)
83
83
  this.flags |= (1 << 6);
84
- if (this.config.privacy_mode === 'basic')
84
+ if (this.config.privacy_mode === 'basic' || this.config.oblivious_nodes?.length)
85
85
  this.verify_flags |= 2;
86
+ if (this.config.oblivious_nodes?.length)
87
+ this.verify_flags |= (1 << 6);
88
+ if (this.config.skip_wsp_check)
89
+ this.verify_flags |= (1 << 7);
86
90
  if (!this.config.warningHandler)
87
91
  this.config.warningHandler = async (req, message) => console.warn(message);
88
92
  if (!this.config.proofStrategy)
@@ -95,6 +99,21 @@ class C4Client {
95
99
  pollingInterval: this.config.pollingInterval || chain_conf(this.config, this.config.chainId)?.pollingInterval || 12000
96
100
  });
97
101
  }
102
+ /**
103
+ * Computes the lower bound for `block.timestamp` accepted on `"latest"`
104
+ * proofs as `now - max_latest_age_seconds`. Returns `0n` when the host
105
+ * disables the check (`max_latest_age_seconds === 0`). The platform
106
+ * wallclock is read here in the binding so the C/WASM core stays
107
+ * clock-free (relevant for embedded/WASM portability).
108
+ */
109
+ get_min_latest_block_ts() {
110
+ const maxAge = this.config.max_latest_age_seconds ?? C4Client.DEFAULT_MAX_LATEST_AGE_SECONDS;
111
+ if (maxAge <= 0)
112
+ return 0n;
113
+ const nowSec = Math.floor(Date.now() / 1000);
114
+ const lower = nowSec - maxAge;
115
+ return BigInt(lower > 0 ? lower : 0);
116
+ }
98
117
  /**
99
118
  * Checks whether the RPC method is supported or proofable.
100
119
  * @param method - The method to check
@@ -161,7 +180,7 @@ class C4Client {
161
180
  const witness_keys_ptr = this.config.checkpoint_witness_keys
162
181
  ? as_char_ptr(this.config.checkpoint_witness_keys, c4w, free_buffers)
163
182
  : 0;
164
- ctx = c4w._c4w_create_verify_ctx(copy_to_c(proof, c4w, free_buffers), proof.length, as_char_ptr(method, c4w, free_buffers), as_char_ptr(JSON.stringify(args), c4w, free_buffers), BigInt(this.config.chainId), checkpoint_ptr, witness_keys_ptr, this.verify_flags);
183
+ ctx = c4w._c4w_create_verify_ctx(copy_to_c(proof, c4w, free_buffers), proof.length, as_char_ptr(method, c4w, free_buffers), as_char_ptr(JSON.stringify(args), c4w, free_buffers), BigInt(this.config.chainId), checkpoint_ptr, witness_keys_ptr, this.verify_flags, this.get_min_latest_block_ts());
165
184
  while (true) {
166
185
  const state = as_json(c4w._c4w_verify_proof(ctx), c4w, true);
167
186
  switch (state.status) {
@@ -223,6 +242,7 @@ class C4Client {
223
242
  c4w._c4w_set_checkpoint(BigInt(this.config.chainId), as_char_ptr(this.config.trusted_checkpoint, c4w, free_buffers));
224
243
  if (this.config.checkpoint_witness_keys)
225
244
  c4w._c4w_rpc_ctx_set_witness_keys(ctx, as_char_ptr(this.config.checkpoint_witness_keys, c4w, free_buffers));
245
+ c4w._c4w_rpc_ctx_set_min_latest_block_ts(ctx, this.get_min_latest_block_ts());
226
246
  while (true) {
227
247
  const state = as_json(c4w._c4w_execute_rpc_ctx(ctx), c4w, true);
228
248
  switch (state.status) {
@@ -341,6 +361,8 @@ class C4Client {
341
361
  }
342
362
  }
343
363
  }
364
+ /** Default freshness window for `latest` proofs in seconds (≈5 Ethereum slots). */
365
+ C4Client.DEFAULT_MAX_LATEST_AGE_SECONDS = 60;
344
366
  // Protect against prototype pollution by freezing critical methods
345
367
  C4Client.CRITICAL_METHODS = ['rpc', 'request', 'verifyProof', 'createProof'];
346
368
  (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpus-core/colibri-stateless",
3
- "version": "1.1.25",
3
+ "version": "1.1.27",
4
4
  "description": "Colibri is a stateless and trustless ethereum client, which is optimized for the mobile apps or embedded devices, because it does not hols the state, but verifies on demand.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/types.d.ts CHANGED
@@ -54,6 +54,8 @@ export interface Cache {
54
54
  export interface ChainConfig {
55
55
  beacon_apis: string[];
56
56
  rpcs: string[];
57
+ /** TEE RPC endpoints for eth_getProof. Sets VERIFY_FLAG_OBLIVIOUS and PAP when non-empty. Use with privacy_mode "basic" and prover_mode "hybrid" for private eth_call. */
58
+ oblivious_nodes?: string[];
57
59
  prover?: string[];
58
60
  checkpointz?: string[];
59
61
  trusted_checkpoint?: string;
@@ -81,6 +83,24 @@ export interface Config extends ChainConfig {
81
83
  zk_proof?: boolean;
82
84
  /** Proof generation mode. Default: "remote" if prover URLs configured, otherwise "local". */
83
85
  prover_mode?: ProverMode;
86
+ /**
87
+ * If true, the verifier skips the Weak Subjectivity Period check
88
+ * (`VERIFY_FLAG_SKIP_WSP_CHECK`, bit `1 << 7`). **SECURITY:** only safe when another
89
+ * trust anchor (witness signatures, hard-coded checkpoint, signed package) is in
90
+ * place; disabling raises the risk of long-range attacks across periods older than
91
+ * the WSP. Default: false.
92
+ */
93
+ skip_wsp_check?: boolean;
94
+ /**
95
+ * Maximum age (in seconds) accepted for a proof whose request uses the
96
+ * `"latest"` block tag. The verifier compares the block timestamp from
97
+ * the proof against `now - max_latest_age_seconds`; older proofs are
98
+ * rejected with `"proof for latest too old"`. `0` disables the check
99
+ * (useful when working with older proof formats that lack a block
100
+ * context). Currently active for `eth_call`, `eth_estimateGas`, and
101
+ * `colibri_simulateTransaction`. Default: 60.
102
+ */
103
+ max_latest_age_seconds?: number;
84
104
  chains: {
85
105
  [chainId: number]: ChainConfig;
86
106
  };
package/wasm_shared.d.ts CHANGED
@@ -28,7 +28,7 @@ export interface C4W {
28
28
  _c4w_req_set_response: (reqPtr: number, data: number, len: number, node_index: number) => void;
29
29
  _c4w_req_set_error: (reqPtr: number, error: number, node_index: number) => void;
30
30
  _c4w_get_method_type: (chain_id: bigint, method: number, params: number, flags: number) => number;
31
- _c4w_create_verify_ctx: (proof: number, proof_len: number, method: number, args: number, chain_id: bigint, trusted_checkpoint: number, witness_keys: number, flags: number) => number;
31
+ _c4w_create_verify_ctx: (proof: number, proof_len: number, method: number, args: number, chain_id: bigint, trusted_checkpoint: number, witness_keys: number, flags: number, min_latest_block_ts: bigint) => number;
32
32
  _c4w_free_verify_ctx: (verifyCtx: number) => void;
33
33
  _c4w_verify_proof: (verifyCtx: number) => number;
34
34
  _c4w_req_free: (reqPtr: number) => void;
@@ -39,6 +39,7 @@ export interface C4W {
39
39
  _c4w_set_checkpoint: (chainId: bigint, checkpoint: number) => void;
40
40
  _c4w_rpc_ctx_set_witness_keys: (ctx: number, keys: number) => void;
41
41
  _c4w_rpc_ctx_set_proxy_urls: (ctx: number, rpc_urls: number, beacon_urls: number) => void;
42
+ _c4w_rpc_ctx_set_min_latest_block_ts: (ctx: number, ts: bigint) => void;
42
43
  _c4w_decode_proof: (data: number, len: number) => number;
43
44
  _init_storage: () => void;
44
45
  HEAPU8: Uint8Array;