Skip to content

Commit e66d6d5

Browse files
Gp/203 (#106)
* update 203 * Remove 'replace_rpc' from test cases * update cli * update test * format code * remove exception_use_old_ckb * update ckb-cli * update 203 * fix ckb download * update light-client * remove ckb 110 for light-client * fix ci faild * update 4702 test * update light-client sync time * fix light-client sync failed * fix 4702 * fix ci * update test.sh * fix 4702 * pdate ckb tmp path * update node compatible * Update version from 0.203.0-rc1 to 0.203.0-rc2 * fix memory * Scz/203 (#109) * Update download.py * Update test_node.py * add test for listen 2address * add exec and spawn test * compare cycle vs 200 * fix path not found * black code * fix contract call err * format code * Update download.py * update light-client main branch * update ckb-light version * update light client download url * support docker * fix docker * fix ci for docker * update makefile * update light client * add test_ckbcli_dep_groups_enable_type_id_203.py --------- Co-authored-by: sunchengzhu <[email protected]> * Update download.py * use develop branch ckb-cli (#110) * Update version from '0.203.0-rc3' to '0.203.0' * use ckb-cli in 0.203.0 --------- Co-authored-by: sunchengzhu <[email protected]> Co-authored-by: sunchengzhu <[email protected]>
1 parent 851bdc0 commit e66d6d5

File tree

112 files changed

+802
-7421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+802
-7421
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: ci_integration_tests_docker
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-22.04]
22+
23+
# os: [ubuntu-22.04, macos-latest]
24+
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Set up Python 3.10
29+
uses: actions/setup-python@v3
30+
with:
31+
python-version: "3.10"
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
37+
38+
- name: Install dependencies
39+
run: make prepare
40+
41+
- name: Run tests
42+
run: make test
43+
env:
44+
DOCKER: true
45+
DOCKER_CKB_VERSION: "nervos/ckb:v0.202.0-rc1"
46+
47+
#
48+
#DOCKER = os.getenv('DOCKER',False)
49+
#DOCKER_CKB_VERSION = os.getenv('DOCKER_CKB_VERSION',"nervos/ckb:v0.202.0-rc1")
50+
# - name: Setup upterm session
51+
# if: always()
52+
# uses: lhotari/action-upterm@v1
53+
54+
- name: Publish reports
55+
if: failure()
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: jfoa-build-reports-${{ runner.os }}
59+
path: ./report

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ tmp
44
download
55
pytest.ini
66
reprot
7+
__pycache__
8+
pid.txt
9+
.idea
10+
venv

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ prepare:
1111
python3 -m download_ckb_light_client
1212
echo "install ckb cli"
1313
sh prepare.sh
14+
1415
develop_prepare:
1516
python3 -m venv venv
1617
. venv/bin/activate
@@ -22,11 +23,10 @@ develop_prepare:
2223
python3 -m download_ckb_light_client
2324
echo "install ckb cli"
2425
bash develop_prepare.sh
26+
# test_cases/ckb2023 \
2527
2628
test_cases := \
27-
test_cases/replace_rpc \
2829
test_cases/ckb_cli \
29-
test_cases/ckb2023 \
3030
test_cases/contracts \
3131
test_cases/example \
3232
test_cases/framework \

download.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,10 @@
1212
from tqdm import tqdm
1313

1414
versions = [
15-
"0.109.0",
16-
"0.110.2",
17-
"0.111.0",
18-
"0.112.1",
19-
"0.113.1",
20-
"0.114.0",
21-
"0.115.0",
22-
"0.116.1",
23-
"0.117.0",
24-
"0.118.0",
25-
"0.119.0",
26-
"0.120.0",
27-
"0.121.0",
2815
"0.200.0",
2916
"0.201.0",
3017
"0.202.0",
18+
"0.203.0",
3119
] # Replace with your versions
3220

3321
DOWNLOAD_DIR = "download"

download_ckb_light_client.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@
1313

1414

1515
versions = [
16-
"0.2.4",
17-
"0.3.0",
18-
"0.3.1",
19-
"0.3.2",
20-
"0.3.3",
21-
"0.3.4",
22-
"0.3.5",
23-
"0.3.6",
24-
"0.4.1",
2516
"0.5.0",
17+
"0.5.3",
2618
] # Replace with your versions
2719

2820
DOWNLOAD_DIR = "download"

framework/basic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import framework.test_cluster
1313
import framework.config
1414
import shutil
15+
16+
from framework.test_node import DOCKER
1517
from framework.util import get_project_root
1618

1719

@@ -56,3 +58,7 @@ def teardown_method(self, method):
5658
f"{get_project_root()}/tmp",
5759
f"{get_project_root()}/report/{method.__name__}",
5860
)
61+
62+
@staticmethod
63+
def skip_docker():
64+
return DOCKER

framework/helper/ckb_cli.py

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,6 @@
1313
cli_path = f"cd {get_project_root()}/source && ./ckb-cli"
1414

1515

16-
def exception_use_old_ckb():
17-
def decorator(func):
18-
@wraps(func)
19-
def wrapper(*args, **kwargs):
20-
try:
21-
return func(*args, **kwargs)
22-
except Exception as e:
23-
if "SoftFork" in str(e):
24-
global cli_path
25-
cli_path = f"cd {get_project_root()}/source && ./ckb-cli-old"
26-
print("------ change use old ckb-cli -------")
27-
try:
28-
ret = func(*args, **kwargs)
29-
cli_path = f"cd {get_project_root()}/source && ./ckb-cli"
30-
return ret
31-
except Exception as e:
32-
cli_path = f"cd {get_project_root()}/source && ./ckb-cli"
33-
raise e
34-
else:
35-
raise e
36-
37-
return wrapper
38-
39-
return decorator
40-
41-
42-
@exception_use_old_ckb()
4316
def wallet_get_capacity(ckb_address, api_url="http://127.0.0.1:8114"):
4417
"""
4518
MacBook-Pro-4 0.111.0 % ./ckb-cli wallet get-capacity
@@ -67,7 +40,6 @@ def wallet_get_capacity(ckb_address, api_url="http://127.0.0.1:8114"):
6740
Exception(f"Number not found :{capacity_response}")
6841

6942

70-
@exception_use_old_ckb()
7143
def wallet_get_live_cells(ckb_address, api_url="http://127.0.0.1:8114"):
7244
"""
7345
./ckb-cli wallet get-live-cells --address
@@ -132,7 +104,6 @@ def wallet_get_live_cells(ckb_address, api_url="http://127.0.0.1:8114"):
132104
return json.loads(run_command(cmd))
133105

134106

135-
@exception_use_old_ckb()
136107
def wallet_transfer_by_private_key(
137108
private_key,
138109
to_ckb_address,
@@ -630,18 +601,30 @@ def tx_add_header_dep(block_hash, tx_file):
630601
f.write(tx_info_str)
631602

632603

633-
def get_deploy_toml_config(account_private, contract_bin_path, enable_type_id):
604+
def get_deploy_toml_config(
605+
account_private, contract_bin_path, enable_type_id, dep_groups_enable_type_id="old"
606+
):
634607
# get account script
635608
account = util_key_info_by_private_key(account_private)
609+
# handle enable_type_id line in dep_groups
610+
dep_groups_enable_line = ""
611+
if not (
612+
isinstance(dep_groups_enable_type_id, str)
613+
and dep_groups_enable_type_id.lower() == "old"
614+
):
615+
dep_groups_enable_line = (
616+
f"\nenable_type_id = {str(dep_groups_enable_type_id).lower()}"
617+
)
618+
636619
# return format toml
637620
return f"""
638-
[[cells]]
621+
[[cells]]
639622
name = "compact_udt_lock"
640623
enable_type_id = {str(enable_type_id).lower()}
641624
location = {{ file = "{contract_bin_path}" }}
642625
643626
[[dep_groups]]
644-
name = "my_dep_group"
627+
name = "my_dep_group"{dep_groups_enable_line}
645628
cells = []
646629
647630
[lock]

framework/helper/contract.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ def get_arg_and_data(self, key) -> (str, str):
2121
pass
2222

2323

24-
@exception_use_old_ckb()
2524
def deploy_ckb_contract(
2625
private_key,
2726
contract_path,
2827
fee_rate=2000,
2928
enable_type_id=True,
29+
dep_groups_enable_type_id="old",
30+
return_tx="cell_tx",
3031
api_url="http://127.0.0.1:8114",
3132
):
3233
"""
@@ -45,7 +46,7 @@ def deploy_ckb_contract(
4546
tmp_tx_info_path = f"/tmp/tx-{time.time_ns().real}.json"
4647
tmp_deploy_toml_path = "/tmp/deploy1.toml"
4748
deploy_toml_str = get_deploy_toml_config(
48-
private_key, contract_path, enable_type_id
49+
private_key, contract_path, enable_type_id, dep_groups_enable_type_id
4950
)
5051
with open(tmp_deploy_toml_path, "w") as f:
5152
f.write(deploy_toml_str)
@@ -63,6 +64,8 @@ def deploy_ckb_contract(
6364
)
6465
deploy_sign_txs(private_key, tmp_tx_info_path, api_url)
6566
deploy_tx_result = deploy_apply_txs(tmp_tx_info_path, api_url)
67+
if return_tx == "dep_group_tx":
68+
return deploy_tx_result["dep_group_tx"]
6669
return deploy_tx_result["cell_tx"]
6770

6871
# rand ckb address ,provider contract cell cant be used
@@ -79,7 +82,6 @@ def deploy_ckb_contract(
7982
return run_command(cmd).replace("\n", "")
8083

8184

82-
@exception_use_old_ckb()
8385
def get_ckb_contract_codehash(
8486
tx_hash, tx_index, enable_type_id=True, api_url="http://127.0.0.1:8114"
8587
):
@@ -110,7 +112,6 @@ def get_ckb_contract_codehash(
110112
return f"0x{hex_digest}"
111113

112114

113-
@exception_use_old_ckb()
114115
def invoke_ckb_contract(
115116
account_private,
116117
contract_out_point_tx_hash,
@@ -260,7 +261,6 @@ def invoke_ckb_contract(
260261
return tx_send(tmp_tx_file, api_url).strip()
261262

262263

263-
@exception_use_old_ckb()
264264
def build_invoke_ckb_contract(
265265
account_private,
266266
contract_out_point_tx_hash,

framework/test_light_client.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,14 @@
66

77

88
class CkbLightClientConfigPath(Enum):
9-
V0_2_4 = (
10-
"source/template/ckb_light_client/0.2.4/testnet.toml.j2",
11-
"download/0.2.4/ckb-light-client",
12-
)
13-
V0_3_0 = (
14-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
15-
"download/0.3.0/ckb-light-client",
16-
)
17-
V0_3_1 = (
18-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
19-
"download/0.3.1/ckb-light-client",
20-
)
21-
V0_3_2 = (
22-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
23-
"download/0.3.2/ckb-light-client",
24-
)
25-
V0_3_3 = (
26-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
27-
"download/0.3.3/ckb-light-client",
28-
)
29-
V0_3_4 = (
30-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
31-
"download/0.3.4/ckb-light-client",
32-
)
33-
V0_3_5 = (
34-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
35-
"download/0.3.5/ckb-light-client",
36-
)
37-
V0_3_6 = (
38-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
39-
"download/0.3.6/ckb-light-client",
40-
)
41-
42-
V0_4_1 = (
43-
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
44-
"download/0.4.2/ckb-light-client",
45-
)
46-
479
V0_5_0 = (
4810
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
4911
"download/0.5.0/ckb-light-client",
5012
)
5113

5214
CURRENT_TEST = (
5315
"source/template/ckb_light_client/0.3.0/testnet.toml.j2",
54-
"download/0.5.0/ckb-light-client",
16+
"download/0.5.3/ckb-light-client",
5517
)
5618

5719
def __init__(self, ckb_light_client_config_path, ckb_light_bin_path):

0 commit comments

Comments
 (0)