Skip to content

ci: check database files and roots are portable across Linux and macOS - #55

Merged
dipkakwani merged 2 commits into
mainfrom
ci/mdbx-portability
Oct 15, 2026
Merged

dipkakwani merged 2 commits into
mainfrom
ci/mdbx-portability

Conversation

@dipkakwani

@dipkakwani dipkakwani commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #41.

Adds a workflow that checks database files are portable between Linux (x86-64 and ARM) and macOS:

  1. Each platform creates a database and writes 10 commits.
  2. Each platform reopens every platform's database, its own and the two others, reads every record back and writes 5 more commits.
  3. All platforms must report the same roots and key limits, and each reopened database must show the head and records its creator left.

The check uses only the public API. The storage backend is opened in one place through the Store adapter, so replacing MDBX means changing one line.

Runs on pushes to main.

Tested on this PR: this run passes on the current main branch. With #37's fixed page size reverted, this run fails:

-keccak256 limits max_key_size=8166 max_value_size=2146435072
+keccak256 limits max_key_size=2022 max_value_size=2146435072

Why it fails without #37

  • Without fix: default MDBX to 4 KiB pages and a 1 TiB map ceiling #37, MDBX takes its page size from the OS: 16 KiB on Apple Silicon, 4 KiB on Linux.
  • The page size is fixed when a database is created and stored in the file, so a database created on macOS keeps 16 KiB pages after being copied to Linux.
  • The page size sets the largest key a database can store: 8,166 bytes with 16 KiB pages, 2,022 bytes with 4 KiB pages.
  • Genesis::validate checks the genesis against that limit, because attribute values become part of index keys. A genesis allowing 3,000-character strings needs 3,034-byte keys: a database created on macOS accepts it, one created on Linux rejects it with InvalidConfig.
  • In the failing run, the roots and records matched on every platform. Only the key limit differed, so the same genesis would be accepted or rejected depending on where the database was created.

#37 fixes the page size at 4 KiB, so every platform creates databases with the same 2,022-byte limit.

@dipkakwani dipkakwani changed the title ci: check roots and MDBX files are portable across Linux and macOS ci: check database files and roots are portable across Linux and macOS Oct 14, 2026
@dipkakwani
dipkakwani marked this pull request as ready for review October 14, 2026 12:19

@krzysiekfonal krzysiekfonal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Generally fine and very good to have it, good idea ;)
I would only rethink this subdir name 'examples' (but not sure about other candidate, maybe portability subdir and the test work-over-snapshot.rs - just guessiong but exmaples seems like not the real test)

@dipkakwani
dipkakwani merged commit c27ba1c into main Oct 15, 2026
2 checks passed
@dipkakwani
dipkakwani deleted the ci/mdbx-portability branch October 15, 2026 09:23
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