状态同步 (Statesync)

For new validator nodes or full nodes, statesync can help reduce the time required to catch up to the current block, especially when chain history grows for a long time.

对于新的验证节点或全节点,statesync 可以帮助减少追平当前区块所需的时间,尤其是当链历史长时间增长后。

These are the settings we currently use for sei pruning and snapshotting for statesync

这些是我们目前用于状态同步的 sei 修剪和快照的设置

Pruning Settings 修剪设置: default

Snapshot Settings 快照设置 :

snapshot-interval = 1000
snapshot-keep-recent = 5

If you start a new node, you can quickly get caught up on the sei chains by configuring your statesync settings prior to starting the seid process. Below are instructions on how to enable statesync for your node along with specific configurations per sei chain environment.

如果您启动一个新节点,您可以通过在启动“seid”过程之前,设置您的同步配置来快速追平 sei 链。以下是如何为您的节点启用状态同步以及每个 sei 链环境特定配置的说明。

配置Statesync (Configuring Statesync)

Set the RPC address that your would like to use for statesync: 设置您希望用于 statesync 的 RPC 地址:

The RPC Address to set differs by chain environment 设置的RPC地址因链环境而异

Sei 激励测试网 (Sei Incentivized Testnet)

export RPC_ADDRESS="ec2-54-241-77-154.us-west-1.compute.amazonaws.com:26657"

Sei开发网 (Sei Devnet)

Coming Soon!
敬请期待

Get the current block info: 获取区块信息:

export CURR_HEIGHT=$(curl -s $RPC_ADDRESS/block | jq -r .result.block.header.height) && echo $CURR_HEIGHT

Get trust height and trust hash info for the block snapshot-interval blocks previous (1000 in the case of default pruning) and set it to TRUST_HEIGHT and TRUST_HASH respectively

获取区块快照块snapshot-interval先前的信任高度和信任哈希信息(默认修剪情况下为 1000)并将其分别设置为 TRUST_HEIGHT 和 TRUST_HASH

export TRUST_HEIGHT=$(($CURR_HEIGHT-1000)) && echo $TRUST_HEIGHT
export TRUST_HASH=$(curl -s $RPC_ADDRESS/block?height=$TRUST_HEIGHT | jq -r '.result.block_id.hash') && echo $TRUST_HASH

Update config.toml file with the RPC_ADDRESS, TRUST_HEIGHT, and TRUST_HASH using the following command:

使用以下命令,用 RPC_ADDRESSTRUST_HEIGHTTRUST_HASH 更新 config.toml 文件:

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$RPC_ADDRESS,$RPC_ADDRESS\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$TRUST_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.sei/config/config.toml

Reset the chain history: 重置链历史:

seid tendermint unsafe-reset-all --home $HOME/.sei

You may also need to set the node as a persistent peer: 您可能还需要将节点设置为持久对等点:

The persistent peer to set differs by chain environment 要设置的持久对等点因链环境而异

Sei激励性测试网 (Sei Incentivized Testnet)

peers="c22205240014c51d9c5126c3840315cda50275fd@ec2-54-241-77-154.us-west-1.compute.amazonaws.com:26656"; \
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.sei/config/config.toml

Sei开发网 (Sei Devnet)

Coming Soon!
敬请期待

You can now start your chain and it should find snapshots and catch up. Once you are fully caught up, you may want to disable statesync to avoid any issues when restarting the chain in the future such as during upgrades:

您现在可以启动您的链,它应该会找到快照并追平。一旦你完全追平了,可能会想要禁用 statesync ,进而避免将来重启链时出现任何问题,比如在升级期间:

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1false|" $HOME/.sei/config/config.toml

最后更新于