Skip to content

Commit acdfbb9

Browse files
author
Everett Hildenbrandt
committed
network, evm: add EVM_EC_ERROR exceptional status code for crypto function errors
1 parent ac178c9 commit acdfbb9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

evm.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ Precompiled Contracts
18011801
18021802
syntax InternalOp ::= #ecadd(G1Point, G1Point)
18031803
// ----------------------------------------------
1804-
rule <k> #ecadd(P1, P2) => #exception EVM_INTERNAL_ERROR ... </k>
1804+
rule <k> #ecadd(P1, P2) => #exception EVM_EC_ERROR ... </k>
18051805
requires notBool isValidPoint(P1) orBool notBool isValidPoint(P2)
18061806
rule <k> #ecadd(P1, P2) => #end ... </k> <output> _ => #point(BN128Add(P1, P2)) </output>
18071807
requires isValidPoint(P1) andBool isValidPoint(P2)
@@ -1813,7 +1813,7 @@ Precompiled Contracts
18131813
18141814
syntax InternalOp ::= #ecmul(G1Point, Int)
18151815
// ------------------------------------------
1816-
rule <k> #ecmul(P, S) => #exception EVM_INTERNAL_ERROR ... </k>
1816+
rule <k> #ecmul(P, S) => #exception EVM_EC_ERROR ... </k>
18171817
requires notBool isValidPoint(P)
18181818
rule <k> #ecmul(P, S) => #end ... </k> <output> _ => #point(BN128Mul(P, S)) </output>
18191819
requires isValidPoint(P)
@@ -1827,7 +1827,7 @@ Precompiled Contracts
18271827
rule <k> ECPAIRING => #ecpairing(.List, .List, 0, DATA, #sizeWordStack(DATA)) ... </k>
18281828
<callData> DATA </callData>
18291829
requires #sizeWordStack(DATA) modInt 192 ==Int 0
1830-
rule <k> ECPAIRING => #exception EVM_INTERNAL_ERROR ... </k>
1830+
rule <k> ECPAIRING => #exception EVM_EC_ERROR ... </k>
18311831
<callData> DATA </callData>
18321832
requires #sizeWordStack(DATA) modInt 192 =/=Int 0
18331833
@@ -1842,7 +1842,7 @@ Precompiled Contracts
18421842
// -----------------------------------
18431843
rule <k> (#checkPoint => .) ~> #ecpairing(ListItem(AK::G1Point) _, ListItem(BK::G2Point) _, _, _, _) ... </k>
18441844
requires isValidPoint(AK) andBool isValidPoint(BK)
1845-
rule <k> #checkPoint ~> #ecpairing(ListItem(AK::G1Point) _, ListItem(BK::G2Point) _, _, _, _) => #exception EVM_INTERNAL_ERROR ... </k>
1845+
rule <k> #checkPoint ~> #ecpairing(ListItem(AK::G1Point) _, ListItem(BK::G2Point) _, _, _, _) => #exception EVM_EC_ERROR ... </k>
18461846
requires notBool isValidPoint(AK) orBool notBool isValidPoint(BK)
18471847
```
18481848

network.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The following codes all indicate that the VM ended execution with an exception,
2626
This can happen when accessing local memory with `CODECOPY*` or `CALLDATACOPY`, or when accessing return data with `RETURNDATACOPY`.
2727
- `EVM_STATIC_MODE_ERROR` indicates that a `STATICCALL` tried to change state.
2828
**TODO:** Avoid `_ERROR` suffix that suggests fatal error.
29+
- `EVM_EC_ERROR` indicates an error with the eliptic curve cryptographic builtins.
2930

3031
```k
3132
syntax ExceptionalStatusCode ::= "EVM_FAILURE"
@@ -37,6 +38,7 @@ The following codes all indicate that the VM ended execution with an exception,
3738
| "EVM_STACK_UNDERFLOW"
3839
| "EVM_INVALID_MEMORY_ACCESS"
3940
| "EVM_STATIC_MODE_ERROR"
41+
| "EVM_EC_ERROR"
4042
```
4143

4244
### Ending Codes

0 commit comments

Comments
 (0)