Skip to content

Feat: Add L2 Shutdown helper scripts and docs#383

Merged
theo-learner merged 41 commits into
mainfrom
feat/shutdown-helper
Feb 2, 2026
Merged

Feat: Add L2 Shutdown helper scripts and docs#383
theo-learner merged 41 commits into
mainfrom
feat/shutdown-helper

Conversation

@theo-learner
Copy link
Copy Markdown
Member

1. Core Features & Summary

L2 Shutdown Automation & Force Withdrawal Helper
Implemented a comprehensive toolset for safely shutting down the Thanos L2 network and automating L1 force withdrawals.

  • Refined Script Architecture: Split the workflow into distinct Prepare (Upgrade, Pause, Deploy Storage) and Execute (Sweep, Claims) phases for better modularity.
  • Full Automation (E2E): Updated shell scripts to seamlessly orchestrate the entire 5-step process (Block → Fetch → Gen → Prepare → Execute).
  • Enhanced Data Integrity: Improved Python scripts to accurately handle L2 burns and unclaimed withdrawals used for snapshot generation.
  • Documentation: Fully translated and updated analysis and test guide documents to reflect the latest architecture.

2. Motivation

  • Complexity Reduction: Automating the multi-step shutdown process minimizes the risk of human error during critical operations.
  • Asset Security: Ensures that user asset snapshots are accurately generated and recorded on-chain for transparent recovery.
  • Operational Safety: Supports dry-runs and Gnosis Safe integration to verify transactions before execution.

3. How to Test

  1. Navigate to the contracts-bedrock directory.
  2. Run the end-to-end shutdown test script.
  3. Verify that all phases complete successfully and that the storage contract is deployed and populated correctly.

theo-learner and others added 30 commits December 12, 2025 20:59
…n task

- Added axios, console-log-colors, and progress as dependencies in package.json.
- Introduced a new task for generating force withdrawal assets in force-withdraw-gen.ts.
- Implemented utility functions for event querying and progress tracking.
- Created types for force withdrawal claims and asset entries in types.ts.
- Updated pnpm-lock.yaml to reflect new dependencies.
…orce withdrawal task

- Introduced a new flag `--skipVerify` to allow skipping on-chain verification for faster execution.
- Implemented detailed on-chain verification logic, including hash and balance checks, and total supply validation.
- Added comprehensive logging for verification results and error handling to ensure data integrity.
@theo-learner theo-learner requested review from a user, NegruGeorge and Shailu-s January 27, 2026 10:33
@theo-learner theo-learner self-assigned this Jan 27, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @theo-learner, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a robust and automated framework for managing the L2 network shutdown and enabling secure asset recovery on L1. It streamlines complex multi-step processes into a cohesive workflow, significantly reducing operational risks and enhancing transparency for user asset recovery. The changes span new smart contracts, Python and shell scripts for automation, and extensive documentation, ensuring a well-defined and auditable shutdown procedure.

Highlights

  • L2 Shutdown Automation & Force Withdrawal Toolset: Introduced a comprehensive suite of scripts and smart contracts to automate the safe shutdown of the Thanos L2 network and facilitate L1 force withdrawals. This includes distinct Prepare and Execute phases for modularity.
  • Enhanced Data Integrity and Snapshot Generation: Improved Python scripts for accurate handling of L2 burns and unclaimed withdrawals, crucial for generating cryptographic asset snapshots. Solidity scripts validate L1-L2 consistency and register these snapshots on-chain.
  • Smart Contract Upgrades for Shutdown: Implemented new ForceWithdrawBridge, OptimismPortalClosing, ShutdownL1UsdcBridge, and ShutdownOptimismPortal contracts to manage blocking deposits, sweeping liquidity, and enabling force withdrawal mechanisms on L1.
  • Developer and User Documentation: Added detailed documentation, including an E2E test guide, a technical analysis of the shutdown architecture, and a user-friendly guide for self-withdrawal, ensuring clarity for both operators and end-users.
  • Gnosis Safe Integration and Utilities: Refactored Gnosis Safe interactions in deployment scripts, replacing SafeExtender with standard Safe contracts and introducing SafeUtils for robust multisig transaction handling and logging.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive and well-structured toolset for managing the L2 shutdown and force withdrawal process. The changes include new contracts, automation scripts, and detailed documentation, which significantly improve the operational safety and clarity of this critical procedure. The move to use the standard Gnosis Safe contract is a good simplification. However, a critical issue was found in a new shell script where a local file path is hardcoded, which will prevent it from running on other machines.

Comment thread packages/tokamak/contracts-bedrock/scripts/e2e-shutdown-test_devnet.sh Outdated
@theo-learner theo-learner changed the title Feat: Add L2 2Shutdown helper scripts and docs Feat: Add L2 Shutdown helper scripts and docs Jan 27, 2026
Copy link
Copy Markdown
Collaborator

@Shailu-s Shailu-s left a comment

Choose a reason for hiding this comment

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

I've gone through the PR in breif it looks good. I haven't tested it though.

@theo-learner theo-learner merged commit 80a0b56 into main Feb 2, 2026
8 of 16 checks passed
theo-learner added a commit that referenced this pull request Feb 19, 2026
Feat: Add L2 Shutdown helper scripts and docs
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.

3 participants