Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8b22219
docs: add tlog-tiles tiled-storage and proof design
achamayou Jun 13, 2026
2a97965
feat(tiles): scaffold merklecpp_tiles.h and TileStore (Phase 1)
achamayou Jun 13, 2026
2c2a329
feat(tiles): add TileWriterT progressive write path (Phase 2)
achamayou Jun 13, 2026
1bff8da
feat(tiles): add tile-backed proof engine (Phase 3)
achamayou Jun 13, 2026
237f3dd
feat(tiles): combine tiles with in-memory tree; TiledTree (Phase 4)
achamayou Jun 13, 2026
4f4aea6
feat(tiles): entry bundles + docs (Phase 5)
achamayou Jun 13, 2026
384c498
feat(tiles): make in-memory compaction opt-in
achamayou Jun 13, 2026
4e3f11b
feat(tiles): guard rollback against immutable tiles
achamayou Jun 13, 2026
f08b3b1
docs+test: tiles API guide and expanded rollback coverage
achamayou Jun 13, 2026
b859a04
feat(tiles): add index-based consistency_proof variant
achamayou Jun 13, 2026
90ff898
style(tiles): make merklecpp_tiles.h and tests clang-tidy clean
achamayou Jun 13, 2026
16c38e7
refactor(tiles): remove checkpoint concept, persist tiles via flush()
achamayou Jun 14, 2026
f2f81d7
test(tiles): add time_tiles benchmark for the tiled-storage path
achamayou Jun 14, 2026
8b9cecc
refactor(tiles): drop partial tiles; keep the un-tiled frontier in me…
achamayou Jun 14, 2026
89b370e
refactor(tiles): drop dead partial machinery; full-only bundles; dedu…
achamayou Jun 14, 2026
18923ec
feat(tiles): remove write_higher_levels flag; add audit-driven tests
achamayou Jun 14, 2026
577b4e7
Harden tile storage
achamayou Jul 2, 2026
aae4095
Fix CI audit findings
achamayou Jul 2, 2026
f3e6991
Merge branch 'main' into experiment/tiles
achamayou Jul 3, 2026
77ed588
Fetch doctest in CMake when missing
achamayou Jul 3, 2026
b6886f8
Skip concurrent tile write stress on Windows
achamayou Jul 3, 2026
202255a
Address tiled storage review feedback
achamayou Jul 3, 2026
ade7854
Fix tiled tree move semantics
achamayou Jul 11, 2026
37d6716
Mark tiled tree move noexcept
achamayou Jul 11, 2026
90c2b98
Clarify full-tile-only storage
achamayou Jul 11, 2026
74e63c0
Seal interrupted tile flushes
achamayou Jul 11, 2026
ce881a7
Reject existing TiledTree data
achamayou Jul 11, 2026
0ea87da
Preserve exact rollback boundary
achamayou Jul 11, 2026
9bfdb90
Harden tile store filesystem writes
achamayou Jul 11, 2026
9fad334
Fix tiled storage recovery and durability
achamayou Jul 11, 2026
10fa370
Add illustrated tiled tree walkthrough
achamayou Jul 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: pages
group: pages-${{ github.ref }}
cancel-in-progress: false

permissions: read-all
Expand All @@ -24,6 +25,7 @@ jobs:
- name: Setup Pages
id: pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
if: github.event_name != 'pull_request'

- name: Install dependencies
run: |
Expand All @@ -42,6 +44,7 @@ jobs:
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: doc/build
if: github.event_name != 'pull_request'

deploy:
name: Deploy
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ jobs:
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cmake $GITHUB_WORKSPACE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON -DOPENSSL=ON -DCLANG_TIDY=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake $GITHUB_WORKSPACE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON -DLONG_TESTS=ON -DOPENSSL=ON -DCLANG_TIDY=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
else
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON -DLONG_TESTS=ON
fi

- name: Build
Expand All @@ -64,7 +64,9 @@ jobs:
- name: Clang-Tidy Header
if: matrix.os == 'ubuntu-latest'
shell: bash
run: clang-tidy merklecpp.h -p build/${{ matrix.build_type }} --warnings-as-errors='*'
run: |
clang-tidy merklecpp.h -p build/${{ matrix.build_type }} --warnings-as-errors='*'
clang-tidy merklecpp_tiles.h -p build/${{ matrix.build_type }} --warnings-as-errors='*'

- name: Test
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Configure merklecpp
working-directory: ${{github.workspace}}/build
run: cmake -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON $GITHUB_WORKSPACE
run: cmake -DCMAKE_BUILD_TYPE=Debug -DTESTS=ON -DLONG_TESTS=ON $GITHUB_WORKSPACE

- name: Build merklecpp
working-directory: ${{github.workspace}}/build
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

project(merklecpp LANGUAGES CXX C ASM)

cmake_minimum_required(VERSION 3.11)

project(merklecpp LANGUAGES CXX C ASM)
set(CMAKE_CXX_STANDARD 17)

set(MERKLECPP_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Expand All @@ -14,6 +14,7 @@ option(EVERCRYPT "enable comparison with EverCrypt Merkle trees" OFF)
option(OPENSSL "enable OpenSSL" OFF)
option(TRACE "enable debug traces" OFF)
option(CLANG_TIDY "enable clang-tidy checks during build" OFF)
option(LONG_TESTS "enable long-running tests" OFF)

if(CLANG_TIDY)
find_program(CLANG_TIDY_PROGRAM clang-tidy)
Expand Down
3 changes: 2 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = merklecpp.h
INPUT = merklecpp.h \
merklecpp_tiles.h

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,69 @@ unusual features like flushing, retracting, and tree segment serialisation.
assert(path->verify(root));


## Tiled storage (tlog-tiles)

The companion header `merklecpp_tiles.h` adds optional, header-only support for
persisting a tree as [tlog-tiles](https://c2sp.org/tlog-tiles) tile files
*progressively* (optionally dropping already-tiled leaves from memory) and for
retrieving inclusion and consistency proofs from those tiles, from the in-memory
tree, or from a combination of the two. The hashing is unchanged: tiles and tile-derived proofs are templated on
the tree's existing hash function, so a tile-derived inclusion proof is
byte-identical to one from `merkle::Tree::path()` and verifies with the same
`merkle::Path::verify()`.

#include <merklecpp_tiles.h>

merkle::tiles::TiledTree::Config cfg;
cfg.prefix = "/var/log/mylog"; // tile files live here
cfg.retention_margin = 1024; // keep the most recent leaves in memory
cfg.compact_on_flush = true; // opt in to dropping already-tiled leaves

merkle::tiles::TiledTree log(cfg);
for (const auto& leaf_hash : batch)
log.append(leaf_hash);

// Write newly-complete tiles. With compaction enabled
// this also drops from memory the leaves already covered by a full tile;
// otherwise the tree keeps every leaf and you can call log.compact() later.
log.flush();

// Proofs are served from tiles + the resident tree, even for flushed leaves.
auto inclusion = log.inclusion_proof(/*index=*/0, log.size());
assert(inclusion->verify(log.root()));

auto consistency = log.consistency_proof(/*m=*/100, /*n=*/log.size());

`TiledTree` creates a new tiled tree: the configured directory may exist, but
its `tile` subdirectory must be absent or empty. It deliberately rejects
existing tile data because tile files alone do not identify or restore the
tree that produced them. Applications with externally persisted tree state can
use the lower-level `TileStore` and `TileWriter` APIs to resume a store.

See the [tiled storage guide](doc/tiles-guide.md) for a how-to covering
flushing, compaction, rollback, proofs, and the lower-level building blocks,
and [doc/design/tlog-tiles.md](doc/design/tlog-tiles.md) for the full design,
file/directory layout, and the proof algorithms.


## Building and testing

Enable the test suite with CMake's `TESTS` option:

cmake -S . -B build -DTESTS=ON
cmake --build build
ctest --test-dir build

Some tile coverage is intentionally long-running. `LONG_TESTS` is off by
default for local builds; turn it on when you want the full tile stress suite,
including level-2 tile coverage and tile proof timing:

cmake -S . -B build -DTESTS=ON -DLONG_TESTS=ON

The repository CI enables `LONG_TESTS` so pull requests continue to exercise the
full tiled-storage matrix.


## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
Loading
Loading