feat!: contract interfaces and better function calls#5687
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #5081
This PR introduces autogenerated contract interfaces for easy intra and inter contract interactions. The
aztec-macrocrate is used to stub every non-internal private and public function and inject them into a ghost struct which has the same name as the contract that generated them. After that, they can be called like this:Return values are
deserialized_into()automatically, providing "real" return values thanks to #5633Also, some general cleanup was required to allow importing contracts in another contracts. Main changes:
HirContext.fully_qualified_struct_pathnow uses BFS to avoid returning the longest path when looking for a struct in a crate. This is required to avoid pulling structs usually imported in top-level dependencies (usually notes from our main contract) from other imported contracts.pack_args_oraclenow has a slice mode in addition to its usual array mode.PENDING:
AvmContext. The AVM team is discussing supporting args as slices. In case it's decided not to do that, a workaround could possibly be implemented using the macro, but it would be fairly complex.Thanks to @fcarreiro and the amazing AVM team, this is now supported for the AvmContext!