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

L1 to L3 Bridgers #353

Closed
wants to merge 89 commits into from
Closed

L1 to L3 Bridgers #353

wants to merge 89 commits into from

Conversation

godzillaba
Copy link
Contributor

@godzillaba godzillaba commented Oct 2, 2023

I AM GOING TO CLOSE THIS PR

This PR introduces 3 new classes to help bridge tokens directly from L1 to L3:

  • Erc20L1L3Bridger
  • RelayedErc20L1L3Bridger
  • EthL1L3Bridger

See #346 for test setup changes for L3's

@cla-bot cla-bot bot added the cla-signed label Oct 2, 2023
@gzeoneth
Copy link
Member

gzeoneth commented Dec 8, 2023

so instead of hacking with calldata, I am thinking if we should simply modifier the L1 contract to accept additional parameters and calculate the address (instead of calculating the address offchain)

src/lib/assetBridger/l1l3Bridger.ts Show resolved Hide resolved
const depositReceipt = await depositTx.wait()

// poll status
await poll(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to something like below instead of manually polling?

const depositTx = await l1l3Bridger.deposit(...);
const depositReceipt = await depositTx.wait()
const l1tol2Message = depositReceipt.getL1ToL2Messages()[0]
const l2TxReceipt = new L1TransactionReceipt(await l1ToL2Message.waitForL2())
const l2tol3Message = depositReceipt.getL1ToL2Messages()[0]
await l2toL3Message.waitForL2()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i had a function like this before instead of getDepositStatus but the full stack team said they wouldn't use it and would instead do polling. I thought it might be best to just take it out

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, fair enough.

Here though I mean that we could just do the above code instead of polling to make your test simpler.

*
* Note: This function does not verify that the tx is actually a deposit tx.
*/
public async getDepositStatus(
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally we've put the status methods on the messages themselves. In this case we dont have an l1toL3 message, I'm not sure if it makes sense to have one or not, what do you think?

If we do keep this functions here I feel like they could be simplified by using the existing status functions on the underlying l1tol2Messages

Copy link
Contributor Author

@godzillaba godzillaba Dec 12, 2023

Choose a reason for hiding this comment

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

i'm not sure. i put it here initially because it was easier.

one argument though for keeping it here is that the statuses will be different for each type of L1-L3 transfer:
standard erc20 bridge: 2x L2, 1x L3 initiated by the second L2 message
relayed erc20: 1x L2, 1x L3 initiated by a relayer
ETH: 1x L2, 1x L3 initiated by L2 message

whereas with the existing L1L2 message status functions it's just a single message so it's simpler

Copy link
Contributor

Choose a reason for hiding this comment

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

yeh, i think it's ok to keep it - unless we make a full l1tol2message class.

However internally i think we should use the status() functions to calculate the return of getDepositStatus

@godzillaba
Copy link
Contributor Author

so instead of hacking with calldata, I am thinking if we should simply modifier the L1 contract to accept additional parameters and calculate the address (instead of calculating the address offchain)

@gzeoneth If we want to use a relayer to save costs and not touch any additional L1 contracts i think we have to calculate offchain. I assume you're talking about 5d7388a?

@godzillaba
Copy link
Contributor Author

moved to #396

@godzillaba godzillaba closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants