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

Fix subxt metadata fallback code to work with default opts #1127

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented Aug 18, 2023

Closes #1125

if !matches!(
version,
MetadataVersion::Latest | MetadataVersion::Version(14)
) {
return Err(FetchMetadataError::Other(
"The node can only return version 14 metadata using the legacy API but you've asked for something else"
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this message say that it supports "v14" or "latest"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only V14 can be provided from this legacy route, so whether they ask for V14 or "latest that node has" that's what they will get back, so I htink it's all good?

Copy link
Member

Choose a reason for hiding this comment

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

ok, I see didn't understand that :P

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.

Looks good to me, I wonder if it's worth checking that the Latest version from the node is 14 / or if the API to fetch the version returns MethodNotIMplemented?

Ideally, in the future we'd have the V15 nodes. The inner_legacy method could still fetch V14 when the V15 code path fails (with maybe some network error). I think that's fine since it should be considered a fallback :D

@jsdw
Copy link
Collaborator Author

jsdw commented Aug 21, 2023

Looks good to me, I wonder if it's worth checking that the Latest version from the node is 14 / or if the API to fetch the version returns MethodNotIMplemented?

My reasoning was that if we are trying this legacy path, then we have already failed to call the "new" methods, and so the node only supports V14 (please do correct me if I'm wrong though :))

Edit: Ah yeah, like you said I guess it's a bit more subtle than that because we don't look at what exactly failed to get us to the fetch_legacy code path, and yeah we should pay more attention to the specific error! I geuss I'm not too bothered either because it's just a fallback thing :)

@jsdw jsdw merged commit ab84228 into master Aug 21, 2023
8 checks passed
@jsdw jsdw deleted the fix-cli-metadata-fallback branch August 21, 2023 11:37
tadeohepperle added a commit that referenced this pull request Aug 24, 2023
* work in progress

* add custom types access

* nit

* custom values client

* adjust light client

* adjust doc comments

* adjust book for custom values in code gen

* format and check docs

* work in progress

* add custom types access

* nit

* custom values client

* adjust light client

* codegen and validation

* adjust docs

* use ignore in docs in book

* change iter implementation

* use validation hash and other codegen changes

* add ui test for custom values codegen

* allow 'latest' metadata to be returned from the fallback code (#1127)

* nits

* fix validation check

* fix comments

* nits

---------

Co-authored-by: James Wilson <james@jsdw.me>
@jsdw jsdw mentioned this pull request Sep 27, 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.

subxt metadata does not work when talking to older nodes
3 participants