-
Notifications
You must be signed in to change notification settings - Fork 296
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: internal keyword + lending contract and tests #978
Merged
+1,813
−197
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
673284a
feat: noir contracts and test file
LHerskind c4b6264
feat: include is_internal in kernels
LHerskind 684e14b
feat: assume isInternal unless told otherwise + update snaps
LHerskind 46d6e9e
test: cleanup tests
LHerskind 0f62615
chore: update noir
LHerskind bc58383
chore: recompile noir
LHerskind 876df6b
fix: rebase issues and clean test
LHerskind 7aa3e02
chore: prettier + update name
LHerskind 6191d5e
chore: fix snapshots
LHerskind b3f6e88
fix: add to ci
LHerskind cfe0493
Merge branch 'master' into lh/noir-example-lending
LHerskind 1245143
chore: minor fixes
LHerskind 3689ab4
fix: update noir FunctionData (cannot satisfy 💀)
LHerskind c6a2b12
fix: serialization
LHerskind 9b22e07
Merge branch 'master' into lh/noir-example-lending
Maddiaa0 2c6102d
fix: bump lending contract
Maddiaa0 25cf778
chore: address nits
LHerskind 746b74e
Merge branch 'master' into lh/noir-example-lending
LHerskind fac6b3c
chore: recompile noir
LHerskind b41a7dc
Merge branch 'master' into lh/noir-example-lending
LHerskind f123135
chore: recompile noir
LHerskind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Submodule forge-std
updated
22 files
+48 −6 | .github/workflows/ci.yml | |
+29 −0 | .github/workflows/sync.yml | |
+1 −1 | foundry.toml | |
+1 −1 | package.json | |
+5 −3 | src/Base.sol | |
+3 −2 | src/Script.sol | |
+8 −12 | src/StdChains.sol | |
+183 −17 | src/StdCheats.sol | |
+1 −1 | src/StdInvariant.sol | |
+4 −0 | src/StdStorage.sol | |
+2 −2 | src/StdStyle.sol | |
+6 −1 | src/StdUtils.sol | |
+4 −2 | src/Test.sol | |
+91 −10 | src/Vm.sol | |
+394 −382 | src/console2.sol | |
+13,248 −0 | src/safeconsole.sol | |
+91 −36 | test/StdChains.t.sol | |
+197 −13 | test/StdCheats.t.sol | |
+17 −2 | test/StdMath.t.sol | |
+10 −0 | test/StdStorage.t.sol | |
+4 −4 | test/StdStyle.t.sol | |
+53 −8 | test/StdUtils.t.sol |
Submodule openzeppelin-contracts
updated
212 files
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,15 @@ void common_validate_inputs(DummyBuilder& builder, KernelInput const& public_ker | |
builder.do_assert(public_kernel_inputs.public_call.bytecode_hash != 0, | ||
"Bytecode hash must be non-zero", | ||
CircuitErrorCode::PUBLIC_KERNEL__BYTECODE_HASH_INVALID); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a cpp test testing this code path, similarly for the other assert There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, will do. It's tested in the TS as well. |
||
if (this_call_stack_item.function_data.is_internal) { | ||
auto const target = this_call_stack_item.contract_address; | ||
auto const sender = this_call_stack_item.public_inputs.call_context.msg_sender; | ||
|
||
builder.do_assert(target == sender, | ||
"call is internal, but msg_sender is not self", | ||
CircuitErrorCode::PUBLIC_KERNEL__IS_INTERNAL_BUT_NOT_SELF_CALL); | ||
} | ||
} | ||
|
||
template <typename KernelInput, typename Builder> | ||
|
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
Submodule forge-std
updated
22 files
+48 −6 | .github/workflows/ci.yml | |
+29 −0 | .github/workflows/sync.yml | |
+1 −1 | foundry.toml | |
+1 −1 | package.json | |
+5 −3 | src/Base.sol | |
+4 −3 | src/Script.sol | |
+8 −12 | src/StdChains.sol | |
+183 −17 | src/StdCheats.sol | |
+1 −1 | src/StdInvariant.sol | |
+4 −0 | src/StdStorage.sol | |
+2 −2 | src/StdStyle.sol | |
+11 −2 | src/StdUtils.sol | |
+4 −3 | src/Test.sol | |
+91 −10 | src/Vm.sol | |
+394 −382 | src/console2.sol | |
+13,248 −0 | src/safeconsole.sol | |
+91 −36 | test/StdChains.t.sol | |
+197 −13 | test/StdCheats.t.sol | |
+17 −2 | test/StdMath.t.sol | |
+10 −0 | test/StdStorage.t.sol | |
+4 −4 | test/StdStyle.t.sol | |
+53 −8 | test/StdUtils.t.sol |
Submodule openzeppelin-contracts
updated
736 files
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This being almost the same as
function_data
makes me think that the types should maybe be unifiedThere 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.
Possibly, 3 are overlapping. But the function data is accesible inside noir as well, so maybe the leaf should include the function data:
leaf = {function_data, vk_hash, acir_hash}
. Seems more intuitive to have theis_constructor
stored in the leaf as well. Don't recall how we right now are ensuring the constructors are not rerun @iAmMichaelConnor.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.
I like the sounds of that
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.
I think perhaps the difference between
function_data
andfunction_leaf_preimage
(at least, when things were initially designed... having quickly looked back at the diagram, which is basically an extension of my memory at this point)... is...function_data
is information about the function you wish to call, which becomes part of a tx_request. It's separate from any deployment information. Perhaps it should be renamed totarget_function
orentrypoint_function
or something. Given this information, a node which has already synced can lookup the rest of the function's info (vk_hash, acir_hash, etc).function_leaf_preimage
is data required to prove existence of the function in the contracts tree. Some of that data comes fromfunction_data
, and some of that data is grabbed by the rpc server.Some of this is faint memories, so I could be wrong, but I believe their separation was intentional.
Re storing
is_constructor
in the leaf. In the initial design, the constructor isn't included as a leaf in the tree (because it never needs to be called after deployment); so the constructor's information is only included in theconstructor_hash
which is included in the contract's address. I'm not sure if that's still the case in the code. I intend to write lots of specs soon, and we'll review all this.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.
sounds good, it can stay as is!