Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
rv-jenkins committed Nov 27, 2024
2 parents d0f4a79 + 853ef88 commit ac7913a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/kontrol/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ def parse(s: str) -> list[T]:
default=None,
dest='optimize_performance',
help=(
'Optimize performance for proof execution. Takes the number of parallel threads to be used.'
"Will overwrite other settings of 'assume-defined', 'log-success-rewrites', 'max-frontier-parallel',"
'Optimize performance for proof execution. Takes the number of parallel threads to be used. '
"Will overwrite other settings of 'assume-defined', 'log-success-rewrites', 'max-frontier-parallel', "
"'maintenance-rate', 'smt-timeout', 'smt-retry-limit', 'max-depth', 'max-iterations', and 'no-stack-checks'."
),
)
Expand All @@ -584,7 +584,7 @@ def parse(s: str) -> list[T]:
default=None,
action='store_false',
help=(
'Optimize KEVM execution by removing stack overflow/underflow checks.'
'Optimize KEVM execution by removing stack overflow/underflow checks. '
'Assumes running Solidity-compiled bytecode cannot result in a stack overflow/underflow.'
),
)
Expand Down
26 changes: 26 additions & 0 deletions src/kontrol/kdist/no_code_size_checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Relaxed Bytecode Limits Rules
===================

The provided rule disables the enforcement of the code size limit introduced in EIP-170 during contract deployment.
That enables the deployment of larger test contracts containing auxiliary functions for verification and testing.
In addition, it enhances compatibility with Foundry, which also does not enforce the code size limit.

```k
requires "foundry.md"
module NO-CODE-SIZE-CHECKS
imports EVM
imports FOUNDRY
rule <k> #mkCodeDeposit ACCT
=> Gcodedeposit < SCHED > *Int lengthBytes(OUT) ~> #deductGas
~> #finishCodeDeposit ACCT OUT
...
</k>
<schedule> SCHED </schedule>
<output> OUT => .Bytes </output>
requires #isValidCode(OUT, SCHED)
[priority(30)]
endmodule
```
4 changes: 4 additions & 0 deletions src/kontrol/kompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ def foundry_kompile(
regen = True
foundry_up_to_date = False

options.requires = [str(foundry._root / r) for r in options.requires]

requires = (
options.requires
+ ([KSRC_DIR / 'keccak.md'] if options.keccak_lemmas else [])
+ ([KSRC_DIR / 'kontrol_lemmas.md'] if options.auxiliary_lemmas else [])
+ ([KSRC_DIR / 'no_stack_checks.md'])
+ ([KSRC_DIR / 'no_code_size_checks.md'])
)
for r in tuple(requires):
req = Path(r)
Expand Down Expand Up @@ -229,6 +232,7 @@ def _foundry_to_main_def(
+ ([KImport('KECCAK-LEMMAS')] if keccak_lemmas else [])
+ ([KImport('KONTROL-AUX-LEMMAS')] if auxiliary_lemmas else [])
+ ([KImport('NO-STACK-CHECKS')])
+ ([KImport('NO-CODE-SIZE-CHECKS')])
),
)

Expand Down
2 changes: 2 additions & 0 deletions src/tests/integration/test-data/show/foundry.k.expected
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ requires "requires/pausability-lemmas.k"
requires "requires/symbolic-bytes-lemmas.k"
requires "requires/keccak.md"
requires "requires/no_stack_checks.md"
requires "requires/no_code_size_checks.md"

module FOUNDRY-MAIN
imports public S2KsrcZModduplicatesZMod2ZModDuplicateName-VERIFICATION
Expand Down Expand Up @@ -173,6 +174,7 @@ module FOUNDRY-MAIN
imports public S2KlibZModforgeZSubstdZModlibZModdsZSubtestZModsrcZModDSTest-VERIFICATION
imports public KECCAK-LEMMAS
imports public NO-STACK-CHECKS
imports public NO-CODE-SIZE-CHECKS



Expand Down

0 comments on commit ac7913a

Please sign in to comment.