From 712adcbf8f2ee4bd56b303ab032d35bd4aeeeee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Thu, 23 Mar 2023 08:33:22 +0000 Subject: [PATCH] app/ledger/finalize_block: slash after copying of validator sets --- apps/src/lib/node/ledger/shell/finalize_block.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 336c4d9415b..3acaff27bac 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -73,6 +73,10 @@ where )?; } + // Invariant: This has to be applied after + // `copy_validator_sets_and_positions` if we're starting a new epoch + self.slash(); + let wrapper_fees = self.get_wrapper_tx_fees(); let mut stats = InternalStats::default(); @@ -404,8 +408,6 @@ where .wl_storage .update_epoch(height, header_time) .expect("Must be able to update epoch"); - - self.slash(); (height, new_epoch) }