-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: TXE single execution env (#9183)
## TXE single execution env Previously, TXE had a weird dual model in which direct calls from test code would "inline" contract code and call it directly. This was very fast, but unfortunately wasn't possible when doing an external call. `test -> env.call(ContractUnderTest.fn) (inlined call) -> ExternalContract::at(addr).fn (nested call inside ACVM or AVM simulator)` This forced us to reproduce the simulator behavior both in Noir and in TXE, leading to bugs and generally terrible UX. The upside is that besides being faster, it also allowed the developer to *NOT* recompile the contract code on every change, only when modifying external contracts that were called from the one under test. Fortunately, recent Brillig improvements allow us to do every single call (including inside tests) as a nested call, which leads to a lot of deduplication and a more consistent UX. Contracts under test now have to *always* be recompiled and deployed, but it is a small price to pay for consistency's sake. ## Public rethrows and proper support for `#[test(should_fail_with="message")]` Previously, the very weird dual model introduced problems when trying to parse errors thrown by public functions, specially when they were nested calls. This is *NO MORE* and we can always use Noir's native system to parse error messages and ensure negative tests fail *properly* ## Call interface rework Since TXE has been simplified, call interfaces don't need the weird `original: fn` field that previously allowed use to call the "macrofied" version of the contract function inline with the test. However, this rework led to the discovery of an issue: return types from call interfaces were incorrectly typed, and were only bound by the compiler when used after the call. This has been fixed by adding a `zeroed` return_value field to the call interfaces (essentially rust's `PhantomData`) so we are able to properly type them and leverage the type system to ensure the values are not only what we expect, but of the type we expect.
- Loading branch information
Showing
40 changed files
with
714 additions
and
929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.