From f12411f7380d29953fb82811c0600189e6d9f283 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 18 Nov 2019 19:54:52 +0100 Subject: [PATCH 01/18] add helm chart for oracle cronjob --- packages/helm-charts/oracle/.helmignore | 22 +++++ packages/helm-charts/oracle/Chart.yaml | 5 ++ .../oracle/templates/oracle.cronjob.yaml | 81 +++++++++++++++++++ .../oracle/templates/oracle.secret.yaml | 12 +++ packages/helm-charts/oracle/values.yaml | 2 + 5 files changed, 122 insertions(+) create mode 100644 packages/helm-charts/oracle/.helmignore create mode 100644 packages/helm-charts/oracle/Chart.yaml create mode 100644 packages/helm-charts/oracle/templates/oracle.cronjob.yaml create mode 100644 packages/helm-charts/oracle/templates/oracle.secret.yaml create mode 100644 packages/helm-charts/oracle/values.yaml diff --git a/packages/helm-charts/oracle/.helmignore b/packages/helm-charts/oracle/.helmignore new file mode 100644 index 00000000000..50af0317254 --- /dev/null +++ b/packages/helm-charts/oracle/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/packages/helm-charts/oracle/Chart.yaml b/packages/helm-charts/oracle/Chart.yaml new file mode 100644 index 00000000000..10ccf946e82 --- /dev/null +++ b/packages/helm-charts/oracle/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: oracle +version: 0.1.0 diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml new file mode 100644 index 00000000000..04402dcd01d --- /dev/null +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -0,0 +1,81 @@ +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ .Release.Name }} + labels: + app: oracle + chart: oracle + release: {{ .Release.Service }} + component: oracle +spec: + schedule: "*/1 * * * *" + concurrencyPolicy: Forbid + jobTemplate: + spec: + backoffLimit: 1 + template: + spec: + initContainers: + - name: get-current-price + image: gcr.io/celo-testnet/oracle:{{ .Release.Namespace }} + imagePullPolicy: IfNotPresent + command: + - sh + - "-c" + - | + echo `python get_rate_for_now.py oracle_rates.csv` > /root/.celo/current_price + volumeMounts: + - name: data + mountPath: /root/.celo + - name: celo-tool + image: gcr.io/celo-testnet/celo-monorepo:celotool-8189da8a150aaa80e325316f45009218765d6e43 + imagePullPolicy: IfNotPresent + command: ["/bin/sh"] + # TODO: use price_oracle account type + args: + - "-c" + - | + echo "getting the oracle key + account" + echo 'current price:' + celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType attestation --index 0 > /root/.celo/pkey + volumeMounts: + - name: data + mountPath: /root/.celo + env: + - name: MNEMONIC + valueFrom: + secretKeyRef: + name: {{ .Release.Name }} + key: MNEMONIC + containers: + - name: report-price + image: gcr.io/celo-testnet/celocli-standalone:yerduaoracletest + imagePullPolicy: IfNotPresent + command: ["/bin/sh"] + args: + - "-c" + - | + echo "running the celocli container" + echo 'current price:' + PRICE=`cat /root/.celo/current_price` + echo $PRICE + PK=`cat /root/.celo/pkey` + echo "key is:" + echo $PK + alias celocli='node_modules/@celo/celocli/bin/run' + celocli config:get + volumeMounts: + - name: data + mountPath: /root/.celo + env: + - name: MNEMONIC + valueFrom: + secretKeyRef: + name: {{ .Release.Name }} + key: MNEMONIC + restartPolicy: Never + volumes: + - name: data + emptyDir: {} + + \ No newline at end of file diff --git a/packages/helm-charts/oracle/templates/oracle.secret.yaml b/packages/helm-charts/oracle/templates/oracle.secret.yaml new file mode 100644 index 00000000000..dac777fb212 --- /dev/null +++ b/packages/helm-charts/oracle/templates/oracle.secret.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }} + labels: + app: oracle + chart: oracle + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + MNEMONIC: {{ .Values.mnemonic | b64enc | quote }} \ No newline at end of file diff --git a/packages/helm-charts/oracle/values.yaml b/packages/helm-charts/oracle/values.yaml new file mode 100644 index 00000000000..5009c7f3091 --- /dev/null +++ b/packages/helm-charts/oracle/values.yaml @@ -0,0 +1,2 @@ +nodeSelector: {} + From f3c0616f3710367874366e9ec650f4bfea3ddedb Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 18 Nov 2019 19:56:07 +0100 Subject: [PATCH 02/18] celotool command for deploying an oracle job (WIP) --- .../celotool/src/cmds/deploy/initial/oracle.ts | 17 +++++++++++++++++ packages/celotool/src/lib/oracle.ts | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 packages/celotool/src/cmds/deploy/initial/oracle.ts create mode 100644 packages/celotool/src/lib/oracle.ts diff --git a/packages/celotool/src/cmds/deploy/initial/oracle.ts b/packages/celotool/src/cmds/deploy/initial/oracle.ts new file mode 100644 index 00000000000..367dcee8772 --- /dev/null +++ b/packages/celotool/src/cmds/deploy/initial/oracle.ts @@ -0,0 +1,17 @@ +import { InitialArgv } from 'src/cmds/deploy/initial' +import { switchToClusterFromEnv } from 'src/lib/cluster' +import { installHelmChart } from 'src/lib/oracle' +import yargs from 'yargs' + +export const command = 'oracle' + +export const describe = 'deploy the oracle for the specified network' + +export const builder = (argv: yargs.Argv) => { + return argv +} + +export const handler = async (argv: InitialArgv) => { + await switchToClusterFromEnv() + await installHelmChart(argv.celoEnv) +} diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts new file mode 100644 index 00000000000..5e398cdc399 --- /dev/null +++ b/packages/celotool/src/lib/oracle.ts @@ -0,0 +1,16 @@ +import { envVar, fetchEnv } from 'src/lib/env-utils' +import { installGenericHelmChart } from 'src/lib/helm_deploy' + +const helmChartPath = '../helm-charts/oracle' + +export async function installHelmChart(celoEnv: string) { + return installGenericHelmChart(celoEnv, releaseName(celoEnv), helmChartPath, helmParameters()) +} + +function helmParameters() { + return [`--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`] +} + +function releaseName(celoEnv: string) { + return `${celoEnv}-oracle` +} From e7710d4f0459aa216f722bda6a9e2d55698989b8 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Wed, 20 Nov 2019 16:31:15 +0100 Subject: [PATCH 03/18] more helm chart work --- packages/celotool/src/lib/attestation-service.ts | 1 - packages/celotool/src/lib/oracle.ts | 8 +++++++- .../helm-charts/oracle/templates/oracle.cronjob.yaml | 11 ++++------- packages/helm-charts/oracle/values.yaml | 2 ++ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/celotool/src/lib/attestation-service.ts b/packages/celotool/src/lib/attestation-service.ts index 4bea856f58f..bef21c322e6 100644 --- a/packages/celotool/src/lib/attestation-service.ts +++ b/packages/celotool/src/lib/attestation-service.ts @@ -46,7 +46,6 @@ async function helmParameters(celoEnv: string) { envVar.ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY )}`, `--set attestation_service.image.tag=${fetchEnv(envVar.ATTESTATION_SERVICE_DOCKER_IMAGE_TAG)}`, - `--set attestation_service.image.tag=${fetchEnv(envVar.ATTESTATION_SERVICE_DOCKER_IMAGE_TAG)}`, `--set attestation_service.nexmo.apiKey="${fetchEnv(envVar.NEXMO_KEY)}"`, `--set attestation_service.nexmo.apiSecret="${fetchEnv(envVar.NEXMO_SECRET)}"`, `--set attestation_service.sms_retriever_hash_code="${fetchEnv( diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index 5e398cdc399..6c64fb7f860 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -8,7 +8,13 @@ export async function installHelmChart(celoEnv: string) { } function helmParameters() { - return [`--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`] + return [ + `--set celotool.image.repository=${fetchEnv('CELOTOOL_DOCKER_IMAGE_REPOSITORY')}`, + `--set celotool.image.tag=${fetchEnv('CELOTOOL_DOCKER_IMAGE_TAG')}`, + `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, + `--set oracle.image.repository=${fetchEnv('ORACLE_DOCKER_IMAGE_REPOSITORY')}`, + `--set oracle.image.tag=${fetchEnv('ORACLE_DOCKER_IMAGE_TAG')}`, + ] } function releaseName(celoEnv: string) { diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml index 04402dcd01d..38e0c6d6476 100644 --- a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -8,7 +8,7 @@ metadata: release: {{ .Release.Service }} component: oracle spec: - schedule: "*/1 * * * *" + schedule: {{ .Values.oracleSchedule }} concurrencyPolicy: Forbid jobTemplate: spec: @@ -27,17 +27,14 @@ spec: volumeMounts: - name: data mountPath: /root/.celo - - name: celo-tool - image: gcr.io/celo-testnet/celo-monorepo:celotool-8189da8a150aaa80e325316f45009218765d6e43 + - name: get-account + image: {{ .Values.celotool.image.repository }}:{{ .Values.celotool.image.tag }} imagePullPolicy: IfNotPresent command: ["/bin/sh"] - # TODO: use price_oracle account type args: - "-c" - | - echo "getting the oracle key + account" - echo 'current price:' - celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType attestation --index 0 > /root/.celo/pkey + celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType price_oracle --index 0 > /root/.celo/pkey volumeMounts: - name: data mountPath: /root/.celo diff --git a/packages/helm-charts/oracle/values.yaml b/packages/helm-charts/oracle/values.yaml index 5009c7f3091..e6c818c558c 100644 --- a/packages/helm-charts/oracle/values.yaml +++ b/packages/helm-charts/oracle/values.yaml @@ -1,2 +1,4 @@ nodeSelector: {} +# Expects cron schedule syntax +oracleSchedule: "*/1 * * * *" \ No newline at end of file From 19f0e695f4f4937399d7e2130c79770dbda761a8 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Wed, 20 Nov 2019 19:18:51 +0100 Subject: [PATCH 04/18] move some values into .env. add a dockerfile for a standalone cli image without geth --- .env | 6 ++++++ dockerfiles/cli-standalone/Dockerfile | 7 +++++++ packages/celotool/src/lib/endpoints.ts | 4 ++++ packages/celotool/src/lib/oracle.ts | 14 +++++++++++--- .../oracle/templates/oracle.cronjob.yaml | 16 +++++++--------- 5 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 dockerfiles/cli-standalone/Dockerfile diff --git a/.env b/.env index bcea7390578..58c0db2197a 100644 --- a/.env +++ b/.env @@ -36,6 +36,12 @@ 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" +# TODO (yerdua): Change this to something actually reasonable +CELOCLI_STANDALONE_IMAGE_TAG="yerduaoracletest" + +ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" + TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-d3d165a7db548d175cd703c86c20c1657c04368d" diff --git a/dockerfiles/cli-standalone/Dockerfile b/dockerfiles/cli-standalone/Dockerfile new file mode 100644 index 00000000000..c5221dccc2c --- /dev/null +++ b/dockerfiles/cli-standalone/Dockerfile @@ -0,0 +1,7 @@ +FROM node:10-alpine + +RUN apk update && apk add python git make gcc g++ + +WORKDIR /celo/ + +RUN npm install @celo/celocli@0.0.29 diff --git a/packages/celotool/src/lib/endpoints.ts b/packages/celotool/src/lib/endpoints.ts index 13597b9be35..0c56bbd1fb7 100644 --- a/packages/celotool/src/lib/endpoints.ts +++ b/packages/celotool/src/lib/endpoints.ts @@ -15,3 +15,7 @@ export function getEthstatsUrl(argv: CeloEnvArgv) { export function getBlockchainApiUrl(argv: CeloEnvArgv) { return `https://${argv.celoEnv}-dot-${fetchEnv(envVar.TESTNET_PROJECT_NAME)}.appspot.com` } + +export function getFornoUrl(celoEnv: string) { + return `https://${celoEnv}-forno.${fetchEnv(envVar.CLUSTER_DOMAIN_NAME)}.org` +} diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index 6c64fb7f860..894f228476e 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -1,19 +1,27 @@ +import { getFornoUrl } from 'src/lib/endpoints' import { envVar, fetchEnv } from 'src/lib/env-utils' import { installGenericHelmChart } from 'src/lib/helm_deploy' const helmChartPath = '../helm-charts/oracle' export async function installHelmChart(celoEnv: string) { - return installGenericHelmChart(celoEnv, releaseName(celoEnv), helmChartPath, helmParameters()) + return installGenericHelmChart( + celoEnv, + releaseName(celoEnv), + helmChartPath, + helmParameters(celoEnv) + ) } -function helmParameters() { +function helmParameters(celoEnv: string) { return [ `--set celotool.image.repository=${fetchEnv('CELOTOOL_DOCKER_IMAGE_REPOSITORY')}`, `--set celotool.image.tag=${fetchEnv('CELOTOOL_DOCKER_IMAGE_TAG')}`, `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, `--set oracle.image.repository=${fetchEnv('ORACLE_DOCKER_IMAGE_REPOSITORY')}`, - `--set oracle.image.tag=${fetchEnv('ORACLE_DOCKER_IMAGE_TAG')}`, + `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, + `--set celocli.image.repository=${fetchEnv('CELOCLI_STANDALONE_IMAGE_REPOSITORY')}`, + `--set celocli.image.tag=${fetchEnv('CELOCLI_STANDALONE_IMAGE_TAG')}`, ] } diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml index 38e0c6d6476..0bdd11fc2f4 100644 --- a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -8,7 +8,7 @@ metadata: release: {{ .Release.Service }} component: oracle spec: - schedule: {{ .Values.oracleSchedule }} + schedule: "{{ .Values.oracleSchedule }}" concurrencyPolicy: Forbid jobTemplate: spec: @@ -35,6 +35,7 @@ spec: - "-c" - | celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType price_oracle --index 0 > /root/.celo/pkey + celotooljs.sh generate account-address --private-key `cat /root/.celo/pkey` > /root/.celo/account volumeMounts: - name: data mountPath: /root/.celo @@ -46,21 +47,20 @@ spec: key: MNEMONIC containers: - name: report-price - image: gcr.io/celo-testnet/celocli-standalone:yerduaoracletest + image: {{ .Values.celocli.image.repository }}:{{ .Values.celocli.image.tag }} imagePullPolicy: IfNotPresent command: ["/bin/sh"] args: - "-c" - | - echo "running the celocli container" - echo 'current price:' PRICE=`cat /root/.celo/current_price` + echo 'current price:' echo $PRICE PK=`cat /root/.celo/pkey` - echo "key is:" - echo $PK + ACCOUNT=`cat /root/.celo/account` alias celocli='node_modules/@celo/celocli/bin/run' - celocli config:get + celocli config:set --node {{ .Values.celocli.nodeUrl }} + celocli oracle:report StableToken --numerator $PRICE --privateKey $PK --from $ACCOUNT volumeMounts: - name: data mountPath: /root/.celo @@ -74,5 +74,3 @@ spec: volumes: - name: data emptyDir: {} - - \ No newline at end of file From 9600fe108385fa58970ffa39b10558d07bf6518d Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Thu, 21 Nov 2019 15:24:22 +0100 Subject: [PATCH 05/18] deal with some envVars in a better way --- .env | 4 ++-- packages/celotool/src/lib/env-utils.ts | 4 ++++ packages/celotool/src/lib/oracle.ts | 11 ++++++----- .../helm-charts/oracle/templates/oracle.cronjob.yaml | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 58c0db2197a..25e98f8b928 100644 --- a/.env +++ b/.env @@ -37,10 +37,10 @@ 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" -# TODO (yerdua): Change this to something actually reasonable -CELOCLI_STANDALONE_IMAGE_TAG="yerduaoracletest" +CELOCLI_STANDALONE_IMAGE_TAG="latest" ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" +ORACLE_DOCKER_IMAGE_TAG="development" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-d3d165a7db548d175cd703c86c20c1657c04368d" diff --git a/packages/celotool/src/lib/env-utils.ts b/packages/celotool/src/lib/env-utils.ts index 98b5e2afa52..3f36d716880 100644 --- a/packages/celotool/src/lib/env-utils.ts +++ b/packages/celotool/src/lib/env-utils.ts @@ -13,6 +13,8 @@ export enum envVar { ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY = 'ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY', ATTESTATION_SERVICE_DOCKER_IMAGE_TAG = 'ATTESTATION_SERVICE_DOCKER_IMAGE_TAG', BLOCK_TIME = 'BLOCK_TIME', + CELOCLI_STANDALONE_IMAGE_REPOSITORY = 'CELOCLI_STANDALONE_IMAGE_REPOSITORY', + CELOCLI_STANDALONE_IMAGE_TAG = 'CELOCLI_STANDALONE_IMAGE_TAG', CELOTOOL_CELOENV = 'CELOTOOL_CELOENV', CELOTOOL_CONFIRMED = 'CELOTOOL_CONFIRMED', CELOTOOL_DOCKER_IMAGE_REPOSITORY = 'CELOTOOL_DOCKER_IMAGE_REPOSITORY', @@ -62,6 +64,8 @@ export enum envVar { NEXMO_KEY = 'NEXMO_KEY', NEXMO_SECRET = 'NEXMO_SECRET', NOTIFICATION_SERVICE_FIREBASE_DB = 'NOTIFICATION_SERVICE_FIREBASE_DB', + ORACLE_DOCKER_IMAGE_REPOSITORY = 'ORACLE_DOCKER_IMAGE_REPOSITORY', + ORACLE_DOCKER_IMAGE_TAG = 'ORACLE_DOCKER_IMAGE_TAG', PROMTOSD_EXPORT_INTERVAL = 'PROMTOSD_EXPORT_INTERVAL', PROMTOSD_SCRAPE_INTERVAL = 'PROMTOSD_SCRAPE_INTERVAL', SMS_RETRIEVER_HASH_CODE = 'SMS_RETRIEVER_HASH_CODE', diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index 894f228476e..abccbb5c069 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -15,13 +15,14 @@ export async function installHelmChart(celoEnv: string) { function helmParameters(celoEnv: string) { return [ - `--set celotool.image.repository=${fetchEnv('CELOTOOL_DOCKER_IMAGE_REPOSITORY')}`, - `--set celotool.image.tag=${fetchEnv('CELOTOOL_DOCKER_IMAGE_TAG')}`, + `--set celotool.image.repository=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_REPOSITORY)}`, + `--set celotool.image.tag=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_TAG)}`, `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, - `--set oracle.image.repository=${fetchEnv('ORACLE_DOCKER_IMAGE_REPOSITORY')}`, + `--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, + `--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, - `--set celocli.image.repository=${fetchEnv('CELOCLI_STANDALONE_IMAGE_REPOSITORY')}`, - `--set celocli.image.tag=${fetchEnv('CELOCLI_STANDALONE_IMAGE_TAG')}`, + `--set celocli.image.repository=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_REPOSITORY)}`, + `--set celocli.image.tag=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_TAG)}`, ] } diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml index 0bdd11fc2f4..8add89dafb0 100644 --- a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -17,7 +17,7 @@ spec: spec: initContainers: - name: get-current-price - image: gcr.io/celo-testnet/oracle:{{ .Release.Namespace }} + image: {{ .Values.oracle.image.repository }}:{{ .Values.oracle.image.tag }} imagePullPolicy: IfNotPresent command: - sh From cb319f6f24814eaf56ccf320960776656a7f37f1 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 25 Nov 2019 19:16:20 +0100 Subject: [PATCH 06/18] hardcode a node's IP because forno is broken. fix some bits of the celotool deployment command for the oracle --- .env.baklavastaging | 103 ++++++++++++++++++ dockerfiles/cli-standalone/Dockerfile | 14 ++- packages/celotool/src/lib/oracle.ts | 6 +- .../oracle/templates/oracle.cronjob.yaml | 23 ++-- 4 files changed, 128 insertions(+), 18 deletions(-) create mode 100644 .env.baklavastaging diff --git a/.env.baklavastaging b/.env.baklavastaging new file mode 100644 index 00000000000..6b243216044 --- /dev/null +++ b/.env.baklavastaging @@ -0,0 +1,103 @@ +# 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="ad86714d629c01272e0651dec1fb6a968c3cec71" +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="fb9bcc639eeb0d3a70dadaf2aa3c49d45c7d9f5c" + +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="ed1312266c350a53316ed82c47c52327f227b727" + +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="ed1312266c350a53316ed82c47c52327f227b727" + +CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" +CELOTOOL_DOCKER_IMAGE_TAG="celotool-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" + +CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30" + +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-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" + +ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" +ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" + +GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter" +GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261" + +# Genesis Vars +NETWORK_ID=1101 +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=100 +# every 36 seconds, so that 100 transactions are sent by a client every hour +LOAD_TEST_TX_DELAY_MS=36000 + +# "og" -> our original 4 tx nodes, "${n}" -> for deriving n tx nodes from the MNEMONIC +# NOTE: we only create static IPs when TX_NODES is set to "og" +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 diff --git a/dockerfiles/cli-standalone/Dockerfile b/dockerfiles/cli-standalone/Dockerfile index c5221dccc2c..a924223e973 100644 --- a/dockerfiles/cli-standalone/Dockerfile +++ b/dockerfiles/cli-standalone/Dockerfile @@ -1,7 +1,15 @@ FROM node:10-alpine -RUN apk update && apk add python git make gcc g++ +RUN apk update && apk add python git make gcc g++ bash -WORKDIR /celo/ +RUN adduser -D -S celo -RUN npm install @celo/celocli@0.0.29 +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 diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index abccbb5c069..744381b44f7 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -1,4 +1,3 @@ -import { getFornoUrl } from 'src/lib/endpoints' import { envVar, fetchEnv } from 'src/lib/env-utils' import { installGenericHelmChart } from 'src/lib/helm_deploy' @@ -13,14 +12,15 @@ export async function installHelmChart(celoEnv: string) { ) } -function helmParameters(celoEnv: string) { +function helmParameters(_celoEnv: string) { return [ `--set celotool.image.repository=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_REPOSITORY)}`, `--set celotool.image.tag=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_TAG)}`, `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, `--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, `--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, - `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, + // `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, + `--set celocli.nodeUrl='http://34.83.46.9:8545'`, `--set celocli.image.repository=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_REPOSITORY)}`, `--set celocli.image.tag=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_TAG)}`, ] diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml index 8add89dafb0..04706938f10 100644 --- a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -1,8 +1,8 @@ apiVersion: batch/v1beta1 kind: CronJob -metadata: +metadata: name: {{ .Release.Name }} - labels: + labels: app: oracle chart: oracle release: {{ .Release.Service }} @@ -23,10 +23,10 @@ spec: - sh - "-c" - | - echo `python get_rate_for_now.py oracle_rates.csv` > /root/.celo/current_price + echo `./current_rate.sh` > /celo/.celo/current_price volumeMounts: - name: data - mountPath: /root/.celo + mountPath: /celo/.celo - name: get-account image: {{ .Values.celotool.image.repository }}:{{ .Values.celotool.image.tag }} imagePullPolicy: IfNotPresent @@ -34,11 +34,11 @@ spec: args: - "-c" - | - celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType price_oracle --index 0 > /root/.celo/pkey - celotooljs.sh generate account-address --private-key `cat /root/.celo/pkey` > /root/.celo/account + celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType price_oracle --index 0 > /celo/.celo/pkey + celotooljs.sh generate account-address --private-key `cat /celo/.celo/pkey` > /celo/.celo/account volumeMounts: - name: data - mountPath: /root/.celo + mountPath: /celo/.celo env: - name: MNEMONIC valueFrom: @@ -53,17 +53,16 @@ spec: args: - "-c" - | - PRICE=`cat /root/.celo/current_price` + PRICE=`cat /celo/.celo/current_price` echo 'current price:' echo $PRICE - PK=`cat /root/.celo/pkey` - ACCOUNT=`cat /root/.celo/account` - alias celocli='node_modules/@celo/celocli/bin/run' + PK=`cat /celo/.celo/pkey` + ACCOUNT=`cat /celo/.celo/account` celocli config:set --node {{ .Values.celocli.nodeUrl }} celocli oracle:report StableToken --numerator $PRICE --privateKey $PK --from $ACCOUNT volumeMounts: - name: data - mountPath: /root/.celo + mountPath: /celo/.celo env: - name: MNEMONIC valueFrom: From 25e7668fa219924d50cad2c21c7b426d1e792115 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Tue, 26 Nov 2019 01:12:24 +0100 Subject: [PATCH 07/18] various things to make the oracle actually work --- .env.baklavastaging | 2 +- dockerfiles/cli-standalone/Dockerfile | 2 +- packages/attestation-service/package.json | 2 +- packages/celotool/package.json | 2 +- packages/celotool/src/lib/oracle.ts | 3 ++- packages/cli/package.json | 4 ++-- packages/cli/src/commands/oracle/report.ts | 8 +++++++- packages/contractkit/package.json | 2 +- packages/mobile/package.json | 2 +- yarn.lock | 19 +++++++++++++++++++ 10 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.env.baklavastaging b/.env.baklavastaging index 6b243216044..c524f6b5516 100644 --- a/.env.baklavastaging +++ b/.env.baklavastaging @@ -37,7 +37,7 @@ CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" CELOTOOL_DOCKER_IMAGE_TAG="celotool-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" -CELOCLI_STANDALONE_IMAGE_TAG="0.0.30" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" ORACLE_DOCKER_IMAGE_TAG="baklavastaging" diff --git a/dockerfiles/cli-standalone/Dockerfile b/dockerfiles/cli-standalone/Dockerfile index a924223e973..b80f5c2a4c6 100644 --- a/dockerfiles/cli-standalone/Dockerfile +++ b/dockerfiles/cli-standalone/Dockerfile @@ -12,4 +12,4 @@ ENV NPM_CONFIG_PREFIX=/home/celo/.npm-global WORKDIR /home/celo/ -RUN npm install -g @celo/celocli@0.0.30 +RUN npm install -g @celo/celocli@0.0.30-beta2 diff --git a/packages/attestation-service/package.json b/packages/attestation-service/package.json index 78d677b816a..a2adb35626d 100644 --- a/packages/attestation-service/package.json +++ b/packages/attestation-service/package.json @@ -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", diff --git a/packages/celotool/package.json b/packages/celotool/package.json index 1deb65bf3c0..01e5dce5420 100644 --- a/packages/celotool/package.json +++ b/packages/celotool/package.json @@ -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", diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index 744381b44f7..f806915a2eb 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -20,7 +20,8 @@ function helmParameters(_celoEnv: string) { `--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, `--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, // `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, - `--set celocli.nodeUrl='http://34.83.46.9:8545'`, + // Temporary hardcode for baklava while forno doesn't work + '--set celocli.nodeUrl="http://34.83.46.9:8545"', `--set celocli.image.repository=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_REPOSITORY)}`, `--set celocli.image.tag=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_TAG)}`, ] diff --git a/packages/cli/package.json b/packages/cli/package.json index 2c589cb8782..cbdb5dfe158 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@celo/celocli", "description": "CLI Tool for transacting with the Celo protocol", - "version": "0.0.30-beta", + "version": "0.0.31-beta", "author": "Celo", "license": "Apache-2.0", "repository": "celo-org/celo-monorepo", @@ -31,7 +31,7 @@ "test": "TZ=UTC jest --runInBand" }, "dependencies": { - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@celo/utils": "^0.1.0", "@oclif/command": "^1", "@oclif/config": "^1", diff --git a/packages/cli/src/commands/oracle/report.ts b/packages/cli/src/commands/oracle/report.ts index 1b1e9846dab..8f422c086d8 100644 --- a/packages/cli/src/commands/oracle/report.ts +++ b/packages/cli/src/commands/oracle/report.ts @@ -2,7 +2,7 @@ import { CeloContract } from '@celo/contractkit' import { flags } from '@oclif/command' import BigNumber from 'bignumber.js' import { BaseCommand } from '../../base' -import { displaySendTx } from '../../utils/cli' +import { displaySendTx, failWith } from '../../utils/cli' import { Flags } from '../../utils/command' export default class ReportPrice extends BaseCommand { @@ -49,6 +49,12 @@ export default class ReportPrice extends BaseCommand { denominator = denominator.multipliedBy(multiplier) } + // Give a sensible error if this account is not an oracle + const isOracle = await sortedOracles.isOracle(res.args.token, res.flags.from) + if (!isOracle) { + failWith(`Account ${res.flags.from} is not an oracle for ${res.args.token}`) + } + await displaySendTx( 'sortedOracles.report', await sortedOracles.report( diff --git a/packages/contractkit/package.json b/packages/contractkit/package.json index 2b9f0a8a09c..2ef4102e033 100644 --- a/packages/contractkit/package.json +++ b/packages/contractkit/package.json @@ -1,6 +1,6 @@ { "name": "@celo/contractkit", - "version": "0.2.1-dev", + "version": "0.2.3-dev", "description": "Celo's ContractKit to interact with Celo network", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 495f1677abb..a87d63dc5cc 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -44,7 +44,7 @@ }, "dependencies": { "@celo/client": "9575a01", - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@celo/react-components": "1.0.0", "@celo/react-native-sms-retriever": "git+https://github.com/celo-org/react-native-sms-retriever#b88e502", "@celo/utils": "^0.1.1", diff --git a/yarn.lock b/yarn.lock index 03e28f5b995..6ed4da6cfd3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2231,6 +2231,25 @@ web3-eth-abi "1.0.0-beta.37" web3-utils "1.0.0-beta.37" +"@celo/contractkit@0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@celo/contractkit/-/contractkit-0.2.2.tgz#dbfb8b5a6c6591661b1b13b542063efaff7fcc1c" + integrity sha512-RQBlKd3AOceiJKD8Bm1r2YR0fAKn1ToOXL4K3N6+yWRohi/BjvX+LWmtimcfK4oyNZGu8PQq174SqNMjhFbSwg== + dependencies: + "@0x/subproviders" "^5.0.0" + "@celo/utils" "^0.1.0" + "@types/debug" "^4.1.5" + bignumber.js "^7.2.0" + cross-fetch "3.0.4" + debug "^4.1.1" + eth-lib "^0.2.8" + fp-ts "2.1.1" + io-ts "2.0.1" + web3 "1.0.0-beta.37" + web3-core-helpers "1.0.0-beta.37" + web3-eth-abi "1.0.0-beta.37" + web3-utils "1.0.0-beta.37" + "@celo/dev-cli@^2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@celo/dev-cli/-/dev-cli-2.0.3.tgz#67f61dfee373ad8b412925e386cf122aabada5f5" From e95cba0d19bb0dd8dac0412e7f9324d3a452a4cc Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Thu, 28 Nov 2019 12:12:30 +0100 Subject: [PATCH 08/18] get rid of temporary hardcode now that forno works --- packages/celotool/src/lib/oracle.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index f806915a2eb..abccbb5c069 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -1,3 +1,4 @@ +import { getFornoUrl } from 'src/lib/endpoints' import { envVar, fetchEnv } from 'src/lib/env-utils' import { installGenericHelmChart } from 'src/lib/helm_deploy' @@ -12,16 +13,14 @@ export async function installHelmChart(celoEnv: string) { ) } -function helmParameters(_celoEnv: string) { +function helmParameters(celoEnv: string) { return [ `--set celotool.image.repository=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_REPOSITORY)}`, `--set celotool.image.tag=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_TAG)}`, `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, `--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, `--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, - // `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, - // Temporary hardcode for baklava while forno doesn't work - '--set celocli.nodeUrl="http://34.83.46.9:8545"', + `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, `--set celocli.image.repository=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_REPOSITORY)}`, `--set celocli.image.tag=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_TAG)}`, ] From 9e4e9e5eebd7969fb032c5904e01ad1b39193b32 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 13:37:26 +0100 Subject: [PATCH 09/18] yarn.lock cleanup via yarn install --- yarn.lock | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6ed4da6cfd3..03e28f5b995 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2231,25 +2231,6 @@ web3-eth-abi "1.0.0-beta.37" web3-utils "1.0.0-beta.37" -"@celo/contractkit@0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@celo/contractkit/-/contractkit-0.2.2.tgz#dbfb8b5a6c6591661b1b13b542063efaff7fcc1c" - integrity sha512-RQBlKd3AOceiJKD8Bm1r2YR0fAKn1ToOXL4K3N6+yWRohi/BjvX+LWmtimcfK4oyNZGu8PQq174SqNMjhFbSwg== - dependencies: - "@0x/subproviders" "^5.0.0" - "@celo/utils" "^0.1.0" - "@types/debug" "^4.1.5" - bignumber.js "^7.2.0" - cross-fetch "3.0.4" - debug "^4.1.1" - eth-lib "^0.2.8" - fp-ts "2.1.1" - io-ts "2.0.1" - web3 "1.0.0-beta.37" - web3-core-helpers "1.0.0-beta.37" - web3-eth-abi "1.0.0-beta.37" - web3-utils "1.0.0-beta.37" - "@celo/dev-cli@^2.0.3": version "2.0.3" resolved "https://registry.yarnpkg.com/@celo/dev-cli/-/dev-cli-2.0.3.tgz#67f61dfee373ad8b412925e386cf122aabada5f5" From 75d96819a949a6d0496a2e6b9fe5e1ba9e3b7821 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 16:41:00 +0100 Subject: [PATCH 10/18] make oracle schedule be in the .env file --- .env | 6 +++++- .env.alfajores | 7 +++++++ .env.baklavastaging | 4 ++++ .env.integration | 10 ++++++++++ packages/celotool/src/lib/env-utils.ts | 1 + packages/celotool/src/lib/oracle.ts | 1 + .../helm-charts/oracle/templates/oracle.cronjob.yaml | 2 +- packages/helm-charts/oracle/values.yaml | 4 ---- 8 files changed, 29 insertions(+), 6 deletions(-) delete mode 100644 packages/helm-charts/oracle/values.yaml diff --git a/.env b/.env index 25e98f8b928..8d3398c42bd 100644 --- a/.env +++ b/.env @@ -39,8 +39,12 @@ CELOTOOL_DOCKER_IMAGE_TAG="celotool-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84" CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" CELOCLI_STANDALONE_IMAGE_TAG="latest" +# 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="development" +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" diff --git a/.env.alfajores b/.env.alfajores index 8089f0318e7..5f20ebca2d4 100644 --- a/.env.alfajores +++ b/.env.alfajores @@ -32,6 +32,13 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="9575a01c12438e1adc6bb610c891cb5066aaa7aa" CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" CELOTOOL_DOCKER_IMAGE_TAG="celotool-552b1accf90404fdcd886670d150af0a5cae116f" +# 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" diff --git a/.env.baklavastaging b/.env.baklavastaging index c524f6b5516..0aba1ed572d 100644 --- a/.env.baklavastaging +++ b/.env.baklavastaging @@ -39,6 +39,10 @@ CELOTOOL_DOCKER_IMAGE_TAG="celotool-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" 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" diff --git a/.env.integration b/.env.integration index 86243ff42ca..65a3ddb3512 100644 --- a/.env.integration +++ b/.env.integration @@ -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="latest" + +# 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" diff --git a/packages/celotool/src/lib/env-utils.ts b/packages/celotool/src/lib/env-utils.ts index 3f36d716880..9855023ca62 100644 --- a/packages/celotool/src/lib/env-utils.ts +++ b/packages/celotool/src/lib/env-utils.ts @@ -64,6 +64,7 @@ export enum envVar { NEXMO_KEY = 'NEXMO_KEY', NEXMO_SECRET = 'NEXMO_SECRET', NOTIFICATION_SERVICE_FIREBASE_DB = 'NOTIFICATION_SERVICE_FIREBASE_DB', + ORACLE_CRON_SCHEDULE = 'ORACLE_CRON_SCHEDULE', ORACLE_DOCKER_IMAGE_REPOSITORY = 'ORACLE_DOCKER_IMAGE_REPOSITORY', ORACLE_DOCKER_IMAGE_TAG = 'ORACLE_DOCKER_IMAGE_TAG', PROMTOSD_EXPORT_INTERVAL = 'PROMTOSD_EXPORT_INTERVAL', diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index abccbb5c069..8d74ce9397f 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -18,6 +18,7 @@ function helmParameters(celoEnv: string) { `--set celotool.image.repository=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_REPOSITORY)}`, `--set celotool.image.tag=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_TAG)}`, `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, + `--set oracle.cronSchedule="${fetchEnv(envVar.ORACLE_CRON_SCHEDULE)}"`, `--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, `--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml index 04706938f10..c76af568de8 100644 --- a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -8,7 +8,7 @@ metadata: release: {{ .Release.Service }} component: oracle spec: - schedule: "{{ .Values.oracleSchedule }}" + schedule: "{{ .Values.oracle.cronSchedule }}" concurrencyPolicy: Forbid jobTemplate: spec: diff --git a/packages/helm-charts/oracle/values.yaml b/packages/helm-charts/oracle/values.yaml deleted file mode 100644 index e6c818c558c..00000000000 --- a/packages/helm-charts/oracle/values.yaml +++ /dev/null @@ -1,4 +0,0 @@ -nodeSelector: {} - -# Expects cron schedule syntax -oracleSchedule: "*/1 * * * *" \ No newline at end of file From 35e8d516a05255da5d7d248e034ef37e54ef687c Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 17:05:44 +0100 Subject: [PATCH 11/18] remove cli changes from this PR, since they're not in published cli --- packages/cli/package.json | 4 ++-- packages/cli/src/commands/oracle/report.ts | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index cbdb5dfe158..2c589cb8782 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@celo/celocli", "description": "CLI Tool for transacting with the Celo protocol", - "version": "0.0.31-beta", + "version": "0.0.30-beta", "author": "Celo", "license": "Apache-2.0", "repository": "celo-org/celo-monorepo", @@ -31,7 +31,7 @@ "test": "TZ=UTC jest --runInBand" }, "dependencies": { - "@celo/contractkit": "0.2.3-dev", + "@celo/contractkit": "0.2.1-dev", "@celo/utils": "^0.1.0", "@oclif/command": "^1", "@oclif/config": "^1", diff --git a/packages/cli/src/commands/oracle/report.ts b/packages/cli/src/commands/oracle/report.ts index 8f422c086d8..1b1e9846dab 100644 --- a/packages/cli/src/commands/oracle/report.ts +++ b/packages/cli/src/commands/oracle/report.ts @@ -2,7 +2,7 @@ import { CeloContract } from '@celo/contractkit' import { flags } from '@oclif/command' import BigNumber from 'bignumber.js' import { BaseCommand } from '../../base' -import { displaySendTx, failWith } from '../../utils/cli' +import { displaySendTx } from '../../utils/cli' import { Flags } from '../../utils/command' export default class ReportPrice extends BaseCommand { @@ -49,12 +49,6 @@ export default class ReportPrice extends BaseCommand { denominator = denominator.multipliedBy(multiplier) } - // Give a sensible error if this account is not an oracle - const isOracle = await sortedOracles.isOracle(res.args.token, res.flags.from) - if (!isOracle) { - failWith(`Account ${res.flags.from} is not an oracle for ${res.args.token}`) - } - await displaySendTx( 'sortedOracles.report', await sortedOracles.report( From 5b202a0eb66cb04b19424ba43b544d1bf47df8cb Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 17:10:18 +0100 Subject: [PATCH 12/18] fix contractkit dependency for cli --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 2c589cb8782..b7438da1bdd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -31,7 +31,7 @@ "test": "TZ=UTC jest --runInBand" }, "dependencies": { - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@celo/utils": "^0.1.0", "@oclif/command": "^1", "@oclif/config": "^1", From 61b8a6ebd4ce39edee28a766bf6b84c9dac978e0 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 18:12:21 +0100 Subject: [PATCH 13/18] add the new envvars to all .envs. Use a cli docker image that actually exists --- .env | 2 +- .env.alfajores | 3 +++ .env.alfajoresstaging | 10 ++++++++++ .env.integration | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 8d3398c42bd..fdf19de754b 100644 --- a/.env +++ b/.env @@ -37,7 +37,7 @@ 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="latest" +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" diff --git a/.env.alfajores b/.env.alfajores index 5f20ebca2d4..154cbac68ee 100644 --- a/.env.alfajores +++ b/.env.alfajores @@ -32,6 +32,9 @@ 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 * * * *" diff --git a/.env.alfajoresstaging b/.env.alfajoresstaging index ea8268163ad..3d6e13d49d4 100644 --- a/.env.alfajoresstaging +++ b/.env.alfajoresstaging @@ -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" diff --git a/.env.integration b/.env.integration index 65a3ddb3512..d100f72e6b6 100644 --- a/.env.integration +++ b/.env.integration @@ -37,7 +37,7 @@ 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="latest" +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" From 92ad324b36bdf8c93dc2a15dbc5f275c6646fc22 Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 19:45:27 +0100 Subject: [PATCH 14/18] addOracle expects leading '0x' on the address. Don't assume the addresses come that way --- packages/protocol/migrations/08_stabletoken.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/protocol/migrations/08_stabletoken.ts b/packages/protocol/migrations/08_stabletoken.ts index 8d45be380c9..b6d552b6fd7 100644 --- a/packages/protocol/migrations/08_stabletoken.ts +++ b/packages/protocol/migrations/08_stabletoken.ts @@ -7,6 +7,7 @@ import { getDeployedProxiedContract, } from '@celo/protocol/lib/web3-utils' import { config } from '@celo/protocol/migrationsConfig' +import { ensureHexLeader } from '@celo/utils/lib/address' import { toFixed } from '@celo/utils/lib/fixidity' import { FeeCurrencyWhitelistInstance, @@ -46,7 +47,7 @@ module.exports = deploymentForCoreContract( for (const oracle of config.stableToken.oracles) { console.info(`Adding ${oracle} as an Oracle for StableToken`) - await sortedOracles.addOracle(stableToken.address, oracle) + await sortedOracles.addOracle(stableToken.address, ensureHexLeader(oracle)) } // We need to seed the exchange rate, and that must be done with an account From 3cda3c7b685f515d60f80fa6300d28d2a9fb9c0a Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 20:11:33 +0100 Subject: [PATCH 15/18] add destroy oracle command --- .../celotool/src/cmds/deploy/destroy/oracle.ts | 16 ++++++++++++++++ packages/celotool/src/lib/oracle.ts | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 packages/celotool/src/cmds/deploy/destroy/oracle.ts diff --git a/packages/celotool/src/cmds/deploy/destroy/oracle.ts b/packages/celotool/src/cmds/deploy/destroy/oracle.ts new file mode 100644 index 00000000000..3fe01577ba1 --- /dev/null +++ b/packages/celotool/src/cmds/deploy/destroy/oracle.ts @@ -0,0 +1,16 @@ +import { createClusterIfNotExists, switchToClusterFromEnv } from 'src/lib/cluster' +import { removeHelmRelease } from 'src/lib/oracle' +import { DestroyArgv } from '../../deploy/destroy' + +export const command = 'oracle' + +export const describe = 'destroy the oracle package' + +export const builder = {} + +export const handler = async (argv: DestroyArgv) => { + await createClusterIfNotExists() + await switchToClusterFromEnv() + + await removeHelmRelease(argv.celoEnv) +} diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index 8d74ce9397f..71cc2b70131 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -1,6 +1,5 @@ -import { getFornoUrl } from 'src/lib/endpoints' import { envVar, fetchEnv } from 'src/lib/env-utils' -import { installGenericHelmChart } from 'src/lib/helm_deploy' +import { installGenericHelmChart, removeGenericHelmChart } from 'src/lib/helm_deploy' const helmChartPath = '../helm-charts/oracle' From d1d5e8e633c347aad2f78752ca2b4ff0b1cfad8d Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 20:21:00 +0100 Subject: [PATCH 16/18] get latest .env.baklavastaging from trevor's branch --- .env.baklavastaging | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.env.baklavastaging b/.env.baklavastaging index 0aba1ed572d..ad33044b0f9 100644 --- a/.env.baklavastaging +++ b/.env.baklavastaging @@ -13,7 +13,7 @@ CLUSTER_DOMAIN_NAME="celo-testnet" TESTNET_PROJECT_NAME="celo-testnet" BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout" -BLOCKSCOUT_DOCKER_IMAGE_TAG="ad86714d629c01272e0651dec1fb6a968c3cec71" +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. @@ -21,20 +21,22 @@ BLOCKSCOUT_DB_SUFFIX="0" BLOCKSCOUT_SUBNETWORK_NAME="Baklava Staging" ETHSTATS_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/ethstats" -ETHSTATS_DOCKER_IMAGE_TAG="fb9bcc639eeb0d3a70dadaf2aa3c49d45c7d9f5c" +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="ed1312266c350a53316ed82c47c52327f227b727" +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="ed1312266c350a53316ed82c47c52327f227b727" +GETH_BOOTNODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d" CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" -CELOTOOL_DOCKER_IMAGE_TAG="celotool-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" +CELOTOOL_DOCKER_IMAGE_TAG="celotool-51ae8e72be34a614346950b6fbd8ba3b94223947" CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" @@ -47,16 +49,16 @@ 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-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" +TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-51ae8e72be34a614346950b6fbd8ba3b94223947" -ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" -ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-bffefdb9e94a64b6e70a90aab60dd85ca39d7862" +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=1101 +NETWORK_ID=31416 CONSENSUS_TYPE="istanbul" BLOCK_TIME=5 # Minimum epoch length is 15 minutes @@ -65,12 +67,10 @@ 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=100 -# every 36 seconds, so that 100 transactions are sent by a client every hour -LOAD_TEST_TX_DELAY_MS=36000 +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 -# "og" -> our original 4 tx nodes, "${n}" -> for deriving n tx nodes from the MNEMONIC -# NOTE: we only create static IPs when TX_NODES is set to "og" VALIDATORS=70 PROXIED_VALIDATORS=35 TX_NODES=5 From ce6a9318aa56518b2c0587637272741d46b3e8ef Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 20:36:52 +0100 Subject: [PATCH 17/18] oops. actually include the necessary bits of the destroy oracle command --- packages/celotool/src/lib/oracle.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts index 71cc2b70131..da213a94542 100644 --- a/packages/celotool/src/lib/oracle.ts +++ b/packages/celotool/src/lib/oracle.ts @@ -1,3 +1,4 @@ +import { getFornoUrl } from 'src/lib/endpoints' import { envVar, fetchEnv } from 'src/lib/env-utils' import { installGenericHelmChart, removeGenericHelmChart } from 'src/lib/helm_deploy' @@ -11,6 +12,9 @@ export async function installHelmChart(celoEnv: string) { helmParameters(celoEnv) ) } +export async function removeHelmRelease(celoEnv: string) { + await removeGenericHelmChart(releaseName(celoEnv)) +} function helmParameters(celoEnv: string) { return [ From ced08aed09b30872e2aadc3eb5fd406c3ac8a3fc Mon Sep 17 00:00:00 2001 From: Audrey Penven Date: Mon, 2 Dec 2019 22:10:50 +0100 Subject: [PATCH 18/18] fix minor issues --- packages/celotool/src/cmds/deploy/destroy/oracle.ts | 3 +-- packages/helm-charts/oracle/templates/oracle.cronjob.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/celotool/src/cmds/deploy/destroy/oracle.ts b/packages/celotool/src/cmds/deploy/destroy/oracle.ts index 3fe01577ba1..b7286f0074a 100644 --- a/packages/celotool/src/cmds/deploy/destroy/oracle.ts +++ b/packages/celotool/src/cmds/deploy/destroy/oracle.ts @@ -1,4 +1,4 @@ -import { createClusterIfNotExists, switchToClusterFromEnv } from 'src/lib/cluster' +import { switchToClusterFromEnv } from 'src/lib/cluster' import { removeHelmRelease } from 'src/lib/oracle' import { DestroyArgv } from '../../deploy/destroy' @@ -9,7 +9,6 @@ export const describe = 'destroy the oracle package' export const builder = {} export const handler = async (argv: DestroyArgv) => { - await createClusterIfNotExists() await switchToClusterFromEnv() await removeHelmRelease(argv.celoEnv) diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml index c76af568de8..f962a6dfbe9 100644 --- a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -23,7 +23,7 @@ spec: - sh - "-c" - | - echo `./current_rate.sh` > /celo/.celo/current_price + ./current_rate.sh > /celo/.celo/current_price volumeMounts: - name: data mountPath: /celo/.celo