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: Compare public key values not references #3119

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

buffalojoec
Copy link
Collaborator

Problem

As mentioned in #3118, using == or != to compare two PublicKey objects will compare their references. This means the conditional will only evaluate to be a match if they are the same object. Additionally, if two build targets or versions of @solana/web3.js are being used, these will always be different objects, even if the keys are the same value.

We've encountered the latter issue before, and this appears to be the last place in the legacy library where we still do this conditional without using the PublicKey.equals method.

Summary of Changes

Run a search through the codebase for any public key comparisons using == or != and update them to use PublicKey.equals. There's only one.

Closes #3118

Copy link

changeset-bot bot commented Aug 20, 2024

⚠️ No Changeset found

Latest commit: cd6f2f0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator

@steveluscher steveluscher left a comment

Choose a reason for hiding this comment

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

image

@steveluscher steveluscher changed the title Legacy: Compare public key values not references fix: Compare public key values not references Aug 20, 2024
@buffalojoec buffalojoec merged commit 99aa3c8 into maintenance/v1.x Aug 20, 2024
6 checks passed
@buffalojoec buffalojoec deleted the legacy-pubkey-equals branch August 20, 2024 13:41
Copy link
Contributor

🎉 This PR is included in version 1.95.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

github-actions bot commented Sep 4, 2024

Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants