Skip to content

Integrate summaries of opcode automatically into the evm semantics #2710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 131 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
ce37bb1
provide `KEVMSummarizer` to sammarize rules for all the instruction r…
Stevengre Jan 7, 2025
e159c31
solve error call for legacy_explore and incorrect name for `#next[_]`
Stevengre Jan 7, 2025
a8a5c1c
kevm-pyk/: get code passing basic type checking issues
ehildenb Jan 7, 2025
6942dce
qupdate poetry to 2.0.0
Stevengre Jan 8, 2025
2bbdc04
add new command `summarize` for summarizing evm instructions
Stevengre Jan 8, 2025
10d9534
don't use `summarize` but `kevm summarize` instead.
Stevengre Jan 8, 2025
c207fc2
provide spec with initial and target node that are not terminal accor…
Stevengre Jan 8, 2025
4127ce0
make format & make check
Stevengre Jan 8, 2025
ae80f65
print nodes and add summarize function to generate optimized rules fo…
Stevengre Jan 8, 2025
4ddfc0a
make format & make check
Stevengre Jan 8, 2025
c28a58e
add ignore
Stevengre Jan 8, 2025
1652b8f
allow_symbolic_program
Stevengre Jan 8, 2025
ad173a1
summarize instructions one by one
Stevengre Jan 9, 2025
73d8d88
summarize `STOP`
Stevengre Jan 9, 2025
f464d37
solve the unhook problem during summarizing `ADD`.
Stevengre Jan 9, 2025
7b3f603
summarize all the evm opcode using `KEVMSummarizer.batch_summarize`. …
Stevengre Jan 10, 2025
e6bc0bd
fix the summarization for `STOP`.
Stevengre Jan 10, 2025
29a85a7
update the status of `STOP`.
Stevengre Jan 10, 2025
9f1dee6
don't use optimizations during summarization
Stevengre Jan 13, 2025
18592a1
summarize `ADD` successfully with new simplification rules, wrapper r…
Stevengre Jan 13, 2025
383a465
summarized `MUL`
Stevengre Jan 14, 2025
c3c4aab
summarized `SUB`
Stevengre Jan 14, 2025
8da7bc6
summarized `DIV`
Stevengre Jan 14, 2025
5ea9aac
summarized `SDIV`
Stevengre Jan 14, 2025
52f2b9d
summarized `MOD`
Stevengre Jan 14, 2025
a3c74fe
summarized `SMOD`
Stevengre Jan 14, 2025
230bd0c
summarized `ADDMOD`.
Stevengre Jan 14, 2025
7a6c76d
summarized `MULMOD`
Stevengre Jan 14, 2025
dd17c40
try to summarize all the opcode, under checking.
Stevengre Jan 14, 2025
acc99e1
check all the finished summarization.
Stevengre Jan 14, 2025
87255c8
update the summarization result
Stevengre Jan 15, 2025
44fb07b
update the summarization statuses.
Stevengre Jan 15, 2025
e3c5441
fix the summarization of `EXP`
Stevengre Jan 15, 2025
31645d1
fix the summarization of `ADDRESS`
Stevengre Jan 15, 2025
7e06e1a
fix summarization of
Stevengre Jan 15, 2025
93cc17c
fixed the summarization of `ORIGIN` and `EXTCODECOPY`
Stevengre Jan 16, 2025
818513a
fix summarization of `CALLER`
Stevengre Jan 16, 2025
33272d5
fix summarization of `EXTCODESIZE`
Stevengre Jan 16, 2025
2b55524
fix the summarization of `RETURNDATASIZE`
Stevengre Jan 16, 2025
e4468a0
fix the summarization of `MLOAD`
Stevengre Jan 16, 2025
73737ca
fix summarization of `MLOAD`
Stevengre Jan 16, 2025
c7577a2
fix the summarization of `MSTORE8`
Stevengre Jan 16, 2025
4fd23b3
fix the summarization of
Stevengre Jan 16, 2025
0493f03
fix the summarization of `JUMPI`
Stevengre Jan 17, 2025
52612df
fix the summarization of `PUSH`
Stevengre Jan 17, 2025
1df22a2
fix the summarization of `LOG`.
Stevengre Jan 17, 2025
00213c2
backup all the useful informations in the PR before preparing the merge
Stevengre Jan 22, 2025
84fba32
delete the logs
Stevengre Jan 22, 2025
341be7a
delete all the proof and summary files
Stevengre Jan 22, 2025
50edba8
ignore the proofs and summaries.
Stevengre Jan 22, 2025
96c0b6c
back up to keep my thinking of debuging
Stevengre Jan 22, 2025
d35b118
finish the test process on `STOP`
Stevengre Jan 22, 2025
a8eac0f
simlify the implementation
Stevengre Jan 23, 2025
b5e222b
comment rule generation validation for faster check
Stevengre Jan 23, 2025
8220e6e
fix make format & check
Stevengre Jan 23, 2025
b80e2aa
poetry lock 2.0.1
Stevengre Jan 23, 2025
e689d84
delete analysis codes in `exec_summarize`
Stevengre Jan 23, 2025
2e00b4e
make format
Stevengre Jan 23, 2025
98aea06
recover the definition and create a new target for summarization
Stevengre Jan 23, 2025
e5e2c18
delete useless lemma comments.
Stevengre Jan 23, 2025
748dc22
test all the passed opcodes
Stevengre Jan 23, 2025
da1e883
fix poetry.lock
Stevengre Jan 24, 2025
4531b4e
update summarization results using nohup.out
Stevengre Feb 10, 2025
c782b46
simplify the implementation & fix the summarization for BALANCE
Stevengre Feb 10, 2025
8cb972d
try to fix all `ACCOUNT_QUERIES_OPCODES` but failed. fix `SELFBALANCE…
Stevengre Feb 10, 2025
ee6ffac
make format & make check
Stevengre Feb 11, 2025
e86ecbf
delete log file
Stevengre Feb 11, 2025
7060652
poetry update
Stevengre Feb 11, 2025
c86953d
keep edsl unchanged
Stevengre Feb 11, 2025
1e0d8dd
Revert submodule ethereum-tests to c30599
Stevengre Feb 11, 2025
0d50efa
more detailed help info for `summarize` command.
Stevengre Feb 12, 2025
2f18b1c
reduce duplification for semantics
Stevengre Feb 12, 2025
354fd65
delete unecessary import
Stevengre Feb 12, 2025
a4bf14d
Apply suggestions from code review
Stevengre Feb 12, 2025
33ffb21
upstream word_stack function to KEVM
Stevengre Feb 12, 2025
88d9963
provide detailed comments for `exec_summarize`
Stevengre Feb 14, 2025
4e43eb2
Consolidate EDSL-SUM module into edsl.md
Stevengre Feb 14, 2025
415fbc0
Remove unnecessary serialization import from EVM module
Stevengre Feb 14, 2025
3c3a577
Rename word_stack method to wordstack in KEVM class
Stevengre Feb 14, 2025
6921f11
Add frozendict for immutable dictionary types in summarizer
Stevengre Feb 14, 2025
1879dee
Remove commented-out 'ALL' key from OPCODES_SUMMARY_STATUS
Stevengre Feb 14, 2025
5ae4347
Enhance accounts_cell function documentation
Stevengre Feb 14, 2025
4ec7728
Prepare build_stack_underflow_spec method for implementation
Stevengre Feb 14, 2025
b177372
Improve documentation for build_spec method in KEVMSummarizer
Stevengre Feb 14, 2025
79dd5bc
Simplify default argument handling in build_spec method
Stevengre Feb 14, 2025
cf16c4f
Refactor KEVM and summarizer methods to use static helper methods
Stevengre Feb 14, 2025
809acc1
Remove trailing whitespace in KEVM and summarizer modules
Stevengre Feb 14, 2025
4043fd0
Update test-summarize workflow and opcode summary statuses
Stevengre Feb 21, 2025
f7423ee
Update Poetry lock file dependencies and version constraints
Stevengre Feb 21, 2025
9f959fe
Update test-pr workflow to initialize specific submodules
Stevengre Feb 21, 2025
c3f6bcf
delete simplification rule
Stevengre Feb 21, 2025
ac42262
Add summarization simplification lemmas and update imports
Stevengre Feb 21, 2025
ce3235f
Remove test-summarize job from GitHub Actions workflow
Stevengre Feb 21, 2025
d2b700e
Add Summarization test suite to GitHub Actions workflow
Stevengre Feb 24, 2025
963c022
Increase Summarization test suite timeout to 720 seconds
Stevengre Feb 25, 2025
8e8f923
Adjust Summarization test suite configuration
Stevengre Feb 26, 2025
827e8d0
Increase Summarization test suite timeout to 240 seconds
Stevengre Feb 26, 2025
cb2894b
Increase Summarization test suite timeout to 360 seconds
Stevengre Feb 26, 2025
fcfc7da
use `summaries` to keep all the opcode summaries
Stevengre Feb 27, 2025
4dad743
Enhance summarize command with opcode-specific and clear options
Stevengre Feb 27, 2025
afe412b
Remove the KCFG.
Stevengre Feb 27, 2025
f4d9e1c
Modify summary file generation to include EVM imports and requires
Stevengre Feb 27, 2025
862f31e
Refactor summary generation and module structure
Stevengre Feb 27, 2025
9abc550
Modify batch summarization to process passed opcodes instead of unpassed
Stevengre Feb 28, 2025
9e2a1ac
Add comprehensive EVM opcode summary imports to summary.k
Stevengre Mar 4, 2025
56a7922
Refactor summary file generation to simplify and clean up specifications
Stevengre Mar 4, 2025
0ae7674
new way to remove inf gas
Stevengre Mar 5, 2025
55671b6
remove_dash_from_var
Stevengre Mar 5, 2025
101845a
Simplify summary specification files by removing unnecessary account …
Stevengre Mar 5, 2025
572d4fe
Generate summary specification files for multiple EVM opcodes
Stevengre Mar 5, 2025
3fdefd2
Enhance summary specification file generation for balance opcode
Stevengre Mar 5, 2025
66e57e3
Refine summarizer and workflow configuration
Stevengre Mar 7, 2025
754f84d
Update poetry.lock with platform-specific dependency constraints
Stevengre Mar 7, 2025
c77f67e
Update poetry.lock with Hypothesis and setuptools version bumps
Stevengre Mar 7, 2025
7b51cf4
bring back the modification in the master branch
Stevengre Mar 7, 2025
a9c71c2
Simplify summary-balance account ID regex transformation
Stevengre Mar 7, 2025
8b0697b
Add new target options for KEVM CLI summary targets
Stevengre Mar 7, 2025
65d78f6
Improve CLI target argument formatting
Stevengre Mar 7, 2025
e5c4c77
update expected file with new module name
Stevengre Mar 7, 2025
88d3441
provide a basic way to verify the summaries
Stevengre Mar 12, 2025
97c23cd
change the `require` to pass the verification
Stevengre Mar 12, 2025
2cfbbf0
try to add gas gaurd automatically
Stevengre Mar 12, 2025
53de37f
try to provide gas guard automatically
Stevengre Mar 12, 2025
f59cbec
solved out of gas problem for most opcode summaries
Stevengre Mar 13, 2025
9a59d44
fix summaries for the summaries of opcode like return
Stevengre Mar 13, 2025
9033bda
`make test-prove-summaries` passed
Stevengre Mar 14, 2025
3423f02
[to delete] add concrete execution result for both normal semantics a…
Stevengre Mar 14, 2025
6fbcbe0
Update test timeout and dependencies in poetry.lock
Stevengre Mar 14, 2025
0c9b396
Remove references to 'summary-exp-2-spec.k' and 'SUMMARY-EXP-2-SPEC' …
Stevengre Mar 14, 2025
8a64faf
[to delete] update the concrete execution result of the summary rules.
Stevengre Mar 14, 2025
3f38455
Update interpreter error handling and restore summary-exp-2-spec refe…
Stevengre Mar 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: 'Build kevm-pyk'
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c 'make poetry'
- name: 'Build distribution'
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c 'CXX=clang++-14 poetry -C kevm-pyk run kdist --verbose build -j`nproc` evm-semantics.plugin evm-semantics.haskell evm-semantics.summary'
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c 'CXX=clang++-14 poetry -C kevm-pyk run kdist --verbose build -j`nproc` evm-semantics.plugin evm-semantics.haskell evm-semantics.summarize'
- name: 'Run proofs'
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c "make ${{ matrix.test-suite }} PYTEST_ARGS='-vv ${{ matrix.test-args }}' PYTEST_PARALLEL=${{ matrix.parallel }}"
- name: 'Tear down Docker'
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ test-prove-functional: poetry
test-prove-optimizations: poetry
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_optimizations"

test-prove-summaries: poetry
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_summaries"

test-prove-dss: poetry
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_dss"

Expand Down
3 changes: 1 addition & 2 deletions kevm-pyk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/dist/
__pycache__/
.coverage
proofs/
summaries/
proofs/
6 changes: 3 additions & 3 deletions kevm-pyk/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions kevm-pyk/src/kevm_pyk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@
from pyk.proof.tui import APRProofViewer
from pyk.utils import FrozenDict, hash_str, single

from kevm_pyk.summarizer import batch_summarize
from kevm_pyk.summarizer import batch_summarize, clear_proofs, summarize

from . import VERSION, config
from .cli import _create_argument_parser, generate_options, get_argument_type_setter, get_option_string_destination
from .cli import (
_create_argument_parser,
generate_options,
get_argument_type_setter,
get_option_string_destination,
)
from .gst_to_kore import SORT_ETHEREUM_SIMULATION, filter_gst_keys, gst_to_kore, kore_pgm_to_kore
from .kevm import KEVM, KEVMSemantics, kevm_node_printer
from .kompile import KompileTarget, kevm_kompile
Expand Down Expand Up @@ -65,6 +70,7 @@
RunOptions,
SectionEdgeOptions,
ShowKCFGOptions,
SummarizeOptions,
VersionOptions,
ViewKCFGOptions,
)
Expand Down Expand Up @@ -636,10 +642,14 @@ def exec_kast(options: KastOptions) -> None:
print(output_text)


def exec_summarize(options: ProveOptions) -> None:
# TODO: provide options to summarize specific opcodes using `summarize(opcode)`
def exec_summarize(options: SummarizeOptions) -> None:
# TODO: provide options to analyze a specific proof using `analyze_proof(opcode, node_id)`
batch_summarize()
if options.clear:
clear_proofs()
if options.opcode is None:
batch_summarize()
else:
summarize(options.opcode)


# Helpers
Expand Down
50 changes: 37 additions & 13 deletions kevm-pyk/src/kevm_pyk/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def generate_options(args: dict[str, Any]) -> LoggingOptions:
case 'run':
return RunOptions(args)
case 'summarize':
return ProveOptions(args)
return SummarizeOptions(args)
case _:
raise ValueError(f'Unrecognized command: {command}')

Expand All @@ -104,7 +104,7 @@ def get_option_string_destination(command: str, option_string: str) -> str:
case 'run':
option_string_destinations = RunOptions.from_option_string()
case 'summarize':
option_string_destinations = ProveOptions.from_option_string()
option_string_destinations = SummarizeOptions.from_option_string()

return option_string_destinations.get(option_string, option_string.replace('-', '_'))

Expand Down Expand Up @@ -134,7 +134,7 @@ def func(par: str) -> str:
case 'run':
option_types = RunOptions.get_argument_type()
case 'summarize':
option_types = ProveOptions.get_argument_type()
option_types = SummarizeOptions.get_argument_type()

return option_types.get(option_string, func)

Expand Down Expand Up @@ -191,22 +191,27 @@ def _create_argument_parser() -> ArgumentParser:
help='Maximum worker threads to use on a single proof to explore separate branches in parallel.',
)

command_parser.add_parser(
summarize_args = command_parser.add_parser(
'summarize',
help='Summarize an Opcode to execute in a single rewrite step.',
parents=[
kevm_cli_args.logging_args,
kevm_cli_args.parallel_args,
kevm_cli_args.k_args,
kevm_cli_args.kprove_args,
kevm_cli_args.rpc_args,
kevm_cli_args.bug_report_args,
kevm_cli_args.smt_args,
kevm_cli_args.explore_args,
# kevm_cli_args.spec_args,
config_args.config_args,
],
)
summarize_args.add_argument(
'opcode',
type=str,
nargs='?',
help='Opcode to summarize. If not provided, all supported opcodes will be summarized.',
)
summarize_args.add_argument(
'--clear',
dest='clear',
default=False,
action='store_true',
help='Clear all existing proofs and re-run the summarization process.',
)

prune_args = command_parser.add_parser(
'prune',
Expand Down Expand Up @@ -620,6 +625,23 @@ def get_argument_type() -> dict[str, Callable]:
)


class SummarizeOptions(LoggingOptions, KOptions):
clear: bool
opcode: str | None

@staticmethod
def default() -> dict[str, Any]:
return {'clear': False, 'opcode': None}

@staticmethod
def from_option_string() -> dict[str, str]:
return LoggingOptions.from_option_string() | KOptions.from_option_string()

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return LoggingOptions.get_argument_type() | KOptions.get_argument_type()


class PruneOptions(LoggingOptions, KOptions, SpecOptions):
node: NodeIdLike

Expand Down Expand Up @@ -833,7 +855,9 @@ class KEVMCLIArgs(KCLIArgs):
@cached_property
def target_args(self) -> ArgumentParser:
args = ArgumentParser(add_help=False)
args.add_argument('--target', choices=['llvm', 'haskell', 'haskell-standalone', 'foundry'])
args.add_argument(
'--target', choices=['llvm', 'llvm-summary', 'haskell', 'haskell-standalone', 'haskell-summary', 'foundry']
)
return args

@cached_property
Expand Down
20 changes: 11 additions & 9 deletions kevm-pyk/src/kevm_pyk/interpreter.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import annotations

from subprocess import CalledProcessError
from typing import TYPE_CHECKING

from pyk.kdist import kdist
from pyk.kore.parser import KoreParser
from pyk.ktool.krun import llvm_interpret_raw
from pyk.utils import run_process_2

from .gst_to_kore import filter_gst_keys, gst_to_kore
Expand All @@ -16,18 +18,18 @@


def interpret(gst_data: Any, schedule: str, mode: str, chainid: int, usegas: bool, *, check: bool = True) -> Pattern:
proc_res = _interpret(gst_data, schedule, mode, chainid, usegas)
try:
res = _interpret(gst_data, schedule, mode, chainid, usegas, check)
except CalledProcessError as err:
raise RuntimeError(f'Interpreter failed with status {err.returncode}: {err.stderr}') from err

if check:
proc_res.check_returncode()
if res.stdout == '':
raise RuntimeError(f'Interpreter returned empty stdout: {res.stderr}')

kore = KoreParser(proc_res.stdout).pattern()
return kore
return KoreParser(res.stdout).pattern()


def _interpret(gst_data: Any, schedule: str, mode: str, chainid: int, usegas: bool) -> CompletedProcess:
def _interpret(gst_data: Any, schedule: str, mode: str, chainid: int, usegas: bool, check: bool) -> CompletedProcess:
gst_data_filtered = filter_gst_keys(gst_data)
interpreter = kdist.get('evm-semantics.llvm') / 'interpreter'
init_kore = gst_to_kore(gst_data_filtered, schedule, mode, chainid, usegas)
proc_res = run_process_2([str(interpreter), '/dev/stdin', '-1', '/dev/stdout'], input=init_kore.text, check=False)
return proc_res
return llvm_interpret_raw(kdist.get('evm-semantics.llvm-summary'), init_kore.text, check=check)
23 changes: 20 additions & 3 deletions kevm-pyk/src/kevm_pyk/kdist/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,29 @@ def context(self) -> dict[str, str]:
'syntax_module': 'EDSL',
},
),
'summary': KEVMTarget(
'summarize': KEVMTarget(
{
'target': KompileTarget.HASKELL,
'main_file': config.EVM_SEMANTICS_DIR / 'edsl.md',
'main_module': 'EDSL-SUM',
'syntax_module': 'EDSL-SUM',
'main_module': 'EDSL-SUMMARIZE',
'syntax_module': 'EDSL-SUMMARIZE',
},
),
'llvm-summary': KEVMTarget(
{
'target': KompileTarget.LLVM,
'main_file': config.EVM_SEMANTICS_DIR / 'driver.md',
'main_module': 'ETHEREUM-SIMULATION-SUMMARY',
'syntax_module': 'ETHEREUM-SIMULATION-SUMMARY',
'optimization': 3,
},
),
'haskell-summary': KEVMTarget(
{
'target': KompileTarget.HASKELL,
'main_file': config.EVM_SEMANTICS_DIR / 'edsl.md',
'main_module': 'EDSL-SUMMARY',
'syntax_module': 'EDSL-SUMMARY',
},
),
'haskell-standalone': KEVMTarget(
Expand Down
12 changes: 11 additions & 1 deletion kevm-pyk/src/kevm_pyk/kproj/evm-semantics/driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ requires "evm.md"
requires "optimizations.md"
requires "asm.md"
requires "state-utils.md"
requires "summaries/summary.k"

module ETHEREUM-SIMULATION-SUMMARY
imports ETHEREUM-SIMULATION-PURE
imports SUMMARY
endmodule

module ETHEREUM-SIMULATION
imports EVM
imports ETHEREUM-SIMULATION-PURE
imports EVM-OPTIMIZATIONS
endmodule

module ETHEREUM-SIMULATION-PURE
imports EVM
imports EVM-ASSEMBLY
imports STATE-UTILS
```
Expand Down
8 changes: 7 additions & 1 deletion kevm-pyk/src/kevm_pyk/kproj/evm-semantics/edsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ requires "gas.md"
requires "optimizations.md"
requires "lemmas/lemmas.k"
requires "lemmas/summarization-simplification.k"
requires "summaries/summary.k"

