Skip to content

Commit 543d37f

Browse files
committed
Fix gov_action state changes
1 parent b217eab commit 543d37f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

cardano-db-sync/src/Cardano/DbSync/Rollback.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ rollbackFromBlockNo syncEnv blkNo = do
5454
DB.deleteEpochRows epochNo
5555
DB.setNullEnacted epochNo
5656
DB.setNullRatified epochNo
57+
DB.setNullDropped epochNo
58+
DB.setNullExpired epochNo
5759
when (deletedBlockCount > 0) $ do
5860
-- We use custom constraints to improve input speeds when syncing.
5961
-- If they don't already exists we add them here as once a rollback has happened

cardano-db/src/Cardano/Db/Insert.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ module Cardano.Db.Insert (
7171
updateGovActionExpired,
7272
setNullEnacted,
7373
setNullRatified,
74+
setNullExpired,
75+
setNullDropped,
7476
replaceAdaPots,
7577
insertAnchor,
7678
insertConstitution,
@@ -397,6 +399,14 @@ setNullRatified :: MonadIO m => Word64 -> ReaderT SqlBackend m ()
397399
setNullRatified eNo =
398400
updateWhere [GovActionProposalRatifiedEpoch !=. Nothing, GovActionProposalRatifiedEpoch >. Just eNo] [GovActionProposalRatifiedEpoch =. Nothing]
399401

402+
setNullExpired :: MonadIO m => Word64 -> ReaderT SqlBackend m ()
403+
setNullExpired eNo =
404+
updateWhere [GovActionProposalExpiredEpoch !=. Nothing, GovActionProposalExpiredEpoch >. Just eNo] [GovActionProposalExpiredEpoch =. Nothing]
405+
406+
setNullDropped :: MonadIO m => Word64 -> ReaderT SqlBackend m ()
407+
setNullDropped eNo =
408+
updateWhere [GovActionProposalDroppedEpoch !=. Nothing, GovActionProposalDroppedEpoch >. Just eNo] [GovActionProposalDroppedEpoch =. Nothing]
409+
400410
replaceAdaPots :: (MonadBaseControl IO m, MonadIO m) => BlockId -> AdaPots -> ReaderT SqlBackend m Bool
401411
replaceAdaPots blockId adapots = do
402412
mAdaPotsId <- queryAdaPotsId blockId

cardano-db/src/Cardano/Db/Schema.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,7 @@ schemaDocs =
904904
PoolUpdateMetaId # "The PoolMetadataRef table index this pool update refers to."
905905
PoolUpdateMargin # "The margin (as a percentage) this pool charges."
906906
PoolUpdateFixedCost # "The fixed per epoch fee (in ADA) this pool charges."
907+
PoolUpdateDeposit # "The deposit payed for this pool update. Null for reregistrations."
907908
PoolUpdateRegisteredTxId # "The Tx table index of the transaction in which provided this pool update."
908909

909910
PoolOwner --^ do
@@ -1277,8 +1278,7 @@ schemaDocs =
12771278

12781279
GovActionProposal --^ do
12791280
"A table for proposed GovActionProposal, aka ProposalProcedure, GovAction or GovProposal.\
1280-
\ At most one of the ratified/enacted/dropped/expired\
1281-
\ epoch field can be non-null, indicating the current state of the proposal. This table may be referenced\
1281+
\ This table may be referenced\
12821282
\ by TreasuryWithdrawal or NewCommittee. New in 13.2-Conway."
12831283
GovActionProposalTxId # "The Tx table index of the tx that includes this certificate."
12841284
GovActionProposalIndex # "The index of this proposal procedure within its transaction."

0 commit comments

Comments
 (0)