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

Make metadata crate available for other compilers #1229

Open
cmichi opened this issue Apr 23, 2022 · 2 comments
Open

Make metadata crate available for other compilers #1229

cmichi opened this issue Apr 23, 2022 · 2 comments
Assignees
Labels
A-ink_metadata [ink_metadata] Work item B-enhancement New feature or request

Comments

@cmichi
Copy link
Collaborator

cmichi commented Apr 23, 2022

Relates to hyperledger-solang/solang#666.

@seanyoung Could you detail what you would need from us?

@cmichi cmichi added the A-ink_metadata [ink_metadata] Work item label Apr 23, 2022
@cmichi cmichi added the B-enhancement New feature or request label Apr 23, 2022
@seanyoung
Copy link

Solang uses contract-metadata for contract metadata generation but this crate does not define anything for the abi itself. So, solang includes some code for the abi generation. This code has been updated to match the latest abi metadata format already, but once again it is out of date.

What would be ideal if there was some code which could be shared between ink and solang for metadata generation:

  • messages, constructors, events
  • storage
  • types

For types, it would be useful if there is a way of creating:

  • primitives
  • account, string, byte string
  • enums
  • composit structurs: structs, array, slice, Result
  • function pointers (both function with and without account, i.e. function internal and function external in solidity
  • mappings

This would require an implementation of the type registry.

Solang does contain an implementation of this, but it is:

  • out of date
  • if even updated, as some point it would be out of date again
  • could use improvement
  • built by looking at metadata generated by ink!, so it may contain mistakes due misunderstanding

Ideally this would be added to contract-metadata.

@extraymond
Copy link

extraymond commented Jul 24, 2022

@cmichi @seanyoung

use-ink/cargo-contract#659
These are my current attempts to reuse crates that rely on cargo-metadata for solang,

I think the most difficult part would be unable to register non-rust types within the registry. Ink can do it because it uses macro that expand native rust data structures. But the same strategy may not be feasible for non-rust projects. Hope these feeback are useful for going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_metadata [ink_metadata] Work item B-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants