Voltar para Documentação

Docs Técnicas

Storage Encoding

Storage encoding is deterministic and sparse.

O conteúdo abaixo vem das fontes técnicas do repositório e é prerenderizado no site para leitura direta por pessoas, crawlers e agentes.

Storage encoding is deterministic and sparse.

Descriptor

The compiler emits a StorageLayoutDescriptor.

It includes:

  • field name;
  • type;
  • default;
  • canonical storage path.

The descriptor is compiler output. It defines how storage is named and compared across versions.

Sparse Persistence

Ledger storage is keyed by:

  • contract id;
  • namespace;
  • path hash.

Sparse maps and vectors persist only non-default entries.

This means:

  • default values do not need physical storage rows;
  • deleting back to default removes sparse entries;
  • large sparse structures remain compact when most values are unset.

Compatibility

Layout compatibility can be classified as:

  • identical;
  • append-only;
  • incompatible.

Automatic incompatible migration execution is outside the current closed profile.

Step-By-Step Model

  1. the compiler emits a storage layout descriptor;
  2. the contract instance uses that layout to interpret persisted storage;
  3. accepted version changes are checked against storage compatibility;
  4. incompatible layouts are rejected from the current executable upgrade path.