helios icon indicating copy to clipboard operation
helios copied to clipboard

check checkpoint age when starting up

Open ncitron opened this issue 2 years ago • 1 comments

When Helios starts, it needs to fetch a recent beacon blockhash to use as the weak subjectivity checkpoint. If this blockhash is too old (under worst case conditions too old is ~14 days), it is possible for an attacker to trick Helios into following the wrong chain. While this attack is hard to pull off (requires millions in capital to fill the staking deposit and withdrawal queues), we should still check the checkpoint age, and if it is too old, throw and error and tell the user how to fetch a good blockhash.

To do this, use the bootstrap fetched here and check bootstap.header.slot's age using the expected_current_slot and slot_timestamp methods in Consensus.

If it is older that 14 days, throw an error (consensus errors can be found here)

ncitron avatar Nov 08 '22 23:11 ncitron

I'll take this one

0xModene avatar Nov 09 '22 00:11 0xModene

If this blockhash is too old (under worst case conditions too old is ~14 days)

@ncitron Is the age for the worst case condition static and always be ~14 days?

From my quick skim through this post it looks it varies and depends on validator set, entry and exit rates...things that might be difficult for helios to attain without having access to the consensus state.

dadepo avatar Nov 11 '22 11:11 dadepo

Yeah it does change, but looking at the bottom chart, it seems like 14 days is a good metric since it increases with the validator set size. Even at 250k its 2 weeks, and Ethereum mainnet has 500k validators. It does bring up a good point that this should be configurable. @0xModene can we add it as a network level config options in config/src/networks.rs instead of hardcoding it to 14 days?

ncitron avatar Nov 11 '22 17:11 ncitron

Sure thing! I'll get to work on this

0xModene avatar Nov 11 '22 17:11 0xModene

closed in #105

ncitron avatar Nov 14 '22 20:11 ncitron