Skip to content

Commit d476a07

Browse files
author
Everett Hildenbrandt
committed
evm, driver, analysis, evm-node: remove #exception, #revert, rename #end => #halt, remove Exception
Now instead of using #revert, #end, or #exception, using #end_ to set the status code as well. Code `#halt` is named different than `#end` so that people must explicitely decide not to set the status code if they want to #end.
1 parent 3ed19d4 commit d476a07

File tree

4 files changed

+74
-77
lines changed

4 files changed

+74
-77
lines changed

analysis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ We'll need to make summaries of the state which collect information about how mu
4343
4444
syntax KItem ::= "#endSummary"
4545
// ------------------------------
46-
rule <statusCode> EVMC_SUCCESS </statusCode> <k> (#exception => .) ~> #endSummary ... </k>
46+
rule <statusCode> EVMC_SUCCESS </statusCode> <k> (#halt => .) ~> #endSummary ... </k>
4747
rule <k> #endSummary => . ... </k> <pc> PCOUNT </pc> <gas> GAVAIL </gas> <memoryUsed> MEMUSED </memoryUsed>
4848
<analysis> ... "blocks" |-> (ListItem({ PCOUNT1 | GAVAIL1 | MEMUSED1 } => { PCOUNT1 ==> PCOUNT | GAVAIL1 -Int GAVAIL | MEMUSED -Int MEMUSED1 }) REST) ... </analysis>
4949
```

driver.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Some Ethereum commands take an Ethereum specification (eg. for an account or tra
3535
rule <k> .EthereumSimulation => . ... </k>
3636
rule <k> ETC ETS:EthereumSimulation => ETC ~> ETS ... </k>
3737
rule <k> ETC1:EthereumCommand ~> ETC2 ETS:EthereumSimulation => ETC1 ~> ETC2 ~> ETS ... </k>
38-
rule <k> EX:Exception ~> ETC2 ETS:EthereumSimulation => EX ~> ETC2 ~> ETS ... </k>
38+
rule <k> KI:KItem ~> ETC2 ETS:EthereumSimulation => KI ~> ETC2 ~> ETS ... </k>
3939
4040
syntax EthereumSimulation ::= JSON
4141
// ----------------------------------
@@ -83,8 +83,8 @@ To do so, we'll extend sort `JSON` with some EVM specific syntax, and provide a
8383
8484
syntax EthereumCommand ::= "flush"
8585
// ----------------------------------
86-
rule <mode> EXECMODE </mode> <statusCode> EVMC_SUCCESS </statusCode> <k> #exception ~> flush => #finalizeTx(EXECMODE ==K VMTESTS) ... </k>
87-
rule <mode> EXECMODE </mode> <statusCode> _:ExceptionalStatusCode </statusCode> <k> #exception ~> flush => #finalizeTx(EXECMODE ==K VMTESTS) ~> #exception ... </k>
86+
rule <mode> EXECMODE </mode> <statusCode> EVMC_SUCCESS </statusCode> <k> #halt ~> flush => #finalizeTx(EXECMODE ==K VMTESTS) ... </k>
87+
rule <mode> EXECMODE </mode> <statusCode> _:ExceptionalStatusCode </statusCode> <k> #halt ~> flush => #finalizeTx(EXECMODE ==K VMTESTS) ~> #halt ... </k>
8888
```
8989

9090
- `startTx` computes the sender of the transaction, and places loadTx on the `k` cell.
@@ -178,11 +178,11 @@ To do so, we'll extend sort `JSON` with some EVM specific syntax, and provide a
178178
179179
syntax EthereumCommand ::= "#finishTx"
180180
// --------------------------------------
181-
rule <statusCode> _:ExceptionalStatusCode </statusCode> <k> #exception ~> #finishTx => #popCallStack ~> #popWorldState ... </k>
182-
rule <statusCode> EVMC_REVERT </statusCode> <k> #exception ~> #finishTx => #popCallStack ~> #popWorldState ~> #refund GAVAIL ... </k> <gas> GAVAIL </gas>
181+
rule <statusCode> _:ExceptionalStatusCode </statusCode> <k> #halt ~> #finishTx => #popCallStack ~> #popWorldState ... </k>
182+
rule <statusCode> EVMC_REVERT </statusCode> <k> #halt ~> #finishTx => #popCallStack ~> #popWorldState ~> #refund GAVAIL ... </k> <gas> GAVAIL </gas>
183183
184184
rule <statusCode> EVMC_SUCCESS </statusCode>
185-
<k> #exception ~> #finishTx => #mkCodeDeposit ACCT ... </k>
185+
<k> #halt ~> #finishTx => #mkCodeDeposit ACCT ... </k>
186186
<id> ACCT </id>
187187
<txPending> ListItem(TXID:Int) ... </txPending>
188188
<message>
@@ -192,7 +192,7 @@ To do so, we'll extend sort `JSON` with some EVM specific syntax, and provide a
192192
</message>
193193
194194
rule <statusCode> EVMC_SUCCESS </statusCode>
195-
<k> #exception ~> #finishTx => #popCallStack ~> #dropWorldState ~> #refund GAVAIL ... </k>
195+
<k> #halt ~> #finishTx => #popCallStack ~> #dropWorldState ~> #refund GAVAIL ... </k>
196196
<id> ACCT </id>
197197
<gas> GAVAIL </gas>
198198
<txPending> ListItem(TXID:Int) ... </txPending>
@@ -253,7 +253,7 @@ To do so, we'll extend sort `JSON` with some EVM specific syntax, and provide a
253253
syntax EthereumCommand ::= "exception" | "status" StatusCode
254254
// ------------------------------------------------------------
255255
rule <statusCode> _:ExceptionalStatusCode </statusCode>
256-
<k> #exception ~> exception => . ... </k>
256+
<k> #halt ~> exception => . ... </k>
257257
258258
rule <k> status SC => . ... </k> <statusCode> SC </statusCode>
259259
@@ -640,7 +640,7 @@ The `"rlp"` key loads the block information.
640640
```{.k .standalone}
641641
syntax EthereumCommand ::= "check" JSON
642642
// ---------------------------------------
643-
rule <k> #exception ~> check J:JSON => check J ~> #exception ... </k>
643+
rule <k> #halt ~> check J:JSON => check J ~> #halt ... </k>
644644
645645
rule <k> check DATA : { .JSONList } => . ... </k> requires DATA =/=String "transactions"
646646
rule <k> check DATA : [ .JSONList ] => . ... </k> requires DATA =/=String "ommerHeaders"

evm-node.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,18 @@ Because the same account may be loaded more than once, implementations of this i
184184
- `#endCreate` and `#endVM` clean up after the transaction finishes and store the return status code of the top level call frame on the top of the `<k>` cell.
185185

186186
```{.k .node}
187-
syntax Exception ::= "#endVM" | "#endCreate"
188-
// --------------------------------------------
189-
rule <statusCode> _:ExceptionalStatuscode </statusCode>
190-
<k> #exception ~> #endVM => #popCallStack ~> #popWorldState ~> 0 </k>
187+
syntax KItem ::= "#endVM" | "#endCreate"
188+
// ----------------------------------------
189+
rule <statusCode> _:ExceptionalStatusCode </statusCode>
190+
<k> #halt ~> #endVM => #popCallStack ~> #popWorldState ~> 0 </k>
191191
<output> _ => .WordStack </output>
192192
193193
rule <statusCode> EVMC_REVERT </statusCode>
194-
<k> #exception ~> #endVM => #popCallStack ~> #popWorldState ~> #refund GAVAIL ~> 0 </k>
194+
<k> #halt ~> #endVM => #popCallStack ~> #popWorldState ~> #refund GAVAIL ~> 0 </k>
195195
<gas> GAVAIL </gas>
196196
197197
rule <statusCode> EVMC_SUCCESS </statusCode>
198-
<k> #exception ~> #endVM => #popCallStack ~> #dropWorldState ~> #refund GAVAIL ~> 1 </k>
198+
<k> #halt ~> #endVM => #popCallStack ~> #dropWorldState ~> #refund GAVAIL ~> 1 </k>
199199
<gas> GAVAIL </gas>
200200
201201
rule <k> #endCreate => W ... </k> <wordStack> W : WS </wordStack>

0 commit comments

Comments
 (0)