Skip to content

Commit

Permalink
hevm 0.50.4 (#986)
Browse files Browse the repository at this point in the history
* hevm 0.50.4

* Bump stack and flake.lock
  • Loading branch information
arcz committed Mar 18, 2023
1 parent 59656ad commit 93ee9db
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub {
owner = "ethereum";
repo = "hevm";
rev = "release/0.50.3";
sha256 = "sha256-n+Y3Y8UGuRxMxzJjGB+/1QBaVLaCttOO2r3cb2PQCVM=";
rev = "release/0.50.4";
sha256 = "sha256-QuTn9q9iF9K5Cc5DOqhBlV5Wgb1hpxRGZPtEUABAjtw=";
}) { secp256k1 = pkgs.secp256k1; });

echidna = with pkgs; lib.pipe
Expand Down
5 changes: 5 additions & 0 deletions lib/Echidna/ABI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ppAbiValue (AbiArray _ _ v) =
"[" ++ intercalate ", " (ppAbiValue <$> toList v) ++ "]"
ppAbiValue (AbiTuple v) =
"(" ++ intercalate ", " (ppAbiValue <$> toList v) ++ ")"
ppAbiValue (AbiFunction v) = show v

-- Types

Expand Down Expand Up @@ -257,6 +258,7 @@ shrinkAbiValue (AbiArrayDynamic t l) = getRandomR (0, 9 :: Int) >>= -- 10% of ch
_ -> AbiArrayDynamic t <$> shrinkV l
shrinkAbiValue (AbiTuple v) = AbiTuple <$> traverse shrinkAbiValue' v
where shrinkAbiValue' x = liftM3 bool (pure x) (shrinkAbiValue x) getRandom
shrinkAbiValue (AbiFunction v) = pure $ AbiFunction v

-- | Given a 'SolCall', generate a random \"smaller\" (simpler) call.
shrinkAbiCall :: MonadRandom m => SolCall -> m SolCall
Expand Down Expand Up @@ -287,6 +289,7 @@ mutateAbiValue (AbiArray n t l) = do fs <- replicateM n $ genAbiValue t

mutateAbiValue (AbiArrayDynamic t l) = AbiArrayDynamic t <$> mutateLL Nothing mempty l
mutateAbiValue (AbiTuple v) = AbiTuple <$> traverse mutateAbiValue v
mutateAbiValue (AbiFunction v) = pure $ AbiFunction v

-- | Given a 'SolCall', generate a random \"similar\" call with the same 'SolSignature'.
mutateAbiCall :: (MonadRandom m) => SolCall -> m SolCall
Expand Down Expand Up @@ -333,6 +336,8 @@ genAbiValueM genDict = genWithDict genDict genDict.constants $ \case
>>= flip V.replicateM (genAbiValueM genDict t)
(AbiArrayType n t) -> AbiArray n t <$> V.replicateM n (genAbiValueM genDict t)
(AbiTupleType v) -> AbiTuple <$> traverse (genAbiValueM genDict) v
AbiFunctionType -> liftM2 (\n -> AbiString . BS.pack . take n)
(getRandomR (1, 32)) getRandoms

-- | Given a 'SolSignature', generate a random 'SolCalls' with that signature, possibly with a dictionary.
genAbiCallM :: MonadRandom m => GenDict -> SolSignature -> m SolCall
Expand Down
4 changes: 0 additions & 4 deletions lib/Echidna/Orphans/JSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Data.ByteString (ByteString)
import Data.DoubleWord (Word256, Int256, Word160)
import Data.Text (Text, unpack)
import EVM.ABI (AbiValue, AbiType)
import EVM.Types (Addr)
import Text.Read (readMaybe)

readT :: Read a => Text -> Maybe a
Expand Down Expand Up @@ -44,8 +43,5 @@ instance ToJSON ByteString where
instance FromJSON ByteString where
parseJSON = withText "ByteString" $ maybe (fail "could not parse ByteString") pure . readT

instance ToJSON Addr where
toJSON = toJSON . show

$(deriveJSON defaultOptions ''AbiType)
$(deriveJSON defaultOptions ''AbiValue)
2 changes: 2 additions & 0 deletions lib/Echidna/Types/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ data TxResult = ReturnTrue
| ErrorSMTTimeout
| ErrorFFI
| ErrorNonceOverflow
| ErrorReturnDataOutOfBounds
deriving (Eq, Ord, Show)
$(deriveJSON defaultOptions ''TxResult)

Expand Down Expand Up @@ -205,6 +206,7 @@ getResult (VMFailure (NotUnique _)) = ErrorWhiffNotUnique
getResult (VMFailure SMTTimeout) = ErrorSMTTimeout
getResult (VMFailure (FFI _)) = ErrorFFI
getResult (VMFailure NonceOverflow) = ErrorNonceOverflow
getResult (VMFailure ReturnDataOutOfBounds) = ErrorReturnDataOutOfBounds

makeSingleTx :: Addr -> Addr -> W256 -> TxCall -> [Tx]
makeSingleTx a d v (SolCall c) = [Tx (SolCall c) a d maxGasPerBlock 0 v (0, 0)]
Expand Down
3 changes: 0 additions & 3 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ toFetchedContractData contract =
instance ToJSONKey W256 where
toJSONKey = toJSONKeyText (Text.pack . show)

instance ToJSONKey Addr where
toJSONKey = toJSONKeyText (Text.pack . show)

readFileIfExists :: FilePath -> IO (Maybe BS.ByteString)
readFileIfExists path = do
exists <- doesFileExist path
Expand Down
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resolver: lts-20.05
resolver: lts-20.14

packages:
- '.'

extra-deps:
- git: https://github.com/ethereum/hevm.git
commit: 040d130e4265038ebba3fc7cd98de04c782678df
commit: fa2eb28fe9c793f9c5d03e95475baa8d8e0b5794

- restless-git-0.7@sha256:346a5775a586f07ecb291036a8d3016c3484ccdc188b574bcdec0a82c12db293,968
- s-cargot-0.1.4.0@sha256:61ea1833fbb4c80d93577144870e449d2007d311c34d74252850bb48aa8c31fb,3525
Expand Down

0 comments on commit 93ee9db

Please sign in to comment.