Skip to content

Commit 0449906

Browse files
authored
Merge pull request #402 from ainblockchain/release/0.7.3
Release/0.7.3 to master branch
2 parents e0e14aa + 2bdba4c commit 0449906

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2886
-1444
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This setup is for local run.
2+
name: AIN-blockchain CI/CD
3+
4+
on:
5+
push:
6+
branches:
7+
- 'develop'
8+
- 'release/*'
9+
- 'master'
10+
pull_request:
11+
branches:
12+
- 'develop'
13+
- 'release/*'
14+
- 'master'
15+
jobs:
16+
build_and_test:
17+
if: ${{ github.event_name == 'pull_request' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: actions/setup-node@v2
22+
with:
23+
node-version: '12.x'
24+
registry-url: 'https://registry.npmjs.org'
25+
- name: Install Yarn
26+
run: sudo npm install -g yarn
27+
- name: install pip
28+
run: |
29+
sudo apt-get install software-properties-common
30+
sudo apt-add-repository universe
31+
sudo apt-get update
32+
sudo apt-get -y install python-pip
33+
pip install ast
34+
- name: yarn install
35+
run: yarn install
36+
# - name: yarn unittest
37+
# run: yarn run test_unit
38+
- name: yarn integration test
39+
run: yarn run test_integration
40+
check_protocol_version:
41+
if: ${{ github.event_name == 'push' }}
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: test
46+
if: github.event_name == 'push'
47+
run: echo ${{github.event_name}}
48+
- name: get current version
49+
run: echo "VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
50+
- name: get min/max versions
51+
run: |
52+
echo "MIN_VERSION=$(cat client/protocol_versions.json | jq -r --arg var "$VERSION" '.[$var].min')" >> $GITHUB_ENV
53+
echo "MAX_VERSION=$(cat client/protocol_versions.json | jq -r --arg var "$VERSION" '.[$var].max')" >> $GITHUB_ENV
54+
- name: send results
55+
env:
56+
SLACK_WEBHOOK_TOKEN: ${{ secrets.SLACK_WEBHOOK_TOKEN }}
57+
run: |
58+
curl -X POST https://hooks.slack.com/services/$SLACK_WEBHOOK_TOKEN \
59+
-H "Content-Type: application/json" \
60+
-d '{"username": "ain-blockchain",
61+
"channel": "blockchain-testnet-deploy",
62+
"text": "New PR has just been merged(${{ github.ref }}, ${{ github.sha }}).\nCurrent version: '"$VERSION"', compatible with min('"$MIN_VERSION"'), max('"$MAX_VERSION"')",
63+
"icon_emoji": ":gem:"}'

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Official Javascript implementation of AI Network Blockchain.
77

88
Tracker server is required by new peers who wish to join the AIN network. Each peer is sent the ipaddress of 2 other nodes in the network. These nodes then gossip information through the network of all transactions and blocks.
99

10-
NOTE: Tracker Server must be started first before starting any blockchain node instances
10+
NOTE: Tracker Server must be started first before starting any blockchain node instances.
1111

1212
### Running without Docker
1313

@@ -33,7 +33,10 @@ You can override default port numbering system by setting `PORT` and `P2P_PORT`
3333
Set <NUMBER_OF_SHARDS> to 0 if you only want to run a parent chain, or set it to the specific number of shard chains you want to run in addition to the parent chain.
3434
```
3535
gcloud init
36-
sh deploy_blockchain_gcp.sh {dev|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS>
36+
# For one-off deploy
37+
sh deploy_blockchain_gcp.sh {dev|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
38+
# For incremental deploy
39+
sh deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
3740
```
3841
- Set up Ubuntu machine (if it's on a new VM)
3942
```
@@ -94,9 +97,9 @@ yarn install
9497
```
9598
- Run blockchain nodes
9699
```
97-
MIN_NUM_VALIDATORS=3 ACCOUNT_INDEX=0 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
98-
MIN_NUM_VALIDATORS=3 ACCOUNT_INDEX=1 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
99-
MIN_NUM_VALIDATORS=3 ACCOUNT_INDEX=2 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
100+
MIN_NUM_VALIDATORS=3 ACCOUNT_INDEX=0 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_SET_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
101+
MIN_NUM_VALIDATORS=3 ACCOUNT_INDEX=1 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_SET_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
102+
MIN_NUM_VALIDATORS=3 ACCOUNT_INDEX=2 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_SET_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
100103
```
101104
You can override default port numbering system by setting `PORT` and `P2P_PORT` environment variables.
102105
Before starting node jobs, remove existing blockchain files and logs if necessary:
@@ -107,7 +110,7 @@ The default minimum size of the validator whitelist is 3. Change MIN_NUM_VALIDAT
107110
the genesis-configs/base/genesis.json to change this value. You may also need to modify the GENESIS_WHITELIST and GENESIS_VALIDATORS accordingly.
108111
The genesis configs directory used is `genesis-configs/base` by default and it can be altered using `GENESIS_CONFIGS_DIR` env variable. For example, afan shard cluster can use the following command line:
109112
```
110-
GENESIS_CONFIGS_DIR=genesis-configs/afan-shard MIN_NUM_VALIDATORS=1 ACCOUNT_INDEX=0 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
113+
GENESIS_CONFIGS_DIR=genesis-configs/afan-shard MIN_NUM_VALIDATORS=1 ACCOUNT_INDEX=0 DEBUG=false STAKE=250 CONSOLE_LOG=true ENABLE_DEV_SET_CLIENT_API=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
111114
```
112115

113116
#### On Google Coud Platform (GCP)
@@ -116,7 +119,10 @@ GENESIS_CONFIGS_DIR=genesis-configs/afan-shard MIN_NUM_VALIDATORS=1 ACCOUNT_INDE
116119
Set <NUMBER_OF_SHARDS> to 0 if you only want to run a parent chain, or set it to the specific number of shard chains you want to run in addition to the parent chain.
117120
```
118121
gcloud init
119-
sh deploy_blockchain_gcp.sh {dev|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS>
122+
# For one-off deploy
123+
sh deploy_blockchain_gcp.sh {dev|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
124+
# For incremental deploy
125+
sh deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
120126
```
121127
- Set up Ubuntu machine (if it's on a new VM)
122128
```

blockchain-database.code-workspace

Lines changed: 0 additions & 7 deletions
This file was deleted.

blockchain/block-file-util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class BlockFileUtil {
2525
return this.getBlockFilenameByNumber(block.number);
2626
}
2727

28-
// TODO(csh): Don't use glob?
28+
// TODO(cshcomcom): Don't use glob?
2929
static getAllBlockPaths(chainPath) {
3030
const allBlockFilesPattern = `${chainPath}/${CHAINS_N2B_DIR_NAME}/*.${FILE_NAME_SUFFIX}`;
3131
return glob.sync(allBlockFilesPattern).sort(compare());
@@ -65,7 +65,7 @@ class BlockFileUtil {
6565
return isBlockEmpty;
6666
}
6767

68-
// TODO(csh): Change to asynchronous
68+
// TODO(cshcomcom): Change to asynchronous.
6969
static readBlock(blockPath) {
7070
const zippedFs = fs.readFileSync(blockPath);
7171
return JSON.parse(zlib.gunzipSync(zippedFs).toString());
@@ -76,7 +76,7 @@ class BlockFileUtil {
7676
return this.readBlock(blockPath);
7777
}
7878

79-
// TODO(csh): Change to asynchronous
79+
// TODO(cshcomcom): Change to asynchronous.
8080
static writeBlock(chainPath, block) {
8181
const blockPath = this.getBlockPath(chainPath, block.number);
8282
if (!fs.existsSync(blockPath)) {

blockchain/block.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class Block {
208208
static buildAccountsSetupTx(timestamp, privateKey, ownerAddress) {
209209
const transferOps = [];
210210
const otherAccounts = GenesisAccounts[AccountProperties.OTHERS];
211-
if (otherAccounts && Array.isArray(otherAccounts) && otherAccounts.length > 0 &&
211+
if (otherAccounts && ChainUtil.isArray(otherAccounts) && otherAccounts.length > 0 &&
212212
GenesisAccounts[AccountProperties.SHARES] > 0) {
213213
for (let i = 0; i < otherAccounts.length; i++) {
214214
const accountAddress = otherAccounts[i][AccountProperties.ADDRESS];
@@ -291,7 +291,7 @@ class Block {
291291
const firstTx = this.buildDbSetupTx(genesisTime, ownerPrivateKey);
292292
const secondTx = this.buildAccountsSetupTx(genesisTime, ownerPrivateKey, ownerAddress);
293293
const thirdTx = this.buildConsensusAppTx(genesisTime, ownerPrivateKey, ownerAddress);
294-
// TODO(lia): Change the logic to staking & signing by the current node
294+
// TODO(liayoo): Change the logic to staking & signing by the current node.
295295
const stakingTxs = this.buildGenesisStakingTxs(genesisTime);
296296

297297
return [firstTx, secondTx, thirdTx, ...stakingTxs];

blockchain/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Blockchain {
5050
}
5151
const newChain = this.loadChain();
5252
if (newChain) {
53-
// Note(minsu): Deal with the case the only genesis block was generated.
53+
// NOTE(minsulee2): Deal with the case the only genesis block was generated.
5454
if (newChain.length > 1) {
5555
lastBlockWithoutProposal = newChain.pop();
5656
const lastBlockPath = BlockFileUtil.getBlockPath(
@@ -163,7 +163,7 @@ class Blockchain {
163163
logger.error(`Genesis block is corrupted`);
164164
return false;
165165
}
166-
// TODO(lia): Check if the tx nonces are correct.
166+
// TODO(liayoo): Check if the tx nonces are correct.
167167
return Blockchain.isValidChainSegment(chain);
168168
}
169169

@@ -285,7 +285,7 @@ class Blockchain {
285285
if (!Number.isInteger(to) || to < 0) {
286286
to = this.lastBlockNumber() + 1;
287287
}
288-
if (to - from > CHAIN_SEGMENT_LENGTH) { // Note: To prevent large query
288+
if (to - from > CHAIN_SEGMENT_LENGTH) { // NOTE: To prevent large query.
289289
to = from + CHAIN_SEGMENT_LENGTH;
290290
}
291291
const chain = [];

0 commit comments

Comments
 (0)