macro_rules! tempo_hardfork {
(
$(#[$enum_meta:meta])*
TempoHardfork {
$(#[$genesis_meta:meta])* Genesis,
$( $(#[$meta:meta])* $variant:ident ),* $(,)?
}
) => { ... };
}Expand description
Single-source hardfork definition macro. Append a new variant and everything else is generated:
- Defines the
TempoHardforkenum via [hardfork!] (includingDisplay,FromStr,Hardforktrait impl, andVARIANTSconst) - Generates
is_<fork>()inherent methods onTempoHardfork— returnstruewhen*self >= Self::<Fork> - Generates the
TempoHardforkstrait with:tempo_fork_activation()(required — the only method implementors provide)tempo_hardfork_at()— walksVARIANTSin reverse to find the latest active forkis_<fork>_active_at_timestamp()— per-fork convenience helpersgeneral_gas_limit_at()— gas limit lookup by timestamp
- Generates a
#[cfg(test)] mod testswith activation, naming, trait, and serde tests
Genesis (first variant) is treated as the baseline and does not get is_*() methods.
All subsequent variants are considered post-Genesis hardforks.