Skip to content

interop: liquidity migration specs#294

Merged
tynes merged 12 commits intomainfrom
feat/liquidity-migration
Aug 1, 2024
Merged

interop: liquidity migration specs#294
tynes merged 12 commits intomainfrom
feat/liquidity-migration

Conversation

@0xParti
Copy link
Copy Markdown
Contributor

@0xParti 0xParti commented Jul 24, 2024

Description

The Liquidity Migration Specs will cover the required modifications to allowed converting between legacy and SuperchainERC20 tokens using the L2StandardBridge.

Additional context

This specs formalizes the Convert Unified Design Docs

The function will

1. Check that `_legacyAddr` and `_superAddr` are valid and paired.
2. Check both tokens have the same amount of decimals.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is probably the best option. Figuring out how to handle decimal changes is a big can of worms.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that seems to be the consensus.

For context, L1 deposits do not check decimals at all, and it's perfectly the same to do the same here (remove the check altogether). In that case, the market should adjust the pricing for each representation.
So, both approaches are safe:

  • enforce the same decimals
  • don't enforce and let the market price the assets
    I think it's mostly a UX decision.


1. For representations minted before
the `OptimismMintableERC20Factory` upgrade:
Check an allowed token list that connects L2 representations with the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How will this list be populated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be relatively straightforward to do this trustlessly but would require that we have an external function that can be called to populate the mapping. I would prefer that over a trusted solution.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@smartcontracts the idea was to do it in a trusted manner, here's a relevant comment from @tynes: ethereum-optimism/design-docs#46 (comment), proto had suggested a slightly different approach using an onion-hash, which is the R&D discord

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can assume that the mapping will be populated correctly as part of this spec, we can work on a design doc for how to populate the mapping separately

to its `REMOTE_TOKEN`
(both allowed list and new deployments).

2. Valid `SuperchainERC20` address:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sanity check: do we assume that the remote token address is always an L1 address? Is there any case where the remote token address may not be an L1 address?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the scope of this spec, we can assume the remote token is an L1 address.
We had an internal discussion on whether to name it l1Address or something similar for this spec. Still, we went for the remote naming because we think a similar logic will eventually be used for L2 native tokens, where the remote address will not correspond to L1 but to the native L2.

@tynes
Copy link
Copy Markdown
Contributor

tynes commented Jul 24, 2024

@mds1 It would be really good to have your review on this if you have time

#### Version

Ensure the `OptimismMintableERC20Factory` implementation uses CREATE2 instead of CREATE and decimals as part of the salt.
This is in line with the latest stable implementation in the
Copy link
Copy Markdown
Contributor

@tynes tynes Jul 26, 2024

Choose a reason for hiding this comment

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

This comment is going to go stale, meaning that at some point it will no longer be the latest implementation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I recommend just removing this paragraph and adding a paragraph that says that the mapping may also be filled with addresses computed from alternative mechanisms for some chains


#### Version

Ensure the `OptimismMintableERC20Factory` implementation uses CREATE2 instead of CREATE and decimals as part of the salt.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that we should add the spec for how the salt is computed. This is useful so that we can reason about invariants around how the deployments mapping is populated.

Right now it is:

bytes32 salt = keccak256(abi.encode(_remoteToken, _name, _symbol, _decimals));

Since this isn't done with create3, a change in the solidity compiler version will result in different addresses. If it is easy to migrate to a create3 deployer, that would be preferred, but certainly not required. For the new factory we would definitely want to use create3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed the paragraph to be as open as possible, only discouraging the use of CREATE, discussing the issue with CREATE2 and suggesting CREATE3 eventually.

Would you like us to work on a dedicated spec for the salt of the OptimismMintableERC20Factory then?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the additional work in your mind besides what i linked above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nevermind, lol. It would not be worth.
I modified the paragraph in the latest commit. Let me know what do you think of it.

Copy link
Copy Markdown
Contributor

@tynes tynes left a comment

Choose a reason for hiding this comment

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

This is amazing! Great work :D

@skeletor-spaceman skeletor-spaceman requested a review from tynes August 1, 2024 14:49
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.

5 participants