DEV Community

Hamza
Hamza

Posted on

Reach: What to do when my version mismatches?

TLDR; Run these commands one after another
./reach down
./reach docker-reset
./reach upgrade
./reach update
./reach clean

 

What does actually happen?

Reach as a program is a compiler and a suite of tools that helps with the blockchain development. As each of these sub-programs are being developed continuously, you have to make sure they are on the same version; otherwise you may get various errors.

To check if your versions match, go to your terminal and use ./reach hashes. This will display git hashes of each program.

$ ./reach hashes

reach: 7bdf75eb
reach-cli: 7bdf75eb
react-runner: 7bdf75eb
rpc-server: 7bdf75eb
runner: 7bdf75eb
devnet-algo: 7bdf75eb
devnet-cfx: 7bdf75eb
devnet-eth: 7bdf75eb
Enter fullscreen mode Exit fullscreen mode

At the time of writing, latest version's hash is 7bdf75eb. You can check the latest hash at #releases channel in our Discord server.

If the hashes doesn't match it means some of the programs are behind and needs to be upgraded.

To do that follow these steps:

  • Run ./reach down & ./reach docker-reset to remove associated containers

Reach is a dockerized program and runs in Docker containers. While updating we first stop the services running in containers with ./reach down and remove them with ./reach docker-reset to make sure they don't intervene with the process.

$ ./reach down
Removing network "reach-devnet"... Done.
$ ./reach docker-reset
Are you sure? This will halt non-Reach containers as well.
Type "y" to continue... y
Killing all Docker containers...
Removing all Docker containers...
Done.
Enter fullscreen mode Exit fullscreen mode

 

  • Run ./reach upgrade to get latest reach script

Reach script is the executable you interact with using ./reach. To make sure we get the latest Docker image version we first have to get the latest reach script.

$ ./reach upgrade
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1969  100  1969    0     0   5307      0 --:--:-- --:--:-- --:--:--  5293
Enter fullscreen mode Exit fullscreen mode

 

  • Run ./reach update to get the latest images

Reach depends on latest versions of Reach Docker images to run correctly. With ./reach update we update the images. This step might take a while.

$ ./reach update

latest: Pulling from reachsh/reach
Digest: sha256:7f18e6d6166a273f2b1be89f710091c5728aa6675595018da5b069f4290b044f
Status: Image is up to date for reachsh/reach:latest
docker.io/reachsh/reach:latest
0: Pulling from reachsh/reach
Digest: sha256:7f18e6d6166a273f2b1be89f710091c5728aa6675595018da5b069f4290b044f
Status: Image is up to date for reachsh/reach:0
docker.io/reachsh/reach:0
.
.
.
Enter fullscreen mode Exit fullscreen mode

After installing, you can use ./reach hashes to make sure everything is updated.

 

  • (If you've compiled before) Run ./reach clean to remove old builds

When you compile a Reach contract using ./reach compile, it will create an .mjs file inside the build/ folder in the contract's directory.

./reach clean deletes what's inside the build folder. Alternatively after you update, you can run ./reach compile to override the previous artifacts.

./reach clean command might need admin privileges to run.

Top comments (0)