Skip to content

redhdx/hardfork-recovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

HardFork Recovery

Description

If you fail to upgrade your node in a timely manner, the following scenarios may occur:: within SWS (currently 14400 blocks, approximately 12 hours in the testnet) the node block will not grow. If it exceeds the SWS, the node will force the generation of blocks, resulting in block forks. In such cases, reattempting the upgrade operation will not automatically restore the node.

How to Recover

  1. Stop op-node and op-geth.
  2. Initialize a new genesis file using the new op-geth init command.
./op-geth --datadir ./datadir init genesis.json
  1. Start op-geth while opening the admin and debug HTTP APIs.(Note:These two APIs must be closed afterwards to prevent future misoperations.)
  2. Check the ChainConfig to confirm that the new parameters are set:
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545
  1. Set new block header with the following command.Choose a block number in hexadecimal format that is close to the hardfork activation block number:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_setHead","params":["0x4E09B5"],"id":1}' http://localhost:8545
  1. Check if the change is effective with the following command:
 curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' http://localhost:8545
  1. Set the safe and finalized block numbers using the following command:
curl -X POST --header 'Content-Type: application/json' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTIwMDQ1MDN9.CiP4DxKQ7Dpml6PyiuTGzQ_8qJ5om1yKxgtz4MGmJ0A" --data '{"jsonrpc": "2.0","method": "engine_forkchoiceUpdatedV1", "params": [{"headBlockHash": "0x6c42acce8aecacaecb6304cbff82501a7a64190df9a612e0c9fb38e6d67c05a0","safeBlockHash": "0x6c42acce8aecacaecb6304cbff82501a7a64190df9a612e0c9fb38e6d67c05a0","finalizedBlockHash": "0x6c42acce8aecacaecb6304cbff82501a7a64190df9a612e0c9fb38e6d67c05a0"},null],"id":67}'   http://127.0.0.1:8551

(Note: The Authorization: Bearer value value can be generated by referring: jwtoutput. The headBlockHash,safeBlockHash,finalizedBlockHash should correspond to the hash value of the block used in the debug_setHead API in step 5.)

  1. Check if the changes are effective with the following commands:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["safe",false],"id":1}' http://localhost:8545
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["finalized",false],"id":1}' http://localhost:8545
  1. Start op-node and wait for the recovery process to complete.

Note: The longer the delay in performing the update and the further the set block is from the current block, the longer the waiting time will be. If the restoration process takes a long time, such as several hours, it may be necessary to resynchronize using a snapshot or by clearing the data.

  1. Restart op-geth without enabling admin and debug HTTP APIs to prevent future misoperations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published