Skip to content

Commit 9d5fc0c

Browse files
committed
Revert "Web3: Generate basic coverage report (#513)"
This reverts commit d79a9a4.
1 parent d79a9a4 commit 9d5fc0c

File tree

3 files changed

+1
-97
lines changed

3 files changed

+1
-97
lines changed

tests/web3/firefly_getCoverageData0.expected.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/web3/firefly_getCoverageData0.in.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

web3.md

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,6 @@ WEB3 JSON RPC
315315
<method> "eth_call" </method>
316316
rule <k> #runRPCCall => #eth_estimateGas ... </k>
317317
<method> "eth_estimateGas" </method>
318-
rule <k> #runRPCCall => #firefly_getCoverageData ... </k>
319-
<method> "firefly_getCoverageData" </method>
320318
321319
rule <k> #runRPCCall => #sendResponse( "error": {"code": -32601, "message": "Method not found"} ) ... </k> [owise]
322320
@@ -1074,10 +1072,6 @@ Collecting Coverage Data
10741072
- `<opcodeLists>` cell is a map similar to `<opcodeCoverage>` which stores instead a list containing all the `OpcodeItem`s of the executed bytecode for each contract.
10751073
- `OpcodeItem` is a tuple which contains the Program Counter and the Opcode name.
10761074

1077-
**TODO**: instead of having both `#serializeCoverage` and `#serializePrograms` we could keep only the first rule as `#serializeCoverageMap` if `<opcodeLists>` would store `Sets` instead of `Lists`.
1078-
**TODO**: compute coverage percentages in `Float` instead of `Int`
1079-
**TODO**: `Set2List` won't return `ListItems` in order, causing tests to fail.
1080-
10811075
```k
10821076
syntax Phase ::= ".Phase"
10831077
| "CONSTRUCTOR"
@@ -1132,52 +1126,5 @@ Collecting Coverage Data
11321126
requires notBool PCOUNT in PCS
11331127
[priority(25)]
11341128
1135-
syntax KItem ::= "#firefly_getCoverageData"
1136-
// -------------------------------------------
1137-
rule <k> #firefly_getCoverageData => #sendResponse ("result": #makeCoverageReport(COVERAGE, PGMS)) ... </k>
1138-
<opcodeCoverage> COVERAGE </opcodeCoverage>
1139-
<opcodeLists> PGMS </opcodeLists>
1140-
1141-
syntax JSON ::= #makeCoverageReport ( Map, Map ) [function]
1142-
// -----------------------------------------------------------
1143-
rule #makeCoverageReport (COVERAGE, PGMS) => {
1144-
"coverages": [#coveragePercentages(keys_list(PGMS),COVERAGE,PGMS)],
1145-
"coveredOpcodes": [#serializeCoverage(keys_list(COVERAGE),COVERAGE)],
1146-
"programs": [#serializePrograms(keys_list(PGMS),PGMS)]
1147-
}
1148-
1149-
syntax JSONList ::= #serializeCoverage ( List, Map ) [function]
1150-
// ---------------------------------------------------------------
1151-
rule #serializeCoverage (.List, _ ) => .JSONList
1152-
rule #serializeCoverage ((ListItem({ CODEHASH | EPHASE } #as KEY) KEYS), KEY |-> X:Set COVERAGE:Map ) => { Int2String(CODEHASH):{ Phase2String(EPHASE): [IntList2JSONList(Set2List(X))] }}, #serializeCoverage(KEYS, COVERAGE)
1153-
1154-
syntax JSONList ::= #serializePrograms ( List, Map ) [function]
1155-
// ---------------------------------------------------------------
1156-
rule #serializePrograms (.List, _ ) => .JSONList
1157-
rule #serializePrograms ((ListItem({ CODEHASH | EPHASE } #as KEY) KEYS), KEY |-> X:List PGMS:Map ) => { Int2String(CODEHASH):{ Phase2String(EPHASE): [CoverageIDList2JSONList(X)] }}, #serializePrograms(KEYS, PGMS)
1158-
1159-
syntax String ::= Phase2String ( Phase ) [function]
1160-
// ----------------------------------------------------
1161-
rule Phase2String (CONSTRUCTOR) => "CONSTRUCTOR"
1162-
rule Phase2String (RUNTIME) => "RUNTIME"
1163-
1164-
syntax JSONList ::= CoverageIDList2JSONList ( List ) [function]
1165-
// ---------------------------------------------------------------
1166-
rule CoverageIDList2JSONList (.List) => .JSONList
1167-
rule CoverageIDList2JSONList (ListItem({I:Int | _:OpCode }) L) => I, CoverageIDList2JSONList(L)
1168-
1169-
syntax JSONList ::= IntList2JSONList ( List ) [function]
1170-
// --------------------------------------------------------
1171-
rule IntList2JSONList (.List) => .JSONList
1172-
rule IntList2JSONList (ListItem(I:Int) L) => I, IntList2JSONList(L)
1173-
1174-
syntax JSONList ::= #coveragePercentages ( List, Map, Map) [function]
1175-
// ---------------------------------------------------------------------
1176-
rule #coveragePercentages (.List, _, _) => .JSONList
1177-
rule #coveragePercentages ((ListItem({ CODEHASH | EPHASE } #as KEY) KEYS), KEY |-> X:Set COVERAGE:Map, KEY |-> Y:List PGMS:Map) => { Int2String(CODEHASH):{ Phase2String(EPHASE): #computePercentage(size(X),size(Y)) }}, #coveragePercentages(KEYS,COVERAGE,PGMS)
1178-
1179-
syntax Int ::= #computePercentage ( Int, Int ) [function]
1180-
// ---------------------------------------------------------
1181-
rule #computePercentage (EXECUTED, TOTAL) => (100 *Int EXECUTED) /Int TOTAL
11821129
endmodule
1183-
```
1130+
```

0 commit comments

Comments
 (0)