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

[DOCS]Potential Missing Steps in "Communicating between OP Stack and Ethereum in Solidity" Tutorial #1217

Open
opfocus opened this issue Jan 5, 2025 · 3 comments
Assignees

Comments

@opfocus
Copy link
Contributor

opfocus commented Jan 5, 2025

I believe there might be a few crucial steps missing in the "Communicating between OP Stack and Ethereum in Solidity" tutorial. The steps related to the relevant actions may be connected to the instructions found in https://viem.sh/op-stack/actions/proveWithdrawal. I am currently investigating this and will appreciate any guidance or clarification on this matter.

@krofax
Copy link
Collaborator

krofax commented Jan 6, 2025

Hi @opfocus, thank you for bringing this to our attention. Could you please share which specific steps you found to be missing? This would help us ensure we address all the gaps in the tutorial.

@opfocus
Copy link
Contributor Author

opfocus commented Jan 6, 2025

9. Import Viem - Add Import Modules
After the change:

const { createPublicClient, http, createWalletClient } = require("viem");
const { optimismSepolia, sepolia } = require("viem/chains");
const { publicActionsL1, publicActionsL2, walletActionsL1 } = require("viem/op-stack");
const { privateKeyToAccount } = require("viem/accounts");

10. Load your transaction hash - Remove
Remove:

const transactionHash = process.env.TUTORIAL_TRANSACTION_HASH

Reason for removal: transactionHash is referenced in step 13 with const receipt = await l2Provider.getTransactionReceipt(transactionHash), but this step seems not to work properly. The new method for obtaining it is added in step 12.


11. Create the RPC providers and wallets - Change
After the change:

const l1Provider = createPublicClient({ chain: sepolia, transport: http("https://eth-sepolia.g.alchemy.com/v2/***") }).extend(publicActionsL1())

const l2Provider = createPublicClient({ chain: optimismSepolia, transport: http("https://opt-sepolia.g.alchemy.com/v2/***") }).extend(publicActionsL2())

const account = privateKeyToAccount(process.env.TUTORIAL_PRIVATE_KEY)

const l1Wallet = createWalletClient({
  chain: sepolia,
  transport:  http("https://eth-sepolia.g.alchemy.com/v2/***")
}).extend(walletActionsL1())

12. Wait until the message is ready to prove - Add receipt retrieval method
After the change:

const receipt = await l2Provider.getTransactionReceipt({
  hash: process.env.TUTORIAL_TRANSACTION_HASH
})

console.log('Waiting for message to be provable...')
await l1Provider.getWithdrawalStatus({ 
  receipt, 
  targetChain: l2Provider.chain, 
})

13. Prove the message on L1 - Change
After the change:

console.log('Proving message...')
const { output, withdrawal } = await l1Provider.waitToProve({ 
  receipt, 
  targetChain: l2Provider.chain, 
})

14. Build parameters to prove the withdrawal on the L2 - New addition

const args = await l2Provider.buildProveWithdrawal({
  account,
  output,
  withdrawal,
})

const hash = await l1Wallet.proveWithdrawal(args)

Note: Steps 14–16 have not been tested due to the challenge period. Possible issues include:

  1. Step 15's await l1Provider.waitToFinalize(...) may cause a delay of up to 7 days, which could block the process. It is recommended to always use await l1Provider.getWithdrawalStatus(...) to check progress.
  2. The process may be missing await walletClientL1.finalizeWithdrawal(...).

For more details on the withdrawal process, refer to the Vieme withdrawal guide.

@bradleycamacho
Copy link
Member

@krofax - @ZakAyesh and @hamdiallam will be good resources for this

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