Open phsmenon opened 2 years ago
As a sanity check, are you using view(LogResults(verbose_failure=True))
? I ask since I instead used view(LogResults())
in unrelated work, which caused SAW to omit important details about the failure. I'm not sure if the issue you're experiencing would be revealed by enabling verbose_failure=True
, but it would be worth a shot.
I'm guessing that the context of this issue is GaloisInc/saw-demos#11, which adds SerializeProtobufSpec
. Indeed, if I run that with the following changes:
diff --git a/demos/signal-protocol/python/load.py b/demos/signal-protocol/python/load.py
index e046b09..0612301 100644
--- a/demos/signal-protocol/python/load.py
+++ b/demos/signal-protocol/python/load.py
@@ -6,7 +6,8 @@ from saw_client import LogResults, connect, llvm_load_module, view
dir_path = os.path.dirname(os.path.realpath(__file__))
connect()
-view(LogResults(verbose_failure=True))
+# view(LogResults(verbose_failure=True))
+view(LogResults())
path = [os.path.dirname(dir_path), "c", "libsignal-everything.bc"]
bcname = os.path.join(*path)
diff --git a/demos/signal-protocol/python/signal_protocol.py b/demos/signal-protocol/python/signal_protocol.py
index b3f2a14..4b47eae 100644
--- a/demos/signal-protocol/python/signal_protocol.py
+++ b/demos/signal-protocol/python/signal_protocol.py
@@ -196,7 +196,7 @@ class SerializeProtobufSpec(Contract):
self.execute_func(buffer, stringp)
- nval = int_to_64_cryptol(self.length - 1)
+ nval = int_to_64_cryptol(self.length) # Error: off-by-one
self.points_to(buffer, struct(nval, stringp))
self.returns(void)
Then I observe the original error. If I use view(LogResults(verbose_failure=True))
instead, however, I get a counterexample quite similar to the SAWScript one. Granted, it's pretty lengthy, so there is perhaps a question to be asked about whether verbose_failure
failure should be the default or not. If we decide to keep verbose_failure=False
the default, then at the very least we should add a disclaimer to the abridged error message that (1) some additional information was suppressed, and (2) explain how a user can enable the additional information if they so choose.
SAW can usually produce counterexamples (and additional details) when verification fails. However, these are not displayed to the user when using SAW through the Python interface.
It would be ideal if using the remote interfaces produced the same level of detail as SAWScript itself.
As an example, consider the following function: https://github.com/signalapp/libsignal-protocol-c/blob/3a83a4f4ed2302ff6e68ab569c88793b50c22d28/src/signal_protocol.c#L605-L611
The following specification (in Python) contains an off-by-one error in the postconditions
The resulting error is below. It does not really tell you what went wrong.
A similar spec in SAWScript (with the same error) is below:
This produces a better error message that includes a counter example: