Skip to content

Commit

Permalink
Merge branch 'master' into aaronmgdr/stake-off-touchups
Browse files Browse the repository at this point in the history
* master:
  Update docker image and instructions (#2000)
  DOCS correct typos (#1965)
  Add a space on payment request (#1935)
  expose signer through getValidator (#1997)
  Fix validator election migration bug with sorted list insertion (#1998)
  Deploy an oracle cronjob (#1814)
  Set default env in attestation service docker image as production (#1999)
  Attestation Bot POC (#1851)
  Only allow external RPCs for tx nodes (#1994)
  • Loading branch information
aaronmgdr committed Dec 3, 2019
2 parents ca297d6 + 5873d50 commit a7c2060
Show file tree
Hide file tree
Showing 53 changed files with 1,170 additions and 166 deletions.
10 changes: 10 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="master"
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"

# Schedule for an oracle deployed via celotool, expressed in crontab syntax
# This schedule is "every 5th minute"
ORACLE_CRON_SCHEDULE="*/5 * * * *"

ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="default"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-d3d165a7db548d175cd703c86c20c1657c04368d"

Expand Down
10 changes: 10 additions & 0 deletions .env.alfajores
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="9575a01c12438e1adc6bb610c891cb5066aaa7aa"
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-552b1accf90404fdcd886670d150af0a5cae116f"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"

# Schedule for an oracle deployed via celotool, expressed in crontab syntax
# This schedule is "every 5th minute"
ORACLE_CRON_SCHEDULE="*/5 * * * *"

ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="default"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-552b1accf90404fdcd886670d150af0a5cae116f"

Expand Down
10 changes: 10 additions & 0 deletions .env.alfajoresstaging
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="9575a01c12438e1adc6bb610c891cb5066aaa7aa"
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-552b1accf90404fdcd886670d150af0a5cae116f"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"

# Schedule for an oracle deployed via celotool, expressed in crontab syntax
# This schedule is "every 5th minute"
ORACLE_CRON_SCHEDULE="*/5 * * * *"

ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="default"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-552b1accf90404fdcd886670d150af0a5cae116f"

Expand Down
107 changes: 107 additions & 0 deletions .env.baklavastaging
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Don't use "//" for comments in this file.
# This file is meant to be executed as a bash script for testing.
ENV_TYPE="staging"

GETH_VERBOSITY=2

VM_BASED=true

KUBERNETES_CLUSTER_NAME="baklavastaging"
KUBERNETES_CLUSTER_ZONE="us-west1-a"
CLUSTER_DOMAIN_NAME="celo-testnet"

TESTNET_PROJECT_NAME="celo-testnet"

BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout"
BLOCKSCOUT_DOCKER_IMAGE_TAG="c42d9c2f3ef5e79c152c44a82fa0f12233dcfb5c"
BLOCKSCOUT_WEB_REPLICAS=3
# Increment this value everytime you redeploy blockscout. Or else the deployment will fail due to the
# existing database.
BLOCKSCOUT_DB_SUFFIX="0"
BLOCKSCOUT_SUBNETWORK_NAME="Baklava Staging"

ETHSTATS_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/ethstats"
ETHSTATS_DOCKER_IMAGE_TAG="bbc89603d872af1c6b37cf00e8220ed26237fc91"
ETHSTATS_TRUSTED_ADDRESSES=""
ETHSTATS_BANNED_ADDRESSES=""

GETH_NODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth"
# When upgrading change this to latest commit hash from the master of the geth repo
# `geth $ git show | head -n 1`
GETH_NODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d"

GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/geth-all"
# When upgrading change this to latest commit hash from the master of the geth repo
# `geth $ git show | head -n 1`
GETH_BOOTNODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d"

CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-51ae8e72be34a614346950b6fbd8ba3b94223947"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"

# Schedule for an oracle deployed via celotool, expressed in crontab syntax
# This schedule is "every 5th minute"
ORACLE_CRON_SCHEDULE="*/5 * * * *"

ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="baklavastaging"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-51ae8e72be34a614346950b6fbd8ba3b94223947"

ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84"

GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter"
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261"

# Genesis Vars
NETWORK_ID=31416
CONSENSUS_TYPE="istanbul"
BLOCK_TIME=5
# Minimum epoch length is 15 minutes
EPOCH=180
LOOKBACK=12
ISTANBUL_REQUEST_TIMEOUT_MS=10000

# the number of load test clients that will be given funds in the genesis & migrations
LOAD_TEST_CLIENTS=10
# every 3.6 seconds, so that 1000 transactions are sent by a client every hour
LOAD_TEST_TX_DELAY_MS=3600

VALIDATORS=70
PROXIED_VALIDATORS=35
TX_NODES=5
# STATIC_IPS_FOR_GETH_NODES=false
# Whether tx_nodes/validators stateful set should use ssd persistent disks
# GETH_NODES_SSD_DISKS=true
IN_MEMORY_DISCOVERY_TABLE=false
# PING_IP_FROM_PACKET=false

# Testnet vars
# GETH_NODES_BACKUP_CRONJOB_ENABLED=true
# CONTRACT_CRONJOBS_ENABLED=true
CLUSTER_CREATION_FLAGS="--enable-autoscaling --min-nodes 3 --max-nodes 8 --machine-type=n1-standard-4"


GETH_NODE_CPU_REQUEST=400m
GETH_NODE_MEMORY_REQUEST=2.5G

VERIFICATION_POOL_URL="https://us-central1-celo-testnet.cloudfunctions.net/handleVerificationRequestbaklavastaging/v0.1/sms/"
VERIFICATION_REWARDS_URL="https://us-central1-celo-testnet.cloudfunctions.net/handleVerificationRequestbaklavastaging/v0.1/rewards/"

STACKDRIVER_MONITORING_DASHBOARD="https://app.google.stackdriver.com/dashboards/11713866848730522797?project=celo-testnet"
STACKDRIVER_NOTIFICATION_CHANNEL_APPLICATIONS="12047595356119796119"
STACKDRIVER_NOTIFICATION_CHANNEL_PROTOCOL="12047595356119796119"
STACKDRIVER_NOTIFICATION_APPLICATIONS_PREFIX="notification-service-,blockchain-api-,faucet-"

MOBILE_WALLET_PLAYSTORE_LINK="https://play.google.com/apps/internaltest/4700990475000634666"

# NOTIFICATION_SERVICE_FIREBASE_DB="https://console.firebase.google.com/u/0/project/celo-org-mobile/database/celo-org-mobile-int/data"

PROMTOSD_SCRAPE_INTERVAL="5m"
PROMTOSD_EXPORT_INTERVAL="5m"

SMS_RETRIEVER_HASH_CODE=l5k6LvdPDXS
10 changes: 10 additions & 0 deletions .env.integration
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="09a217ff58a95214cbc5189c933359707f4fdaf2"
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-5bea6d30cbe6aa4272b32a4d2cfed5567f422ea9"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"

# Schedule for an oracle deployed via celotool, expressed in crontab syntax
# This schedule is "every 5th minute"
ORACLE_CRON_SCHEDULE="*/5 * * * *"

ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="default"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-5bea6d30cbe6aa4272b32a4d2cfed5567f422ea9"

Expand Down
2 changes: 2 additions & 0 deletions dockerfiles/attestation-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ COPY packages/protocol packages/protocol/
COPY packages/contractkit packages/contractkit/
COPY packages/attestation-service packages/attestation-service/

ENV NODE_ENV production

# build all
RUN yarn build

Expand Down
15 changes: 15 additions & 0 deletions dockerfiles/cli-standalone/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:10-alpine

RUN apk update && apk add python git make gcc g++ bash

RUN adduser -D -S celo

USER celo

RUN mkdir /home/celo/.npm-global
ENV PATH=/home/celo/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/celo/.npm-global

WORKDIR /home/celo/

RUN npm install -g @celo/celocli@0.0.30-beta2
2 changes: 1 addition & 1 deletion packages/attestation-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"lint": "tslint -c tslint.json --project ."
},
"dependencies": {
"@celo/contractkit": "0.2.1-dev",
"@celo/contractkit": "0.2.3-dev",
"@celo/utils": "^0.1.0",
"bignumber.js": "^7.2.0",
"body-parser": "1.19.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/celotool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@celo/verification-pool-api": "^1.0.0",
"@celo/utils": "^0.1.0",
"@celo/walletkit": "^0.0.14",
"@celo/contractkit": "0.2.1-dev",
"@celo/contractkit": "0.2.3-dev",
"@google-cloud/monitoring": "0.7.1",
"@google-cloud/pubsub": "^0.28.1",
"@google-cloud/storage": "^2.4.3",
Expand Down
55 changes: 12 additions & 43 deletions packages/celotool/src/cmds/account/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import {
ActionableAttestation,
AttestationsWrapper,
} from '@celo/contractkit/lib/wrappers/Attestations'
import { concurrentMap } from '@celo/utils/lib/async'
import { base64ToHex } from '@celo/utils/lib/attestations'
import prompts from 'prompts'
import {
printAndIgnoreRequestErrors,
requestAttestationsFromIssuers,
requestMoreAttestations,
} from 'src/lib/attestation'
import { switchToClusterFromEnv } from 'src/lib/cluster'
import yargs from 'yargs'

Expand Down Expand Up @@ -82,8 +86,13 @@ async function verifyCmd(argv: VerifyArgv) {
attestationsToComplete = await attestations.getActionableAttestations(argv.phone, account)
// Find attestations we can verify
console.info(`Requesting ${attestationsToComplete.length} attestations from issuers`)
await requestAttestationsFromIssuers(attestationsToComplete, attestations, argv.phone, account)

const possibleErrors = await requestAttestationsFromIssuers(
attestationsToComplete,
attestations,
argv.phone,
account
)
printAndIgnoreRequestErrors(possibleErrors)
await promptForCodeAndVerify(attestations, argv.phone, account)
}

Expand All @@ -101,46 +110,6 @@ export async function printCurrentCompletedAttestations(
)
}

async function requestMoreAttestations(
attestations: AttestationsWrapper,
phoneNumber: string,
attestationsRequested: number,
account: string
) {
await attestations
.approveAttestationFee(attestationsRequested)
.then((txo) => txo.sendAndWaitForReceipt())
await attestations
.request(phoneNumber, attestationsRequested)
.then((txo) => txo.sendAndWaitForReceipt())
await attestations.waitForSelectingIssuers(phoneNumber, account)
await attestations.selectIssuers(phoneNumber).then((txo) => txo.sendAndWaitForReceipt())
}

async function requestAttestationsFromIssuers(
attestationsToReveal: ActionableAttestation[],
attestations: AttestationsWrapper,
phoneNumber: string,
account: string
) {
return concurrentMap(5, attestationsToReveal, async (attestation) => {
try {
const response = await attestations.revealPhoneNumberToIssuer(
phoneNumber,
account,
attestation.issuer,
attestation.attestationServiceURL
)
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}: ${await response.text()}`)
}
} catch (error) {
console.error(`Error requesting attestations from issuer ${attestation.issuer}`)
console.error(error)
}
})
}

async function verifyCode(
attestations: AttestationsWrapper,
base64Code: string,
Expand Down
15 changes: 15 additions & 0 deletions packages/celotool/src/cmds/bots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import yargs from 'yargs'

export const command = 'bots <command>'

export const describe = 'various bots we have'

export type BotsArgv = yargs.Argv

export const builder = (argv: yargs.Argv) => {
return argv.commandDir('bots', { extensions: ['ts'] })
}

export const handler = () => {
// empty
}
Loading

0 comments on commit a7c2060

Please sign in to comment.