Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add proper test Custom values #1147
Add proper test Custom values #1147
Changes from 5 commits
cae28c3
03ed1a3
e7971c2
7e56e61
d87a969
ccc125d
30b47b8
10ff27f
3578bd7
08864a4
da5d91b
7830ba8
d4728ad
c2330f1
f558dd5
d13af85
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below, we add some
CustomMetadata
with a valid Foo value inside it (sorry; I can't comment on the exact line).Could we also add a custom value with a random type ID that isn't in use (eg
u32::MAX
); people might opt to do this too and we want to be sure that we can still access the bytes and that nothing will panic (just Err) if we try decoding them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case we just test if the bytes are returned from the dynamic interface right? E.g. we do not generate any static custom value address. Or should we generate a static address that has a return type of
Vec<u8>
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we've decided that you can't call
.at()
on a value with an invalid type ID, perhaps we can test that such an attempt fails with a compile error (via trybuild), but that.at_bytes()
works, sicne that's what we've decided to allow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a call to this to
/scripts/artifacts.sh
(iecargo run --bin generate-custom-metadata > artifacts/metadata_with_custom_values.scale
), so that running that script updates all of our artifacts :)(also, let's either allow the caller to decide where to write the file to, or just write the file to stdout, so that the file location can be specified in
artifacts.sh
so it's clear from that script what is being generated)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, that is a great idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is
substrate-compat
needed? Offhand I can't see any use for it but I'm likely to be missing something :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra line