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 isRegistered always true #43

Merged
merged 3 commits into from
Jul 22, 2022
Merged

Conversation

Maar-io
Copy link
Member

@Maar-io Maar-io commented Jul 22, 2022

  • When isRegistered() is called with enabled external database (Shiden only) it will always result with true. The problem is that 0x000...000 will have length>0

  • Problem fixed with this PR is check for register() when ss58 address is 0.

  • set isRegistered() to be view function. Remore re-register from the isRegistered() call

  • unit test updated

@Maar-io Maar-io requested review from akru and niklabh July 22, 2022 10:18
@Maar-io Maar-io self-assigned this Jul 22, 2022
@github-actions
Copy link

github-actions bot commented Jul 22, 2022

Visit the preview URL for this PR (updated for commit 3a4af40):

https://astarbase-a4922--pr43-fix-isregistered-alw-pfa0f9mi.web.app

(expires Fri, 29 Jul 2022 15:16:52 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@niklabh
Copy link
Contributor

niklabh commented Jul 22, 2022

isRegistered has become a transaction and requiring opening metamask. It should remain a view function and should not change

else{
// if ss58PublicKey32 was 0, it will be encoded as 0x000...000
// this will cause chack in isRegister to show len(0)>0
delete ss58PublicKey;
Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot modify blockchain state in isRegistered function. It should remain a view function

Copy link
Member Author

Choose a reason for hiding this comment

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

you are right. But the reason that this method needs signing is in call to register()
this delete is for the local variable

Copy link
Contributor

Choose a reason for hiding this comment

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

Need a view function to show user is registered or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@niklabh niklabh left a comment

Choose a reason for hiding this comment

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

make isRegistered a view method

@Maar-io Maar-io requested a review from niklabh July 22, 2022 12:07
@niklabh
Copy link
Contributor

niklabh commented Jul 22, 2022

working fine

@Maar-io Maar-io closed this Jul 22, 2022
@Maar-io Maar-io reopened this Jul 22, 2022
@Maar-io Maar-io merged commit 8dbdbd0 into main Jul 22, 2022
@Maar-io Maar-io deleted the fix/isRegistered-always-true branch July 22, 2022 15:17
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.

2 participants