-
Notifications
You must be signed in to change notification settings - Fork 16
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
common: wasmToSchema: Base custom section resolution on module version #233
Conversation
14792e4
to
f12a8b7
Compare
@orhoj @shjortConcordium @rasmus-kirk @abizjak Do we want this? If so I'll clean it up and add some tests. I think it would be useful and simplify https://github.com/Concordium/concordium-dapp-libraries/pull/46/files. |
@bisgardo Stumbled upon this PR with no reviewers and no replies. Is this still relevant? I guess if it's a general purpose thing that you've needed to implement in dapp-libraries, it might as well exist here instead? I'm sorry this has been dangling for so long. If you deem it relevant still, I'll be happy to take a look if you get it up to speed with the main branch. Otherwise please close it 😄 |
@soerenbf Thanks for poking at this. I still think it's relevant :) The reason I didn't add reviewers was that I didn't consider it ready for review and I didn't want to finish it up before it was deemed worthy of doing. I merged main into the PR branch. A couple of things have changed in the meantime and the feature seems more widely used and there seems to be some duplication that I'll try and address as part of it. |
Return undefined instead of failing (force-unwrapping) when no schema was found.
Let `ConcordiumGRPCClient.getEmbeddedSchema` return `RawModuleSchema` instead of only the buffer.
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.
As these are breaking changes, I don't think these should be just merged to main
. As I see it, we have 2 options: either change these to not be breaking (if possible), or follow the process outlined below.
The way we usually handle breaking changes is:
- Make a new release branch, i.e.
release/web-sdk/8
- Target this branch for PR's implementing breaking changes
- Merge this when we're ready.
If you need to use these changes, I would suggest publishing them to npm under either the alpha
or beta
tag (we usually use alpha
for internal preliminary release versions. If you intend to publish the dapp-libraries
based on this, I would use beta
).
I'm in favor of keeping it a breaking change because having I'll let you decide what should happen. Just let me know and I'll make the relevant changes. Btw. I'm in no rush to use this in dapp-libs. But I'm happy to prepare a PR to be merged when the time is right. |
I think I would prefer to just keep the method on the GRPC client, as I think it will be easier for user to migrate. Please create a release branch for the next major version of the SDK and set it as the target branch for this. Then we'll release the changes with the next protocol update. |
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.
Assuming this is not merged to main but to a release branch for the next major version 😉
…d instead of null This is consistent with the rest of the library. Also removed some now-redundant `await`s from tests.
Created the release branch and set it as merge target. I also did the change with |
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.
Thanks! looks good 👍
Purpose
Ensure that
getEmbeddedSchema
(onConcordiumGRPCClient
) is able to resolve legacy schemas (i.e. schemas without embedded versions).Also make parsing of contract schema more precise based by using the module version information that is now exposed by the gRPC client. This in turn also documents the relationship between module and schema versions.
Changes
The module version is now used to determine what custom sections to look for. Added comments explain the expected results.
The extraction code is migrated from the dapp-library
@concordium/react-components
. Specifically, the contents of functiongetEmbeddedModuleSchema
was replaced with the contents offindSchema
and its helper functionfindCustomSections
was added and adjusted to use the SDK types.Finally,
getEmbeddedModuleSchema
was made non-async andwasmToSchema
removed because it was nothing but a more limited version ofgetEmbeddedModuleSchema
.Addresses Concordium/concordium-dapp-libraries#66.