Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoeldner committed Mar 24, 2024
1 parent 0b2b01e commit d2a838f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src-tool/Pact/Analyze/Eval/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import Crypto.Hash.Keccak256Native
import qualified Data.ByteString as BS
import Data.Functor ((<&>))
import qualified Data.Vector as V
import Data.Default

import qualified Pact.JSON.Encode as J

Expand Down Expand Up @@ -317,13 +316,14 @@ evalCore (ListHash ty' xs) = do
evalCore (Keccak256Hash xs) = eval xs <&> unliteralS >>= \case
Nothing ->do
-- (keccak256 [])
let h = "xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e/rYBF2FpHA="
emitWarning (FVShimmedStaticContent "keccac256" ("of type '[string]', substitute '" <> T.pack h <> "')"))
let h = "xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e_rYBF2FpHA"
emitWarning (FVShimmedStaticContent "keccak256" ("of type '[string]', substitute '" <> T.pack h <> "')"))
pure (literalS (Str h))
Just (xs':: [Str]) -> do
let tm = fmap (\x -> Pact.TLiteral (Pact.LString $ T.pack $ unStr x) def) xs'
h = keccak256 (V.fromList tm)
pure (literalS . Str . T.unpack $ h)
let tm = T.pack . unStr <$> xs'
case keccak256 (V.fromList tm) of
Left err -> throwErrorNoLoc $ FailureMessage (T.pack $ show err)
Right h -> pure (literalS . Str . T.unpack $ h)

evalCore (ListContains ty needle haystack) = withSymVal ty $ do
S _ needle' <- withSing ty $ eval needle
Expand Down
2 changes: 1 addition & 1 deletion tests/AnalyzeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,7 @@ spec = describe "analyze" $ do
(defun test:bool (arg:[string])
(enforce (=
(keccak256 [""])
"xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e/rYBF2FpHA=") "should match empty")
"xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e_rYBF2FpHA") "should match empty")

(enforce (=
(keccak256 [""])
Expand Down

0 comments on commit d2a838f

Please sign in to comment.