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

Bump version of forge-std and kontrol-cheatcodes in integration suite #906

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ jobs:
docker exec ${CONTAINER_NAME} chown -R ${DOCKER_USER}:${DOCKER_GROUP} ${FOUNDRY_ROOT}
- name: 'Run forge build'
run: |
docker exec --user ${DOCKER_USER} --workdir ${FOUNDRY_ROOT} ${CONTAINER_NAME} forge install --no-git foundry-rs/forge-std@75f1746
docker exec --user ${DOCKER_USER} --workdir ${FOUNDRY_ROOT} ${CONTAINER_NAME} forge install --no-git runtimeverification/kontrol-cheatcodes@a5dd4b0
docker exec --user ${DOCKER_USER} --workdir ${FOUNDRY_ROOT} ${CONTAINER_NAME} forge install --no-git foundry-rs/forge-std@051fb65
docker exec --user ${DOCKER_USER} --workdir ${FOUNDRY_ROOT} ${CONTAINER_NAME} forge install --no-git runtimeverification/kontrol-cheatcodes@c2bdec7
docker exec --user ${DOCKER_USER} --workdir ${FOUNDRY_ROOT} ${CONTAINER_NAME} forge build
- name: 'Run kontrol build'
run: docker exec --user ${DOCKER_USER} --workdir ${FOUNDRY_ROOT} ${CONTAINER_NAME} kontrol build -O2
Expand Down
4 changes: 2 additions & 2 deletions src/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from pytest import TempPathFactory


FORGE_STD_REF: Final = '75f1746'
KONTROL_CHEATCODES_REF: Final = 'a5dd4b0'
FORGE_STD_REF: Final = '051fb65'
KONTROL_CHEATCODES_REF: Final = 'c2bdec7'


