@sentio/runtime 2.42.0-rc.1 → 2.42.0-rc.2

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/lib/index.d.ts CHANGED
@@ -364,6 +364,7 @@ interface ExecutionConfig {
364
364
  forceExactBlockTime: boolean;
365
365
  processBindingTimeout: number;
366
366
  skipStartBlockValidation: boolean;
367
+ rpcRetryTimes: number;
367
368
  }
368
369
  declare const ExecutionConfig: {
369
370
  encode(message: ExecutionConfig, writer?: _m0.Writer): _m0.Writer;
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
2
- import{U as d,V as N,W as O,X as b,Y as w,Z as A,g as u,i as T,j as l,m,n as x,o as f,p as h,q as V,y as p}from"./chunk-VQEEM6NP.js";var r=class{stateMap=new Map;static reset(){r.INSTANCE=new r}},e=r;u(e,"INSTANCE",new r);var n=class{constructor(){}key(){return this.constructor.name}getOrRegister(){let t=e.INSTANCE.stateMap.get(this.key());return t||(t=this.initValue(),e.INSTANCE.stateMap.set(this.key(),t)),t}},g=class extends n{initValue(){return new Map}getValue(t){return this.getOrRegister().get(t)}getValues(){let t=this.getOrRegister();return Array.from(t.values())}getOrSetValue(t,s){let o=this.getOrRegister(),a=o.get(t);return a?(console.warn(t,"has been registered twice, use the previous one"),a):(o.set(t,s),s)}},c=class extends n{initValue(){return[]}getValues(){return this.getOrRegister()}addValue(t){return this.getOrRegister().push(t),t}};export{O as DummyProvider,V as Endpoints,p as GLOBAL_CONFIG,c as ListStateStorage,g as MapStateStorage,T as Plugin,l as PluginManager,A as ProcessorServiceImpl,w as QueuedStaticJsonRpcProvider,e as State,n as StateStorage,N as StoreContext,f as USER_PROCESSOR,x as errorString,b as getProvider,h as makeEthCallKey,m as mergeProcessResults,d as timeoutError};
2
+ import{U as d,V as N,W as O,X as b,Y as w,Z as A,g as u,i as T,j as l,m,n as x,o as f,p as h,q as V,y as p}from"./chunk-YJ5C526W.js";var r=class{stateMap=new Map;static reset(){r.INSTANCE=new r}},e=r;u(e,"INSTANCE",new r);var n=class{constructor(){}key(){return this.constructor.name}getOrRegister(){let t=e.INSTANCE.stateMap.get(this.key());return t||(t=this.initValue(),e.INSTANCE.stateMap.set(this.key(),t)),t}},g=class extends n{initValue(){return new Map}getValue(t){return this.getOrRegister().get(t)}getValues(){let t=this.getOrRegister();return Array.from(t.values())}getOrSetValue(t,s){let o=this.getOrRegister(),a=o.get(t);return a?(console.warn(t,"has been registered twice, use the previous one"),a):(o.set(t,s),s)}},c=class extends n{initValue(){return[]}getValues(){return this.getOrRegister()}addValue(t){return this.getOrRegister().push(t),t}};export{O as DummyProvider,V as Endpoints,p as GLOBAL_CONFIG,c as ListStateStorage,g as MapStateStorage,T as Plugin,l as PluginManager,A as ProcessorServiceImpl,w as QueuedStaticJsonRpcProvider,e as State,n as StateStorage,N as StoreContext,f as USER_PROCESSOR,x as errorString,b as getProvider,h as makeEthCallKey,m as mergeProcessResults,d as timeoutError};
3
3
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
3
- import{A as rh,B as Qr,C as nh,D as ih,E as pt,F as J,G as oh,H as Yt,I as Io,J as dt,K as ht,L as ah,M as uh,N as ke,O as A,P as Lo,Q as at,R as X,S as Ne,T as w,Z as sh,a as M,b as E,c as y,d as it,e as je,f as Y,h as Q1,k as Qd,l as Zd,q as Sr,r as ul,s as Z1,t as Jn,u as eh,v as th,w as eC,x as tC,y as sl,z as ot}from"./chunk-VQEEM6NP.js";var he=y(ll=>{"use strict";ll.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((n,o)=>{e.push((a,u)=>a!=null?o(a):n(u)),t.apply(this,e)})},"name",{value:t.name})};ll.fromPromise=function(t){return Object.defineProperty(function(...e){let n=e[e.length-1];if(typeof n!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(o=>n(null,o),n)},"name",{value:t.name})}});var ch=y((I7,lh)=>{var $t=M("constants"),rC=process.cwd,Co=null,nC=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Co||(Co=rC.call(process)),Co};try{process.cwd()}catch{}typeof process.chdir=="function"&&(cl=process.chdir,process.chdir=function(t){Co=null,cl.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,cl));var cl;lh.exports=iC;function iC(t){$t.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||n(t),t.chown=u(t.chown),t.fchown=u(t.fchown),t.lchown=u(t.lchown),t.chmod=o(t.chmod),t.fchmod=o(t.fchmod),t.lchmod=o(t.lchmod),t.chownSync=i(t.chownSync),t.fchownSync=i(t.fchownSync),t.lchownSync=i(t.lchownSync),t.chmodSync=a(t.chmodSync),t.fchmodSync=a(t.fchmodSync),t.lchmodSync=a(t.lchmodSync),t.stat=r(t.stat),t.fstat=r(t.fstat),t.lstat=r(t.lstat),t.statSync=s(t.statSync),t.fstatSync=s(t.fstatSync),t.lstatSync=s(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,p,m){m&&process.nextTick(m)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,p,m,f){f&&process.nextTick(f)},t.lchownSync=function(){}),nC==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function p(m,f,v){var S=Date.now(),_=0;c(m,f,function O(g){if(g&&(g.code==="EACCES"||g.code==="EPERM"||g.code==="EBUSY")&&Date.now()-S<6e4){setTimeout(function(){t.stat(f,function(b,L){b&&b.code==="ENOENT"?c(m,f,O):v(g)})},_),_<100&&(_+=10);return}v&&v(g)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function p(m,f,v,S,_,O){var g;if(O&&typeof O=="function"){var b=0;g=function(L,B,j){if(L&&L.code==="EAGAIN"&&b<10)return b++,c.call(t,m,f,v,S,_,g);O.apply(this,arguments)}}return c.call(t,m,f,v,S,_,g)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(p,m,f,v,S){for(var _=0;;)try{return c.call(t,p,m,f,v,S)}catch(O){if(O.code==="EAGAIN"&&_<10){_++;continue}throw O}}}(t.readSync);function e(c){c.lchmod=function(p,m,f){c.open(p,$t.O_WRONLY|$t.O_SYMLINK,m,function(v,S){if(v){f&&f(v);return}c.fchmod(S,m,function(_){c.close(S,function(O){f&&f(_||O)})})})},c.lchmodSync=function(p,m){var f=c.openSync(p,$t.O_WRONLY|$t.O_SYMLINK,m),v=!0,S;try{S=c.fchmodSync(f,m),v=!1}finally{if(v)try{c.closeSync(f)}catch{}else c.closeSync(f)}return S}}function n(c){$t.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(p,m,f,v){c.open(p,$t.O_SYMLINK,function(S,_){if(S){v&&v(S);return}c.futimes(_,m,f,function(O){c.close(_,function(g){v&&v(O||g)})})})},c.lutimesSync=function(p,m,f){var v=c.openSync(p,$t.O_SYMLINK),S,_=!0;try{S=c.futimesSync(v,m,f),_=!1}finally{if(_)try{c.closeSync(v)}catch{}else c.closeSync(v)}return S}):c.futimes&&(c.lutimes=function(p,m,f,v){v&&process.nextTick(v)},c.lutimesSync=function(){})}function o(c){return c&&function(p,m,f){return c.call(t,p,m,function(v){l(v)&&(v=null),f&&f.apply(this,arguments)})}}function a(c){return c&&function(p,m){try{return c.call(t,p,m)}catch(f){if(!l(f))throw f}}}function u(c){return c&&function(p,m,f,v){return c.call(t,p,m,f,function(S){l(S)&&(S=null),v&&v.apply(this,arguments)})}}function i(c){return c&&function(p,m,f){try{return c.call(t,p,m,f)}catch(v){if(!l(v))throw v}}}function r(c){return c&&function(p,m,f){typeof m=="function"&&(f=m,m=null);function v(S,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),f&&f.apply(this,arguments)}return m?c.call(t,p,m,v):c.call(t,p,v)}}function s(c){return c&&function(p,m){var f=m?c.call(t,p,m):c.call(t,p);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function l(c){if(!c||c.code==="ENOSYS")return!0;var p=!process.getuid||process.getuid()!==0;return!!(p&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var dh=y((L7,ph)=>{var fh=M("stream").Stream;ph.exports=oC;function oC(t){return{ReadStream:e,WriteStream:n};function e(o,a){if(!(this instanceof e))return new e(o,a);fh.call(this);var u=this;this.path=o,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,a=a||{};for(var i=Object.keys(a),r=0,s=i.length;r<s;r++){var l=i[r];this[l]=a[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){u._read()});return}t.open(this.path,this.flags,this.mode,function(c,p){if(c){u.emit("error",c),u.readable=!1;return}u.fd=p,u.emit("open",p),u._read()})}function n(o,a){if(!(this instanceof n))return new n(o,a);fh.call(this),this.path=o,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,a=a||{};for(var u=Object.keys(a),i=0,r=u.length;i<r;i++){var s=u[i];this[s]=a[s]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var mh=y((C7,hh)=>{"use strict";hh.exports=uC;var aC=Object.getPrototypeOf||function(t){return t.__proto__};function uC(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:aC(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}});var en=y((U7,dl)=>{var oe=M("fs"),sC=ch(),lC=dh(),cC=mh(),Uo=M("util"),_e,Vo;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_e=Symbol.for("graceful-fs.queue"),Vo=Symbol.for("graceful-fs.previous")):(_e="___graceful-fs.queue",Vo="___graceful-fs.previous");function fC(){}function _h(t,e){Object.defineProperty(t,_e,{get:function(){return e}})}var Er=fC;Uo.debuglog?Er=Uo.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Er=function(){var t=Uo.format.apply(Uo,arguments);t="GFS4: "+t.split(/\n/).join(`
3
+ import{A as rh,B as Qr,C as nh,D as ih,E as pt,F as J,G as oh,H as Yt,I as Io,J as dt,K as ht,L as ah,M as uh,N as ke,O as A,P as Lo,Q as at,R as X,S as Ne,T as w,Z as sh,a as M,b as E,c as y,d as it,e as je,f as Y,h as Q1,k as Qd,l as Zd,q as Sr,r as ul,s as Z1,t as Jn,u as eh,v as th,w as eC,x as tC,y as sl,z as ot}from"./chunk-YJ5C526W.js";var he=y(ll=>{"use strict";ll.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((n,o)=>{e.push((a,u)=>a!=null?o(a):n(u)),t.apply(this,e)})},"name",{value:t.name})};ll.fromPromise=function(t){return Object.defineProperty(function(...e){let n=e[e.length-1];if(typeof n!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(o=>n(null,o),n)},"name",{value:t.name})}});var ch=y((I7,lh)=>{var $t=M("constants"),rC=process.cwd,Co=null,nC=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Co||(Co=rC.call(process)),Co};try{process.cwd()}catch{}typeof process.chdir=="function"&&(cl=process.chdir,process.chdir=function(t){Co=null,cl.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,cl));var cl;lh.exports=iC;function iC(t){$t.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||n(t),t.chown=u(t.chown),t.fchown=u(t.fchown),t.lchown=u(t.lchown),t.chmod=o(t.chmod),t.fchmod=o(t.fchmod),t.lchmod=o(t.lchmod),t.chownSync=i(t.chownSync),t.fchownSync=i(t.fchownSync),t.lchownSync=i(t.lchownSync),t.chmodSync=a(t.chmodSync),t.fchmodSync=a(t.fchmodSync),t.lchmodSync=a(t.lchmodSync),t.stat=r(t.stat),t.fstat=r(t.fstat),t.lstat=r(t.lstat),t.statSync=s(t.statSync),t.fstatSync=s(t.fstatSync),t.lstatSync=s(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,p,m){m&&process.nextTick(m)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,p,m,f){f&&process.nextTick(f)},t.lchownSync=function(){}),nC==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function p(m,f,v){var S=Date.now(),_=0;c(m,f,function O(g){if(g&&(g.code==="EACCES"||g.code==="EPERM"||g.code==="EBUSY")&&Date.now()-S<6e4){setTimeout(function(){t.stat(f,function(b,L){b&&b.code==="ENOENT"?c(m,f,O):v(g)})},_),_<100&&(_+=10);return}v&&v(g)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function p(m,f,v,S,_,O){var g;if(O&&typeof O=="function"){var b=0;g=function(L,B,j){if(L&&L.code==="EAGAIN"&&b<10)return b++,c.call(t,m,f,v,S,_,g);O.apply(this,arguments)}}return c.call(t,m,f,v,S,_,g)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(p,m,f,v,S){for(var _=0;;)try{return c.call(t,p,m,f,v,S)}catch(O){if(O.code==="EAGAIN"&&_<10){_++;continue}throw O}}}(t.readSync);function e(c){c.lchmod=function(p,m,f){c.open(p,$t.O_WRONLY|$t.O_SYMLINK,m,function(v,S){if(v){f&&f(v);return}c.fchmod(S,m,function(_){c.close(S,function(O){f&&f(_||O)})})})},c.lchmodSync=function(p,m){var f=c.openSync(p,$t.O_WRONLY|$t.O_SYMLINK,m),v=!0,S;try{S=c.fchmodSync(f,m),v=!1}finally{if(v)try{c.closeSync(f)}catch{}else c.closeSync(f)}return S}}function n(c){$t.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(p,m,f,v){c.open(p,$t.O_SYMLINK,function(S,_){if(S){v&&v(S);return}c.futimes(_,m,f,function(O){c.close(_,function(g){v&&v(O||g)})})})},c.lutimesSync=function(p,m,f){var v=c.openSync(p,$t.O_SYMLINK),S,_=!0;try{S=c.futimesSync(v,m,f),_=!1}finally{if(_)try{c.closeSync(v)}catch{}else c.closeSync(v)}return S}):c.futimes&&(c.lutimes=function(p,m,f,v){v&&process.nextTick(v)},c.lutimesSync=function(){})}function o(c){return c&&function(p,m,f){return c.call(t,p,m,function(v){l(v)&&(v=null),f&&f.apply(this,arguments)})}}function a(c){return c&&function(p,m){try{return c.call(t,p,m)}catch(f){if(!l(f))throw f}}}function u(c){return c&&function(p,m,f,v){return c.call(t,p,m,f,function(S){l(S)&&(S=null),v&&v.apply(this,arguments)})}}function i(c){return c&&function(p,m,f){try{return c.call(t,p,m,f)}catch(v){if(!l(v))throw v}}}function r(c){return c&&function(p,m,f){typeof m=="function"&&(f=m,m=null);function v(S,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),f&&f.apply(this,arguments)}return m?c.call(t,p,m,v):c.call(t,p,v)}}function s(c){return c&&function(p,m){var f=m?c.call(t,p,m):c.call(t,p);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function l(c){if(!c||c.code==="ENOSYS")return!0;var p=!process.getuid||process.getuid()!==0;return!!(p&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var dh=y((L7,ph)=>{var fh=M("stream").Stream;ph.exports=oC;function oC(t){return{ReadStream:e,WriteStream:n};function e(o,a){if(!(this instanceof e))return new e(o,a);fh.call(this);var u=this;this.path=o,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,a=a||{};for(var i=Object.keys(a),r=0,s=i.length;r<s;r++){var l=i[r];this[l]=a[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){u._read()});return}t.open(this.path,this.flags,this.mode,function(c,p){if(c){u.emit("error",c),u.readable=!1;return}u.fd=p,u.emit("open",p),u._read()})}function n(o,a){if(!(this instanceof n))return new n(o,a);fh.call(this),this.path=o,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,a=a||{};for(var u=Object.keys(a),i=0,r=u.length;i<r;i++){var s=u[i];this[s]=a[s]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var mh=y((C7,hh)=>{"use strict";hh.exports=uC;var aC=Object.getPrototypeOf||function(t){return t.__proto__};function uC(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:aC(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}});var en=y((U7,dl)=>{var oe=M("fs"),sC=ch(),lC=dh(),cC=mh(),Uo=M("util"),_e,Vo;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_e=Symbol.for("graceful-fs.queue"),Vo=Symbol.for("graceful-fs.previous")):(_e="___graceful-fs.queue",Vo="___graceful-fs.previous");function fC(){}function _h(t,e){Object.defineProperty(t,_e,{get:function(){return e}})}var Er=fC;Uo.debuglog?Er=Uo.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Er=function(){var t=Uo.format.apply(Uo,arguments);t="GFS4: "+t.split(/\n/).join(`
4
4
  GFS4: `),console.error(t)});oe[_e]||(vh=global[_e]||[],_h(oe,vh),oe.close=function(t){function e(n,o){return t.call(oe,n,function(a){a||yh(),typeof o=="function"&&o.apply(this,arguments)})}return Object.defineProperty(e,Vo,{value:t}),e}(oe.close),oe.closeSync=function(t){function e(n){t.apply(oe,arguments),yh()}return Object.defineProperty(e,Vo,{value:t}),e}(oe.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Er(oe[_e]),M("assert").equal(oe[_e].length,0)}));var vh;global[_e]||_h(global,oe[_e]);dl.exports=fl(cC(oe));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!oe.__patched&&(dl.exports=fl(oe),oe.__patched=!0);function fl(t){sC(t),t.gracefulify=fl,t.createReadStream=B,t.createWriteStream=j;var e=t.readFile;t.readFile=n;function n(P,k,U){return typeof k=="function"&&(U=k,k=null),z(P,k,U);function z(W,ne,ie,ue){return e(W,ne,function(Z){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?Zr([z,[W,ne,ie],Z,ue||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}}var o=t.writeFile;t.writeFile=a;function a(P,k,U,z){return typeof U=="function"&&(z=U,U=null),W(P,k,U,z);function W(ne,ie,ue,Z,ye){return o(ne,ie,ue,function(re){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Zr([W,[ne,ie,ue,Z],re,ye||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}var u=t.appendFile;u&&(t.appendFile=i);function i(P,k,U,z){return typeof U=="function"&&(z=U,U=null),W(P,k,U,z);function W(ne,ie,ue,Z,ye){return u(ne,ie,ue,function(re){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Zr([W,[ne,ie,ue,Z],re,ye||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}var r=t.copyFile;r&&(t.copyFile=s);function s(P,k,U,z){return typeof U=="function"&&(z=U,U=0),W(P,k,U,z);function W(ne,ie,ue,Z,ye){return r(ne,ie,ue,function(re){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Zr([W,[ne,ie,ue,Z],re,ye||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}var l=t.readdir;t.readdir=p;var c=/^v[0-5]\./;function p(P,k,U){typeof k=="function"&&(U=k,k=null);var z=c.test(process.version)?function(ie,ue,Z,ye){return l(ie,W(ie,ue,Z,ye))}:function(ie,ue,Z,ye){return l(ie,ue,W(ie,ue,Z,ye))};return z(P,k,U);function W(ne,ie,ue,Z){return function(ye,re){ye&&(ye.code==="EMFILE"||ye.code==="ENFILE")?Zr([z,[ne,ie,ue],ye,Z||Date.now(),Date.now()]):(re&&re.sort&&re.sort(),typeof ue=="function"&&ue.call(this,ye,re))}}}if(process.version.substr(0,4)==="v0.8"){var m=lC(t);O=m.ReadStream,b=m.WriteStream}var f=t.ReadStream;f&&(O.prototype=Object.create(f.prototype),O.prototype.open=g);var v=t.WriteStream;v&&(b.prototype=Object.create(v.prototype),b.prototype.open=L),Object.defineProperty(t,"ReadStream",{get:function(){return O},set:function(P){O=P},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return b},set:function(P){b=P},enumerable:!0,configurable:!0});var S=O;Object.defineProperty(t,"FileReadStream",{get:function(){return S},set:function(P){S=P},enumerable:!0,configurable:!0});var _=b;Object.defineProperty(t,"FileWriteStream",{get:function(){return _},set:function(P){_=P},enumerable:!0,configurable:!0});function O(P,k){return this instanceof O?(f.apply(this,arguments),this):O.apply(Object.create(O.prototype),arguments)}function g(){var P=this;$(P.path,P.flags,P.mode,function(k,U){k?(P.autoClose&&P.destroy(),P.emit("error",k)):(P.fd=U,P.emit("open",U),P.read())})}function b(P,k){return this instanceof b?(v.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function L(){var P=this;$(P.path,P.flags,P.mode,function(k,U){k?(P.destroy(),P.emit("error",k)):(P.fd=U,P.emit("open",U))})}function B(P,k){return new t.ReadStream(P,k)}function j(P,k){return new t.WriteStream(P,k)}var ae=t.open;t.open=$;function $(P,k,U,z){return typeof U=="function"&&(z=U,U=null),W(P,k,U,z);function W(ne,ie,ue,Z,ye){return ae(ne,ie,ue,function(re,w7){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Zr([W,[ne,ie,ue,Z],re,ye||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}return t}function Zr(t){Er("ENQUEUE",t[0].name,t[1]),oe[_e].push(t),pl()}var Do;function yh(){for(var t=Date.now(),e=0;e<oe[_e].length;++e)oe[_e][e].length>2&&(oe[_e][e][3]=t,oe[_e][e][4]=t);pl()}function pl(){if(clearTimeout(Do),Do=void 0,oe[_e].length!==0){var t=oe[_e].shift(),e=t[0],n=t[1],o=t[2],a=t[3],u=t[4];if(a===void 0)Er("RETRY",e.name,n),e.apply(null,n);else if(Date.now()-a>=6e4){Er("TIMEOUT",e.name,n);var i=n.pop();typeof i=="function"&&i.call(null,o)}else{var r=Date.now()-u,s=Math.max(u-a,1),l=Math.min(s*1.2,100);r>=l?(Er("RETRY",e.name,n),e.apply(null,n.concat([a]))):oe[_e].push(t)}Do===void 0&&(Do=setTimeout(pl,0))}}});var Pe=y(Mt=>{"use strict";var Sh=he().fromCallback,Re=en(),pC=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof Re[t]=="function");Object.assign(Mt,Re);pC.forEach(t=>{Mt[t]=Sh(Re[t])});Mt.exists=function(t,e){return typeof e=="function"?Re.exists(t,e):new Promise(n=>Re.exists(t,n))};Mt.read=function(t,e,n,o,a,u){return typeof u=="function"?Re.read(t,e,n,o,a,u):new Promise((i,r)=>{Re.read(t,e,n,o,a,(s,l,c)=>{if(s)return r(s);i({bytesRead:l,buffer:c})})})};Mt.write=function(t,e,...n){return typeof n[n.length-1]=="function"?Re.write(t,e,...n):new Promise((o,a)=>{Re.write(t,e,...n,(u,i,r)=>{if(u)return a(u);o({bytesWritten:i,buffer:r})})})};Mt.readv=function(t,e,...n){return typeof n[n.length-1]=="function"?Re.readv(t,e,...n):new Promise((o,a)=>{Re.readv(t,e,...n,(u,i,r)=>{if(u)return a(u);o({bytesRead:i,buffers:r})})})};Mt.writev=function(t,e,...n){return typeof n[n.length-1]=="function"?Re.writev(t,e,...n):new Promise((o,a)=>{Re.writev(t,e,...n,(u,i,r)=>{if(u)return a(u);o({bytesWritten:i,buffers:r})})})};typeof Re.realpath.native=="function"?Mt.realpath.native=Sh(Re.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var Th=y((V7,Eh)=>{"use strict";var dC=M("path");Eh.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(dC.parse(e).root,""))){let o=new Error(`Path contains invalid characters: ${e}`);throw o.code="EINVAL",o}}});var bh=y((k7,hl)=>{"use strict";var gh=Pe(),{checkPath:Oh}=Th(),Ah=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};hl.exports.makeDir=async(t,e)=>(Oh(t),gh.mkdir(t,{mode:Ah(e),recursive:!0}));hl.exports.makeDirSync=(t,e)=>(Oh(t),gh.mkdirSync(t,{mode:Ah(e),recursive:!0}))});var ut=y((B7,xh)=>{"use strict";var hC=he().fromPromise,{makeDir:mC,makeDirSync:ml}=bh(),vl=hC(mC);xh.exports={mkdirs:vl,mkdirsSync:ml,mkdirp:vl,mkdirpSync:ml,ensureDir:vl,ensureDirSync:ml}});var Kt=y((G7,Rh)=>{"use strict";var vC=he().fromPromise,Nh=Pe();function yC(t){return Nh.access(t).then(()=>!0).catch(()=>!1)}Rh.exports={pathExists:vC(yC),pathExistsSync:Nh.existsSync}});var yl=y((q7,Ph)=>{"use strict";var tn=Pe(),_C=he().fromPromise;async function SC(t,e,n){let o=await tn.open(t,"r+"),a=null;try{await tn.futimes(o,e,n)}finally{try{await tn.close(o)}catch(u){a=u}}if(a)throw a}function EC(t,e,n){let o=tn.openSync(t,"r+");return tn.futimesSync(o,e,n),tn.closeSync(o)}Ph.exports={utimesMillis:_C(SC),utimesMillisSync:EC}});var Tr=y((F7,Lh)=>{"use strict";var rn=Pe(),me=M("path"),wh=he().fromPromise;function TC(t,e,n){let o=n.dereference?a=>rn.stat(a,{bigint:!0}):a=>rn.lstat(a,{bigint:!0});return Promise.all([o(t),o(e).catch(a=>{if(a.code==="ENOENT")return null;throw a})]).then(([a,u])=>({srcStat:a,destStat:u}))}function gC(t,e,n){let o,a=n.dereference?i=>rn.statSync(i,{bigint:!0}):i=>rn.lstatSync(i,{bigint:!0}),u=a(t);try{o=a(e)}catch(i){if(i.code==="ENOENT")return{srcStat:u,destStat:null};throw i}return{srcStat:u,destStat:o}}async function OC(t,e,n,o){let{srcStat:a,destStat:u}=await TC(t,e,o);if(u){if(Qn(a,u)){let i=me.basename(t),r=me.basename(e);if(n==="move"&&i!==r&&i.toLowerCase()===r.toLowerCase())return{srcStat:a,destStat:u,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(a.isDirectory()&&!u.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!a.isDirectory()&&u.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(a.isDirectory()&&_l(t,e))throw new Error(ko(t,e,n));return{srcStat:a,destStat:u}}function AC(t,e,n,o){let{srcStat:a,destStat:u}=gC(t,e,o);if(u){if(Qn(a,u)){let i=me.basename(t),r=me.basename(e);if(n==="move"&&i!==r&&i.toLowerCase()===r.toLowerCase())return{srcStat:a,destStat:u,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(a.isDirectory()&&!u.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!a.isDirectory()&&u.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(a.isDirectory()&&_l(t,e))throw new Error(ko(t,e,n));return{srcStat:a,destStat:u}}async function Mh(t,e,n,o){let a=me.resolve(me.dirname(t)),u=me.resolve(me.dirname(n));if(u===a||u===me.parse(u).root)return;let i;try{i=await rn.stat(u,{bigint:!0})}catch(r){if(r.code==="ENOENT")return;throw r}if(Qn(e,i))throw new Error(ko(t,n,o));return Mh(t,e,u,o)}function Ih(t,e,n,o){let a=me.resolve(me.dirname(t)),u=me.resolve(me.dirname(n));if(u===a||u===me.parse(u).root)return;let i;try{i=rn.statSync(u,{bigint:!0})}catch(r){if(r.code==="ENOENT")return;throw r}if(Qn(e,i))throw new Error(ko(t,n,o));return Ih(t,e,u,o)}function Qn(t,e){return e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev}function _l(t,e){let n=me.resolve(t).split(me.sep).filter(a=>a),o=me.resolve(e).split(me.sep).filter(a=>a);return n.every((a,u)=>o[u]===a)}function ko(t,e,n){return`Cannot ${n} '${t}' to a subdirectory of itself, '${e}'.`}Lh.exports={checkPaths:wh(OC),checkPathsSync:AC,checkParentPaths:wh(Mh),checkParentPathsSync:Ih,isSrcSubdir:_l,areIdentical:Qn}});var kh=y((H7,Vh)=>{"use strict";var Oe=Pe(),Zn=M("path"),{mkdirs:bC}=ut(),{pathExists:xC}=Kt(),{utimesMillis:NC}=yl(),ei=Tr();async function RC(t,e,n={}){typeof n=="function"&&(n={filter:n}),n.clobber="clobber"in n?!!n.clobber:!0,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
5
5
 
6
6
  see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:o,destStat:a}=await ei.checkPaths(t,e,"copy",n);if(await ei.checkParentPaths(t,o,e,"copy"),!await Uh(t,e,n))return;let i=Zn.dirname(e);await xC(i)||await bC(i),await Dh(a,t,e,n)}async function Uh(t,e,n){return n.filter?n.filter(t,e):!0}async function Dh(t,e,n,o){let u=await(o.dereference?Oe.stat:Oe.lstat)(e);if(u.isDirectory())return IC(u,t,e,n,o);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return PC(u,t,e,n,o);if(u.isSymbolicLink())return LC(t,e,n,o);throw u.isSocket()?new Error(`Cannot copy a socket file: ${e}`):u.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function PC(t,e,n,o,a){if(!e)return Ch(t,n,o,a);if(a.overwrite)return await Oe.unlink(o),Ch(t,n,o,a);if(a.errorOnExist)throw new Error(`'${o}' already exists`)}async function Ch(t,e,n,o){if(await Oe.copyFile(e,n),o.preserveTimestamps){wC(t.mode)&&await MC(n,t.mode);let a=await Oe.stat(e);await NC(n,a.atime,a.mtime)}return Oe.chmod(n,t.mode)}function wC(t){return(t&128)===0}function MC(t,e){return Oe.chmod(t,e|128)}async function IC(t,e,n,o,a){e||await Oe.mkdir(o);let u=await Oe.readdir(n);await Promise.all(u.map(async i=>{let r=Zn.join(n,i),s=Zn.join(o,i);if(!await Uh(r,s,a))return;let{destStat:c}=await ei.checkPaths(r,s,"copy",a);return Dh(c,r,s,a)})),e||await Oe.chmod(o,t.mode)}async function LC(t,e,n,o){let a=await Oe.readlink(e);if(o.dereference&&(a=Zn.resolve(process.cwd(),a)),!t)return Oe.symlink(a,n);let u=null;try{u=await Oe.readlink(n)}catch(i){if(i.code==="EINVAL"||i.code==="UNKNOWN")return Oe.symlink(a,n);throw i}if(o.dereference&&(u=Zn.resolve(process.cwd(),u)),ei.isSrcSubdir(a,u))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${u}'.`);if(ei.isSrcSubdir(u,a))throw new Error(`Cannot overwrite '${u}' with '${a}'.`);return await Oe.unlink(n),Oe.symlink(a,n)}Vh.exports=RC});var Hh=y((j7,Fh)=>{"use strict";var we=en(),ti=M("path"),CC=ut().mkdirsSync,UC=yl().utimesMillisSync,ri=Tr();function DC(t,e,n){typeof n=="function"&&(n={filter:n}),n=n||{},n.clobber="clobber"in n?!!n.clobber:!0,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.42.0-rc.1",
3
+ "version": "2.42.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -378,6 +378,7 @@ export interface ExecutionConfig {
378
378
  forceExactBlockTime: boolean;
379
379
  processBindingTimeout: number;
380
380
  skipStartBlockValidation: boolean;
381
+ rpcRetryTimes: number;
381
382
  }
382
383
 
383
384
  export interface ProcessConfigRequest {
@@ -1282,7 +1283,13 @@ export const ProjectConfig = {
1282
1283
  };
1283
1284
 
1284
1285
  function createBaseExecutionConfig(): ExecutionConfig {
1285
- return { sequential: false, forceExactBlockTime: false, processBindingTimeout: 0, skipStartBlockValidation: false };
1286
+ return {
1287
+ sequential: false,
1288
+ forceExactBlockTime: false,
1289
+ processBindingTimeout: 0,
1290
+ skipStartBlockValidation: false,
1291
+ rpcRetryTimes: 0,
1292
+ };
1286
1293
  }
1287
1294
 
1288
1295
  export const ExecutionConfig = {
@@ -1299,6 +1306,9 @@ export const ExecutionConfig = {
1299
1306
  if (message.skipStartBlockValidation !== false) {
1300
1307
  writer.uint32(32).bool(message.skipStartBlockValidation);
1301
1308
  }
1309
+ if (message.rpcRetryTimes !== 0) {
1310
+ writer.uint32(40).int32(message.rpcRetryTimes);
1311
+ }
1302
1312
  return writer;
1303
1313
  },
1304
1314
 
@@ -1337,6 +1347,13 @@ export const ExecutionConfig = {
1337
1347
 
1338
1348
  message.skipStartBlockValidation = reader.bool();
1339
1349
  continue;
1350
+ case 5:
1351
+ if (tag !== 40) {
1352
+ break;
1353
+ }
1354
+
1355
+ message.rpcRetryTimes = reader.int32();
1356
+ continue;
1340
1357
  }
1341
1358
  if ((tag & 7) === 4 || tag === 0) {
1342
1359
  break;
@@ -1354,6 +1371,7 @@ export const ExecutionConfig = {
1354
1371
  skipStartBlockValidation: isSet(object.skipStartBlockValidation)
1355
1372
  ? globalThis.Boolean(object.skipStartBlockValidation)
1356
1373
  : false,
1374
+ rpcRetryTimes: isSet(object.rpcRetryTimes) ? globalThis.Number(object.rpcRetryTimes) : 0,
1357
1375
  };
1358
1376
  },
1359
1377
 
@@ -1371,6 +1389,9 @@ export const ExecutionConfig = {
1371
1389
  if (message.skipStartBlockValidation !== false) {
1372
1390
  obj.skipStartBlockValidation = message.skipStartBlockValidation;
1373
1391
  }
1392
+ if (message.rpcRetryTimes !== 0) {
1393
+ obj.rpcRetryTimes = Math.round(message.rpcRetryTimes);
1394
+ }
1374
1395
  return obj;
1375
1396
  },
1376
1397
 
@@ -1383,6 +1404,7 @@ export const ExecutionConfig = {
1383
1404
  message.forceExactBlockTime = object.forceExactBlockTime ?? false;
1384
1405
  message.processBindingTimeout = object.processBindingTimeout ?? 0;
1385
1406
  message.skipStartBlockValidation = object.skipStartBlockValidation ?? false;
1407
+ message.rpcRetryTimes = object.rpcRetryTimes ?? 0;
1386
1408
  return message;
1387
1409
  },
1388
1410
  };
package/src/provider.ts CHANGED
@@ -5,6 +5,7 @@ import { Endpoints } from './endpoints.js'
5
5
  import { EthChainId } from '@sentio/chain'
6
6
  import { LRUCache } from 'lru-cache'
7
7
  import { providerMetrics } from './metrics.js'
8
+ import { GLOBAL_CONFIG } from 'global-config.js'
8
9
  const { miss_count, hit_count, total_duration, total_queued, queue_size } = providerMetrics
9
10
 
10
11
  export const DummyProvider = new JsonRpcProvider('', Network.from(1))
@@ -104,6 +105,9 @@ export class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
104
105
  // return 1024
105
106
  // }
106
107
  })
108
+ #retryCache = new LRUCache<string, number>({
109
+ max: 300000 // 300k items
110
+ })
107
111
 
108
112
  constructor(url: string, network: Network, concurrency: number, batchCount = 1) {
109
113
  // TODO re-enable match when possible
@@ -120,6 +124,9 @@ export class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
120
124
  let perform = this.#performCache.get(tag)
121
125
  if (!perform) {
122
126
  miss_count.add(1)
127
+ if (GLOBAL_CONFIG.execution.rpcRetryTimes && this.#retryCache.get(tag) === undefined) {
128
+ this.#retryCache.set(tag, GLOBAL_CONFIG.execution.rpcRetryTimes)
129
+ }
123
130
  const queued: number = Date.now()
124
131
  perform = this.executor.add(() => {
125
132
  const started = Date.now()
@@ -129,14 +136,6 @@ export class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
129
136
  total_duration.add(Date.now() - started)
130
137
  })
131
138
  })
132
- perform.catch((e) => {
133
- // if (e.code !== 'CALL_EXCEPTION' && e.code !== 'BAD_DATA') {
134
- setTimeout(() => {
135
- if (this.#performCache.get(tag) === perform) {
136
- this.#performCache.delete(tag)
137
- }
138
- }, 1000)
139
- })
140
139
 
141
140
  queue_size.record(this.executor.size)
142
141
 
@@ -153,7 +152,20 @@ export class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
153
152
  hit_count.add(1)
154
153
  }
155
154
 
156
- const result = await perform
155
+ let result
156
+ try {
157
+ result = await perform
158
+ } catch (e) {
159
+ // if (e.code !== 'CALL_EXCEPTION' && e.code !== 'BAD_DATA') {
160
+ if (this.#performCache.get(tag) === perform) {
161
+ this.#performCache.delete(tag)
162
+ }
163
+ const retryCount = this.#retryCache.get(tag)
164
+ if (e.code === 'TIMEOUT' && retryCount) {
165
+ this.#retryCache.set(tag, retryCount - 1)
166
+ return this.send(method, params)
167
+ }
168
+ }
157
169
  if (!result) {
158
170
  throw Error('Unexpected null response')
159
171
  }