diff --git a/chainweb.cabal b/chainweb.cabal index d711aa6a6..4aa928828 100644 --- a/chainweb.cabal +++ b/chainweb.cabal @@ -351,7 +351,6 @@ library build-depends: , Decimal >= 0.4.2 , aeson >= 2.2 - , aeson-pretty >= 0.8 , asn1-encoding >=0.9 , asn1-types >=0.3 , async >= 2.2 diff --git a/src/Chainweb/Pact/PactService.hs b/src/Chainweb/Pact/PactService.hs index 60fd8c607..ab7ca2123 100644 --- a/src/Chainweb/Pact/PactService.hs +++ b/src/Chainweb/Pact/PactService.hs @@ -812,7 +812,7 @@ execReadOnlyReplay lowerBound maybeUpperBound = pactLabel "execReadOnlyReplay" $ let printValidationError (BlockValidationFailure (BlockValidationFailureMsg m)) = do writeIORef validationFailedRef True - logFunctionText logger Error m + logFunctionText logger Error (J.getJsonText m) printValidationError e = throwM e handleMissingBlock NoHistory = throwM $ BlockHeaderLookupFailure $ "execReadOnlyReplay: missing block: " <> sshow bh @@ -831,7 +831,7 @@ execReadOnlyReplay lowerBound maybeUpperBound = pactLabel "execReadOnlyReplay" $ ) validationFailed <- readIORef validationFailedRef when validationFailed $ - throwM $ BlockValidationFailure $ BlockValidationFailureMsg "Prior block validation errors" + throwM $ BlockValidationFailure $ BlockValidationFailureMsg $ J.encodeJsonText ("Prior block validation errors" :: Text) return r heightProgress :: BlockHeight -> BlockHeight -> IORef BlockHeight -> (Text -> IO ()) -> IO () diff --git a/src/Chainweb/Pact/PactService/ExecBlock.hs b/src/Chainweb/Pact/PactService/ExecBlock.hs index 78b3ef88f..adb6b35d5 100644 --- a/src/Chainweb/Pact/PactService/ExecBlock.hs +++ b/src/Chainweb/Pact/PactService/ExecBlock.hs @@ -44,7 +44,6 @@ import Control.Monad.Reader import Control.Monad.State.Strict import qualified Data.Aeson as A -import qualified Data.Aeson.Encode.Pretty as A import qualified Data.ByteString.Short as SB import qualified Data.ByteString.Lazy as BL import Data.Decimal @@ -565,16 +564,12 @@ validateHashes bHeader payload miner transactions = if newHash == prevHash then Right actualPwo else Left $ BlockValidationFailure $ BlockValidationFailureMsg $ - prettyJson $ J.encodeText $ J.object + J.encodeJsonText $ J.object [ "header" J..= J.encodeWithAeson (ObjectEncoded bHeader) , "mismatch" J..= errorMsg "Payload hash" prevHash newHash , "details" J..= difference ] where - prettyJson txt = case A.eitherDecodeStrict @A.Value (T.encodeUtf8 txt) of - Right obj -> T.cons '\n' $ T.decodeUtf8 $ BL.toStrict $ A.encodePretty obj - Left err -> error $ "validateHashes: impossible JSON decode failure: " <> show err - actualPwo = toPayloadWithOutputs miner transactions newHash = _payloadWithOutputsPayloadHash actualPwo diff --git a/src/Chainweb/Pact/Service/Types.hs b/src/Chainweb/Pact/Service/Types.hs index ea5edb8f9..0b483510d 100644 --- a/src/Chainweb/Pact/Service/Types.hs +++ b/src/Chainweb/Pact/Service/Types.hs @@ -213,7 +213,7 @@ data LocalPreflightSimulation | LegacySimulation deriving stock (Eq, Show, Generic) -newtype BlockValidationFailureMsg = BlockValidationFailureMsg Text +newtype BlockValidationFailureMsg = BlockValidationFailureMsg J.JsonText deriving (Eq, Ord, Generic) deriving newtype (J.Encode)