diff --git a/.gitignore b/.gitignore
index f204c457b0..86dfb087be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@
/package/pkg
/package/src
/media/*.pdf
+/tests/web3/*.out.json
+/tests/web3/*/*.out.json
diff --git a/Makefile b/Makefile
index df4cd31e68..805984fe92 100644
--- a/Makefile
+++ b/Makefile
@@ -425,6 +425,8 @@ tests/web3/no-shutdown/%: KEVM_WEB3_ARGS=
tests/%.run-web3: tests/%.in.json
tests/web3/runtest.sh $< tests/$*.out.json $(KEVM_WEB3_ARGS)
+ $(CHECK) tests/$*.expected.json tests/$*.out.json
+ rm -rf tests/$*.out.json
tests/%.parse: tests/%
$(TEST) kast --backend $(TEST_CONCRETE_BACKEND) $< kast > $@-out
diff --git a/data.md b/data.md
index d28e985e85..07a8717f64 100644
--- a/data.md
+++ b/data.md
@@ -29,7 +29,7 @@ Writing a JSON-ish parser in K takes 6 lines.
```k
syntax JSONList ::= List{JSON,","}
syntax JSONKey ::= String | Int
- syntax JSON ::= String | Int
+ syntax JSON ::= String | Int | Bool
| JSONKey ":" JSON
| "{" JSONList "}"
| "[" JSONList "]"
diff --git a/tests/web3/batch_all_notification.out.json b/tests/web3/batch_all_notification.expected.json
similarity index 100%
rename from tests/web3/batch_all_notification.out.json
rename to tests/web3/batch_all_notification.expected.json
diff --git a/tests/web3/batch_empty_array.out.json b/tests/web3/batch_empty_array.expected.json
similarity index 100%
rename from tests/web3/batch_empty_array.out.json
rename to tests/web3/batch_empty_array.expected.json
diff --git a/tests/web3/batch_invalid_array.out.json b/tests/web3/batch_invalid_array.expected.json
similarity index 100%
rename from tests/web3/batch_invalid_array.out.json
rename to tests/web3/batch_invalid_array.expected.json
diff --git a/tests/web3/batch_invalid_array_2.out.json b/tests/web3/batch_invalid_array_2.expected.json
similarity index 100%
rename from tests/web3/batch_invalid_array_2.out.json
rename to tests/web3/batch_invalid_array_2.expected.json
diff --git a/tests/web3/batch_partial_notification.out.json b/tests/web3/batch_partial_notification.expected.json
similarity index 100%
rename from tests/web3/batch_partial_notification.out.json
rename to tests/web3/batch_partial_notification.expected.json
diff --git a/tests/web3/batch_partially_valid.out.json b/tests/web3/batch_partially_valid.expected.json
similarity index 100%
rename from tests/web3/batch_partially_valid.out.json
rename to tests/web3/batch_partially_valid.expected.json
diff --git a/tests/web3/eth_newBlockFilter.expected.json b/tests/web3/eth_newBlockFilter.expected.json
new file mode 100644
index 0000000000..602dae045d
--- /dev/null
+++ b/tests/web3/eth_newBlockFilter.expected.json
@@ -0,0 +1 @@
+[{"jsonrpc":"2.0","id":1,"result":"0x0"},{"jsonrpc":"2.0","id":2,"result":"0x1"},{"jsonrpc":"2.0","id":3,"result":true},{"jsonrpc":"2.0","id":4,"result":true},{"jsonrpc":"2.0","id":4,"result":false}]
\ No newline at end of file
diff --git a/tests/web3/eth_newBlockFilter.in.json b/tests/web3/eth_newBlockFilter.in.json
index 2c9593ee0e..60c9a35ddc 100644
--- a/tests/web3/eth_newBlockFilter.in.json
+++ b/tests/web3/eth_newBlockFilter.in.json
@@ -1,4 +1,5 @@
-[{"jsonrpc":"2.0", "method":"eth_newBlockFilter", "params":[], "id":1},
-{"jsonrpc":"2.0", "method":"eth_newBlockFilter", "params":[], "id":2},
-{"jsonrpc":"2.0", "method":"eth_uninstallFilter", "params":["0x0"], "id":3},
-{"jsonrpc":"2.0", "method":"eth_uninstallFilter", "params":["0x1"], "id":4}]
+[{"jsonrpc":"2.0", "method":"eth_newBlockFilter", "params":[], "id":1},
+{"jsonrpc":"2.0", "method":"eth_newBlockFilter", "params":[], "id":2},
+{"jsonrpc":"2.0", "method":"eth_uninstallFilter", "params":["0x0"], "id":3},
+{"jsonrpc":"2.0", "method":"eth_uninstallFilter", "params":["0x1"], "id":4},
+{"jsonrpc":"2.0", "method":"eth_uninstallFilter", "params":["0x2"], "id":4}]
diff --git a/tests/web3/eth_newBlockFilter.out.json b/tests/web3/eth_newBlockFilter.out.json
deleted file mode 100644
index c28a00aba2..0000000000
--- a/tests/web3/eth_newBlockFilter.out.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"jsonrpc":"2.0","id":1,"result":"0x0"},{"jsonrpc":"2.0","id":2,"result":"0x1"},{"jsonrpc":"2.0","id":3,"result":"true"},{"jsonrpc":"2.0","id":4,"result":"true"}]
\ No newline at end of file
diff --git a/tests/web3/evm_increaseTime.out.json b/tests/web3/evm_increaseTime.expected.json
similarity index 65%
rename from tests/web3/evm_increaseTime.out.json
rename to tests/web3/evm_increaseTime.expected.json
index b37d47be6b..8f28a8a615 100644
--- a/tests/web3/evm_increaseTime.out.json
+++ b/tests/web3/evm_increaseTime.expected.json
@@ -1 +1 @@
-{"jsonrpc":"2.0","id":1,"result":"0x0"}{"jsonrpc":"2.0","id":2,"result":"100"}{"jsonrpc":"2.0","id":3,"result":"300"}{"jsonrpc":"2.0","id":4,"result":"true"}{"jsonrpc":"2.0","id":5,"result":"350"}
\ No newline at end of file
+{"jsonrpc":"2.0","id":1,"result":"0x0"}{"jsonrpc":"2.0","id":2,"result":"100"}{"jsonrpc":"2.0","id":3,"result":"300"}{"jsonrpc":"2.0","id":4,"result":true}{"jsonrpc":"2.0","id":5,"result":"350"}
\ No newline at end of file
diff --git a/tests/web3/evm_revert.expected.json b/tests/web3/evm_revert.expected.json
new file mode 100644
index 0000000000..25cc86326f
--- /dev/null
+++ b/tests/web3/evm_revert.expected.json
@@ -0,0 +1 @@
+{"jsonrpc":"2.0","id":1,"result":"0x0"}{"jsonrpc":"2.0","id":2,"result":"0x1"}{"jsonrpc":"2.0","id":3,"result":true}{"jsonrpc":"2.0","id":4,"result":"0x1"}
\ No newline at end of file
diff --git a/tests/web3/evm_revert.out.json b/tests/web3/evm_revert.out.json
deleted file mode 100644
index 984adecf6e..0000000000
--- a/tests/web3/evm_revert.out.json
+++ /dev/null
@@ -1 +0,0 @@
-{"jsonrpc":"2.0","id":1,"result":"0x0"}{"jsonrpc":"2.0","id":2,"result":"0x1"}{"jsonrpc":"2.0","id":3,"result":"true"}{"jsonrpc":"2.0","id":4,"result":"0x1"}
\ No newline at end of file
diff --git a/tests/web3/evm_revert2.out.json b/tests/web3/evm_revert2.expected.json
similarity index 65%
rename from tests/web3/evm_revert2.out.json
rename to tests/web3/evm_revert2.expected.json
index bd1ea87927..0e3916eb88 100644
--- a/tests/web3/evm_revert2.out.json
+++ b/tests/web3/evm_revert2.expected.json
@@ -1 +1 @@
-{"jsonrpc":"2.0","id":1,"result":"0x0"}{"jsonrpc":"2.0","id":2,"result":"0x1"}{"jsonrpc":"2.0","id":3,"result":"0x2"}{"jsonrpc":"2.0","id":4,"result":"true"}{"jsonrpc":"2.0","id":5,"result":"0x1"}
\ No newline at end of file
+{"jsonrpc":"2.0","id":1,"result":"0x0"}{"jsonrpc":"2.0","id":2,"result":"0x1"}{"jsonrpc":"2.0","id":3,"result":"0x2"}{"jsonrpc":"2.0","id":4,"result":true}{"jsonrpc":"2.0","id":5,"result":"0x1"}
\ No newline at end of file
diff --git a/tests/web3/evm_snapshot.out.json b/tests/web3/evm_snapshot.expected.json
similarity index 100%
rename from tests/web3/evm_snapshot.out.json
rename to tests/web3/evm_snapshot.expected.json
diff --git a/tests/web3/invalid_id.out.json b/tests/web3/invalid_id.expected.json
similarity index 100%
rename from tests/web3/invalid_id.out.json
rename to tests/web3/invalid_id.expected.json
diff --git a/tests/web3/invalid_method.out.json b/tests/web3/invalid_method.expected.json
similarity index 100%
rename from tests/web3/invalid_method.out.json
rename to tests/web3/invalid_method.expected.json
diff --git a/tests/web3/invalid_params.out.json b/tests/web3/invalid_params.expected.json
similarity index 100%
rename from tests/web3/invalid_params.out.json
rename to tests/web3/invalid_params.expected.json
diff --git a/tests/web3/invalid_version.out.json b/tests/web3/invalid_version.expected.json
similarity index 100%
rename from tests/web3/invalid_version.out.json
rename to tests/web3/invalid_version.expected.json
diff --git a/tests/web3/invalid_version_no_id.out.json b/tests/web3/invalid_version_no_id.expected.json
similarity index 100%
rename from tests/web3/invalid_version_no_id.out.json
rename to tests/web3/invalid_version_no_id.expected.json
diff --git a/tests/web3/method_not_found.out.json b/tests/web3/method_not_found.expected.json
similarity index 100%
rename from tests/web3/method_not_found.out.json
rename to tests/web3/method_not_found.expected.json
diff --git a/tests/web3/net_version.out.json b/tests/web3/net_version.expected.json
similarity index 100%
rename from tests/web3/net_version.out.json
rename to tests/web3/net_version.expected.json
diff --git a/tests/web3/net_version_2.out.json b/tests/web3/net_version_2.expected.json
similarity index 100%
rename from tests/web3/net_version_2.out.json
rename to tests/web3/net_version_2.expected.json
diff --git a/tests/web3/net_version_notification.out.json b/tests/web3/net_version_notification.expected.json
similarity index 100%
rename from tests/web3/net_version_notification.out.json
rename to tests/web3/net_version_notification.expected.json
diff --git a/tests/web3/no-shutdown/net_version.out.json b/tests/web3/no-shutdown/net_version.expected.json
similarity index 100%
rename from tests/web3/no-shutdown/net_version.out.json
rename to tests/web3/no-shutdown/net_version.expected.json
diff --git a/tests/web3/runtest.sh b/tests/web3/runtest.sh
index 92fe181c40..4d9286c88e 100755
--- a/tests/web3/runtest.sh
+++ b/tests/web3/runtest.sh
@@ -11,18 +11,11 @@ PORT=$(tests/web3/get_port.py)
kevm_client_pid="$!"
while ! netcat -z 127.0.0.1 "$PORT"; do sleep 0.1; done
-# Feed input in, store output in tmp file
-tmp_output_file="$(mktemp)"
-trap "rm -rf $tmp_output_file" INT TERM EXIT
-cat "$input_file" | netcat 127.0.0.1 "$PORT" -q 0 > "$tmp_output_file"
+# Feed input in, store output in supplied file
+cat "$input_file" | netcat 127.0.0.1 "$PORT" -q 0 > "$output_file"
./kevm web3-send "$PORT" 'firefly_shutdown'
echo
timeout 20 tail --pid="$kevm_client_pid" -f /dev/null || true
pkill -P "$kevm_client_pid" kevm-client || true
timeout 20 tail --pid="$kevm_client_pid" -f /dev/null || true
-
-exit_code='0'
-git --no-pager diff --no-index "$output_file" "$tmp_output_file" || exit_code="$?"
-
-exit "$exit_code"
diff --git a/web3.md b/web3.md
index a5fbff6c1f..a668948791 100644
--- a/web3.md
+++ b/web3.md
@@ -40,8 +40,10 @@ module WEB3
.List
- syntax JSON ::= Bool | "null" | "undef"
- | #getJSON ( JSONKey , JSON ) [function]
+ syntax JSON ::= "null" | "undef"
+ // --------------------------------
+
+ syntax JSON ::= #getJSON ( JSONKey , JSON ) [function]
// ------------------------------------------------------
rule #getJSON( KEY, { KEY : J, _ } ) => J
rule #getJSON( _, { .JSONList } ) => undef
@@ -305,7 +307,7 @@ module WEB3
syntax KItem ::= "#evm_revert"
// ------------------------------
- rule #evm_revert => #sendResponse( "result" : "true" ) ...
+ rule #evm_revert => #sendResponse( "result" : true ) ...
[ .JSONList ]
... ( ListItem(NETWORKSTATE) => .List )
( _ => NETWORKSTATE )
@@ -344,7 +346,7 @@ module WEB3
rule #eth_uninstallFilter ...
[ (DATA => #parseHexWord(DATA)), .JSONList ]
- rule #eth_uninstallFilter => #sendResponse ( "result": "true" ) ...
+ rule #eth_uninstallFilter => #sendResponse ( "result": true ) ...
[ FILTID, .JSONList ]
(