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 for Event Name Collisions #194

Merged
merged 7 commits into from
Jan 20, 2022
Merged

Fix for Event Name Collisions #194

merged 7 commits into from
Jan 20, 2022

Conversation

George-cl
Copy link
Contributor

@George-cl George-cl commented Dec 20, 2021

This PR prefixes the events emitted by the SigningManager.ts with casper-signer: to reduce the risk of name collisions with other extensions.

I was able to delegate stake on testnet with the Keplr extension installed and account created.

Asset

Signer for PR194

Copy link
Collaborator

@piotrwitek piotrwitek left a comment

Choose a reason for hiding this comment

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

Hey @George-cl, requested some changes and comments

src/background/SigningManager.ts Outdated Show resolved Hide resolved
src/background/SigningManager.ts Outdated Show resolved Hide resolved
src/background/SigningManager.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@piotrwitek piotrwitek requested review from vladimir-gachkovsky and removed request for mssteuer, hoffmannjan and mrkara January 14, 2022 17:24
Copy link
Collaborator

@piotrwitek piotrwitek 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, let's also get a review from @vladimir-gachkovsky on Monday, and then we can merge.

src/background/SigningManager.ts Outdated Show resolved Hide resolved
src/background/SigningManager.ts Outdated Show resolved Hide resolved
@piotrwitek
Copy link
Collaborator

@vladimir-gachkovsky on Monday let's have a call and I'll let you know how to test the event name collision issue.

Copy link
Collaborator

@vladimir-gachkovsky vladimir-gachkovsky left a comment

Choose a reason for hiding this comment

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

Please apply my comments.

Copy link
Collaborator

@vladimir-gachkovsky vladimir-gachkovsky left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@piotrwitek piotrwitek left a comment

Choose a reason for hiding this comment

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

Review round 2

export default class SigningManager extends events.EventEmitter {
private unsignedDeploys: deployWithID[];
private unsignedMessages: messageWithID[];
private nextId: number;
private popupManager: PopupManager;
private messagePrefix: string = `casper-signer`;
private signingFinished: string = `finished`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@George-cl signingFinished is not clear, shouldn't this be named messageSuffix? It is used in the same pattern as the casper-signer prefix and being at the end of the message signifies it is a suffix. Also, I don't see any other suffixes apart from finished, so what is the use case for using that at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated it to be messageSuffix. I think it's useful to prevent typos between where it's used in the emitter and the listener.

Although I guess we could remove that part of the event string entirely - is that what you're suggesting?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're good, we know it is working properly and it's properly documented as a suffix. Should be no problem in the future.

@ghost ghost added this to the Signer 1.4.9 milestone Jan 19, 2022
@piotrwitek piotrwitek merged commit f96cafe into develop Jan 20, 2022
@piotrwitek piotrwitek deleted the fix-keplr-bug branch January 20, 2022 13:32
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.

3 participants