Skip to content

Add the TiledTree lifecycle wrapper - #55

Open
Amaury Chamayou (achamayou) wants to merge 2 commits into
mainfrom
achamayou/tiled-tree
Open

Add the TiledTree lifecycle wrapper#55
Amaury Chamayou (achamayou) wants to merge 2 commits into
mainfrom
achamayou/tiled-tree

Conversation

@achamayou

@achamayou Amaury Chamayou (achamayou) commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Part 4 of the tiled-storage stack, now rebased onto main after #54 merged.

  • add TiledTreeT, combining an in-memory tree, durable tile store, writer, and mixed proof sources;
  • keep TiledTreeT fresh-only and reject adoption of an unrelated existing tile namespace;
  • track separate immutable and successfully flushed boundaries across interrupted writes;
  • make compaction opt-in with retention and exact rollback-boundary handling;
  • provide safe move semantics and explicit external-serialization/escape-hatch contracts;
  • cover lifecycle, compaction, rollback, recovery, mixed proofs, and SHA-384/SHA-512 variants.

Stack

  1. Add durable tlog-tiles storage primitives #52 - tile formats and durable storage (merged)
  2. Add incremental tile and entry-bundle writers #53 - incremental writers (merged)
  3. Add tile-backed proof generation #54 - proof generation and hash sources (merged)
  4. This PR: TiledTree lifecycle
  5. Follow-up: user documentation and performance coverage

Validation

Revalidated after rebasing onto main:

  • Debug Clang 18/OpenSSL build with clang-tidy enabled;
  • full test suite: 19/19 passed, including tiles_tree and tiles_hashes;
  • public-header clang-tidy checks for merklecpp.h, merklecpp_tiles.h, and merklecpp_pal.h.

Add TiledTreeT: a fresh-only tiled tree (rejects an existing tile
namespace rather than adopting it), append/flush/root, flushed/
immutable size tracking, interrupted-flush recovery (a failed flush
seals the attempted full-tile boundary without advancing flushed
size), optional compaction with configurable retention, a rollback
boundary that only ever permits retracting the un-tiled frontier,
noexcept move construction with no copy, mixed tile+memory proofs, and
an explicit no-internal-synchronization / external-serialization
contract for the store and tree it wraps.

Add tiles_tree tests covering the empty tree, move construction,
fresh-only rejection of an existing tile namespace, flush/compaction
(including exact-multiple and retention-margin cases), and rollback
(pre-flush, post-flush, exact-boundary, compacted, and interrupted-
flush recovery). The memory-only subtree_root/ProofEngineProbe cases
already moved to tiles_proofs are not duplicated here.

Add tiles_hashes, exercising the tiled tree, writer and proof engine
under SHA384/SHA512, and wire the OpenSSL 384/512 aliases for every
tiled-storage component.

Document the TiledTreeT API, the flush/compaction invariants and
progressive-production algorithm, pruning, and the consolidated
lifecycle/safety risks and edge cases in the design doc.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@achamayou
Amaury Chamayou (achamayou) changed the base branch from achamayou/tiles-proofs to main August 6, 2026 15:30
@achamayou
Amaury Chamayou (achamayou) marked this pull request as ready for review August 6, 2026 15:30
@achamayou
Amaury Chamayou (achamayou) requested a review from a team as a code owner August 6, 2026 15:30
Copilot AI lite review requested due to automatic review settings August 6, 2026 15:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new merkle::tiles::TiledTreeT lifecycle wrapper that composes an in-memory Merkle tree with tile-backed persistence and proof generation, plus accompanying tests and design documentation updates. This completes the “phase 4” tiled-storage layer by providing a higher-level API for append/flush/compact/rollback and mixed tile+memory proof serving.

Changes:

  • Introduce TiledTreeT (and TiledTree/SHA-384/SHA-512 aliases) with flush/compaction/rollback and proof APIs in merklecpp_tiles.h.
  • Add new tests for lifecycle behavior (tiles_tree) and OpenSSL hash variants (tiles_hashes), and wire them into test/CMakeLists.txt.
  • Update doc/design/tlog-tiles.md to reflect the delivered wrapper and updated API surface.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/tiles_tree.cpp New end-to-end lifecycle/rollback/proof tests for TiledTree.
test/tiles_hashes.cpp New OpenSSL-gated tests covering SHA-384/SHA-512 tiled variants.
test/CMakeLists.txt Registers tiles_tree always; registers tiles_hashes when OPENSSL is enabled.
merklecpp_tiles.h Adds TiledTreeT, new type aliases, and minor formatting/path behavior tweaks.
doc/design/tlog-tiles.md Updates design doc to include TiledTreeT wrapper and adjust references/plan.
Suppressed comments (1)

merklecpp_tiles.h:1786

  • This error path also uses string concatenation for a formatted message. Prefer std::format here for consistency with the rest of merklecpp_tiles.h error construction.
          throw std::runtime_error(
            "TiledTree: cannot claim tile namespace " + tile_root.string() +
            ": " + ec.message());

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/tiles_tree.cpp
Comment thread test/tiles_hashes.cpp
Comment thread merklecpp_tiles.h
Comment thread merklecpp_tiles.h
Comment thread merklecpp_tiles.h Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

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.

2 participants