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

Integration tests for symbolic constructor #573

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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.282
0.1.283
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kontrol"
version = "0.1.282"
version = "0.1.283"
description = "Foundry integration for KEVM"
authors = [
"Runtime Verification, Inc. <[email protected]>",
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.282'
VERSION: Final = '0.1.283'
2 changes: 2 additions & 0 deletions src/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ def foundry(foundry_root_dir: Path | None, tmp_path_factory: TempPathFactory, wo
str(TEST_DATA_DIR / 'lemmas.k'),
str(TEST_DATA_DIR / 'cse-lemmas.k'),
str(TEST_DATA_DIR / 'pausability-lemmas.k'),
str(TEST_DATA_DIR / 'symbolic-bytes-lemmas.k'),
],
'imports': [
'LoopsTest:SUM-TO-N-INVARIANT',
'ArithmeticCallTest:CSE-LEMMAS',
'CSETest:CSE-LEMMAS',
'PortalTest:PAUSABILITY-LEMMAS',
'ImmutableVarsTest:SYMBOLIC-BYTES-LEMMAS',
],
}
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.13;

import "forge-std/Test.sol";
import "kontrol-cheatcodes/KontrolCheats.sol";

contract ImmutableVarsContract {
uint256 public immutable y;

constructor(uint256 _y) {
y = _y;
}
}

contract ImmutableVarsTest is Test {
function test_run_deployment(uint256 x) public returns (bool) {
ImmutableVarsContract c = new ImmutableVarsContract(x);
assert(c.y() == 85);
}
}
25 changes: 25 additions & 0 deletions src/tests/integration/test-data/symbolic-bytes-lemmas.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
requires "evm.md"
requires "foundry.md"

module SYMBOLIC-BYTES-LEMMAS
imports BOOL
imports FOUNDRY
imports INFINITE-GAS
imports INT-SYMBOLIC

// Byte indexing in terms of #asWord
rule BA [ X ] => #asWord ( #range (BA, X, 1) )
requires X <=Int lengthBytes(BA)
[simplification(40)]

rule [bytes-concat-lookup-left]:
(A:Bytes +Bytes B:Bytes) [I] => A [I]
requires 0 <=Int I andBool I <Int lengthBytes(A)
[simplification, preserves-definedness]

rule [bytes-concat-lookup-right]:
(A:Bytes +Bytes B:Bytes) [I] => B [I -Int lengthBytes(A)]
requires lengthBytes(A) <=Int I
[simplification, preserves-definedness]

endmodule
Loading