-
Notifications
You must be signed in to change notification settings - Fork 37
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
Constructor calls in HEVM equivalence #162
Conversation
@@ -53,7 +53,7 @@ hevm_fail=$(wildcard tests/hevm/fail/*/*.act) | |||
failing_typing=tests/frontend/pass/array/array.act tests/frontend/pass/dss/vat.act tests/frontend/pass/creation/createMultiple.act tests/frontend/pass/staticstore/staticstore.act | |||
|
|||
|
|||
coq-examples = tests/coq/transitions tests/coq/safemath tests/coq/exponent tests/coq/token tests/coq/ERC20 tests/coq/multi | |||
coq-examples = tests/coq/transitions tests/coq/safemath tests/coq/exponent tests/coq/token tests/coq/ERC20 tests/coq/multi tests/coq/multi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should pass once we merge #388 into hevm.
@@ -104,11 +104,11 @@ tests/%.postcondition.fail: | |||
|
|||
tests/hevm/pass/%.act.hevm.pass: | |||
$(eval CONTRACT := $(shell awk '/contract/{ print $$2 }' tests/hevm/pass/$*.sol)) | |||
./bin/act hevm --spec tests/hevm/pass/$*.act --sol tests/hevm/pass/$*.sol --contract $(CONTRACT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contact option is removed from CLI. Now all contracts in the spec are checked.
getBytecode :: IO (BS.ByteString, BS.ByteString) | ||
getBytecode = | ||
|
||
createContractMap :: [Contract] -> IO (Map Id (Contract, BS.ByteString, BS.ByteString)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We create a map from contact ids to their (Act spec, initcode, bytecode) triples. This makes it easy to look up the spec and the byte code of a contract when we encounter a call to its constructor. To check equivalence between the spec and the bytecodes, we traverse the map.
bytecodes cid solContents | ||
(Nothing, Just c, Just i) -> pure (i, c) | ||
bytecodes (Text.pack cid) solContents | ||
(Nothing, Just _, Just _) -> render (text "Only Solidity file supported") >> exitFailure -- pure (i, c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how we can support bytecode input when we have multiple contracts.
|
||
updatesToExpr :: Layout -> Id -> [StorageUpdate] -> ContractMap -> ContractMap | ||
updatesToExpr layout cid upds initmap = foldl (flip $ updateToExpr layout cid) initmap upds | ||
updatesToExpr :: CodeMap -> Layout -> Id -> EVM.Expr EVM.EAddr -> [StorageUpdate] -> (ContractMap, [EVM.Prop]) -> (ContractMap, [EVM.Prop]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type propagates the preconditions of constructor calls upwards after substitution. As we discussed this is probably not needed. I will think about this a bit more and probably will be removing this from the return type.
Subsumed by #167 |
This PR adds support for multiple contracts in Act spec (WIP). More precisely:
--contract
option, since all contracts in the spec are now checked by defaultTODO: