Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1421 update logs for Unicode Nul character #1631

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ insertRedeemerData tracer txId txd = do
case mRedeemerDataId of
Just redeemerDataId -> pure redeemerDataId
Nothing -> do
value <- safeDecodeToJson tracer "insertRedeemerData" $ Generic.txDataValue txd
value <- safeDecodeToJson tracer "insertDatum: Column 'value' in table 'datum' " $ Generic.txDataValue txd
lift
. DB.insertRedeemerData
$ DB.RedeemerData
Expand All @@ -113,7 +113,7 @@ insertDatum tracer cache txId txd = do
case mDatumId of
Just datumId -> pure datumId
Nothing -> do
value <- safeDecodeToJson tracer "insertDatum" $ Generic.txDataValue txd
value <- safeDecodeToJson tracer "insertRedeemerData: Column 'value' in table 'redeemer' " $ Generic.txDataValue txd
lift $
insertDatumAndCache cache (Generic.txDataHash txd) $
DB.Datum
Expand Down Expand Up @@ -203,7 +203,7 @@ insertScript tracer txId script = do
where
scriptConvert :: MonadIO m => Generic.TxScript -> m (Maybe Text)
scriptConvert s =
maybe (pure Nothing) (safeDecodeToJson tracer "insertScript") (Generic.txScriptJson s)
maybe (pure Nothing) (safeDecodeToJson tracer "insertScript: Column 'json' in table 'script' ") (Generic.txScriptJson s)

insertExtraKeyWitness ::
(MonadBaseControl IO m, MonadIO m) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ insertTxMetadata tracer txId inOpts mmetadata = do
mkDbTxMetadata (key, md) = do
let jsonbs = LBS.toStrict $ Aeson.encode (metadataValueToJsonNoSchema md)
singleKeyCBORMetadata = serialiseTxMetadataToCbor $ Map.singleton key md
mjson <- safeDecodeToJson tracer "insertTxMetadata" jsonbs
mjson <- safeDecodeToJson tracer "prepareTxMetadata: Column 'json' in table 'metadata' " jsonbs
pure $
Just $
DB.TxMetadata
Expand Down
2 changes: 1 addition & 1 deletion cardano-db-sync/src/Cardano/DbSync/Era/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ safeDecodeToJson tracer tracePrefix x = do
-- See https://github.com/IntersectMBO/cardano-db-sync/issues/297
if containsUnicodeNul json
then do
liftIO $ logWarning tracer $ tracePrefix <> ": dropped due to a Unicode NUL character. " <> json
liftIO $ logWarning tracer $ tracePrefix <> "was recorded as null, due to a Unicode NUL character found when trying to parse the json."
pure Nothing
else pure $ Just json
Loading