pub(crate) async fn adjust_global_config(
        &mut self,
        ctx: &ctx::Ctx,
        spec: &config::GenesisSpec,
    ) -> ctx::Result<()> {
        let mut txn = self
            .start_transaction(ctx)
            .await
            .wrap("start_transaction()")?;

        let old = txn.global_config(ctx).await.wrap("genesis()")?;
        if let Some(old) = &old {
            if &config::GenesisSpec::from_global_config(old) == spec {
                // Hard fork is not needed.
                return Ok(());
            }
        }

        tracing::info!("Performing a hard fork of consensus.");
        let new = GlobalConfig {
            genesis: validator::GenesisRaw {
                chain_id: spec.chain_id,
                fork_number: old.as_ref().map_or(validator::ForkNumber(0), |old| {
                    old.genesis.fork_number.next()
                }),
                first_block: txn.next_block(ctx).await.wrap("next_block()")?,
                protocol_version: spec.protocol_version,
                validators_schedule: spec.validators.clone(),
            }
            .with_hash(),
            registry_address: spec.registry_address,
            seed_peers: spec.seed_peers.clone(),
        };

        txn.try_update_global_config(ctx, &new)
            .await
            .wrap("try_update_global_config()")?;
        txn.commit(ctx).await.wrap("commit()")?;
        Ok(())
    }
(Re)initializes consensus genesis to start at the last L2 block in storage.
Noop if `spec` matches the current genesis.
core/node/consensus/src/storage/connection.rs