upgrade-stylus-contracts

Upgrade Stylus Rust WASM contracts with OpenZeppelin UUPS or Beacon proxies.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/phpmac/foundry --skill upgrade-stylus-contracts-phpmac
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: upgrade-stylus-contracts
Source: https://github.com/phpmac/foundry/tree/main/.agents/skills/upgrade-stylus-contracts
Command: npx skills add https://github.com/phpmac/foundry --skill upgrade-stylus-contracts-phpmac

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Stylus Upgrades provides precise guidance and patterns to make Stylus (Rust/WASM) smart contracts upgradeable on Arbitrum using OpenZeppelin proxy mechanisms, addressing challenges around storage compatibility, proxy context detection, access control for upgrades, and required WASM reactivation.

Core Features & Use Cases

  • Proxy Patterns: Describes UUPS, Beacon, and basic Erc1967 proxy approaches for Stylus implementations and when to use each.
  • Stylus-specific Mechanics: Explains logic_flag, VERSION_NUMBER initialization via proxy, and annual WASM reactivation considerations unique to Stylus on Arbitrum.
  • Upgrade Safety & Testing: Guidance on storage-layout rules, initialization best practices, access-control gating for upgrade functions, and recommended devnet upgrade tests to validate state and reactivation.
  • Use Case: Migrate a Solidity contract to a Stylus implementation behind an Erc1967 proxy or implement UUPS/Beacon upgrades for an existing Stylus-based system while preserving storage and access guarantees.

Quick Start

Use this skill to upgrade a Stylus contract to a UUPS implementation on a local Arbitrum devnet, initializing set_version via the proxy, verifying storage layout compatibility, and testing reactivation.

Frequently Asked Questions about upgrade-stylus-contracts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make Arbitrum Stylus contracts upgradeable with UUPS or Beacon proxies?

To make Arbitrum Stylus contracts upgradeable, you implement OpenZeppelin proxy mechanisms like UUPS or Beacon patterns. This involves adapting Rust WASM contracts to support ERC-1967 and EIP-1822 compatibility while handling Stylus-specific initialization.

What Stylus-specific mechanics need handling during a proxy upgrade?

Stylus proxy upgrades require handling the logic_flag and initializing VERSION_NUMBER via the proxy. You must also account for annual WASM reactivation testing to ensure the upgraded contract remains active on Arbitrum.

How do I verify storage layout compatibility when upgrading Stylus contracts?

Verifying storage layout compatibility involves enforcing storage-layout rules during the upgrade process. You must ensure the new implementation preserves the existing state structure to prevent data corruption when migrating behind an Erc1967 proxy.

Does migrating a Solidity contract to Stylus support Erc1967 proxy patterns?

Yes, you can migrate a Solidity contract to a Stylus implementation behind an Erc1967 proxy. This allows you to implement UUPS or Beacon upgrades for the Stylus-based system while preserving storage and access guarantees.

How do I test Stylus contract upgrades on a local Arbitrum devnet?

You test Stylus contract upgrades on a local Arbitrum devnet by deploying the proxy, initializing set_version, and validating state changes. This process verifies storage layout compatibility and tests WASM reactivation.

Why do I need access-control checks for Stylus upgrade functions?

Access-control checks for Stylus upgrade functions prevent unauthorized users from executing proxy upgrades. Enforcing these guards ensures only permitted roles can trigger UUPS or Beacon implementation updates, securing the contract state.