Skip to content
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

Give the full path of each Struct used in the Abi #2238

Closed
jfecher opened this issue Aug 9, 2023 · 0 comments · Fixed by #2374
Closed

Give the full path of each Struct used in the Abi #2238

jfecher opened this issue Aug 9, 2023 · 0 comments · Fixed by #2374
Assignees
Labels
enhancement New feature or request

Comments

@jfecher
Copy link
Contributor

jfecher commented Aug 9, 2023

Problem

When used in the Abi a struct (or user defined type in general) does not give its full path. This can make the Abi more difficult to use with an external codegen tool to automatically create bindings for.

Happy Case

We should add the full path of each user-defined type in Noir's Abi.

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@jfecher jfecher added the enhancement New feature or request label Aug 9, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 9, 2023
spalladino added a commit to AztecProtocol/aztec-packages that referenced this issue Aug 14, 2023
… contracts (#1487)

Builds on @iAmMichaelConnor work to generate a contract interface for
simplifying calling function in other contracts. Uses only information
present in the ABI. For each function in the target contract, creates a
wrapper function that receives the same arguments, serialises them based
on the standard ABI encoding format (see
[here](https://github.com/AztecProtocol/aztec-packages/blob/49d272159f1b27521ad34081c7f1622ccac19dff/yarn-project/foundation/src/abi/encoder.ts)),
and uses the `call_private_function` from the `context` to call into
them.

To handle custom structs, we're re-defining them in the contract
interface. Until we get struct type names in the ABI (see
noir-lang/noir#2238), we are autogenerating
the name as well, based on the function name and param name where they
are used. Serialisation is done manually in the code, but we may want to
replace it with a Noir intrinsic when available (see
noir-lang/noir#2240).

See [this
file](https://github.com/AztecProtocol/aztec-packages/blob/49d272159f1b27521ad34081c7f1622ccac19dff/yarn-project/noir-contracts/src/contracts/test_contract/src/test_contract_interface.nr)
for example output.

Fixes #1237

---------

Co-authored-by: iAmMichaelConnor <[email protected]>
@phated phated self-assigned this Aug 15, 2023
@phated phated added E-LOW and removed E-LOW labels Aug 18, 2023
@phated phated moved this from 📋 Backlog to 🏗 In progress in Noir Aug 24, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Aug 30, 2023
superstar0402 added a commit to superstar0402/aztec-nr that referenced this issue Aug 16, 2024
… contracts (#1487)

Builds on @iAmMichaelConnor work to generate a contract interface for
simplifying calling function in other contracts. Uses only information
present in the ABI. For each function in the target contract, creates a
wrapper function that receives the same arguments, serialises them based
on the standard ABI encoding format (see
[here](https://github.com/AztecProtocol/aztec-packages/blob/49d272159f1b27521ad34081c7f1622ccac19dff/yarn-project/foundation/src/abi/encoder.ts)),
and uses the `call_private_function` from the `context` to call into
them.

To handle custom structs, we're re-defining them in the contract
interface. Until we get struct type names in the ABI (see
noir-lang/noir#2238), we are autogenerating
the name as well, based on the function name and param name where they
are used. Serialisation is done manually in the code, but we may want to
replace it with a Noir intrinsic when available (see
noir-lang/noir#2240).

See [this
file](https://github.com/AztecProtocol/aztec-packages/blob/49d272159f1b27521ad34081c7f1622ccac19dff/yarn-project/noir-contracts/src/contracts/test_contract/src/test_contract_interface.nr)
for example output.

Fixes #1237

---------

Co-authored-by: iAmMichaelConnor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
2 participants