Skip to content

Commit

Permalink
Add epoch_height config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jbearer committed Oct 22, 2024
1 parent 83db75c commit e770e42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sequencer/api/migrations/V41__epoch_height.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- HotShotConfig was upgraded to include an `epoch_height` parameter. This migration initializes it
-- with a default. We use the `||` operator to merge two JSON objects, one containing the default
-- value for the new config parameter and one containing the existing config. When keys are present
-- in both, the rightmost operand (the existing config) will take precedence.
UPDATE network_config SET
config = jsonb_set(config, '{config}', '{
"epoch_height": 0
}' || (config->'config'));
6 changes: 6 additions & 0 deletions sequencer/src/persistence/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,12 @@ fn migrate_network_config(
config.insert("stop_voting_time".into(), 0.into());
}

// HotShotConfig was upgraded to include an `epoch_height` parameter. Initialize with a default
// if missing.
if !config.contains_key("epoch_height") {
config.insert("epoch_height".into(), 0.into());
}

Ok(network_config)
}

Expand Down

0 comments on commit e770e42

Please sign in to comment.