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

Add update_to_l2 command #292

Merged
merged 3 commits into from
Nov 6, 2023
Merged

Add update_to_l2 command #292

merged 3 commits into from
Nov 6, 2023

Conversation

Uxio0
Copy link
Member

@Uxio0 Uxio0 commented Nov 3, 2023

Updates a v1.1.1/v1.3.0/v1.4.1 non L2 Safe to a L2 Safe supported by Safe Wallet UI.
The migration contract address needs to be provided.
It can be found [here](https://github.com/safe-global/safe-contracts/blob/main/contracts/libraries/SafeToL2Migration.sol).
Nonce for the Safe must be 0 and supported versions are v1.1.1, v1.3.0 and v1.4.1.
@moisses89 moisses89 self-requested a review November 3, 2023 13:59
if self.safe.retrieve_nonce() > 0:
raise InvalidNonceException("Nonce must be 0 for non L2 to L2 migration")

if safe_version == "1.1.1":
Copy link
Member

Choose a reason for hiding this comment

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

In case of 1.1.1 the idea is to update to 1.3.0 L2?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, there's no 1.1.1 L2

@@ -0,0 +1,165 @@
safe_to_l2_migration = {
"_format": "hh-sol-artifact-1",
"contractName": "SafeToL2Migration",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe can be better move this file to a contracts folder, utils is very generic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'm thinking that this might belong to safe-eth-py

@coveralls
Copy link

coveralls commented Nov 3, 2023

Coverage Status

coverage: 92.799% (+0.5%) from 92.284%
when pulling cbdc25e on migrate-l2
into e4c1f10 on master.

@Uxio0 Uxio0 marked this pull request as ready for review November 6, 2023 11:49

if not self.ethereum_client.is_contract(migration_contract_address):
raise InvalidMigrationContractException(
f"Non L2 to L2 migration contract {migration_contract_address} is not deployed"
Copy link
Member

Choose a reason for hiding this comment

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

I think that is not necessary specify the origin contract, for me is more clear

Suggested change
f"Non L2 to L2 migration contract {migration_contract_address} is not deployed"
f"L2 migration contract {migration_contract_address} is not deployed"

},
}
},
):
Copy link
Member

Choose a reason for hiding this comment

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

Very nice :)

@Uxio0 Uxio0 merged commit 5a6a1af into master Nov 6, 2023
13 checks passed
@Uxio0 Uxio0 deleted the migrate-l2 branch November 6, 2023 13:33
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add migration upgrade from non L2 Safes to L2 Safes
3 participants