From a6042e76b402de2d3ad707eef31589a578d1da52 Mon Sep 17 00:00:00 2001 From: isaac Date: Tue, 10 Jan 2023 18:37:10 +0000 Subject: [PATCH 1/3] Remove EM gating for verify user --- identity-service/package-lock.json | 161 ++++++++++++++--------- identity-service/package.json | 2 +- identity-service/src/routes/instagram.js | 4 +- identity-service/src/routes/tiktok.js | 4 +- identity-service/src/routes/twitter.js | 4 +- 5 files changed, 101 insertions(+), 74 deletions(-) diff --git a/identity-service/package-lock.json b/identity-service/package-lock.json index b7c169ce069..ac7af0575a9 100644 --- a/identity-service/package-lock.json +++ b/identity-service/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@amplitude/node": "^1.9.2", - "@audius/sdk": "1.0.12", + "@audius/sdk": "1.0.37", "@certusone/wormhole-sdk": "0.1.1", "@improbable-eng/grpc-web-node-http-transport": "^0.15.0", "@opentelemetry/api": "^1.2.0", @@ -253,9 +253,9 @@ } }, "node_modules/@audius/sdk": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@audius/sdk/-/sdk-1.0.12.tgz", - "integrity": "sha512-kQPJ/A/iNnqVdd5SyYk5NiU2wxfWKUA76ZP3LgTbkAnf9vNFztHL7hwbliffxoo/V6Dvvq33VEk/ePQgZm+kxg==", + "version": "1.0.37", + "resolved": "https://registry.npmjs.org/@audius/sdk/-/sdk-1.0.37.tgz", + "integrity": "sha512-37iv+SG+Wx2PSPVE81gt7Go7WuTMRDQqzICY4uUrCzKFDEVzNiLP6LkKpTiwOqoXYE0yaTEc1LLQHnzswY9dKA==", "dependencies": { "@audius/anchor-audius-data": "0.0.2", "@audius/hedgehog": "2.1.0", @@ -263,7 +263,9 @@ "@certusone/wormhole-sdk": "0.1.1", "@ethersproject/solidity": "5.0.5", "@improbable-eng/grpc-web-node-http-transport": "0.15.0", + "@noble/secp256k1": "1.7.0", "@project-serum/anchor": "0.24.1", + "@scure/base": "1.1.1", "@solana/spl-token": "0.1.8", "@solana/web3.js": "1.37.1", "abi-decoder": "2.4.0", @@ -274,6 +276,8 @@ "borsh": "0.4.0", "bs58": "4.0.1", "cipher-base": "1.0.4", + "cross-fetch": "3.1.5", + "cuid": "2.1.8", "elliptic": "6.5.4", "esm": "3.2.25", "eth-sig-util": "2.5.4", @@ -289,6 +293,7 @@ "jsonschema": "1.2.6", "keccak256": "1.0.2", "lodash": "4.17.21", + "micro-aes-gcm": "0.3.3", "node-localstorage": "^1.3.1", "proper-url-join": "1.2.0", "rollup-plugin-shim": "^1.0.0", @@ -5722,6 +5727,17 @@ "upath": "^1.1.1" } }, + "node_modules/@noble/secp256k1": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", + "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -6295,38 +6311,11 @@ "node": ">=11" } }, - "node_modules/@project-serum/anchor/node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dependencies": { - "node-fetch": "2.6.7" - } - }, "node_modules/@project-serum/anchor/node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, - "node_modules/@project-serum/anchor/node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@project-serum/anchor/node_modules/pako": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz", @@ -6401,6 +6390,17 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, + "node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, "node_modules/@sendgrid/client": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-7.7.0.tgz", @@ -10641,11 +10641,11 @@ } }, "node_modules/cross-fetch": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", - "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", "dependencies": { - "node-fetch": "2.6.1" + "node-fetch": "2.6.7" } }, "node_modules/cross-spawn": { @@ -10734,6 +10734,11 @@ "postcss-value-parser": "^4.0.2" } }, + "node_modules/cuid": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/cuid/-/cuid-2.1.8.tgz", + "integrity": "sha512-xiEMER6E7TlTPnDxrM4eRiC6TRgjNX9xzEZ5U/Se2YJKr7Mq4pJn/2XEHjl3STcSh96GmkHPcBXLES8M29wyyg==" + }, "node_modules/d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -16917,6 +16922,11 @@ "node": ">= 0.6" } }, + "node_modules/micro-aes-gcm": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micro-aes-gcm/-/micro-aes-gcm-0.3.3.tgz", + "integrity": "sha512-wetPK288r0FyTzrWKkX9fNAKlJE+//bdQWpucWwx1Ei/MyFgBgN/0Ex1G3sTm4WR+2ATReGKzDQBYVpuwhho/A==" + }, "node_modules/micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -17523,11 +17533,22 @@ "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, "node_modules/node-forge": { @@ -24130,9 +24151,9 @@ } }, "@audius/sdk": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@audius/sdk/-/sdk-1.0.12.tgz", - "integrity": "sha512-kQPJ/A/iNnqVdd5SyYk5NiU2wxfWKUA76ZP3LgTbkAnf9vNFztHL7hwbliffxoo/V6Dvvq33VEk/ePQgZm+kxg==", + "version": "1.0.37", + "resolved": "https://registry.npmjs.org/@audius/sdk/-/sdk-1.0.37.tgz", + "integrity": "sha512-37iv+SG+Wx2PSPVE81gt7Go7WuTMRDQqzICY4uUrCzKFDEVzNiLP6LkKpTiwOqoXYE0yaTEc1LLQHnzswY9dKA==", "requires": { "@audius/anchor-audius-data": "0.0.2", "@audius/hedgehog": "2.1.0", @@ -24140,7 +24161,9 @@ "@certusone/wormhole-sdk": "0.1.1", "@ethersproject/solidity": "5.0.5", "@improbable-eng/grpc-web-node-http-transport": "0.15.0", + "@noble/secp256k1": "1.7.0", "@project-serum/anchor": "0.24.1", + "@scure/base": "1.1.1", "@solana/spl-token": "0.1.8", "@solana/web3.js": "1.37.1", "abi-decoder": "2.4.0", @@ -24151,6 +24174,8 @@ "borsh": "0.4.0", "bs58": "4.0.1", "cipher-base": "1.0.4", + "cross-fetch": "3.1.5", + "cuid": "2.1.8", "elliptic": "6.5.4", "esm": "3.2.25", "eth-sig-util": "2.5.4", @@ -24166,6 +24191,7 @@ "jsonschema": "1.2.6", "keccak256": "1.0.2", "lodash": "4.17.21", + "micro-aes-gcm": "0.3.3", "node-localstorage": "^1.3.1", "proper-url-join": "1.2.0", "rollup-plugin-shim": "^1.0.0", @@ -27761,6 +27787,11 @@ "upath": "^1.1.1" } }, + "@noble/secp256k1": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", + "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -28160,27 +28191,11 @@ "toml": "^3.0.0" }, "dependencies": { - "cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "requires": { - "node-fetch": "2.6.7" - } - }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, "pako": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz", @@ -28251,6 +28266,11 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, + "@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==" + }, "@sendgrid/client": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-7.7.0.tgz", @@ -31628,11 +31648,11 @@ } }, "cross-fetch": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", - "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", "requires": { - "node-fetch": "2.6.1" + "node-fetch": "2.6.7" } }, "cross-spawn": { @@ -31708,6 +31728,11 @@ "postcss-value-parser": "^4.0.2" } }, + "cuid": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/cuid/-/cuid-2.1.8.tgz", + "integrity": "sha512-xiEMER6E7TlTPnDxrM4eRiC6TRgjNX9xzEZ5U/Se2YJKr7Mq4pJn/2XEHjl3STcSh96GmkHPcBXLES8M29wyyg==" + }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -36449,6 +36474,11 @@ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" }, + "micro-aes-gcm": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micro-aes-gcm/-/micro-aes-gcm-0.3.3.tgz", + "integrity": "sha512-wetPK288r0FyTzrWKkX9fNAKlJE+//bdQWpucWwx1Ei/MyFgBgN/0Ex1G3sTm4WR+2ATReGKzDQBYVpuwhho/A==" + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -36960,9 +36990,12 @@ "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } }, "node-forge": { "version": "0.7.6", diff --git a/identity-service/package.json b/identity-service/package.json index 87252ebd242..8778102c951 100644 --- a/identity-service/package.json +++ b/identity-service/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@amplitude/node": "^1.9.2", - "@audius/sdk": "1.0.12", + "@audius/sdk": "1.0.37", "@certusone/wormhole-sdk": "0.1.1", "@improbable-eng/grpc-web-node-http-transport": "^0.15.0", "@opentelemetry/api": "^1.2.0", diff --git a/identity-service/src/routes/instagram.js b/identity-service/src/routes/instagram.js index f9a7833c888..378542511de 100644 --- a/identity-service/src/routes/instagram.js +++ b/identity-service/src/routes/instagram.js @@ -136,9 +136,7 @@ module.exports = function (app) { const [encodedABI, contractAddress] = await audiusLibsInstance.User.updateIsVerified( userId, - true, - config.get('userVerifierPrivateKey'), - config.get('entityManagerReplicaSetEnabled') + config.get('userVerifierPrivateKey') ) const contractRegKey = await audiusLibsInstance.contracts.getRegistryContractForAddress( diff --git a/identity-service/src/routes/tiktok.js b/identity-service/src/routes/tiktok.js index 6f846cb3770..80ea9f3d890 100644 --- a/identity-service/src/routes/tiktok.js +++ b/identity-service/src/routes/tiktok.js @@ -153,9 +153,7 @@ module.exports = function (app) { const [encodedABI, contractAddress] = await audiusLibsInstance.User.updateIsVerified( userId, - true, - config.get('userVerifierPrivateKey'), - config.get('entityManagerReplicaSetEnabled') + config.get('userVerifierPrivateKey') ) const contractRegKey = await audiusLibsInstance.contracts.getRegistryContractForAddress( diff --git a/identity-service/src/routes/twitter.js b/identity-service/src/routes/twitter.js index dfcfb242d1e..26b0cb1f74e 100644 --- a/identity-service/src/routes/twitter.js +++ b/identity-service/src/routes/twitter.js @@ -174,9 +174,7 @@ module.exports = function (app) { const [encodedABI, contractAddress] = await audiusLibsInstance.User.updateIsVerified( userId, - true, - config.get('userVerifierPrivateKey'), - config.get('entityManagerReplicaSetEnabled') + config.get('userVerifierPrivateKey') ) const contractRegKey = await audiusLibsInstance.contracts.getRegistryContractForAddress( From ed6307a2540dab668249a0f387533f4e0abaca26 Mon Sep 17 00:00:00 2001 From: Isaac Solo Date: Tue, 10 Jan 2023 11:44:29 -0800 Subject: [PATCH 2/3] add gas estimate --- identity-service/src/relay/txRelay.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/identity-service/src/relay/txRelay.js b/identity-service/src/relay/txRelay.js index caee9be28c0..014fb7fe4c3 100644 --- a/identity-service/src/relay/txRelay.js +++ b/identity-service/src/relay/txRelay.js @@ -457,6 +457,16 @@ async function relayToNethermind(encodedABI, contractAddress, gasLimit) { const start = new Date().getTime() try { + const toChecksumAddress = nethermindWeb3.utils.toChecksumAddress + + if (!gasLimit){ + gasLimit = await nethermindWeb3.eth.estimateGas({ + from: toChecksumAddress(wallet.address), + to: toChecksumAddress(contractAddress), + data: encodedABI + }) + } + const transaction = { to: contractAddress, value: 0, From 15512d45f12efcf9b7b84b0710b3bda21b26e0fc Mon Sep 17 00:00:00 2001 From: Isaac Solo Date: Tue, 10 Jan 2023 12:26:02 -0800 Subject: [PATCH 3/3] lint --- identity-service/src/relay/txRelay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity-service/src/relay/txRelay.js b/identity-service/src/relay/txRelay.js index 014fb7fe4c3..5e134e185ea 100644 --- a/identity-service/src/relay/txRelay.js +++ b/identity-service/src/relay/txRelay.js @@ -459,7 +459,7 @@ async function relayToNethermind(encodedABI, contractAddress, gasLimit) { try { const toChecksumAddress = nethermindWeb3.utils.toChecksumAddress - if (!gasLimit){ + if (!gasLimit) { gasLimit = await nethermindWeb3.eth.estimateGas({ from: toChecksumAddress(wallet.address), to: toChecksumAddress(contractAddress),