Skip to content
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

[WIP] Calldata generation for bytes, bytes[] parameters #303

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
93fd80f
Add `symbolicCallData`, `assumeBytesLength` cheats
palinatolmach Dec 1, 2023
f8fa53f
Set Version: 0.1.78
Dec 1, 2023
14db31f
WIP: use dynamic array in ABI calldata for `bytes`
palinatolmach Dec 1, 2023
56ce5e8
Merge branch 'master' into symbolic-calldata
PetarMax Dec 5, 2023
dba45bf
Set Version: 0.1.83
Dec 5, 2023
6c81fea
WIP: use `abi_symbolic_calldata` in calldata cell
palinatolmach Dec 6, 2023
bd58294
Set Version: 0.1.84
Dec 6, 2023
9825ae7
Experimental: `bytes` assumptions
palinatolmach Dec 6, 2023
c6e43fe
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 6, 2023
ae3740e
Set Version: 0.1.84
Dec 6, 2023
2ddb50f
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 7, 2023
c4b37d9
Set Version: 0.1.86
Dec 7, 2023
a425c9a
Fix in escaping in dynamic array names
palinatolmach Dec 7, 2023
bfc32b8
WIP: make calldata symbolic iff it has dyn types
palinatolmach Dec 8, 2023
07eb6b7
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 8, 2023
91fecd3
Set Version: 0.1.88
Dec 8, 2023
6a5785b
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 8, 2023
61e5cad
Set Version: 0.1.89
Dec 8, 2023
c8d09b8
Make CD symbolic if any input has dynamic types
palinatolmach Dec 8, 2023
1c13c20
Handle dynamic arrays of types other than `bytes`
palinatolmach Dec 10, 2023
1441750
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 10, 2023
35a89fa
Set Version: 0.1.91
Dec 10, 2023
765e815
WIP: temp poetry change, manual assumptions on CD
palinatolmach Dec 11, 2023
8531aa3
Set Version: 0.1.92
Dec 11, 2023
fe7d23d
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 11, 2023
ad30492
Format assumptions on CD
palinatolmach Dec 11, 2023
b8c68fe
add suport for kevm nogas
anvacaru Dec 12, 2023
0ba7b82
hardcode use-gas for profiling
anvacaru Dec 12, 2023
edae5e6
test
anvacaru Dec 12, 2023
a590d05
WIP: hardcode constraints for symbolic CD test
palinatolmach Dec 14, 2023
a82ac3e
WIP: hardcode the first offset to `224`
palinatolmach Dec 14, 2023
5fc1f89
renaming use-gas related variables
PetarMax Dec 15, 2023
377ba45
Set Version: 0.1.100
Dec 15, 2023
dc486c2
merge with master
PetarMax Dec 17, 2023
40d31dd
Set Version: 0.1.101
Dec 17, 2023
b10c434
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 18, 2023
7242b4a
Set Version: 0.1.101
Dec 18, 2023
942cf05
WIP: hardcode calldata length constraints
palinatolmach Dec 19, 2023
89b6518
set kevm version tag
anvacaru Dec 20, 2023
9210417
remove space
anvacaru Dec 20, 2023
4214f09
set use_gas to false by default
anvacaru Dec 20, 2023
06f1f79
Revert "hardcode use-gas for profiling"
anvacaru Dec 20, 2023
ec3fc71
WIP: hardcode range constraints for test arguments
palinatolmach Dec 21, 2023
77816c0
Set Version: 0.1.102
Dec 21, 2023
3114a8e
REVERT: use `symbolic-calldata` branch in KEVM
palinatolmach Dec 21, 2023
d88bb39
Merge branch 'master' into symbolic-calldata
palinatolmach Dec 21, 2023
c4ab4bf
Set Version: 0.1.102
Dec 21, 2023
9f32027
Merge branch 'master' into kevm-no-gas
anvacaru Dec 21, 2023
3757229
Set Version: 0.1.103
Dec 21, 2023
92909c1
remove duplicated substitution
anvacaru Dec 21, 2023
9712d1b
update expected output
anvacaru Dec 21, 2023
23ca4c3
use gas for GasTests
anvacaru Dec 22, 2023
7d93549
Merge branch 'kevm-no-gas' into symbolic-calldata
palinatolmach Dec 22, 2023
420ac95
Move manual assumption building to functions, fmt
palinatolmach Dec 22, 2023
cfd42ac
Add assumptions for symbolic `bytes data` length
palinatolmach Dec 22, 2023
de1484f
Use assumptions for structured calldata by default
palinatolmach Dec 22, 2023
8c6f880
Update dependency: deps/kevm_release (#256)
rv-jenkins Dec 22, 2023
ddd45ea
Update dependency: deps/kevm_release (#256)
rv-jenkins Dec 22, 2023
5020a34
merge with master
PetarMax Dec 27, 2023
20adf54
Set Version: 0.1.104
Dec 27, 2023
c377393
adding constraint on bytes length
PetarMax Dec 30, 2023
bcd315e
setting length to 1Gb
PetarMax Dec 30, 2023
81c7036
Update `poetry.lock`
palinatolmach Jan 10, 2024
e6752db
adding definedness preservation
PetarMax Jan 14, 2024
08dceed
preserving definedness
PetarMax Jan 14, 2024
fe2ee25
Merge branch 'master' into symbolic-calldata
palinatolmach Jan 15, 2024
64f7a64
Set Version: 0.1.112
Jan 15, 2024
8066e5e
merge with master
PetarMax Jan 16, 2024
703c1f5
Set Version: 0.1.118
Jan 16, 2024
9d4e395
Merge branch 'master' into symbolic-calldata
palinatolmach Jan 17, 2024
0266425
Set Version: 0.1.119
Jan 17, 2024
2d7838d
Merge branch 'master' into symbolic-calldata
palinatolmach Jan 20, 2024
f3710be
Set Version: 0.1.123
Jan 20, 2024
7ce1022
Minor cleanup: removed unused assumptions, cheatcodes
palinatolmach Jan 20, 2024
458da13
Auto-generate syntactic sugar rules for functions with `bytes[]` args
palinatolmach Jan 21, 2024
4dce12e
Parse NatSpec `@custom:length`, `@custom:element-length` comments w/a…
palinatolmach Jan 22, 2024
03a5f2a
Point to `symbolic-calldata-gen` branch of KEVM
palinatolmach Jan 22, 2024
8815a73
Cleanup in `prove.py`: removed hardcoded symbolic calldata assumptions
palinatolmach Jan 22, 2024
2679e79
Minor cleanup, change upper bound for `bytes` variables
palinatolmach Jan 22, 2024
1f0aab8
Minor cleanup, removed unused statements
palinatolmach Jan 22, 2024
d983c01
Merge branch 'master' into symbolic-calldata-gen
PetarMax Jan 23, 2024
a5993ae
Set Version: 0.1.128
Jan 23, 2024
d667c60
Adapt to tuple encoding in kevm
anvacaru Jan 24, 2024
fe768cc
save draft with general approach for dynamic bytes
anvacaru Jan 29, 2024
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 package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.127
0.1.128
6 changes: 3 additions & 3 deletions poetry.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kontrol"
version = "0.1.127"
version = "0.1.128"
description = "Foundry integration for KEVM"
authors = [
"Runtime Verification, Inc. <[email protected]>",
]

[tool.poetry.dependencies]
python = "^3.10"
kevm-pyk = { git = "https://github.com/runtimeverification/evm-semantics.git", tag = "v1.0.427", subdirectory = "kevm-pyk" }
kevm-pyk = { git = "https://github.com/runtimeverification/evm-semantics.git", branch = "dynamic-tuple", subdirectory = "kevm-pyk" }

[tool.poetry.group.dev.dependencies]
autoflake = "*"
Expand Down
2 changes: 1 addition & 1 deletion src/kontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '0.1.127'
VERSION: Final = '0.1.128'
2 changes: 1 addition & 1 deletion src/kontrol/foundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def custom_view(self, contract_name: str, element: KCFGElem) -> Iterable[str]:

def build(self) -> None:
try:
run_process(['forge', 'build', '--root', str(self._root)], logger=_LOGGER)
run_process(['forge', 'build', '--root', str(self._root), '--extra-output', 'devdoc'], logger=_LOGGER)
except FileNotFoundError:
print("Error: 'forge' command not found. Please ensure that 'forge' is installed and added to your PATH.")
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions src/kontrol/kdist/cheatcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ The `<output>` cell will be updated with the value of the address generated from
<k> #call_foundry SELECTOR ARGS => . ... </k>
<output> _ => #bufStrict(32, #addrFromPrivateKey(#unparseDataBytes(ARGS))) </output>
requires SELECTOR ==Int selector ( "addr(uint256)" )
[preserves-definedness]
```

#### `load` - Loads a storage slot from an address.
Expand Down Expand Up @@ -896,6 +897,7 @@ The `ECDSASign` function returns the signed data in [r,s,v] form, which we conve
<k> #call_foundry SELECTOR ARGS => . ... </k>
<output> _ => #sign(#range(ARGS, 32, 32),#range(ARGS,0,32)) </output>
requires SELECTOR ==Int selector ( "sign(uint256,bytes32)" )
[preserves-definedness]
```

Otherwise, throw an error for any other call to the Foundry contract.
Expand Down Expand Up @@ -943,6 +945,7 @@ Utils
<code> _ => #if #asWord(CODE) ==Int 0 #then .Bytes #else CODE #fi </code>
...
</account>
[preserves-definedness]
```

- `#returnNonce ACCTID` takes the nonce of a given account and places it on the `<output>` cell.
Expand Down Expand Up @@ -997,6 +1000,7 @@ Utils
<storage> STORAGE => STORAGE [ LOC <- VALUE ] </storage>
...
</account>
[preserves-definedness]
```

`#setSymbolicStorage ACCTID` takes a given account and makes its storage fully symbolic.
Expand Down
4 changes: 4 additions & 0 deletions src/kontrol/prove.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ def _update_cterm_from_node(cterm: CTerm, node: KCFG.Node, contract_name: str) -
new_init_cterm = CTerm(set_cell(new_init_cterm.config, 'GAS_CELL', gas_cell), [])
new_init_cterm = CTerm(set_cell(new_init_cterm.config, 'CALLGAS_CELL', callgas_cell), [])

# adding constraints from the initial cterm
for constraint in cterm.constraints:
new_init_cterm = new_init_cterm.add_constraint(constraint)

return new_init_cterm


Expand Down
Loading