Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odis crypto op metering #10461

Merged
merged 5 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.rc1
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ AZURE_ORACLE_WESTUS_CELOUSD_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x0aee051be85ba9c7c1
AZURE_ORACLE_WESTUS_CELOEUR_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0xb8bDBfdd591a5be5980983A7ba1710a5F46f42B5:mainnet-eur-oracle-wus2:mainnet-oracles-westus2,0x929Ad7f2b781CE830014E824CA2eF0b7b8de87C2:mainnet-eur-oracle-wus3:mainnet-oracles-westus2,0xCCC0B54edD8dAe3c15b5C002dd5d348495d4f7fe:mainnet-eur-oracle-wus4:mainnet-oracles-westus2
AZURE_ORACLE_WESTUS_CELOBRL_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x57d8a7bf9e7f4113c49e077b140fd8e1d7f78a76:mainnet-brl-oracle-wus0:mainnet-oracles-westus2,0x1299dd007cd5120262e546dca893e30d1cff8a10:mainnet-brl-oracle-wus1:mainnet-oracles-westus2,0x116951e440aee97a328614f9937710c9bb2f0839:mainnet-brl-oracle-wus4:mainnet-oracles-westus2
AZURE_ORACLE_WESTUS_USDCUSD_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x2986c21824c9b804d170270a316ceb07149f79c5:mainnet-usdcusd-wus0,0x09e2e47bb5df7b3464407746970a65c7b02883b3:mainnet-usdcusd-wus1,0xd5e7454932f6e853af849f70044570b62ca2596e:mainnet-usdcusd-wus2,0xfe3276b7142dee2cda34b1d14852eb32f436483d:mainnet-usdcusd-wus3
AZURE_ORACLE_WESTUS_USDCEUR_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0xeccd1e9439094d025ac7d08d16b0bfe0da3bea53:mainnet-usdceur-wus0,0x9b242d2bd848fc92060ca7546033c3af352583d2:mainnet-usdceur-wus1,0x905ab001a9199d45c3f5c7b055b65ace5fc7d70a:mainnet-usdceur-wus2,0xdf5dd31d8f78520185d6a9fb0498c4bbddfe0708:mainnet-usdceur-wus3
AZURE_ORACLE_WESTUS_USDCBRL_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x8dba01f832c7b0bb5f0bad4efe181cc07f8b322e:mainnet-usdcbrl-wus0,0xffb417d009d09bd1140244e70babbaa52d69ec84:mainnet-usdcbrl-wus1,0x5f755b8350a2e6b8b042cb3e052580e4c5b0ac35:mainnet-usdcbrl-wus2,0x8e1349b48ee82ef5437c912662e6640f3590c6f9:mainnet-usdcbrl-wus3
AZURE_ORACLE_WESTUS_FULL_NODES_COUNT=5
AZURE_ORACLE_WESTUS_FULL_NODES_ROLLING_UPDATE_PARTITION=0
AZURE_ORACLE_WESTUS_FULL_NODES_DISK_SIZE=100
Expand All @@ -101,6 +103,8 @@ AZURE_ORACLE_WESTEUROPE_CELOUSD_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0xfe9925e6ae9c4c
AZURE_ORACLE_WESTEUROPE_CELOEUR_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x87C45738DAd8Dc3D2b1cCe779E0766329cc408C6:mainnet-eur-oracle-weu0:mainnet-oracles-westeurope,0xeF1E143C554EFC43B0537Af00Ac27C828dE6cF8D:mainnet-eur-oracle-weu1:mainnet-oracles-westeurope,0xF4B4AA107F30206EA019DE145A9b778a220f9fc0:mainnet-eur-oracle-weu2:mainnet-oracles-westeurope,0x24c303e6395DD19806F739619960A311764e3F40:mainnet-eur-oracle-weu3:mainnet-oracles-westeurope,0xDA413875FB45E5905950Bc08a908ebD246Ee6581:mainnet-eur-oracle-weu5:mainnet-oracles-westeurope
AZURE_ORACLE_WESTEUROPE_CELOBRL_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x3b91bbb873f3b979bd6671dc018d5fc1848882dd:mainnet-brl-oracle-weu0:mainnet-oracles-westeurope,0xc3994b2af0e82490e432d49e9f2246cdfd84da8f:mainnet-brl-oracle-weu1:mainnet-oracles-westeurope,0x9b376b33c33325332df8c6ca951a9896889a6d1e:mainnet-brl-oracle-weu2:mainnet-oracles-westeurope,0x554ba7f4d200c7b233b93b7f2223bc1ea7c467fd:mainnet-brl-oracle-weu3:mainnet-oracles-westeurope,0x535cea1834d6b52e4e9724642fdd7008f569ba5c:mainnet-brl-oracle-weu4:mainnet-oracles-westeurope
AZURE_ORACLE_WESTEUROPE_USDCUSD_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x477185291403ca2ed5f56d59ed0d568a16222013:mainnet-usdcusd-weu0,0x9a0a52d483c62df76d54f41ab3283cc7cb41ba91:mainnet-usdcusd-weu1,0x2ddb86898a2c2c884fc5cc3ca344898b0170a00d:mainnet-usdcusd-weu2,0x79be0a692e3a4bcd22b96c3e93a108b485becbb2:mainnet-usdcusd-weu3
AZURE_ORACLE_WESTEUROPE_USDCEUR_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x0781f530100e619936f5b427263441cb0414f885:mainnet-usdceur-weu0,0x55de75fd0c2b37987757172fef7ba2ea935d284d:mainnet-usdceur-weu1,0xdc0c15fa73b13b2e74cd3eced23d8826569904c5:mainnet-usdceur-weu2,0x9048872f739cebbe72825763a1b72064c4df8f1f:mainnet-usdceur-weu3
AZURE_ORACLE_WESTEUROPE_USDCBRL_ORACLE_ADDRESS_AZURE_KEY_VAULTS=0x42b813b9ff8ce8f4837accea26bedda20d7c4982:mainnet-usdcbrl-weu0,0x09208127500963ee1c3af88bfbb3ef0cd34d6eb0:mainnet-usdcbrl-weu1,0xa8f5be092a8452eab98ed1c220d642114bb2731e:mainnet-usdcbrl-weu2,0xfd265c994a5a9c2847fe03a5e878648963f53a37:mainnet-usdcbrl-weu3
AZURE_ORACLE_WESTEUROPE_FULL_NODES_COUNT=5
AZURE_ORACLE_WESTEUROPE_FULL_NODES_ROLLING_UPDATE_PARTITION=0
AZURE_ORACLE_WESTEUROPE_FULL_NODES_DISK_SIZE=100
Expand Down Expand Up @@ -534,4 +538,4 @@ AZURE_KOMENCI_SEA_KOMENCI_NETWORK=rc1
WALLET_CONNECT_IMAGE_REPOSITORY='us.gcr.io/celo-testnet/walletconnect'
WALLET_CONNECT_IMAGE_TAG='1472bcaad57e3746498f7a661c42ff5cf9acaf5a'
WALLET_CONNECT_REDIS_CLUSTER_ENABLED=false
WALLET_CONNECT_REDIS_CLUSTER_USEPASSWORD=false
WALLET_CONNECT_REDIS_CLUSTER_USEPASSWORD=false
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ErrorMessage, KeyVersionInfo } from '@celo/phone-number-privacy-common'
import Logger from 'bunyan'
import { performance } from 'perf_hooks'

