Skip to content

Commit 16ccbe8

Browse files
committed
Add warning for missing validation
1 parent 8b95488 commit 16ccbe8

File tree

3 files changed

+8
-8
lines changed
  • cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit
  • cardano-db-sync/src/Cardano/DbSync/OffChain

3 files changed

+8
-8
lines changed

cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Babbage/CommandLineArg/ForceIndex.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ checkForceIndexesArg =
1919
withCustomConfig commandLineForceIndexArgs Nothing babbageConfigDir testLabel $ \_ _ dbSyncEnv -> do
2020
startDBSync dbSyncEnv
2121
threadDelay 3_000_000
22-
assertEqQuery dbSyncEnv DB.queryPgIndexesCount 166 "there wasn't the correct number of indexes"
22+
assertEqQuery dbSyncEnv DB.queryPgIndexesCount 169 "there wasn't the correct number of indexes"
2323
where
2424
testLabel = "CLAcheckForceIndexesArg"
2525
commandLineForceIndexArgs =
@@ -32,7 +32,7 @@ checkNoForceIndexesArg =
3232
withCustomConfigAndDropDB commandLineNoForceIndexArgs Nothing babbageConfigDir testLabel $ \_ _ dbSyncEnv -> do
3333
startDBSync dbSyncEnv
3434
threadDelay 3_000_000
35-
assertEqQuery dbSyncEnv DB.queryPgIndexesCount 101 "there wasn't the correct number of indexes"
35+
assertEqQuery dbSyncEnv DB.queryPgIndexesCount 104 "there wasn't the correct number of indexes"
3636
where
3737
testLabel = "CLAcheckNoForceIndexesArg"
3838
commandLineNoForceIndexArgs =

cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/CommandLineArg/ForceIndex.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ checkForceIndexesArg =
1717
startDBSync dbSync
1818

1919
-- Verify number of DB indexes
20-
assertEqQuery dbSync DB.queryPgIndexesCount 166 "unexpected number of indexes"
20+
assertEqQuery dbSync DB.queryPgIndexesCount 169 "unexpected number of indexes"
2121
where
2222
cliArgs = initCommandLineArgs {claForceIndexes = True}
2323
testLabel = "conwayCLACheckForceIndexesArg"
@@ -28,7 +28,7 @@ checkNoForceIndexesArg =
2828
startDBSync dbSync
2929

3030
-- Verify number of DB indexes
31-
assertEqQuery dbSync DB.queryPgIndexesCount 101 "unexpected number of indexes"
31+
assertEqQuery dbSync DB.queryPgIndexesCount 104 "unexpected number of indexes"
3232
where
3333
cliArgs = initCommandLineArgs {claForceIndexes = False}
3434
testLabel = "conwayCLACheckNoForceIndexesArg"

cardano-db-sync/src/Cardano/DbSync/OffChain/Http.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ httpGetOffChainVoteData manager request vurl metaHash isGovAction = do
102102

103103
parseAndValidateVoteData :: ByteString -> LBS.ByteString -> Maybe VoteMetaHash -> Bool -> Maybe OffChainUrlType -> ExceptT OffChainFetchError IO (Vote.OffChainVoteData, Aeson.Value, ByteString, Maybe Text)
104104
parseAndValidateVoteData bs lbs metaHash isGa murl = do
105-
mWarning <- case unVoteMetaHash <$> metaHash of
106-
Nothing -> pure Nothing
107-
Just _expectedMetaHash -> pure Nothing
108105
let metadataHash = Crypto.digest (Proxy :: Proxy Crypto.Blake2b_256) bs
106+
(hsh, mWarning) <- case unVoteMetaHash <$> metaHash of
107+
Nothing -> pure (metadataHash, Nothing)
108+
Just expectedMetaHash -> pure (expectedMetaHash, Just "Failed to validate metadata hash") -- TODO: Conway
109109
decodedValue <-
110110
case Aeson.eitherDecode' @Aeson.Value lbs of
111111
Left err -> left $ OCFErrJsonDecodeFail murl (Text.pack err)
@@ -114,7 +114,7 @@ parseAndValidateVoteData bs lbs metaHash isGa murl = do
114114
case Vote.eitherDecodeOffChainVoteData lbs isGa of
115115
Left err -> left $ OCFErrJsonDecodeFail murl (Text.pack err)
116116
Right res -> pure res
117-
pure (ocvd, decodedValue, metadataHash, mWarning)
117+
pure (ocvd, decodedValue, hsh, mWarning)
118118

119119
httpGetBytes ::
120120
Http.Manager ->

0 commit comments

Comments
 (0)