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

allow safe signature #135

Merged
merged 5 commits into from
Aug 14, 2024
Merged

allow safe signature #135

merged 5 commits into from
Aug 14, 2024

Conversation

technophile-04
Copy link
Member

Description

Updated all the routes where we were doing admin check:

Screenshot 2024-08-13 at 11 30 17 PM

Demo signing with admin :

Screen.Recording.2024-08-13.at.11.10.15.PM.mov

Demo with contract interaction( there was this transaction notification that transaction hash not found in background but everything seems to work, maybe some problem in sepolia etherscan because my trasactions was also taking time)

Untitled.1.mp4

Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
grants-bg ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 5:08am

Copy link
Contributor

@carletex carletex left a comment

Choose a reason for hiding this comment

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

It was amazing to see this working this morning. Good stuff @technophile-04 !!

It's looking great!! I'll do some more testing tomorrow.

Question: would it be possible to avoid the isSafeContext RPC call to get the bytecode? Wondering if we could detect it some other way:

  • Are the signatures equal in length? (Probably they are for EOA vs 1/n Safe).
  • Are we getting something else back or it's safe injecting something in the page? (maybe it won't work if we wallet connect into the app, without the frame)

Like I said, no need to change it... just wondering :P

Copy link
Member

@Pabl0cks Pabl0cks left a comment

Choose a reason for hiding this comment

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

Wow! Really nice job tackling it @technophile-04!!. Seems like a tough issue.

The creation>approve/reject flow is working great to me with my Sepolia safe wallet, but then I tried to do the same flow with a regular wallet, and it's throwing "Error reviewing grant".

It seems like it's not checking correctly if the address is a contract to execute the new safe logic. The log I'm getting:

Error: SafeProxy contract is not deployed on the current network
    at getSafeContract (webpack-internal:///(rsc)/./node_modules/@safe-global/pr
otocol-kit/dist/src/contracts/safeDeploymentContracts.js:15:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5
)
    at async ContractManager._ContractManager_initializeContractManager (webpack
-internal:///(rsc)/./node_modules/@safe-global/protocol-kit/dist/src/managers/co
ntractManager.js:61:45)
    at async ContractManager.init (webpack-internal:///(rsc)/./node_modules/@saf
e-global/protocol-kit/dist/src/managers/contractManager.js:31:9)
    at async Safe.Safe_initializeProtocolKit (webpack-internal:///(rsc)/./node
modules/@safe-global/protocol-kit/dist/src/Safe.js:1166:61)
    at async Safe.init (webpack-internal:///(rsc)/./node_modules/@safe-global/pr
otocol-kit/dist/src/Safe.js:118:9)
    at async validateSafeSignature (webpack-internal:///(rsc)/./utils/safe-signa
ture.ts:63:25)
    at async POST (webpack-internal:///(rsc)/./app/api/grants/[grantId]/review/r
oute.tsx:52:32)
    at async C:\GitHub\grants\packages\nextjs\node_modules\next\dist\compiled\ne
xt-server\app-route.runtime.dev.js:6:63251

@technophile-04
Copy link
Member Author

Are the signatures equal in length? (Probably they are for EOA vs 1/n Safe).

Safe sig 1/2 After
Screenshot 2024-08-14 at 2 10 49 PM Screenshot 2024-08-14 at 2 11 50 PM

So yeah their length seems same and we are not able to distinguish

Are we getting something else back or it's safe injecting something in the page? (maybe it won't work if we wallet connect into the app, without the frame)

The thing it could be connected via walletconnect breaks all the approaches. I tried getting current connected connector from wagmi's useAccount hook but when you connect via walletConnect it just only shows walletConnect and don't give more details like walletConnect was used via safe or MM

Also while digging found this https://ethereum.stackexchange.com/a/141258 where one of the Safe developer answered and he too seems to tell to check if connected address is contract or not


It seems like it's not checking correctly if the address is a contract to execute the new safe logic. The log I'm getting:

Ohh thanks @Pabl0cks! Just fixed it at 6373ec4

Copy link
Contributor

@carletex carletex left a comment

Choose a reason for hiding this comment

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

Thanks for looking it up @technophile-04 !! Detecting the contract is good enough for now (the proxy thing is not needed in our use case for now)

Testing everything and it's working great!

@carletex carletex merged commit 09562e7 into main Aug 14, 2024
3 checks passed
@carletex carletex deleted the allow-safe-signature branch August 14, 2024 08:26
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