diff --git a/packages/phone-number-privacy/combiner/src/config.ts b/packages/phone-number-privacy/combiner/src/config.ts index f9cc2ecda2..3d9fcb9e91 100644 --- a/packages/phone-number-privacy/combiner/src/config.ts +++ b/packages/phone-number-privacy/combiner/src/config.ts @@ -1,6 +1,8 @@ import { BlockchainConfig, FULL_NODE_TIMEOUT_IN_MS, + RETRY_COUNT, + RETRY_DELAY_IN_MS, rootLogger, TestUtils, toBool, @@ -36,6 +38,8 @@ export interface OdisConfig { versions: string // parse as KeyVersionInfo[] } fullNodeTimeoutMs: number + fullNodeRetryCount: number + fullNodeRetryDelayMs: number } export interface CombinerConfig { @@ -102,6 +106,8 @@ if (DEV_MODE) { ]), }, fullNodeTimeoutMs: FULL_NODE_TIMEOUT_IN_MS, + fullNodeRetryCount: RETRY_COUNT, + fullNodeRetryDelayMs: RETRY_DELAY_IN_MS, }, domains: { serviceName: defaultServiceName, @@ -135,6 +141,8 @@ if (DEV_MODE) { ]), }, fullNodeTimeoutMs: FULL_NODE_TIMEOUT_IN_MS, + fullNodeRetryCount: RETRY_COUNT, + fullNodeRetryDelayMs: RETRY_DELAY_IN_MS, }, } } else { @@ -160,6 +168,10 @@ if (DEV_MODE) { versions: functionConfig.pnp_keys.versions, }, fullNodeTimeoutMs: Number(functionConfig.pnp.full_node_timeout_ms ?? FULL_NODE_TIMEOUT_IN_MS), + fullNodeRetryCount: Number(functionConfig.pnp.full_node_retry_count ?? RETRY_COUNT), + fullNodeRetryDelayMs: Number( + functionConfig.pnp.full_node_retry_delay_ms ?? RETRY_DELAY_IN_MS + ), }, domains: { serviceName: functionConfig.domains.service_name ?? defaultServiceName, @@ -176,6 +188,10 @@ if (DEV_MODE) { versions: functionConfig.domains_keys.versions, }, fullNodeTimeoutMs: Number(functionConfig.pnp.full_node_timeout_ms ?? FULL_NODE_TIMEOUT_IN_MS), + fullNodeRetryCount: Number(functionConfig.pnp.full_node_retry_count ?? RETRY_COUNT), + fullNodeRetryDelayMs: Number( + functionConfig.pnp.full_node_retry_delay_ms ?? RETRY_DELAY_IN_MS + ), }, } } diff --git a/packages/phone-number-privacy/combiner/src/pnp/endpoints/quota/io.ts b/packages/phone-number-privacy/combiner/src/pnp/endpoints/quota/io.ts index 64c402b7eb..cf70791e41 100644 --- a/packages/phone-number-privacy/combiner/src/pnp/endpoints/quota/io.ts +++ b/packages/phone-number-privacy/combiner/src/pnp/endpoints/quota/io.ts @@ -72,7 +72,9 @@ export class PnpQuotaIO extends IO { logger, this.config.shouldFailOpen, [], - this.config.fullNodeTimeoutMs + this.config.fullNodeTimeoutMs, + this.config.fullNodeRetryCount, + this.config.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.legacy.ts b/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.legacy.ts index bfd1565608..d5ee3201c2 100644 --- a/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.legacy.ts +++ b/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.legacy.ts @@ -91,7 +91,9 @@ export class LegacyPnpSignIO extends IO { logger, this.config.shouldFailOpen, [], - this.config.fullNodeTimeoutMs + this.config.fullNodeTimeoutMs, + this.config.fullNodeRetryCount, + this.config.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.ts b/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.ts index ce02dc0321..a0e1246f3f 100644 --- a/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.ts +++ b/packages/phone-number-privacy/combiner/src/pnp/endpoints/sign/io.ts @@ -90,7 +90,9 @@ export class PnpSignIO extends IO { logger, this.config.shouldFailOpen, [], - this.config.fullNodeTimeoutMs + this.config.fullNodeTimeoutMs, + this.config.fullNodeRetryCount, + this.config.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/combiner/test/integration/domain.test.ts b/packages/phone-number-privacy/combiner/test/integration/domain.test.ts index 5f7f1f1fe5..f56b765df9 100644 --- a/packages/phone-number-privacy/combiner/test/integration/domain.test.ts +++ b/packages/phone-number-privacy/combiner/test/integration/domain.test.ts @@ -1,5 +1,6 @@ import { CombinerEndpoint, + DB_TIMEOUT, DisableDomainRequest, disableDomainRequestEIP712, DisableDomainResponse, @@ -18,6 +19,8 @@ import { getContractKit, KEY_VERSION_HEADER, PoprfClient, + RETRY_COUNT, + RETRY_DELAY_IN_MS, SequentialDelayDomain, SequentialDelayStage, TestUtils, @@ -110,6 +113,7 @@ const signerConfig: SignerConfig = { port: undefined, ssl: true, poolMaxSize: 50, + timeout: DB_TIMEOUT, }, keystore: { type: SupportedKeystore.MOCK_SECRET_MANAGER, @@ -140,6 +144,8 @@ const signerConfig: SignerConfig = { timeout: 5000, test_quota_bypass_percentage: 0, fullNodeTimeoutMs: FULL_NODE_TIMEOUT_IN_MS, + fullNodeRetryCount: RETRY_COUNT, + fullNodeRetryDelayMs: RETRY_DELAY_IN_MS, } describe('domainService', () => { diff --git a/packages/phone-number-privacy/combiner/test/integration/legacypnp.test.ts b/packages/phone-number-privacy/combiner/test/integration/legacypnp.test.ts index 1506015c28..c75286184d 100644 --- a/packages/phone-number-privacy/combiner/test/integration/legacypnp.test.ts +++ b/packages/phone-number-privacy/combiner/test/integration/legacypnp.test.ts @@ -2,11 +2,14 @@ import { newKit } from '@celo/contractkit' import { AuthenticationMethod, CombinerEndpoint, + DB_TIMEOUT, ErrorMessage, FULL_NODE_TIMEOUT_IN_MS, genSessionID, KEY_VERSION_HEADER, LegacySignMessageRequest, + RETRY_COUNT, + RETRY_DELAY_IN_MS, SignMessageResponseFailure, SignMessageResponseSuccess, TestUtils, @@ -114,6 +117,7 @@ const signerConfig: SignerConfig = { port: undefined, ssl: true, poolMaxSize: 50, + timeout: DB_TIMEOUT, }, keystore: { type: SupportedKeystore.MOCK_SECRET_MANAGER, @@ -144,6 +148,8 @@ const signerConfig: SignerConfig = { timeout: 5000, test_quota_bypass_percentage: 0, fullNodeTimeoutMs: FULL_NODE_TIMEOUT_IN_MS, + fullNodeRetryCount: RETRY_COUNT, + fullNodeRetryDelayMs: RETRY_DELAY_IN_MS, } const testBlockNumber = 1000000 diff --git a/packages/phone-number-privacy/combiner/test/integration/pnp.test.ts b/packages/phone-number-privacy/combiner/test/integration/pnp.test.ts index f74d4432bf..fcea12b182 100644 --- a/packages/phone-number-privacy/combiner/test/integration/pnp.test.ts +++ b/packages/phone-number-privacy/combiner/test/integration/pnp.test.ts @@ -2,6 +2,7 @@ import { newKit } from '@celo/contractkit' import { AuthenticationMethod, CombinerEndpoint, + DB_TIMEOUT, ErrorMessage, FULL_NODE_TIMEOUT_IN_MS, genSessionID, @@ -9,6 +10,8 @@ import { PnpQuotaRequest, PnpQuotaResponseFailure, PnpQuotaResponseSuccess, + RETRY_COUNT, + RETRY_DELAY_IN_MS, SignerEndpoint, SignMessageRequest, SignMessageResponseFailure, @@ -65,6 +68,8 @@ const { BLINDING_FACTOR, } = TestUtils.Values +jest.setTimeout(20000) + // create deep copy of config const combinerConfig: typeof config = JSON.parse(JSON.stringify(config)) combinerConfig.phoneNumberPrivacy.enabled = true @@ -118,6 +123,7 @@ const signerConfig: SignerConfig = { port: undefined, ssl: true, poolMaxSize: 50, + timeout: DB_TIMEOUT, }, keystore: { type: SupportedKeystore.MOCK_SECRET_MANAGER, @@ -148,6 +154,8 @@ const signerConfig: SignerConfig = { timeout: 5000, test_quota_bypass_percentage: 0, fullNodeTimeoutMs: FULL_NODE_TIMEOUT_IN_MS, + fullNodeRetryCount: RETRY_COUNT, + fullNodeRetryDelayMs: RETRY_DELAY_IN_MS, } const testBlockNumber = 1000000 diff --git a/packages/phone-number-privacy/common/src/utils/authentication.ts b/packages/phone-number-privacy/common/src/utils/authentication.ts index 79c70acca0..dce7fa26f0 100644 --- a/packages/phone-number-privacy/common/src/utils/authentication.ts +++ b/packages/phone-number-privacy/common/src/utils/authentication.ts @@ -26,7 +26,9 @@ export async function authenticateUser( logger: Logger, shouldFailOpen: boolean = false, warnings: ErrorType[] = [], - timeoutMs: number = FULL_NODE_TIMEOUT_IN_MS + timeoutMs: number = FULL_NODE_TIMEOUT_IN_MS, + retryCount: number = RETRY_COUNT, + retryDelay: number = RETRY_DELAY_IN_MS ): Promise { logger.debug('Authenticating user') @@ -43,7 +45,14 @@ export async function authenticateUser( if (authMethod && authMethod === AuthenticationMethod.ENCRYPTION_KEY) { let registeredEncryptionKey try { - registeredEncryptionKey = await getDataEncryptionKey(signer, contractKit, logger, timeoutMs) + registeredEncryptionKey = await getDataEncryptionKey( + signer, + contractKit, + logger, + timeoutMs, + retryCount, + retryDelay + ) } catch (err) { // getDataEncryptionKey should only throw if there is a full-node connection issue. // That is, it does not throw if the DEK is undefined or invalid @@ -129,7 +138,9 @@ export async function getDataEncryptionKey( address: string, contractKit: ContractKit, logger: Logger, - timeoutMs: number + timeoutMs: number, + fullNodeRetryCount: number, + fullNodeRetryDelayMs: number ): Promise { try { const res = await retryAsyncWithBackOffAndTimeout( @@ -137,9 +148,9 @@ export async function getDataEncryptionKey( const accountWrapper: AccountsWrapper = await contractKit.contracts.getAccounts() return accountWrapper.getDataEncryptionKey(address) }, - RETRY_COUNT, + fullNodeRetryCount, [], - RETRY_DELAY_IN_MS, + fullNodeRetryDelayMs, 1.5, timeoutMs ) diff --git a/packages/phone-number-privacy/common/src/utils/constants.ts b/packages/phone-number-privacy/common/src/utils/constants.ts index c50f375e84..1287c9086f 100644 --- a/packages/phone-number-privacy/common/src/utils/constants.ts +++ b/packages/phone-number-privacy/common/src/utils/constants.ts @@ -1,5 +1,6 @@ export const REASONABLE_BODY_CHAR_LIMIT: number = 16_000 export const DB_TIMEOUT = 1000 +export const DB_POOL_MAX_SIZE = 50 export const FULL_NODE_TIMEOUT_IN_MS = 1000 export const RETRY_COUNT = 5 export const RETRY_DELAY_IN_MS = 100 diff --git a/packages/phone-number-privacy/signer/src/common/database/wrappers/account.ts b/packages/phone-number-privacy/signer/src/common/database/wrappers/account.ts index b40af283d4..f5a11122df 100644 --- a/packages/phone-number-privacy/signer/src/common/database/wrappers/account.ts +++ b/packages/phone-number-privacy/signer/src/common/database/wrappers/account.ts @@ -1,6 +1,7 @@ -import { DB_TIMEOUT, ErrorMessage } from '@celo/phone-number-privacy-common' +import { ErrorMessage } from '@celo/phone-number-privacy-common' import Logger from 'bunyan' import { Knex } from 'knex' +import { config } from '../../../config' import { Histograms, meter } from '../../metrics' import { AccountRecord, ACCOUNTS_COLUMNS, ACCOUNTS_TABLE, toAccountRecord } from '../models/account' import { countAndThrowDBError, tableWithLockForTrx } from '../utils' @@ -26,7 +27,7 @@ export async function getPerformedQueryCount( .select(ACCOUNTS_COLUMNS.numLookups) .where(ACCOUNTS_COLUMNS.address, account) .first() - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) return queryCounts === undefined ? 0 : queryCounts[ACCOUNTS_COLUMNS.numLookups] }, [], @@ -48,7 +49,7 @@ async function getAccountExists( const accountRecord = await tableWithLockForTrx(accounts(db, accountsTable), trx) .where(ACCOUNTS_COLUMNS.address, account) .first() - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) return !!accountRecord }, @@ -77,7 +78,7 @@ export async function incrementQueryCount( .transacting(trx) .where(ACCOUNTS_COLUMNS.address, account) .increment(ACCOUNTS_COLUMNS.numLookups, 1) - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) } else { const newAccountRecord = toAccountRecord(account, 1) await insertRecord(db, accountsTable, newAccountRecord, logger, trx) @@ -98,7 +99,7 @@ async function insertRecord( trx: Knex.Transaction ): Promise { try { - await accounts(db, accountsTable).transacting(trx).insert(data).timeout(DB_TIMEOUT) + await accounts(db, accountsTable).transacting(trx).insert(data).timeout(config.db.timeout) } catch (error) { countAndThrowDBError(error, logger, ErrorMessage.DATABASE_INSERT_FAILURE) } diff --git a/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-request.ts b/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-request.ts index 3ce83ccfc6..35428f423d 100644 --- a/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-request.ts +++ b/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-request.ts @@ -1,6 +1,7 @@ -import { DB_TIMEOUT, Domain, domainHash, ErrorMessage } from '@celo/phone-number-privacy-common' +import { Domain, domainHash, ErrorMessage } from '@celo/phone-number-privacy-common' import Logger from 'bunyan' import { Knex } from 'knex' +import { config } from '../../../config' import { Histograms, meter } from '../../metrics' import { DOMAIN_REQUESTS_COLUMNS, @@ -35,7 +36,7 @@ export async function getDomainRequestRecordExists( [DOMAIN_REQUESTS_COLUMNS.blindedMessage]: blindedMessage, }) .first() - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) return !!existingRequest }, [], @@ -58,7 +59,7 @@ export async function storeDomainRequestRecord( await domainRequests(db) .transacting(trx) .insert(toDomainRequestRecord(domain, blindedMessage)) - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) }, [], (err: any) => countAndThrowDBError(err, logger, ErrorMessage.DATABASE_INSERT_FAILURE), diff --git a/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-state.ts b/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-state.ts index 2c87d23db4..fd71b1fd97 100644 --- a/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-state.ts +++ b/packages/phone-number-privacy/signer/src/common/database/wrappers/domain-state.ts @@ -1,7 +1,8 @@ -import { DB_TIMEOUT, ErrorMessage } from '@celo/phone-number-privacy-common' +import { ErrorMessage } from '@celo/phone-number-privacy-common' import { Domain, domainHash } from '@celo/phone-number-privacy-common/lib/domains' import Logger from 'bunyan' import { Knex } from 'knex' +import { config } from '../../../config' import { Histograms, meter } from '../../metrics' import { DOMAIN_STATE_COLUMNS, @@ -29,7 +30,7 @@ export async function setDomainDisabled( .transacting(trx) .where(DOMAIN_STATE_COLUMNS.domainHash, hash) .update(DOMAIN_STATE_COLUMNS.disabled, true) - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) }, [], (err: any) => countAndThrowDBError(err, logger, ErrorMessage.DATABASE_UPDATE_FAILURE), @@ -71,7 +72,7 @@ export async function getDomainStateRecord( const result = await tableWithLockForTrx(domainStates(db), trx) .where(DOMAIN_STATE_COLUMNS.domainHash, hash) .first() - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) // bools are stored in db as ints (1 or 0), so we must cast them back if (result) { @@ -111,7 +112,7 @@ export async function updateDomainStateRecord( .transacting(trx) .where(DOMAIN_STATE_COLUMNS.domainHash, hash) .update(domainState) - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) } }, [], @@ -130,7 +131,7 @@ export async function insertDomainStateRecord( return meter( async () => { logger.debug({ domainState }, 'Insert domain state') - await domainStates(db).transacting(trx).insert(domainState).timeout(DB_TIMEOUT) + await domainStates(db).transacting(trx).insert(domainState).timeout(config.db.timeout) return domainState }, [], diff --git a/packages/phone-number-privacy/signer/src/common/database/wrappers/request.ts b/packages/phone-number-privacy/signer/src/common/database/wrappers/request.ts index 6e90960ffb..85e3d9b308 100644 --- a/packages/phone-number-privacy/signer/src/common/database/wrappers/request.ts +++ b/packages/phone-number-privacy/signer/src/common/database/wrappers/request.ts @@ -1,6 +1,7 @@ -import { DB_TIMEOUT, ErrorMessage } from '@celo/phone-number-privacy-common' +import { ErrorMessage } from '@celo/phone-number-privacy-common' import Logger from 'bunyan' import { Knex } from 'knex' +import { config } from '../../../config' import { Histograms, meter } from '../../metrics' import { PnpSignRequestRecord, @@ -33,7 +34,7 @@ export async function getRequestExists( [REQUESTS_COLUMNS.blindedQuery]: blindedQuery, }) .first() - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) return !!existingRequest }, [], @@ -57,7 +58,7 @@ export async function storeRequest( await requests(db, requestsTable) .transacting(trx) .insert(toPnpSignRequestRecord(account, blindedQuery)) - .timeout(DB_TIMEOUT) + .timeout(config.db.timeout) }, [], (err: any) => countAndThrowDBError(err, logger, ErrorMessage.DATABASE_INSERT_FAILURE), diff --git a/packages/phone-number-privacy/signer/src/config.ts b/packages/phone-number-privacy/signer/src/config.ts index 588a95dd3e..57b9da654a 100644 --- a/packages/phone-number-privacy/signer/src/config.ts +++ b/packages/phone-number-privacy/signer/src/config.ts @@ -1,6 +1,10 @@ import { BlockchainConfig, + DB_POOL_MAX_SIZE, + DB_TIMEOUT, FULL_NODE_TIMEOUT_IN_MS, + RETRY_COUNT, + RETRY_DELAY_IN_MS, toBool, } from '@celo/phone-number-privacy-common' import BigNumber from 'bignumber.js' @@ -69,6 +73,7 @@ export interface SignerConfig { port?: number ssl: boolean poolMaxSize: number + timeout: number } keystore: { type: SupportedKeystore @@ -99,6 +104,8 @@ export interface SignerConfig { timeout: number test_quota_bypass_percentage: number fullNodeTimeoutMs: number + fullNodeRetryCount: number + fullNodeRetryDelayMs: number } const env = process.env as any @@ -150,7 +157,8 @@ export const config: SignerConfig = { host: env.DB_HOST, port: env.DB_PORT ? Number(env.DB_PORT) : undefined, ssl: toBool(env.DB_USE_SSL, true), - poolMaxSize: env.DB_POOL_MAX_SIZE ?? 50, + poolMaxSize: Number(env.DB_POOL_MAX_SIZE ?? DB_POOL_MAX_SIZE), + timeout: Number(env.DB_TIMEOUT ?? DB_TIMEOUT), }, keystore: { type: env.KEYSTORE_TYPE, @@ -181,4 +189,6 @@ export const config: SignerConfig = { timeout: Number(env.ODIS_SIGNER_TIMEOUT ?? 5000), test_quota_bypass_percentage: Number(env.TEST_QUOTA_BYPASS_PERCENTAGE ?? 0), fullNodeTimeoutMs: Number(env.TIMEOUT_MS ?? FULL_NODE_TIMEOUT_IN_MS), + fullNodeRetryCount: Number(env.RETRY_COUNT ?? RETRY_COUNT), + fullNodeRetryDelayMs: Number(env.RETRY_DELAY_IN_MS ?? RETRY_DELAY_IN_MS), } diff --git a/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.legacy.ts b/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.legacy.ts index 7fd5ed0bb3..b35c5e2662 100644 --- a/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.legacy.ts +++ b/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.legacy.ts @@ -29,6 +29,8 @@ export class LegacyPnpQuotaIO extends IO { readonly enabled: boolean, readonly shouldFailOpen: boolean, readonly timeoutMs: number, + readonly fullNodeRetryCount: number, + readonly fullNodeRetryDelayMs: number, readonly kit: ContractKit ) { super(enabled) @@ -71,7 +73,9 @@ export class LegacyPnpQuotaIO extends IO { logger, this.shouldFailOpen, warnings, - this.timeoutMs + this.timeoutMs, + this.fullNodeRetryCount, + this.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.ts b/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.ts index 727ac3cdce..99900a4a70 100644 --- a/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.ts +++ b/packages/phone-number-privacy/signer/src/pnp/endpoints/quota/io.ts @@ -28,6 +28,8 @@ export class PnpQuotaIO extends IO { readonly enabled: boolean, readonly shouldFailOpen: boolean, readonly timeoutMs: number, + readonly fullNodeRetryCount: number, + readonly fullNodeRetryDelayMs: number, readonly kit: ContractKit ) { super(enabled) @@ -69,7 +71,9 @@ export class PnpQuotaIO extends IO { logger, this.shouldFailOpen, warnings, - this.timeoutMs + this.timeoutMs, + this.fullNodeRetryCount, + this.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.legacy.ts b/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.legacy.ts index f4617119f7..68a3920c38 100644 --- a/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.legacy.ts +++ b/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.legacy.ts @@ -33,6 +33,8 @@ export class LegacyPnpSignIO extends IO { readonly enabled: boolean, readonly shouldFailOpen: boolean, readonly timeoutMs: number, + readonly fullNodeRetryCount: number, + readonly fullNodeRetryDelayMs: number, readonly kit: ContractKit ) { super(enabled) @@ -83,7 +85,9 @@ export class LegacyPnpSignIO extends IO { logger, this.shouldFailOpen, warnings, - this.timeoutMs + this.timeoutMs, + this.fullNodeRetryCount, + this.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.ts b/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.ts index 6761fd797d..c8833344ee 100644 --- a/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.ts +++ b/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/io.ts @@ -32,6 +32,8 @@ export class PnpSignIO extends IO { readonly enabled: boolean, readonly shouldFailOpen: boolean, readonly timeoutMs: number, + readonly fullNodeRetryCount: number, + readonly fullNodeRetryDelayMs: number, readonly kit: ContractKit ) { super(enabled) @@ -79,7 +81,9 @@ export class PnpSignIO extends IO { logger, this.shouldFailOpen, warnings, - this.timeoutMs + this.timeoutMs, + this.fullNodeRetryCount, + this.fullNodeRetryDelayMs ) } diff --git a/packages/phone-number-privacy/signer/src/server.ts b/packages/phone-number-privacy/signer/src/server.ts index 19558bfc39..ff0f20104f 100644 --- a/packages/phone-number-privacy/signer/src/server.ts +++ b/packages/phone-number-privacy/signer/src/server.ts @@ -99,6 +99,8 @@ export function startSigner( config.api.phoneNumberPrivacy.enabled, config.api.phoneNumberPrivacy.shouldFailOpen, // TODO (https://github.com/celo-org/celo-monorepo/issues/9862) consider refactoring config to make the code cleaner config.fullNodeTimeoutMs, + config.fullNodeRetryCount, + config.fullNodeRetryDelayMs, kit ) ) @@ -113,6 +115,8 @@ export function startSigner( config.api.phoneNumberPrivacy.enabled, config.api.phoneNumberPrivacy.shouldFailOpen, config.fullNodeTimeoutMs, + config.fullNodeRetryCount, + config.fullNodeRetryDelayMs, kit ) ) @@ -127,6 +131,8 @@ export function startSigner( config.api.legacyPhoneNumberPrivacy.enabled, config.api.legacyPhoneNumberPrivacy.shouldFailOpen, config.fullNodeTimeoutMs, + config.fullNodeRetryCount, + config.fullNodeRetryDelayMs, kit ) ) @@ -139,6 +145,8 @@ export function startSigner( config.api.legacyPhoneNumberPrivacy.enabled, config.api.legacyPhoneNumberPrivacy.shouldFailOpen, config.fullNodeTimeoutMs, + config.fullNodeRetryCount, + config.fullNodeRetryDelayMs, kit ) )