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

relay-kit not working when using latest version of web3auth/modal. Plans on upgrading auth-kit deps? #551

Closed
paro-paro opened this issue Oct 16, 2023 · 9 comments

Comments

@paro-paro
Copy link

paro-paro commented Oct 16, 2023

Hi!

First of all, congrats on this amazing service for integrating account abstraction into web (d)apps. It's quite amazing.

My first test integration using the auth-kit, protocol-kit and relay-kit (sync-fee) is working perfectly fine.

But then I realise that the auth-kit is using "very" deprecated dependencies from web3auth:

  • The auth-kit install will throw up to 32 deprecated subdependencies.
  • It ships with wallet-connect-v1 and does not support v2.
  • Browser console is absolutely flooded with logs.
  • Web3Auth is currently at v7.x. The auth-kit versions at 4.x
  • Web3Auth docs do not support previous versions (so you have to fully rely on IDE typing) for configuring the auth-kit (modalConfig, etc) (of course, this is out the scope of Safe)

So... I tried removing the auth-kit and manually integrate the web3auth/modal latest version.

After this, all the aboved issues where solved and the protocol-kit was still working nicely. But I was not able to make the relay-kit (sync-fee) work again.

Getting this constant error when relaying the tx:

{
  "task": {
  "chainId": 5,
  "taskId": "0xb483460168eb87043975d3b5d24c6a2a9e95203a888f18fdbe5a056abfe8d256",
  "taskState": "Cancelled",
  "creationDate": "2023-10-16T17:44:10.718Z",
  "lastCheckDate": "2023-10-16T17:44:32.723Z",
  "lastCheckMessage": "Task Failed After 5 Retries: \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000#GelatoRelay.callWithSyncFeeV2:GS026"
  }
}

My code snippet:

import { GelatoRelayPack } from '@safe-global/relay-kit' // v1.3.0
import Safe, { EthersAdapter } from '@safe-global/protocol-kit' // v1.3.0
import { ethers } from 'ethers' // v5.7.2

// handle authentication (either by using auth-kit or web3auth/modal latest version). 
// I am using Goerli and openlogin-google.
const auth = ...

const provider = new ethers.providers.Web3Provider(auth.getProvider() as ethers.providers.ExternalProvider) // auth-kit
// or
const provider = new ethers.providers.Web3Provider(auth.provider as ethers.providers.ExternalProvider) // web3auth/modal

// then...
const signer = provider.getSigner() // problem here? read below...

const ethAdapter = new EthersAdapter({ ethers, signerOrProvider: signer })
const safeSdk = await Safe.create({
  ethAdapter,
  safeAddress: '0x...', // previously deployed safe owned by signer (threshold = 1) with enough balance!
})

const transactions = [
  {
    to: '0x...', // any address
    data: '0x',
    value: ethers.utils.parseUnits('0.0000001', 'ether').toString(),
  },
]

const relayPack = new GelatoRelayPack()
const safeTransaction = await relayPack.createRelayedTransaction({ safe: safeSdk, transactions })
const safeTransactionSigned = await safeSdk.signTransaction(safeTransaction)

const res = await relayPack.executeRelayTransaction(safeTransactionSigned, safeSdk)
console.log('url: ', `https://relay.gelato.digital/tasks/status/${res.taskId}`)

I noticed that after the upgrade in the web3auth/modal package the returned provider was different. Latest version will return an internal CommonJRPCProvider instance and the version used by the auth-kit will return a js proxy (either way, I believe they are both EIP-1193 compliance).

I was then wondering if the issue is related to the provider.getSigner() method due to the provider change?

Or maybe something else?

I have also noticed that the openlogin-google redirection opens a https://beta.web3auth... url when using the web3auth/modal v4.x and a https://auth.web3auth... url when using the latest version. Also, there are significant differences between what is stored in the browser local storage, session storage, etc when using one version or another.

Here you can find my complete reproduction repo in case is helpful.

Maybe related issue:

  • 539: "Evaluate if the signers are deterministically generated given different client id's as it is our main requirement"

So... any help or clarification will be really appreciated.

Thanks in advanced and sorry for the long text!

@paro-paro paro-paro changed the title relay-kit not working when using latest version of web3auth/modal. Plans on upgrading auth-kit deps? relay-kit not working when using latest version of web3auth/modal. Plans on upgrading auth-kit deps? Oct 16, 2023
@yagopv
Copy link
Member

yagopv commented Oct 19, 2023

Hey @paro-paro, currently we are under a development of a better web3auth integration to create a better product and we have no plans to upgrade the packages in the current pack as it is going to be revamped. Mentioned here as well.

The issue you are mentioning is indeed related to this revamp. When we finish this development, all the kits should work and play nicely together

@paro-paro
Copy link
Author

Hi @yagopv

Thanks for the reply. Glad you guys are working on a new revamped version of the auth kit.

But I was still wondering if the current issue with the relay kit is indeed due to the change in the eip provider returned from web3auth/modal latest version.

@yagopv
Copy link
Member

yagopv commented Oct 23, 2023

Hey @paro-paro, probably yes

I created this sandbox with your code and is working fine for me. So the relay-kit is working fine

@paro-paro
Copy link
Author

paro-paro commented Oct 23, 2023

Hi @yagopv

I believe you are using the window.ethereum provider in the sandbox reproduction.

Not the one returned by the latest version of web3auth/modal (as explained above) which is the one that I am having trouble with.

I just re-checked and the relay kit is still failing for me when I use the latest version from web3auth/modal as the authentication provider.

Here is a simple reproduction repo

  • Run the repo with @web3auth/[email protected].
  • Relay kit fails.
  • Downgrade to @web3auth/[email protected] (same version auth kit uses).
  • Run it again (exact same code)
  • Relay kit works fine.

@paro-paro
Copy link
Author

paro-paro commented Oct 23, 2023

The main reason why I am very interested in this issue being solved is because I am working on a dapp that already integrates web3auth v7.x

So I want to leverage just the protocol and relay kits for account abstraction. And do not be forced to use the auth-kit or to downgrade web3auth packages.

I guess this is (will be) a very common scenario when adapting dapps for AA support.

@yagopv
Copy link
Member

yagopv commented Oct 24, 2023

Hey @paro-paro. Yes, my code example was intended because i wanted to test if the issue was with the relay-kit itself.

It seems that the underlying (EIP1193) provider they return has some kind of compatibility issue and the Gelato transaction is returning a GS026 (Invalid owner signing on Safe contract). This is difficult to debug and i'm currently having issues with the provider they are using in the new integration as well (My two cents is an incompatible interface with ethers and web3 libs)

I was testing your example and the problem seems to be related to typed data signing but if you change the signing method type in the signTransaction() it worked for me. Can you add the eth_sign parameter (eth_signTypedData is the default) and retest

const safeTransactionSigned = await safeSdk.signTransaction(safeTransaction, 'eth_sign');

If it works, please use this method until we have the new integration in place that should play nicely with the other kits

@danielsimao
Copy link

Hey @paro-paro, currently we are under a development of a better web3auth integration to create a better product and we have no plans to upgrade the packages in the current pack as it is going to be revamped. Mentioned here as well.

The issue you are mentioning is indeed related to this revamp. When we finish this development, all the kits should work and play nicely together

Hey @yagopv 👋🏼. Is there a PR which we could use follow the status of your progress on this?

@paro-paro
Copy link
Author

It works!!!! What a relief!

Thank you very much for taking the time to check this out and finding a solution @yagopv

Keep up the amazing work and big thanks!

@yagopv
Copy link
Member

yagopv commented Nov 4, 2023

Hey @yagopv 👋🏼. Is there a PR which we could use follow the status of your progress on this?

There are several tickets @danielsimao. You can find them searching for "[Web3Auth Safe Signer]" in the issue title

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

No branches or pull requests

3 participants