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

Autogenerate abi/metadata package #58

Merged
merged 30 commits into from
Jun 24, 2020
Merged

Autogenerate abi/metadata package #58

merged 30 commits into from
Jun 24, 2020

Conversation

ascjones
Copy link
Collaborator

@ascjones ascjones commented Jun 18, 2020

Closes #39.

Generating metadata requires a separate workspace package which is invoked via cargo run --package abi-gen. Currently this is generated by the template and exists statically in the contract's workspace.

This PR instead dynamically generates the abi-gen package, adding it to the contract workspace before invoking it. This simplifies the contract's workspace, and also allows changes to the metadata generation process without relying on all contract authors to update their local abi-gen packages.

Template updated to be ink/master compatible

Limitations

  • Not backwards compatible - will not work for ink! v2 contracts. Agreed with @Robbepop that this is too much work.
  • Cannot generate metadata for ink-as-dependency sub contracts in a multi contract workspace (e.g. delegator). I began to write code for this, it's possible but requires several more hours work. This could be addressed in a follow up Generate metadata for sub-contracts in multi contract workspace #60, since we don't currently support this anyway.

todo

  • separate PR for splitting workspace module into files, for easier review here
  • PR description here
  • ink! v2 backwards compatibility
  • handle where storage struct has a different name than the contract package e.g. ink/examples/dns
  • test with ink/examples/delegator
  • test with generated template
  • friendly message for user to remove old abi_gen package

@ascjones ascjones marked this pull request as ready for review June 23, 2020 10:23
@ascjones ascjones requested a review from Robbepop June 23, 2020 10:23
src/workspace/abi.rs Outdated Show resolved Hide resolved
src/workspace/abi.rs Outdated Show resolved Hide resolved
src/workspace/manifest.rs Outdated Show resolved Hide resolved
src/workspace/manifest.rs Outdated Show resolved Hide resolved
src/workspace/manifest.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ascjones ascjones merged commit 8071675 into master Jun 24, 2020
@ascjones ascjones deleted the aj-abi branch June 24, 2020 09:55
@ascjones ascjones mentioned this pull request Oct 13, 2020
@ascjones ascjones mentioned this pull request Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate abi_gen workspace package
2 participants