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

Upgrade to syn 2.0 #875

Merged
merged 12 commits into from
May 3, 2023
Merged

Upgrade to syn 2.0 #875

merged 12 commits into from
May 3, 2023

Conversation

ascjones
Copy link
Contributor

@ascjones ascjones commented Mar 21, 2023

Closes #874.

Required waiting for update to Darling: TedDriggs/darling#226.

Now this is done, but is has meant one breaking change: we can no longer use a keyword (in our case type) as the name in meta name value attributes e.g. (type = "..."). It would be possible to implement our own parsing of meta name values to allow keywords in the name position. But for simplicity I have opted to rename type to path, allowing us to continue to use the build in darling::ast::NestedMeta parsing. Which I think makes sense in the context. Happy to change that name to something else.

@ascjones ascjones marked this pull request as ready for review May 2, 2023 15:44
@ascjones ascjones requested a review from a team as a code owner May 2, 2023 15:44
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

I'm happy with path; I pondered from and to for the substitute type stuff, but path aligns nicely with the derive stuff (ie works in both cases) so I can't think of anything better!

Copy link
Collaborator

@lexnv lexnv left a comment

Choose a reason for hiding this comment

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

Amazing! 👍

We should probably take a note to update the documentation (if needed) -- the one from the subxt guide: #890

@ascjones ascjones merged commit f4eb80e into master May 3, 2023
@ascjones ascjones deleted the aj/update-syn branch May 3, 2023 12:14
tadeohepperle pushed a commit that referenced this pull request May 4, 2023
* WIP updating to syn 2.0.0

* WIP darling compat

* Update darling and syn workspace deps

* NestedMeta::parse_meta_list

* Rename attribute keyword type property to path

* Fmt

* Update more type to path

* Unused darling

* Cargo.lock

* Add missing syn features
tadeohepperle pushed a commit that referenced this pull request May 4, 2023
* WIP updating to syn 2.0.0

* WIP darling compat

* Update darling and syn workspace deps

* NestedMeta::parse_meta_list

* Rename attribute keyword type property to path

* Fmt

* Update more type to path

* Unused darling

* Cargo.lock

* Add missing syn features
tadeohepperle added a commit that referenced this pull request May 12, 2023
* speed up ui tests by reducing number of pallets

* add small and tiny versions of polkadot metadata

* change drop implementation fix test

* rust yml add nextest and merge tests

* 2

* 3

* 4

* 5

* 6

* add script for generating files

