Using Cairo's Storage Trait for Persistent State in Starknet Contracts
Learn how to define persistent state in Cairo contracts using the storage trait, avoid common pitfalls, and verify state changes with a simple counter example.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to define persistent state in Cairo contracts using the storage trait, avoid common pitfalls, and verify state changes with a simple counter example.
When Unicode characters vanish from Cairo PDFs, font embedding, weight mismatches, or text matrix scaling are usually the culprits. Follow this step‑by‑step diagnostic guide to restore visible text.
Cairo offers NONE, GRAY and SUBPIXEL antialiasing, but SUBPIXEL is silently downgraded on PDF/PS. Match the mode to the surface type for predictable rendering.
Learn how Cairo separates drawing intent from output implementation using a context-surface architecture to enable portable 2D rendering across PDF, SVG, and windowing systems.
When a Cairo 2.0 contract throws a ‘range_check failed’ or ‘builtin not found’ error, it’s usually a mis‑configured or missing range_check builtin. This guide walks through the symptoms, root causes, step‑by‑step checks, fixes, and when to seek help.
Define all persistent state in one #[storage] struct and access it via compiler-generated accessors. This prevents slot collisions, makes upgrades safer, and avoids felt252 overflow bugs in Cairo 1.x Starknet contracts.
A decision guide for Cairo 1 StarkNet contracts: when to use the declarative #[storage] struct versus manual StoragePointer access, with trade-offs, example code, and validation steps.
Drawing directly to a window surface can be slow because of per-pixel format conversion. A similar off-screen surface matches the target format, so you draw once and blit once.
Learn how to create fully vector PDFs with Cairo’s PDF surface, embed images, handle text, and verify the output. The guide covers code, trade‑offs, and practical checks for production use.