safe-global / safe-smart-account

Safe allows secure management of blockchain assets.
https://safe.global
GNU Lesser General Public License v3.0
1.84k stars 907 forks source link

How to update the safe version to #777

Closed Malikrehman00107 closed 2 months ago

Malikrehman00107 commented 2 months ago

We need to implement relay to pay the gas fee from the safe ( global) , and we need to update the safe version how we can ? from UI we can not ?

we are trying to use relays using API key method and give error and need to update to Version 1.4.1 .

how we can update to Version 1.4.1?

nlordell commented 2 months ago

Generally speaking, you would need to change the proxy singleton storage to point to the new 1.4.1 Safe contract version.

I don't think the Wallet interface currently supports this, but it should be coming soon.

Malikrehman00107 commented 2 months ago

Generally speaking, you would need to change the proxy singleton storage to point to the new 1.4.1 Safe contract version.

How i can do that ?

nlordell commented 2 months ago

With a contract like: https://github.com/safe-global/safe-smart-account/blob/main/contracts/libraries/Safe130To141Migration.sol

Note that this is currently not audited (but in our audit pipeline).

Malikrehman00107 commented 2 months ago

So , our safe is already deployed on testnet and mianenet as well , what we suppose to do with this smart contract in order to update the safe version? please guide us in more detail.

Thank you so much!

Malikrehman00107 commented 2 months ago

Waiting please!

mmv08 commented 2 months ago

We need to implement relay to pay the gas fee from the safe ( global) , and we need to update the safe version how we can ? from UI we can not ?

we are trying to use relays using API key method and give error and need to update to Version 1.4.1 .

how we can update to Version 1.4.1?

Why do you need to upgrade the safe version to implement the relay? The Safe supports relaying since v1.0.0

Malikrehman00107 commented 2 months ago

We are using this method : https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk

it give error : This module must only be used with Safe v1.4.1 or newer.

mmv08 commented 2 months ago

We are using this method : https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk

it give error : This module must only be used with Safe v1.4.1 or newer.

Ok, is it truly impossible for you to deploy a 1.4.1 safe? We haven't properly considered the 1.3.0 > 1.4.1+4337 upgrade path, and while I can write you the instructions, it will be a much more significant effort and surface for a mistake compared to just deploying a new Safe.

Malikrehman00107 commented 2 months ago

If i deploy a new safe? the version will be 1.4.1?

Malikrehman00107 commented 2 months ago

I just deploy a new safe and still show

Screenshot 2024-07-01 at 5 58 36 AM
mmv08 commented 2 months ago

If i deploy a new safe? the version will be 1.4.1?

The guide you referenced https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk tells you how to implement 4337 support for a new account on step 3. The interface still deploys safes 1.3.0 for now, that's correct.

Malikrehman00107 commented 2 months ago

If i deploy a new safe? the version will be 1.4.1?

The guide you referenced https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk tells you how to implement 4337 support for a new account on step 3. The interface still deploys safes 1.3.0 for now, that's correct.

Using this ref you shared the safe version will be e 1.4.1?

mmv08 commented 2 months ago

If i deploy a new safe? the version will be 1.4.1?

The guide you referenced https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk tells you how to implement 4337 support for a new account on step 3. The interface still deploys safes 1.3.0 for now, that's correct.

Using this ref you shared the safe version will be e 1.4.1?

yes

Malikrehman00107 commented 2 months ago

https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk

but the same issue , it throw error : that you need 1.4.1.

I still belive that updating the current one is the right solution instead of deploying new one each time if we have any backog in future.

mmv08 commented 2 months ago

https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk

but the same issue , it throw error : that you need 1.4.1.

I still belive that updating the current one is the right solution instead of deploying new one each time if we have any backog in future.

Do you follow the guide for deploying a new safe or one that is existing? You need to follow the former

I still belive that updating the current one is the right solution instead of deploying new one each time if we have any backog in future.

I fully concur. However, upgrading a Safe is a non-trivial task where multiple things can go wrong and even lead to the loss of control of the account. Hence, we'd like to properly design the upgrade flow and include all the safety mechanisms to prevent any issues. This is hard to do in the setting of a reply to a GitHub issue.

Malikrehman00107 commented 2 months ago

We are doing it using the current safe.

2- can you reply over stack exchange i can post the question?

mmv08 commented 2 months ago

We are doing it using the current safe.

So, just to recap: I suggested that you deploy a new Safe because the upgrade path from 1.3.0 is non-trivial and we haven't fully considered it at the moment. Why do you try to use the current Safe?

Malikrehman00107 commented 2 months ago

Cause we have the smart contract of safe saved in our internal setup and environments of secret manager of cloud so it can cause to break down the system.

Malikrehman00107 commented 2 months ago

I just deployed the : https://github.com/safe-global/safe-smart-account/blob/main/contracts/libraries/Safe130To141Migration.sol

https://sepolia.etherscan.io/address/0xab4691a869abd58f0c410ea273e06ad66dea2e7d

what is the next step?

mmv08 commented 2 months ago

Cause we have the smart contract of safe saved in our internal setup and environments of secret manager of cloud so it can cause to break down the system.

Do you think it's worth risking using an unaudited contract if you're worried about the state of the system?

mmv08 commented 2 months ago

what is the next step?

Use safe-core-sdk to execute a delegatecall to the migrateWithFallbackHandler function of the contract. Please be extremely careful, double-check and simulate the transaction before executing. Delegatecall is dangerous, and the target contract has full access to the caller's storage.

Malikrehman00107 commented 2 months ago

1- I have deployed the Safe130To141Migration and here it is : https://sepolia.etherscan.io/address/0xab4691a869abd58f0c410ea273e06ad66dea2e7d

2- the current safe contract address is already deployed :

https://sepolia.etherscan.io/address/0x159bD467fafcfA348D2b5f357b23aA1d70E814A0

Malikrehman00107 commented 2 months ago

Can you please write it for me ?

nlordell commented 2 months ago

Please note that the Safe130To141Migration is currently unaudited, and so it is not officially supported by the team yet. While, for testing purposes it is OK, I do recommend you do as @mmv08 mentioned and deploy a fresh 1.4.1 Safe with 4337 support instead of deploying a Safe in the user interface, and then trying to get it to work after the fact with 1.4.1 and 4337. It is more effort than its worth.

If you insist on going down the upgrade path, we have existing test in the repository that demonstrate how to use it here: https://github.com/safe-global/safe-smart-account/blob/main/test/libraries/Safe130To141Migration.test.ts. This upgrade path requires scripts, and cannot be done in the Wallet interface.