pub(crate) fn can_use_v2_at_block_hash(
node: &TempoFullNode,
hash: B256,
latest: Option<B256>,
) -> Result<bool>Expand description
Returns if the validator config v2 can be used exactly at hash and the
timestamp of the corresponding header.
If latest is set, then the function will look at the timestamp of hash
to determine hardfork activation, but latest to determine contract
initialization. This is an optimization that makes use of the fact that
the initialization height is stored in the contract.
Validators can be read from the V2 contract if the following conditions hold:
timestamp(hash) >= T2.initialization_height(<state>) <= number(hash).is_init(<state>) == true.
<state> is read at either hash or latest if set.
This makes use of the following assumption:
If initialization_height > 0, then is_init == true always (invariant of
the smart contract).
If initialization_height == 0, then is_init is used to determine if
the contract was initialized at genesis or not.