* Upgrade to `syn 2.0` (#875)

* WIP updating to syn 2.0.0

* WIP darling compat

* Update darling and syn workspace deps

* NestedMeta::parse_meta_list

* Rename attribute keyword type property to path

* Fmt

* Update more type to path

* Unused darling

* Cargo.lock

* Add missing syn features

* Metadata V15: Generate Runtime APIs (#918)

* Update frame-metadata to v15.1.0

Signed-off-by: Alexandru Vasile <[email protected]>

* Enable V15 unstable metadata in frame-metadata

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Move validation hashing to dedicated file

Signed-off-by: Alexandru Vasile <[email protected]>

* Use sp-metadata-ir from substrate to work with metadata

Signed-off-by: Alexandru Vasile <[email protected]>

* Revert using sp-metadata-ir in favor of conversion to v15

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Convert v14 to v15

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Use v15 for validation

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Use v15 for codegen

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata/bench: Use v15

Signed-off-by: Alexandru Vasile <[email protected]>

* Adjust to v15 metadata

Signed-off-by: Alexandru Vasile <[email protected]>

* Adjust testing

Signed-off-by: Alexandru Vasile <[email protected]>

* Improve documentation

Signed-off-by: Alexandru Vasile <[email protected]>

* force CI

Signed-off-by: Alexandru Vasile <[email protected]>

* rpc: Fetch metadata at version

Signed-off-by: Alexandru Vasile <[email protected]>

* artifacts: Update polkadot.scale from commit 6dc9e84dde2

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Fetch V15 using the new API

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Add runtime API interface

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Hash runtime API metadata for validation

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Extract runtime API metadata wrapper from subxt::Metadata

Signed-off-by: Alexandru Vasile <[email protected]>

* subxt: Adjust hashing cache to reflect root+item keys

Signed-off-by: Alexandru Vasile <[email protected]>

* rpc: Add raw state_call API method

Signed-off-by: Alexandru Vasile <[email protected]>

* runtime_api: Add payload with static and dynamic variants

Signed-off-by: Alexandru Vasile <[email protected]>

* subxt: Allow payloads to call into the runtime

Signed-off-by: Alexandru Vasile <[email protected]>

* examples: Add example to make a runtime API call both static and dynamic

Signed-off-by: Alexandru Vasile <[email protected]>

* Update polkadot.rs

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Simplify client fetching

Signed-off-by: Alexandru Vasile <[email protected]>

* Address feedback and fallback to old API if needed

Signed-off-by: Alexandru Vasile <[email protected]>

* runtime_api: Make mutability conditional on input params

Signed-off-by: Alexandru Vasile <[email protected]>

* Regenerate polkadot.rs

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Retain only pallets without runtime API info

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Retry via `Metadata_metadata` without conversion

Signed-off-by: Alexandru Vasile <[email protected]>

* payload: Remove `Decode` and change validation fn

Signed-off-by: Alexandru Vasile <[email protected]>

* metadata: Retain runtime API types

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Runtime APIs documentation based on flag

Signed-off-by: Alexandru Vasile <[email protected]>

* Update examples/examples/custom_metadata_url.rs

Co-authored-by: James Wilson <[email protected]>

* Update artifacts from polkadot-a6cfdb16e9

Signed-off-by: Alexandru Vasile <[email protected]>

* Update polkadot.rs with polkadot-a6cfdb16e9

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Generate input structures for runtime API

Signed-off-by: Alexandru Vasile <[email protected]>

* runtime_api: Remove the static paylaod and use single impl

Signed-off-by: Alexandru Vasile <[email protected]>

* examples: Fetch account nonce

Signed-off-by: Alexandru Vasile <[email protected]>

* testing: Adjust build script to fetch latest metadata

Signed-off-by: Alexandru Vasile <[email protected]>

* testing: Check account nonce from runtime API

Signed-off-by: Alexandru Vasile <[email protected]>

* Update cargo.lock

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Fix doc generation for runtime types

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Rename `inputs` runtime calls module to `types`

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Generate Calls structs inside the types module

Signed-off-by: Alexandru Vasile <[email protected]>

* testing: Check Alice account nonce before submitting the tx

Signed-off-by: Alexandru Vasile <[email protected]>

* cli: Add metadata version option flag supporting v14 and unstable

Signed-off-by: Alexandru Vasile <[email protected]>

* cli: Specify version to fetch

Signed-off-by: Alexandru Vasile <[email protected]>

* subxt: Fallback to fetching latest stable metadata

Signed-off-by: Alexandru Vasile <[email protected]>

* subxt: Add unstable-metadata feature to fetch the latest

Signed-off-by: Alexandru Vasile <[email protected]>

* RuntimeVersion with Latest and Version(u32)

Signed-off-by: Alexandru Vasile <[email protected]>

* Update polkadot.rs

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Adjust fetch_metadata to inspect version list

Signed-off-by: Alexandru Vasile <[email protected]>

* testing: Adjust metadata to metadata_legacy

Signed-off-by: Alexandru Vasile <[email protected]>

* events: Adjust docs to use metadata_legacy

Signed-off-by: Alexandru Vasile <[email protected]>

* have a pass over fetch_metadata

* cargo fmt

* Option<String> when fetch metadata via latest API

* clippy

* fmt

* cli: Use the MetadataVersion from codegen

Signed-off-by: Alexandru Vasile <[email protected]>

* cli: Specify latest as default for MetadataVersion

Signed-off-by: Alexandru Vasile <[email protected]>

* cli: Remove version from metadata and use the one from file_or_url

Signed-off-by: Alexandru Vasile <[email protected]>

* Fix clippy

Signed-off-by: Alexandru Vasile <[email protected]>

* codegen: Decode metadata independently for different RPC calls

Signed-off-by: Alexandru Vasile <[email protected]>

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: James Wilson <[email protected]>

* add small and tiny versions of polkadot metadata

* add script for generating files

* new metadata

* Runtime APIs; don't ask for validation hash anywhere except new_static (#947)

* remove validation hash where not wanted

* .into()

* fix example

* cargo fmt

* Subxt Guide (#890)

* WIP Starting to write book; extrinsics first pass done

* cargo fmt

* Ongoing work; events, constants, wip blocks

* at_latest() and wip blocks

* remove need to import parity-scale-codec crate with Subxt for macro to work

* More docs; expanding on setup guide and finish pass of main sections

* Tidy and remove example section for now

* format book lines to 100chars

* Fix example code

* cargo fmt

* cargo fmt

* fix example

* Fix typos

* fix broken doc links, pub mods

* Update Subxt macro docs

* can't link to Subxt here

* move macro docs to Subxt to make linking better and fix example code

* note on macro about docs

* cargo fmt

* document the no_default_derives macro feature

* Address feedback and remove redundant text

* address review comments; minor tweaks

* WIP add Runtime calls to book

* Improve Runtime API docs

* expose thing we forgot to expose and doc link fixes

* use new metadata files in book

* use mtadata full in docs

* regenerate polkadot.rs

* use small metadata in a couple of places

* Update scripts/artifacts.sh

Co-authored-by: Niklas Adolfsson <[email protected]>

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: Andrew Jones <[email protected]>
Co-authored-by: Alexandru Vasile <[email protected]>
Co-authored-by: James Wilson <[email protected]>
Co-authored-by: Niklas Adolfsson <[email protected]>
@jsdw jsdw mentioned this pull request Jun 1, 2023
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.

Upgrade to Syn 2.0
3 participants