telosnetwork / telos-consensus-client

Consensus client for TelosEVM
Apache License 2.0
2 stars 0 forks source link

Persist recent final block hashes #23

Closed poplexity closed 1 month ago

poplexity commented 2 months ago

Keep latest Nth final block hashes that consensus client sees in rocks for persistence. i.e. every 1000 blocks for the last 1mil blocks, configurable in config file with default values that make sense

On startup ask reth for it's latest final block, then find the latest final block in rocks that is less than reth's latest final block. Use that block from rocks as the parent hash, start reading ship at that block +1 to rebuild all blocks leading up to the block that reth needs.

Have a 3rd configuration parameter that is the largest acceptable range for consensus client to sync before it reaches reth. i.e. if reth is at block 500mil and consensus has 100mil, it would sync for 400mil blocks which is not ok. Maybe default value should be 100k ? If greater than the setting, log an error and suggest user finds a more recent start block or increases the setting.

coa-telos commented 2 months ago

https://github.com/telosnetwork/telos-consensus-client/pull/28