From 9c9b35358593d1bce72db793f313b46e551991fb Mon Sep 17 00:00:00 2001 From: Alex E Date: Tue, 1 Oct 2024 18:27:41 +0500 Subject: [PATCH 01/10] [FIX] log response before starting redactions --- src/providers/http/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/providers/http/index.ts b/src/providers/http/index.ts index cbf690b7..ef7d249c 100644 --- a/src/providers/http/index.ts +++ b/src/providers/http/index.ts @@ -137,6 +137,8 @@ const HTTP_PROVIDER: Provider<'http'> = { } }, getResponseRedactions(response, rawParams) { + logger.debug({ response:base64.encode(response), params:rawParams }) + const res = parseHttpResponse(response) if(!rawParams.responseRedactions?.length) { return [] From 174371c1ce1804892ecb18537ee8652aeff1bc56 Mon Sep 17 00:00:00 2001 From: Alex E Date: Tue, 1 Oct 2024 18:56:11 +0500 Subject: [PATCH 02/10] [FIX] tests --- src/providers/http/index.ts | 5 +++++ src/tests/test.http-provider-utils.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/providers/http/index.ts b/src/providers/http/index.ts index ef7d249c..ceae21bd 100644 --- a/src/providers/http/index.ts +++ b/src/providers/http/index.ts @@ -144,6 +144,11 @@ const HTTP_PROVIDER: Provider<'http'> = { return [] } + if(((res.statusCode / 100) >> 0) !== 2) { + logger.error({ response:base64.encode(response), params:rawParams }) + throw new Error(`Provider returned ${res.statusCode} ${res.statusMessage} error`) + } + const newParams = substituteParamValues(rawParams, undefined, true) const params = newParams.newParams diff --git a/src/tests/test.http-provider-utils.ts b/src/tests/test.http-provider-utils.ts index 2539e88e..eb623131 100644 --- a/src/tests/test.http-provider-utils.ts +++ b/src/tests/test.http-provider-utils.ts @@ -121,7 +121,7 @@ describe('HTTP Provider Utils tests', () => { it('should error on incorrect jsonPath', () => { expect(() => { extractJSONValueIndex(('{"asdf": 1}'), '(alert(origin))') - }).toThrow('jsonPath: alert is not defined: (alert(origin))') + }).toThrow('loc.indexOf is not a function') }) it('should not error on incorrect regex', () => { From f16158a861abe13c37be60139e77ae9eb584495f Mon Sep 17 00:00:00 2001 From: Alex E Date: Wed, 2 Oct 2024 10:40:48 +0500 Subject: [PATCH 03/10] [FIX] make koffi optional, update packages --- package-lock.json | 289 +++++++++++++++++++++++----------------------- package.json | 28 ++--- 2 files changed, 161 insertions(+), 156 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e0f7d6e..196105a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "@reclaimprotocol/attestor-core", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@reclaimprotocol/attestor-core", - "version": "3.0.0", + "version": "3.0.1", "license": "See License in ", "dependencies": { - "@bufbuild/protobuf": "^2.0.0", - "@commitlint/cli": "^17.7.1", - "@commitlint/config-conventional": "^17.7.0", + "@bufbuild/protobuf": "^2.1.0", + "@commitlint/cli": "^17.8.1", + "@commitlint/config-conventional": "^17.8.1", "@reclaimprotocol/circom-symmetric-crypto": "git+https://gitlab.reclaimprotocol.org/reclaim/zk-symmetric-crypto", "@reclaimprotocol/tls": "git+https://gitlab.reclaimprotocol.org/reclaim/tls", "ajv": "^8.17.1", @@ -23,41 +23,43 @@ "https-proxy-agent": "^7.0.5", "jsdom": "^24.1.3", "jsonpath-plus": "^9.0.0", - "koffi": "^2.9.0", "p-queue": "^8.0.1", "pino": "^9.4.0", "protobufjs": "^7.4.0", "re2": "^1.21.4", - "serve-static": "^1.15.0", + "serve-static": "^1.16.2", "snarkjs": "^0.7.4", "ws": "^8.18.0" }, "devDependencies": { "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config", "@swc-node/register": "^1.10.9", - "@swc/core": "^1.7.23", + "@swc/core": "^1.7.26", "@swc/jest": "^0.2.36", "@typechain/ethers-v5": "^11.1.2", "@types/chance": "^1.1.6", - "@types/jest": "^29.5.12", + "@types/jest": "^29.5.13", "@types/jsdom": "^21.1.7", - "@types/node": "^20.16.5", + "@types/node": "^20.16.10", "@types/serve-static": "^1.15.7", "@types/ws": "^8.5.12", "chance": "^1.1.12", - "eslint": "^8.57.0", + "eslint": "^8.57.1", "eslint-plugin-no-relative-import-paths": "^1.5.5", "jest": "^29.7.0", "json-schema-to-typescript": "^15.0.2", "ts-loader": "^9.5.1", - "ts-proto": "^2.2.0", + "ts-proto": "^2.2.1", "tsc-alias": "^1.8.10", "tsconfig-paths-webpack-plugin": "^4.1.0", "typechain": "^8.3.2", - "typescript": "^5.5.4", - "webpack": "^5.94.0", + "typescript": "^5.6.2", + "webpack": "^5.95.0", "webpack-cli": "^5.1.4", "yaml": "^2.5.1" + }, + "optionalDependencies": { + "koffi": "^2.9.1" } }, "node_modules/@adiwajshing/eslint-config": { @@ -702,9 +704,9 @@ "dev": true }, "node_modules/@bufbuild/protobuf": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.0.0.tgz", - "integrity": "sha512-sw2JhwJyvyL0zlhG61aDzOVryEfJg2PDZFSV7i7IdC7nAE41WuXCru3QWLGiP87At0BMzKOoKO/FqEGoKygGZQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.1.0.tgz", + "integrity": "sha512-+2Mx67Y3skJ4NCD/qNSdBJNWtu6x6Qr53jeNg+QcwiL6mt0wK+3jwHH2x1p7xaYH6Ve2JKOVn0OxU35WsmqI9A==" }, "node_modules/@commitlint/cli": { "version": "17.8.1", @@ -2611,9 +2613,9 @@ } }, "node_modules/@oxc-resolver/binding-darwin-arm64": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-arm64/-/binding-darwin-arm64-1.11.0.tgz", - "integrity": "sha512-jjhTgaTMhJ5lpE/OiqF5eX7Nhy5gPZBjZNqwmZstbHmqujfVs1MGiTEXHWgKUrcFdLnENWtuoIR3Kmdp3/vuqw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-arm64/-/binding-darwin-arm64-1.12.0.tgz", + "integrity": "sha512-wYe+dlF8npM7cwopOOxbdNjtmJp17e/xF5c0K2WooQXy5VOh74icydM33+Uh/SZDgwyum09/U1FVCX5GdeQk+A==", "cpu": [ "arm64" ], @@ -2624,9 +2626,9 @@ ] }, "node_modules/@oxc-resolver/binding-darwin-x64": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-x64/-/binding-darwin-x64-1.11.0.tgz", - "integrity": "sha512-w/svTRKnuRinojYAVsWRozVoPar7XUPlJhpfnsYlReRjls6A53/ziTzHfpmcKjdBrP/AXPcDVJDnM4pOSsvWvA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-x64/-/binding-darwin-x64-1.12.0.tgz", + "integrity": "sha512-FZxxp99om+SlvBr1cjzF8A3TjYcS0BInCqjUlM+2f9m9bPTR2Bng9Zq5Q09ZQyrKJjfGKqlOEHs3akuVOnrx3Q==", "cpu": [ "x64" ], @@ -2637,9 +2639,9 @@ ] }, "node_modules/@oxc-resolver/binding-freebsd-x64": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-freebsd-x64/-/binding-freebsd-x64-1.11.0.tgz", - "integrity": "sha512-thGp8g8maYUx7vYJqD0vSsuUO95vWNJwKS2AXchq212J5dQ0Dybq4gjt2O2N9iU+lxj1QzmIDXGw7q5HCagOiw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-freebsd-x64/-/binding-freebsd-x64-1.12.0.tgz", + "integrity": "sha512-BZi0iU6IEOnXGSkqt1OjTTkN9wfyaK6kTpQwL/axl8eCcNDc7wbv1vloHgILf7ozAY1TP75nsLYlASYI4B5kGA==", "cpu": [ "x64" ], @@ -2650,9 +2652,9 @@ ] }, "node_modules/@oxc-resolver/binding-linux-arm-gnueabihf": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.11.0.tgz", - "integrity": "sha512-8G99bs4cnwpJRjRK2cEJXiJVyLogzPJq4JgLlcMEKSGhdkoMV1Ia0dghLk9lAFog33U4lWIwKmPgqQzTO6JM8g==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.12.0.tgz", + "integrity": "sha512-L2qnMEnZAqxbG9b1J3di/w/THIm+1fMVfbbTMWIQNMMXdMeqqDN6ojnOLDtuP564rAh4TBFPdLyEfGhMz6ipNA==", "cpu": [ "arm" ], @@ -2663,9 +2665,9 @@ ] }, "node_modules/@oxc-resolver/binding-linux-arm64-gnu": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.11.0.tgz", - "integrity": "sha512-hNcB/wbuCFbsspg4h9+Nz5gSL8PbRW7zG/eVvmEpzGhmVubzDFuNmlYtmaUaZ6b9jzOrrqTkYCt9t7Q2TDHnBA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.12.0.tgz", + "integrity": "sha512-otVbS4zeo3n71zgGLBYRTriDzc0zpruC0WI3ICwjpIk454cLwGV0yzh4jlGYWQJYJk0BRAmXFd3ooKIF+bKBHw==", "cpu": [ "arm64" ], @@ -2676,9 +2678,9 @@ ] }, "node_modules/@oxc-resolver/binding-linux-arm64-musl": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.11.0.tgz", - "integrity": "sha512-H9rjqCcNQT9aip1VLrtsiyj9So0DEKUoutMNu1oL9UuD3H5lWIaxhDlHTAFsobWeUHCnuaCbizhGb9wyLRHSuA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.12.0.tgz", + "integrity": "sha512-IStQDjIT7Lzmqg1i9wXvPL/NsYsxF24WqaQFS8b8rxra+z0VG7saBOsEnOaa4jcEY8MVpLYabFhTV+fSsA2vnA==", "cpu": [ "arm64" ], @@ -2689,9 +2691,9 @@ ] }, "node_modules/@oxc-resolver/binding-linux-x64-gnu": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.11.0.tgz", - "integrity": "sha512-6hdv/kmaGysK3/hUaGTYG07yX+nvk6hGoWombmOuc0vBnGLRtSjqvvgDBdAs9/iIcOSQI2YNUEiJvTyy6eb5GA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.12.0.tgz", + "integrity": "sha512-SipT7EVORz8pOQSFwemOm91TpSiBAGmOjG830/o+aLEsvQ4pEy223+SAnCfITh7+AahldYsJnVoIs519jmIlKQ==", "cpu": [ "x64" ], @@ -2702,9 +2704,9 @@ ] }, "node_modules/@oxc-resolver/binding-linux-x64-musl": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-musl/-/binding-linux-x64-musl-1.11.0.tgz", - "integrity": "sha512-AYUvI4VwQkBq0rcYI3Z7a9+BpllbllbxQCD30ZRgHghvqXvDECWfP8r98iynz7u0oKGO8ZPf15d/l9VrkRtiuQ==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-musl/-/binding-linux-x64-musl-1.12.0.tgz", + "integrity": "sha512-mGh0XfUzKdn+WFaqPacziNraCWL5znkHRfQVxG9avGS9zb2KC/N1EBbPzFqutDwixGDP54r2gx4q54YCJEZ4iQ==", "cpu": [ "x64" ], @@ -2715,9 +2717,9 @@ ] }, "node_modules/@oxc-resolver/binding-wasm32-wasi": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-wasm32-wasi/-/binding-wasm32-wasi-1.11.0.tgz", - "integrity": "sha512-vhXnOs34q8p7QhqQ04bIGy7ZzLEHBaBTsqh2wpAzSBCmjL7MmTpM8KWwXFPFB+Wj0P7/parjGDHzbZG20pEePg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-wasm32-wasi/-/binding-wasm32-wasi-1.12.0.tgz", + "integrity": "sha512-SZN6v7apKmQf/Vwiqb6e/s3Y2Oacw8uW8V2i1AlxtyaEFvnFE0UBn89zq6swEwE3OCajNWs0yPvgAXUMddYc7Q==", "cpu": [ "wasm32" ], @@ -2731,9 +2733,9 @@ } }, "node_modules/@oxc-resolver/binding-win32-arm64-msvc": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.11.0.tgz", - "integrity": "sha512-5XMm8EELDkAVQoMGv4QKqi+SjWnhcU1aq5B9q59iqiXIBNAs72f0d3LAldLrqE2XomP2QweorpsoxuGuIk2Cnw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.12.0.tgz", + "integrity": "sha512-GRe4bqCfFsyghruEn5bv47s9w3EWBdO2q72xCz5kpQ0LWbw+enPHtTjw3qX5PUcFYpKykM55FaO0hFDs1yzatw==", "cpu": [ "arm64" ], @@ -2744,9 +2746,9 @@ ] }, "node_modules/@oxc-resolver/binding-win32-x64-msvc": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.11.0.tgz", - "integrity": "sha512-rVKiZSTgao4SBWyqWvStxDhKmwbKEN/E8+H3CJzIP4FcsL7MQtWH2HT86bmoefkyRe1yO+m2/mG7j3TfADh/Fg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.12.0.tgz", + "integrity": "sha512-Z3llHH0jfJP4mlWq3DT7bK6qV+/vYe0+xzCgfc67+Tc/U3eYndujl880bexeGdGNPh87JeYznpZAOJ44N7QVVQ==", "cpu": [ "x64" ], @@ -2780,9 +2782,9 @@ } }, "node_modules/@peculiar/asn1-ecc": { - "version": "2.3.13", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.3.13.tgz", - "integrity": "sha512-3dF2pQcrN/WJEMq+9qWLQ0gqtn1G81J4rYqFl6El6QV367b4IuhcRv+yMA84tNNyHOJn9anLXV5radnpPiG3iA==", + "version": "2.3.14", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.3.14.tgz", + "integrity": "sha512-zWPyI7QZto6rnLv6zPniTqbGaLh6zBpJyI46r1yS/bVHJXT2amdMHCRRnbV5yst2H8+ppXG6uXu/M6lKakiQ8w==", "dependencies": { "@peculiar/asn1-schema": "^2.3.13", "@peculiar/asn1-x509": "^2.3.13", @@ -2874,20 +2876,20 @@ } }, "node_modules/@peculiar/x509": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.12.1.tgz", - "integrity": "sha512-2T9t2viNP9m20mky50igPTpn2ByhHl5NlT6wW4Tp4BejQaQ5XDNZgfsabYwYysLXhChABlgtTCpp2gM3JBZRKA==", - "dependencies": { - "@peculiar/asn1-cms": "^2.3.8", - "@peculiar/asn1-csr": "^2.3.8", - "@peculiar/asn1-ecc": "^2.3.8", - "@peculiar/asn1-pkcs9": "^2.3.8", - "@peculiar/asn1-rsa": "^2.3.8", - "@peculiar/asn1-schema": "^2.3.8", - "@peculiar/asn1-x509": "^2.3.8", + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.12.3.tgz", + "integrity": "sha512-+Mzq+W7cNEKfkNZzyLl6A6ffqc3r21HGZUezgfKxpZrkORfOqgRXnS80Zu0IV6a9Ue9QBJeKD7kN0iWfc3bhRQ==", + "dependencies": { + "@peculiar/asn1-cms": "^2.3.13", + "@peculiar/asn1-csr": "^2.3.13", + "@peculiar/asn1-ecc": "^2.3.14", + "@peculiar/asn1-pkcs9": "^2.3.13", + "@peculiar/asn1-rsa": "^2.3.13", + "@peculiar/asn1-schema": "^2.3.13", + "@peculiar/asn1-x509": "^2.3.13", "pvtsutils": "^1.3.5", "reflect-metadata": "^0.2.2", - "tslib": "^2.6.2", + "tslib": "^2.7.0", "tsyringe": "^4.8.0" } }, @@ -2955,8 +2957,8 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@reclaimprotocol/circom-symmetric-crypto": { - "version": "1.1.2", - "resolved": "git+https://gitlab.reclaimprotocol.org/reclaim/zk-symmetric-crypto#71f815d17d7d0d108332f67cc146ab0a2df4b8ee", + "version": "1.1.3", + "resolved": "git+https://gitlab.reclaimprotocol.org/reclaim/zk-symmetric-crypto#4f996ddc91eb14901a622e0d92c708fc8b3458e4", "peerDependencies": { "js-base64": "^3.7.7", "koffi": "*", @@ -2978,9 +2980,9 @@ "version": "0.0.2", "resolved": "git+https://gitlab.reclaimprotocol.org/reclaim/tls#b062ab54340a0ba0e6c65ecc06799a87ba4f6515", "dependencies": { - "@peculiar/asn1-ecc": "^2.3.13", + "@peculiar/asn1-ecc": "^2.3.14", "@peculiar/asn1-schema": "^2.3.13", - "@peculiar/x509": "^1.12.1", + "@peculiar/x509": "^1.12.2", "@stablelib/chacha20poly1305": "^1.0.1" } }, @@ -3432,9 +3434,9 @@ "dev": true }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, "node_modules/@types/graceful-fs": { @@ -3504,9 +3506,9 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.17.7", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", - "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==", + "version": "4.17.9", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.9.tgz", + "integrity": "sha512-w9iWudx1XWOHW5lQRS9iKpK/XuRhnN+0T7HvdCCd802FYkT1AMTnxndJHGrNJwRoRHkslGr4S29tjm1cT7x/7w==", "dev": true }, "node_modules/@types/mime": { @@ -3521,9 +3523,9 @@ "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==" }, "node_modules/@types/node": { - "version": "20.16.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz", - "integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==", + "version": "20.16.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz", + "integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==", "dependencies": { "undici-types": "~6.19.2" } @@ -4411,9 +4413,9 @@ } }, "node_modules/b4a": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", - "integrity": "sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==" + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", + "integrity": "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==" }, "node_modules/babel-jest": { "version": "29.7.0", @@ -4667,9 +4669,9 @@ "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" }, "node_modules/browserslist": { - "version": "4.23.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", - "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", + "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", "dev": true, "funding": [ { @@ -4686,8 +4688,8 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001646", - "electron-to-chromium": "^1.5.4", + "caniuse-lite": "^1.0.30001663", + "electron-to-chromium": "^1.5.28", "node-releases": "^2.0.18", "update-browserslist-db": "^1.1.0" }, @@ -4840,9 +4842,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001660", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", - "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==", + "version": "1.0.30001666", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001666.tgz", + "integrity": "sha512-gD14ICmoV5ZZM1OdzPWmpx+q4GyefaK06zi8hmfHV5xe4/2nOQX3+Dw5o+fSqOws2xVwL9j+anOPFwHzdEdV4g==", "dev": true, "funding": [ { @@ -5836,9 +5838,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.24", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.24.tgz", - "integrity": "sha512-0x0wLCmpdKFCi9ulhvYZebgcPmHTkFVUfU2wzDykadkslKwT4oAmDTHEKLnlrDsMGZe4B+ksn8quZfZjYsBetA==", + "version": "1.5.31", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.31.tgz", + "integrity": "sha512-QcDoBbQeYt0+3CWcK/rEbuHvwpbT/8SV9T3OSgs6cX1FlcUAkgrkqbg9zLnDrMM/rLamzQwal4LYFCiWk861Tg==", "dev": true }, "node_modules/elliptic": { @@ -6319,9 +6321,9 @@ "dev": true }, "node_modules/eslint-plugin-react": { - "version": "7.36.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.36.1.tgz", - "integrity": "sha512-/qwbqNXZoq+VP30s1d4Nc1C5GTxjJQjk4Jzs4Wq2qzxFM7dSmuG2UkIjg2USMLh3A/aVcUNrK7v0J5U1XEGGwA==", + "version": "7.37.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.1.tgz", + "integrity": "sha512-xwTnwDqzbDRA8uJ7BMxPs/EXRB3i8ZfnOIp8BsxEQkT0nHPp+WWceqGgo6rKb9ctNi8GJLDT4Go5HAWELa/WMg==", "dev": true, "dependencies": { "array-includes": "^3.1.8", @@ -6485,9 +6487,9 @@ } }, "node_modules/eslint-plugin-unicorn/node_modules/eslint-visitor-keys": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", - "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", + "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -6497,14 +6499,14 @@ } }, "node_modules/eslint-plugin-unicorn/node_modules/espree": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", - "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz", + "integrity": "sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==", "dev": true, "dependencies": { "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.0.0" + "eslint-visitor-keys": "^4.1.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -6903,9 +6905,9 @@ } }, "node_modules/fast-uri": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", - "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.2.tgz", + "integrity": "sha512-GR6f0hD7XXyNJa25Tb9BuIdN0tdr+0BMi6/CJPH3wJO1JjNG3n/VsSw38AwRdKZABm8lGbPfakLRkYzx2V9row==" }, "node_modules/fastest-levenshtein": { "version": "1.0.16", @@ -9363,10 +9365,11 @@ } }, "node_modules/koffi": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/koffi/-/koffi-2.9.0.tgz", - "integrity": "sha512-KCsuJ2gM58n6bNdR2Z7gqsh/3TchxxQFbVgax2/UvAjRTgwNSYAJDx9E3jrkBP4jEDHWRCfE47Y2OG+/fiSvEw==", - "hasInstallScript": true + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/koffi/-/koffi-2.9.1.tgz", + "integrity": "sha512-LXYOzaiUB8XK7EwbG0tgzhajEr3FLS2RB9oHYbTOiWRQQO+Rgft3xSvd5TFlM3wQ6DMMQG41lvUR5gLgdyWIsA==", + "hasInstallScript": true, + "optional": true }, "node_modules/leven": { "version": "3.1.0", @@ -10077,9 +10080,9 @@ } }, "node_modules/nwsapi": { - "version": "2.2.12", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.12.tgz", - "integrity": "sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w==" + "version": "2.2.13", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.13.tgz", + "integrity": "sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ==" }, "node_modules/object-assign": { "version": "4.1.1", @@ -10261,25 +10264,25 @@ } }, "node_modules/oxc-resolver": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/oxc-resolver/-/oxc-resolver-1.11.0.tgz", - "integrity": "sha512-N3qMse2AM7uST8PaiUMXZkcACyGAMN073tomyvzHTICSzaOqKHvVS0IZ3vj/OqoE140QP4CyOiWmgC1Hw5Urmg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/oxc-resolver/-/oxc-resolver-1.12.0.tgz", + "integrity": "sha512-YlaCIArvWNKCWZFRrMjhh2l5jK80eXnpYP+bhRc1J/7cW3TiyEY0ngJo73o/5n8hA3+4yLdTmXLNTQ3Ncz50LQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/Boshen" }, "optionalDependencies": { - "@oxc-resolver/binding-darwin-arm64": "1.11.0", - "@oxc-resolver/binding-darwin-x64": "1.11.0", - "@oxc-resolver/binding-freebsd-x64": "1.11.0", - "@oxc-resolver/binding-linux-arm-gnueabihf": "1.11.0", - "@oxc-resolver/binding-linux-arm64-gnu": "1.11.0", - "@oxc-resolver/binding-linux-arm64-musl": "1.11.0", - "@oxc-resolver/binding-linux-x64-gnu": "1.11.0", - "@oxc-resolver/binding-linux-x64-musl": "1.11.0", - "@oxc-resolver/binding-wasm32-wasi": "1.11.0", - "@oxc-resolver/binding-win32-arm64-msvc": "1.11.0", - "@oxc-resolver/binding-win32-x64-msvc": "1.11.0" + "@oxc-resolver/binding-darwin-arm64": "1.12.0", + "@oxc-resolver/binding-darwin-x64": "1.12.0", + "@oxc-resolver/binding-freebsd-x64": "1.12.0", + "@oxc-resolver/binding-linux-arm-gnueabihf": "1.12.0", + "@oxc-resolver/binding-linux-arm64-gnu": "1.12.0", + "@oxc-resolver/binding-linux-arm64-musl": "1.12.0", + "@oxc-resolver/binding-linux-x64-gnu": "1.12.0", + "@oxc-resolver/binding-linux-x64-musl": "1.12.0", + "@oxc-resolver/binding-wasm32-wasi": "1.12.0", + "@oxc-resolver/binding-win32-arm64-msvc": "1.12.0", + "@oxc-resolver/binding-win32-x64-msvc": "1.12.0" } }, "node_modules/p-limit": { @@ -10359,9 +10362,9 @@ } }, "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==" }, "node_modules/parent-module": { "version": "1.0.1", @@ -12259,9 +12262,9 @@ } }, "node_modules/terser": { - "version": "5.32.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.32.0.tgz", - "integrity": "sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ==", + "version": "5.34.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.34.1.tgz", + "integrity": "sha512-FsJZ7iZLd/BXkz+4xrRTGJ26o/6VTjQytUk8b8OxkwcD2I+79VPJlz7qss1+zE7h8GNIScFqXcDyJ/KqBYZFVA==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -12614,9 +12617,9 @@ } }, "node_modules/ts-proto": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.2.0.tgz", - "integrity": "sha512-xzmnyrarUjPnY+Py4RyTh3lYmL9w5t/oTtRTo2rKF8laAAahpGZ/ELxkXFEZns5JVbgkYke3C17HN5iNvZOs4g==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.2.1.tgz", + "integrity": "sha512-EiPj34febZLbLdEyo//J20ix44kFFRZJYGuEx43cOBZ0pLSGiBKLwy2ORfkeJTlhHFqZKPoaWdiRyI4pYqdR4Q==", "dev": true, "dependencies": { "@bufbuild/protobuf": "^2.0.0", @@ -13023,9 +13026,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", - "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", "dev": true, "funding": [ { @@ -13042,8 +13045,8 @@ } ], "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" + "escalade": "^3.2.0", + "picocolors": "^1.1.0" }, "bin": { "update-browserslist-db": "cli.js" @@ -13163,9 +13166,9 @@ } }, "node_modules/webpack": { - "version": "5.94.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", - "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", + "version": "5.95.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.95.0.tgz", + "integrity": "sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q==", "dev": true, "dependencies": { "@types/estree": "^1.0.5", diff --git a/package.json b/package.json index 20634c37..e62080b1 100644 --- a/package.json +++ b/package.json @@ -58,9 +58,9 @@ "author": "Adhiraj Singh", "license": "See License in ", "dependencies": { - "@bufbuild/protobuf": "^2.0.0", - "@commitlint/cli": "^17.7.1", - "@commitlint/config-conventional": "^17.7.0", + "@bufbuild/protobuf": "^2.1.0", + "@commitlint/cli": "^17.8.1", + "@commitlint/config-conventional": "^17.8.1", "@reclaimprotocol/circom-symmetric-crypto": "git+https://gitlab.reclaimprotocol.org/reclaim/zk-symmetric-crypto", "@reclaimprotocol/tls": "git+https://gitlab.reclaimprotocol.org/reclaim/tls", "ajv": "^8.17.1", @@ -72,39 +72,38 @@ "https-proxy-agent": "^7.0.5", "jsdom": "^24.1.3", "jsonpath-plus": "^9.0.0", - "koffi": "^2.9.0", "p-queue": "^8.0.1", "pino": "^9.4.0", "protobufjs": "^7.4.0", "re2": "^1.21.4", - "serve-static": "^1.15.0", + "serve-static": "^1.16.2", "snarkjs": "^0.7.4", "ws": "^8.18.0" }, "devDependencies": { "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config", "@swc-node/register": "^1.10.9", - "@swc/core": "^1.7.23", + "@swc/core": "^1.7.26", "@swc/jest": "^0.2.36", "@typechain/ethers-v5": "^11.1.2", "@types/chance": "^1.1.6", - "@types/jest": "^29.5.12", + "@types/jest": "^29.5.13", "@types/jsdom": "^21.1.7", - "@types/node": "^20.16.5", + "@types/node": "^20.16.10", "@types/serve-static": "^1.15.7", "@types/ws": "^8.5.12", "chance": "^1.1.12", - "eslint": "^8.57.0", + "eslint": "^8.57.1", "eslint-plugin-no-relative-import-paths": "^1.5.5", "jest": "^29.7.0", "json-schema-to-typescript": "^15.0.2", "ts-loader": "^9.5.1", - "ts-proto": "^2.2.0", + "ts-proto": "^2.2.1", "tsc-alias": "^1.8.10", "tsconfig-paths-webpack-plugin": "^4.1.0", "typechain": "^8.3.2", - "typescript": "^5.5.4", - "webpack": "^5.94.0", + "typescript": "^5.6.2", + "webpack": "^5.95.0", "webpack-cli": "^5.1.4", "yaml": "^2.5.1" }, @@ -113,5 +112,8 @@ "ws": "^7.5.10" }, "elliptic": "^v6.5.7" + }, + "optionalDependencies": { + "koffi": "^2.9.1" } -} \ No newline at end of file +} From 35d57eb578bde21b5c093d70d363f3b7a9a0b6a1 Mon Sep 17 00:00:00 2001 From: Abdul Rashid Date: Fri, 4 Oct 2024 15:20:16 +0530 Subject: [PATCH 04/10] chore: fix docs link --- docs/readme.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/readme.md b/docs/readme.md index add04265..fc30b605 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -25,10 +25,10 @@ Note for devs: the "prepare" script which is run after `npm install` is configur ## Getting Started We'd recommend you go through our documentation in the following order: -1. [Problem Statement](docs/problem-statement.md): Understand the problem we're solving & whether this is the right solution for you. -2. [Getting Started](docs/getting-started.md): Understand how to get started with the attestor SDK & create your first claim. -3. [Browser RPC/React Native](docs/browser-rpc.md): How to setup the attestor client SDK for environments like React Native or any other mobile app. -4. [Provider](docs/provider.md): What is a provider in the Reclaim context, how to create one & details on the HTTP provider. -5. [Internals of Claim Creation](docs/claim-creation.md): In-depth description of the full flow of creating a claim with a attestor. -6. [Working with the Codebase](docs/project.md): Understand how to work with the codebase & how to deploy an attestor server. -6. [AVS](docs/avs.md): Understand how we use an Eigen AVS to decentralize the attestor server. \ No newline at end of file +1. [Problem Statement](./problem-statement.md): Understand the problem we're solving & whether this is the right solution for you. +2. [Getting Started](./getting-started.md): Understand how to get started with the attestor SDK & create your first claim. +3. [Browser RPC/React Native](./browser-rpc.md): How to setup the attestor client SDK for environments like React Native or any other mobile app. +4. [Provider](./provider.md): What is a provider in the Reclaim context, how to create one & details on the HTTP provider. +5. [Internals of Claim Creation](./claim-creation.md): In-depth description of the full flow of creating a claim with a attestor. +6. [Working with the Codebase](./project.md): Understand how to work with the codebase & how to deploy an attestor server. +6. [AVS](./avs.md): Understand how we use an Eigen AVS to decentralize the attestor server. \ No newline at end of file From 56d9338b47cc63ffafdc85d565c686739089e829 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sat, 5 Oct 2024 11:31:54 +0530 Subject: [PATCH 05/10] feat: whitelist operator script --- package.json | 1 + src/scripts/generate-receipt.ts | 10 +--------- src/scripts/utils.ts | 8 ++++++++ src/scripts/whitelist-operator.ts | 22 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/scripts/utils.ts create mode 100644 src/scripts/whitelist-operator.ts diff --git a/package.json b/package.json index 73d34c18..1b5bb168 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "deploy:contracts-to-chain": "sh avs/utils/anvil/deploy-to-chain.sh", "register:avs-operator": "npm run run:tsc -- src/scripts/register-avs-operator.ts", "check:avs-registration": "npm run run:tsc -- src/scripts/check-avs-registration.ts", + "whitelist:operator": "npm run run:tsc -- src/scripts/whitelist-operator.ts", "generate:avs": "typechain -- --target ethers-v5 --out-dir src/avs/contracts avs/contracts/out/ReclaimServiceManager.sol/*.json", "start:chain": "bash ./avs/utils/anvil/start-anvil-chain-with-el-and-avs-deployed.sh", "commitlint": "commitlint --edit" diff --git a/src/scripts/generate-receipt.ts b/src/scripts/generate-receipt.ts index 1144b6f6..c604c4d7 100644 --- a/src/scripts/generate-receipt.ts +++ b/src/scripts/generate-receipt.ts @@ -1,4 +1,5 @@ import { readFile } from 'fs/promises' +import { getCliArgument } from 'src/scripts/utils' import { createServer, decryptTranscript } from 'src/server' import { assertValidateProviderParams } from 'src/utils' import { getEnvVariable } from 'src/utils/env' @@ -115,15 +116,6 @@ async function getInputParameters(): Promise { diff --git a/src/scripts/utils.ts b/src/scripts/utils.ts new file mode 100644 index 00000000..d7d020fc --- /dev/null +++ b/src/scripts/utils.ts @@ -0,0 +1,8 @@ +export function getCliArgument(arg: string) { + const index = process.argv.indexOf(`--${arg}`) + if(index === -1) { + return undefined + } + + return process.argv[index + 1] +} \ No newline at end of file diff --git a/src/scripts/whitelist-operator.ts b/src/scripts/whitelist-operator.ts new file mode 100644 index 00000000..11b098d6 --- /dev/null +++ b/src/scripts/whitelist-operator.ts @@ -0,0 +1,22 @@ +// eslint-disable-next-line simple-import-sort/imports +import 'src/server/utils/config-env' +import { getContracts } from 'src/avs/utils/contracts' +import { getCliArgument } from 'src/scripts/utils' + +async function main() { + const { contract } = getContracts() + + const address = getCliArgument('address') + if(!address) { + throw new Error( + 'Provide operator address via --address ' + ) + } + + const tx = await contract.whitelistAddressAsOperator(address, true) + await tx.wait() + + console.log('Whitelisted address:', address) +} + +main() \ No newline at end of file From 6e0109f46df6677b4ee9ddb7dadf61540f22d574 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sat, 5 Oct 2024 11:49:12 +0530 Subject: [PATCH 06/10] fix: avs registration utils --- src/avs/utils/register.ts | 11 +++++++++-- src/scripts/check-avs-registration.ts | 4 +++- src/scripts/register-avs-operator.ts | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/avs/utils/register.ts b/src/avs/utils/register.ts index a3cc6620..9c8f36af 100644 --- a/src/avs/utils/register.ts +++ b/src/avs/utils/register.ts @@ -102,10 +102,17 @@ export async function registerOperator({ } const existingMetadata = await contract.getMetadataForOperator(addr) + .catch(err => { + if(err.message.includes('Operator not found')) { + return undefined + } + + throw err + }) const metadata = { addr, url: reclaimRpcUrl } if( - existingMetadata.addr === metadata.addr - && existingMetadata.url === metadata.url + existingMetadata?.addr === metadata.addr + && existingMetadata?.url === metadata.url ) { logger.info('operator metadata already up to date') return diff --git a/src/scripts/check-avs-registration.ts b/src/scripts/check-avs-registration.ts index 3e37fd25..0ea40498 100644 --- a/src/scripts/check-avs-registration.ts +++ b/src/scripts/check-avs-registration.ts @@ -1,5 +1,7 @@ -import { getContracts } from 'src/avs/utils/contracts' +// eslint-disable-next-line simple-import-sort/imports import 'src/server/utils/config-env' +import { getContracts } from 'src/avs/utils/contracts' + async function main() { const { wallet, contract } = getContracts() diff --git a/src/scripts/register-avs-operator.ts b/src/scripts/register-avs-operator.ts index 5a0592ea..3bfb1996 100644 --- a/src/scripts/register-avs-operator.ts +++ b/src/scripts/register-avs-operator.ts @@ -1,4 +1,5 @@ -import { registerOperator } from 'src/avs/utils/register' +// eslint-disable-next-line simple-import-sort/imports import 'src/server/utils/config-env' +import { registerOperator } from 'src/avs/utils/register' registerOperator() \ No newline at end of file From 9968f5d55921350f9ba0d2432deb4c419707271d Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sat, 5 Oct 2024 11:51:32 +0530 Subject: [PATCH 07/10] chore: remove gitlab CI --- .gitlab-ci.yml | 57 -------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 579f9224..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,57 +0,0 @@ -stages: - - test - - deploy -test: - stage: test - # install latest version, min v22.0.0 - # since we need node native WebSockets for - # tests to work - image: node:current - before_script: - - git config --global url."https://git-push-pull:$GL_TOKEN@gitlab.reclaimprotocol.org".insteadOf "https://gitlab.reclaimprotocol.org" - - npm install - script: - - npm run test - only: - # only deploy if not a docs commit - # or a wip commit - variables: - - $CI_COMMIT_MESSAGE !~ /^wip/ && $CI_COMMIT_MESSAGE !~ /^docs/ - refs: - - main -deploy: - stage: deploy - environment: production - before_script: - - echo $0 - - apt-get update -y - - apt-get install zip -y - - apt-get install awscli -y - only: - # only deploy if not a docs commit - # or a wip commit - variables: - - $CI_COMMIT_MESSAGE !~ /^wip/ && $CI_COMMIT_MESSAGE !~ /^docs/ - refs: - - main - script: - # copy prod env files in - - echo -e "$ENV" > .env.production - # copy in GL token into docker-compose - - sed -i 's/${GL_TOKEN}/'$GL_TOKEN'/g' docker-compose.yaml - - export FILE=pkg-$(date +%s%N).zip - - echo $FILE - - zip -r $FILE * .* -x '*.git*' - # authenticate w AWS - - mkdir ~/.aws/ - - touch ~/.aws/credentials - - printf "[default]\naws_access_key_id = %s\naws_secret_access_key = %s\n" "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" >> ~/.aws/credentials - - touch ~/.aws/config - # deploy to AWS - - export BUCKET=elasticbeanstalk-ap-south-1-342772716647 - - export APP_NAME=reclaim-protocol - - export ENV_NAME=witness - - export VERSION=$CI_COMMIT_SHORT_SHA - - aws s3 cp $FILE s3://$BUCKET/$FILE - - aws elasticbeanstalk create-application-version --application-name $APP_NAME --version-label $VERSION --source-bundle S3Bucket="$BUCKET",S3Key="$FILE" - - aws elasticbeanstalk update-environment --application-name $APP_NAME --environment-name $ENV_NAME --version-label $VERSION \ No newline at end of file From f500fba03911c6397d695718f2cb169064fed5a2 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Thu, 17 Oct 2024 16:02:22 +0530 Subject: [PATCH 08/10] docs: streamline readme --- .gitignore | 3 ++- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++------ docs/readme.md | 34 ------------------------------- 3 files changed, 50 insertions(+), 41 deletions(-) delete mode 100644 docs/readme.md diff --git a/.gitignore b/.gitignore index 1382bf5e..f1ccef12 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ example-local coverage/ ngrok.yml src/test.ts -.env.* \ No newline at end of file +.env.* +.cache \ No newline at end of file diff --git a/README.md b/README.md index 24922bc4..f1e0fd91 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,64 @@ # Reclaim Attestor Core +
+## What is the Reclaim Protocol? -## Getting Started +Reclaim enables you to bring user activity, reputation, and identity from external websites into your own platform. + +For example, +- Import the number of rides the user has taken on Uber to build a competing ride sharing platform +- Import the users purchasing preferences using Amazon to provide discounts to the right users +- Enable economics on a blockchain using users offchain activity data +- Use national IDs to perform KYC + +And many more... + +### Now what is this repository? + +The `attestor-core` package is the core implementation of the Reclaim protocol. + +TLDR: An "attestor" is a server that sits between the reclaim user & the internet. The client sends data to the internet via the attestor. All this data is exchanged securely via the TLS protocol. + +We leverage some special properties of the TLS protocol along with zero-knowledge proofs to reveal only the necessary information to the attestor. +The attestor then signs this data & sends it back to the client. The client can then use this signed data to prove the claim to anyone. -To get started with Reclaim, check out our comprehensive documentation, [Reclaim Documentation](https://docs.reclaimprotocol.org/). +This package contains both the client & server side code for the Reclaim protocol. -For an intro to this package & how it works, check out our [Getting Started Guide](/docs/readme.md). +Read a longer brief [here](docs/problem-statement.md). -## Try It Out Yourself +This repository contains **Typescript** implementation of the attestor server & the SDK to interact with it. The SDK is compatible with the browser & NodeJS. However, to run the SDK on React Native/Mobile, refer to our [React Native guide](docs/browser-rpc.md). -Ready to dive in? Follow our installation guide to set up Reclaim. +Note: if you're looking to build apps on Reclaim, we'd recommend you to use the [Reclaim SDK](https://docs.reclaimprotocol.org/) instead. This repository is intended for developers looking to contribute to the core protocol. + +## Install + +From GitHub: +`npm install git+https://github.com/reclaimprotocol/attestor-core` + +From NPM: +`npm install @reclaimprotocol/attestor-core` + +Note: installation can take a couple minutes, so grab a coffee while you wait. + +**Note:** this approach is only advised for NodeJS projects or projects meant to run directly in a modern browser. For React Native or any solution running in a mobile app, refer to our doc [here](docs/browser-rpc.md). + +Note for devs: the "prepare" script which is run after `npm install` is configured to only build when there are files in the `src` directory. This is to prevent errors when building the Docker image. + +## Getting Started -[Install Reclaim](https://docs.reclaimprotocol.org/install) +We'd recommend you go through our documentation in the following order: +1. [Problem Statement](./problem-statement.md): Understand the problem we're solving & whether this is the right solution for you. +2. [Getting Started](./getting-started.md): Understand how to get started with the attestor SDK & create your first claim. +3. [Browser RPC/React Native](./browser-rpc.md): How to setup the attestor client SDK for environments like React Native or any other mobile app. +4. [Provider](./provider.md): What is a provider in the Reclaim context, how to create one & details on the HTTP provider. +5. [Internals of Claim Creation](./claim-creation.md): In-depth description of the full flow of creating a claim with a attestor. +6. [Working with the Codebase](./project.md): Understand how to work with the codebase & how to deploy an attestor server. +7. [AVS](./avs.md): Understand how we use an Eigen AVS to decentralize the attestor server. ## Contributing to Our Project diff --git a/docs/readme.md b/docs/readme.md deleted file mode 100644 index fc30b605..00000000 --- a/docs/readme.md +++ /dev/null @@ -1,34 +0,0 @@ -# Reclaim Attestor - -Prove arbritrary claims about the internet with the Reclaim protocol. - -TLDR: The attestor is a server that sits between the reclaim user & the internet. The client sends data to the internet via the attestor. All this data is exchanged securely via the TLS protocol. -We leverage some special properties of the TLS protocol along with zero-knowledge proofs to reveal only the necessary information to the attestor. -The attestor then signs this data & sends it back to the client. The client can then use this signed data to prove the claim to anyone. - -Read a longer brief [here](docs/problem-statement.md). - -This repository contains **Typescript** implementation of the attestor server & the SDK to interact with it. The SDK is compatible with the browser & NodeJS. However, to run the SDK on React Native/Mobile, refer to our [React Native guide](docs/browser-rpc.md). - -## Install - -`npm install git+https://gitlab.reclaimprotocol.org/protocol/attestor-core` - -or - -`npm install git+https://github.com/reclaimprotocol/attestor-core` - -**Note:** this approach is only advised for NodeJS projects or projects meant to run directly in a modern browser. For React Native or any solution running in a mobile app, refer to our doc [here](docs/browser-rpc.md). - -Note for devs: the "prepare" script which is run after `npm install` is configured to only build when there are files in the `src` directory. This is to prevent errors when building the Docker image. - -## Getting Started - -We'd recommend you go through our documentation in the following order: -1. [Problem Statement](./problem-statement.md): Understand the problem we're solving & whether this is the right solution for you. -2. [Getting Started](./getting-started.md): Understand how to get started with the attestor SDK & create your first claim. -3. [Browser RPC/React Native](./browser-rpc.md): How to setup the attestor client SDK for environments like React Native or any other mobile app. -4. [Provider](./provider.md): What is a provider in the Reclaim context, how to create one & details on the HTTP provider. -5. [Internals of Claim Creation](./claim-creation.md): In-depth description of the full flow of creating a claim with a attestor. -6. [Working with the Codebase](./project.md): Understand how to work with the codebase & how to deploy an attestor server. -6. [AVS](./avs.md): Understand how we use an Eigen AVS to decentralize the attestor server. \ No newline at end of file From 5c324f871b6577f1558aff97c1e000df98c8db0f Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Thu, 17 Oct 2024 16:05:36 +0530 Subject: [PATCH 09/10] docs: separate out server doc --- README.md | 21 +++++++++++---------- docs/project.md | 21 +-------------------- docs/run-server.md | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 docs/run-server.md diff --git a/README.md b/README.md index f1e0fd91..275b4324 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ The attestor then signs this data & sends it back to the client. The client can This package contains both the client & server side code for the Reclaim protocol. -Read a longer brief [here](docs/problem-statement.md). +Read a longer brief [here](/docs/problem-statement.md). -This repository contains **Typescript** implementation of the attestor server & the SDK to interact with it. The SDK is compatible with the browser & NodeJS. However, to run the SDK on React Native/Mobile, refer to our [React Native guide](docs/browser-rpc.md). +This repository contains **Typescript** implementation of the attestor server & the SDK to interact with it. The SDK is compatible with the browser & NodeJS. However, to run the SDK on React Native/Mobile, refer to our [React Native guide](/docs/browser-rpc.md). Note: if you're looking to build apps on Reclaim, we'd recommend you to use the [Reclaim SDK](https://docs.reclaimprotocol.org/) instead. This repository is intended for developers looking to contribute to the core protocol. @@ -45,20 +45,21 @@ From NPM: Note: installation can take a couple minutes, so grab a coffee while you wait. -**Note:** this approach is only advised for NodeJS projects or projects meant to run directly in a modern browser. For React Native or any solution running in a mobile app, refer to our doc [here](docs/browser-rpc.md). +**Note:** this approach is only advised for NodeJS projects or projects meant to run directly in a modern browser. For React Native or any solution running in a mobile app, refer to our doc [here](/docs/browser-rpc.md). Note for devs: the "prepare" script which is run after `npm install` is configured to only build when there are files in the `src` directory. This is to prevent errors when building the Docker image. ## Getting Started We'd recommend you go through our documentation in the following order: -1. [Problem Statement](./problem-statement.md): Understand the problem we're solving & whether this is the right solution for you. -2. [Getting Started](./getting-started.md): Understand how to get started with the attestor SDK & create your first claim. -3. [Browser RPC/React Native](./browser-rpc.md): How to setup the attestor client SDK for environments like React Native or any other mobile app. -4. [Provider](./provider.md): What is a provider in the Reclaim context, how to create one & details on the HTTP provider. -5. [Internals of Claim Creation](./claim-creation.md): In-depth description of the full flow of creating a claim with a attestor. -6. [Working with the Codebase](./project.md): Understand how to work with the codebase & how to deploy an attestor server. -7. [AVS](./avs.md): Understand how we use an Eigen AVS to decentralize the attestor server. +1. [Problem Statement](/docs/problem-statement.md): Understand the problem we're solving & whether this is the right solution for you. +2. [Getting Started](/docs/getting-started.md): Understand how to get started with the attestor SDK & create your first claim. +3. [Browser RPC/React Native](/docs/browser-rpc.md): How to setup the attestor client SDK for environments like React Native or any other mobile app. +4. [Provider](/docs/provider.md): What is a provider in the Reclaim context, how to create one & details on the HTTP provider. +5. [Internals of Claim Creation](/docs/claim-creation.md): In-depth description of the full flow of creating a claim with a attestor. +6. [Working with the Codebase](/docs/project.md): Understand how to work with the codebase & how to deploy an attestor server. +7. [Run your own Attestor Server](/docs/run-server.md): Understand how to run your own attestor server locally or deploy it to the cloud. +8. [AVS](/docs/avs.md): Understand how we use an Eigen AVS to decentralize the attestor server. ## Contributing to Our Project diff --git a/docs/project.md b/docs/project.md index 68201e22..bdd2d0ed 100644 --- a/docs/project.md +++ b/docs/project.md @@ -10,23 +10,4 @@ - `window-rpc`: Contains code to setup a listener on the browser for a mobile app to interact with the SDK. More on this in the [docs](docs/browser-rpc.md). Entirely client-side code. - `...`: Other common code & utils used by both the client & server. - `avs`: Smart contracts & respective code, utils for the Eigen AVS. -- `proto`: Protobuf spec for client-server communication. - - -## Running a Attestor Locally - -1. Of course, clone this repository. -2. Ensure you have an env file with at least the `PRIVATE_KEY` set. See the [.env.sample](.env.sample) file to see all available options. -3. Optional: build the browser RPC files with `npm run build:browser`. More on this in the [docs](docs/browser-rpc.md). -4. Run the attestor server with `npm run start:tsc`. This will start the server on port 8001 by default. - -## Deploying to the Cloud - -You can deploy your own Reclaim server via the [docker-compose](/docker-compose.yaml). The Reclaim server is a stateless machine so you can scale it horizontally as much as you want. - -With the docker compose up: -- Expose the Reclaim HTTP server behind a reverse proxy (like nginx) to the internet. -- Add HTTPS to the reverse proxy to ensure secure communication. -- Since Reclaim uses a websocket, ensure that the reverse proxy is configured to handle websockets. - -Your final RPC URL should look something like `wss:///ws`. To use your server on a mobile device via browser RPC, you can load the page at: `https:///browser-rpc`. \ No newline at end of file +- `proto`: Protobuf spec for client-server communication. \ No newline at end of file diff --git a/docs/run-server.md b/docs/run-server.md new file mode 100644 index 00000000..473c8240 --- /dev/null +++ b/docs/run-server.md @@ -0,0 +1,19 @@ +# Run your own Attestor + +## Running a Attestor Locally + +1. Of course, clone this repository. +2. Ensure you have an env file with at least the `PRIVATE_KEY` set. See the [.env.sample](.env.sample) file to see all available options. +3. Optional: build the browser RPC files with `npm run build:browser`. More on this in the [docs](docs/browser-rpc.md). +4. Run the attestor server with `npm run start:tsc`. This will start the server on port 8001 by default. + +## Deploying to the Cloud + +You can deploy your own Reclaim server via the [docker-compose](/docker-compose.yaml). The Reclaim server is a stateless machine so you can scale it horizontally as much as you want. + +With the docker compose up: +- Expose the Reclaim HTTP server behind a reverse proxy (like nginx) to the internet. +- Add HTTPS to the reverse proxy to ensure secure communication. +- Since Reclaim uses a websocket, ensure that the reverse proxy is configured to handle websockets. + +Your final RPC URL should look something like `wss:///ws`. To use your server on a mobile device via browser RPC, you can load the page at: `https:///browser-rpc`. \ No newline at end of file From 900b842b685e68a38d2383093f4f84a192fe3690 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Thu, 17 Oct 2024 18:34:00 +0530 Subject: [PATCH 10/10] chore: update templates Signed-off-by: Adithya Krishna --- .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/bug_report.md | 0 .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/ci.md | 0 .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/documentation.md | 0 .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/feature-request.md | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/bug_report.md (100%) rename .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/ci.md (100%) rename .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/documentation.md (100%) rename .github/{ISSUE_TEMPLATES => ISSUE_TEMPLATE}/feature-request.md (100%) diff --git a/.github/ISSUE_TEMPLATES/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUE_TEMPLATES/bug_report.md rename to .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATES/ci.md b/.github/ISSUE_TEMPLATE/ci.md similarity index 100% rename from .github/ISSUE_TEMPLATES/ci.md rename to .github/ISSUE_TEMPLATE/ci.md diff --git a/.github/ISSUE_TEMPLATES/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md similarity index 100% rename from .github/ISSUE_TEMPLATES/documentation.md rename to .github/ISSUE_TEMPLATE/documentation.md diff --git a/.github/ISSUE_TEMPLATES/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md similarity index 100% rename from .github/ISSUE_TEMPLATES/feature-request.md rename to .github/ISSUE_TEMPLATE/feature-request.md