-
Notifications
You must be signed in to change notification settings - Fork 204
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
feat: Implement basic contracts #944
Conversation
Example output of
|
Nice! We can combine these ABIs with method names in a separate PR |
This isn't necessary for this PR but do we potentially want to create a new We would then have something like
|
Sidenote: our |
I'd rather users just referenced the additional modules in their program via |
Yeah I'm not yet sure how to disambiguate. Probably better to do it sooner than later. Maybe something along the lines of 'nargo verify --Ethereum' spits out an eth contract? |
Ah yes that's true, I'd need to think about how this would work in a rust-like import scheme. In solidity each file has explicit path-based imports when pulling in other files so you can enter through any file and just follow the paths to find all of its dependencies whereas it's a little more complex here. That said, I can foresee this being a big point of friction for new devs coming into the discord asking why nargo won't compile their new contract. |
I'm not a fan of overloading the
(Sorry for derailing this PR Jake, we should probably open an issue for this) |
generate-verifier is much better! |
What happens if I run |
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.
Looks good -- some small questions re exclusivity of contracts and regular noir programs.
It may be confusing to allow them to be called just like modules -- I'm not sure. This is not a blocker for this PR and something which may require experience/time
It will try to compile the |
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.
LGTM
Not sure if @TomAFrench had any comments on this, if not we can merge |
Nothing blocking! |
@jfecher we merged another PR which created merge conflicts -- could you resolve these please? |
Related issue(s)
Resolves #943
Description
Adds support for a basic
contract
structure in Noir. Contracts are currently very similar to submodules in that they can contain imports, globals, and functions, although currently these function exactly like normal noir constructs.This PR also adds a
nargo compile --contracts
command for compiling all functions declared in acontract
as if they were a separate main function.Test additions / changes
Adds a
contracts
testChecklist
cargo fmt
with default settings.