Skip to content

Commit 490f05a

Browse files
authored
Merge pull request #1325 from GaloisInc/bump-argo
Bump argo submodule to include docs for method results
2 parents c9ce595 + 15d8d4a commit 490f05a

13 files changed

+220
-43
lines changed

saw-remote-api/docs/SAW.rst

+159-23
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,37 @@ The server supports three transport methods:
1313

1414

1515
``stdio``
16-
in which the server communicates over ``stdin`` and ``stdout``
16+
in which the server communicates over ``stdin`` and ``stdout`` using `netstrings. <http://cr.yp.to/proto/netstrings.txt>`_
1717

1818

1919

20-
Socket
21-
in which the server communicates over ``stdin`` and ``stdout``
20+
``socket``
21+
in which the server communicates over a socket using `netstrings. <http://cr.yp.to/proto/netstrings.txt>`_
2222

2323

2424

25-
HTTP
26-
in which the server communicates over HTTP
25+
``http``
26+
in which the server communicates over a socket using HTTP.
2727

2828

29-
In both ``stdio`` and socket mode, messages are delimited using `netstrings. <http://cr.yp.to/proto/netstrings.txt>`_
30-
3129

3230
Application State
3331
~~~~~~~~~~~~~~~~~
3432

3533
According to the JSON-RPC specification, the ``params`` field in a message object must be an array or object. In this protocol, it is always an object. While each message may specify its own arguments, every message has a parameter field named ``state``.
3634

37-
When the first message is sent from the client to the server, the ``state`` parameter should be initialized to the JSON null value ``null``. Replies from the server may contain a new state that should be used in subsequent requests, so that state changes executed by the request are visible. Prior versions of this protocol represented the initial state as the empty array ``[]``, but this is now deprecated and will be removed.
35+
When the first message is sent from the client to the server, the ``state`` parameter should be initialized to the JSON null value ``null``. Replies from the server may contain a new state that should be used in subsequent requests, so that state changes executed by the request are visible.
3836

3937
In particular, per JSON-RPC, non-error replies are always a JSON object that contains a ``result`` field. The result field always contains an ``answer`` field and a ``state`` field, as well as ``stdout`` and ``stderr``.
4038

4139

4240
``answer``
43-
The value returned as a response to the request (the precise contents depend on which request was sent)
41+
The value returned as a response to the request (the precise contents depend on which request was sent).
4442

4543

4644

4745
``state``
48-
The state, to be sent in subsequent requests. If the server did not modify its state in response to the command, then this state may be the same as the one sent by the client.
46+
The state, to be sent in subsequent requests. If the server did not modify its state in response to the command, then this state may be the same as the one sent by the client. When a new state is in a server response, the previous state may no longer be available for requests.
4947

5048

5149

@@ -69,28 +67,53 @@ Methods
6967
SAW/Cryptol/load module (command)
7068
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7169

70+
Load the specified Cryptol module.
71+
72+
Parameter fields
73+
++++++++++++++++
74+
7275

7376
``module name``
7477
Name of module to load.
7578

7679

77-
Load the specified Cryptol module.
80+
81+
Return fields
82+
+++++++++++++
83+
84+
No return fields
85+
7886

7987

8088
SAW/Cryptol/load file (command)
8189
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8290

91+
Load the given file as a Cryptol module.
92+
93+
Parameter fields
94+
++++++++++++++++
95+
8396

8497
``file``
8598
File to load as a Cryptol module.
8699

87100

88-
Load the given file as a Cryptol module.
101+
102+
Return fields
103+
+++++++++++++
104+
105+
No return fields
106+
89107

90108

91109
SAW/Cryptol/save term (command)
92110
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93111

112+
Save a term to be referenced later by name.
113+
114+
Parameter fields
115+
++++++++++++++++
116+
94117

95118
``name``
96119
The name to assign to the expression for later reference.
@@ -101,12 +124,22 @@ SAW/Cryptol/save term (command)
101124
The expression to save.
102125

103126

104-
Save a term to be referenced later by name.
127+
128+
Return fields
129+
+++++++++++++
130+
131+
No return fields
132+
105133

106134

107135
SAW/LLVM/load module (command)
108136
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109137

138+
Load the specified LLVM module.
139+
140+
Parameter fields
141+
++++++++++++++++
142+
110143

111144
``name``
112145
The name to refer to the loaded module by later.
@@ -117,12 +150,22 @@ SAW/LLVM/load module (command)
117150
The file containing the bitcode LLVM module to load.
118151

119152

120-
Load the specified LLVM module.
153+
154+
Return fields
155+
+++++++++++++
156+
157+
No return fields
158+
121159

122160

123161
SAW/LLVM/verify (command)
124162
~~~~~~~~~~~~~~~~~~~~~~~~~
125163

164+
Verify the named LLVM function meets its specification.
165+
166+
Parameter fields
167+
++++++++++++++++
168+
126169

127170
``module``
128171
The module of the function being verified.
@@ -158,12 +201,22 @@ SAW/LLVM/verify (command)
158201
The name to refer to this verification/contract by later.
159202

160203

161-
Verify the named LLVM function meets its specification.
204+
205+
Return fields
206+
+++++++++++++
207+
208+
No return fields
209+
162210

163211

164212
SAW/LLVM/verify x86 (command)
165213
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166214

215+
Verify an x86 function from an ELF file for use as an override in an LLVM verification meets its specification.
216+
217+
Parameter fields
218+
++++++++++++++++
219+
167220

168221
``module``
169222
The LLVM module of the caller.
@@ -209,12 +262,22 @@ SAW/LLVM/verify x86 (command)
209262
The name to refer to this verification/contract by later.
210263

211264

212-
Verify an x86 function from an ELF file for use as an override in an LLVM verification meets its specification.
265+
266+
Return fields
267+
+++++++++++++
268+
269+
No return fields
270+
213271

214272

215273
SAW/LLVM/assume (command)
216274
~~~~~~~~~~~~~~~~~~~~~~~~~
217275

276+
Assume the function meets its specification.
277+
278+
Parameter fields
279+
++++++++++++++++
280+
218281

219282
``module``
220283
The LLVM module containing the function.
@@ -235,12 +298,22 @@ SAW/LLVM/assume (command)
235298
The name to refer to this assumed contract by later.
236299

237300

238-
Assume the function meets its specification.
301+
302+
Return fields
303+
+++++++++++++
304+
305+
No return fields
306+
239307

240308

241309
SAW/create ghost variable (command)
242310
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243311

312+
Create a ghost global variable to represent proof-specific program state.
313+
314+
Parameter fields
315+
++++++++++++++++
316+
244317

245318
``display name``
246319
The name to assign to the ghost variable for display.
@@ -251,12 +324,22 @@ SAW/create ghost variable (command)
251324
The server name to use to access the ghost variable later.
252325

253326

254-
Create a ghost global variable to represent proof-specific program state.
327+
328+
Return fields
329+
+++++++++++++
330+
331+
No return fields
332+
255333

256334

257335
SAW/make simpset (command)
258336
~~~~~~~~~~~~~~~~~~~~~~~~~~
259337

338+
Create a simplification rule set from the given rules.
339+
340+
Parameter fields
341+
++++++++++++++++
342+
260343

261344
``elements``
262345
The items to include in the simpset.
@@ -267,12 +350,22 @@ SAW/make simpset (command)
267350
The name to assign to this simpset.
268351

269352

270-
Create a simplification rule set from the given rules.
353+
354+
Return fields
355+
+++++++++++++
356+
357+
No return fields
358+
271359

272360

273361
SAW/prove (command)
274362
~~~~~~~~~~~~~~~~~~~
275363

364+
Attempt to prove the given term representing a theorem, given a proof script context.
365+
366+
Parameter fields
367+
++++++++++++++++
368+
276369

277370
``script``
278371
Script to use to prove the term.
@@ -283,37 +376,80 @@ SAW/prove (command)
283376
The goal to interpret as a theorm and prove.
284377

285378

286-
Attempt to prove the given term representing a theorem, given a proof script context.
379+
380+
Return fields
381+
+++++++++++++
382+
383+
384+
``status``
385+
A string (one of ``valid````, ````invalid``, or ``unknown``) indicating whether the proof went through successfully or not.
386+
387+
388+
389+
``counterexample``
390+
Only used if the ``status`` is ``invalid``. An array of objects where each object has a ``name`` string and a :ref:`JSON Cryptol expression <Expression>` ``value``.
391+
392+
287393

288394

289395
SAW/set option (command)
290396
~~~~~~~~~~~~~~~~~~~~~~~~
291397

398+
Set a SAW option in the server.
399+
400+
Parameter fields
401+
++++++++++++++++
402+
292403

293404
``option``
294405
The option to set and its accompanying value (i.e., true or false); one of the following:``lax arithmetic``, ``SMT array memory model``, or ``What4 hash consing``
295406

296407

297-
Set a SAW option in the server.
408+
409+
Return fields
410+
+++++++++++++
411+
412+
No return fields
413+
298414

299415

300416
SAW/clear state (notification)
301417
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302418

419+
Clear a particular state from the SAW server (making room for subsequent/unrelated states).
420+
421+
Parameter fields
422+
++++++++++++++++
423+
303424

304425
``state to clear``
305426
The state to clear from the server to make room for other unrelated states.
306427

307428

308-
Clear a particular state from the SAW server (making room for subsequent/unrelated states).
429+
430+
Return fields
431+
+++++++++++++
432+
433+
No return fields
434+
309435

310436

311437
SAW/clear all states (notification)
312438
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313439

440+
Clear all states from the SAW server (making room for subsequent/unrelated states).
441+
442+
Parameter fields
443+
++++++++++++++++
444+
314445
No parameters
315446

316-
Clear all states from the SAW server (making room for subsequent/unrelated states).
447+
448+
Return fields
449+
+++++++++++++
450+
451+
No return fields
452+
317453

318454

319455

saw-remote-api/src/SAWServer/ClearState.hs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE MultiParamTypeClasses #-}
12
{-# LANGUAGE OverloadedStrings #-}
23
module SAWServer.ClearState
34
( clearState
@@ -18,8 +19,8 @@ instance JSON.FromJSON ClearStateParams where
1819
JSON.withObject "params for \"clear state\"" $
1920
\o -> ClearStateParams <$> o .: "state to clear"
2021

21-
instance Doc.DescribedParams ClearStateParams where
22-
parameterFieldDescription =
22+
instance Doc.DescribedMethod ClearStateParams () where
23+
parameterFieldDescription =
2324
[("state to clear",
2425
Doc.Paragraph [Doc.Text "The state to clear from the server to make room for other unrelated states."])
2526
]
@@ -42,7 +43,7 @@ instance JSON.FromJSON ClearAllStatesParams where
4243
JSON.withObject "params for \"clear all states\"" $
4344
\_ -> pure ClearAllStatesParams
4445

45-
instance Doc.DescribedParams ClearAllStatesParams where
46+
instance Doc.DescribedMethod ClearAllStatesParams () where
4647
parameterFieldDescription = []
4748

4849
clearAllStatesDescr :: Doc.Block

0 commit comments

Comments
 (0)