Skip to content

Commit 94dbebd

Browse files
committed
fix: move slash_processing_epoch_offset to correct migration
1 parent 0845a86 commit 94dbebd

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

orm/migrations/2024-05-31-125032_chain_parameters/up.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ CREATE TABLE chain_parameters (
1111
chain_id VARCHAR NOT NULL,
1212
genesis_time BIGINT NOT NULL,
1313
epoch_switch_blocks_delay INT NOT NULL,
14-
checksums JSONB NOT NULL,
15-
slash_processing_epoch_offset INT NOT NULL
14+
checksums JSONB NOT NULL
1615
);
1716

1817
ALTER TABLE chain_parameters ADD UNIQUE (chain_id);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
-- This file should undo anything in `up.sql`
2-
31
DROP TABLE IF EXISTS redelegation;
2+
3+
ALTER TABLE chain_parameters DROP COLUMN IF EXISTS slash_processing_epoch_offset;

orm/migrations/2025-03-10-122312_redelegation/up.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ CREATE TABLE redelegation (
99
);
1010

1111
ALTER TABLE redelegation ADD UNIQUE (delegator, validator_id);
12+
13+
ALTER TABLE chain_parameters ADD COLUMN slash_processing_epoch_offset INT NOT NULL DEFAULT 0;

orm/src/schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ diesel::table! {
179179
genesis_time -> Int8,
180180
epoch_switch_blocks_delay -> Int4,
181181
checksums -> Jsonb,
182-
slash_processing_epoch_offset -> Int4,
183182
cubic_slashing_window_length -> Int4,
184183
duplicate_vote_min_slash_rate -> Numeric,
185184
light_client_attack_min_slash_rate -> Numeric,
185+
slash_processing_epoch_offset -> Int4,
186186
}
187187
}
188188

parameters/src/repository/parameters.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ pub fn upsert_chain_parameters(
2626
chain_parameters::light_client_attack_min_slash_rate.eq(excluded(
2727
chain_parameters::light_client_attack_min_slash_rate,
2828
)),
29+
chain_parameters::slash_processing_epoch_offset
30+
.eq(excluded(chain_parameters::slash_processing_epoch_offset)),
2931
))
3032
.execute(transaction_conn)
3133
.context("Failed to update chain_parameters state in db")?;

0 commit comments

Comments
 (0)