Skip to main content
This guide covers testing, networking, authority management, constraints, and upgradeability for LayerZero contracts on Starknet. For toolchain installation and account setup, see Getting Started. For project scaffolding and deployment steps, see the OApp and OFT overviews.

Project Scaffolding, Build, and Deploy

For project layout, Scarb.toml, build, declare/deploy, and verification steps, see:

Testing

Running Tests

Test Structure

Test Utilities


Network Configuration

Endpoint IDs and addressesFor up-to-date Starknet endpoint IDs and LayerZero contract addresses, use V2 Protocol Contracts or query the Endpoint Metadata API.

RPC Endpoints

LayerZero Contract Addresses

Check the LayerZero Deployments page for current addresses:

Public Key vs Address

Starknet accounts are smart contracts (native account abstraction), so an account address is a contract address, not a public-key-derived identifier. There is no default deterministic link between the key(s) controlling an account and its address, and keys can be rotated by the account logic. See Accounts and Account keys and addresses derivation standard. Practical takeaways:
  • Use the account address anywhere an API expects a ContractAddress.
  • Treat the public key as signer metadata owned by the account contract, not as the account identifier.

Authority Management

Ownership Pattern

LayerZero Starknet contracts use OpenZeppelin’s OwnableComponent:

Delegate Pattern

Set a delegate for configuration without transferring ownership:
Delegates can:
  • Set library configurations
  • Update DVN settings
  • Manage pathway configurations
Delegates cannot:
  • Transfer ownership
  • Set peers (owner only)

Technical Constraints

Contract Size

Starknet has contract size limits (see the chain info cheat sheet for current values): Mitigation: Split large contracts into components or use libraries.

Storage

Compute


Upgradeability

Upgradeable Contracts

Use OpenZeppelin’s UpgradeableComponent:

Upgrade Process

  1. Declare new contract version
  2. Call upgrade(new_class_hash) on existing contract
  3. Verify new implementation
Ensure storage layout compatibility between versions!

Common Commands Reference

Scarb Commands

snforge Commands

sncast Commands


Class Hash Mismatch Errors

When declaring contracts, you may encounter:
This error occurs when the CASM (Cairo Assembly) hash computed locally doesn’t match what the network expects.

Common Causes

Version Compatibility Matrix

Always match your starknet dependency version in Scarb.toml with your installed Scarb version. Run scarb --version to check.

Debugging Steps

  1. Verify versions match:
  2. Clean and rebuild:
  3. Check Scarb.toml dependency:
  4. Verify RPC version:

Next Steps