Skip to content

Commit

Permalink
Merge pull request #3040 from darwintree/remove-solcx
Browse files Browse the repository at this point in the history
tests: remove solcx dependency
  • Loading branch information
Pana authored Jan 21, 2025
2 parents 460e5d9 + 719411b commit 22c4a3b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
4 changes: 1 addition & 3 deletions dev-support/dep_pip3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

set -e

pip3 install cfx-account eth-utils py-ecc rlp trie coincurve safe-pysha3 conflux-web3==1.4.0b5 web3 py-solc-x jsonrpcclient==3.3.6 asyncio websockets pyyaml numpy

python3 -m solcx.install v0.5.17
pip3 install cfx-account eth-utils py-ecc rlp trie coincurve safe-pysha3 conflux-web3==1.4.0b5 web3 jsonrpcclient==3.3.6 asyncio websockets pyyaml numpy

# TODO cross platform
#yum install clang snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel
Expand Down
10 changes: 6 additions & 4 deletions tests/fixed_supply_token_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from web3 import Web3
import os

from test_framework.util import get_contract_instance
from test_framework.util import load_contract_metadata


class FixedTokenSupplyTokenTest(SmartContractBenchBase):
Expand All @@ -18,9 +18,11 @@ def __init__(self):
self.accounts = []

def setup_contract(self):
file_dir = os.path.dirname(os.path.realpath(__file__))
self.contract = get_contract_instance(source=os.path.join(file_dir, "contracts/fixed_supply_token.sol"),
contract_name="FixedSupplyToken")
metadata = load_contract_metadata("ERC20")
self.contract = Web3().eth.contract(
abi=metadata["abi"],
bytecode=metadata["bytecode"],
)
self.log.info("Initializing contract")

transaction = self.call_contract_function(self.contract, "constructor", [], self.default_account_key, storage_limit=20000)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_contracts
Submodule test_contracts updated 44 files
+4 −0 artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json
+85 −0 artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json
+4 −0 artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.dbg.json
+113 −0 artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.json
+4 −0 artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.dbg.json
+97 −0 artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.json
+4 −0 artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.dbg.json
+114 −0 artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.json
+4 −0 artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json
+319 −0 artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json
+4 −0 artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json
+194 −0 artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json
+4 −0 artifacts/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol/ERC20Burnable.dbg.json
+350 −0 artifacts/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol/ERC20Burnable.json
+4 −0 artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json
+233 −0 artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json
+4 −0 artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json
+10 −0 artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json
+453 −0 artifacts/contracts/Token20.sol/MyToken.json
+50 −0 artifacts/contracts/origin/ContextUser.sol/ContextUser.json
+73 −0 artifacts/contracts/origin/CrossSpaceEventTest.sol/CrossSpaceEventTestConfluxSide.json
+68 −0 artifacts/contracts/origin/CrossSpaceEventTest.sol/CrossSpaceEventTestEVMSide.json
+130 −0 artifacts/contracts/origin/CrossSpaceTraceTest.sol/CrossSpaceTraceTestConfluxSide.json
+37 −0 artifacts/contracts/origin/CrossSpaceTraceTest.sol/CrossSpaceTraceTestEVMSide.json
+92 −0 artifacts/contracts/origin/EventsTestContract.sol/EventsTestContract.json
+96 −0 artifacts/contracts/origin/ballot.sol/Ballot.json
+24 −0 artifacts/contracts/origin/cip98_test.sol/CIP98Test.json
+41 −0 artifacts/contracts/origin/erc20.sol/ApproveAndCallFallBack.json
+206 −0 artifacts/contracts/origin/erc20.sol/ERC20Interface.json
+392 −0 artifacts/contracts/origin/erc20.sol/FixedSupplyToken.json
+90 −0 artifacts/contracts/origin/erc20.sol/Owned.json
+10 −0 artifacts/contracts/origin/erc20.sol/SafeMath.json
+130 −0 artifacts/contracts/origin/event.sol/EventsTestContract.json
+18 −0 contracts/Token20.sol
+19 −0 contracts/origin/ContextUser.sol
+45 −0 contracts/origin/CrossSpaceEventTest.sol
+61 −0 contracts/origin/CrossSpaceTraceTest.sol
+28 −0 contracts/origin/EventsTestContract.sol
+71 −0 contracts/origin/ballot.sol
+8 −0 contracts/origin/cip98_test.sol
+226 −0 contracts/origin/erc20.sol
+46 −0 contracts/origin/event.sol
+7 −0 hardhat.config.ts
+3 −0 package.json
20 changes: 9 additions & 11 deletions tests/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import socket
import threading
import jsonrpcclient.exceptions
import solcx
import conflux_web3 # should be imported before web3
import web3
from cfx_account import Account as CfxAccount
Expand All @@ -34,8 +33,6 @@
if TYPE_CHECKING:
from conflux.rpc import RpcClient

solcx.set_solc_version('v0.5.17')

CONFLUX_RPC_WAIT_TIMEOUT = 60
CONFLUX_GRACEFUL_SHUTDOWN_TIMEOUT = 1220

Expand Down Expand Up @@ -758,14 +755,15 @@ def get_contract_instance(contract_dict=None,
w3 = web3.Web3()
contract = None
if source and contract_name:
output = solcx.compile_files([source])
if platform == "win32":
source = os.path.abspath(source).replace("\\","/")
contract_dict = output[f"{source}:{contract_name}"]
if "bin" in contract_dict:
contract_dict["bytecode"] = contract_dict.pop("bin")
elif "code" in contract_dict:
contract_dict["bytecode"] = contract_dict.pop("code")
raise Exception("deprecated")
# output = solcx.compile_files([source])
# if platform == "win32":
# source = os.path.abspath(source).replace("\\","/")
# contract_dict = output[f"{source}:{contract_name}"]
# if "bin" in contract_dict:
# contract_dict["bytecode"] = contract_dict.pop("bin")
# elif "code" in contract_dict:
# contract_dict["bytecode"] = contract_dict.pop("code")
if contract_dict:
contract = w3.eth.contract(
abi=contract_dict['abi'], bytecode=contract_dict['bytecode'], address=address)
Expand Down

0 comments on commit 22c4a3b

Please sign in to comment.