Skip to content

Add Irmin2 storage backend

David D. requested to merge ddeclerck/dune-network:irmin2 into next

This PR adds the Irmin2 storage backend from Tezos, while retaining the Irmin1 and Ironmin backends.

In order to support both Irmin1 and Irmin2, Irmin1 source code has been added in vendors/irmin-legacy.

The Irmin_sig.S interface has been adapted to account for the differences between the 3 implementations. A few wrappers had to be added, in particular:

  • Store.tree_hash (~= Store.Tree.hash - different signature in Irmin2)
  • Store.tree_clear (~= Store.Tree.close - does not exist in Irmin1)
  • Store.repo_close (~= Store.Repo.close - does not exist in Irmin1)
  • Store.commit_tree (~= Store.Commit.tree - different signature in Irmin2)
  • Store.commit_v (~= Store.Commit.v - different signature in Irmin2)

Also, the GitStore module has been renamed to Store, as in Tezos, to reduce the diff.

Most of the work was just plumbering, i.e. adjusting the code to use the wrappers and providing them the correct arguments. There was a bit of annoyance with the tree_hash functions, since there are several variants of these functions in each backend, and with the Commit.v function, as it takes Commits as input in Irmin1 and Hashes in Irmin2...

Each of the three backends was tested quite a bit, by:

  • importing/exporting mainnet snapshots and comparing the output snapshots with the input snapshot
  • comparing the database files between this branch and next after importing a snapshot (for Irmin1 and Ironmin)
  • synchronizing a node after importing a few days old snapshot and letting it run for a few hours
Edited by David D.

Merge request reports