Skip to content

Commit 7af5df3

Browse files
authored
Merge pull request #1110 from ainblockchain/release/v1.0.10
Release/v1.0.10
2 parents 80c7d7a + 8dab1d9 commit 7af5df3

26 files changed

+590
-229
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ You can override default port numbering system by setting `PORT` and `P2P_PORT`
4040
#### On Google Coud Platform (GCP)
4141

4242
- Deploy code (in common with Node server)
43-
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.
43+
Set <# 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.
4444
```
4545
gcloud init
46-
# For one-off deploy
47-
bash deploy_blockchain_gcp.sh {dev|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
46+
# For genesis deploy
47+
bash deploy_blockchain_genesis_gcp.sh {dev|staging|spring|summer} <# of Shards> [--setup]
4848
# For incremental deploy
49-
bash deploy_blockchain_incremental_gcp.sh {dev|staging|exp|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
49+
bash deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup]
5050
```
5151
- Set up Ubuntu machine (if it's on a new VM)
5252
```
@@ -127,13 +127,13 @@ BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard MIN_NUM_VALIDATORS=1 DEBUG=
127127
#### On Google Cloud Platform (GCP)
128128

129129
- Deploy code (in common with Tracker server)
130-
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.
130+
Set <# 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.
131131
```
132132
gcloud init
133-
# For one-off deploy
134-
bash deploy_blockchain_gcp.sh {dev|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
133+
# For genesis deploy
134+
bash deploy_blockchain_genesis_gcp.sh {dev|staging|spring|summer} <# of Shards> [--setup]
135135
# For incremental deploy
136-
bash deploy_blockchain_incremental_gcp.sh {dev|staging|exp|spring|summer} <YOUR_GCP_USER_NAME> <NUMBER_OF_SHARDS> [--setup]
136+
bash deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup]
137137
```
138138
- Set up Ubuntu machine (if it's on a new VM)
139139
```

blockchain-configs/base/timer_flags.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,13 @@
3939
"add_app_creation_gas_amount": {
4040
"enabled_block": 2,
4141
"has_bandage": true
42+
},
43+
"allow_non_negative_transfer_value_only": {
44+
"enabled_block": 2,
45+
"has_bandage": true
46+
},
47+
"update_min_gc_num_siblings_deleted": {
48+
"enabled_block": 2,
49+
"has_bandage": true
4250
}
4351
}

blockchain-configs/mainnet-prod/timer_flags.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,13 @@
3838
"add_app_creation_gas_amount": {
3939
"enabled_block": 584000,
4040
"has_bandage": true
41+
},
42+
"allow_non_negative_transfer_value_only": {
43+
"enabled_block": 1414800,
44+
"has_bandage": true
45+
},
46+
"update_min_gc_num_siblings_deleted": {
47+
"enabled_block": 1414800,
48+
"has_bandage": true
4149
}
4250
}

blockchain-configs/testnet-dev/timer_flags.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@
3232
"has_bandage": false
3333
},
3434
"extend_account_registration_gas_amount": {
35-
"enabled_block": 224300,
35+
"enabled_block": 2,
3636
"has_bandage": false
3737
},
3838
"add_app_creation_gas_amount": {
39-
"enabled_block": 224300,
39+
"enabled_block": 2,
40+
"has_bandage": true
41+
},
42+
"allow_non_negative_transfer_value_only": {
43+
"enabled_block": 2,
44+
"has_bandage": true
45+
},
46+
"update_min_gc_num_siblings_deleted": {
47+
"enabled_block": 2,
4048
"has_bandage": true
4149
}
4250
}

blockchain-configs/testnet-prod/timer_flags.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,13 @@
4242
"add_app_creation_gas_amount": {
4343
"enabled_block": 569800,
4444
"has_bandage": true
45+
},
46+
"allow_non_negative_transfer_value_only": {
47+
"enabled_block": 1411300,
48+
"has_bandage": true
49+
},
50+
"update_min_gc_num_siblings_deleted": {
51+
"enabled_block": 1411300,
52+
"has_bandage": true
4553
}
4654
}

client/protocol_versions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,8 @@
104104
},
105105
"1.0.9": {
106106
"min": "1.0.0"
107+
},
108+
"1.0.10": {
109+
"min": "1.0.0"
107110
}
108111
}

common/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ const ValueChangedEventSources = {
676676
const FilterDeletionReasons = {
677677
FILTER_TIMEOUT: 'FILTER_TIMEOUT',
678678
END_STATE_REACHED: 'END_STATE_REACHED',
679+
DELETED_BY_USER: 'DELETED_BY_USER',
680+
ERROR_OCCURRED: 'ERROR_OCCURRED',
679681
}
680682

681683
// ** Lists & Sets **

common/result-code.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ const EventHandlerErrorCode = {
223223
EVENT_CHANNEL_EXCEEDS_SIZE_LIMIT: 70014,
224224
EVENT_FILTER_EXCEEDS_SIZE_LIMIT: 70015,
225225
EVENT_FILTER_EXCEEDS_SIZE_LIMIT_PER_CHANNEL: 70016,
226+
FAILED_TO_REGISTER_FILTER: 70020,
227+
FAILED_TO_DEREGISTER_FILTER: 70030,
226228
// BLOCK_FINALIZED (701XX)
227229
NEGATIVE_BLOCK_NUMBER: 70100,
228230
INVALID_BLOCK_NUMBER_TYPE: 70101,

copy_blockchain_data_gcp.sh

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/bin/bash
2+
3+
function usage() {
4+
printf "Usage: bash copy_blockchain_data_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <Node Index> [download|upload]\n"
5+
printf "Example: bash copy_blockchain_data_gcp.sh spring 5 download\n"
6+
printf "\n"
7+
exit
8+
}
9+
10+
if [[ $# -lt 3 ]] || [[ $# -gt 3 ]]; then
11+
usage
12+
fi
13+
14+
if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[ "$1" = 'exp' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'summer' ]] || [[ "$1" = 'mainnet' ]]; then
15+
SEASON="$1"
16+
if [[ "$1" = 'mainnet' ]]; then
17+
PROJECT_ID="mainnet-prod-ground"
18+
elif [[ "$1" = 'spring' ]] || [[ "$1" = 'summer' ]]; then
19+
PROJECT_ID="testnet-prod-ground"
20+
else
21+
PROJECT_ID="testnet-$1-ground"
22+
fi
23+
else
24+
printf "Invalid <Project/Season> argument: $1\n"
25+
exit
26+
fi
27+
printf "\n"
28+
printf "SEASON=$SEASON\n"
29+
printf "PROJECT_ID=$PROJECT_ID\n"
30+
31+
GCP_USER="runner"
32+
printf "GCP_USER=$GCP_USER\n"
33+
34+
number_re='^[0-9]+$'
35+
if ! [[ $2 =~ $number_re ]] ; then
36+
printf "\n"
37+
printf "Invalid <Node Index> argument: $2\n"
38+
exit
39+
fi
40+
NODE_INDEX=$2
41+
if [[ $NODE_INDEX -lt 0 ]] || [[ $NODE_INDEX -gt 9 ]]; then
42+
printf "\n"
43+
printf "Out-of-range <Node Index> argument: $NODE_INDEX\n"
44+
exit
45+
fi
46+
printf "NODE_INDEX=$NODE_INDEX\n"
47+
48+
if [[ "$3" = 'download' ]] || [[ "$3" = 'upload' ]]; then
49+
COMMAND="$3"
50+
else
51+
printf "\n"
52+
printf "Invalid <Command> argument: $3\n"
53+
printf "\n"
54+
usage
55+
fi
56+
printf "COMMAND=$COMMAND\n"
57+
58+
# Get confirmation.
59+
if [[ "$SEASON" = "mainnet" ]]; then
60+
printf "\n"
61+
printf "Do you want to proceed for $SEASON? Enter [mainnet]: "
62+
read CONFIRM
63+
printf "\n\n"
64+
if [[ ! $CONFIRM = "mainnet" ]]
65+
then
66+
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
67+
fi
68+
else
69+
printf "\n"
70+
read -p "Do you want to proceed for $SEASON? [y/N]: " -n 1 -r
71+
printf "\n\n"
72+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
73+
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
74+
fi
75+
fi
76+
77+
NODE_TARGET_ADDR_LIST=(
78+
"${GCP_USER}@${SEASON}-node-0-taiwan" \
79+
"${GCP_USER}@${SEASON}-node-1-oregon" \
80+
"${GCP_USER}@${SEASON}-node-2-singapore" \
81+
"${GCP_USER}@${SEASON}-node-3-iowa" \
82+
"${GCP_USER}@${SEASON}-node-4-netherlands" \
83+
"${GCP_USER}@${SEASON}-node-5-taiwan" \
84+
"${GCP_USER}@${SEASON}-node-6-oregon" \
85+
"${GCP_USER}@${SEASON}-node-7-singapore" \
86+
"${GCP_USER}@${SEASON}-node-8-iowa" \
87+
"${GCP_USER}@${SEASON}-node-9-netherlands" \
88+
)
89+
NODE_ZONE_LIST=(
90+
"asia-east1-b" \
91+
"us-west1-b" \
92+
"asia-southeast1-b" \
93+
"us-central1-a" \
94+
"europe-west4-a" \
95+
"asia-east1-b" \
96+
"us-west1-b" \
97+
"asia-southeast1-b" \
98+
"us-central1-a" \
99+
"europe-west4-a" \
100+
)
101+
102+
function download_data() {
103+
local node_index="$1"
104+
local node_target_addr=${NODE_TARGET_ADDR_LIST[${node_index}]}
105+
local node_zone=${NODE_ZONE_LIST[${node_index}]}
106+
107+
printf "\n* >> Downloading data from node $node_index ($node_target_addr) *********************************************************\n\n"
108+
109+
printf "node_target_addr='$node_target_addr'\n"
110+
printf "node_zone='$node_zone'\n"
111+
112+
# 1. Create tgz file for node
113+
printf "\n\n<<< Creating tgz file for node $node_index >>>\n\n"
114+
TGZ_CMD="gcloud compute ssh $node_target_addr --command 'cd /home/ain_blockchain_data; tar cvf - chains snapshots | gzip -c > ~/ain_blockchain_data.tar.gz' --project $PROJECT_ID --zone $node_zone"
115+
printf "TGZ_CMD=$TGZ_CMD\n\n"
116+
eval $TGZ_CMD
117+
118+
# 2. Copy tgz file from node
119+
printf "\n\n<<< Copying tgz file from node $node_index >>>\n\n"
120+
SCP_CMD="gcloud compute scp $node_target_addr:~/ain_blockchain_data.tar.gz . --project $PROJECT_ID --zone $node_zone"
121+
printf "SCP_CMD=$SCP_CMD\n\n"
122+
eval $SCP_CMD
123+
124+
# 3. Clean up tgz file for node
125+
printf "\n\n<<< Cleaning up tgz file for node $node_index >>>\n\n"
126+
CLEANUP_CMD="gcloud compute ssh $node_target_addr --command 'rm ~/ain_blockchain_data.tar.gz' --project $PROJECT_ID --zone $node_zone"
127+
printf "CLEANUP_CMD=$CLEANUP_CMD\n\n"
128+
eval $CLEANUP_CMD
129+
}
130+
131+
function upload_data() {
132+
local node_index="$1"
133+
local node_target_addr=${NODE_TARGET_ADDR_LIST[${node_index}]}
134+
local node_zone=${NODE_ZONE_LIST[${node_index}]}
135+
136+
printf "\n* >> Uploading data from node $node_index ($node_target_addr) *********************************************************\n\n"
137+
138+
printf "node_target_addr='$node_target_addr'\n"
139+
printf "node_zone='$node_zone'\n"
140+
141+
# 1. Copy tgz file to node
142+
printf "\n\n<<< Copying tgz file to node $node_index >>>\n\n"
143+
SCP_CMD="gcloud compute scp ./ain_blockchain_data.tar.gz $node_target_addr:~ --project $PROJECT_ID --zone $node_zone"
144+
printf "SCP_CMD=$SCP_CMD\n\n"
145+
eval $SCP_CMD
146+
147+
# 2. Extract tgz file for node
148+
printf "\n\n<<< Extracting tgz file for node $node_index >>>\n\n"
149+
TGZ_CMD="gcloud compute ssh $node_target_addr --command 'cd /home; sudo mkdir -p ain_blockchain_data; sudo chown runner:runner ain_blockchain_data; sudo chmod 777 ain_blockchain_data; cd ain_blockchain_data; gzip -dc ~/ain_blockchain_data.tar.gz | tar xvf -' --project $PROJECT_ID --zone $node_zone"
150+
printf "TGZ_CMD=$TGZ_CMD\n\n"
151+
eval $TGZ_CMD
152+
153+
# 3. Clean up tgz file for node
154+
printf "\n\n<<< Cleaning up tgz file for node $node_index >>>\n\n"
155+
CLEANUP_CMD="gcloud compute ssh $node_target_addr --command 'rm ~/ain_blockchain_data.tar.gz' --project $PROJECT_ID --zone $node_zone"
156+
printf "CLEANUP_CMD=$CLEANUP_CMD\n\n"
157+
eval $CLEANUP_CMD
158+
}
159+
160+
if [[ "$COMMAND" = 'upload' ]]; then
161+
upload_data "$NODE_INDEX"
162+
else
163+
download_data "$NODE_INDEX"
164+
fi
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
data: [
3+
{
4+
path: ['rules', 'transfer', '$from', '$to', '$key', 'value' ],
5+
value: {
6+
'.rule': {
7+
"write": "(auth.addr === $from || auth.fid === '_stake' || auth.fid === '_unstake' || auth.fid === '_pay' || auth.fid === '_claim' || auth.fid === '_hold' || auth.fid === '_release' || auth.fid === '_collectFee' || auth.fid === '_claimReward' || auth.fid === '_openCheckout' || auth.fid === '_closeCheckout' || auth.fid === '_closeCheckin') && !getValue('transfer/' + $from + '/' + $to + '/' + $key) && (util.isServAcntName($from, blockNumber) || util.isCksumAddr($from)) && (util.isServAcntName($to, blockNumber) || util.isCksumAddr($to)) && $from !== $to && util.isNumber(newData) && newData > 0 && util.getBalance($from, getValue) >= newData"
8+
}
9+
},
10+
// From allow_lower_case_app_names_only bandage file.
11+
prevValue: {
12+
".rule": {
13+
"write": "(auth.addr === $from || auth.fid === '_stake' || auth.fid === '_unstake' || auth.fid === '_pay' || auth.fid === '_claim' || auth.fid === '_hold' || auth.fid === '_release' || auth.fid === '_collectFee' || auth.fid === '_claimReward' || auth.fid === '_openCheckout' || auth.fid === '_closeCheckout' || auth.fid === '_closeCheckin') && !getValue('transfer/' + $from + '/' + $to + '/' + $key) && (util.isServAcntName($from, blockNumber) || util.isCksumAddr($from)) && (util.isServAcntName($to, blockNumber) || util.isCksumAddr($to)) && $from !== $to && util.isNumber(newData) && util.getBalance($from, getValue) >= newData"
14+
}
15+
}
16+
}
17+
]
18+
};

0 commit comments

Comments
 (0)