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

feat: handle transactions through Safe app #1041

Merged
merged 7 commits into from
Jan 27, 2025
Merged

Conversation

Sekhmet
Copy link
Member

@Sekhmet Sekhmet commented Dec 10, 2024

Summary

This PR changes three things when executing actions through Safe.

  1. When doing any action on EVM spaces (voting, proposing, editing settings) UI will not be blocked and you will be asked to confirm transaction in Safe app.
  2. When voting or proposing on Starknet spaces UI will not be blocked and you will be asked to confirm transaction in Safe app and also have access to hash-verifier.

Closes: https://github.com/snapshot-labs/workflow/issues/292

How to test

  1. On offchain spaces you can vote and propose and edit settings via Safe.
  2. On onchain EVM space you can vote, propose, and edit settings via Safe (non blocking, no hash-verifier link).
  3. On onchain Starknet space you can vote and propose via Safe (non blocking, hash-verifier link).

Screenshots

image

Wasn't sure about design on this screen or text to use there, so I'm open for suggestions.

@Sekhmet Sekhmet requested review from bonustrack and pscott December 10, 2024 15:06
@Sekhmet Sekhmet marked this pull request as ready for review December 10, 2024 15:06
@pscott
Copy link
Contributor

pscott commented Dec 10, 2024

I think it would make sense to have support for propose and updateSettings, basically any action that requires going back and forth between snapshot and safe :)

@Sekhmet Sekhmet changed the title feat: handle votes through Safe app feat: handle votes and proposals through Safe app Dec 10, 2024
@bonustrack
Copy link
Member

How is the flow with Snapshot offchain? Would be great to have similar modals

@Sekhmet Sekhmet changed the title feat: handle votes and proposals through Safe app feat: handle transactions through Safe app Dec 12, 2024
@Sekhmet
Copy link
Member Author

Sekhmet commented Dec 12, 2024

Should be ready for review.

@bonustrack
Copy link
Member

bonustrack commented Jan 6, 2025

For Snapshot offchain:

  • When I use a Safe with WalletConnect and with offchain sig it works fine, once I get all sig the vote resolve and I can see my vote.
  • When I use onchain tx to confirm a signature with the Safe, in our UI it just show this and never resolve:
image

My vote also doesn't seem to go through (I'm not sure it send a request to relayer.snapshot.org).

We should instead show a modal saying to confirm the vote (or another action) on Safe if the Safe is using onchain tx for message signature.

Here is how I enable onchain tx:

image

For SX EVM it works well.

@bonustrack bonustrack requested a review from ChaituVR January 6, 2025 22:47
@bonustrack
Copy link
Member

Looks like there is no easy way to detect if a Safe use offchain or onchain signature, so I recommend to use a modal to assume both, something like this (without hash verifier), and if we receive back a signature we show the sucess modal.:

image

@Sekhmet
Copy link
Member Author

Sekhmet commented Jan 7, 2025

Looks like this setting (onchain signatures) are old way of signing and Safe migrated to offchain signature (https://help.safe.global/en/articles/40783-what-are-signed-messages#h_ae27e5b14f).

That's the reason our old implementation looked like this (we didn't wait for confirmation because the promise we get after asking for signing never resolved). I'm not sure how this worked with v1 before - I enabled this setting on v1 Snapshot and when I try to edit space settings or create proposal via my Safe it just gets stuck:
image

Can you try it on v1 @ChaituVR ? Enable this setting as in here and see if you are able to propose.

@ChaituVR
Copy link
Member

ChaituVR commented Jan 7, 2025

Can you try it on v1 @ChaituVR ? Enable this setting as in #1041 (comment) and see if you are able to propose.

Both offchain and onchain signatures already work on v2 (offchain spaces) and also v1, something changed recently? i will try to test again

@ChaituVR
Copy link
Member

ChaituVR commented Jan 7, 2025

hmm it works for offchain spaces if I use snapshot.box as a safe app, doesn't work with walletconnect, this one https://github.com/snapshot-labs/workflow/issues/300

@bonustrack
Copy link
Member

Looks like this setting (onchain signatures) are old way of signing and Safe migrated to offchain signature

Safe migrated to offchain sig as default but onchain sig is still possible using the option in their UI. Offchain sig require the initiator of the message to keep his Safe UI open until signers of the Safe confirm the message, this is not ideal for many Safe, I dont think onchain sig will be removed anytime soon.

@Sekhmet
Copy link
Member Author

Sekhmet commented Jan 8, 2025

The issue is that with this option the promise never returns https://github.com/snapshot-labs/workflow/issues/300
And it looks like this is also something that impacts v1 (with this option you can't really do anything on v1 app as well as UI just waits for response from Safe forever).

@Sekhmet
Copy link
Member Author

Sekhmet commented Jan 8, 2025

@bonustrack after testing it it looks like there is nothing we can do about onchain signatures with WalletConnect on Safe, it just seems to hang for a while and eventually fail with Request expired. Please try again.. Seems like it's buggy implementation of Safe and WalletConnect with onchain signatures.

This will also reproduce on https://react-app.walletconnect.com/ as @ChaituVR reported.

This issue is also present on master (and on v1 UI), so there will be no negative result of this PR being merged (this PR will improve other UX aspects of Safe usage though). We should wait then to see what Safe responds about this issue.

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

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

tACK, let's merge this for now, if Safe answer we would implement onchain tx in another PR

@Sekhmet Sekhmet merged commit b12c842 into master Jan 27, 2025
2 checks passed
@Sekhmet Sekhmet deleted the sekhmet/safe-vote branch January 27, 2025 15:09
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.

4 participants