Skip to content

Commit 7d098ea

Browse files
committed
fix formatting
1 parent f3ded6b commit 7d098ea

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

Diff for: src/kontrol/foundry.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,8 @@ def cut_point_rules(
129129
break_on_storage: bool,
130130
break_on_basic_blocks: bool,
131131
break_on_load_program: bool,
132-
break_on_access_opcode: bool | None = None,
133132
) -> list[str]:
134-
cut_point_rules = ['FOUNDRY-CHEAT-CODES.rename', 'FOUNDRY-ACCOUNTS.forget']
135-
if break_on_access_opcode:
136-
cut_point_rules.extend(
137-
[
138-
'EVM.call.false',
139-
]
140-
)
141-
return cut_point_rules + KEVMSemantics.cut_point_rules(
133+
return ['FOUNDRY-CHEAT-CODES.rename', 'FOUNDRY-ACCOUNTS.forget'] + KEVMSemantics.cut_point_rules(
142134
break_on_jumpi,
143135
break_on_jump,
144136
break_on_calls,
@@ -397,6 +389,20 @@ def _exec_fetch_account_custom_step(self, subst: Subst, cterm: CTerm, _c: CTermS
397389
new_cterm = self._commit_changes_to_cterm(cterm, new_accounts_cell, continuation, target_address)
398390
return Step(CTerm(new_cterm.config, cterm.constraints), 1, (), ['FETCH_ACCOUNT'], cut=True)
399391

392+
def _update_forked_accounts_cell(self, cterm: CTerm, target_address: KToken) -> KInner:
393+
"""Update the FORKEDACCOUNTS_CELL by adding target_address if it is not already present."""
394+
395+
forked_accounts_cell = cterm.cell('FORKEDACCOUNTS_CELL')
396+
account_set_item = KApply('SetItem', target_address)
397+
if forked_accounts_cell == set_empty():
398+
forked_accounts: list[KInner] = [account_set_item]
399+
else:
400+
forked_accounts = flatten_label('_Set_', forked_accounts_cell)
401+
if account_set_item in forked_accounts:
402+
return forked_accounts_cell
403+
forked_accounts.append(account_set_item)
404+
return build_assoc(KApply('.Set'), '_Set_', forked_accounts)
405+
400406
def _commit_changes_to_cterm(
401407
self, cterm: CTerm, new_accounts_cell: KInner, continuation: KSequence, target_address: KToken
402408
) -> CTerm:
@@ -411,6 +417,7 @@ def _commit_changes_to_cterm(
411417

412418
return updated_cterm
413419

420+
414421
def account_already_forked(target_address: KToken, cterm: CTerm) -> bool:
415422
"""Check if target_address is part of the FORKEDACCOUNTS_CELL of a CTerm."""
416423

@@ -423,6 +430,7 @@ def account_already_forked(target_address: KToken, cterm: CTerm) -> bool:
423430
return True
424431
return False
425432

433+
426434
def add_to_account_storage(account: KApply, slot: KToken, value: KToken) -> KApply:
427435
new_map_item = KApply('_|->_', [slot, value])
428436
acct_id_cell = account.args[0]

Diff for: src/kontrol/prove.py

-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ def create_kcfg_explore() -> KCFGExplore:
442442
options.break_on_storage,
443443
options.break_on_basic_blocks,
444444
options.break_on_load_program,
445-
break_on_access_opcode=(not options.fork_url is None),
446445
)
447446
if options.break_on_cheatcodes:
448447
cut_point_rules.extend(

0 commit comments

Comments
 (0)