This repository was archived by the owner on Mar 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[libraries/pod]: improve PodOption
type
#7076
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joncinque
reviewed
Jul 30, 2024
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.
Looks good! Just a couple of style nits
joncinque
approved these changes
Jul 30, 2024
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.
Looks great
joncinque
added a commit
to joncinque/solana-program-library
that referenced
this pull request
Aug 27, 2024
#### Problem The publish step is great, but there's still some manual work to add the changelog and correct title for the created release. #### Summary of changes Use git-cliff to generate the release notes. This comes with a very simple cliff.toml which will do minimal processing, since we don't follow conventional commits in the repo. Here's a test run for the given input: ``` $ git-cliff -c ci/cliff.toml "pod-v0.3.0"..master --include-path "libraries/pod/**" --github-repo "solana-labs/solana-program-library" ``` Output: ``` ## What's new - Publish pod v0.3.2 by @github-actions[bot] - [token-2022] Upgrade to `zk-sdk` (solana-labs#7148) by @samkim-crypto - Implement `Default` for `PodOption` (solana-labs#7083) by @joncinque - Bump to 0.3.1 (solana-labs#7075) by @febo - Improve `PodOption` type (solana-labs#7076) by @febo - Add `PodU128` type (solana-labs#7012) by @febo - Add `PodOption` type (solana-labs#6886) by @febo - Use `bytemuck_derive` explicitly (solana-labs#6928) by @joncinque ```
joncinque
added a commit
that referenced
this pull request
Aug 28, 2024
* CI: Add git-cliff step during publish #### Problem The publish step is great, but there's still some manual work to add the changelog and correct title for the created release. #### Summary of changes Use git-cliff to generate the release notes. This comes with a very simple cliff.toml which will do minimal processing, since we don't follow conventional commits in the repo. Here's a test run for the given input: ``` $ git-cliff -c ci/cliff.toml "pod-v0.3.0"..master --include-path "libraries/pod/**" --github-repo "solana-labs/solana-program-library" ``` Output: ``` ## What's new - Publish pod v0.3.2 by @github-actions[bot] - [token-2022] Upgrade to `zk-sdk` (#7148) by @samkim-crypto - Implement `Default` for `PodOption` (#7083) by @joncinque - Bump to 0.3.1 (#7075) by @febo - Improve `PodOption` type (#7076) by @febo - Add `PodU128` type (#7012) by @febo - Add `PodOption` type (#6886) by @febo - Use `bytemuck_derive` explicitly (#6928) by @joncinque ``` * Don't always run the step * Make the YAML valid * Trim each commit line to just the first line
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
The
PodOption
type currently has 2 limitations:Option::Some(T::default())
toPodOption
sinceT::default()
corresponds to theNone
value. As a result, it will convert aSome
to aNone
value.T:default()
is theNone
value, which might not be true in all cases and could be a limitation.Solution
To address (1), replace the
From
implementation for aTryFrom
, where the conversion will fail when trying to convert aOption::Some(T::default())
value toPodOption
.To address (2), add a new associated constant
NONE
to theNullable
trait instead of relying on thedefault
value. Types implementing the trait can then specify the value that representsNone
.