Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web3 test dependencies #2033

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,13 @@ pkg_install_rust() {
_fold_end
}

pkg_install_solc() {
_fold_start "pkg-install-solc"
python3 -m pip install py-solc-x
shohamc1 marked this conversation as resolved.
Show resolved Hide resolved
python3 -c 'from solcx import install_solc;install_solc("0.8.20")'
_fold_end
}

pkg_setup_rust() {
local target=${TARGET}
local rust_target
Expand Down Expand Up @@ -847,6 +854,7 @@ ci_setup_deps() {
DEBIAN_FRONTEND=noninteractive pkg_install_llvm
DEBIAN_FRONTEND=noninteractive pkg_install_rust
pkg_setup_rust
pkg_install_solc
}

ci_setup_deps_target() {
Expand Down
13 changes: 7 additions & 6 deletions test/functional/test_framework/evm_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@


class EVMContract:
# Solidity compiler version
_solc_version = "0.8.10"
_path_prefix = "../contracts"
path_prefix = "../contracts"

def __init__(self, code: str, file_name: str, contract_name: str):
def __init__(self, code: str, file_name: str, contract_name: str, compiler_version: str = "0.8.20",
path_prefix: str = "../contracts"):
self.code = code
self.file_name = file_name
self.contract_name = contract_name
self.compiler_version = compiler_version
self.path_prefix = path_prefix

@staticmethod
def from_file(file_name: str, contract_name: str):
with open(f"{os.path.dirname(__file__)}/{EVMContract._path_prefix}/{file_name}", "r") as file:
with open(f"{os.path.dirname(__file__)}/{EVMContract.path_prefix}/{file_name}", "r") as file:
return EVMContract(file.read(), file_name, contract_name)

def compile(self) -> (List[Dict], str):
Expand All @@ -35,7 +36,7 @@ def compile(self) -> (List[Dict], str):
}
},
},
solc_version=self._solc_version,
solc_version=self.compiler_version,
)

data = compiled_sol["contracts"][self.file_name][self.contract_name]
Expand Down