module EDSL-SUM
module EDSL-SUMMARY
imports EDSL-PURE
imports SUMMARY
endmodule

module EDSL-SUMMARIZE
Comment on lines +19 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between these two modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUMMARY is to use the summary rules.
SUMMARIZE is used to generate the summary rules.

imports EDSL-PURE
imports LEMMAS
imports SUMMARIZATION-SIMPLIFICATION
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
requires "../evm.md"
requires "../buf.md"

module SUMMARY-ADD-2-SPEC
imports EVM
imports BUF


rule [BASIC-BLOCK-21-TO-20]: <kevm>
<k>
( #next [ ADD ] ~> .K => .K )
~> K_CELL:K
</k>
<schedule>
SCHEDULE_CELL:Schedule
</schedule>
<useGas>
( USEGAS_CELL:Bool => true )
</useGas>
<ethereum>
<evm>
<callState>
<wordStack>
( ( W0:Int => chop ( ( W0:Int +Int W1:Int ) ) ) : ( ( W1:Int : WS:WordStack ) => WS:WordStack ) )
</wordStack>
<pc>
( PC_CELL:Int => ( PC_CELL:Int +Int 1 ) )
</pc>
<gas>
( ( GAS_CELL:Int => ( GAS_CELL:Int -Int Gverylow < SCHEDULE_CELL:Schedule > ) ) )
</gas>
...
</callState>
...
</evm>
...
</ethereum>
...
</kevm>
requires USEGAS_CELL:Bool andBool ( ( ( Gverylow < SCHEDULE_CELL:Schedule > ) ) ) <=Int GAS_CELL
[priority(20), label(BASIC-BLOCK-21-TO-20)]

rule [BASIC-BLOCK-22-TO-15]: <kevm>
<k>
( #next [ ADD ] ~> .K => .K )
~> K_CELL:K
</k>
<useGas>
( USEGAS_CELL:Bool => false )
</useGas>
<ethereum>
<evm>
<callState>
<wordStack>
( ( W0:Int => chop ( ( W0:Int +Int W1:Int ) ) ) : ( ( W1:Int : WS:WordStack ) => WS:WordStack ) )
</wordStack>
<pc>
( PC_CELL:Int => ( PC_CELL:Int +Int 1 ) )
</pc>
<gas>
( GAS_CELL:Int )
</gas>
...
</callState>
...
</evm>
...
</ethereum>
...
</kevm>
requires ( notBool USEGAS_CELL:Bool )
[priority(20), label(BASIC-BLOCK-22-TO-15)]

endmodule
Loading