[go: up one dir, main page]

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

Dynamic buffers via SMT lists #500

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

Dynamic buffers via SMT lists #500

wants to merge 36 commits into from

Conversation

MrChico
Copy link
Member
@MrChico MrChico commented Sep 7, 2020

Replaces #491

@MrChico MrChico force-pushed the slistbuffer branch 4 times, most recently from 5b104f4 to cb523e4 Compare September 14, 2020 13:20
@MrChico
Copy link
Member Author
MrChico commented Sep 16, 2020

getting annoying, mysterious errors in the communication with the solver and sbv

*** Data.SBV: Unexpected response from the solver, context: push:
***
***    Sent      : (push 1)
***    Expected  : success
***    Received  : (error "line 4036 column 7: canceled")
***
***    Executable: /nix/store/i0rqzy3avr6mdbggr28kk91igdripvnn-z3-4.8.8/bin/z3
***    Options   : -nw -in -smt2

Comment on lines +151 to +160
-- testCase "calldata beyond length must be 0" $ runSMTWith z3
-- $ query $ do calldatalist <- freshVar_
-- -- works with length .< 10, but not 100...
-- constrain $ SL.length calldatalist .< 10
-- let cd = DynamicSymBuffer calldatalist
-- constrain $ 0 ./= readSWord (sw256 $ sFromIntegral $ len cd) cd
-- checkSat >>= \case
-- Sat -> error "should be false"
-- Unsat -> return ()
-- Unk -> error "timed out!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this commented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will remove this

Unk -> error "timed out!"

,
testCase "comparing function selector" $ runSMTWith z3{transcript=Just "sameno.smt2"} $ do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to leave the transcript here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no 👍

Comment on lines +166 to +167
constrain $ SL.length calldatalist .< 100
constrain $ sw256 (sFromIntegral $ SL.length calldatalist) .< sw256 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need both of these contraints?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it turned out to yield better performance in practice

Comment on lines +147 to +166
# # OpCalldatacopy
# "loops/for_loop_array_assignment_memory_memory.sol"
# "loops/for_loop_array_assignment_memory_storage.sol"
# "loops/while_loop_array_assignment_memory_memory.sol"
# "loops/while_loop_array_assignment_memory_storage.sol"
# "types/address_call.sol"
# "types/address_delegatecall.sol"
# "types/address_staticcall.sol"
# "types/array_aliasing_storage_2.sol"
# "types/array_aliasing_storage_3.sol"
# "types/array_aliasing_storage_5.sol"
# "types/array_branch_1d.sol"
# "types/array_branches_1d.sol"
# "types/array_dynamic_parameter_1.sol"
# "types/array_dynamic_parameter_1_fail.sol"
# "types/bytes_1.sol"
# "types/bytes_2.sol"
# "types/bytes_2_fail.sol"
# "types/mapping_unsupported_key_type_1.sol"
# "types/function_type_array_as_reference_type.sol"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave these commented?

@@ -1721,8 +1721,13 @@ notStatic continue = do
then vmError StateChangeWhileStatic
else continue

burnSym :: SymWord -> EVM () -> EVM ()
burnSym n continue = case maybeLitWord n of
Nothing -> continue -- smt query (TODO: no gas mode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean no gas is deduced when dealing with symbolic values?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently yes. But there should really be a query made here unless run in --no-gas mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants