Skip to content

Commit

Permalink
feat: support custom logos in network upgrades (#4527)
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs authored and sudo-shashank committed Jul 16, 2024
1 parent 7333c4e commit 50efeb2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/state_migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::sync::{
use crate::networks::{ChainConfig, Height, NetworkChain};
use crate::shim::clock::ChainEpoch;
use crate::shim::state_tree::StateRoot;
use crate::utils::misc::reveal_three_trees;
use cid::Cid;
use fvm_ipld_blockstore::Blockstore;
use fvm_ipld_encoding::CborStore;
Expand Down Expand Up @@ -110,7 +109,7 @@ where
.map(|sr| format!("{}", sr.actors))
.unwrap_or_default();
if new_state != *parent_state {
reveal_three_trees();
crate::utils::misc::reveal_upgrade_logo(chain_config.network_version(epoch));
tracing::info!("State migration at height {height}(epoch {epoch}) was successful, Previous state: {parent_state}, new state: {new_state}, new state actors: {new_state_actors}. Took: {elapsed}s.");
} else {
anyhow:: bail!("State post migration at height {height} must not match. Previous state: {parent_state}, new state: {new_state}, new state actors: {new_state_actors}. Took {elapsed}s.");
Expand Down
57 changes: 56 additions & 1 deletion src/utils/misc/logo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@

use tracing::info;

use crate::shim::version::NetworkVersion;

pub fn reveal_upgrade_logo(network_version: NetworkVersion) {
match network_version {
NetworkVersion::V23 => reveal_waffle_upgrade(),
_ => reveal_three_trees(),
}
}

/// Reveals three trees arranged in an order that resemble the forest logo.
/// To be used at anyone's convenience.
pub fn reveal_three_trees() {
fn reveal_three_trees() {
info!(
r###"
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
Expand Down Expand Up @@ -39,3 +48,49 @@ pub fn reveal_three_trees() {
"###
);
}

/// Reveals a beautiful Belgian waffle. A keen eye may notice that the waffle is built out of
/// smaller waffles.
fn reveal_waffle_upgrade() {
info!(
r###"
##
#### ###
## ##
###### ## ## ######
## ## ### ### ## ##
### ########### ########### ###
#### ## ## ## ## ####
######## ########### ########### ########
######### ######### ######### #########
## ##
### ###
######### ########### ########### #########
## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ###
#### ## ## ## ## ## ## ####
############## ########### ########### ##############
## ##
### ##
############## ########### ########### ##############
### ## ## ## ## ## ## ###
## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
### ## ## ## ## ## ## ##
########## ########### ########### ##########
## ##
## ##
########## ########### ########### ##########
###### ## ## ## ## ######
### ## #### ## ## #### ## ###
## #### ##### ##### #### ##
## ## ## ### ## ##
###### ## ## ######
## ##
######
"###
);
}

0 comments on commit 50efeb2

Please sign in to comment.