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

Latest contract metadata #2118

Merged
merged 17 commits into from
Apr 1, 2020

Conversation

ascjones
Copy link
Contributor

@ascjones ascjones commented Mar 30, 2020

This PR is to demonstrate the new metadata format introduced via use-ink/ink#296 which incorporates paritytech/scale-info#3 (the parity fork of type-metadata). The main change is merging type id and type def.

This is a WIP and the main purpose is to test how easy it is to parse the updated format and gain some feedback before merging upstream, so any feedback appreciated.

  • Fix tests
  • Test sanitizing/handling of Vec<u8> -> Bytes
  • Fix lints
  • Test integration with UI

@ascjones ascjones marked this pull request as ready for review March 31, 2020 12:51
@ascjones
Copy link
Contributor Author

@jacogr you'll need to merge master into your branch to avoid the big diff.

Let me know if you have any feedback on the new format, since I am working towards getting the upstream PRs merged.

@jacogr
Copy link
Member

jacogr commented Mar 31, 2020

@ascjones Master merged in. Sorry, I completely forgot :(

@jacogr
Copy link
Member

jacogr commented Mar 31, 2020

It looks fine to merge into mine. I would love a larger ABI test case though (only 7 types here, but can wait for that, should not stop this). Some additional type naming cleanups can be done (once again, not for here), e.g. removing the indexes, which are certainly not useful anymore.

@ascjones
Copy link
Contributor Author

Have removed the indices. I'd like to test it with the UI if possible - can you point me to where it hooks in?

@jacogr
Copy link
Member

jacogr commented Apr 1, 2020

For the UI test, there is the ./copy-to-apps.sh script in the API - compiles and copies it t the apps UI. Then a yarn start inside the apps repo will launch with the new packages. (It needs a re-launch there, the watcher does not actually monitor node_modules anymore, it was a huge performance drag, so a small loop with stop/start when updating)

copy script does assume the api and apps are on the same level, i.e. /home/me/Projects/{api, apps}

That script gets used a lot...

Copy link
Member

@jacogr jacogr left a comment

Choose a reason for hiding this comment

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

lgtm, going to merge as-is, it is certainly 20x better than the WIP there is atm.

Thanks an absolute million.

@jacogr jacogr merged commit b395229 into polkadot-js:jg-abi-json-parse Apr 1, 2020
jacogr added a commit that referenced this pull request Oct 9, 2020
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
jacogr added a commit that referenced this pull request Oct 9, 2020
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
jacogr added a commit that referenced this pull request Oct 9, 2020
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* Adjust ContractAbi interface (empty rpc)

* linting

* Pull in Andrew's changes

* Cleanups

* Some more cleanups

* Update with v3 contracts

* Adjust with actual types

* Regenerate

* Update ABI parsing (#2695)

* Adjust ABI code

* Cleanup

* Merge non-code

* Type naming

* Simplify Base

* Rename 1

* rename 2

* Rename 3

* Simplify

* Add index to AbiMessage

* Pass actual message or index for call

* Rename param

* Simplify

* Expose call & exec

* s/call/read/

* Cleanup asserts

* AccountId as per spec

* displayName is path

* Update definitions

* Flatten ABIType into TypeDef

* Rewrite

* Fix tests

* Updates

Co-authored-by: Andrew Jones <ascjones@gmail.com>
jacogr added a commit that referenced this pull request Oct 11, 2020
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

* encodeTypeDef asRaw

* update ink typ spec

* latest built contracts

* compare files

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
woss pushed a commit to woss/api that referenced this pull request Apr 23, 2021
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (polkadot-js#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
woss pushed a commit to woss/api that referenced this pull request Apr 23, 2021
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (polkadot-js#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
woss pushed a commit to woss/api that referenced this pull request Apr 23, 2021
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (polkadot-js#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* Adjust ContractAbi interface (empty rpc)

* linting

* Pull in Andrew's changes

* Cleanups

* Some more cleanups

* Update with v3 contracts

* Adjust with actual types

* Regenerate

* Update ABI parsing (polkadot-js#2695)

* Adjust ABI code

* Cleanup

* Merge non-code

* Type naming

* Simplify Base

* Rename 1

* rename 2

* Rename 3

* Simplify

* Add index to AbiMessage

* Pass actual message or index for call

* Rename param

* Simplify

* Expose call & exec

* s/call/read/

* Cleanup asserts

* AccountId as per spec

* displayName is path

* Update definitions

* Flatten ABIType into TypeDef

* Rewrite

* Fix tests

* Updates

Co-authored-by: Andrew Jones <ascjones@gmail.com>
woss pushed a commit to woss/api that referenced this pull request Apr 23, 2021
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (polkadot-js#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

* encodeTypeDef asRaw

* update ink typ spec

* latest built contracts

* compare files

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jun 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants