-
Notifications
You must be signed in to change notification settings - Fork 281
Network Upgrade
Eventually go-opera community propose the changes to an existing protocol as a network upgrade.
Network upgrade (hard fork) may involve rule changes such that the software validating according to the old rules will see the events produced according to the new rules as invalid. In case of a network upgrade, all nodes meant to work in accordance with the new rules need to upgrade their software.
In a case of a network upgrade, it's important to upgrade the node before the network upgrade is activated. If node was upgraded after the network upgrade was activated, then node's state becomes dirty - in this case, a full re-sync is required. The state will become dirty because the outdated node will process new blocks/events according to the old rules, differently to the upgraded nodes.
Go-opera node tracks current network version by listening on-chain events.
By default, the node will show warning in a case of a network upgrade was activated before current node has upgraded to a latest version:
WARN [...] Network upgrade y.y.y was activated. Current node version is x.x.x. Please upgrade your node and re-sync the chain data.
If see this warning, then you cannot upgrade and restart your node anymore, because the node state is already spoiled. If you try to restart after a missed upgrade, you will see the warning:
WARN [...] Node's state is dirty because node was upgraded after the network upgrade y.y.y was activated. Please re-sync the chain data to continue.
You will have to re-sync in order to continue.
Optionally, you can enable automatic node shutdown in a case if network upgrades to a higher version than the current one. To do this, make the changes in your .toml config:
[Opera.VersionWatcher]
ShutDownIfNotUpgraded = true
In a case you don't have an existing .toml config, then create a new config.toml with the content above.
Then restart your node with the changed config:
opera --config config.toml
The automatic shutdown has an advantage that node's state will not become dirty due to processing new events/blocks according to the old rules. Thus, you will not need to re-sync, even if you upgraded the node later than the network upgrade was activated.
- Stop the go-opera node (
killall opera
) - Wait until the node has stopped
- Erase previous chain data (
rm -r /path-to-datadir/chaindata
) - Start the go-opera node