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

Fix issue 505 by updating abiMapping with result from constructor #562

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions lib/Echidna/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import EVM hiding (contracts, path)
import qualified EVM (contracts)
import EVM.ABI
import EVM.Solidity
import EVM.Types (Addr)
import EVM.Types (Addr, Buffer(ConcreteBuffer))
import EVM.Concrete (w256)

import qualified Data.List.NonEmpty as NE
Expand Down Expand Up @@ -232,8 +232,12 @@ loadSpecified name cs = do
vm <- loadLibraries ls addrLibrary d blank
let transaction = unless (isJust fp) $ void . execTx $ createTxWithValue bc d ca unlimitedGasPerBlock (w256 $ fromInteger balc)
vm' <- execStateT transaction vm
-- Take the result from calling the constructor and also load it in the ABI mapping for World
let abiMapping' = case vm' ^. result of
Just (VMSuccess (ConcreteBuffer bc')) -> M.insert (stripBytecodeMetadata bc') fabiOfc abiMapping
_ -> abiMapping
case currentContract vm' of
Just _ -> return (vm', c ^. eventMap, neFuns, fst <$> tests, abiMapping)
Just _ -> return (vm', c ^. eventMap, neFuns, fst <$> tests, abiMapping')
Nothing -> throwM DeploymentFailed

where choose [] _ = throwM NoContracts
Expand Down