You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By convention, an empty store is a store whose all values are initialized to zero. However, this is not implemented in the equivalence checker, resulting in the counterexamples shown below.
This snippet creates two endstates, one with an empty store and one with a store with slot 0 set to value 0. According to the semantics of Expr these to should be equivalent. However, running the equivalence checker returns a counterexample.
Then in the repl, we can show that endState1 and endState2 are not equivalent (though they should be)
> cabal repl test
ghci> :load test
[1 of 2] Compiling Main ( test.hs, interpreted )
ghci> testEquiv [endState1] [endState2]
Found 1 total pairs of endstates
Asking the SMT solver for 1 pairs
Reuse of previous queries was Useful in 0 cases
[Cex (SMTCex {vars = fromList [(TxValue,0x0)], addrs = fromList [], buffers = fromList [], store = fromList [], blockContext = fromList [], txContext = fromList []})]
That does not allow us to prove the following two contracts equivalent:
contractC {
uint x;
// constructor is implicit
}
contractC {
uint x;
constructor() {
x =0;
}
}
I have a branch in which I have pushed a fix for the first code snippet. I have added the second example to the test suite and I have modified equivalenceCheck to be able to run on deployment code as well as runtime code. However, I'm running into a weird error (Exception: Internal Error: cannot analyze symbolic code:). Any help will be appreciated!
The text was updated successfully, but these errors were encountered:
zoep
changed the title
Equivalence checking does not treat emptystore as equal to a store initialized to zero
Equivalence checking does not treat empty store as equal to a store initialized to zero
Feb 7, 2025
BTW, I actually made progress on this. It needs to be completed, if you wanna take a peek, it's at equiv-fix-mate, The props from the init need to be used as preconditions for the deployed bytecode. They show up as warnings in that branch.
By convention, an empty store is a store whose all values are initialized to zero. However, this is not implemented in the equivalence checker, resulting in the counterexamples shown below.
This snippet creates two endstates, one with an empty store and one with a store with slot 0 set to value 0. According to the semantics of Expr these to should be equivalent. However, running the equivalence checker returns a counterexample.
Then in the repl, we can show that
endState1
andendState2
are not equivalent (though they should be)That does not allow us to prove the following two contracts equivalent:
I have a branch in which I have pushed a fix for the first code snippet. I have added the second example to the test suite and I have modified
equivalenceCheck
to be able to run on deployment code as well as runtime code. However, I'm running into a weird error (Exception: Internal Error: cannot analyze symbolic code:
). Any help will be appreciated!The text was updated successfully, but these errors were encountered: