Skip to content

Harden lmdblib LMDB failure handling#24707

Draft
AztecBot wants to merge 1 commit into
nextfrom
cb/bb-audit-remediation-2649-lmdblib-error-handling
Draft

Harden lmdblib LMDB failure handling#24707
AztecBot wants to merge 1 commit into
nextfrom
cb/bb-audit-remediation-2649-lmdblib-error-handling

Conversation

@AztecBot

Copy link
Copy Markdown
Collaborator

Summary

lmdblib treated several LMDB failure statuses as normal not-found or end-of-data cases, and transaction failure paths could leave guard or transaction state inconsistent. This change preserves the existing not-found behavior while throwing on real LMDB errors and making transaction lifecycle cleanup deterministic.

Fix

  • Distinguish MDB_NOTFOUND from real LMDB errors in query and cursor helpers.
  • Make stats reads use initialized output and the throwing mdb_stat wrapper.
  • Mark failed commits terminal before throwing and add RAII cleanup for reader/writer guard acquisition.
  • Add focused lmdblib regressions for invalid duplicate cursor operations, empty filtered previous lookup, uncommitted stats, and committed transaction reuse.

Testing

  • cmake --build --preset default --target lmdblib_tests -j$(nproc)
  • ctest --preset default -R 'LMDBStoreTest\.(duplicate_cursor_helpers_throw_on_non_duplicate_database|filtered_get_value_or_previous_returns_false_on_empty_database|get_stats_throws_for_uncommitted_database|write_transaction_rejects_second_commit)$' --output-on-failure
  • ctest --preset default -R 'LMDB(Store|Environment)Test\.' --output-on-failure
  • cmake --build --preset default --target crypto_merkle_tree_tests -j$(nproc)
  • ctest --preset default -R 'LMDBTreeStoreTest\.' --output-on-failure

Issues

  • Closes AztecProtocol/barretenberg-claude#2649 — lmdblib error handling and transaction guard failures.
  • Refs AztecProtocol/barretenberg-claude#2544 — LMDB M1/M2 failure-handling portion only.

Created by claudebox · group: bb-audit-remediation

@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Jul 15, 2026
@AztecBot

Copy link
Copy Markdown
Collaborator Author

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/a88a67c22c5b93bf�a88a67c22c5b93bf8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/multi-node/slashing/inactivity_slash_with_consecutive_epochs.test.ts (314s) (code: 0) group:e2e-p2p-epoch-flakes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant