From 0816d469a68cea69c979ff7b5214a9acc82a6e64 Mon Sep 17 00:00:00 2001 From: Cmdv Date: Tue, 11 Nov 2025 11:25:51 +0000 Subject: [PATCH 1/2] hotfix/genesis rollback fix --- cardano-db/src/Cardano/Db/Statement/Base.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cardano-db/src/Cardano/Db/Statement/Base.hs b/cardano-db/src/Cardano/Db/Statement/Base.hs index ae0d6fa79..c2ff120ec 100644 --- a/cardano-db/src/Cardano/Db/Statement/Base.hs +++ b/cardano-db/src/Cardano/Db/Statement/Base.hs @@ -192,12 +192,13 @@ queryBlockNoAndEpochStmt = -- (where DrepDistr will be inserted). Using the previous block's epoch ensures -- DrepDistr for the current epoch gets deleted, preventing duplicates -- when replaying through the epoch boundary. + -- For genesis (block 0), there's no previous block, so use the current epoch. sql = TextEnc.encodeUtf8 $ Text.concat - [ "SELECT curr.id, prev.epoch_no" + [ "SELECT curr.id, COALESCE(prev.epoch_no, curr.epoch_no)" , " FROM " <> tableName (Proxy @a) <> " curr" - , " JOIN " <> tableName (Proxy @a) <> " prev ON prev.block_no = $1 - 1" + , " LEFT JOIN " <> tableName (Proxy @a) <> " prev ON prev.block_no = $1 - 1" , " WHERE curr.block_no = $1" ] From 0a41025de67dae610d185690e3845ae68f2f7992 Mon Sep 17 00:00:00 2001 From: Cmdv Date: Tue, 11 Nov 2025 11:37:25 +0000 Subject: [PATCH 2/2] ghg98 no partials fix --- .../test/Test/Cardano/Db/Mock/Unit/Conway/Rollback.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Rollback.hs b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Rollback.hs index 27176412b..9d51e6e6e 100644 --- a/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Rollback.hs +++ b/cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Rollback.hs @@ -1,5 +1,9 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE NumericUnderscores #-} + +#if __GLASGOW_HASKELL__ >= 908 {-# OPTIONS_GHC -Wno-x-partial #-} +#endif module Test.Cardano.Db.Mock.Unit.Conway.Rollback ( simpleRollback,