export interface ServicePartialSignature {
url: string
Expand Down Expand Up @@ -38,7 +39,17 @@ export abstract class CryptoClient {
`${ErrorMessage.NOT_ENOUGH_PARTIAL_SIGNATURES} ${this.allSignaturesLength}/${threshold}`
)
}
return this._combineBlindedSignatureShares(blindedMessage, logger)

const start = `Start combineBlindedSignatureShares`
const end = `End combineBlindedSignatureShares`
performance.mark(start)

const combinedSignature = this._combineBlindedSignatureShares(blindedMessage, logger)

performance.mark(end)
performance.measure('combineBlindedSignatureShares', start, end)

return combinedSignature
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { computeBlindedSignature } from '../../../common/bls/bls-cryptography-cl
import { REQUESTS_TABLE } from '../../../common/database/models/request'
import { getRequestExists } from '../../../common/database/wrappers/request'
import { DefaultKeyName, Key, KeyProvider } from '../../../common/key-management/key-provider-base'
import { Counters } from '../../../common/metrics'
import { Counters, Histograms, meter } from '../../../common/metrics'
import { SignerConfig } from '../../../config'
import { PnpQuotaService } from '../../services/quota'
import { PnpSession } from '../../session'
Expand Down Expand Up @@ -113,10 +113,14 @@ export class PnpSignAction implements Action<SignMessageRequest> {
}

try {
const signature = await this.sign(
session.request.body.blindedQueryPhoneNumber,
key,
session
const signature = await meter(
this.sign.bind(this),
[session.request.body.blindedQueryPhoneNumber, key, session],
(err: any) => {
throw err
},
Histograms.getBlindedSigInstrumentation,
['sign']
)
this.io.sendSuccess(200, session.response, key, signature, quotaStatus, session.errors)
return
Expand Down
7 changes: 5 additions & 2 deletions packages/sdk/contractkit/src/wrappers/Governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ export class GovernanceWrapper extends BaseWrapperForGoverning<Governance> {
* @param proposal Proposal to determine the constitution for running.
*/
async getConstitution(proposal: Proposal): Promise<BigNumber> {
let constitution = new BigNumber(0)
// Default value that is harcoded on Governance contract
// it's 0.5 in Fixidity
// https://github.com/celo-org/celo-monorepo/blob/3fffa158d67ffd6366e81ba7243eadede1974b1b/packages/protocol/contracts/governance/Governance.sol#L39
let constitution = fromFixed(new BigNumber('500000000000000000000000'))
for (const tx of proposal) {
constitution = BigNumber.max(await this.getTransactionConstitution(tx), constitution)
}
Expand All @@ -236,7 +239,7 @@ export class GovernanceWrapper extends BaseWrapperForGoverning<Governance> {
// in the total of yes votes required
async getSupportWithConstitutionThreshold(proposalID: BigNumber.Value, constitution: BigNumber) {
const support = await this.getSupport(proposalID)
support.required = support.required.times(constitution)
support.required = support.required.times(constitution).integerValue()
return support
}

Expand Down