Skip to content

Commit 7519a78

Browse files
rv-jenkinsrv-auditoranvacaru
authored
Update dependency: deps/k_release (#2586)
* deps/k_release: Set Version 7.1.112 * kevm-pyk/: sync poetry files pyk version 7.1.112 * flake.{nix,lock}: update Nix derivations * remove deprecated always_check_subsumtion; implement can_make_custom_step * refactor can_make_custom_step * kevm-pyk/: sync poetry files pyk version 7.1.112 --------- Co-authored-by: devops <devops@runtimeverification.com> Co-authored-by: Andrei <16517508+anvacaru@users.noreply.github.com>
1 parent f6496f3 commit 7519a78

File tree

10 files changed

+45
-53
lines changed

10 files changed

+45
-53
lines changed

deps/k_release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.111
1+
7.1.112

flake.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
description = "A flake for the KEVM Semantics";
33

44
inputs = {
5-
k-framework.url = "github:runtimeverification/k/v7.1.111";
5+
k-framework.url = "github:runtimeverification/k/v7.1.112";
66
nixpkgs.follows = "k-framework/nixpkgs";
77
flake-utils.follows = "k-framework/flake-utils";
88
rv-utils.follows = "k-framework/rv-utils";
9-
pyk.url = "github:runtimeverification/k/v7.1.111?dir=pyk";
9+
pyk.url = "github:runtimeverification/k/v7.1.112?dir=pyk";
1010
nixpkgs-pyk.follows = "pyk/nixpkgs";
1111
poetry2nix.follows = "pyk/poetry2nix";
1212
blockchain-k-plugin = {

kevm-pyk/poetry.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kevm-pyk/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
[tool.poetry.dependencies]
1414
python = "^3.10"
1515
pathos = "*"
16-
kframework = "7.1.111"
16+
kframework = "7.1.112"
1717
tomlkit = "^0.11.6"
1818

1919
[tool.poetry.group.dev.dependencies]

kevm-pyk/src/kevm_pyk/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ def create_kcfg_explore() -> KCFGExplore:
357357
),
358358
terminal_rules=KEVMSemantics.terminal_rules(options.break_every_step),
359359
fail_fast=options.fail_fast,
360-
always_check_subsumption=options.always_check_subsumption,
361360
fast_check_subsumption=options.fast_check_subsumption,
362361
direct_subproof_rules=options.direct_subproof_rules,
363362
max_frontier_parallel=options.max_frontier_parallel,

kevm-pyk/src/kevm_pyk/cli.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ def from_option_string() -> dict[str, str]:
375375

376376
class KProveOptions(Options):
377377
debug_equations: list[str]
378-
always_check_subsumption: bool
379378
fast_check_subsumption: bool
380379
direct_subproof_rules: bool
381380
maintenance_rate: int
@@ -385,7 +384,6 @@ class KProveOptions(Options):
385384
def default() -> dict[str, Any]:
386385
return {
387386
'debug_equations': [],
388-
'always_check_subsumption': True,
389387
'fast_check_subsumption': False,
390388
'direct_subproof_rules': False,
391389
'maintenance_rate': 1,
@@ -823,20 +821,6 @@ def kprove_args(self) -> ArgumentParser:
823821
type=list_of(str, delim=','),
824822
help='Comma-separated list of equations to debug.',
825823
)
826-
args.add_argument(
827-
'--always-check-subsumption',
828-
dest='always_check_subsumption',
829-
default=None,
830-
action='store_true',
831-
help='Check subsumption even on non-terminal nodes (default, experimental).',
832-
)
833-
args.add_argument(
834-
'--no-always-check-subsumption',
835-
dest='always_check_subsumption',
836-
default=None,
837-
action='store_false',
838-
help='Do not check subsumption on non-terminal nodes (experimental).',
839-
)
840824
args.add_argument(
841825
'--fast-check-subsumption',
842826
dest='fast_check_subsumption',

kevm-pyk/src/kevm_pyk/kevm.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from pathlib import Path
3939
from typing import Final
4040

41-
from pyk.kast.inner import KAst
41+
from pyk.kast.inner import KAst, Subst
4242
from pyk.kast.outer import KFlatModule
4343
from pyk.kcfg import KCFG
4444
from pyk.kcfg.semantics import KCFGExtendResult
@@ -53,10 +53,12 @@
5353
class KEVMSemantics(KCFGSemantics):
5454
auto_abstract_gas: bool
5555
allow_symbolic_program: bool
56+
_cached_subst: Subst | None
5657

5758
def __init__(self, auto_abstract_gas: bool = False, allow_symbolic_program: bool = False) -> None:
5859
self.auto_abstract_gas = auto_abstract_gas
5960
self.allow_symbolic_program = allow_symbolic_program
61+
self._cached_subst = None
6062

6163
@staticmethod
6264
def is_functional(term: KInner) -> bool:
@@ -155,13 +157,11 @@ def custom_step(self, cterm: CTerm) -> KCFGExtendResult | None:
155157
"""Given a CTerm, update the JUMPDESTS_CELL and PROGRAM_CELL if the rule 'EVM.program.load' is at the top of the K_CELL.
156158
157159
:param cterm: CTerm of a proof node.
158-
:type cterm: CTerm
159160
:return: If the K_CELL matches the load_pattern, a Step with depth 1 is returned together with the new configuration, also registering that the `EVM.program.load` rule has been applied. Otherwise, None is returned.
160-
:rtype: KCFGExtendResult | None
161161
"""
162-
load_pattern = KSequence([KApply('loadProgram', KVariable('###BYTECODE')), KVariable('###CONTINUATION')])
163-
subst = load_pattern.match(cterm.cell('K_CELL'))
164-
if subst is not None:
162+
if self.can_make_custom_step(cterm):
163+
subst = self._cached_subst
164+
assert subst is not None
165165
bytecode_sections = flatten_label('_+Bytes__BYTES-HOOKED_Bytes_Bytes_Bytes', subst['###BYTECODE'])
166166
jumpdests_set = compute_jumpdests(bytecode_sections)
167167
new_cterm = CTerm.from_kast(set_cell(cterm.kast, 'JUMPDESTS_CELL', jumpdests_set))
@@ -213,6 +213,18 @@ def terminal_rules(break_every_step: bool) -> list[str]:
213213
terminal_rules.append('EVM.step')
214214
return terminal_rules
215215

216+
def can_make_custom_step(self, cterm: CTerm) -> bool:
217+
"""Given a CTerm, check if the rule 'EVM.program.load' is at the top of the K_CELL.
218+
219+
This method checks if the `EVM.program.load` rule is at the top of the `K_CELL` in the given `cterm`.
220+
If the rule matches, the resulting substitution is cached in `_cached_subst` for later use in `custom_step`
221+
:param cterm: The CTerm representing the current state of the proof node.
222+
:return: `True` if the pattern matches and a custom step can be made; `False` otherwise.
223+
"""
224+
load_pattern = KSequence([KApply('loadProgram', KVariable('###BYTECODE')), KVariable('###CONTINUATION')])
225+
self._cached_subst = load_pattern.match(cterm.cell('K_CELL'))
226+
return self._cached_subst is not None
227+
216228

217229
class KEVM(KProve, KRun):
218230
_use_hex: bool

kevm-pyk/src/kevm_pyk/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def run_prover(
106106
terminal_rules: Iterable[str] = (),
107107
fail_fast: bool = False,
108108
counterexample_info: bool = False,
109-
always_check_subsumption: bool = False,
110109
fast_check_subsumption: bool = False,
111110
direct_subproof_rules: bool = False,
112111
max_frontier_parallel: int = 1,
@@ -127,7 +126,6 @@ def create_prover() -> APRProver:
127126
terminal_rules=terminal_rules,
128127
cut_point_rules=cut_point_rules,
129128
counterexample_info=counterexample_info,
130-
always_check_subsumption=always_check_subsumption,
131129
fast_check_subsumption=fast_check_subsumption,
132130
direct_subproof_rules=direct_subproof_rules,
133131
assume_defined=assume_defined,

kevm-pyk/src/tests/integration/test_prove.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ def _get_optimization_proofs() -> list[APRProof]:
427427
terminal_rules=[],
428428
cut_point_rules=['EVM.pc.inc', 'EVM.end-basic-block'],
429429
counterexample_info=False,
430-
always_check_subsumption=True,
431430
fast_check_subsumption=True,
432431
)
433432
for proof in _get_optimization_proofs():

0 commit comments

Comments
 (0)