Skip to content

Autogenerate abi/metadata package#58

Merged
ascjones merged 30 commits into
masterfrom
aj-abi
Jun 24, 2020
Merged

Autogenerate abi/metadata package#58
ascjones merged 30 commits into
masterfrom
aj-abi

Conversation

@ascjones

@ascjones ascjones commented Jun 18, 2020

Copy link
Copy Markdown
Collaborator

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
Comment thread src/workspace/abi.rs Outdated
Comment thread src/workspace/abi.rs
Comment thread src/workspace/manifest.rs Outdated
Comment thread src/workspace/manifest.rs Outdated
Comment thread src/workspace/manifest.rs Outdated

@Robbepop Robbepop left a comment

Copy link
Copy Markdown
Contributor

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