-
Notifications
You must be signed in to change notification settings - Fork 3
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
Executing constructor code with CSE enabled #563
Conversation
…all, not test vs non-test
…ification/kontrol into noah/cse-constructors
…ification/kontrol into noah/cse-constructors
…ification/kontrol into noah/cse-constructors
|
…ification/kontrol into noah/cse-constructors
.../integration/test-data/show/ArithmeticCallTest.test_double_add(uint256,uint256).cse.expected
Show resolved
Hide resolved
src/tests/integration/test-data/foundry/test/ConstructorTest.t.sol
Outdated
Show resolved
Hide resolved
src/tests/integration/test-data/show/ConstructorTest.test_contract_call().cse.expected
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a number of comments to resolve/address.
Co-authored-by: Petar Maksimović <PetarMax@users.noreply.github.com>
…ification/kontrol into noah/cse-constructors
…ification/kontrol into noah/cse-constructors
Additions
--config-type [SUMMARY_CONFIG | TEST_CONFIG]
tokontrol prove
to control what mode to create the proof(s) in.SUMMARY_CONFIG
mode is for running functions for CSE summarization andTEST_CONFIG
mode is for running functions as kontrol tests.setUp
functions.TEST_CONFIG
is the default mode. When CSE is enabled, there are recursive calls tofoundry_prove
for called functions. These calls will always be made withconfig_type=SUMMARY_CONFIG
, because the purpose of running proofs for called functions is to create CSE summaries for them.config_type=SUMMARY_CONFIG
will always have KCFG minimization enabled.setUp
functions. Certain fields are still copied from the constructor final state to the new initial state, but the nodes of the constructor KCFG don't appear in the new KCFG. As such, branching constructors are no longer allowed.program
cell when creating a constructor proof, not thecode
cell of any account._update_cterm_from_node
previously assumedFoundry.address_TEST_CONTRACT()
is in the accounts list, which is only the case underTEST_CONFIG
mode.ACCOUNTS_REST
variable. To handle this, we split those members of the account list into cells and non-cells, with non-cells assumed to be variables._update_cterm_from_node
static
cell to false for constructors, because constructors are always associated with contract creation, which is non-static.callData
, we needed an additional pair of lemmas to simplify the generated conditions like:true #Equals b"\xe5\xc1\x9b-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x158" ~> .K ==K b"\xe5\xc1\x9b-" +Bytes #buf ( 32 , chop ( VV0_x_114b9705:Int ) ) ~> .K
to prevent a branch where the wrong function is called.ConstructorTest
which exercises using constructors alongside CSE.ConstructorTest.test_contract_call
is run, using the constructor forConstructorTest
as setup proof, both inTEST_CONFIG
mode, and supported by CSE rules generated by runningImportedContract.add
andImportedContract.set
, each withImportedContract
constructor as setup proof, all inSUMMARY_CONFIG
mode.test_foundry_dependency_automated
, enables--run-constructor
. functions are either run withSUMMARY_CONFIG
orTEST_CONFIG
depending on whether the contract is a "Test" contract.test_contract_call
totest_foundry_dependency_automated
. Re-enablesConstructorTest.run_constructor()
in this test.Further issues
--cse
), for the same reason we already can't have constructors with arguments in top-level/test contracts.