Skip to content

Commit d017f98

Browse files
xianhuaweidustinxie
authored andcommitted
add staking patch support
1 parent 52ff704 commit d017f98

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

184_patch/patch.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# v1.8.4 patch
2+
In the past 2 weeks certain IoTeX nodes run into an issue of failing to sync with
3+
most recent blocks. After careful analysis it was root-caused to an incorrect state
4+
in memory storage, which may occur when a node restarts.
5+
6+
## Impact
7+
A node could be affected by this issue if it has restarted sometime between Sep 30
8+
and Oct 08, 2002. It will get stuck on a certain height if it happens.
9+
10+
## Solution
11+
This issue has been fixed in the v1.8.4 release. A script tool has been provided
12+
to download a patch file, which would correctly restore the internal state.
13+
14+
This fix is **not** a hard-fork, and is **only** needed one-time. After applying
15+
the patch, the node will be able to successfully restart and continue to run. It
16+
does **not** need to rely on this patch in the future restarts.
17+
18+
Follow steps below to apply the patch and upgrade to v1.8.4.
19+
20+
## Apply the patch
21+
1. First, stop your IoTeX node and remove the docker container. This is **needed**
22+
to ensure that the patch fix can be applied correctly and the node can successfully
23+
restart later.
24+
2. Download the patch script:
25+
```
26+
curl https://raw.githubusercontent.com/iotexproject/iotex-bootstrap/v1.8.4/184_patch/patch.sh > ./patch.sh
27+
```
28+
3. `chmod a+x ./patch.sh`
29+
4. Make sure you have the `$IOTEX_HOME` environment variable properly set. It is
30+
the full-node home directory containing all node settings and data files in the
31+
`/etc`, `/data`, `/log` sub-directories. By default, it is `/iotex-var`, you can
32+
check it by `echo $IOTEX_HOME`. If it is not set, when you run the script in the
33+
next step you will be asked to input it, make sure you enter the right directory
34+
using absolute path.
35+
5. Run the script `./patch.sh`, it will download the proper patch file, you will
36+
see message like:
37+
```
38+
download /iotex-var/data/19901069.patch success, please upgrade to v1.8.4 and restart iotex-server
39+
```
40+
41+
## Upgrade to v1.8.4
42+
Now with the correct path file in place, it's time to upgrade to v1.8.4.
43+
```
44+
docker pull iotex/iotex-core:v1.8.4
45+
```
46+
Restart your node as usual, but use `iotex/iotex-core:v1.8.4` image in the docker
47+
script/commandline. Your node should apply the patch file, and then continue to
48+
run normally.

184_patch/patch.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
read -p "Please confirm that the iotex server process has been stopped [yes/no] (Default: no)" check
2+
3+
if [ "${check}"X != "yes"X ];then
4+
echo "the iotex server process is not stopped. Please stop the process first"
5+
exit 1
6+
fi
7+
8+
#check IOTEX_HOME variable & statedb path
9+
if [ ! $IOTEX_HOME ] || [ ! -f ${IOTEX_HOME}/data/trie.db ];then
10+
read -p "Input your \$IOTEX_HOME : " inputdir
11+
IOTEX_HOME=${inputdir}
12+
fi
13+
14+
echo "IOTEX_HOME : $IOTEX_HOME"
15+
16+
17+
cd $IOTEX_HOME
18+
19+
#download readtip file
20+
curl https://storage.googleapis.com/blockchain-archive/readtip > $IOTEX_HOME/readtip
21+
22+
if [ ! -f $IOTEX_HOME/readtip ];then
23+
echo "$IOTEX_HOME/readtip does not exist"
24+
exit 1
25+
fi
26+
27+
chmod a+x $IOTEX_HOME/readtip
28+
29+
tipHeight=`$IOTEX_HOME/readtip -state-db-path=$IOTEX_HOME/data/trie.db`
30+
31+
if [ ! $tipHeight ];then
32+
echo "can't get $tipHeight"
33+
exit 1
34+
fi
35+
36+
echo "tip height : $tipHeight"
37+
38+
#download the patch file
39+
if [ $tipHeight -gt 19778036 ];then
40+
ServerIP='patch.iotex.io'
41+
patchUrl=`curl https://$ServerIP/$tipHeight`
42+
echo "the patch url: $patchUrl"
43+
44+
patchFile=$IOTEX_HOME/data/$tipHeight.patch
45+
curl $patchUrl >$patchFile
46+
47+
if [ ! -f $patchFile ];then
48+
echo "$patchFile does not exist"
49+
exit 1
50+
fi
51+
fi
52+
53+
echo "download $patchFile success, please upgrade to v1.8.4 and restart iotex-server"

0 commit comments

Comments
 (0)