@pytest.fixture
Expand Down
34 changes: 5 additions & 29 deletions src/tests/integration/test-data/foundry-prove-all
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@ AccountParamsTest.testDealConcrete()
AccountParamsTest.testDealSymbolic(uint256)
AccountParamsTest.testEtchConcrete()
AccountParamsTest.testEtchSymbolic(bytes)
AccountParamsTest.testFail_GetNonce_false()
AccountParamsTest.testFail_GetNonce_true()
AccountParamsTest.test_GetNonce_false()
AccountParamsTest.test_GetNonce_true()
AccountParamsTest.test_getNonce_unknownSymbolic(address)
AccountParamsTest.test_Nonce_ExistentAddress()
AccountParamsTest.test_Nonce_NonExistentAddress()
AccountParamsTest.testNonce()
AccountParamsTest.testNonceSymbolic(uint64)
AddrTest.test_addr_false()
AddrTest.test_addr_symbolic(uint256)
AddrTest.test_addr_true()
AddrTest.test_builtInAddresses()
AddrTest.testFail_addr_false()
AddrTest.testFail_addr_true()
AddrTest.test_notBuiltinAddress_concrete()
AddrTest.test_notBuiltinAddress_symbolic(address)
AddrTest.test_notBuiltinAddress(address)
AllowChangesTest.test()
AllowChangesTest.testAllow()
AllowChangesTest.testAllowSymbolic()
Expand Down Expand Up @@ -57,25 +48,18 @@ AssumeTest.testFail_assume_false(uint256,uint256)
AssumeTest.testFail_assume_true(uint256,uint256)
AssumeTest.test_multi_assume(address,address)
BlockParamsTest.testBlockNumber()
BlockParamsTest.testChainId(uint256)
BlockParamsTest.testCoinBase()
BlockParamsTest.testFee(uint256)
BlockParamsTest.testRoll(uint256)
BlockParamsTest.testWarp(uint256)
BlockParamsTest.test_block_params(uint256,uint256,uint256,uint256,address)
BroadcastTest.testDeploy()
BytesTypeTest.test_bytes32(bytes32)
BytesTypeTest.test_bytes32_fail(bytes32)
BytesTypeTest.test_bytes4(bytes4)
BytesTypeTest.test_bytes4_fail(bytes4)
BytesTypeTest.testFail_bytes32(bytes32)
BytesTypeTest.testFail_bytes4(bytes4)
ChainIdTest.test_chainid_setup()
CoinBaseTest.test_coinbase_setup()
ConstructorTest.run_constructor()
ContractBTest.testCannotSubtract43()
ContractBTest.testFailSubtract43()
ContractBTest.testNumberIs42()
ContractTest.testExample()
CopyStorageTest.testCopyStorage()
CounterTest.testIncrement()
CounterTest.testSetNumber(uint256)
Expand Down Expand Up @@ -115,7 +99,6 @@ ExpectRevertTest.testFail_ExpectRevert_failAndSuccess()
ExpectRevertTest.testFail_expectRevert_false()
ExpectRevertTest.testFail_expectRevert_multipleReverts()
ExternalLibTest.testSquare(uint256)
FeeTest.test_fee_setup()
FfiTest.testffi()
FfiTest.testFFIFOO()
FfiTest.testFFIScript()
Expand Down Expand Up @@ -192,30 +175,24 @@ NestedStructsTest.prove_fourfold_nested_struct(((((uint8,uint256),bytes32)[],byt
OwnerUpOnlyTest.testFailIncrementAsNotOwner()
OwnerUpOnlyTest.testIncrementAsNotOwner()
OwnerUpOnlyTest.testIncrementAsOwner()
PlainPrankTest.testFail_startPrank_existingAlready()
PlainPrankTest.testFail_startPrank_internalCall()
PlainPrankTest.test_prank_zeroAddress_true()
PlainPrankTest.test_startPrank_true()
PlainPrankTest.test_startPrankWithOrigin_true()
PlainPrankTest.test_startPrank_zeroAddress_true()
PlainPrankTest.test_stopPrank_notExistent()
PlainPrankTest.test_prank_expectRevert()
PortalTest.test_withdrawal_paused((uint256,address,address,uint256,uint256,bytes),uint256,(bytes32,bytes32,bytes32,bytes32),bytes[])
PrankTest.testAddAsOwner(uint256)
PrankTest.testAddStartPrank(uint256)
PrankTest.testFailAddPrank(uint256)
PrankTest.testSubtractAsTxOrigin(uint256,uint256)
PrankTest.testSubtractFail(uint256)
PrankTest.testSubtractStartPrank(uint256,uint256)
PrankTestMsgSender.test_msgsender_setup()
PrankTestOrigin.test_origin_setup()
RecordLogsTest.testRecordLogs()
RollTest.test_roll_setup()
SafeTest.testWithdraw()
SafeTest.testWithdrawFuzz(uint96)
Setup2Test.testFail_setup()
Setup2Test.test_setup()
SetUpDeployTest.test_extcodesize()
SetUpTest.testFail_setup()
SetUpTest.test_setup()
SetUpTest.testSetUpCalled()
SetUpTest.testSetUpCalledSymbolic(uint256)
SetUpTest.testSetupData()
Expand Down Expand Up @@ -349,7 +326,6 @@ IntTypeTest.test_uint256_fail(uint256)
IntTypeTest.test_uint64(uint64)
IntTypeTest.test_uint64_fail(uint64)
StructTypeTest.test_vars((uint8,uint32,bytes32))
WarpTest.test_warp_setup()
FreshBytesTest.test_symbolic_bytes_1
FreshBytesTest.test_symbolic_bytes_3
FreshBytesTest.test_symbolic_bytes_length
17 changes: 4 additions & 13 deletions src/tests/integration/test-data/foundry-prove-skip
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
AccountParamsTest.testDealConcrete()
AccountParamsTest.testEtchConcrete()
AccountParamsTest.testEtchSymbolic(bytes)
AccountParamsTest.testFail_GetNonce_false()
AccountParamsTest.test_GetNonce_false()
AddrTest.test_addr_true()
AddrTest.test_addr_false()
AddrTest.test_addr_symbolic(uint256)
AddrTest.testFail_addr_false()
AddrTest.testFail_addr_true()
AddrTest.test_addr_true()
AllowChangesTest.test()
AllowChangesTest.testAllow_fail()
ArithmeticCallTest.test_double_add(uint256,uint256)
Expand All @@ -31,7 +27,7 @@ AssertTest.test_failing_branch(uint256)
AssertTest.test_revert_branch(uint256,uint256)
AssumeTest.test_assume_false(uint256,uint256)
AssumeTest.testFail_assume_false(uint256,uint256)
BlockParamsTest.testWarp(uint256)
BlockParamsTest.testBlockNumber()
BroadcastTest.testDeploy()
BytesTypeTest.test_bytes32_fail(bytes32)
BytesTypeTest.test_bytes4_fail(bytes4)
Expand All @@ -40,7 +36,6 @@ BytesTypeTest.testFail_bytes4(bytes4)
ContractBTest.testCannotSubtract43()
ContractBTest.testFailSubtract43()
ContractBTest.testNumberIs42()
ContractTest.testExample()
DynamicTypesTest.test_complex_type_array((uint256,bytes)[],bytes[],uint256)
DynamicTypesTest.test_dynamic_byte_read(bytes,uint256)
EnvTest.testEnvAddress()
Expand All @@ -58,6 +53,7 @@ EnvTest.testEnvStringArray()
EnvTest.testEnvUInt()
EnvTest.testEnvUIntArray()
ExpectRevertTest.test_expectRevert_encodedSymbolic(address)
ExpectRevertTest.test_expectRevert_returnValue()
ExpectRevertTest.test_expectRevert_internalCall()
FfiTest.testffi()
FfiTest.testFFIFOO()
Expand Down Expand Up @@ -115,12 +111,7 @@ MockCallRevertTest.testMockCallEmptyAccount()
OwnerUpOnlyTest.testFailIncrementAsNotOwner()
OwnerUpOnlyTest.testIncrementAsNotOwner()
OwnerUpOnlyTest.testIncrementAsOwner()
PlainPrankTest.testFail_startPrank_existingAlready()
PrankTest.testAddAsOwner(uint256)
PrankTest.testAddStartPrank(uint256)
PrankTest.testFailAddPrank(uint256)
PrankTest.testSubtractAsTxOrigin(uint256,uint256)
PrankTest.testSubtractFail(uint256)
PrankTest.testSubtractStartPrank(uint256,uint256)
RecordLogsTest.testRecordLogs()
SafeTest.testWithdraw()
Expand Down
33 changes: 7 additions & 26 deletions src/tests/integration/test-data/foundry-prove-skip-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ AccountParamsTest.testDealConcrete()
AccountParamsTest.testDealSymbolic(uint256)
AccountParamsTest.testEtchConcrete()
AccountParamsTest.testEtchSymbolic(bytes)
AccountParamsTest.testFail_GetNonce_false()
AccountParamsTest.testFail_GetNonce_true()
AccountParamsTest.test_GetNonce_false()
AccountParamsTest.test_GetNonce_true()
AccountParamsTest.test_getNonce_unknownSymbolic(address)
AccountParamsTest.test_Nonce_ExistentAddress()
AccountParamsTest.test_Nonce_NonExistentAddress()
AccountParamsTest.testNonce()
AccountParamsTest.testNonceSymbolic(uint64)
AddrTest.test_addr_false()
AddrTest.test_addr_symbolic(uint256)
AddrTest.test_addr_true()
AddrTest.testFail_addr_false()
AddrTest.testFail_addr_true()
AddrTest.test_notBuiltinAddress_symbolic(address)
AddrTest.test_builtInAddresses()
AddrTest.test_notBuiltinAddress(address)
AllowChangesTest.test()
AllowChangesTest.testAllow()
AllowChangesTest.testAllowSymbolic()
Expand Down Expand Up @@ -51,22 +44,18 @@ AssumeTest.test_assume_true(uint256,uint256)
AssumeTest.testFail_assume_false(uint256,uint256)
AssumeTest.testFail_assume_true(uint256,uint256)
AssumeTest.test_multi_assume(address,address)
BlockParamsTest.testChainId(uint256)
BlockParamsTest.testFee(uint256)
BlockParamsTest.testWarp(uint256)
BlockParamsTest.testBlockNumber()
BlockParamsTest.test_block_params(uint256,uint256,uint256,uint256,address)
BMCLoopsTest.test_countdown_concrete()
BMCLoopsTest.test_countdown_symbolic(uint256)
BroadcastTest.testDeploy()
BytesTypeTest.test_bytes32_fail(bytes32)
BytesTypeTest.test_bytes4_fail(bytes4)
BytesTypeTest.testFail_bytes32(bytes32)
BytesTypeTest.testFail_bytes4(bytes4)
ChainIdTest.test_chainid_setup()
CoinBaseTest.test_coinbase_setup()
ContractBTest.testCannotSubtract43()
ContractBTest.testFailSubtract43()
ContractBTest.testNumberIs42()
ContractTest.testExample()
CounterTest.testIncrement()
CounterTest.testSetNumber(uint256)
DynamicTypesTest.test_complex_type((uint256,bytes),bytes[])
Expand Down Expand Up @@ -103,7 +92,6 @@ ExpectRevertTest.testFail_ExpectRevert_failAndSuccess()
ExpectRevertTest.testFail_expectRevert_false()
ExpectRevertTest.testFail_expectRevert_multipleReverts()
ExternalLibTest.testSquare(uint256)
FeeTest.test_fee_setup()
FfiTest.testffi()
FfiTest.testFFIFOO()
FfiTest.testFFIScript()
Expand Down Expand Up @@ -190,27 +178,21 @@ OwnerUpOnlyTest.testIncrementAsNotOwner()
OwnerUpOnlyTest.testIncrementAsOwner()
PlainPrankTest.testFail_startPrank_existingAlready()
PlainPrankTest.testFail_startPrank_internalCall()
PlainPrankTest.test_prank_expectRevert()
PlainPrankTest.test_prank_zeroAddress_true()
PlainPrankTest.test_startPrank_consecutive()
PlainPrankTest.test_startPrank_true()
PlainPrankTest.test_startPrankWithOrigin_true()
PlainPrankTest.test_startPrank_zeroAddress_true()
PortalTest.test_withdrawal_paused((uint256,address,address,uint256,uint256,bytes),uint256,(bytes32,bytes32,bytes32,bytes32),bytes[])
PrankTestMsgSender.test_msgsender_setup()
PrankTestOrigin.test_origin_setup()
PrankTest.testAddAsOwner(uint256)
PrankTest.testAddStartPrank(uint256)
PrankTest.testFailAddPrank(uint256)
PrankTest.testSubtractAsTxOrigin(uint256,uint256)
PrankTest.testSubtractFail(uint256)
PrankTest.testSubtractStartPrank(uint256,uint256)
RecordLogsTest.testRecordLogs()
RollTest.test_roll_setup()
SafeTest.testWithdraw()
SafeTest.testWithdrawFuzz(uint96)
Setup2Test.testFail_setup()
Setup2Test.test_setup()
SetUpTest.testFail_setup()
SetUpTest.test_setup()
SetUpDeployTest.test_extcodesize()
SetUpTest.testSetUpCalled()
SetUpTest.testSetUpCalledSymbolic(uint256)
Expand Down Expand Up @@ -336,4 +318,3 @@ FreshBytesTest.test_symbolic_bytes_1
FreshBytesTest.test_symbolic_bytes_2
FreshBytesTest.test_symbolic_bytes_3
FreshBytesTest.test_symbolic_bytes_length
WarpTest.test_warp_setup()
2 changes: 1 addition & 1 deletion src/tests/integration/test-data/foundry-trace-all
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
AccountParamsTest.testDealConcrete(),true,true,true
AddrTest.test_addr_true(),true,false,true
BlockParamsTest.testWarp(uint256),false,false,false
BlockParamsTest.testBlockNumber(),false,false,false
2 changes: 1 addition & 1 deletion src/tests/integration/test-data/foundry/src/Branches.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity =0.8.13;

// CSE challenge: multiple branches that slow down the verification
contract Branches{
function applyOp(uint256 x, uint256 y, bool z) public returns (uint256) {
function applyOp(uint256 x, uint256 y, bool z) public pure returns (uint256) {
if (z) {
return x + y;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ contract RecordedCounter is Test {
counter2.setNumber(2);
vm.deal(address(counter1), 1 ether);
vm.deal(address(counter2), 2 ether);
// Commented since we're running an old forge-std version (v1.6.0)
// vm.dumpState(dumpStateFile);
vm.dumpState(dumpStateFile);
}
}
}
6 changes: 3 additions & 3 deletions src/tests/integration/test-data/foundry/src/Portal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ contract Portal {
/// @notice Proves a withdrawal transaction.
function proveWithdrawalTransaction(
Types.WithdrawalTransaction memory _tx,
uint256 _l2OutputIndex,
Types.OutputRootProof calldata _outputRootProof,
bytes[] calldata _withdrawalProof
uint256,
Types.OutputRootProof calldata,
bytes[] calldata
)
external
whenNotPaused
Expand Down
7 changes: 7 additions & 0 deletions src/tests/integration/test-data/foundry/src/StoreContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.13;

contract StoreContract {
uint256 private testNumber = 1337; // slot 0
constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,51 +26,28 @@ contract AccountParamsTest is Test {
assertEq(address(124).code, code);
}

function testNonce() public {
vm.setNonce(address(this), 100);
vm.setNonce(address(100), 100);
uint64 nonce = vm.getNonce(address(this));
assert(nonce == 100);
nonce = vm.getNonce(address(100));
assert(nonce == 100);
}

function testNonceSymbolic(uint64 newNonce) public {
uint64 oldNonce = vm.getNonce(address(this));
vm.assume(newNonce > oldNonce);
vm.setNonce(address(this), newNonce);
assert(vm.getNonce(address(this)) == newNonce);
}

function test_GetNonce_true() public {
uint64 nonce = vm.getNonce(address(this));
assert(nonce == 1);
}

function test_getNonce_unknownSymbolic(address addr) public {
function test_getNonce_unknownSymbolic(address addr) public view {
vm.assume(addr != address(vm));
vm.assume(addr != address(this));
vm.assume(addr != address(0x3fAB184622Dc19b6109349B94811493BF2a45362));
vm.assume(addr != address(0x4e59b44847b379578588920cA78FbF26c0B4956C));
uint64 nonce = vm.getNonce(addr);
assert(nonce == 0);
}

function test_GetNonce_false() public {
uint64 nonce = vm.getNonce(address(100));
assertEq(nonce, 10);
}

function testFail_GetNonce_true() public {
uint64 nonce = vm.getNonce(address(0));
assertEq(nonce, 10);
}

function testFail_GetNonce_false() public {
uint64 nonce = vm.getNonce(address(this));
assertEq(nonce, 1);
}

function test_Nonce_ExistentAddress() public {
vm.setNonce(address(this), 100);
uint64 nonce = vm.getNonce(address(this));
assert(nonce == 100);
}

function test_Nonce_NonExistentAddress() public {
vm.setNonce(address(100), 100);
uint64 nonce = vm.getNonce(address(100));
assert(nonce == 100);
}
}
Loading
Loading