Skip to content

Commit f202a4d

Browse files
authored
pass node_id to custom_step (#2840)
1 parent 46c3791 commit f202a4d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

kevm-pyk/src/kevm_pyk/kevm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
_LOGGER: Final = logging.getLogger(__name__)
5050

51-
CustomStepImpl = Callable[[Subst, CTerm, CTermSymbolic], KCFGExtendResult | None]
51+
CustomStepImpl = Callable[[Subst, CTerm, CTermSymbolic, int], KCFGExtendResult | None]
5252

5353

5454
class CustomStep(NamedTuple):
@@ -60,10 +60,10 @@ class CustomStep(NamedTuple):
6060
def check_pattern_match(self, cterm: CTerm) -> bool:
6161
return self.pattern.match(cterm.cell('K_CELL')) is not None
6262

63-
def try_execute(self, cterm: CTerm, cterm_symbolic: CTermSymbolic) -> KCFGExtendResult | None:
63+
def try_execute(self, cterm: CTerm, cterm_symbolic: CTermSymbolic, node_id: int) -> KCFGExtendResult | None:
6464
subst = self.pattern.match(cterm.cell('K_CELL'))
6565
if subst is not None:
66-
return self.exec_fn(subst, cterm, cterm_symbolic)
66+
return self.exec_fn(subst, cterm, cterm_symbolic, node_id)
6767
return None
6868

6969

@@ -177,7 +177,7 @@ def _replace(term: KInner) -> KInner:
177177

178178
def custom_step(self, cterm: CTerm, cterm_symbolic: CTermSymbolic, node_id: int) -> KCFGExtendResult | None:
179179
for c_step in self._custom_steps:
180-
result = c_step.try_execute(cterm, cterm_symbolic)
180+
result = c_step.try_execute(cterm, cterm_symbolic, node_id)
181181
if result is not None:
182182
return result
183183
return None
@@ -234,7 +234,7 @@ def terminal_rules(break_every_step: bool) -> list[str]:
234234
def _load_pattern(self) -> KSequence:
235235
return KSequence([KApply('loadProgram', KVariable('###BYTECODE')), KVariable('###CONTINUATION')])
236236

237-
def _exec_load_custom_step(self, subst: Subst, cterm: CTerm, _c: CTermSymbolic) -> KCFGExtendResult:
237+
def _exec_load_custom_step(self, subst: Subst, cterm: CTerm, _c: CTermSymbolic, _node_id: int) -> KCFGExtendResult:
238238
"""Given a CTerm, update the JUMPDESTS_CELL and PROGRAM_CELL if the rule 'EVM.program.load' is at the top of the K_CELL.
239239
240240
:param cterm: CTerm of a proof node.

0 commit comments

Comments
 (0)