Evmosd binary is compiled based on three other repositories.
All the tfhe operations are implemented in this repository. As go-ethereum is written in go we are calling FHE operations through cgo. So we need to compile a c_api library using this repository.
Custom repository
To use an existing repository please update the environment file .env with the path to it or export it:
export TFHE_RS_PATH=../tfhe-rs
Add it for me!
If you want to install it automatically, you can override the default tfhe-rs version by setting TFHE_RS_VERSION env variable and running:
export TFHE_RS_VERSION=0.2.4
make install-tfhe-rs
Once we are sure TFHE_RS_PATH is correct let's build it
make build-local
Here are the steps executed automatically:
-
Build a base image (or retrieve it from ghcr.io) called zama-zbc-build.
-
Check tfhe-rs is available in TFHE_RS_PATH (default is work_dir/tfhe-rs)
-
In any case the custom version or the cloned (TFHE_RS_VERSION) one is copied into work_dir/tfhe-rs
-
Clone go-ethereum and ethermint to work_dir (version are parsed from go.mod to avoid handling ssh keys inside docker because those repositories are private)
-
Update go.mod to make it use local repositories (related to the just above change)
-
Build a docker called evmosnodelocal.
make build-local-docker
If everything work correctly you should have:
ls work_dir/
ethermint go-ethereum tfhe-rs
And the following images:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
evmosnodelocal latest 04a5b55c8d9c 10 minutes ago 2.22GB
zama-zbc-build latest c280fb388ab5 12 minutes ago 1.99GB
golang bullseye 342faadef914 5 days ago 777MB
make print-info
GO_ETHEREUM_TAG: v1.0.1-test ---extracted from go.mod
ETHERMINT_TAG: v1.0.0-test ---extracted from go.mod
...
Troubleshoot ghcr.io
Here is a tutorial on how to manage ghcr.io access.
If you get trouble to pull image from ghcri.io, one can build it locally with
docker build . -t zama-zbc-build -f docker/Dockerfile.zbc.build
Troubleshoot go modules
Because evmos depends on private go-ethereum and ethermint repositories, one need to pay attention to two points to allow go modules manager to work correctly.
- Check that GOPRIVATE is set to github.com/zama-ai/* (normally this env variable is set by default in Makefile)
- Check you have the following lines in your gitconfig files:
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
To be able to run the e2e, first build the evmos local node image explained in the first part.
make build-local-docker
Then
make e2e-test-local
Every repositories are cloned into work_dir.
This test will:
- check you have all the needed repositories
- zbc-fhe-tool
- zbc-solidity
- zbc-development
- init evmos node by calling /config/setup.sh file
- generate fhe keys using zbc-fhe-tool based on $(ZBC_DEVELOPMENT_PATH)/prepare_volumes_from_fhe_tool.sh script
- copy them at the right folder using $(ZBC_DEVELOPMENT_PATH)/prepare_demo_local.sh script
- start validator and oracle db using docker-compose/docker-compose.local.yml file
- run the e2e test
- copy pks to encrypt user input using $(ZBC_SOLIDITY_PATH)/prepare_fhe_keys_from_fhe_tool script
- start the test using $(ZBC_SOLIDITY_PATH)/run_local_test_from_evmos.sh
- Get the private key of main account
- Give it to the python test script $(ZBC_SOLIDITY_PATH)/demo_test_high_level_fhe_tool