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

master #7

Merged
merged 19 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
fdbf0cd
[Wallet] Hide get invite code link for pilot build and firebase db fi…
jmrossy Nov 11, 2019
95f7e35
[wallet] Reversed sort of Payment Requests (#1654)
martinvol Nov 11, 2019
9d315b5
[wallet] Doesn't calculate fee on empty balance (#1652)
martinvol Nov 11, 2019
644b97b
[Wallet] Fix scrolling and some related style issues with tx review f…
jmrossy Nov 11, 2019
25b62b5
[Wallet] Fix verification signing issue for Alfajores/Pilot (#1655)
jmrossy Nov 11, 2019
ba60964
Export geth metrics on VM testnet (#1351)
tkporter Nov 11, 2019
2b3eb0b
[Wallet] Add timestamp to top banner messages (#1657)
i1skn Nov 11, 2019
2664e2b
Support claim signatures and support Keybase claims (#1575)
nambrot Nov 11, 2019
7e3d507
Optimized Attestation view calls and removal of the reveal TX (#1578)
nambrot Nov 11, 2019
0452093
Add EpochRewards smart contract to calculate epoch rewards and paymen…
Nov 12, 2019
722945f
Point end-to-end governance test back to master (#1665)
Nov 12, 2019
cc69980
[Wallet] Fix app deprecation check mechanism (#1358)
rohit-dua Nov 12, 2019
cabadee
[Wallet] Add spinner, timer, and tip text to Verification input scree…
jmrossy Nov 12, 2019
d350720
[wallet] Hide invite education copy after invite was redeemed (#1670)
martinvol Nov 12, 2019
110f856
Fix token addresses for notification service (#1674)
jmrossy Nov 12, 2019
6bca7c3
[wallet] Fixed Native phone picker Use native API instead (#1669)
martinvol Nov 12, 2019
b864e07
Minor attestation service fixes (#1680)
nambrot Nov 12, 2019
b2761bb
Update Dark backgrounds text color (#1677)
aaronmgdr Nov 13, 2019
ca40512
[Wallet] Limit QR code scanner to 1 code per second (#1676)
i1skn Nov 13, 2019
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
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# More details: https://github.com/GoogleContainerTools/kaniko

steps:

- id: "docker:celotool"
name: gcr.io/kaniko-project/executor:latest
args: [
Expand Down Expand Up @@ -37,7 +37,7 @@ steps:
args: [
"--dockerfile=dockerfiles/attestation-service/Dockerfile",
"--cache=true",
"--destination=gcr.io/$PROJECT_ID/celo-monorepo:attestation-service-$COMMIT_SHA"
"--destination=us.gcr.io/$PROJECT_ID/celo-monorepo:attestation-service-$COMMIT_SHA"
]
waitFor: ['-']

Expand Down
21 changes: 21 additions & 0 deletions packages/attestation-service/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"development": {
"username": "root",
"password": null,
"database": "database_development",
"host": "db/dev.db",
"dialect": "sqlite",
"operatorsAliases": false
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "sqlite",
"operatorsAliases": false
},
"production": {
"use_env_variable": "DATABASE_URL"
}
}
2 changes: 1 addition & 1 deletion packages/celotool/ci_test_governance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -euo pipefail

if [ "${1}" == "checkout" ]; then
# Test master by default.
BRANCH_TO_TEST=${2:-"nambrot/accounts"}
BRANCH_TO_TEST=${2:-"master"}
echo "Checking out geth at branch ${BRANCH_TO_TEST}..."
../../node_modules/.bin/mocha -r ts-node/register src/e2e-tests/governance_tests.ts --branch ${BRANCH_TO_TEST}
elif [ "${1}" == "local" ]; then
Expand Down
40 changes: 26 additions & 14 deletions packages/celotool/src/cmds/account/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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 { switchToClusterFromEnv } from 'src/lib/cluster'
Expand Down Expand Up @@ -54,12 +55,13 @@ async function verifyCmd(argv: VerifyArgv) {
const attestations = await kit.contracts.getAttestations()
const accounts = await kit.contracts.getAccounts()
await printCurrentCompletedAttestations(attestations, argv.phone, account)

let attestationsToComplete = await attestations.getActionableAttestations(argv.phone, account)

// Request more attestations
if (argv.num > attestationsToComplete.length) {
console.info(`Requesting ${argv.num - attestationsToComplete.length} attestations`)
console.info(
`Requesting ${argv.num - attestationsToComplete.length} attestations from the smart contract`
)
await requestMoreAttestations(
attestations,
argv.phone,
Expand All @@ -78,9 +80,9 @@ async function verifyCmd(argv: VerifyArgv) {
}

attestationsToComplete = await attestations.getActionableAttestations(argv.phone, account)
// Find attestations we can reveal/verify
console.info(`Revealing ${attestationsToComplete.length} attestations`)
await revealAttestations(attestationsToComplete, attestations, argv.phone)
// Find attestations we can verify
console.info(`Requesting ${attestationsToComplete.length} attestations from issuers`)
await requestAttestationsFromIssuers(attestationsToComplete, attestations, argv.phone, account)

await promptForCodeAndVerify(attestations, argv.phone, account)
}
Expand Down Expand Up @@ -115,18 +117,28 @@ async function requestMoreAttestations(
await attestations.selectIssuers(phoneNumber).then((txo) => txo.sendAndWaitForReceipt())
}

async function revealAttestations(
async function requestAttestationsFromIssuers(
attestationsToReveal: ActionableAttestation[],
attestations: AttestationsWrapper,
phoneNumber: string
phoneNumber: string,
account: string
) {
return Promise.all(
attestationsToReveal.map(async (attestation) =>
attestations
.reveal(phoneNumber, attestation.issuer)
.then((txo) => txo.sendAndWaitForReceipt())
)
)
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(
Expand Down
5 changes: 5 additions & 0 deletions packages/celotool/src/cmds/deploy/destroy/vm-testnet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { switchToClusterFromEnv } from 'src/lib/cluster'
import { removeHelmRelease } from 'src/lib/prom-to-sd-utils'
import { destroy } from 'src/lib/vm-testnet-utils'
import { DestroyArgv } from '../../deploy/destroy'

Expand All @@ -6,5 +8,8 @@ export const describe = 'destroy an existing VM-based testnet'
export const builder = {}

export const handler = async (argv: DestroyArgv) => {
await switchToClusterFromEnv()
await destroy(argv.celoEnv)
// destroy prometheus to stackdriver statefulset
await removeHelmRelease(argv.celoEnv)
}
15 changes: 8 additions & 7 deletions packages/celotool/src/cmds/deploy/initial/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* tslint:disable no-console */
import { newKit } from '@celo/contractkit'
import { IdentityMetadataWrapper } from '@celo/contractkit/lib/identity'
import {
createAttestationServiceURLClaim,
createNameClaim,
IdentityMetadataWrapper,
} from '@celo/contractkit/lib/identity'
} from '@celo/contractkit/lib/identity/claims/claim'
import { concurrentMap } from '@celo/utils/lib/async'
import { LocalSigner } from '@celo/utils/lib/signatureUtils'
import { writeFileSync } from 'fs'
import { uploadArtifacts } from 'src/lib/artifacts'
import { switchToClusterFromEnv } from 'src/lib/cluster'
Expand Down Expand Up @@ -63,7 +64,7 @@ function metadataURLForCLabsValidator(testnet: string, address: string) {
return `https://storage.googleapis.com/${CLABS_VALIDATOR_METADATA_BUCKET}/${testnet}/validator-${testnet}-${address}-metadata.json`
}

async function makeMetadata(testnet: string, address: string, index: number) {
async function makeMetadata(testnet: string, address: string, index: number, privateKey: string) {
const attestationServiceClaim = createAttestationServiceURLClaim(
getAttestationServiceUrl(testnet, index)
)
Expand All @@ -73,9 +74,9 @@ async function makeMetadata(testnet: string, address: string, index: number) {
const fileName = `validator-${testnet}-${address}-metadata.json`
const filePath = `/tmp/${fileName}`

const metadata = IdentityMetadataWrapper.fromEmpty()
metadata.addClaim(nameClaim)
metadata.addClaim(attestationServiceClaim)
const metadata = IdentityMetadataWrapper.fromEmpty(address)
await metadata.addClaim(nameClaim, LocalSigner(privateKey))
await metadata.addClaim(attestationServiceClaim, LocalSigner(privateKey))
writeFileSync(filePath, metadata.toString())

await uploadFileToGoogleStorage(
Expand All @@ -89,7 +90,7 @@ async function makeMetadata(testnet: string, address: string, index: number) {

export async function registerMetadata(testnet: string, privateKey: string, index: number) {
const address = privateKeyToAddress(privateKey)
await makeMetadata(testnet, address, index)
await makeMetadata(testnet, address, index, privateKey)

const kit = newKit('http://localhost:8545')
kit.addAccount(privateKey)
Expand Down
11 changes: 10 additions & 1 deletion packages/celotool/src/cmds/deploy/initial/vm-testnet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { deploy } from '../../../lib/vm-testnet-utils'
import { createClusterIfNotExists, setupCluster, switchToClusterFromEnv } from 'src/lib/cluster'
import { installHelmChart } from 'src/lib/prom-to-sd-utils'
import { deploy } from 'src/lib/vm-testnet-utils'
import { InitialArgv } from '../../deploy/initial'

export const command = 'vm-testnet'
export const describe = 'upgrade a testnet on a VM'
export const builder = {}

export const handler = async (argv: InitialArgv) => {
// set up Kubernetes cluster that will have prometheus to stackdriver statefulset
const createdCluster = await createClusterIfNotExists()
await switchToClusterFromEnv()
await setupCluster(argv.celoEnv, createdCluster)
// deploy VM testnet with Terraform
await deploy(argv.celoEnv)
// deploy prom to sd statefulset
await installHelmChart(argv.celoEnv)
}
6 changes: 6 additions & 0 deletions packages/celotool/src/cmds/deploy/upgrade/vm-testnet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { switchToClusterFromEnv } from 'src/lib/cluster'
import { upgradeHelmChart } from 'src/lib/prom-to-sd-utils'
import { deploy, taintTestnet, untaintTestnet } from 'src/lib/vm-testnet-utils'
import yargs from 'yargs'
import { UpgradeArgv } from '../../deploy/upgrade'
Expand All @@ -18,10 +20,14 @@ export const builder = (argv: yargs.Argv) => {
}

export const handler = async (argv: VmTestnetArgv) => {
await switchToClusterFromEnv()

let onDeployFailed = () => Promise.resolve()
if (argv.reset) {
onDeployFailed = () => untaintTestnet(argv.celoEnv)
await taintTestnet(argv.celoEnv)
}
await deploy(argv.celoEnv, onDeployFailed)
// upgrade prom to sd statefulset
await upgradeHelmChart(argv.celoEnv)
}
5 changes: 3 additions & 2 deletions packages/celotool/src/e2e-tests/attestations_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ describe('governance tests', () => {

const stats = await Attestations.getAttestationStat(phoneNumber, validatorAddress)
assert.equal(stats.total, 2)
const actionable = await Attestations.getActionableAttestations(phoneNumber, validatorAddress)
assert.lengthOf(actionable, 2)

const issuers = await Attestations.getAttestationIssuers(phoneNumber, validatorAddress)
assert.lengthOf(issuers, 2)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Blockchain parameters tests', function(this: any) {
let parameters: BlockchainParametersWrapper

const gethConfig: GethTestConfig = {
migrateTo: 17,
migrateTo: 18,
instances: [
{ name: 'validator', validating: true, syncmode: 'full', port: 30303, rpcport: 8545 },
],
Expand Down
Loading