Skip to content

Commit

Permalink
Save number cell from setUp function (#166)
Browse files Browse the repository at this point in the history
* save number cell from setup + test and expected output

* Set Version: 0.1.56

* Update src/tests/integration/test-data/foundry/test/BlockParamsTest.t.sol

* update expected ouptut

---------

Co-authored-by: devops <[email protected]>
  • Loading branch information
anvacaru and devops authored Nov 10, 2023
1 parent c1de293 commit 27ad7e0
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.55
0.1.56
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.55"
version = "0.1.56"
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.55'
VERSION: Final = '0.1.56'
2 changes: 2 additions & 0 deletions src/kontrol/prove.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def _method_to_cfg(
)
for final_node in final_states:
new_accounts_cell = final_node.cterm.cell('ACCOUNTS_CELL')
number_cell = final_node.cterm.cell('NUMBER_CELL')
new_accounts = [CTerm(account, []) for account in flatten_label('_AccountCellMap_', new_accounts_cell)]
new_accounts_map = {account.cell('ACCTID_CELL'): account for account in new_accounts}
test_contract_account = new_accounts_map[Foundry.address_TEST_CONTRACT()]
Expand All @@ -385,6 +386,7 @@ def _method_to_cfg(
new_accounts_cell = KEVM.accounts([account.config for account in new_accounts_map.values()])

new_init_cterm = CTerm(set_cell(init_cterm.config, 'ACCOUNTS_CELL', new_accounts_cell), [])
new_init_cterm = CTerm(set_cell(new_init_cterm.config, 'NUMBER_CELL', number_cell), [])
new_node = cfg.create_node(new_init_cterm)
cfg.create_edge(final_node.id, new_node.id, depth=1)
new_node_ids.append(new_node.id)
Expand Down
201 changes: 200 additions & 1 deletion src/tests/integration/test-data/contracts.k.expected

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/tests/integration/test-data/foundry.k.expected
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module FOUNDRY-MAIN
imports public ScriptBase-VERIFICATION
imports public TestBase-VERIFICATION
imports public BlockParamsTest-VERIFICATION
imports public RollTest-VERIFICATION
imports public BroadcastTest-VERIFICATION
imports public Constants-VERIFICATION
imports public Contract-VERIFICATION
Expand Down Expand Up @@ -183,6 +184,13 @@ module BlockParamsTest-VERIFICATION



endmodule

module RollTest-VERIFICATION
imports public RollTest-CONTRACT



endmodule

module BroadcastTest-VERIFICATION
Expand Down
11 changes: 11 additions & 0 deletions src/tests/integration/test-data/foundry/test/BlockParamsTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,14 @@ contract BlockParamsTest is Test {
assert(x >= 0);
}
}

contract RollTest is Test {
function setUp() external {
vm.roll(123);
}

function test_roll_setup() external {
assert(block.number == 123);

}
}

0 comments on commit 27ad7e0

Please sign in to comment.