Skip to content

Commit

Permalink
Merge branch 'master' into aaronmgdr/thesplintering
Browse files Browse the repository at this point in the history
* master:
  Integration deploy, don't overwrite genesis block if upgrading testnet (#1315)
  Fix broken Discord link (#1317)
  [Wallet] Add check for $ENVFILE to pre-dev script (#1324)
  Add GRADLE_OPTS note to SETUP.md (#1311)
  Allow validators to specify an attestationKey with which they sign attestations (#1313)
  Add step to install typescript and other minor edits (#1256)
  [Wallet] Add script to build sdk for env before running yarn dev (#1312)
  [Wallet] Fix ListView deprecation warning (#1293)
  Set IN_MEMORY_DISCOVERY_TABLE=true for integration (#1296)
  Add ability to generate addresses directly from env file in celotool (#1294)
  • Loading branch information
aaronmgdr committed Oct 22, 2019
2 parents 0bd42ee + 82a9d1c commit 08dc1af
Show file tree
Hide file tree
Showing 27 changed files with 423 additions and 76 deletions.
14 changes: 7 additions & 7 deletions .env.integration
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout"
BLOCKSCOUT_WEB_DOCKER_IMAGE_TAG="web-f6c3e0888d1d0ef72dc8bf870808702b7fd13730"
BLOCKSCOUT_INDEXER_DOCKER_IMAGE_TAG="indexer-f6c3e0888d1d0ef72dc8bf870808702b7fd13730"
BLOCKSCOUT_WEB_REPLICAS=3
BLOCKSCOUT_DB_SUFFIX="24"
BLOCKSCOUT_DB_SUFFIX="25"
BLOCKSCOUT_SUBNETWORK_NAME="Integration"

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="640a41fd970e0edbf5f30a90d53660165f5e98bd"
GETH_NODE_DOCKER_IMAGE_TAG="c1ae452c707f8bee91a9a0bf49193e78e9c8512e"

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="640a41fd970e0edbf5f30a90d53660165f5e98bd"
GETH_BOOTNODE_DOCKER_IMAGE_TAG="c1ae452c707f8bee91a9a0bf49193e78e9c8512e"

CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-dfdc3e8b26e98aa294b27e2b5621c184488a10db"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-2cb725c36b69e7ae608875610af080f4f3fa79bd"

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

ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-5035b241cbcfbd4f261e3d77e1fca8f6dc8edc32"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-2cb725c36b69e7ae608875610af080f4f3fa79bd"

GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter"
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261"
Expand All @@ -53,7 +53,7 @@ TX_NODES=2
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
IN_MEMORY_DISCOVERY_TABLE=true

# Testnet vars
GETH_NODES_BACKUP_CRONJOB_ENABLED=true
Expand Down
17 changes: 13 additions & 4 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ Install `nvm` (allows you to manage multiple versions of Node), Node 8 and `yarn

```bash
brew install nvm

# follow the instructions from the command above to edit your .bash_profile
# then restart the terminal
nvm install 8
nvm install 10
nvm alias default 10
brew install yarn
npm install -g typescript
```

#### Java
Expand Down Expand Up @@ -98,6 +101,8 @@ Execute the following (and make sure the lines are in your `~/.bash_profile`):
```bash
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_NDK=/usr/local/share/android-ndk
# Optional to speedup java builds
export GRADLE_OPTS='-Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"'
```

Then install the Android 28 platform:
Expand All @@ -112,7 +117,7 @@ sdkmanager 'platforms;android-28'

We use Yarn to build all of the [celo-monorepo] repo.

Install `nvm` (allows you to manage multiple versions of Node), Node 8 and `yarn`:
Install `nvm` (allows you to manage multiple versions of Node), Node 8, Node 10 and `yarn`:

```bash
# Installing Node
Expand All @@ -125,12 +130,16 @@ source ~/.bashrc

# Setting up the right version of Nvm
nvm install 8
nvm alias default 8
nvm install 10
nvm alias default 10

# Installing Yarn - https://yarnpkg.com/en/docs/install#debian-stable
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

# Install typescript
npm install -g typescript
```

#### Installing OpenJDK 8
Expand Down Expand Up @@ -211,9 +220,9 @@ Run the emulator with:
emulator -avd Nexus_5X_API_28
```

#### Optional: Genymotion
#### Optional: Install Genymotion Emulator Manager

Optionally, as alternative to other emulators you can install Genymotion, a nice emulator manager:
Optionally, as alternative to other emulators you can install Genymotion

##### MacOS

Expand Down
2 changes: 1 addition & 1 deletion packages/celotool/src/cmds/deploy/upgrade/testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export const handler = async (argv: TestnetArgv) => {

if (argv.reset) {
await resetAndUpgradeHelmChart(argv.celoEnv)
await uploadGenesisBlockToGoogleStorage(argv.celoEnv)
} else {
await upgradeHelmChart(argv.celoEnv)
}
await uploadGenesisBlockToGoogleStorage(argv.celoEnv)
await uploadStaticNodesToGoogleStorage(argv.celoEnv)
await uploadEnvFileToGoogleStorage(argv.celoEnv)
}
46 changes: 46 additions & 0 deletions packages/celotool/src/cmds/generate/address-from-env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* tslint:disable no-console */
import { addCeloEnvMiddleware, CeloEnvArgv } from 'src/lib/env-utils'
import {
coerceMnemonicAccountType,
getAddressFromEnv,
MNEMONIC_ACCOUNT_TYPE_CHOICES,
} from 'src/lib/generate_utils'
import * as yargs from 'yargs'

export const command = 'address-from-env'

export const describe =
'command for fetching addresses (validator, load_testing, tx_node, bootnode and faucet) as specified by the current environment'

interface AccountAddressArgv {
index: number
accountType: string
}

export const builder = (argv: yargs.Argv) => {
return addCeloEnvMiddleware(
argv
.option('index', {
alias: 'i',
type: 'number',
description: 'account index',
demand: 'Please specifiy account index',
})
.option('accountType', {
alias: 'a',
type: 'string',
choices: MNEMONIC_ACCOUNT_TYPE_CHOICES,
description: 'account type',
demand: 'Please specifiy account type',
required: true,
})
)
}

export const handler = async (argv: CeloEnvArgv & AccountAddressArgv) => {
const validatorAddress = getAddressFromEnv(
coerceMnemonicAccountType(argv.accountType),
argv.index
)
console.info(validatorAddress)
}
6 changes: 6 additions & 0 deletions packages/celotool/src/lib/generate_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export const getValidators = (mnemonic: string, n: number) => {
})
}

export const getAddressFromEnv = (accountType: AccountType, n: number) => {
const mnemonic = fetchEnv(envVar.MNEMONIC)
const privateKey = generatePrivateKey(mnemonic, accountType, n)
return privateKeyToAddress(privateKey)
}

export const generateGenesisFromEnv = (enablePetersburg: boolean = true) => {
const mnemonic = fetchEnv(envVar.MNEMONIC)
const validatorEnv = fetchEnv(envVar.VALIDATORS)
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/developer-resources/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to the Celo SDK Docs Homepage! Here, you can find resources for DAppKit

- **[DAppKit](dappkit/README.md)** is a lightweight set of functions that allow mobile DApps to work with the Celo Wallet to sign transactions and access the user's account. This allows for a better user experience: DApps can focus on a great native experience without having to worry about key management. It also provides a simpler development experience, as no state or connection management is necessary.

If you'd like to see the Celo SDK expanded to support your favorite technology or application, please join the conversation on the [Celo Forum](https://forum.celo.org/c/applications-and-ecosystem-development) or [Discord](https://discordapp.com/channels/600834479145353243/600839784700837926) and tell us what you'd like to build- we highly encourage contributions!
If you'd like to see the Celo SDK expanded to support your favorite technology or application, please join the conversation on the [Celo Forum](https://forum.celo.org/c/applications-and-ecosystem-development) or [Discord](https://discordapp.com/channels/600834479145353243/600834479145353245) and tell us what you'd like to build- we highly encourage contributions!

{% hint style="info" %}
Please note, financial products built on the Celo protocol may be regulated in their respective jurisdictions, so it is important that developers are responsible and attentive to their end consumers and the regulations that may apply. This commitment is also part of the [Celo Code of Conduct](https://celo.org/code-of-conduct).
Expand Down
6 changes: 3 additions & 3 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"build:ts": "tsc --noEmit",
"build:metro": "echo 'NOT WORKING RIGHT NOW'",
"build:gen-graphql-types": "gql-gen --schema http://localhost:8080/graphql --template graphql-codegen-typescript-template --out ./typings/ 'src/**/*.tsx'",
"predev": "./scripts/pre-dev.sh",
"dev": "react-native run-android --appIdSuffix \"debug\"",
"dev:show-menu": "adb devices | grep '\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} adb -s {} shell input keyevent 82",
"dev:clear-data": "adb shell pm clear org.celo.mobile.debug",
Expand Down Expand Up @@ -46,7 +47,8 @@
]
},
"dependencies": {
"@celo/client": "640a41f",
"@celo/client": "c1ae452",
"@celo/react-components": "1.0.0",
"@celo/react-native-sms-retriever": "git+https://github.com/celo-org/react-native-sms-retriever#d3a2fdb",
"@celo/utils": "^0.1.1",
"@celo/walletkit": "^0.0.14",
Expand Down Expand Up @@ -80,7 +82,6 @@
"react-i18next": "^8.3.8",
"react-native": "0.59.10",
"react-native-android-open-settings": "^1.2.0",
"react-native-autocomplete-input": "^3.6.0",
"react-native-bip39": "git://github.com/celo-org/react-native-bip39#1488fa1",
"react-native-camera": "2.9.0",
"react-native-clock-sync": "^1.0.0",
Expand Down Expand Up @@ -137,7 +138,6 @@
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/runtime": "^7.4.3",
"@celo/react-components": "1.0.0",
"@celo/typescript": "0.0.1",
"@types/enzyme": "3.1.10",
"@types/enzyme-adapter-react-16": "1.0.4",
Expand Down
13 changes: 13 additions & 0 deletions packages/mobile/scripts/pre-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

# ====================================
# Tasks to run before running yarn dev
# ====================================

# Detect network from .env and build the sdk for it
ENV_FILENAME="${ENVFILE:-.env}"
export $(grep -v '^#' $ENV_FILENAME | xargs)
echo "Building sdk for testnet $DEFAULT_TESTNET"
yarn build:sdk $DEFAULT_TESTNET
echo "Done building sdk"
1 change: 0 additions & 1 deletion packages/mobile/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ declare module 'react-native-flag-secure-android'
declare module 'svgs'
declare module 'react-navigation-tabs'
declare module 'react-native-languages'
declare module 'react-native-autocomplete-input'
declare module 'react-native-swiper'
declare module 'react-native-version-check'
declare module 'react-native-randombytes'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ exports[`JoinCeloScreen renders correctly 1`] = `
autoCorrect={false}
data={Array []}
defaultValue="Canadá"
flatListProps={Object {}}
inputContainerStyle={
Array [
Object {
Expand All @@ -240,6 +241,7 @@ exports[`JoinCeloScreen renders correctly 1`] = `
},
]
}
keyExtractor={[Function]}
keyboardShouldPersistTaps="always"
listContainerStyle={
Object {
Expand Down Expand Up @@ -279,7 +281,6 @@ exports[`JoinCeloScreen renders correctly 1`] = `
renderItem={[Function]}
renderSeparator={null}
renderTextInput={[Function]}
rowHasChanged={[Function]}
style={
Array [
Object {
Expand Down Expand Up @@ -749,6 +750,7 @@ exports[`JoinCeloScreen renders with an error 1`] = `
autoCorrect={false}
data={Array []}
defaultValue="Canadá"
flatListProps={Object {}}
inputContainerStyle={
Array [
Object {
Expand All @@ -765,6 +767,7 @@ exports[`JoinCeloScreen renders with an error 1`] = `
},
]
}
keyExtractor={[Function]}
keyboardShouldPersistTaps="always"
listContainerStyle={
Object {
Expand Down Expand Up @@ -804,7 +807,6 @@ exports[`JoinCeloScreen renders with an error 1`] = `
renderItem={[Function]}
renderSeparator={null}
renderTextInput={[Function]}
rowHasChanged={[Function]}
style={
Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,7 @@ exports[`renders the Input step correctly 1`] = `
autoCorrect={false}
data={Array []}
defaultValue=""
flatListProps={Object {}}
inputContainerStyle={
Array [
Object {
Expand All @@ -2503,6 +2504,7 @@ exports[`renders the Input step correctly 1`] = `
},
]
}
keyExtractor={[Function]}
keyboardShouldPersistTaps="always"
listContainerStyle={
Object {
Expand Down Expand Up @@ -2542,7 +2544,6 @@ exports[`renders the Input step correctly 1`] = `
renderItem={[Function]}
renderSeparator={null}
renderTextInput={[Function]}
rowHasChanged={[Function]}
style={
Array [
Object {
Expand Down
Loading

0 comments on commit 08dc1af

Please sign in to comment.