Skip to content

Commit

Permalink
Merge pull request #601 from ethereum/keccak-distance-word-eq
Browse files Browse the repository at this point in the history
Adding test for issue with keccak distance and word equiv checking
  • Loading branch information
msooseth authored Oct 24, 2024
2 parents ea772b2 + 48f183c commit 7842c1e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,14 @@ tests = testGroup "hevm"
let simplified = Expr.simplify x
y <- checkEquivAndLHS x simplified
assertBoolM "Must be equal" y
-- TODO
, expectFail $ test "word-eq-bug" $ do
-- This test is actually OK because the simplified takes into account that it's impossible to find a
-- near-collision in the keccak hash
let x = (SLoad (Keccak (AbstractBuf "es")) (SStore (Add (Keccak (ConcreteBuf "")) (Lit 0x1)) (Lit 0xacab) (ConcreteStore (Map.empty))))
let simplified = Expr.simplify x
y <- checkEquiv x simplified
assertBoolM "Must be equal, given keccak distance axiom" y
]
{- NOTE: These tests were designed to test behaviour on reading from a buffer such that the indices overflow 2^256.
However, such scenarios are impossible in the real world (the operation would run out of gas). The problem
Expand Down

0 comments on commit 7842c1e

Please sign in to comment.