This directory contains the Go implementation of Carmen. It includes the officially supported Merkle Patricia Trie State Root Hash compatible implementation.
Carmen is included in other systems as a Go library. The Go implementation does not need any C++ dependency, i.e.; no build is required to use the library.
Carmen is added to another project simply as a dependency:
go get github.com/Fantom-foundation/carmendb/
For development purposes, it may come handy to execute all tests. It needs build of c++ parts.
Execute in the root directory:
make
Then execute in this directory:
go test ./... -timeout=60m
On memory constrained systems, parallelism may need to be reduced
go test ./... -parallel=1 -timeout 600m
all tests should pass.
Tests extensively use mocks. To regenerate mocks, use the command:
go generate ./...
If this command reports that gomock
is not installed, one can install it using the following command:
go install go.uber.org/mock/mockgen@latest
Formatting rules are enforced in the devvelopment process by running:
gofmt -s -w .
Some of the key parts may be exercised with benchmarks. For example, the Stores benchmark is executed as:
go test ./backend/store -bench=BenchmarkInsert
For more information about the running benchmarks see: Go testing documentation.