Skip to content

Commit

Permalink
Merge pull request #1034 from ainblockchain/release/v1.0.7
Browse files Browse the repository at this point in the history
Release/v1.0.7
  • Loading branch information
minsulee2 authored May 17, 2022
2 parents 5fb134b + df77824 commit ee604d7
Show file tree
Hide file tree
Showing 83 changed files with 3,887 additions and 2,119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'develop'
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/setup-gcloud@master
- uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.PERF_TEST_PIPELINE_GCP_SA_KEY }}
project_id: ${{ secrets.PERF_TEST_PIPELINE_GCP_PROJECT_ID }}
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM node:10.14
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
FROM node:16.14
WORKDIR /app/ain-blockchain
COPY . /app/ain-blockchain
RUN yarn install
EXPOSE 8080 5000
CMD node client/index.js
ARG SEASON
ENV SEASON=$SEASON
ENTRYPOINT bash ./start_node_docker.sh
51 changes: 36 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ yarn install
```
- Run blockchain nodes
```
ACCOUNT_INJECTION_OPTION=keystore KEYSTORE_FILE_PATH=/path/to/keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
ACCOUNT_INJECTION_OPTION=keystore KEYSTORE_FILE_PATH=/path/to/keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
ACCOUNT_INJECTION_OPTION=keystore KEYSTORE_FILE_PATH=/path/to/keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
ACCOUNT_INJECTION_OPTION=keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
ACCOUNT_INJECTION_OPTION=keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
ACCOUNT_INJECTION_OPTION=keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
```
You can override default port numbering system by setting `PORT` and `P2P_PORT` environment variables.
Before starting node jobs, remove existing blockchain files and logs if necessary:
Expand All @@ -121,7 +121,7 @@ The default minimum size of the validator whitelist is 3. Change MIN_NUM_VALIDAT
the blockchain-configs/base/genesis.json to change this value. You may also need to modify the GENESIS_WHITELIST and GENESIS_VALIDATORS accordingly.
The genesis configs directory used is `blockchain-configs/base` by default and it can be altered using `BLOCKCHAIN_CONFIGS_DIR` env variable. For example, afan shard cluster can use the following command line:
```
BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard MIN_NUM_VALIDATORS=1 ACCOUNT_INJECTION_OPTION=keystore KEYSTORE_FILE_PATH=/path/to/keystore DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard MIN_NUM_VALIDATORS=1 DEBUG=false STAKE=100000 CONSOLE_LOG=true ENABLE_GAS_FEE_WORKAROUND=true node client/index.js
```

#### On Google Cloud Platform (GCP)
Expand All @@ -148,22 +148,43 @@ source setup_node_gcp.sh
bash start_node_genesis_gcp.sh {dev|spring|summer} <SHARD_INDEX> <SERVER_INDEX>
```

<!--
### Running with Docker

- Build Docker image
- Pull Docker image from [Docker Hub](https://hub.docker.com/repository/docker/ainblockchain/ain-blockchain)
```
docker build -t ain-blockchain .
docker pull ainblockchain/ain-blockchain:dev
docker pull ainblockchain/ain-blockchain:dev-1.0.6
docker pull ainblockchain/ain-blockchain:{mainnet|summer|spring|sandbox|staging|exp|dev}-<PACKAGE_VERSION>
```
- Pull Docker image
- Or build Docker image yourself
```
docker pull ainblockchain/blockchain-database
docker build -t ain-blockchain --build-arg SEASON={mainnet|summer|spring|sandbox|staging|exp|dev} .
```
- Run with Docker image
- Run with Docker image example
```
docker run -e ACCOUNT_INJECTION_OPTION=private_key -e SYNC_MODE=peer -e STAKE=10000 --network="host" -d ainblockchain/ain-blockchain:dev
docker run -e ACCOUNT_INJECTION_OPTION=keystore -e SYNC_MODE=peer -e STAKE=10000 --network="host" -d ainblockchain/ain-blockchain:mainnet
```
You can use some environment variables, and these have the following options.
```
docker run -e ACCOUNT_INJECTION_OPTION=keystore KEYSTORE_FILE_PATH=/path/to/keystore --network="host" -d ainblockchain/ain-blockchain:latest
-e ACCOUNT_INJECTION_OPTION={private_key|keystore|mnemonic}
-e SYNC_MODE={fast|full|peer}
-e STAKE=<YOUR_TARGET_STAKE>
```
After the node is executed, you should inject your account into the node.
```
node inject_account_gcp.js <NODE_ENDPOINT_URL> --private-key
node inject_account_gcp.js <NODE_ENDPOINT_URL> --keystore
node inject_account_gcp.js <NODE_ENDPOINT_URL> --mnemonic
```
If you want to inject your account automatically, add one of these environment variables before running the node.
```
-e ACCOUNT_INJECTION_OPTION=private_key -e PRIVATE_KEY=<YOUR_PRIVATE_KEY>
-e ACCOUNT_INJECTION_OPTION=keystore -e KEYSTORE_FILE_PATH="/path/to/keystore" -e PASSWORD=<YOUR_PASSWORD>
-e ACCOUNT_INJECTION_OPTION=mnemonic -e MNEMONIC="your mnemonic"
```

<!--
#### Enter Docker container and inspect blockchain files
```
Expand Down Expand Up @@ -308,13 +329,13 @@ POST http://<ip_address>:8080/batch with json_body {"tx_list": [{"operation": {"

## Utility scripts

Four Node server with a Tracker server can be started all at once using `start_servers.sh` like:
Four Node server with a Tracker server can be started all at once using `start_local_blockchain.sh` like:
```
bash start_servers.sh
bash start_local_blockchain.sh
```
and can be stopped all at once using `stop_servers.sh` like:
and can be stopped all at once using `stop_local_blockchain.sh` like:
```
bash stop_servers.sh
bash stop_local_blockchain.sh
```

## Versions
Expand Down
4 changes: 2 additions & 2 deletions block-pool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class BlockPool {
* @param {DB} baseDb The DB instance should be the base of where evidence votes should be executed on.
* @returns { offenses, evidence }
*/
getOffensesAndEvidence(validators, recordedInvalidBlockHashSet, blockNumber, blockTime, baseDb) {
getOffensesAndEvidence(validators, recordedInvalidBlockHashSet, blockNumber, blockTime, baseDb, eventSource) {
const LOG_HEADER = 'getOffensesAndEvidence';
const totalAtStake = ConsensusUtil.getTotalAtStake(validators);
const baseBlockNumber = baseDb.blockNumberSnapshot;
Expand Down Expand Up @@ -620,7 +620,7 @@ class BlockPool {
const stake = _get(validators, `${vote.address}.stake`, 0);
if (stake > 0) {
const res = baseDb.executeTransaction(
Transaction.toExecutable(vote, chainId), true, true, blockNumber, blockTime);
Transaction.toExecutable(vote, chainId), true, true, blockNumber, blockTime, eventSource);
if (CommonUtil.isFailedTx(res)) {
logger.debug(`[${LOG_HEADER}] Failed to execute evidence vote:\n${JSON.stringify(vote, null, 2)}\n${JSON.stringify(res, null, 2)})`);
} else {
Expand Down
10 changes: 8 additions & 2 deletions blockchain-configs/afan-shard/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"DEV_CLIENT_API_IP_WHITELIST": "*",
"DEFAULT_AXIOS_REQUEST_TIMEOUT": 20000,
"ENABLE_DEV_CLIENT_SET_API": true,
"ENABLE_EARLY_TX_SIG_VERIF": true,
"ENABLE_EVENT_HANDLER": false,
"ENABLE_EXPRESS_RATE_LIMIT": true,
"ENABLE_GAS_FEE_WORKAROUND": true,
Expand All @@ -29,13 +30,17 @@
"ENABLE_TX_SIG_VERIF_WORKAROUND": false,
"EVENT_HANDLER_PORT": 6000,
"EVENT_HANDLER_HEARTBEAT_INTERVAL_MS": 15000,
"FREE_TX_POOL_SIZE_LIMIT_RATIO": 0.1,
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 200000000,
"GET_RESP_MAX_SIBLINGS": 50000,
"HOSTING_ENV": "local",
"KEYSTORE_FILE_PATH": null,
"LIGHTWEIGHT": false,
"MAX_FINALIZED_BLOCK_INFO_ON_MEM": 1000,
"MAX_NUM_EVENT_CHANNELS": 10,
"MAX_NUM_EVENT_FILTERS": 20,
"MAX_NUM_EVENT_FILTERS_PER_CHANNEL": 5,
"MAX_NUM_INBOUND_CONNECTION": 3,
"MAX_NUM_SNAPSHOTS": 10,
"OLD_CHAIN_SEGMENT_LENGTH": 20,
Expand Down Expand Up @@ -71,5 +76,6 @@
"TX_POOL_SIZE_LIMIT_PER_ACCOUNT": 100,
"TX_POOL_TIMEOUT_MS": 3600000,
"TX_TRACKER_TIMEOUT_MS": 86400000,
"UNSAFE_PRIVATE_KEY": null
"UNSAFE_PRIVATE_KEY": null,
"UPDATE_NEW_FINAL_FRONT_DB_WITH_TX_POOL": true
}
10 changes: 8 additions & 2 deletions blockchain-configs/base/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"DEV_CLIENT_API_IP_WHITELIST": "*",
"DEFAULT_AXIOS_REQUEST_TIMEOUT": 20000,
"ENABLE_DEV_CLIENT_SET_API": true,
"ENABLE_EARLY_TX_SIG_VERIF": true,
"ENABLE_EVENT_HANDLER": false,
"ENABLE_EXPRESS_RATE_LIMIT": true,
"ENABLE_GAS_FEE_WORKAROUND": true,
Expand All @@ -29,13 +30,17 @@
"ENABLE_TX_SIG_VERIF_WORKAROUND": false,
"EVENT_HANDLER_PORT": 6000,
"EVENT_HANDLER_HEARTBEAT_INTERVAL_MS": 15000,
"FREE_TX_POOL_SIZE_LIMIT_RATIO": 0.1,
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 200000000,
"GET_RESP_MAX_SIBLINGS": 50000,
"HOSTING_ENV": "local",
"KEYSTORE_FILE_PATH": null,
"LIGHTWEIGHT": false,
"MAX_FINALIZED_BLOCK_INFO_ON_MEM": 1000,
"MAX_NUM_EVENT_CHANNELS": 10,
"MAX_NUM_EVENT_FILTERS": 20,
"MAX_NUM_EVENT_FILTERS_PER_CHANNEL": 5,
"MAX_NUM_INBOUND_CONNECTION": 6,
"MAX_NUM_SNAPSHOTS": 10,
"OLD_CHAIN_SEGMENT_LENGTH": 20,
Expand Down Expand Up @@ -71,5 +76,6 @@
"TX_POOL_SIZE_LIMIT_PER_ACCOUNT": 100,
"TX_POOL_TIMEOUT_MS": 3600000,
"TX_TRACKER_TIMEOUT_MS": 86400000,
"UNSAFE_PRIVATE_KEY": null
"UNSAFE_PRIVATE_KEY": null,
"UPDATE_NEW_FINAL_FRONT_DB_WITH_TX_POOL": true
}
8 changes: 8 additions & 0 deletions blockchain-configs/base/timer_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,13 @@
"enabled_block": 2,
"has_bandage": false,
"_note": "Remove this flag or set disabled_block to 2 if you need to run with the tx receipt recording feature"
},
"extend_account_registration_gas_amount": {
"enabled_block": 2,
"has_bandage": false
},
"add_app_creation_gas_amount": {
"enabled_block": 2,
"has_bandage": true
}
}
10 changes: 8 additions & 2 deletions blockchain-configs/he-shard/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"DEV_CLIENT_API_IP_WHITELIST": "*",
"DEFAULT_AXIOS_REQUEST_TIMEOUT": 20000,
"ENABLE_DEV_CLIENT_SET_API": true,
"ENABLE_EARLY_TX_SIG_VERIF": true,
"ENABLE_EVENT_HANDLER": false,
"ENABLE_EXPRESS_RATE_LIMIT": true,
"ENABLE_GAS_FEE_WORKAROUND": true,
Expand All @@ -29,13 +30,17 @@
"ENABLE_TX_SIG_VERIF_WORKAROUND": false,
"EVENT_HANDLER_PORT": 6000,
"EVENT_HANDLER_HEARTBEAT_INTERVAL_MS": 15000,
"FREE_TX_POOL_SIZE_LIMIT_RATIO": 0.1,
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 200000000,
"GET_RESP_MAX_SIBLINGS": 50000,
"HOSTING_ENV": "local",
"KEYSTORE_FILE_PATH": null,
"LIGHTWEIGHT": false,
"MAX_FINALIZED_BLOCK_INFO_ON_MEM": 1000,
"MAX_NUM_EVENT_CHANNELS": 10,
"MAX_NUM_EVENT_FILTERS": 20,
"MAX_NUM_EVENT_FILTERS_PER_CHANNEL": 5,
"MAX_NUM_INBOUND_CONNECTION": 6,
"MAX_NUM_SNAPSHOTS": 10,
"OLD_CHAIN_SEGMENT_LENGTH": 20,
Expand Down Expand Up @@ -71,5 +76,6 @@
"TX_POOL_SIZE_LIMIT_PER_ACCOUNT": 100,
"TX_POOL_TIMEOUT_MS": 3600000,
"TX_TRACKER_TIMEOUT_MS": 86400000,
"UNSAFE_PRIVATE_KEY": null
"UNSAFE_PRIVATE_KEY": null,
"UPDATE_NEW_FINAL_FRONT_DB_WITH_TX_POOL": true
}
10 changes: 8 additions & 2 deletions blockchain-configs/mainnet-prod/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"DEV_CLIENT_API_IP_WHITELIST": [],
"DEFAULT_AXIOS_REQUEST_TIMEOUT": 20000,
"ENABLE_DEV_CLIENT_SET_API": false,
"ENABLE_EARLY_TX_SIG_VERIF": true,
"ENABLE_EVENT_HANDLER": false,
"ENABLE_EXPRESS_RATE_LIMIT": true,
"ENABLE_GAS_FEE_WORKAROUND": true,
Expand All @@ -28,13 +29,17 @@
"ENABLE_TX_SIG_VERIF_WORKAROUND": false,
"EVENT_HANDLER_PORT": 6000,
"EVENT_HANDLER_HEARTBEAT_INTERVAL_MS": 15000,
"FREE_TX_POOL_SIZE_LIMIT_RATIO": 0.1,
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 200000000,
"GET_RESP_MAX_SIBLINGS": 50000,
"HOSTING_ENV": "gcp",
"KEYSTORE_FILE_PATH": null,
"LIGHTWEIGHT": false,
"MAX_FINALIZED_BLOCK_INFO_ON_MEM": 1000,
"MAX_NUM_EVENT_CHANNELS": 10,
"MAX_NUM_EVENT_FILTERS": 20,
"MAX_NUM_EVENT_FILTERS_PER_CHANNEL": 5,
"MAX_NUM_INBOUND_CONNECTION": 6,
"MAX_NUM_SNAPSHOTS": 10,
"OLD_CHAIN_SEGMENT_LENGTH": 20,
Expand Down Expand Up @@ -70,5 +75,6 @@
"TX_POOL_SIZE_LIMIT_PER_ACCOUNT": 100,
"TX_POOL_TIMEOUT_MS": 3600000,
"TX_TRACKER_TIMEOUT_MS": 86400000,
"UNSAFE_PRIVATE_KEY": null
"UNSAFE_PRIVATE_KEY": null,
"UPDATE_NEW_FINAL_FRONT_DB_WITH_TX_POOL": true
}
8 changes: 8 additions & 0 deletions blockchain-configs/mainnet-prod/timer_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@
"disable_tx_receipt_recording": {
"enabled_block": 352000,
"has_bandage": false
},
"extend_account_registration_gas_amount": {
"enabled_block": 584000,
"has_bandage": false
},
"add_app_creation_gas_amount": {
"enabled_block": 584000,
"has_bandage": true
}
}
10 changes: 8 additions & 2 deletions blockchain-configs/sim-shard/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"DEV_CLIENT_API_IP_WHITELIST": "*",
"DEFAULT_AXIOS_REQUEST_TIMEOUT": 20000,
"ENABLE_DEV_CLIENT_SET_API": true,
"ENABLE_EARLY_TX_SIG_VERIF": true,
"ENABLE_EVENT_HANDLER": false,
"ENABLE_EXPRESS_RATE_LIMIT": true,
"ENABLE_GAS_FEE_WORKAROUND": true,
Expand All @@ -29,13 +30,17 @@
"ENABLE_TX_SIG_VERIF_WORKAROUND": false,
"EVENT_HANDLER_PORT": 6000,
"EVENT_HANDLER_HEARTBEAT_INTERVAL_MS": 15000,
"FREE_TX_POOL_SIZE_LIMIT_RATIO": 0.1,
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 200000000,
"GET_RESP_MAX_SIBLINGS": 50000,
"HOSTING_ENV": "local",
"KEYSTORE_FILE_PATH": null,
"LIGHTWEIGHT": false,
"MAX_FINALIZED_BLOCK_INFO_ON_MEM": 1000,
"MAX_NUM_EVENT_CHANNELS": 10,
"MAX_NUM_EVENT_FILTERS": 20,
"MAX_NUM_EVENT_FILTERS_PER_CHANNEL": 5,
"MAX_NUM_INBOUND_CONNECTION": 6,
"MAX_NUM_SNAPSHOTS": 10,
"OLD_CHAIN_SEGMENT_LENGTH": 20,
Expand Down Expand Up @@ -71,5 +76,6 @@
"TX_POOL_SIZE_LIMIT_PER_ACCOUNT": 100,
"TX_POOL_TIMEOUT_MS": 3600000,
"TX_TRACKER_TIMEOUT_MS": 86400000,
"UNSAFE_PRIVATE_KEY": null
"UNSAFE_PRIVATE_KEY": null,
"UPDATE_NEW_FINAL_FRONT_DB_WITH_TX_POOL": true
}
10 changes: 8 additions & 2 deletions blockchain-configs/testnet-dev/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"DEV_CLIENT_API_IP_WHITELIST": "*",
"DEFAULT_AXIOS_REQUEST_TIMEOUT": 20000,
"ENABLE_DEV_CLIENT_SET_API": false,
"ENABLE_EARLY_TX_SIG_VERIF": true,
"ENABLE_EVENT_HANDLER": false,
"ENABLE_EXPRESS_RATE_LIMIT": true,
"ENABLE_GAS_FEE_WORKAROUND": true,
Expand All @@ -29,13 +30,17 @@
"ENABLE_TX_SIG_VERIF_WORKAROUND": false,
"EVENT_HANDLER_PORT": 6000,
"EVENT_HANDLER_HEARTBEAT_INTERVAL_MS": 15000,
"FREE_TX_POOL_SIZE_LIMIT_RATIO": 0.1,
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 200000000,
"GET_RESP_MAX_SIBLINGS": 50000,
"HOSTING_ENV": "gcp",
"KEYSTORE_FILE_PATH": null,
"LIGHTWEIGHT": false,
"MAX_FINALIZED_BLOCK_INFO_ON_MEM": 1000,
"MAX_NUM_EVENT_CHANNELS": 10,
"MAX_NUM_EVENT_FILTERS": 20,
"MAX_NUM_EVENT_FILTERS_PER_CHANNEL": 5,
"MAX_NUM_INBOUND_CONNECTION": 6,
"MAX_NUM_SNAPSHOTS": 10,
"OLD_CHAIN_SEGMENT_LENGTH": 20,
Expand Down Expand Up @@ -71,5 +76,6 @@
"TX_POOL_SIZE_LIMIT_PER_ACCOUNT": 5000,
"TX_POOL_TIMEOUT_MS": 3600000,
"TX_TRACKER_TIMEOUT_MS": 86400000,
"UNSAFE_PRIVATE_KEY": null
"UNSAFE_PRIVATE_KEY": null,
"UPDATE_NEW_FINAL_FRONT_DB_WITH_TX_POOL": true
}
8 changes: 8 additions & 0 deletions blockchain-configs/testnet-dev/timer_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@
"disable_tx_receipt_recording": {
"enabled_block": 2,
"has_bandage": false
},
"extend_account_registration_gas_amount": {
"enabled_block": 224300,
"has_bandage": false
},
"add_app_creation_gas_amount": {
"enabled_block": 224300,
"has_bandage": true
}
}
Loading

0 comments on commit ee604d7

Please sign in to comment.