Skip to content

Commit

Permalink
Merge pull request #22 from celo-org/soloseng/odis-cloud-function-gen2
Browse files Browse the repository at this point in the history
Transition ODIS to cloud function Gen 2
  • Loading branch information
soloseng authored Oct 13, 2023
2 parents 9d36efd + a547bc5 commit 8760b09
Show file tree
Hide file tree
Showing 24 changed files with 630 additions and 264 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-plums-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/phone-number-privacy-combiner': patch
---

Migrated the combiner to gen2 cloud function.
5 changes: 5 additions & 0 deletions .changeset/serious-turtles-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/phone-number-privacy-combiner': minor
---

Migrated the combiner from gen1 to gen2 cloud function. This changeset overwride the previous one.
4 changes: 1 addition & 3 deletions packages/phone-number-privacy/combiner/.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ SERVICE_NAME='odis-combiner'
ODIS_BLOCKCHAIN_PROVIDER=https://alfajores-forno.celo-testnet.org
CONTEXT_NAME='alfajores'
# TODO investigate why these are defined here
NODE_OPTIONS='--require ./dist/tracing.js'
TRACER_ENDPOINT='https://grafana-agent.staging-odis2-centralus.celo-networks-dev.org/api/traces'
TRACING_SERVICE_NAME='odis-combiner-staging'
NODE_OPTIONS='--require ./dist/tracing.js'
29 changes: 29 additions & 0 deletions packages/phone-number-privacy/combiner/.env.celo-pgpnp-mainnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
TRACER_ENDPOINT='https://grafana-agent.mainnet-odis2-centralus.celo-networks-dev.org/api/traces'
TRACING_SERVICE_NAME='odis-combiner-gen2-mainnet'
MIN_INSTANCES=0
REQUEST_CONCURRENCY=80
BLOCKCHAIN_PROVIDER="https://forno.celo.org"
PNP_SERVICE_NAME="odis-combiner-mainnet"
PNP_ENABLED=true
PNP_ODIS_SERVICES_SIGNERS="[{\"url\": \"https://odis.vladiatorlabs.io\"},{\"url\": \"https://mainnet-pgpnp-brazilsouth.azurefd.net\"},{\"url\": \"https://mainnet-pgpnp-eastasia.azurefd.net\"},{\"url\": \"https://phone.chainlayerattestations.com\"},{\"url\": \"https://pnprivacy.wotrust.us\"},{\"url\": \"https://pgpnp.census.works\"},{\"url\": \"https://odis.keyko.rocks\"},{\"url\": \"https://odis.celo.spruceid.xyz\"}]"
PNP_ODIS_SERVICES_TIMEOUT_MILLISECONDS=5000
PNP_KEYS_CURRENT_VERSION=1
PNP_KEYS_VERSIONS="[{\"keyVersion\":1,\"threshold\":6,\"polynomial\":\"060000000000000016fade1df2e68418f0c47c6cc5ecab70e2ed4a89c2f63ecadd6ad2e106a962c407e8b75a0d368d1a69e540c7c5634e01a7f2b8c00bea4303bdfdba8f54229ff197bc399a3c16b9a8838258e31022c2bb2a397c6e835d7e86d8c47b5a63e2e30017f865337fd0060497457135173e2b0eaec6f8f14f0cacb17a5d150218e15bd46963ed1b9d56f956f9c4fc692813100042f098b7f70913f671e28ed1c99104b9b740549c42c59212b6671f1e1675674f7e6b6d690a13bd474ab9f0c83cd48e017514ca3874606f6abde2b957c791376e24d55efe6ccc7a1194a685b9589ca873a51c7e77b7b814a76cd9af2aafef500155280fb84efd3219b04312635568788b3393fd45a11f431a7eef8a8fc59ff2bfd4aab744baf9221bf1774653dda61d8193b720f60c627d5a9fec5c2c16a27e948f2f4545b460090303327262ec87f51fbf860f58d5e051d91d5bb869c8912300a9b1c2d922d329c9b7d5179946e049d52ed9b3876f36e5c8b2a47831eb235a51d8d877a284fbe07750449f9654d332808beb9641404188813cddb8ffad906752d71f3f042b583f501b3b7f3906946f9931c598575bf4c8d3e8941168f8cc8e001c092117257bb073db3885dffca5e8dd76b689d395bb5555cf00f9943a9e1ec9939f9d700407330163220f3c15a9420011b8693fb95c635168b6b0a021263b246301343e80161eac44fe79ba657fe59deb9d297ced18d090a8f65dc9c2e0990177f186d7501a2256ac9ecca36743e118f5dd4ce35dc976d38c8679d53cd11b0f11edb45c3473ce848d35875e63b2d100\",\"pubKey\":\"FvreHfLmhBjwxHxsxeyrcOLtSonC9j7K3WrS4QapYsQH6LdaDTaNGmnlQMfFY04Bp/K4wAvqQwO9/bqPVCKf8Ze8OZo8Frmog4JY4xAiwrsqOXxug11+htjEe1pj4uMA\"},{\"keyVersion\":2,\"threshold\":5,\"polynomial\":\"050000000000000016fade1df2e68418f0c47c6cc5ecab70e2ed4a89c2f63ecadd6ad2e106a962c407e8b75a0d368d1a69e540c7c5634e01a7f2b8c00bea4303bdfdba8f54229ff197bc399a3c16b9a8838258e31022c2bb2a397c6e835d7e86d8c47b5a63e2e300399b80040cf5b4b7e016100f02326636696ad6f449cca503bf336c0fec8f7f96d8d410974ca92708a740257029836a00d5b30808af8ab33d6a069656570402339e649a5d4ee2d399768b1598590c3e9deee17d750f480c94f94fb62ad7554b810fb72e1984c0dc2704cf3a6c67d8470104ee5e727b3fc56efb44d53f50ad3d53a18874dc7c3a670c2c34266b33825601fbb1193929115fdebbc99185f2d327904759c18173d1e2abfcaa3db8954f1d41c816a140b86c8d80ba2c2c39faad7080a0068a13aca4767671c13a75735f638d0f0ba8ae2ad650cff7a2f17a89ea7a28699e0e1f232142b2e5f7662c6b582d01b5ac16fb20791462492bed5fa7e28dc2616cf9703f9b4358d8ceb511c7a9cd4054d2d37a8b25f73aa50086c58e723d8145bbd7a6f3024aa7201fa965558e5641839c1b51930bdbc310f9df2894c37e75c4cebe36f4ac5b35c813605b8cbc830078988790de7525fc7d37c44d6ef75b41392b5b117adcfba29f50d6634b331f63cd9ac341744097cd955007b60e86e200\",\"pubKey\":\"FvreHfLmhBjwxHxsxeyrcOLtSonC9j7K3WrS4QapYsQH6LdaDTaNGmnlQMfFY04Bp/K4wAvqQwO9/bqPVCKf8Ze8OZo8Frmog4JY4xAiwrsqOXxug11+htjEe1pj4uMA\"}]"
PNP_FULL_NODE_TIMEOUT_MS=1000
PNP_FULL_NODE_RETRY_COUNT=5
PNP_FULL_NODE_DELAY_MS=100
PNP_SHOULD_AUTHENTICATE=false
PNP_SHOULD_CHECK_QUOTA=false
PNP_SHOULD_MOCK_ACCOUNT_SERVICE=false
PNP_MOCK_DECK=0xbf8a2b73baf8402f8fe906ad3f42b560bf14b39f7df7797ece9e293d6f162188
DOMAIN_SERVICE_NAME="odis-combiner-mainnet"
DOMAIN_ENABLED=true
DOMAIN_ODIS_SERVICES_SIGNERS="[{\"url\": \"https://odis.vladiatorlabs.io\"},{\"url\": \"https://mainnet-pgpnp-brazilsouth.azurefd.net\"},{\"url\": \"https://phone.chainlayerattestations.com\"},{\"url\": \"https://pnprivacy.wotrust.us\"},{\"url\": \"https://pgpnp.census.works\"},{\"url\": \"https://odis.keyko.rocks\"},{\"url\": \"https://odis.celo.spruceid.xyz\"}]"
DOMAIN_ODIS_SERVICES_TIMEOUT_MILLISECONDS=5000
DOMAIN_KEYS_CURRENT_VERSION=1
DOMAIN_KEYS_VERSIONS="[{\"keyVersion\":1,\"threshold\":5,\"polynomial\":\"05000000000000002d7e2d2e2b989bc81e677ced987ee8216cf8a215eddde3d14ddf416c6f513bce8d32b0297e58a888ecca62d22cca3100d2e6ab9d7f049a8fa5b936386f0116a60643c8f604e9431602805a641772e8d0cc800c526dd36d69012ae757c18c250029d97c8a3d4b81e305780b49d511c80dc3009c02b8f651a06c8ec2d5530937a1f7eadf730ad46762a4c089bbd973a000ba77717ec36ebb6fd58904b444a6cde7dd3b3b7ac6fa37f9cd8d00aa67e7cfe81adee5ed45218f7f78b4f8473b564601f4361d228dc6dabf7decd3f61f5bb0ad2c7bd7fe5b7a88054959543e82f4deb08d4fe9af4ac775c9353e038e79f82200863ac9cb7fd6b5fa263eb9d1dead51002607f3eadac153596b671b854715bdb07bee1b0bc8d5178f0dac1b4d00ed0700f46e37135e96604d389f3a323028e29b07f36279e829da00eee1794f3ad6e5dca24eba65a7821755cc464add27c7a601c7e187756e79a5ec3c847f4d91b037fe3cd40590fc1a46b46c2f68c0edcbe5cd7727162a195a711008e4e956eb8a81011b290057cee3f14b9a4198a3e9909cac69a9e7d648fa3dd185794acc4c1e4b994637dca36621d463b42e015115ac2c015fc176d8f143bf99cca654ae95a3101afbdc0c5026f95fbf31af1ac115399f5b6b6d1de09af367745415be9533f8c080\",\"pubKey\":\"LX4tLiuYm8geZ3ztmH7oIWz4ohXt3ePRTd9BbG9RO86NMrApflioiOzKYtIsyjEA0uarnX8Emo+luTY4bwEWpgZDyPYE6UMWAoBaZBdy6NDMgAxSbdNtaQEq51fBjCUA\"}]"
DOMAIN_FULL_NODE_TIMEOUT_MS=1000
DOMAIN_FULL_NODE_RETRY_COUNT=5
DOMAIN_FULL_NODE_DELAY_MS=100
DOMAIN_SHOULD_AUTHENTICATE=false
DOMAIN_SHOULD_CHECK_QUOTA=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
TRACER_ENDPOINT='https://grafana-agent.alfajores-odis2-centralus.celo-networks-dev.org/api/traces'
TRACING_SERVICE_NAME='odis-combiner-gen2-alfajores'
MIN_INSTANCES=0
REQUEST_CONCURRENCY=80
BLOCKCHAIN_PROVIDER="https://alfajores-forno.celo-testnet.org"
PNP_SERVICE_NAME="odis-combiner"
PNP_ENABLED=true
PNP_ODIS_SERVICES_SIGNERS="[{\"url\": \"https://odis-alfajores-signer2.azurefd.net\"},{\"url\": \"https://odis-alfajores-signer3.azurefd.net\"},{\"url\": \"https://odis-alfajores-signer-1-b.azurefd.net\"}]"
PNP_ODIS_SERVICES_TIMEOUT_MILLISECONDS=5000
PNP_KEYS_CURRENT_VERSION=1
PNP_KEYS_VERSIONS="[{\"keyVersion\":1,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"kPoRxWdEdZ/Nd3uQnp3FJFs54zuiS+ksqvOm9x8vY6KHPG8jrfqysvIRU0wtqYsBKA7SoAsICMBv8C/Fb2ZpDOqhSqvr/sZbZoHmQfvbqrzbtDIPvUIrHgRS0ydJCMsA\"},{\"keyVersion\":2,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"kPoRxWdEdZ/Nd3uQnp3FJFs54zuiS+ksqvOm9x8vY6KHPG8jrfqysvIRU0wtqYsBKA7SoAsICMBv8C/Fb2ZpDOqhSqvr/sZbZoHmQfvbqrzbtDIPvUIrHgRS0ydJCMsA\"}]"
PNP_FULL_NODE_TIMEOUT_MS=1000
PNP_FULL_NODE_RETRY_COUNT=5
PNP_FULL_NODE_DELAY_MS=100
PNP_SHOULD_AUTHENTICATE=false
PNP_SHOULD_CHECK_QUOTA=false
PNP_SHOULD_MOCK_ACCOUNT_SERVICE=false
PNP_MOCK_DECK=0xbf8a2b73baf8402f8fe906ad3f42b560bf14b39f7df7797ece9e293d6f162188
DOMAIN_SERVICE_NAME="odis-combiner"
DOMAIN_ENABLED=true
DOMAIN_ODIS_SERVICES_SIGNERS="[{\"url\": \"https://odis-alfajores-signer2.azurefd.net\"},{\"url\": \"https://odis-alfajores-signer3.azurefd.net\"},{\"url\": \"https://odis-alfajores-signer-1-b.azurefd.net\"}]"
DOMAIN_ODIS_SERVICES_TIMEOUT_MILLISECONDS=5000
DOMAIN_KEYS_CURRENT_VERSION=1
DOMAIN_KEYS_VERSIONS="[{\"keyVersion\":1,\"threshold\":2,\"polynomial\":\"0200000000000000f99af1c8fbcb0a15945ff0f23f0e93b86c101f48250c911b4ab4b15004723f93eea98c8ffd4e166535757b46c0522a0167a40224c88ba43c13685bf2f159e63394416cb41432b320e69e3e0810aa8fa1e1b0c7dcc948fc5742f2b8d752b65081f10d83821b4e2cf90b56cc4fc8c98dc00e5f24f2c5b53fa8ad7c2ebd3963c9223cf95209692d267a4f8084edfc0b5f01f7a31d82bf5421c544b6258749c691b79e6f36d9ba963ead6f25b9986b6bcb7d45b5edb33a616af630b4ce17bf552c81\",\"pubKey\":\"+ZrxyPvLChWUX/DyPw6TuGwQH0glDJEbSrSxUARyP5PuqYyP/U4WZTV1e0bAUioBZ6QCJMiLpDwTaFvy8VnmM5RBbLQUMrMg5p4+CBCqj6HhsMfcyUj8V0LyuNdStlCB\"},{\"keyVersion\":2,\"threshold\":2,\"polynomial\":\"0200000000000000f99af1c8fbcb0a15945ff0f23f0e93b86c101f48250c911b4ab4b15004723f93eea98c8ffd4e166535757b46c0522a0167a40224c88ba43c13685bf2f159e63394416cb41432b320e69e3e0810aa8fa1e1b0c7dcc948fc5742f2b8d752b65081f10d83821b4e2cf90b56cc4fc8c98dc00e5f24f2c5b53fa8ad7c2ebd3963c9223cf95209692d267a4f8084edfc0b5f01f7a31d82bf5421c544b6258749c691b79e6f36d9ba963ead6f25b9986b6bcb7d45b5edb33a616af630b4ce17bf552c81\",\"pubKey\":\"+ZrxyPvLChWUX/DyPw6TuGwQH0glDJEbSrSxUARyP5PuqYyP/U4WZTV1e0bAUioBZ6QCJMiLpDwTaFvy8VnmM5RBbLQUMrMg5p4+CBCqj6HhsMfcyUj8V0LyuNdStlCB\"}]"
DOMAIN_FULL_NODE_TIMEOUT_MS=1000
DOMAIN_FULL_NODE_RETRY_COUNT=5
DOMAIN_FULL_NODE_DELAY_MS=100
DOMAIN_SHOULD_AUTHENTICATE=false
DOMAIN_SHOULD_CHECK_QUOTA=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
TRACER_ENDPOINT='https://grafana-agent.staging-odis2-centralus.celo-networks-dev.org/api/traces'
TRACING_SERVICE_NAME='odis-combiner-gen2-staging'
MIN_INSTANCES=0
REQUEST_CONCURRENCY=80
BLOCKCHAIN_PROVIDER="https://alfajores-forno.celo-testnet.org"
PNP_SERVICE_NAME="odis_combiner"
PNP_ENABLED=true
PNP_ODIS_SERVICES_SIGNERS="[{\"url\": \"https://staging-pgpnp-signer0.azurefd.net\", \"fallbackUrl\": \"http://52.154.55.35\"},{\"url\": \"https://staging-pgpnp-signer1.azurefd.net\", \"fallbackUrl\": \"http://13.89.116.218\"},{\"url\": \"https://staging-pgpnp-signer2.azurefd.net\", \"fallbackUrl\": \"http://20.84.128.169\"}]"
PNP_ODIS_SERVICES_TIMEOUT_MILLISECONDS=5000
PNP_KEYS_CURRENT_VERSION=1
PNP_KEYS_VERSIONS="[{\"keyVersion\":1,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA\"},{\"keyVersion\":2,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA\"},{\"keyVersion\":3,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA\"}]"
PNP_FULL_NODE_TIMEOUT_MS=1000
PNP_FULL_NODE_RETRY_COUNT=5
PNP_FULL_NODE_DELAY_MS=100
PNP_SHOULD_AUTHENTICATE=false
PNP_SHOULD_CHECK_QUOTA=false
PNP_SHOULD_MOCK_ACCOUNT_SERVICE=false
PNP_MOCK_DECK=0xbf8a2b73baf8402f8fe906ad3f42b560bf14b39f7df7797ece9e293d6f162188
DOMAIN_SERVICE_NAME="odis_combiner"
DOMAIN_ENABLED=true
DOMAIN_ODIS_SERVICES_SIGNERS="[{\"url\": \"https://staging-pgpnp-signer0.azurefd.net\", \"fallbackUrl\": \"http://52.154.55.35\"},{\"url\": \"https://staging-pgpnp-signer1.azurefd.net\", \"fallbackUrl\": \"http://13.89.116.218\"},{\"url\": \"https://staging-pgpnp-signer2.azurefd.net\", \"fallbackUrl\": \"http://20.84.128.169\"}]"
DOMAIN_ODIS_SERVICES_TIMEOUT_MILLISECONDS=5000
DOMAIN_KEYS_CURRENT_VERSION=1
DOMAIN_KEYS_VERSIONS="[{\"keyVersion\":1,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA\"},{\"keyVersion\":2,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA\"},{\"keyVersion\":3,\"threshold\":2,\"polynomial\":\"0200000000000000ec5b161ac167995bd17cc0e9cf3f79369efac1fff5b0f68ad0e83dca207e3fc41b8e20bc155ebb3416a7b3d87364490169032189aa7380c47a0a464864fbe0c106e803197ae4959165e7067b95775cee2c74a78d7a67406764f342e5a4b99a003a510287524c9437b12ebb0bfdc7ea46078b807d1b665966961784bd71c4227c272b01c0fcd19c5b92226c1aac324b010abef36192e8ff3abb25686b3e6707bc747b129c32e572b5850db8446bd8f0af9a3fbf6b579793002b1b68528ca4ac00\",\"pubKey\":\"7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA\"}]"
DOMAIN_FULL_NODE_TIMEOUT_MS=1000
DOMAIN_FULL_NODE_RETRY_COUNT=5
DOMAIN_FULL_NODE_DELAY_MS=100
DOMAIN_SHOULD_AUTHENTICATE=false
DOMAIN_SHOULD_CHECK_QUOTA=false
8 changes: 3 additions & 5 deletions packages/phone-number-privacy/combiner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"main": "dist/index.js",
"scripts": {
"dev": "yarn build && firebase serve --only functions",
"deploy": "yarn build && firebase deploy --only functions:combiner",
"deploy": "yarn build && firebase deploy --only functions:combinerGen2",
"deploy:staging": "yarn deploy --project celo-phone-number-privacy-stg",
"deploy:alfajores": "yarn deploy --project celo-phone-number-privacy",
"deploy:mainnet": "yarn deploy --project celo-pgpnp-mainnet",
Expand All @@ -30,6 +30,7 @@
"test:e2e:mainnet": "CONTEXT_NAME=mainnet yarn test:e2e"
},
"dependencies": {
"@celo/base": "^5.0.4",
"@celo/contractkit": "^5.0.4",
"@celo/phone-number-privacy-common": "^3.0.3",
"@celo/identity": "^5.0.4",
Expand All @@ -55,9 +56,8 @@
"express": "^4.17.1",
"firebase-admin": "^11.10.1",
"firebase-functions": "^4.4.1",
"http-proxy": "^1.18.1",
"stream-array": "^1.1.2",
"knex": "^2.1.0",
"lru-cache": "^10.0.1",
"node-fetch": "^2.6.9",
"pg": "^8.2.1",
"uuid": "^7.0.3"
Expand All @@ -67,8 +67,6 @@
"@celo/utils": "^5.0.4",
"@celo/phone-utils": "^5.0.4",
"@types/express": "^4.17.6",
"@types/http-proxy": "^1.17.11",
"@types/stream-array": "1.1.1",
"@types/supertest": "^2.0.12",
"@types/uuid": "^7.0.3",
"firebase-functions-test": "^3.1.0",
Expand Down
43 changes: 28 additions & 15 deletions packages/phone-number-privacy/combiner/src/common/combine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ export async function thresholdCallToSigners<R extends OdisRequest>(
options: ThresholdCallToSignersOptions<R>,
processResult: (res: OdisResponse<R>) => Promise<boolean> = (_) => Promise.resolve(false)
): Promise<{ signerResponses: Array<SignerResponse<R>>; maxErrorCode?: number }> {
const obs = new PerformanceObserver((list) => {
// Possible race condition here: if multiple signers take exactly the same
// amount of time, the PerformanceObserver callback may be called twice with
// both entries present. Node 12 doesn't allow for entries to be deleted by name,
// and eliminating the race condition requires a more significant redesign of
// the measurement code.
// This is only used for monitoring purposes, so a rare
// duplicate latency measure for the signer should have minimal impact.
list.getEntries().forEach((entry) => {
logger.info({ latency: entry, signer: entry.name }, 'Signer response latency measured')
})
})
obs.observe({ entryTypes: ['measure'], buffered: false })

const {
signers,
endpoint,
Expand All @@ -57,6 +43,31 @@ export async function thresholdCallToSigners<R extends OdisRequest>(
responseSchema,
} = options

const obs = new PerformanceObserver((list) => {
// Since moving to a Cloud Run based infrastucture, which allows for
// multiple requests to be processed by the same server instance,
// there was a need to filter the performance observer by entry name.
//
// Without this, the performance observer would incorrectly log requests
// from multiple sessions.

list.getEntries().forEach((entry) => {
// Filter entries based on signer URL
const matchingSigner = signers.find((signer) => {
const entryName = signer.url + endpoint + `/${request.body.sessionID}`
return entry.name === entryName
})

if (matchingSigner) {
logger.info(
{ latency: entry, signer: matchingSigner.url + endpoint },
'Signer response latency measured'
)
}
})
})
obs.observe({ entryTypes: ['measure'], buffered: false })

const manualAbort = new AbortController()
// @ts-ignore
const timeoutSignal = AbortSignal.timeout(requestTimeoutMS)
Expand Down Expand Up @@ -92,10 +103,11 @@ export async function thresholdCallToSigners<R extends OdisRequest>(
})

if (!signerFetchResult.ok) {
const responseData = await signerFetchResult.json()
// used for log based metrics
logger.info({
message: 'Received signerFetchResult on unsuccessful signer response',
res: await signerFetchResult.json(),
res: responseData,
status: signerFetchResult.status,
signer: signer.url,
})
Expand All @@ -110,6 +122,7 @@ export async function thresholdCallToSigners<R extends OdisRequest>(
logger.warn('Not possible to reach a threshold of signer responses. Failing fast')
manualAbort.abort()
}
responses.push({ res: responseData, url: signer.url })
return
}

Expand Down
Loading

0 comments on commit 8760b09

Please sign in to comment.