Skip to content

Commit

Permalink
solve the unhook problem during summarizing ADD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevengre committed Jan 9, 2025
1 parent c8104fa commit a92e97e
Show file tree
Hide file tree
Showing 6 changed files with 2,806 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def exec_summarize(options: ProveOptions) -> None:
proof_dir = Path(__file__).parent / 'proofs'
save_directory = Path(__file__).parent / 'summaries'
summarizer = KEVMSummarizer(proof_dir, save_directory)
proof = summarizer.build_spec('STOP')
proof = summarizer.build_spec('ADD')
summarizer.explore(proof)
summarizer.summarize(proof)
# summarizer.analyze_proof(proof_dir / 'STOP_SPEC')
Expand Down
12 changes: 6 additions & 6 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/evm.md
Original file line number Diff line number Diff line change
Expand Up @@ -1886,9 +1886,9 @@ Precompiled Contracts
syntax InternalOp ::= #ecadd(G1Point, G1Point) [symbol(#ecadd)]
// ---------------------------------------------------------------
rule <k> #ecadd(P1, P2) => #end EVMC_PRECOMPILE_FAILURE ... </k>
requires notBool isValidPoint(P1) orBool notBool isValidPoint(P2)
requires notBool isValidPointWrapper(P1) orBool notBool isValidPointWrapper(P2)
rule <k> #ecadd(P1, P2) => #end EVMC_SUCCESS ... </k> <output> _ => #point(BN128Add(P1, P2)) </output>
requires isValidPoint(P1) andBool isValidPoint(P2)
requires isValidPointWrapper(P1) andBool isValidPointWrapper(P2)
syntax PrecompiledOp ::= "ECMUL"
// --------------------------------
Expand All @@ -1898,9 +1898,9 @@ Precompiled Contracts
syntax InternalOp ::= #ecmul(G1Point, Int) [symbol(#ecmul)]
// -----------------------------------------------------------
rule <k> #ecmul(P, _S) => #end EVMC_PRECOMPILE_FAILURE ... </k>
requires notBool isValidPoint(P)
requires notBool isValidPointWrapper(P)
rule <k> #ecmul(P, S) => #end EVMC_SUCCESS ... </k> <output> _ => #point(BN128Mul(P, S)) </output>
requires isValidPoint(P)
requires isValidPointWrapper(P)
syntax Bytes ::= #point ( G1Point ) [symbol(#point), function]
// --------------------------------------------------------------
Expand All @@ -1925,9 +1925,9 @@ Precompiled Contracts
syntax InternalOp ::= "#checkPoint"
// -----------------------------------
rule <k> (#checkPoint => .K) ~> #ecpairing(ListItem(AK::G1Point) _, ListItem(BK::G2Point) _, _, _, _) ... </k>
requires isValidPoint(AK) andBool isValidPoint(BK)
requires isValidPointWrapper(AK) andBool isValidPointWrapper(BK)
rule <k> #checkPoint ~> #ecpairing(ListItem(AK::G1Point) _, ListItem(BK::G2Point) _, _, _, _) => #end EVMC_PRECOMPILE_FAILURE ... </k>
requires notBool isValidPoint(AK) orBool notBool isValidPoint(BK)
requires notBool isValidPointWrapper(AK) orBool notBool isValidPointWrapper(BK)
syntax PrecompiledOp ::= "BLAKE2F"
// ----------------------------------
Expand Down
10 changes: 10 additions & 0 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ module SERIALIZATION
Address/Hash Helpers
--------------------

- `isValidPointWrapper` serves as a wrapper around the `isValidPoint` in `KRYPTO`.

```k
syntax Bool ::= isValidPointWrapper ( G1Point ) [symbol(isValidPointWrapper), function, total, smtlib(smt_krypto_bn128valid)]
| isValidPointWrapper ( G2Point ) [symbol(isValidG2PointWrapper), function, total, smtlib(smt_krypto_bn128g2valid)]
// -----------------------------------------------------------------------------------------------------------------------------
rule [isValidPointWrapper]: isValidPointWrapper(P:G1Point) => isValidPoint(P) [concrete]
rule [isValidG2PointWrapper]: isValidPointWrapper(P:G2Point) => isValidPoint(P) [concrete]
```

- `keccak` serves as a wrapper around the `Keccak256` in `KRYPTO`.

```k
Expand Down
Loading

0 comments on commit a92e97e

Please sign in to comment.