From 3a23b18a36d809dac658283d8775d3b24f58622f Mon Sep 17 00:00:00 2001 From: Duncan Tebbs Date: Wed, 5 May 2021 17:10:54 +0100 Subject: [PATCH 1/2] client: fall back to source install of solc if binary fails --- client/zeth/core/contracts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/zeth/core/contracts.py b/client/zeth/core/contracts.py index 85201c57e..1adc9140b 100644 --- a/client/zeth/core/contracts.py +++ b/client/zeth/core/contracts.py @@ -11,6 +11,7 @@ from web3.utils.events import get_event_data # type: ignore from eth_utils import event_abi_to_log_topic # type: ignore import solcx +import solcx.install # type: ignore from typing import Dict, List, Iterator, Optional, Union, Iterable, Any # Avoid trying to read too much data into memory @@ -117,7 +118,10 @@ def get_block_number(web3: Any) -> int: def install_sol() -> None: - solcx.install_solc(SOL_COMPILER_VERSION) + try: + solcx.install_solc(SOL_COMPILER_VERSION) + except solcx.exceptions.SolcInstallationError: + solcx.install.compile_solc(SOL_COMPILER_VERSION) def compile_files(files: List[str], **kwargs: Any) -> Any: From 85d39d714c5c2f70d467cef2bef63317604e5e61 Mon Sep 17 00:00:00 2001 From: Duncan Tebbs Date: Thu, 6 May 2021 10:02:50 +0100 Subject: [PATCH 2/2] ci: copy alpine solc binary into client container --- Dockerfile-client | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile-client b/Dockerfile-client index 2a8916fe7..76e75803f 100644 --- a/Dockerfile-client +++ b/Dockerfile-client @@ -1,7 +1,13 @@ +# Image to copy solc compiler from +FROM ethereum/solc:0.8.1-alpine as solc-0.8.1 + FROM python:3.8-alpine3.12 LABEL org.opencontainers.image.source https://github.com/clearmatics/zeth +# Image to copy solc compiler from +COPY --from=solc-0.8.1 /usr/local/bin/solc /root/.solcx/solc-v0.8.1 + RUN apk --update --no-cache add \ build-base \ linux-headers \