-
Notifications
You must be signed in to change notification settings - Fork 239
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
Fix Missing Steps in "Communicating between OP Stack and Ethereum in Solidity" Tutorial #1326
Conversation
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
📝 WalkthroughWalkthroughThis pull request updates the cross-domain Solidity tutorial by significantly enhancing wallet operations and transaction handling. The code in Sequence Diagram(s)sequenceDiagram
participant T as Tutorial Script
participant L2 as l2Provider
participant L1 as l1Wallet
T->>L2: getTransactionReceipt({ hash: process.env.TUTORIAL_TRANSACTION_HASH })
T->>L2: buildProveWithdrawal(parameters)
L2-->>T: return withdrawal proof args
T->>L1: proveWithdrawal(args)
L1-->>T: return proveWithdrawal hash
T->>L1: finalizeWithdrawal(withdrawal details)
L1-->>T: return finalizeHash
Possibly related issues
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pages/builders/app-developers/tutorials/cross-dom-solidity.mdx
(3 hunks)public/tutorials/cross-dom-solidity.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.mdx`: "ALWAYS review Markdown content THOROUGHLY with ...
**/*.mdx
: "ALWAYS review Markdown content THOROUGHLY with the following criteria:
- Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
- Avoid gender-specific language and use the imperative form.
- Monitor capitalization for emphasis. Avoid using all caps, italics, or bold for emphasis.
- Ensure proper nouns are capitalized in sentences.
- Apply the Oxford comma.
- Use proper title case for buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
- Use correct spelling and grammar at all times (IMPORTANT).
- For H1, H2, and H3 headers:
- Use sentence case, capitalizing only the first word.
- Preserve the capitalization of proper nouns, technical terms, and acronyms as defined in the 'nouns.txt' file located in the root directory of the project.
- Do not automatically lowercase words that appear in the 'nouns.txt' file, regardless of their position in the header.
- Flag any headers that seem to inconsistently apply these rules for manual review.
- When reviewing capitalization, always refer to the 'nouns.txt' file for the correct capitalization of proper nouns and technical terms specific to the project.
"
pages/builders/app-developers/tutorials/cross-dom-solidity.mdx
🪛 ESLint
public/tutorials/cross-dom-solidity.js
[error] 3-3: Extra semicolon.
(semi)
[error] 4-4: Extra semicolon.
(semi)
[error] 5-5: Extra semicolon.
(semi)
[error] 6-6: Extra semicolon.
(semi)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: pr-workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (4)
public/tutorials/cross-dom-solidity.js (2)
46-54
: Add error handling for message relaying.Consider adding try-catch blocks to handle potential failures during the relaying process.
console.log('Waiting for message to be relayable...') +try { await l1Provider.getWithdrawalStatus({ receipt, targetChain: l2Provider.chain, }) console.log('Relaying message...') const [message] = getWithdrawals(receipt) await l1Provider.waitToFinalize({ withdrawalHash: message.withdrawalHash, targetChain: l2Provider.chain }) +} catch (error) { + console.error('Failed to relay message:', error) + throw error +}
56-62
: Add error handling for withdrawal finalization.Consider adding try-catch blocks to handle potential failures during the finalization process.
+try { const finalizeHash = await l1Wallet.finalizeWithdrawal({ targetChain: l2Wallet.chain, withdrawal, }) console.log('Waiting for message to be relayed...') await l1Provider.getWithdrawalStatus({ receipt, targetChain: l2Provider.chain }) +} catch (error) { + console.error('Failed to finalize withdrawal:', error) + throw error +}pages/app-developers/tutorials/bridging/cross-dom-solidity.mdx (2)
229-229
: Add missing comma.Add a comma after "relayed" in the sentence: "Once the withdrawal is ready to be relayed you can finally complete..."
-Once the withdrawal is ready to be relayed you can finally complete the message sending process. +Once the withdrawal is ready to be relayed, you can finally complete the message sending process.🧰 Tools
🪛 LanguageTool
[uncategorized] ~229-~229: Possible missing comma found.
Context: ...3>} Once the withdrawal is ready to be relayed you can finally complete the message se...(AI_HYDRA_LEO_MISSING_COMMA)
179-179
: Fix capitalization in heading.The heading "Import viem" should be "Import Viem" as Viem is a proper noun.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pages/app-developers/tutorials/bridging/cross-dom-solidity.mdx
(3 hunks)public/tutorials/cross-dom-solidity.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.mdx`: "ALWAYS review Markdown content THOROUGHLY with ...
**/*.mdx
: "ALWAYS review Markdown content THOROUGHLY with the following criteria:
- Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
- Avoid gender-specific language and use the imperative form.
- Monitor capitalization for emphasis. Avoid using all caps, italics, or bold for emphasis.
- Ensure proper nouns are capitalized in sentences.
- Apply the Oxford comma.
- Use proper title case for buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
- Use correct spelling and grammar at all times (IMPORTANT).
- For H1, H2, and H3 headers:
- Use sentence case, capitalizing only the first word.
- Preserve the capitalization of proper nouns, technical terms, and acronyms as defined in the 'nouns.txt' file located in the root directory of the project.
- Do not automatically lowercase words that appear in the 'nouns.txt' file, regardless of their position in the header.
- Flag any headers that seem to inconsistently apply these rules for manual review.
- When reviewing capitalization, always refer to the 'nouns.txt' file for the correct capitalization of proper nouns and technical terms specific to the project.
"
pages/app-developers/tutorials/bridging/cross-dom-solidity.mdx
🪛 LanguageTool
pages/app-developers/tutorials/bridging/cross-dom-solidity.mdx
[uncategorized] ~229-~229: Possible missing comma found.
Context: ...3>} Once the withdrawal is ready to be relayed you can finally complete the message se...
(AI_HYDRA_LEO_MISSING_COMMA)
🪛 ESLint
public/tutorials/cross-dom-solidity.js
[error] 3-3: Extra semicolon.
(semi)
[error] 4-4: Extra semicolon.
(semi)
[error] 5-5: Extra semicolon.
(semi)
[error] 6-6: Extra semicolon.
(semi)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - docs-optimism
- GitHub Check: Header rules - docs-optimism
- GitHub Check: Pages changed - docs-optimism
🔇 Additional comments (3)
public/tutorials/cross-dom-solidity.js (3)
3-6
: Remove unnecessary semicolons.Remove the semicolons at the end of import statements to comply with the project's coding style.
-const { createPublicClient, http, createWalletClient } = require("viem"); -const { optimismSepolia, sepolia } = require("viem/chains"); -const { publicActionsL1, publicActionsL2, walletActionsL1, walletActionsL2, getWithdrawals } = require("viem/op-stack"); -const { privateKeyToAccount } = require("viem/accounts"); +const { createPublicClient, http, createWalletClient } = require("viem") +const { optimismSepolia, sepolia } = require("viem/chains") +const { publicActionsL1, publicActionsL2, walletActionsL1, walletActionsL2, getWithdrawals } = require("viem/op-stack") +const { privateKeyToAccount } = require("viem/accounts")🧰 Tools
🪛 ESLint
[error] 3-3: Extra semicolon.
(semi)
[error] 4-4: Extra semicolon.
(semi)
[error] 5-5: Extra semicolon.
(semi)
[error] 6-6: Extra semicolon.
(semi)
22-24
: LGTM! Secure transaction receipt retrieval.The implementation correctly uses an environment variable for the transaction hash.
26-42
: LGTM! Well-structured withdrawal proving process.The implementation follows the correct sequence of operations and includes helpful progress logging.
Description
Summary
This PR addresses Issue #1217 by adding missing steps and updating outdated instructions in the "Communicating between OP Stack and Ethereum in Solidity" tutorial. The changes ensure that the tutorial aligns with the latest Viem APIs and correctly guides users through the withdrawal proving process.
Changes Introduced
transactionHash
Referenceconst transactionHash = process.env.TUTORIAL_TRANSACTION_HASH
, as it was incorrectly referenced later.createPublicClient
and.extend(publicActionsL1()) / .extend(publicActionsL2())
.createWalletClient
and.extend(walletActionsL1())
.await l2Provider.getTransactionReceipt({ hash: process.env.TUTORIAL_TRANSACTION_HASH })
to ensure proper receipt handling.Tests
Additional context
Include a link to any github issues that this may close in the following form: