iov-one / starnamed

Other
7 stars 13 forks source link

State sync doesn’t work due to Block.Header.AppHash #174

Closed burningxxx closed 2 years ago

burningxxx commented 2 years ago

As hard we tried we were not able to make state sync work for starnamed, you can reproduce the problem by trying to state sync from our RPC node. Below is the configs.

sudo systemctl stop starnamed && starnamed unsafe-reset-all

SNAP_RPC="http://rpc2.nodejumper.io:34657"

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

peers="3180fdc5e477e675acd22e63477ce3a2db20edf9@rpc2.nodejumper.io:34656"
sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.starnamed/config/config.toml

sed -i -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" ~/.starnamed/config/config.toml

sudo systemctl restart starnamed && sudo journalctl -u starnamed -f --no-hostname -o cat

Here's the error that we faced:

panic: Failed to process committed block (8450020:E1C57BBFFD48C3A3C5EF35CFD0303362B29400CD8249B884D888D05A60D3D63B): wrong Block.Header.AppHash.  Expected CAE865629186AD80CB85EC24343710C959622B5384E2A83E629F4718D19681B7, got F3536CE3C64460AF9F5A16BA19CE2F1EDDBA01A9BBC6CC15260F1CF052278A94
goroutine 122 [running]:
github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).poolRoutine(0xc000cb8fc0, 0x1)
    github.com/tendermint/tendermint@v0.34.10/blockchain/v0/reactor.go:401 +0x1265
created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).SwitchToFastSync
    github.com/tendermint/tendermint@v0.34.10/blockchain/v0/reactor.go:125 +0xef
starnamed.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
starnamed.service: Failed with result 'exit-code'.
starnamed.service: Scheduled restart job, restart counter is at 1.
Stopped Starname Node.
Started Starname Node.

We were using v0.10.13 which seems to be the latest stable binaries. We also tried to state sync from v0.11.5 without any luck. Let us know if you need any further assistance on fixing this.