diff --git a/.github/workflows/ci_integration_tests_docker.yml b/.github/workflows/ci_integration_tests_docker.yml new file mode 100644 index 00000000..962908d1 --- /dev/null +++ b/.github/workflows/ci_integration_tests_docker.yml @@ -0,0 +1,59 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: ci_integration_tests_docker + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + # os: [ubuntu-22.04, macos-latest] + + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Install dependencies + run: make prepare + + - name: Run tests + run: make test + env: + DOCKER: true + DOCKER_CKB_VERSION: "nervos/ckb:v0.202.0-rc1" + +# +#DOCKER = os.getenv('DOCKER',False) +#DOCKER_CKB_VERSION = os.getenv('DOCKER_CKB_VERSION',"nervos/ckb:v0.202.0-rc1") +# - name: Setup upterm session +# if: always() +# uses: lhotari/action-upterm@v1 + + - name: Publish reports + if: failure() + uses: actions/upload-artifact@v4 + with: + name: jfoa-build-reports-${{ runner.os }} + path: ./report diff --git a/.gitignore b/.gitignore index 3cabeca1..208e49e6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ tmp download pytest.ini reprot +__pycache__ +pid.txt +.idea +venv \ No newline at end of file diff --git a/Makefile b/Makefile index f9355b86..56baaa9d 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ prepare: python3 -m download_ckb_light_client echo "install ckb cli" sh prepare.sh + develop_prepare: python3 -m venv venv . venv/bin/activate @@ -22,11 +23,10 @@ develop_prepare: python3 -m download_ckb_light_client echo "install ckb cli" bash develop_prepare.sh +# test_cases/ckb2023 \ test_cases := \ - test_cases/replace_rpc \ test_cases/ckb_cli \ - test_cases/ckb2023 \ test_cases/contracts \ test_cases/example \ test_cases/framework \ diff --git a/download.py b/download.py index d0ec8a51..fec05bbe 100644 --- a/download.py +++ b/download.py @@ -12,22 +12,10 @@ from tqdm import tqdm versions = [ - "0.109.0", - "0.110.2", - "0.111.0", - "0.112.1", - "0.113.1", - "0.114.0", - "0.115.0", - "0.116.1", - "0.117.0", - "0.118.0", - "0.119.0", - "0.120.0", - "0.121.0", "0.200.0", "0.201.0", "0.202.0", + "0.203.0-rc1", ] # Replace with your versions DOWNLOAD_DIR = "download" diff --git a/download_ckb_light_client.py b/download_ckb_light_client.py index 31c791f4..a52b119d 100644 --- a/download_ckb_light_client.py +++ b/download_ckb_light_client.py @@ -13,16 +13,8 @@ versions = [ - "0.2.4", - "0.3.0", - "0.3.1", - "0.3.2", - "0.3.3", - "0.3.4", - "0.3.5", - "0.3.6", - "0.4.1", "0.5.0", + "0.5.3", ] # Replace with your versions DOWNLOAD_DIR = "download" diff --git a/framework/basic.py b/framework/basic.py index 80f7fd4d..f47c4d4f 100644 --- a/framework/basic.py +++ b/framework/basic.py @@ -12,6 +12,8 @@ import framework.test_cluster import framework.config import shutil + +from framework.test_node import DOCKER from framework.util import get_project_root @@ -56,3 +58,7 @@ def teardown_method(self, method): f"{get_project_root()}/tmp", f"{get_project_root()}/report/{method.__name__}", ) + + @staticmethod + def skip_docker(): + return DOCKER diff --git a/framework/helper/ckb_cli.py b/framework/helper/ckb_cli.py index d982bc60..8b96bd26 100644 --- a/framework/helper/ckb_cli.py +++ b/framework/helper/ckb_cli.py @@ -13,33 +13,6 @@ cli_path = f"cd {get_project_root()}/source && ./ckb-cli" -def exception_use_old_ckb(): - def decorator(func): - @wraps(func) - def wrapper(*args, **kwargs): - try: - return func(*args, **kwargs) - except Exception as e: - if "SoftFork" in str(e): - global cli_path - cli_path = f"cd {get_project_root()}/source && ./ckb-cli-old" - print("------ change use old ckb-cli -------") - try: - ret = func(*args, **kwargs) - cli_path = f"cd {get_project_root()}/source && ./ckb-cli" - return ret - except Exception as e: - cli_path = f"cd {get_project_root()}/source && ./ckb-cli" - raise e - else: - raise e - - return wrapper - - return decorator - - -@exception_use_old_ckb() def wallet_get_capacity(ckb_address, api_url="http://127.0.0.1:8114"): """ 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"): Exception(f"Number not found :{capacity_response}") -@exception_use_old_ckb() def wallet_get_live_cells(ckb_address, api_url="http://127.0.0.1:8114"): """ ./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"): return json.loads(run_command(cmd)) -@exception_use_old_ckb() def wallet_transfer_by_private_key( private_key, to_ckb_address, @@ -642,6 +613,7 @@ def get_deploy_toml_config(account_private, contract_bin_path, enable_type_id): [[dep_groups]] name = "my_dep_group" +enable_type_id = {str(enable_type_id).lower()} cells = [] [lock] diff --git a/framework/helper/contract.py b/framework/helper/contract.py index 0362184c..3d0e68dc 100644 --- a/framework/helper/contract.py +++ b/framework/helper/contract.py @@ -21,7 +21,6 @@ def get_arg_and_data(self, key) -> (str, str): pass -@exception_use_old_ckb() def deploy_ckb_contract( private_key, contract_path, @@ -79,7 +78,6 @@ def deploy_ckb_contract( return run_command(cmd).replace("\n", "") -@exception_use_old_ckb() def get_ckb_contract_codehash( tx_hash, tx_index, enable_type_id=True, api_url="http://127.0.0.1:8114" ): @@ -110,7 +108,6 @@ def get_ckb_contract_codehash( return f"0x{hex_digest}" -@exception_use_old_ckb() def invoke_ckb_contract( account_private, contract_out_point_tx_hash, @@ -260,7 +257,6 @@ def invoke_ckb_contract( return tx_send(tmp_tx_file, api_url).strip() -@exception_use_old_ckb() def build_invoke_ckb_contract( account_private, contract_out_point_tx_hash, diff --git a/framework/test_light_client.py b/framework/test_light_client.py index a3b60023..6085a7e6 100644 --- a/framework/test_light_client.py +++ b/framework/test_light_client.py @@ -6,44 +6,6 @@ class CkbLightClientConfigPath(Enum): - V0_2_4 = ( - "source/template/ckb_light_client/0.2.4/testnet.toml.j2", - "download/0.2.4/ckb-light-client", - ) - V0_3_0 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.0/ckb-light-client", - ) - V0_3_1 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.1/ckb-light-client", - ) - V0_3_2 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.2/ckb-light-client", - ) - V0_3_3 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.3/ckb-light-client", - ) - V0_3_4 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.4/ckb-light-client", - ) - V0_3_5 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.5/ckb-light-client", - ) - V0_3_6 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.3.6/ckb-light-client", - ) - - V0_4_1 = ( - "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.4.2/ckb-light-client", - ) - V0_5_0 = ( "source/template/ckb_light_client/0.3.0/testnet.toml.j2", "download/0.5.0/ckb-light-client", @@ -51,7 +13,7 @@ class CkbLightClientConfigPath(Enum): CURRENT_TEST = ( "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.5.0/ckb-light-client", + "download/0.5.3/ckb-light-client", ) def __init__(self, ckb_light_client_config_path, ckb_light_bin_path): diff --git a/framework/test_node.py b/framework/test_node.py index 7780dc79..83eea38b 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -11,173 +11,28 @@ import shutil import telnetlib from websocket import create_connection, WebSocket +import os -class CkbNodeConfigPath(Enum): - CURRENT_TEST = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/ckb/v200/specs/dev.toml", - "download/0.202.0", - ) - TESTNET = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/specs/testnet.toml.j2", - "download/0.202.0", - ) - - CURRENT_MAIN = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/specs/mainnet.toml.j2", - "download/0.202.0", - ) - - PREVIEW_DUMMY = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/specs/preview_dev.toml", - "download/0.202.0", - ) - - v202 = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/ckb/v200/specs/dev.toml", - "download/0.202.0", - ) - - v201 = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/ckb/v200/specs/dev.toml", - "download/0.201.0", - ) - - v200 = ( - "source/template/ckb/v200/ckb.toml.j2", - "source/template/ckb/v200/ckb-miner.toml.j2", - "source/template/ckb/v200/specs/dev.toml", - "download/0.200.0", - ) - - v121 = ( - "source/template/ckb/v121/ckb.toml.j2", - "source/template/ckb/v121/ckb-miner.toml.j2", - "source/template/ckb/v121/specs/dev.toml", - "download/0.121.0", - ) - - v120 = ( - "source/template/ckb/v120/ckb.toml.j2", - "source/template/ckb/v120/ckb-miner.toml.j2", - "source/template/ckb/v120/specs/dev.toml", - "download/0.120.0", - ) - - v119 = ( - "source/template/ckb/v118/ckb.toml.j2", - "source/template/ckb/v118/ckb-miner.toml.j2", - "source/template/ckb/v118/specs/dev.toml", - "download/0.119.0", - ) - - v118 = ( - "source/template/ckb/v118/ckb.toml.j2", - "source/template/ckb/v118/ckb-miner.toml.j2", - "source/template/ckb/v118/specs/dev.toml", - "download/0.118.0", - ) - - v117 = ( - "source/template/ckb/v117/ckb.toml.j2", - "source/template/ckb/v117/ckb-miner.toml.j2", - "source/template/ckb/v117/specs/dev.toml", - "download/0.117.0", - ) - - v116 = ( - "source/template/ckb/v116/ckb.toml.j2", - "source/template/ckb/v116/ckb-miner.toml.j2", - "source/template/ckb/v116/specs/dev.toml", - "download/0.116.1", - ) - v115 = ( - "source/template/ckb/v115/ckb.toml.j2", - "source/template/ckb/v115/ckb-miner.toml.j2", - "source/template/ckb/v115/specs/dev.toml", - "download/0.115.0", - ) - v114 = ( - "source/template/ckb/v114/ckb.toml.j2", - "source/template/ckb/v114/ckb-miner.toml.j2", - "source/template/ckb/v114/specs/dev.toml", - "download/0.114.0", - ) - - V113 = ( - "source/template/ckb/v113/ckb.toml.j2", - "source/template/ckb/v113/ckb-miner.toml.j2", - "source/template/ckb/v113/specs/dev.toml", - "download/0.113.1", - ) - - V112 = ( - "source/template/ckb/v112/ckb.toml.j2", - "source/template/ckb/v112/ckb-miner.toml.j2", - "source/template/ckb/v112/specs/dev.toml", - "download/0.112.1", - ) - - V112_MAIN = ( - "source/template/ckb/v112/ckb.toml.j2", - "source/template/ckb/v112/ckb-miner.toml.j2", - "source/template/specs/mainnet.toml.j2", - "download/0.112.1", - ) - - V111 = ( - "source/template/ckb/v111/ckb.toml.j2", - "source/template/ckb/v111/ckb-miner.toml.j2", - "source/template/ckb/v111/specs/dev.toml", - "download/0.111.0", - ) - V110 = ( - "source/template/ckb/v110/ckb.toml.j2", - "source/template/ckb/v110/ckb-miner.toml.j2", - "source/template/ckb/v110/specs/dev.toml", - "download/0.110.2", - ) - - V110_MAIN = ( - "source/template/ckb/v110/ckb.toml.j2", - "source/template/ckb/v110/ckb-miner.toml.j2", - "source/template/specs/mainnet.toml.j2", - "download/0.110.2", - ) - V110_TEST = ( - "source/template/ckb/v110/ckb.toml.j2", - "source/template/ckb/v110/ckb-miner.toml.j2", - "source/template/specs/testnet.toml.j2", - "download/0.110.2", - ) - - V109 = ( - "source/template/ckb/v109/ckb.toml.j2", - "source/template/ckb/v109/ckb-miner.toml.j2", - "source/template/ckb/v109/specs/dev.toml", - "download/0.109.0", - ) - - V109_MAIN = ( - "source/template/ckb/v109/ckb.toml.j2", - "source/template/ckb/v109/ckb-miner.toml.j2", - "source/template/specs/mainnet.toml.j2", - "download/0.109.0", - ) - - v108 = ("", "", "", "") +DOCKER = os.getenv("DOCKER", False) +DOCKER_CKB_VERSION = os.getenv("DOCKER_CKB_VERSION", "nervos/ckb:v0.202.0-rc1") + + + +DOCKER = os.getenv("DOCKER", False) +DOCKER_CKB_VERSION = os.getenv("DOCKER_CKB_VERSION", "nervos/ckb:v0.203.0-rc1") + + +class CkbNodeConfigPath: + CURRENT_TEST = None + TESTNET = None + PREVIEW_DUMMY = None + CURRENT_MAIN = None + v202 = None + v201 = None + v200 = None + TESTNET_SPEC_PATH = "source/template/specs/testnet.toml.j2" + MAINNET_SPEC_PATH = "source/template/specs/mainnet.toml.j2" def __init__( self, ckb_config_path, ckb_miner_config_path, ckb_spec_path, ckb_bin_path @@ -191,6 +46,55 @@ def __str__(self): return self.ckb_bin_path.split("/")[-1] +CkbNodeConfigPath.CURRENT_TEST = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/ckb/v200/specs/dev.toml", + "download/0.203.0", +) +CkbNodeConfigPath.TESTNET = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/specs/testnet.toml.j2", + "download/0.203.0", +) + +CkbNodeConfigPath.CURRENT_MAIN = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/specs/mainnet.toml.j2", + "download/0.203.0", +) + +CkbNodeConfigPath.PREVIEW_DUMMY = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/specs/preview_dev.toml", + "download/0.203.0", +) + +CkbNodeConfigPath.v202 = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/ckb/v200/specs/dev.toml", + "download/0.202.0", +) + +CkbNodeConfigPath.v201 = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/ckb/v200/specs/dev.toml", + "download/0.201.0", +) + +CkbNodeConfigPath.v200 = CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + "source/template/ckb/v200/specs/dev.toml", + "download/0.200.0", +) + + class CkbNode: @classmethod def init_dev_by_port( @@ -224,8 +128,12 @@ def __init__( self.ckb_pid = -1 self.ckb_miner_pid = -1 self.rpcUrl = "http://{url}".format( - url=self.ckb_config.get("ckb_rpc_listen_address", "127.0.0.1:8114") + url=self.ckb_config.get("ckb_rpc_listen_address", "127.0.0.1:8114").replace( + "0.0.0.0", "127.0.0.1" + ) ) + print("rpcUrl:", self.rpcUrl) + self.client = RPCClient(self.rpcUrl) def __str__(self): @@ -244,6 +152,14 @@ def get_connected_count(self): def connected(self, node): peer_id = node.get_peer_id() peer_address = node.get_peer_address() + peer_address = peer_address.replace( + "127.0.0.1", node.client.url.split(":")[1].replace("//", "") + ) + if DOCKER and self.ckb_config_path == CkbNodeConfigPath.CURRENT_TEST: + peer_address = peer_address.replace("127.0.0.1", "172.17.0.1") + print( + f"add node peer_address:{peer_address} self.ckb_config_path:{self.ckb_config_path}" + ) print("add node response:", self.getClient().add_node(peer_id, peer_address)) def connected_ws(self, node): @@ -282,13 +198,36 @@ def restart(self, config={}, clean_data=False): self.start() def start(self): + time.sleep(1) + if DOCKER and self.ckb_config_path == CkbNodeConfigPath.CURRENT_TEST: + p2p_port = self.ckb_config["ckb_network_listen_addresses"][0].split("/")[-1] + rpc_port = self.ckb_config["ckb_rpc_listen_address"].split(":")[-1] + # --network host + # self.ckb_pid = run_command( + # f"docker run -p {p2p_port}:{p2p_port} -p {rpc_port}:{rpc_port} --add-host=host.docker.internal:host-gateway -v {self.ckb_dir}:/var/lib/ckb nervos/ckb:v0.202.0-rc1 run -C /var/lib/ckb " + # f"--indexer --skip-spec-check > {self.ckb_dir}/node.log 2>&1 &" + # ) + if self.ckb_config.get("ckb_ws_listen_address") != None: + ws_port = self.ckb_config["ckb_ws_listen_address"].split(":")[-1] + tcp_port = self.ckb_config["ckb_tcp_listen_address"].split(":")[-1] + self.ckb_pid = run_command( + f"docker run --name {self.ckb_dir.split('/')[-1]} -p {p2p_port}:{p2p_port} -p {rpc_port}:{rpc_port} -p {ws_port}:{ws_port} -p {tcp_port}:{tcp_port} --network my-network -v {self.ckb_dir}:/var/lib/ckb {DOCKER_CKB_VERSION} run -C /var/lib/ckb " + f"--indexer --skip-spec-check > {self.ckb_dir}/node.log 2>&1 &" + ) + time.sleep(3) + return + self.ckb_pid = run_command( + f"docker run --name {self.ckb_dir.split('/')[-1]} -p {p2p_port}:{p2p_port} -p {rpc_port}:{rpc_port} --network my-network -v {self.ckb_dir}:/var/lib/ckb {DOCKER_CKB_VERSION} run -C /var/lib/ckb " + f"--indexer --skip-spec-check > {self.ckb_dir}/node.log 2>&1 &" + ) + time.sleep(3) + return version = run_command( "cd {ckb_dir} && ./ckb --version".format(ckb_dir=self.ckb_dir) ) print("\n================= CKB Version =================") print(version.strip()) print("===============================================\n") - self.ckb_pid = run_command( "cd {ckb_dir} && ./ckb run --indexer --skip-spec-check > node.log 2>&1 &".format( ckb_dir=self.ckb_dir @@ -303,6 +242,29 @@ def startWithRichIndexer(self): Returns: """ + if DOCKER and self.ckb_config_path == CkbNodeConfigPath.CURRENT_TEST: + p2p_port = self.ckb_config["ckb_network_listen_addresses"][0].split("/")[-1] + rpc_port = self.ckb_config["ckb_rpc_listen_address"].split(":")[-1] + # --network host + # self.ckb_pid = run_command( + # f"docker run -p {p2p_port}:{p2p_port} -p {rpc_port}:{rpc_port} --add-host=host.docker.internal:host-gateway -v {self.ckb_dir}:/var/lib/ckb nervos/ckb:v0.202.0-rc1 run -C /var/lib/ckb " + # f"--indexer --skip-spec-check > {self.ckb_dir}/node.log 2>&1 &" + # ) + if self.ckb_config.get("ckb_ws_listen_address") != None: + ws_port = self.ckb_config["ckb_ws_listen_address"].split(":")[-1] + tcp_port = self.ckb_config["ckb_tcp_listen_address"].split(":")[-1] + self.ckb_pid = run_command( + f"docker run --name {self.ckb_dir.split('/')[-1]} -p {p2p_port}:{p2p_port} -p {rpc_port}:{rpc_port} -p {ws_port}:{ws_port} -p {tcp_port}:{tcp_port} -v {self.ckb_dir}:/var/lib/ckb {DOCKER_CKB_VERSION} run -C /var/lib/ckb " + f" --rich-indexer --skip-spec-check > {self.ckb_dir}/node.log 2>&1 &" + ) + time.sleep(3) + return + self.ckb_pid = run_command( + f"docker run --name {self.ckb_dir.split('/')[-1]} -p {p2p_port}:{p2p_port} -p {rpc_port}:{rpc_port} -v {self.ckb_dir}:/var/lib/ckb {DOCKER_CKB_VERSION} run -C /var/lib/ckb " + f" --rich-indexer --skip-spec-check > {self.ckb_dir}/node.log 2>&1 &" + ) + time.sleep(3) + return self.ckb_pid = run_command( "cd {ckb_dir} && ./ckb run --rich-indexer --skip-spec-check > node.log 2>&1 &".format( ckb_dir=self.ckb_dir @@ -314,9 +276,21 @@ def stop(self): self.stop_miner() # run_command("kill {pid}".format(pid=self.ckb_pid)) # self.ckb_pid = -1 + if DOCKER and self.ckb_config_path == CkbNodeConfigPath.CURRENT_TEST: + run_command( + f"docker stop {self.ckb_dir.split('/')[-1]}", check_exit_code=False + ) + run_command( + f"docker rm {self.ckb_dir.split('/')[-1]}", check_exit_code=False + ) + time.sleep(3) + return port = self.rpcUrl.split(":")[-1] - run_command(f"kill $(lsof -t -i:{port})", check_exit_code=False) + run_command( + f"kill $(lsof -i:{port} | grep LISTEN | awk '{{print $2}}')", + check_exit_code=False, + ) self.ckb_pid = -1 time.sleep(3) @@ -355,7 +329,7 @@ def prepare( root_path=get_project_root(), spec_path=self.ckb_config_path.ckb_spec_path, ), - self.ckb_dir, + "{ckb_dir}/dev.toml".format(ckb_dir=self.ckb_dir), ) shutil.copy( @@ -412,6 +386,7 @@ def subscribe_telnet(self, topic, other_url=None) -> telnetlib.Telnet: if "ckb_tcp_listen_address" not in self.ckb_config.keys(): raise Exception("not set ckb_ws_listen_address") ckb_tcp_listen_address = self.ckb_config["ckb_tcp_listen_address"] + ckb_tcp_listen_address = ckb_tcp_listen_address.replace("0.0.0.0", "127.0.0.1") if other_url is not None: ckb_tcp_listen_address = other_url # get host @@ -419,6 +394,7 @@ def subscribe_telnet(self, topic, other_url=None) -> telnetlib.Telnet: # get port port = ckb_tcp_listen_address.split(":")[1] # new telnet + print(f"host:{host},port:{port}") tn = telnetlib.Telnet(host, int(port)) print("----") topic_str = ( @@ -443,6 +419,8 @@ def subscribe_websocket(self, topic, other_url=None) -> WebSocket: else: ckb_ws_listen_address = self.ckb_config["ckb_ws_listen_address"] print(ckb_ws_listen_address) + ckb_ws_listen_address = ckb_ws_listen_address.replace("0.0.0.0", "127.0.0.1") + ws = create_connection(f"ws://{ckb_ws_listen_address}") topic_str = ( '{"id": 2, "jsonrpc": "2.0", "method": "subscribe", "params": ["' diff --git a/framework/util.py b/framework/util.py index f2355b86..7a927592 100644 --- a/framework/util.py +++ b/framework/util.py @@ -34,7 +34,7 @@ def get_ckb_configs(p2p_port, rpc_port, spec='{ file = "dev.toml" }'): "ckb_network_listen_addresses": [ "/ip4/0.0.0.0/tcp/{p2p_port}".format(p2p_port=p2p_port) ], - "ckb_rpc_listen_address": "127.0.0.1:{rpc_port}".format(rpc_port=rpc_port), + "ckb_rpc_listen_address": "0.0.0.0:{rpc_port}".format(rpc_port=rpc_port), "ckb_rpc_modules": [ "Net", "Pool", diff --git a/prepare.sh b/prepare.sh index c32e7171..926f4b91 100644 --- a/prepare.sh +++ b/prepare.sh @@ -1,11 +1,10 @@ set -e - git clone https://github.com/nervosnetwork/ckb-cli.git - cd ckb-cli - git checkout develop - make prod - cp target/release/ckb-cli ../source/ckb-cli - cd ../ - cp download/0.110.2/ckb-cli ./source/ckb-cli-old +# git clone https://github.com/nervosnetwork/ckb-cli.git +# cd ckb-cli +# git checkout develop +# make prod +# cp target/release/ckb-cli ../source/ckb-cli +cp download/0.203.0/ckb-cli ./source/ckb-cli #cp download/0.117.0/ckb-cli ./source/ckb-cli #git clone https://github.com/quake/ckb-light-client.git #cd ckb-light-client diff --git a/source/template/ckb/v109/ckb-miner.toml.j2 b/source/template/ckb/v109/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v109/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v109/ckb.toml.j2 b/source/template/ckb/v109/ckb.toml.j2 deleted file mode 100644 index c633dbcb..00000000 --- a/source/template/ckb/v109/ckb.toml.j2 +++ /dev/null @@ -1,172 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -# tcp_listen_address = "127.0.0.1:18114" -# ws_listen_address = "127.0.0.1:28114" -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v109/specs/benchmark-spec.toml b/source/template/ckb/v109/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v109/specs/dev.toml b/source/template/ckb/v109/specs/dev.toml deleted file mode 100644 index 70d94fb2..00000000 --- a/source/template/ckb/v109/specs/dev.toml +++ /dev/null @@ -1,106 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 20 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -rfc_0028 = 0 -rfc_0029 = 0 -rfc_0030 = 0 -rfc_0031 = 0 -rfc_0032 = 0 -rfc_0036 = 0 -rfc_0038 = 0 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v109/specs/mainnet.toml b/source/template/ckb/v109/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v109/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v109/specs/testnet.toml b/source/template/ckb/v109/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v109/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v110/ckb-miner.toml.j2 b/source/template/ckb/v110/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v110/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v110/ckb.toml.j2 b/source/template/ckb/v110/ckb.toml.j2 deleted file mode 100644 index 83a04bda..00000000 --- a/source/template/ckb/v110/ckb.toml.j2 +++ /dev/null @@ -1,179 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -# tcp_listen_address = "127.0.0.1:18114" -# ws_listen_address = "127.0.0.1:28114" -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v110/default.db-options b/source/template/ckb/v110/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v110/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v110/specs/benchmark-spec.toml b/source/template/ckb/v110/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v110/specs/dev.toml b/source/template/ckb/v110/specs/dev.toml deleted file mode 100644 index f0c33b1c..00000000 --- a/source/template/ckb/v110/specs/dev.toml +++ /dev/null @@ -1,107 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true -starting_block_limiting_dao_withdrawing_lock = 0 - -[params.hardfork] -rfc_0028 = 0 -rfc_0029 = 0 -rfc_0030 = 0 -rfc_0031 = 0 -rfc_0032 = 0 -rfc_0036 = 0 -rfc_0038 = 0 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v110/specs/mainnet.toml b/source/template/ckb/v110/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v110/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v110/specs/testnet.toml b/source/template/ckb/v110/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v110/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v111/ckb-miner.toml.j2 b/source/template/ckb/v111/ckb-miner.toml.j2 deleted file mode 100644 index 6b1510a0..00000000 --- a/source/template/ckb/v111/ckb-miner.toml.j2 +++ /dev/null @@ -1,46 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} -# listen = "{{ ckb_miner_listen }}" - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = {{ ckb_worker_value | default("1000") }} -#{% endif %} diff --git a/source/template/ckb/v111/ckb.toml.j2 b/source/template/ckb/v111/ckb.toml.j2 deleted file mode 100644 index 5f721c65..00000000 --- a/source/template/ckb/v111/ckb.toml.j2 +++ /dev/null @@ -1,180 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - -# [metrics.exporter.prometheus] -# target = { type = "prometheus", listen_address = "{{ ckb_prometheus_listen_address | default("127.0.0.1:8100") }}" } -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -# tcp_listen_address = "127.0.0.1:18114" -# ws_listen_address = "127.0.0.1:28114" -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" -# notify = ["{{ ckb_block_assembler_notify }}"] diff --git a/source/template/ckb/v111/default.db-options b/source/template/ckb/v111/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v111/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v111/specs/benchmark-spec.toml b/source/template/ckb/v111/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v111/specs/dev.toml b/source/template/ckb/v111/specs/dev.toml deleted file mode 100644 index 542e4af1..00000000 --- a/source/template/ckb/v111/specs/dev.toml +++ /dev/null @@ -1,101 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 1_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true -starting_block_limiting_dao_withdrawing_lock = 0 - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v111/specs/mainnet.toml b/source/template/ckb/v111/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v111/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v111/specs/testnet.toml b/source/template/ckb/v111/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v111/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v112/ckb-miner.toml.j2 b/source/template/ckb/v112/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v112/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v112/ckb.toml.j2 b/source/template/ckb/v112/ckb.toml.j2 deleted file mode 100644 index 6aa00b28..00000000 --- a/source/template/ckb/v112/ckb.toml.j2 +++ /dev/null @@ -1,186 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v112/default.db-options b/source/template/ckb/v112/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v112/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v112/specs/benchmark-spec.toml b/source/template/ckb/v112/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v112/specs/dev.toml b/source/template/ckb/v112/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v112/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v112/specs/mainnet.toml b/source/template/ckb/v112/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v112/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v112/specs/testnet.toml b/source/template/ckb/v112/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v112/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v113/ckb-miner.toml.j2 b/source/template/ckb/v113/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v113/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v113/ckb.toml.j2 b/source/template/ckb/v113/ckb.toml.j2 deleted file mode 100644 index 7ac04648..00000000 --- a/source/template/ckb/v113/ckb.toml.j2 +++ /dev/null @@ -1,187 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v113/default.db-options b/source/template/ckb/v113/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v113/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v113/specs/benchmark-spec.toml b/source/template/ckb/v113/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v113/specs/dev.toml b/source/template/ckb/v113/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v113/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v113/specs/mainnet.toml b/source/template/ckb/v113/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v113/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v113/specs/testnet.toml b/source/template/ckb/v113/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v113/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v114/ckb-miner.toml.j2 b/source/template/ckb/v114/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v114/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v114/ckb.toml.j2 b/source/template/ckb/v114/ckb.toml.j2 deleted file mode 100644 index bd52354b..00000000 --- a/source/template/ckb/v114/ckb.toml.j2 +++ /dev/null @@ -1,204 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false -# # Customize block filtering rules to index only retained blocks -#block_filter = "block.header.number.to_uint() >= \"0x0\".to_uint()" -# # Customize cell filtering rules to index only retained cells -#cell_filter = "let script = output.type;script!=() && script.code_hash == \"0x00000000000000000000000000000000000000000000000000545950455f4944\"" -# # The initial tip can be set higher than the current indexer tip as the starting height for indexing. -# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44" -# -# # CKB rich-indexer has its unique configuration. -#[indexer_v2.rich_indexer] -# # By default, it uses an embedded SQLite database. -# # Alternatively, you can set up a PostgreSQL database service and provide the connection parameters. -# db_type = "postgres" -# db_name = "ckb-rich-indexer" -# db_host = "127.0.0.1" -# db_port = 5432 -# db_user = "postgres" -# db_password = "123456" - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v114/default.db-options b/source/template/ckb/v114/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v114/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v114/specs/benchmark-spec.toml b/source/template/ckb/v114/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v114/specs/dev.toml b/source/template/ckb/v114/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v114/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v114/specs/mainnet.toml b/source/template/ckb/v114/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v114/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v114/specs/testnet.toml b/source/template/ckb/v114/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v114/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v115/ckb-miner.toml.j2 b/source/template/ckb/v115/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v115/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v115/ckb.toml.j2 b/source/template/ckb/v115/ckb.toml.j2 deleted file mode 100644 index bd52354b..00000000 --- a/source/template/ckb/v115/ckb.toml.j2 +++ /dev/null @@ -1,204 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - -# [notifier] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false -# # Customize block filtering rules to index only retained blocks -#block_filter = "block.header.number.to_uint() >= \"0x0\".to_uint()" -# # Customize cell filtering rules to index only retained cells -#cell_filter = "let script = output.type;script!=() && script.code_hash == \"0x00000000000000000000000000000000000000000000000000545950455f4944\"" -# # The initial tip can be set higher than the current indexer tip as the starting height for indexing. -# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44" -# -# # CKB rich-indexer has its unique configuration. -#[indexer_v2.rich_indexer] -# # By default, it uses an embedded SQLite database. -# # Alternatively, you can set up a PostgreSQL database service and provide the connection parameters. -# db_type = "postgres" -# db_name = "ckb-rich-indexer" -# db_host = "127.0.0.1" -# db_port = 5432 -# db_user = "postgres" -# db_password = "123456" - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v115/default.db-options b/source/template/ckb/v115/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v115/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v115/specs/benchmark-spec.toml b/source/template/ckb/v115/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v115/specs/dev.toml b/source/template/ckb/v115/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v115/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v115/specs/mainnet.toml b/source/template/ckb/v115/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v115/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v115/specs/testnet.toml b/source/template/ckb/v115/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v115/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v116/ckb-miner.toml.j2 b/source/template/ckb/v116/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v116/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v116/ckb.toml.j2 b/source/template/ckb/v116/ckb.toml.j2 deleted file mode 100644 index 968f3ee7..00000000 --- a/source/template/ckb/v116/ckb.toml.j2 +++ /dev/null @@ -1,206 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - - -# [notify] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false -# # Customize block filtering rules to index only retained blocks -#block_filter = "block.header.number.to_uint() >= \"0x0\".to_uint()" -# # Customize cell filtering rules to index only retained cells -#cell_filter = "let script = output.type;script!=() && script.code_hash == \"0x00000000000000000000000000000000000000000000000000545950455f4944\"" -# # The initial tip can be set higher than the current indexer tip as the starting height for indexing. -# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44" -# -# # CKB rich-indexer has its unique configuration. -#[indexer_v2.rich_indexer] -# # By default, it uses an embedded SQLite database. -# # Alternatively, you can set up a PostgreSQL database service and provide the connection parameters. -# db_type = "postgres" -# db_name = "ckb-rich-indexer" -# db_host = "127.0.0.1" -# db_port = 5432 -# db_user = "postgres" -# db_password = "123456" - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v116/default.db-options b/source/template/ckb/v116/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v116/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v116/specs/benchmark-spec.toml b/source/template/ckb/v116/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v116/specs/dev.toml b/source/template/ckb/v116/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v116/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v116/specs/mainnet.toml b/source/template/ckb/v116/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v116/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v116/specs/testnet.toml b/source/template/ckb/v116/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v116/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v117/ckb-miner.toml.j2 b/source/template/ckb/v117/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v117/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v117/ckb.toml.j2 b/source/template/ckb/v117/ckb.toml.j2 deleted file mode 100644 index 968f3ee7..00000000 --- a/source/template/ckb/v117/ckb.toml.j2 +++ /dev/null @@ -1,206 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - - -# [notify] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] -# -# [indexer_v2] -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false -# # Customize block filtering rules to index only retained blocks -#block_filter = "block.header.number.to_uint() >= \"0x0\".to_uint()" -# # Customize cell filtering rules to index only retained cells -#cell_filter = "let script = output.type;script!=() && script.code_hash == \"0x00000000000000000000000000000000000000000000000000545950455f4944\"" -# # The initial tip can be set higher than the current indexer tip as the starting height for indexing. -# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44" -# -# # CKB rich-indexer has its unique configuration. -#[indexer_v2.rich_indexer] -# # By default, it uses an embedded SQLite database. -# # Alternatively, you can set up a PostgreSQL database service and provide the connection parameters. -# db_type = "postgres" -# db_name = "ckb-rich-indexer" -# db_host = "127.0.0.1" -# db_port = 5432 -# db_user = "postgres" -# db_password = "123456" - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v117/default.db-options b/source/template/ckb/v117/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v117/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v117/specs/benchmark-spec.toml b/source/template/ckb/v117/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v117/specs/dev.toml b/source/template/ckb/v117/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v117/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v117/specs/mainnet.toml b/source/template/ckb/v117/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v117/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v117/specs/testnet.toml b/source/template/ckb/v117/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v117/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v118/ckb-miner.toml.j2 b/source/template/ckb/v118/ckb-miner.toml.j2 deleted file mode 100644 index 6c29b129..00000000 --- a/source/template/ckb/v118/ckb-miner.toml.j2 +++ /dev/null @@ -1,45 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}" - -[chain] -{# Choose the kind of chains to run, possible values: #} -{# - { file = "specs/dev.toml" } #} -{# - { bundled = "specs/testnet.toml" } #} -{# - { bundled = "specs/mainnet.toml" } #} -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_miner_logger_filter | default("info") }}" -color = {{ ckb_miner_logger_color | default("true") }} -log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }} - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_miner_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}" - -[miner.client] -rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}" -block_on_submit = {{ ckb_miner_block_on_submit | default("true") }} - -# block template polling interval in milliseconds -poll_interval = {{ ckb_miner_poll_interval | default("1000") }} - -#{% if ckb_miner_workers is defined %} -# {% for worker in ckb_miner_workers %} -# [[miner.workers]] -# worker_type = "{{ worker.worker_type }}" -# delay_type = "{{ worker.delay_type }}" -# value = {{ worker.value }} -# {% endfor %} -#{% else %} -[[miner.workers]] -worker_type = "Dummy" -delay_type = "Constant" -value = 1000 -#{% endif %} diff --git a/source/template/ckb/v118/ckb.toml.j2 b/source/template/ckb/v118/ckb.toml.j2 deleted file mode 100644 index 1c99162c..00000000 --- a/source/template/ckb/v118/ckb.toml.j2 +++ /dev/null @@ -1,219 +0,0 @@ -# Config generated by `ckb init --chain dev` - -data_dir = "{{ ckb_data_dir | default("data") }}" - - -[chain] -# Choose the kind of chains to run, possible values: -# - { file = "specs/dev.toml" } -# - { bundled = "specs/testnet.toml" } -# - { bundled = "specs/mainnet.toml" } -spec = {{ ckb_chain_spec }} - - -[logger] -filter = "{{ ckb_logger_filter | default("info") }}" -color = {{ ckb_logger_color | default("true") }} -log_to_file = {{ ckb_logger_log_to_file | default("true") }} -log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }} - - -[sentry] -# set to blank to disable sentry error collection -dsn = "{{ ckb_sentry_dsn | default("") }}" -# if you are willing to help us to improve, -# please leave a way to contact you when we have troubles to reproduce the errors. -org_contact = "{{ ckb_sentry_org_contact | default("") }}" - - -# # **Experimental** Monitor memory changes. -# [memory_tracker] -# # Seconds between checking the process, 0 is disable, default is 0. -# interval = 600 - -[db] -# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB. -# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0. -# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file, -# however, we strongly discourage this setting, it may lead to severe performance degradation. -cache_size = {{ ckb_db_cache_size | default("134217728") }} - -# Provide an options file to tune RocksDB for your workload and your system configuration. -# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide). -options_file = "{{ ckb_db_options_file | default("default.db-options") }}" - -[network] -listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }} -### Specify the public and routable network addresses -public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }} - -# Node connects to nodes listed here to discovery other peers when there's no local stored peers. -# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. -bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }} - -### Whitelist-only mode -whitelist_only = {{ ckb_network_whitelist_only | default("false") }} -### Whitelist peers connecting from the given IP addresses -whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }} -### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet -# reuse_port_on_linux = true - -max_peers = {{ ckb_network_max_peers | default(125) }} -max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }} -# 2 minutes -ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }} -# 20 minutes -ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }} -connect_outbound_interval_secs = 15 -# If set to true, try to register upnp -upnp = {{ ckb_network_upnp | default("false") }} -# If set to true, network service will add discovered local address to peer store, it's helpful for private net development -discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }} -# If set to true, random cleanup when there are too many inbound nodes -# Ensure that itself can continue to serve as a bootnode node -bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }} - -# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional -support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] - -# [network.sync.header_map] -# memory_limit = "600MB" - -[rpc] -# By default RPC only binds to localhost, thus it only allows accessing from the same machine. -# -# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged. -# Please strictly limit the access to only trusted machines. -listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}" - -# Default is 10MiB = 10 * 1024 * 1024 -max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }} - -# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"] -#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"] -modules = {{ ckb_rpc_modules | to_json }} - -# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket. -#{% if ckb_tcp_listen_address is defined %} -tcp_listen_address = "{{ ckb_tcp_listen_address }}" -#{% endif %} - -#{% if ckb_ws_listen_address is defined %} -ws_listen_address = "{{ ckb_ws_listen_address }}" -#{% endif %} - -reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }} - -# By default deprecated rpc methods are disabled. -enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }} - - -{% if ckb_rpc_batch_limit is defined %} -rpc_batch_limit = {{ ckb_rpc_batch_limit | default("2000") }} -{% endif %} - - -[tx_pool] -max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }} -min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }} -max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }} -max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }} -min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }} - - -[store] -header_cache_size = {{ ckb_store_header_cache_size | default("4096")}} -cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}} -block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}} -block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}} -block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}} - - -# [notify] -# # Execute command when the new tip block changes, first arg is block hash. -# new_block_notify_script = "your_new_block_notify_script.sh" -# # Execute command when node received an network alert, first arg is alert message string. -# network_alert_notify_script = "your_network_alert_notify_script.sh" - - -# Set the lock script to protect mined CKB. -# -# CKB uses CS architecture for miner. Miner process (ckb miner) gets block -# template from the Node process (ckb run) via RPC. Thus the lock script is -# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect -# after restarting Node process. -# -# The `code_hash` identifies different cryptography algorithm. Read the manual -# of the lock script provider about how to generate this config. -# -# CKB provides an secp256k1 implementation, it requires a hash on the -# compressed public key. The hash algorithm is blake2b, with personal -# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg. -# -# You can use any tool you trust to generate a Bitcoin private key and public -# key pair, which can be used in CKB as well. CKB CLI provides the function for -# you to convert the public key into block assembler configuration parameters. -# -# Here is an example using ckb-cli to generate an account, this command will -# print the block assembler args(lock_arg) to screen: -# -# ckb-cli account new -# -# If you already have a raw secp256k1 private key, you can get the lock_arg by: -# -# ckb-cli util key-info --privkey-path -# -# The command `ckb init` also accepts options to generate the block assembler -# directly. See `ckb init --help` for details. -# -# ckb init -# -# secp256k1_blake160_sighash_all example: -# [block_assembler] -# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -# args = "ckb-cli util blake2b --prefix-160 " -# hash_type = "type" -# message = "A 0x-prefixed hex string" -# # -# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it) -# use_binary_version_as_message_prefix = true -# # -# # Block assembler will notify new block template through http post to specified endpoints when update -# notify = ["http://127.0.0.1:8888"] -# # Or you may want use more flexible scripts, block template as arg. -# notify_scripts = ["{cmd} {blocktemplate}"] - - -{% if ckb_request_limit is defined %} -[indexer_v2] -request_limit = {{ ckb_request_limit | default("400") }} -{% endif %} - - - -# # Indexing the pending txs in the ckb tx-pool -# index_tx_pool = false -# # Customize block filtering rules to index only retained blocks -#block_filter = "block.header.number.to_uint() >= \"0x0\".to_uint()" -# # Customize cell filtering rules to index only retained cells -#cell_filter = "let script = output.type;script!=() && script.code_hash == \"0x00000000000000000000000000000000000000000000000000545950455f4944\"" -# # The initial tip can be set higher than the current indexer tip as the starting height for indexing. -# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44" -# -# # CKB rich-indexer has its unique configuration. - -#[indexer_v2.rich_indexer] -# # By default, it uses an embedded SQLite database. -# # Alternatively, you can set up a PostgreSQL database service and provide the connection parameters. -# db_type = "postgres" -# db_name = "ckb-rich-indexer" -# db_host = "127.0.0.1" -# db_port = 5432 -# db_user = "postgres" -# db_password = "123456" - -[block_assembler] -code_hash = "{{ ckb_block_assembler_code_hash }}" -args = "{{ ckb_block_assembler_args }}" -hash_type = "{{ ckb_block_assembler_hash_type }}" -message = "{{ ckb_block_assembler_message }}" diff --git a/source/template/ckb/v118/default.db-options b/source/template/ckb/v118/default.db-options deleted file mode 100644 index bffbdc09..00000000 --- a/source/template/ckb/v118/default.db-options +++ /dev/null @@ -1,22 +0,0 @@ -# This is a RocksDB option file. -# -# For detailed file format spec, please refer to the official documents -# in https://rocksdb.org/docs/ -# - -[DBOptions] -bytes_per_sync=1048576 -max_background_jobs=6 -max_total_wal_size=134217728 -keep_log_file_num=32 - -[CFOptions "default"] -level_compaction_dynamic_level_bytes=true -write_buffer_size=8388608 -min_write_buffer_number_to_merge=1 -max_write_buffer_number=2 -max_write_buffer_size_to_maintain=-1 - -[TableOptions/BlockBasedTable "default"] -cache_index_and_filter_blocks=true -pin_l0_filter_and_index_blocks_in_cache=true diff --git a/source/template/ckb/v118/specs/benchmark-spec.toml b/source/template/ckb/v118/specs/benchmark-spec.toml deleted file mode 100644 index e69de29b..00000000 diff --git a/source/template/ckb/v118/specs/dev.toml b/source/template/ckb/v118/specs/dev.toml deleted file mode 100644 index f25a259a..00000000 --- a/source/template/ckb/v118/specs/dev.toml +++ /dev/null @@ -1,100 +0,0 @@ -name = "ckb_dev" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 0 -compact_target = 0x20010000 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "1688032132025" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# issue for random generated private key: d00c06bfd800d27397002dca6fb0993d5ba6399b4238b2f29ee9deb97593d2bc -[[genesis.issued_cells]] -capacity = 20_000_000_000_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" -lock.hash_type = "type" - -# issue for random generated private key: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d -[[genesis.issued_cells]] -capacity = 5_198_735_037_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x470dcdc5e44064909650113a274b3b36aecb6dc7" -lock.hash_type = "type" - -[params] -initial_primary_epoch_reward = 1_917_808_21917808 -secondary_epoch_reward = 613_698_63013698 -max_block_cycles = 10_000_000_000 -cellbase_maturity = 0 -primary_epoch_reward_halving_interval = 8760 -epoch_duration_target = 14400 -genesis_epoch_length = 1000 -# For development and testing purposes only. -# Keep difficulty be permanent if the pow is Dummy. (default: false) -permanent_difficulty_in_dummy = true - -[params.hardfork] -ckb2023 = 1 - -[pow] -func = "Dummy" diff --git a/source/template/ckb/v118/specs/mainnet.toml b/source/template/ckb/v118/specs/mainnet.toml deleted file mode 100644 index daf7edfb..00000000 --- a/source/template/ckb/v118/specs/mainnet.toml +++ /dev/null @@ -1,69 +0,0 @@ -name = "ckb" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1573852190812 -compact_target = 0x1a08a97e -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" - -[genesis.genesis_cell] -message = "lina 0x18e020f6b1237a3d06b75121f25a7efa0550e4b3f44f974822f471902424c104" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - - - -[params] -genesis_epoch_length = 1743 - -[pow] -func = "Eaglesong" \ No newline at end of file diff --git a/source/template/ckb/v118/specs/testnet.toml b/source/template/ckb/v118/specs/testnet.toml deleted file mode 100644 index 2461e535..00000000 --- a/source/template/ckb/v118/specs/testnet.toml +++ /dev/null @@ -1,90 +0,0 @@ -name = "ckb_testnet" - -[genesis] -version = 0 -parent_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -timestamp = 1589276230000 -compact_target = 0x1e015555 -uncles_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -nonce = "0x0" -# run `cargo run list-hashes -b` to get the genesis hash -hash = "0x10639e0895502b5688a6be8cf69460d76541bfa4821629d86d62ba0aae3f9606" - -[genesis.genesis_cell] -message = "aggron-v4" - -[genesis.genesis_cell.lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# An array list paths to system cell files, which is absolute or relative to -# the directory containing this config file. -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_sighash_all" } -create_type_id = true -capacity = 100_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/dao" } -create_type_id = true -capacity = 16_000_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_data" } -create_type_id = false -capacity = 1_048_617_0000_0000 -[[genesis.system_cells]] -file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" } -create_type_id = true -capacity = 100_000_0000_0000 - -[genesis.system_cells_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "data" - -# Dep group cells -[[genesis.dep_groups]] -name = "secp256k1_blake160_sighash_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_sighash_all" }, -] -[[genesis.dep_groups]] -name = "secp256k1_blake160_multisig_all" -files = [ - { bundled = "specs/cells/secp256k1_data" }, - { bundled = "specs/cells/secp256k1_blake160_multisig_all" }, -] - -# For first 11 block -[genesis.bootstrap_lock] -code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -args = "0x" -hash_type = "type" - -# Burn -[[genesis.issued_cells]] -capacity = 8_400_000_000_00000000 -lock.code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000" -lock.args = "0x62e907b15cbf27d5425399ebf6f0fb50ebb88f18" -lock.hash_type = "data" - -# Locks for developers to run tests -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x64257f00b6b63e987609fa9be2d0c86d351020fb" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_345_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x3f1573b44218d4c12a91919a58a863be415a2bc3" -lock.hash_type = "type" -[[genesis.issued_cells]] -capacity = 8_399_578_347_00000000 -lock.code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" -lock.args = "0x57ccb07be6875f61d93636b0ee11b675494627d2" -lock.hash_type = "type" - -[pow] -func = "EaglesongBlake2b" \ No newline at end of file diff --git a/source/template/ckb/v200/specs/dev.toml b/source/template/ckb/v200/specs/dev.toml index f25a259a..cacfd48b 100644 --- a/source/template/ckb/v200/specs/dev.toml +++ b/source/template/ckb/v200/specs/dev.toml @@ -94,7 +94,7 @@ genesis_epoch_length = 1000 permanent_difficulty_in_dummy = true [params.hardfork] -ckb2023 = 1 +ckb2023 = 0 [pow] func = "Dummy" diff --git a/test_cases/ckb2023/test_01_before_hardfork.py b/test_cases/ckb2023/test_01_before_hardfork.py deleted file mode 100644 index ab22ee26..00000000 --- a/test_cases/ckb2023/test_01_before_hardfork.py +++ /dev/null @@ -1,350 +0,0 @@ -import pytest - -from framework.basic import CkbTest - - -class TestBeforeHardFork(CkbTest): - """ - test cases before ckb2023 - """ - - cluster: CkbTest.Cluster - - @classmethod - def setup_class(cls): - """ - 1. start 4 ckb node in tmp/cluster/hardfork/node dir - 2. link ckb node each other - 3. deploy contract - 4. miner 850 block - :return: - """ - # 1. start 4 ckb node in tmp/cluster/hardfork/node dir - nodes = [ - cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.CURRENT_TEST, - f"cluster/hardfork/node{i}", - 8114 + i, - 8225 + i, - ) - for i in range(1, 5) - ] - cls.cluster = cls.Cluster(nodes) - cls.cluster.prepare_all_nodes() - cls.cluster.start_all_nodes() - - # 2. link ckb node each other - cls.cluster.connected_all_nodes() - - # 3. deploy contract - contracts = cls.Contract_util.deploy_contracts( - cls.Config.ACCOUNT_PRIVATE_1, cls.cluster.ckb_nodes[0] - ) - cls.spawn_contract = contracts["SpawnContract"] - - # 4. miner 850 block - cls.Miner.make_tip_height_number(cls.cluster.ckb_nodes[0], 850) - cls.Node.wait_cluster_height(cls.cluster, 850, 100) - - @classmethod - def teardown_class(cls): - """ - stop ckb node - clean ckb node tmp dir - :return: - """ - print("\nTeardown TestClass1") - cls.cluster.stop_all_nodes() - cls.cluster.clean_all_nodes() - - def setup_method(self, method): - """ - 1. check that the current CKB2023 are not activated yet. - :param method: - :return: - """ - super().setup_method(method) - - # 1. check that the current CKB2023 are not activated yet. - current_epoch_result = self.cluster.ckb_nodes[0].getClient().get_current_epoch() - consensus_response = self.cluster.ckb_nodes[0].getClient().get_consensus() - # current epoch < consensus epoch .length - assert int( - current_epoch_result["number"].replace("0x", "") - ) < get_epoch_number_by_consensus_response(consensus_response, "0048") - - def test_01_rfc_0048_in_consensus(self): - """ - 1. Check if the consensus response includes RFC 0048 - - it includes. - :return: - """ - - # 1. Check if the consensus response includes RFC 0048 - consensus_response = self.cluster.ckb_nodes[0].getClient().get_consensus() - epoch_number = get_epoch_number_by_consensus_response( - consensus_response, "0048" - ) - assert epoch_number >= 0 - - def test_02_rfc_0049_in_consensus(self): - """ - 1. Check if the consensus response includes RFC 0049 - - it includes. - :return: - """ - - # 1. Check if the consensus response includes RFC 0049 - consensus_response = self.cluster.ckb_nodes[0].getClient().get_consensus() - epoch_number = get_epoch_number_by_consensus_response( - consensus_response, "0049" - ) - assert epoch_number >= 0 - - def test_03_0048_miner_with_0x0(self): - """ - Before the fork, the miner's block version is 0x0. - 1. miner version:0x0 block - - block mining successful. - :return: - """ - - # 1. miner version is "0x0" block - before_miner_num = self.cluster.ckb_nodes[0].getClient().get_tip_block_number() - self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") - after_miner_num = self.cluster.ckb_nodes[0].getClient().get_tip_block_number() - assert after_miner_num > before_miner_num - - def test_04_0048_miner_with_0x1(self): - """ - Before the fork, the miner's block version is 0x1. will return BlockVersionError - 1. miner version is "0x1" block - - Return error : BlockVersionError - :return: - """ - # 1. miner version is "0x1" block - with pytest.raises(Exception) as exc_info: - self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x1") - expected_error_message = "BlockVersionError" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}" - f"' not found in actual string '{exc_info.value.args[0]}'" - ) - - def test_05_0049_transfer_to_data2_address(self): - """ - Before the fork, send a transaction with type: data2 will return error - 1. check account1 have enough money - account1_capacity > 0 - 2. send capacity to data2 address - - return error : "the feature \"VM Version 2\" is used in current transaction - but not enabled in current chain" - :return: - """ - # 1. check account1 have enough money - account1 = self.Ckb_cli.util_key_info_by_private_key( - self.Config.ACCOUNT_PRIVATE_1 - ) - account1_capacity = self.Ckb_cli.wallet_get_capacity( - account1["address"]["testnet"], self.cluster.ckb_nodes[0].client.url - ) - assert account1_capacity > 0 - - # 2. send capacity to data2 address - # send account 1 transfer data2 - # @ckb-lumos/helpers.encodeToAddress( - # { - # hashType:"data2", - # args:"0x", - # codeHash:"0x69c80d6a8104994bddc132bb568c953d60fae0ac928ad887c96de8434ca2a790" - # } - # ) - # ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0 - with pytest.raises(Exception) as exc_info: - self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.ACCOUNT_PRIVATE_1, - "ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0", - 140, - self.cluster.ckb_nodes[0].client.url, - ) - print(exc_info) - expected_error_message = 'the feature "VM Version 2" is used in current transaction, but not enabled in current chain' - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}'" - f" not found in actual string '{exc_info.value.args[0]}'" - ) - - def test_06_0050_invoke_spawn_use_type(self): - """ - Before the fork, send a transaction contains spawn , use script:type invoke it. will return error - 1. invoke spawn contrat - - return error: InvalidEcall(2603) - :return: - """ - - # 1. invoke spawn contrat - code_tx_hash, code_tx_index = self.spawn_contract.get_deploy_hash_and_index() - invoke_arg, invoke_data = self.spawn_contract.get_arg_and_data("demo") - with pytest.raises(Exception) as exc_info: - tip_block_number = ( - self.cluster.ckb_nodes[0].getClient().get_tip_block_number() - ) - print("tip_block_number:", tip_block_number) - tx_hash = self.Contract.invoke_ckb_contract( - self.Config.MINER_PRIVATE_1, - code_tx_hash, - code_tx_index, - invoke_arg, - "type", - invoke_data, - api_url=self.cluster.ckb_nodes[0].getClient().url, - ) - print("tx hash :", tx_hash) - expected_error_message = "InvalidEcall(2603)" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - - def test_07_0049_transfer_tx_when_10th_block_before_fork(self): - """ - send data2 Transactions of the 10th block before the fork,the tx status will be rejected or unknown - 1. miner until the 10th block before the fork - 2. sending data2 returns the transaction hash. - 3. querying the transaction status shows it as rejected or unknown. - :return: - """ - - # 1. miner until the 10th block before the fork - consensus_response = self.cluster.ckb_nodes[0].getClient().get_consensus() - epoch_number = ( - get_epoch_number_by_consensus_response(consensus_response, "0049") * 1000 - ) - - self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], epoch_number - 10) - self.Node.wait_cluster_height(self.cluster, epoch_number - 10, 100) - - # 2. sending data2 returns the transaction hash. - # send account 1 transfer data2 - # @ckb-lumos/helpers.encodeToAddress( - # { - # hashType:"data2", - # args:"0x", - # codeHash:"0x69c80d6a8104994bddc132bb568c953d60fae0ac928ad887c96de8434ca2a790" - # } - # ) - # ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0 - tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.MINER_PRIVATE_1, - "ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0", - 140, - self.cluster.ckb_nodes[0].client.url, - ) - print(f"txHash:{tx_hash}") - - # 3. querying the transaction status shows it as rejected or unknown. - self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") - tx_response = self.cluster.ckb_nodes[0].getClient().get_transaction(tx_hash) - print(f"tx response:{tx_response['tx_status']['status']}") - assert ( - tx_response["tx_status"]["status"] == "rejected" - or tx_response["tx_status"]["status"] == "unknown" - ) - - def test_08_send_transfer_tx_when_10th_block_before_fork(self): - """ - send transfer Transactions of the 10th block before the fork: - - return hash - - Within 10 blocks before and after the fork, - the transaction status is queried as: unknown. - - After waiting for +10 blocks after the fork, - the transaction can be committed on the blockchain. - - 1. miner until the 10th block before the fork - 2. sending data2 returns the transaction hash. - 3. querying the transaction status shows it as rejected or unknown. - 4. miner until the 20th block after the fork - 5. querying the transaction status shows it as committed,committed number > 10th after fork - :return: - """ - - # 1. miner until the 10th block before the fork - consensus_response = self.cluster.ckb_nodes[0].getClient().get_consensus() - epoch_number = ( - get_epoch_number_by_consensus_response(consensus_response, "0049") * 1000 - ) - - self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], epoch_number - 10) - self.Node.wait_cluster_height(self.cluster, epoch_number - 10, 100) - - # 2. sending data2 returns the transaction hash. - # send account 1 transfer data2 - # @ckb-lumos/helpers.encodeToAddress( - # { - # hashType:"data2", - # args:"0x", - # codeHash:"0x69c80d6a8104994bddc132bb568c953d60fae0ac928ad887c96de8434ca2a790" - # } - # ) - # ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0 - account = self.Ckb_cli.util_key_info_by_private_key( - account_private=self.Config.ACCOUNT_PRIVATE_2 - ) - tx_hash1 = self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.ACCOUNT_PRIVATE_1, - account["address"]["testnet"], - 140, - self.cluster.ckb_nodes[0].client.url, - ) - tx_hash2 = self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.ACCOUNT_PRIVATE_2, - "ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0", - 140, - self.cluster.ckb_nodes[0].client.url, - ) - print(f"txHash:{tx_hash1}") - - # 3. querying the transaction status shows it as rejected or unknown. - self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") - tx_response = self.cluster.ckb_nodes[0].getClient().get_transaction(tx_hash1) - print(f"tx response:{tx_response['tx_status']['status']}") - assert tx_response["tx_status"]["status"] == "unknown" - - # 4. miner until the 20th block after the fork - for _ in range(30): - self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") - - # 5. querying the transaction status shows it as committed,committed number > 10th after fork - tx_response = self.cluster.ckb_nodes[0].getClient().get_transaction(tx_hash1) - print(f"tx response:{tx_response['tx_status']['status']}") - block = ( - self.cluster.ckb_nodes[0] - .getClient() - .get_block(tx_response["tx_status"]["block_hash"]) - ) - print(int(block["header"]["number"], 16)) - assert int(block["header"]["number"], 16) >= 1010 - tx_response = self.cluster.ckb_nodes[0].getClient().get_transaction(tx_hash2) - assert tx_response["tx_status"]["status"] == "committed" - - -def get_epoch_number_by_consensus_response(consensus_response, rfc_name): - """ - get ckb epoch number - "hardfork_features": [ - { "rfc": "0028", "epoch_number": "0x1526" }, - ] - Example: - get_epoch_number_by_consensus_response(consensus_response,"0028") - return int(0x1526,16) - :param consensus_response: rpc get_consensus response - :param rfc_name: example : 0048 - :return: - """ - hardfork_features = consensus_response["hardfork_features"] - return int( - list(filter(lambda obj: rfc_name in obj["rfc"], hardfork_features))[0][ - "epoch_number" - ].replace("0x", ""), - 16, - ) diff --git a/test_cases/ckb2023/test_02_after_hardfork.py b/test_cases/ckb2023/test_02_after_hardfork.py index c7033373..8ff96c27 100644 --- a/test_cases/ckb2023/test_02_after_hardfork.py +++ b/test_cases/ckb2023/test_02_after_hardfork.py @@ -122,17 +122,15 @@ def test_04_0048_block_version_0x100000000(self): def test_05_send_tx_when_after_0th_fork(self): """ + ckb dev 0 block is hardfork The first block sends a regular transaction. - return tx_hash - - The transaction status is queried as unknown for the first ten blocks. - The transaction will be committed on the blockchain after ten blocks. :return: 1. make tip block is 0th for fork 2. send tx - 3. query tx status is unknown 4. miner 30 block - 5. query statue is committed and commit block > 1010 """ # 1. make tip block is 0th for fork @@ -149,11 +147,6 @@ def test_05_send_tx_when_after_0th_fork(self): 140, self.cluster.ckb_nodes[0].client.url, ) - # 3. query tx status is unknown - self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") - tx_response = self.cluster.ckb_nodes[0].getClient().get_transaction(tx_hash) - print(f"tx response:{tx_response['tx_status']['status']}") - assert tx_response["tx_status"]["status"] == "unknown" # 4. miner 30 block for i in range(30): @@ -168,7 +161,7 @@ def test_05_send_tx_when_after_0th_fork(self): .get_block(tx_response["tx_status"]["block_hash"]) ) print(int(block["header"]["number"], 16)) - assert int(block["header"]["number"], 16) >= 1010 + assert int(block["header"]["number"], 16) >= 1000 def test_06_0049_send_data2_tx(self): """ diff --git a/test_cases/ckb2023/test_03_ckb_light_client_after_hardfork.py b/test_cases/ckb2023/test_03_ckb_light_client_after_hardfork.py index e9add02a..c2b153ae 100644 --- a/test_cases/ckb2023/test_03_ckb_light_client_after_hardfork.py +++ b/test_cases/ckb2023/test_03_ckb_light_client_after_hardfork.py @@ -120,49 +120,6 @@ def teardown_class(cls): cls.ckb_light_node_current.stop() cls.ckb_light_node_current.clean() - def test_01_ckb_light_client_0_3_1_link_node(self): - """ - 0.3.1 light node link node successful - 1. start light node that version is 0.3.1 and link nodes - 2. wait light node sync 2000 block - 3. stop and clean light node that version is 0.3.1 - Returns: - - """ - # 1. start light node that version is 0.3.1 and link nodes - version = self.CkbLightClientConfigPath.V0_3_1 - ckb_light_node = self.CkbLightClientNode.init_by_nodes( - version, self.cluster.ckb_nodes, "tx_pool_light/node2", 8002 - ) - ckb_light_node.prepare() - ckb_light_node.start() - - # 2. wait light node sync 2000 block - account = self.Ckb_cli.util_key_info_by_private_key(self.Config.MINER_PRIVATE_1) - ckb_light_node.getClient().set_scripts( - [ - { - "script": { - "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", - "hash_type": "type", - "args": account["lock_arg"], - }, - "script_type": "lock", - "block_number": "0x0", - } - ] - ) - with pytest.raises(Exception) as exc_info: - self.Node.wait_light_sync_height(ckb_light_node, 2000, 200) - expected_error_message = "time out" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - - # 3. stop and clean light node that version is 0.3.1 - ckb_light_node.stop() - ckb_light_node.clean() - def test_02_ckb_light_client_current_link_node(self): """ 1. setScript miner account diff --git a/test_cases/ckb2023/test_04_ckb_light_client_before_hardfork.py b/test_cases/ckb2023/test_04_ckb_light_client_before_hardfork.py index 241504ed..7a6b3c2f 100644 --- a/test_cases/ckb2023/test_04_ckb_light_client_before_hardfork.py +++ b/test_cases/ckb2023/test_04_ckb_light_client_before_hardfork.py @@ -36,8 +36,8 @@ def setup_class(cls): ) cls.spawn_contract = contracts["SpawnContract"] - cls.Miner.make_tip_height_number(cls.cluster.ckb_nodes[0], 20) - cls.Node.wait_cluster_height(cls.cluster, 20, 100) + cls.Miner.make_tip_height_number(cls.cluster.ckb_nodes[0], 2000) + cls.Node.wait_cluster_height(cls.cluster, 2000, 100) cls.ckb_light_node_current = cls.CkbLightClientNode.init_by_nodes( cls.CkbLightClientConfigPath.CURRENT_TEST, @@ -62,7 +62,7 @@ def setup_class(cls): } ] ) - cls.Node.wait_light_sync_height(cls.ckb_light_node_current, 20, 200) + cls.Node.wait_light_sync_height(cls.ckb_light_node_current, 2000, 200) @classmethod def teardown_class(cls): diff --git a/test_cases/light_client/test_diff_overflow.py b/test_cases/light_client/test_diff_overflow.py index fad98fc6..4a8deed8 100644 --- a/test_cases/light_client/test_diff_overflow.py +++ b/test_cases/light_client/test_diff_overflow.py @@ -21,10 +21,10 @@ def setup_class(cls): """ node1 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V110_MAIN, "tx_pool_main/node1", 8115, 8227 + cls.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_main/node1", 8115, 8227 ) node2 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V110_MAIN, "tx_pool_main/node2", 8116, 8228 + cls.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_main/node2", 8116, 8228 ) cls.node = node1 @@ -111,4 +111,4 @@ def test_light_node_when_diff_very_big(self): self.Miner.make_tip_height_number(self.node2, 500) self.node2.getClient().set_network_active(True) self.Node.wait_node_height(self.node, 500, 1000) - self.Node.wait_light_sync_height(self.ckb_light_node, 500, 30000) + self.Node.wait_light_sync_height(self.ckb_light_node, 500, 3000) diff --git a/test_cases/light_client/test_light_sync.py b/test_cases/light_client/test_light_sync.py index 55fc9b00..0a83730c 100644 --- a/test_cases/light_client/test_light_sync.py +++ b/test_cases/light_client/test_light_sync.py @@ -18,10 +18,10 @@ def setup_class(cls): """ node1 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V113, "tx_pool_main/node1", 8115, 8227 + cls.CkbNodeConfigPath.CURRENT_TEST, "tx_pool_main/node1", 8115, 8227 ) node2 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V113, "tx_pool_main/node2", 8116, 8228 + cls.CkbNodeConfigPath.CURRENT_TEST, "tx_pool_main/node2", 8116, 8228 ) cls.node = node1 @@ -138,7 +138,7 @@ def test_sync(self): ) # 4. compare new account data for acc in new_sync_account: - print("------------~~~----------------------") + print("----------------------------------") acc = self.Ckb_cli.util_key_info_by_private_key(acc) light_cells = self.ckb_light_node.getClient().get_cells( { diff --git a/test_cases/light_client/test_link_v110_node.py b/test_cases/light_client/test_link_v110_node.py deleted file mode 100644 index 5d270b8c..00000000 --- a/test_cases/light_client/test_link_v110_node.py +++ /dev/null @@ -1,186 +0,0 @@ -from framework.basic import CkbTest - - -class CKbLightClientLinkV110Node(CkbTest): - - def teardown_method(self, method): - """ - 1. stop ckb node - 2. clean ckb node tmp dir - 3. stop ckb light client node - 4. clean ckb light client node tmp dir - Args: - method: - - Returns: - - """ - super().teardown_method(method) - self.cluster.stop_all_nodes() - self.cluster.clean_all_nodes() - self.ckb_light_node.stop() - self.ckb_light_node.clean() - - def test_110_main_link_ckb_light_successful(self): - """ - Using the 110 mainnet configuration to connect to a light node, connection successful. - - 1. Deploying 4 nodes with the mainnet configuration. - Deployment successful. - - 2. Mining 2,000 blocks. - Mining successful. - - 3. Starting the light node and connecting to 4 full nodes. - Connection successful, light node started successfully. - - 4. Synchronizing the script. - Synchronization of height to 2,000 blocks successful. - Returns: - - """ - nodes = [ - self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_MAIN, - "cluster/hardfork/node{i}".format(i=i), - 8124 + i, - 8225 + i, - ) - for i in range(1, 5) - ] - self.cluster = self.Cluster(nodes) - self.cluster.prepare_all_nodes() - self.cluster.start_all_nodes() - self.cluster.connected_all_nodes() - - self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 2000) - self.Node.wait_cluster_height(self.cluster, 2000, 100) - - self.ckb_light_node = self.CkbLightClientNode.init_by_nodes( - self.CkbLightClientConfigPath.CURRENT_TEST, - self.cluster.ckb_nodes, - "tx_pool_light/node1", - 8001, - ) - self.ckb_light_node.prepare() - self.ckb_light_node.start() - account = self.Ckb_cli.util_key_info_by_private_key(self.Config.MINER_PRIVATE_1) - self.ckb_light_node.getClient().set_scripts( - [ - { - "script": { - "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", - "hash_type": "type", - "args": account["lock_arg"], - }, - "script_type": "lock", - "block_number": "0x0", - } - ] - ) - self.Node.wait_light_sync_height(self.ckb_light_node, 2000, 200) - - def test_110_testnet_link_ckb_light_successful(self): - """ - Using the 110 testnet configuration to connect to a light node, connection successful. - - 1. Deploying 4 nodes with the mainnet configuration. - Deployment successful. - - 2. Mining 2,000 blocks. - Mining successful. - - 3. Starting the light node and connecting to 4 full nodes. - Connection successful, light node started successfully. - - 4. Synchronizing the script. - Synchronization of height to 2,000 blocks successful. - Returns: - - """ - nodes = [ - self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_TEST, - "cluster/hardfork/node{i}".format(i=i), - 8124 + i, - 8225 + i, - ) - for i in range(1, 5) - ] - self.cluster = self.Cluster(nodes) - self.cluster.prepare_all_nodes() - self.cluster.start_all_nodes() - self.cluster.connected_all_nodes() - - self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 2000) - self.Node.wait_cluster_height(self.cluster, 2000, 100) - - self.ckb_light_node = self.CkbLightClientNode.init_by_nodes( - self.CkbLightClientConfigPath.CURRENT_TEST, - self.cluster.ckb_nodes, - "tx_pool_light/node1", - 8001, - ) - self.ckb_light_node.prepare() - self.ckb_light_node.start() - account = self.Ckb_cli.util_key_info_by_private_key(self.Config.MINER_PRIVATE_1) - self.ckb_light_node.getClient().set_scripts( - [ - { - "script": { - "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", - "hash_type": "data2", - "args": account["lock_arg"], - }, - "script_type": "lock", - "block_number": "0x0", - } - ] - ) - self.Node.wait_light_sync_height(self.ckb_light_node, 2000, 200) - - def test_110_devnet_link_ckb_light_failed(self): - """ - Using the 110 mainnet configuration to connect to a light node, connection successful. - - 1. Deploying 4 nodes with the mainnet configuration. - Deployment successful. - - 2. Mining 100 blocks. - Mining successful. - - 3. Starting the light node and connecting to 4 full nodes. - Connection failed, light node panic : - thread 'main' panicked at 'load spec should be OK: Error { inner: ErrorInner { kind: Custom, line: Some(105), col: 0, at: Some(3266), message: "unknown field `rfc_0028`, expected `ckb2023`", key: ["params", "hardfork"] } }', src/subcmds.rs:36:10 - - Returns: - - """ - nodes = [ - self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110, - "cluster/hardfork/node{i}".format(i=i), - 8114 + i, - 8225 + i, - ) - for i in range(1, 5) - ] - self.cluster = self.Cluster(nodes) - self.cluster.prepare_all_nodes() - self.cluster.start_all_nodes() - self.cluster.connected_all_nodes() - - self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 100) - self.Node.wait_cluster_height(self.cluster, 100, 100) - - self.ckb_light_node = self.CkbLightClientNode.init_by_nodes( - self.CkbLightClientConfigPath.CURRENT_TEST, - self.cluster.ckb_nodes, - "tx_pool_light/node1", - 8001, - ) - self.ckb_light_node.prepare() - self.ckb_light_node.start() - with open(f"{self.ckb_light_node.tmp_path}/node.log") as f: - log = f.read() - assert "panicked" in log diff --git a/test_cases/memory/test_exec_memory_limit.py b/test_cases/memory/test_exec_memory_limit.py index 1f0baed2..42f441d4 100644 --- a/test_cases/memory/test_exec_memory_limit.py +++ b/test_cases/memory/test_exec_memory_limit.py @@ -13,16 +13,11 @@ def setup_class(cls): cls.node = cls.CkbNode.init_dev_by_port( cls.CkbNodeConfigPath.CURRENT_TEST, "contract/node1", 8116, 8115 ) - cls.node119 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.v120, "contract/node2", 8117, 8118 - ) - cls.node119.prepare() - cls.node119.start() + cls.node.prepare() cls.node.start() cls.node.getClient().generate_epochs("0x2") - cls.node119.connected(cls.node) cls.execArgContract = ExecArgContract() cls.execArgContract.deploy(cls.Config.ACCOUNT_PRIVATE_1, cls.node) deploy_hash, deploy_index = cls.execArgContract.get_deploy_hash_and_index() @@ -30,14 +25,12 @@ def setup_class(cls): print("deploy_index:", deploy_index) # cls.execArgContract = ExecArgContract("0xafa84968c99c22c6cb6a117f34a012773721e08f5b6c69bdf984b3de6a7efc63", 0) tip_number = cls.node.getClient().get_tip_block_number() - cls.Node.wait_node_height(cls.node119, tip_number, 100000) @classmethod def teardown_class(cls): cls.node.stop() cls.node.clean() - cls.node119.stop() - cls.node119.clean() + # pass # @pytest.mark.skip( @@ -67,31 +60,6 @@ def test_block_err(self): f"Expected substring '{expected_error_message}' " f"not found in actual string '{exc_info.value.args[0]}'" ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.ACCOUNT_PRIVATE_2, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="data1", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - tip_number = self.node119.getClient().get_tip_block_number() - self.Node.wait_node_height(self.node, tip_number - 1, 1000) - for i in range(15): - self.Miner.miner_with_version(self.node, "0x0") - tip_number = self.node.getClient().get_tip_block_number() - self.Node.wait_node_height(self.node119, tip_number, 1000) - self.node119.getClient().clear_tx_pool() - for i in range(15): - self.Miner.miner_with_version(self.node, "0x0") - response = self.node119.getClient().get_transaction(tx_hash) - assert response["tx_status"]["status"] == "unknown" def test_block_err_type(self): account2 = self.Ckb_cli.util_key_info_by_private_key( @@ -213,56 +181,7 @@ def test_MemWriteOnExecutablePage(self): self.Config.MINER_PRIVATE_1 ) deploy_hash, deploy_index = self.execArgContract.get_deploy_hash_and_index() - # 合法交易边界 - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data( - 3, 895 + 32, 93 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.ACCOUNT_PRIVATE_2, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="data1", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - expected_error_message = "MemWriteOnExecutablePage" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data( - 3, 895 + 32, 93 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.ACCOUNT_PRIVATE_2, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="data1", - data=invoke_data, - fee=1000, - api_url=self.node.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) # # with pytest.raises(Exception) as exc_info: # invoke_arg, invoke_data = self.execArgContract.get_test_data(3, 9949, 2300 + 36) @@ -317,30 +236,6 @@ def test_MemWriteOnExecutablePage_type(self): ) deploy_hash, deploy_index = self.execArgContract.get_deploy_hash_and_index() # 合法交易边界 - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data( - 3, 895 + 32, 93 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.ACCOUNT_PRIVATE_2, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - expected_error_message = "MemWriteOnExecutablePage" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) with pytest.raises(Exception) as exc_info: invoke_arg, invoke_data = self.execArgContract.get_test_data( @@ -360,7 +255,7 @@ def test_MemWriteOnExecutablePage_type(self): output_lock_arg=account2["lock_arg"], ) # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) + self.Miner.miner_until_tx_committed(self.node, tx_hash) # expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" expected_error_message = "MemOutOfStack" assert expected_error_message in exc_info.value.args[0], ( diff --git a/test_cases/memory/test_oom.py b/test_cases/memory/test_oom.py index 199c9394..1ade6737 100644 --- a/test_cases/memory/test_oom.py +++ b/test_cases/memory/test_oom.py @@ -13,29 +13,15 @@ def setup_class(cls): cls.node = cls.CkbNode.init_dev_by_port( cls.CkbNodeConfigPath.CURRENT_TEST, "contract/node1", 8116, 8115 ) - cls.node119 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.v120, "contract/node2", 8117, 8118 - ) - cls.node119.prepare( - # {"ckb_logger_filter": "debug"} - ) - cls.node119.start() - cls.node.prepare( - # {"ckb_logger_filter": "debug"} - ) + cls.node.prepare() cls.node.start() cls.Miner.make_tip_height_number(cls.node, 2000) cls.node.getClient().generate_epochs("0x2") - cls.node119.connected(cls.node) - tip_number = cls.node.getClient().get_tip_block_number() - cls.Node.wait_node_height(cls.node119, tip_number, 1000) @classmethod def teardown_class(cls): cls.node.stop() cls.node.clean() - cls.node119.stop() - cls.node119.clean() def test_spawn(self): with pytest.raises(Exception) as exc_info: diff --git a/test_cases/memory/test_spawn_memory_limit.py b/test_cases/memory/test_spawn_memory_limit.py index 08f1f885..26ac518f 100644 --- a/test_cases/memory/test_spawn_memory_limit.py +++ b/test_cases/memory/test_spawn_memory_limit.py @@ -14,34 +14,24 @@ def setup_class(cls): cls.node = cls.CkbNode.init_dev_by_port( cls.CkbNodeConfigPath.CURRENT_TEST, "contract/node1", 8116, 8115 ) - cls.node119 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.v120, "contract/node2", 8117, 8118 - ) - cls.node119.prepare() - cls.node119.start() cls.node.prepare() cls.node.start() cls.Miner.make_tip_height_number(cls.node, 2000) cls.node.getClient().generate_epochs("0x2") - cls.node119.connected(cls.node) cls.spawnArgContract = SpawnArgContract() cls.spawnArgContract.deploy(cls.Config.ACCOUNT_PRIVATE_1, cls.node) deploy_hash, deploy_index = cls.spawnArgContract.get_deploy_hash_and_index() print("deploy_hash:", deploy_hash) print("deploy_index:", deploy_index) tip_number = cls.node.getClient().get_tip_block_number() - cls.Node.wait_node_height(cls.node119, tip_number, 100000) # cls.spawnArgContract = SpawnArgContract("0x202222df23f05c3c1d11b24b1e4757877480a1b2c1631c4e0fdc5f38d4625de9", 0) @classmethod def teardown_class(cls): cls.node.stop() cls.node.clean() - cls.node119.stop() - cls.node119.clean() - # pass def test_spawn(self): with pytest.raises(Exception) as exc_info: @@ -104,37 +94,16 @@ def test_MemOutOfStack(self): hash_type="type", data=invoke_data, fee=1000, - api_url=self.node119.getClient().url, + api_url=self.node.getClient().url, cell_deps=[], input_cells=[], output_lock_arg=account2["lock_arg"], ) print(tx_hash) - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - tip_number = self.node.getClient().get_tip_block_number() - self.Node.wait_node_height(self.node, tip_number, 100000) + self.Miner.miner_until_tx_committed(self.node, tx_hash) # MemOutOfStack 边界 119 invoke_arg, invoke_data = self.spawnArgContract.get_test_data(0, 1013, 112) - with pytest.raises(Exception) as exc_info: - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - expected_error_message = "MemOutOfStack" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) # MemOutOfStack 120 with pytest.raises(Exception) as exc_info: @@ -157,57 +126,6 @@ def test_MemOutOfStack(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data( - 3, 895 + 32, 92 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - expected_error_message = "MemOutOfStack" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data( - 3, 895 + 32, 92 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - # expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" - expected_error_message = "MemOutOfStack" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - def test_bug(self): """ 不一致bug @@ -253,82 +171,6 @@ def test_MemWriteOnExecutablePage(self): ) deploy_hash, deploy_index = self.spawnArgContract.get_deploy_hash_and_index() - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data( - 3, 895 + 32, 93 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - expected_error_message = "MemWriteOnExecutablePage" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data( - 3, 895 + 32, 93 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - # expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" - expected_error_message = "MemOutOfStack" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data( - 3, 9949, 2300 + 36 - ) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - # self.node.getClient().test_tx_pool_accept(tx,"passthrough") - self.Miner.miner_until_tx_committed(self.node119, tx_hash) - expected_error_message = "MemWriteOnExecutablePage" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - with pytest.raises(Exception) as exc_info: invoke_arg, invoke_data = self.spawnArgContract.get_test_data( 3, 9949, 2300 + 36 @@ -382,28 +224,6 @@ def test_MemOutOfBound(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(4, 0, 0) - print("deploy_hash:", deploy_hash) - tx_hash = self.Contract.invoke_ckb_contract( - account_private=self.Config.MINER_PRIVATE_1, - contract_out_point_tx_hash=deploy_hash, - contract_out_point_tx_index=deploy_index, - type_script_arg=invoke_arg, - hash_type="type", - data=invoke_data, - fee=1000, - api_url=self.node119.getClient().url, - cell_deps=[], - input_cells=[], - output_lock_arg=account2["lock_arg"], - ) - expected_error_message = "MemOutOfBound" - assert expected_error_message in exc_info.value.args[0], ( - f"Expected substring '{expected_error_message}' " - f"not found in actual string '{exc_info.value.args[0]}'" - ) - def test_argv_limit(self): account2 = self.Ckb_cli.util_key_info_by_private_key( self.Config.ACCOUNT_PRIVATE_2 diff --git a/test_cases/miner/test_01_miner_wrong_witness.py b/test_cases/miner/test_01_miner_wrong_witness.py index 0bebe859..880f2b3f 100644 --- a/test_cases/miner/test_01_miner_wrong_witness.py +++ b/test_cases/miner/test_01_miner_wrong_witness.py @@ -19,7 +19,7 @@ def teardown_class(cls): cls.node.stop() cls.node.clean() - def test_01(self): + def test_submit_block_wrong_witness(self): """ 1. submit_block wrong witness 2. return error @@ -39,3 +39,27 @@ def test_01(self): assert ( expected_error_message in exc_info.value.args[0] ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" + + # { + # lock: { + # codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8', + # hashType: 'dataErr', + # args: '0x8883a512ee2383c01574a328f60eeccbb4d78240' + # }, + # message: '0x0000000020302e3131382e3020286366643861376620323032342d30392d323229' + # } + # 0x7a0000000c00000055000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8ff140000008883a512ee2383c01574a328f60eeccbb4d78240210000000000000020302e3131382e3020286366643861376620323032342d30392d323229 + def test_block_wrong_witness_2(self): + block = self.node.getClient().get_block_template() + # InvalidWitness + with pytest.raises(Exception) as exc_info: + block["cellbase"]["data"]["witnesses"][ + 0 + ] = "0x7a0000000c00000055000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8ff140000008883a512ee2383c01574a328f60eeccbb4d78240210000000000000020302e3131382e3020286366643861376620323032342d30392d323229" + self.node.getClient().submit_block( + block["work_id"], block_template_transfer_to_submit_block(block, "0x0") + ) + expected_error_message = "InvalidWitness" + assert ( + expected_error_message in exc_info.value.args[0] + ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" diff --git a/test_cases/node_compatible/test_after_ckb_2023_hardfork.py b/test_cases/node_compatible/test_after_ckb_2023_hardfork.py deleted file mode 100644 index 8c13d347..00000000 --- a/test_cases/node_compatible/test_after_ckb_2023_hardfork.py +++ /dev/null @@ -1,87 +0,0 @@ -import time - -import pytest - -from framework.basic import CkbTest - - -# https: // github.com / nervosnetwork / ckb / pull / 4227 -# 这是 0.112.1 和 0.113.0-rc1 的一个差异。 -# 112 版本之前的dev dao 计算是错误的,所以113之后去掉兼容性测试 -# -# class TestAfterCkb2023(CkbTest): -# node_current = CkbTest.CkbNode.init_dev_by_port(CkbTest.CkbNodeConfigPath.CURRENT_TEST, -# "node_compatible/current/node1", 8115, -# 8225) -# node_111 = CkbTest.CkbNode.init_dev_by_port(CkbTest.CkbNodeConfigPath.V111, -# "node_compatible/current/node2", -# 8116, -# 8226) -# node_110 = CkbTest.CkbNode.init_dev_by_port(CkbTest.CkbNodeConfigPath.V110, "node_compatible/current/node3", 8117, -# 8227) -# nodes = [node_current, node_111, node_110] -# lt_111_nodes = [node_110] -# ge_111_nodes = [node_current, node_111] -# cluster: CkbTest.Cluster = CkbTest.Cluster(nodes) -# -# @classmethod -# def setup_class(cls): -# cls.cluster.prepare_all_nodes( -# other_ckb_config={'ckb_logger_filter': 'debug'} -# ) -# cls.cluster.start_all_nodes() -# cls.node_current.connected(cls.node_111) -# cls.node_current.connected(cls.node_110) -# contracts = cls.Contract_util.deploy_contracts(cls.Config.ACCOUNT_PRIVATE_1, cls.cluster.ckb_nodes[0]) -# cls.spawn_contract = contracts["SpawnContract"] -# cls.Miner.make_tip_height_number(cls.node_current, 900) -# cls.Node.wait_cluster_sync_with_miner(cls.cluster, 300, 900) -# heights = cls.cluster.get_all_nodes_height() -# print(f"heights:{heights}") -# cls.Miner.make_tip_height_number(cls.node_current, 1100) -# -# @classmethod -# def teardown_class(cls): -# pass -# # print("\nTeardown TestClass1") -# # heights = cls.cluster.get_all_nodes_height() -# # print(heights) -# # cls.cluster.stop_all_nodes() -# # cls.cluster.clean_all_nodes() -# -# def test_01_lt_111_sync_hard_fork(self): -# self.Node.wait_node_height(self.node_110, 990, 100) -# time.sleep(10) -# tip_number = self.node_110.getClient().get_tip_block_number() -# assert tip_number <= 999 -# -# def test_02_lt_111_sync_failed(self): -# node = self.CkbNode.init_dev_by_port(self.CkbNodeConfigPath.V110, "node_compatible/current/node5", 8229, -# 8339) -# node.prepare() -# node.start() -# node.connected(self.node_current) -# self.cluster.ckb_nodes.append(node) -# with pytest.raises(Exception) as exc_info: -# self.Node.wait_node_height(node, 1, 30) -# expected_error_message = "time out" -# assert expected_error_message in exc_info.value.args[0], \ -# f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" -# -# def test_03_sync_successful_ge_111(self): -# node = self.CkbNode.init_dev_by_port(self.CkbNodeConfigPath.V111, "node_compatible/current/node6", 8129, -# 8239) -# node.prepare() -# node.start() -# node.connected(self.node_current) -# self.Node.wait_node_height(node, 1001, 1000) -# self.cluster.ckb_nodes.append(node) -# -# def test_04_sync_successful_ge_112(self): -# node = self.CkbNode.init_dev_by_port(self.CkbNodeConfigPath.V112, "node_compatible/current/node7", 8130, -# 8330) -# node.prepare() -# node.start() -# node.connected(self.node_current) -# self.Node.wait_node_height(node, 1001, 1000) -# self.cluster.ckb_nodes.append(node) diff --git a/test_cases/node_compatible/test_before_ckb2023_hardfork.py b/test_cases/node_compatible/test_before_ckb2023_hardfork.py deleted file mode 100644 index db021c94..00000000 --- a/test_cases/node_compatible/test_before_ckb2023_hardfork.py +++ /dev/null @@ -1,162 +0,0 @@ -import pytest - -from framework.basic import CkbTest -from parameterized import parameterized - - -class TestBeforeCkb2023(CkbTest): - - node_current = CkbTest.CkbNode.init_dev_by_port( - CkbTest.CkbNodeConfigPath.CURRENT_TEST, - "node_compatible/current/node1", - 8115, - 8225, - ) - node_110 = CkbTest.CkbNode.init_dev_by_port( - CkbTest.CkbNodeConfigPath.V110, "node_compatible/current/node2", 8116, 8226 - ) - nodes = [node_current, node_110] - cluster: CkbTest.Cluster = CkbTest.Cluster(nodes) - - @classmethod - def setup_class(cls): - """ - 1. start 2 node that version is CURRENT_TEST and V110 - 2. connected 2 node - 3. deploy spawn contract - 4. miner 100 block - Returns: - - """ - - # 1. start 2 node that version is CURRENT_TEST and V110 - cls.cluster.prepare_all_nodes() - cls.cluster.start_all_nodes() - - # 2. connected 2 node - cls.cluster.connected_all_nodes() - contracts = cls.Contract_util.deploy_contracts( - cls.Config.ACCOUNT_PRIVATE_1, cls.cluster.ckb_nodes[0] - ) - cls.spawn_contract = contracts["SpawnContract"] - - # 3. miner 100 block - cls.Miner.make_tip_height_number(cls.node_current, 100) - cls.Node.wait_cluster_height(cls.cluster, 100, 100) - - @classmethod - def teardown_class(cls): - print("\nTeardown TestClass1") - cls.cluster.stop_all_nodes() - cls.cluster.clean_all_nodes() - - def test_01_node_sync(self): - """ - wait all nodes sync - - sync successful - :return: - """ - # 1. wait all nodes sync - tip_number = self.node_current.getClient().get_tip_block_number() - self.Node.wait_cluster_height(self.cluster, tip_number, 300) - - @parameterized.expand([(node.__str__(), node) for node in cluster.ckb_nodes]) - def test_02_node_miner(self, version, node): - """ - node miner - - sync miner block succ - :param version: - :param node: - :return: - - 1. miner 10 block - 2. wait other nodes sync - """ - - # 1. miner 10 block - for i in range(10): - self.Miner.miner_with_version(node, "0x0") - - # 2. wait other nodes sync - tip_number = node.getClient().get_tip_block_number() - self.Node.wait_cluster_height(self.cluster, tip_number, 300) - - @parameterized.expand([(node.__str__(), node) for node in cluster.ckb_nodes]) - def test_03_transfer(self, version, node): - """ - send transfer tx - - sync pending tx successful - miner tx commit - - sync committed tx successful - :param version: - :param node: - :return: - """ - - # 1. send transfer tx - account = self.Ckb_cli.util_key_info_by_private_key( - account_private=self.Config.ACCOUNT_PRIVATE_2 - ) - tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.ACCOUNT_PRIVATE_1, - account["address"]["testnet"], - 140, - node.getClient().url, - ) - print(f"txHash:{tx_hash}") - transaction = node.getClient().get_transaction(tx_hash) - assert transaction["tx_status"]["status"] == "pending" - for query_node in self.cluster.ckb_nodes: - self.Node.wait_get_transaction(query_node, tx_hash, "pending") - - # 2. miner tx commit - self.Miner.miner_until_tx_committed(node, tx_hash) - for query_node in self.cluster.ckb_nodes: - self.Node.wait_get_transaction(query_node, tx_hash, "committed") - print(self.Ckb_cli.cli_path) - - @parameterized.expand([(node.__str__(), node) for node in cluster.ckb_nodes]) - def test_04_spawn_tx(self, version, node): - """ - 1. send spawn tx by data1 . - - return Error: InvalidEcall(2603) - 2. send spawn tx by type . - - return Error: InvalidEcall(2603) - :param version: - :param node: - :return: - """ - - # 1. send spawn tx by data1 . - code_tx_hash, code_tx_index = self.spawn_contract.get_deploy_hash_and_index() - invoke_arg, invoke_data = self.spawn_contract.get_arg_and_data("demo") - with pytest.raises(Exception) as exc_info: - self.Contract.invoke_ckb_contract( - self.Config.MINER_PRIVATE_1, - code_tx_hash, - code_tx_index, - invoke_arg, - "data1", - invoke_data, - api_url=node.getClient().url, - ) - expected_error_message = "InvalidEcall(2603)" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - - # 2. send spawn tx by type . - with pytest.raises(Exception) as exc_info: - self.Contract.invoke_ckb_contract( - self.Config.MINER_PRIVATE_1, - code_tx_hash, - code_tx_index, - invoke_arg, - "type", - invoke_data, - api_url=node.getClient().url, - ) - expected_error_message = "InvalidEcall(2603)" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" diff --git a/test_cases/node_compatible/test_duration_ckb_2023_mainnet.py b/test_cases/node_compatible/test_duration_ckb_2023_mainnet.py new file mode 100644 index 00000000..22bdbfe4 --- /dev/null +++ b/test_cases/node_compatible/test_duration_ckb_2023_mainnet.py @@ -0,0 +1,193 @@ +import time + +from framework.basic import CkbTest +from framework.helper.spawn_contract import SpawnContract +from framework.test_node import CkbNodeConfigPath + + +# https://github.com/nervosnetwork/ckb/pull/4807 +# pub const CKB2023_START_EPOCH: u64 = 12_293; + + +class CKBAfter2023Mainnet(CkbTest): + + @classmethod + def setup_class(cls): + """ + 1. star 4 node in tmp/cluster/hardFork dir + 2. link ckb node each other + Returns: + + """ + + # 1. star 4 node in tmp/cluster/hardFork dir + + nodes = [ + cls.CkbNode.init_dev_by_port( + cls.CkbNodeConfigPath.CURRENT_MAIN, + "cluster/hardFork/node0", + 8114, + 8225, + ), + cls.CkbNode.init_dev_by_port( + CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + CkbNodeConfigPath.MAINNET_SPEC_PATH, + "download/0.200.0", + ), + "cluster/hardFork/node1", + 8115, + 8226, + ), + cls.CkbNode.init_dev_by_port( + CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + CkbNodeConfigPath.MAINNET_SPEC_PATH, + "download/0.202.0", + ), + "cluster/hardFork/node2", + 8116, + 8227, + ), + cls.CkbNode.init_dev_by_port( + CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + CkbNodeConfigPath.MAINNET_SPEC_PATH, + "download/0.202.0", + ), + "cluster/hardFork/node3", + 8117, + 8228, + ), + ] + + cls.cluster = cls.Cluster(nodes) + cls.cluster.prepare_all_nodes( + other_ckb_spec_config={ + "ckb_params_genesis_epoch_length": "1", + "ckb_name": "ckb", + } + ) + cls.cluster.start_all_nodes() + + # 2. link ckb node each other + cls.cluster.connected_all_nodes() + + @classmethod + def teardown_class(cls): + print("\nTeardown TestClass1") + cls.cluster.stop_all_nodes() + cls.cluster.clean_all_nodes() + + def test_duration_hardFork(self): + """ + 1. generate_epochs(hex(12_293)) + 2. get_consensus(0048) == 12_293 + 3. get_consensus(0049) == 12_293 + 4. miner with 0x1 + 5. transfer data2 + 6. invoke spawn + Returns: + """ + self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 1000) + self.Node.wait_cluster_height(self.cluster, 1000, 200) + + self.cluster.ckb_nodes[0].getClient().get_consensus() + + account = self.Ckb_cli.util_key_info_by_private_key( + self.Config.ACCOUNT_PRIVATE_1 + ) + for i in range(len(self.cluster.ckb_nodes)): + tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( + self.Config.ACCOUNT_PRIVATE_1, + account["address"]["mainnet"], + 140, + self.cluster.ckb_nodes[i].client.url, + ) + + # 3. miner until tx committed + self.Miner.miner_with_version(self.cluster.ckb_nodes[i], "0x0") + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[i], tx_hash) + tip_number = self.cluster.ckb_nodes[i].getClient().get_tip_block_number() + self.Node.wait_cluster_height(self.cluster, tip_number, 250) + + self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 12_293) + self.Node.wait_cluster_height(self.cluster, 12_293, 200) + # generate_epochs will cause HeadersIsInvalid + # self.cluster.ckb_nodes[0].client.generate_epochs(hex(12_293)) + + tip_number = self.cluster.ckb_nodes[0].client.get_tip_block_number() + print("tip number:", tip_number) + consensus = self.cluster.ckb_nodes[0].getClient().get_consensus() + res = get_epoch_number_by_consensus_response(consensus, "0048") + assert res == 12_293 + res = get_epoch_number_by_consensus_response(consensus, "0049") + assert res == 12_293 + time.sleep(5) + # 0048 miner with other version block + for i in range(20): + self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x1") + + # transfer data2 + # 2. send tx contains data2 + # send account 1 transfer data2 + # @ckb-lumos/helpers.encodeToAddress( + # { + # hashType:"data2", + # args:"0x", + # codeHash:"0x69c80d6a8104994bddc132bb568c953d60fae0ac928ad887c96de8434ca2a790" + # } + # ) + tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( + self.Config.MINER_PRIVATE_1, + "ckb1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpq2cmcdt", + 140, + self.cluster.ckb_nodes[0].client.url, + ) + + # 3. miner until tx committed + self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[0], tx_hash) + # spawn + spawn = SpawnContract() + spawn.deploy(self.Config.MINER_PRIVATE_1, self.cluster.ckb_nodes[0]) + code_tx_hash, code_tx_index = spawn.get_deploy_hash_and_index() + invoke_arg, invoke_data = spawn.get_arg_and_data("demo") + for i in range(len(self.cluster.ckb_nodes)): + tx_hash = self.Contract.invoke_ckb_contract( + self.Config.MINER_PRIVATE_1, + code_tx_hash, + code_tx_index, + invoke_arg, + "data2", + invoke_data, + api_url=self.cluster.ckb_nodes[i].getClient().url, + ) + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[i], tx_hash) + tip_number = self.cluster.ckb_nodes[i].getClient().get_tip_block_number() + self.Node.wait_cluster_height(self.cluster, tip_number, 250) + + +def get_epoch_number_by_consensus_response(consensus_response, rfc_name): + """ + get ckb epoch number + "hardfork_features": [ + { "rfc": "0028", "epoch_number": "0x1526" }, + ] + Example: + get_epoch_number_by_consensus_response(consensus_response,"0028") + return int(0x1526,16) + :param consensus_response: rpc get_consensus response + :param rfc_name: example : 0048 + :return: + """ + hardfork_features = consensus_response["hardfork_features"] + return int( + list(filter(lambda obj: rfc_name in obj["rfc"], hardfork_features))[0][ + "epoch_number" + ].replace("0x", ""), + 16, + ) diff --git a/test_cases/node_compatible/test_duration_ckb_2023_testnet.py b/test_cases/node_compatible/test_duration_ckb_2023_testnet.py new file mode 100644 index 00000000..04ec1207 --- /dev/null +++ b/test_cases/node_compatible/test_duration_ckb_2023_testnet.py @@ -0,0 +1,191 @@ +import time + +from framework.basic import CkbTest +from framework.helper.spawn_contract import SpawnContract +from framework.test_node import CkbNodeConfigPath + +# https://github.com/nervosnetwork/ckb/commit/50e2ae35841aad2813f155cc913c8e954b6158a7 +# pub const CKB2023_START_EPOCH: u64 = 9690; + + +class CKBAfter2023Testnet(CkbTest): + + @classmethod + def setup_class(cls): + """ + 1. star 4 node in tmp/cluster/hardFork dir + 2. link ckb node each other + Returns: + + """ + + # 1. star 4 node in tmp/cluster/hardFork dir + + nodes = [ + cls.CkbNode.init_dev_by_port( + cls.CkbNodeConfigPath.CURRENT_MAIN, + "cluster/hardFork/node0", + 8114, + 8225, + ), + cls.CkbNode.init_dev_by_port( + CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + CkbNodeConfigPath.MAINNET_SPEC_PATH, + "download/0.200.0", + ), + "cluster/hardFork/node1", + 8115, + 8226, + ), + cls.CkbNode.init_dev_by_port( + CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + CkbNodeConfigPath.MAINNET_SPEC_PATH, + "download/0.202.0", + ), + "cluster/hardFork/node2", + 8116, + 8227, + ), + cls.CkbNode.init_dev_by_port( + CkbNodeConfigPath( + "source/template/ckb/v200/ckb.toml.j2", + "source/template/ckb/v200/ckb-miner.toml.j2", + CkbNodeConfigPath.MAINNET_SPEC_PATH, + "download/0.202.0", + ), + "cluster/hardFork/node3", + 8117, + 8228, + ), + ] + + cls.cluster = cls.Cluster(nodes) + cls.cluster.prepare_all_nodes( + other_ckb_spec_config={ + "ckb_params_genesis_epoch_length": "1", + "ckb_name": "ckb_testnet", + } + ) + cls.cluster.start_all_nodes() + + # 2. link ckb node each other + cls.cluster.connected_all_nodes() + + @classmethod + def teardown_class(cls): + print("\nTeardown TestClass1") + cls.cluster.stop_all_nodes() + cls.cluster.clean_all_nodes() + + def test_duration_hardFork(self): + """ + 1. generate_epochs(hex(9690)) + 2. get_consensus(0048) == 9690 + 3. get_consensus(0049) == 9690 + 4. miner with 0x1 + 5. transfer data2 + 6. invoke spawn + Returns: + """ + self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 1000) + self.Node.wait_cluster_height(self.cluster, 1000, 200) + + self.cluster.ckb_nodes[0].getClient().get_consensus() + + account = self.Ckb_cli.util_key_info_by_private_key( + self.Config.ACCOUNT_PRIVATE_1 + ) + for i in range(len(self.cluster.ckb_nodes)): + tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( + self.Config.ACCOUNT_PRIVATE_1, + account["address"]["testnet"], + 140, + self.cluster.ckb_nodes[i].client.url, + ) + + # 3. miner until tx committed + self.Miner.miner_with_version(self.cluster.ckb_nodes[i], "0x0") + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[i], tx_hash) + tip_number = self.cluster.ckb_nodes[i].getClient().get_tip_block_number() + self.Node.wait_cluster_height(self.cluster, tip_number, 250) + + self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], 9690) + self.Node.wait_cluster_height(self.cluster, 9690, 200) + # generate_epochs will cause HeadersIsInvalid + + tip_number = self.cluster.ckb_nodes[0].client.get_tip_block_number() + print("tip number:", tip_number) + consensus = self.cluster.ckb_nodes[0].getClient().get_consensus() + res = get_epoch_number_by_consensus_response(consensus, "0048") + assert res == 9690 + res = get_epoch_number_by_consensus_response(consensus, "0049") + assert res == 9690 + time.sleep(5) + # 0048 miner with other version block + for i in range(20): + self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x1") + + # transfer data2 + # 2. send tx contains data2 + # send account 1 transfer data2 + # @ckb-lumos/helpers.encodeToAddress( + # { + # hashType:"data2", + # args:"0x", + # codeHash:"0x69c80d6a8104994bddc132bb568c953d60fae0ac928ad887c96de8434ca2a790" + # } + # ) + tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( + self.Config.MINER_PRIVATE_1, + "ckt1qp5usrt2syzfjj7acyetk45vj57kp7hq4jfg4ky8e9k7ss6v52neqpqh7xtq0", + 140, + self.cluster.ckb_nodes[0].client.url, + ) + + # 3. miner until tx committed + self.Miner.miner_with_version(self.cluster.ckb_nodes[0], "0x0") + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[0], tx_hash) + # spawn + spawn = SpawnContract() + spawn.deploy(self.Config.MINER_PRIVATE_1, self.cluster.ckb_nodes[0]) + code_tx_hash, code_tx_index = spawn.get_deploy_hash_and_index() + invoke_arg, invoke_data = spawn.get_arg_and_data("demo") + for i in range(len(self.cluster.ckb_nodes)): + tx_hash = self.Contract.invoke_ckb_contract( + self.Config.MINER_PRIVATE_1, + code_tx_hash, + code_tx_index, + invoke_arg, + "data2", + invoke_data, + api_url=self.cluster.ckb_nodes[i].getClient().url, + ) + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[i], tx_hash) + tip_number = self.cluster.ckb_nodes[i].getClient().get_tip_block_number() + self.Node.wait_cluster_height(self.cluster, tip_number, 250) + + +def get_epoch_number_by_consensus_response(consensus_response, rfc_name): + """ + get ckb epoch number + "hardfork_features": [ + { "rfc": "0028", "epoch_number": "0x1526" }, + ] + Example: + get_epoch_number_by_consensus_response(consensus_response,"0028") + return int(0x1526,16) + :param consensus_response: rpc get_consensus response + :param rfc_name: example : 0048 + :return: + """ + hardfork_features = consensus_response["hardfork_features"] + return int( + list(filter(lambda obj: rfc_name in obj["rfc"], hardfork_features))[0][ + "epoch_number" + ].replace("0x", ""), + 16, + ) diff --git a/test_cases/replace_rpc/test_rpc.py b/test_cases/replace_rpc/test_rpc.py index f43a64d6..08d07b72 100644 --- a/test_cases/replace_rpc/test_rpc.py +++ b/test_cases/replace_rpc/test_rpc.py @@ -16,7 +16,7 @@ def setup_class(cls): """ cls.node113 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.v120, "telnet/node", 8114, 8115 + cls.CkbNodeConfigPath.CURRENT_TEST, "telnet/node", 8114, 8115 ) cls.node113.prepare( other_ckb_config={ @@ -24,19 +24,7 @@ def setup_class(cls): "ckb_ws_listen_address": "127.0.0.1:18124", } ) - - cls.node112 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V112, "telnet/node2", 8116, 8117 - ) - cls.node112.prepare( - other_ckb_config={ - "ckb_tcp_listen_address": "127.0.0.1:18115", - "ckb_ws_listen_address": "127.0.0.1:18125", - } - ) - cls.node112.start() cls.node113.start() - cls.node112.connected(cls.node113) cls.Miner.make_tip_height_number(cls.node113, 100) @classmethod @@ -48,8 +36,6 @@ def teardown_class(cls): """ print("teardown_class") - cls.node112.stop() - cls.node112.clean() cls.node113.stop() cls.node113.clean() @@ -63,11 +49,6 @@ def test_without_header(self): + f"""{self.node113.rpcUrl}/ """ ) assert "null" in ret113 - ret = run_command( - """curl -X POST -d '[{"jsonrpc": "2.0", "method": "ping_peers", "params": [], "id": "1"}]' """ - + f"""{self.node112.rpcUrl}/ """ - ) - assert "Content-Type: application/json is required" in ret def test_01_with_error(self): """ @@ -75,12 +56,6 @@ def test_01_with_error(self): 112:{"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid params: Invalid Uint64 0: without `0x` prefix."}, "id": 42} 113:{"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid parameter for `block_number`: Invalid Uint64 0: without `0x` prefix"}, "id": 42} """ - with pytest.raises(Exception) as exc_info: - ret = self.node112.getClient().get_block_by_number("0") - expected_error_message = "Invalid params: Invalid Uint64 0: without `0x` prefix" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" with pytest.raises(Exception) as exc_info: ret = self.node113.getClient().get_block_by_number("0") @@ -89,21 +64,12 @@ def test_01_with_error(self): expected_error_message in exc_info.value.args[0] ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - pass - def test_01_with_error_2(self): """ {"jsonrpc": "2.0", "method": "dry_run_transaction", "params": [{}], "id": "1"} 112:{"jsonrpc": "2.0", "error": {"code": -32602, "message": "message":"Invalid params: missing field `version`."}, "id": 42} 113:{"jsonrpc": "2.0", "error": {"code": -32602, "message": "message":"Invalid params: missing field `version`."}, "id": 42} """ - with pytest.raises(Exception) as exc_info: - ret = self.node112.getClient().get_block_by_number("0") - expected_error_message = "Invalid params: Invalid Uint64 0: without `0x` prefix" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - with pytest.raises(Exception) as exc_info: ret = self.node113.getClient().get_block_by_number("0") expected_error_message = "" @@ -115,14 +81,12 @@ def test_01_with_error_2(self): def test_max_response(self): """ batch get_block_by_number count:922 - 112: successful 113: successful batch get_block_by_number count:923 - 112:failed 113:failed """ # 测试返回数据上限 - rpcUrls = [self.node112.rpcUrl, self.node113.rpcUrl] + rpcUrls = [self.node113.rpcUrl] for rpcUrl in rpcUrls: requestBody = "" for i in range(922): @@ -165,13 +129,11 @@ def test_max_response(self): def test_max_batch_count(self): """ batch send count :15376 - 112: successful 113: successful batch send count :15377 - 112: failed 113: failed """ - rpcUrls = [self.node112.rpcUrl, self.node113.rpcUrl] + rpcUrls = [self.node113.rpcUrl] for rpcUrl in rpcUrls: requestBody = "" for i in range(15376): @@ -208,19 +170,8 @@ def test_max_batch_count(self): def test_websocket(self): """ not support websocket - 112: not support,Handshake status 405 Method Not Allowed 113: not support,not allowed. POST or OPTIONS is required """ - # 112: not support,Handshake status 405 Method Not Allowed - with pytest.raises(Exception) as exc_info: - socket = self.node112.subscribe_websocket( - "new_tip_header", self.node112.rpcUrl.replace("http://", "") - ) - expected_error_message = "Handshake status 405 Method Not Allowed" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - # 113 support with pytest.raises(Exception) as exc_info: socket = self.node113.subscribe_websocket( @@ -236,18 +187,8 @@ def test_websocket(self): def test_telnet(self): """ support telnet - 112: not 113: not """ - socket = self.node112.subscribe_telnet( - "new_tip_header", self.node112.rpcUrl.replace("http://", "") - ) - with pytest.raises(Exception) as exc_info: - socket.read_very_eager() - expected_error_message = "telnet connection closed" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" with pytest.raises(Exception) as exc_info: socket = self.node113.subscribe_telnet( diff --git a/test_cases/replace_rpc/test_sub_telnet_with_websocket.py b/test_cases/replace_rpc/test_sub_telnet_with_websocket.py index ed1d3348..245d914f 100644 --- a/test_cases/replace_rpc/test_sub_telnet_with_websocket.py +++ b/test_cases/replace_rpc/test_sub_telnet_with_websocket.py @@ -2,6 +2,7 @@ import time from framework.basic import CkbTest +from framework.test_node import DOCKER class TestTelnetAndWebsocket(CkbTest): @@ -21,36 +22,22 @@ def setup_class(cls): cls.node113.prepare( other_ckb_config={ "ckb_logger_filter": "debug", - "ckb_tcp_listen_address": "127.0.0.1:18116", - "ckb_ws_listen_address": "127.0.0.1:18124", + "ckb_tcp_listen_address": "0.0.0.0:18116", + "ckb_ws_listen_address": "0.0.0.0:18124", } ) - cls.node112 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V112, "telnet/node2", 8126, 8127 - ) - cls.node112.prepare( - other_ckb_config={ - "ckb_logger_filter": "debug", - "ckb_tcp_listen_address": "127.0.0.1:18115", - "ckb_ws_listen_address": "127.0.0.1:18125", - } - ) - cls.node112.start() + cls.node113.start() - cls.node112.connected(cls.node113) cls.Miner.make_tip_height_number(cls.node113, 100) - cls.Node.wait_node_height(cls.node112, 100, 1000) @classmethod def teardown_class(cls): """ - 1. stop ckb node include 112 and 113 + 1. stop ckb node and 113 2. clear ckb node dir Returns: """ - cls.node112.stop() - cls.node112.clean() cls.node113.stop() cls.node113.clean() @@ -66,14 +53,10 @@ def test_01_sub_tip_block_number(self): Returns: """ - telnet_new_tip_header_112 = self.node112.subscribe_telnet("new_tip_header") telnet_new_tip_header_113 = self.node113.subscribe_telnet("new_tip_header") - ws_new_tip_header_112 = self.node112.subscribe_websocket("new_tip_header") ws_new_tip_header_113 = self.node113.subscribe_websocket("new_tip_header") for i in range(10): - self.Miner.miner_with_version(self.node112, "0x0") - telnet_new_tip_header_112_ret = telnet_new_tip_header_112.read_very_eager() - ws_new_tip_header_112_ret = ws_new_tip_header_112.recv() + self.Miner.miner_with_version(self.node113, "0x0") telnet_new_tip_header_113_ret = telnet_new_tip_header_113.read_very_eager() ws_new_tip_header_113_ret = ws_new_tip_header_113.recv() print( @@ -92,17 +75,8 @@ def test_01_sub_tip_block_number(self): # json.loads(telnet_new_tip_header_112_ret.decode())['params']['result']) # assert json.loads(telnet_new_tip_header_112_ret.decode())['params']['result'] == \ # json.loads(telnet_new_tip_header_113_ret.decode())['params']['result'] - print( - "ws_new_tip_header_112_ret:", - json.loads(ws_new_tip_header_112_ret)["params"]["result"], - ) - assert ( - json.loads(ws_new_tip_header_112_ret)["params"]["result"] - == json.loads(ws_new_tip_header_113_ret)["params"]["result"] - ) - telnet_new_tip_header_112.close() + telnet_new_tip_header_113.close() - ws_new_tip_header_112.close() ws_new_tip_header_113.close() def test_02_sub_new_tip_block(self): @@ -116,21 +90,14 @@ def test_02_sub_new_tip_block(self): Returns: """ - telnet_new_tip_block_112 = self.node112.subscribe_telnet("new_tip_block") telnet_new_tip_block_113 = self.node113.subscribe_telnet("new_tip_block") - ws_new_tip_block_112 = self.node112.subscribe_websocket("new_tip_block") ws_new_tip_block_113 = self.node113.subscribe_websocket("new_tip_block") for i in range(10): - self.Miner.miner_with_version(self.node112, "0x0") - telnet_new_tip_block_112_ret = telnet_new_tip_block_112.read_very_eager() - ws_new_tip_block_112_ret = ws_new_tip_block_112.recv() + self.Miner.miner_with_version(self.node113, "0x0") telnet_new_tip_block_113_ret = telnet_new_tip_block_113.read_very_eager() ws_new_tip_block_113_ret = ws_new_tip_block_113.recv() # print("telnet_new_tip_block_112_ret:", json.loads(telnet_new_tip_block_112_ret)['params']['result']) - print( - "ws_new_tip_block_112_ret:", - json.loads(ws_new_tip_block_112_ret)["params"]["result"], - ) + print( "telnet_new_tip_block_113_ret:", json.loads(telnet_new_tip_block_113_ret)["params"]["result"], @@ -139,17 +106,8 @@ def test_02_sub_new_tip_block(self): "ws_new_tip_block_113_ret:", json.loads(ws_new_tip_block_113_ret)["params"]["result"], ) - assert ( - json.loads(ws_new_tip_block_112_ret)["params"]["result"] - == json.loads(telnet_new_tip_block_113_ret)["params"]["result"] - ) - assert ( - json.loads(ws_new_tip_block_112_ret)["params"]["result"] - == json.loads(ws_new_tip_block_113_ret)["params"]["result"] - ) - telnet_new_tip_block_112.close() + telnet_new_tip_block_113.close() - ws_new_tip_block_112.close() ws_new_tip_block_113.close() def test_03_sub_new_tx(self): @@ -163,8 +121,6 @@ def test_03_sub_new_tx(self): Returns: """ - telnet_new_tx_112 = self.node112.subscribe_telnet("new_transaction") - ws_new_tx_112 = self.node112.subscribe_websocket("new_transaction") telnet_new_tx_113 = self.node113.subscribe_telnet("new_transaction") ws_new_tx_113 = self.node113.subscribe_websocket("new_transaction") account1 = self.Ckb_cli.util_key_info_by_private_key( @@ -180,21 +136,14 @@ def test_03_sub_new_tx(self): ) self.Miner.miner_until_tx_committed(self.node113, tx_hash) telnet_new_tx_113_ret = telnet_new_tx_113.read_very_eager() - telnet_new_tx_112_ret = telnet_new_tx_112.read_very_eager() ws_new_tx_113_ret = ws_new_tx_113.recv() - ws_new_tx_112_ret = ws_new_tx_112.recv() print("telnet_new_tx_113_ret:", telnet_new_tx_113_ret) print("ws_new_tx_113_ret:", ws_new_tx_113_ret) # print("telnet_new_tx_112_ret:", telnet_new_tx_112_ret) - print("ws_new_tx_112_ret:", ws_new_tx_112_ret) assert len( json.loads(telnet_new_tx_113_ret.decode())["params"]["result"] ) == len(json.loads(ws_new_tx_113_ret)["params"]["result"]) - assert len( - json.loads(telnet_new_tx_113_ret.decode())["params"]["result"] - ) == len(json.loads(ws_new_tx_112_ret)["params"]["result"]) - telnet_new_tx_112.close() - ws_new_tx_112.close() + telnet_new_tx_113.close() ws_new_tx_113.close() @@ -209,8 +158,6 @@ def test_04_sub_proposal_tx(self): Returns: """ - telnet_new_tx_112 = self.node112.subscribe_telnet("proposed_transaction") - ws_new_tx_112 = self.node112.subscribe_websocket("proposed_transaction") telnet_new_tx_113 = self.node113.subscribe_telnet("proposed_transaction") ws_new_tx_113 = self.node113.subscribe_websocket("proposed_transaction") account1 = self.Ckb_cli.util_key_info_by_private_key( @@ -226,40 +173,29 @@ def test_04_sub_proposal_tx(self): self.Miner.miner_until_tx_committed(self.node113, tx_hash) telnet_new_tx_113_ret = telnet_new_tx_113.read_very_eager() - telnet_new_tx_112_ret = telnet_new_tx_112.read_very_eager() ws_new_tx_113_ret = ws_new_tx_113.recv() - ws_new_tx_112_ret = ws_new_tx_112.recv() print("telnet_new_tx_113_ret:", telnet_new_tx_113_ret) print("ws_new_tx_113_ret:", ws_new_tx_113_ret) # print("telnet_new_tx_112_ret:", telnet_new_tx_112_ret) - print("ws_new_tx_112_ret:", ws_new_tx_112_ret) print( "json:", json.loads(telnet_new_tx_113_ret.decode())["params"]["result"] ) assert len( json.loads(telnet_new_tx_113_ret.decode())["params"]["result"] ) == len(json.loads(ws_new_tx_113_ret)["params"]["result"]) - assert len( - json.loads(telnet_new_tx_113_ret.decode())["params"]["result"] - ) == len(json.loads(ws_new_tx_112_ret)["params"]["result"]) - telnet_new_tx_112.close() - ws_new_tx_112.close() + telnet_new_tx_113.close() ws_new_tx_113.close() def test_05_reject_tx(self): """ - 1. ckb node 112 subscribe_telnet rejected_transaction 2. ckb node 113 subscribe_telnet rejected_transaction - 3. ckb node 112 subscribe_websocket rejected_transaction - 4. ckb node 112 subscribe_websocket rejected_transaction 5. check recv telnet_new_tip_header_113_ret and 112_ret 6. assert 113_ret and 112_ret recv content Returns: """ - telnet_new_tx_112 = self.node112.subscribe_telnet("rejected_transaction") - ws_new_tx_112 = self.node112.subscribe_websocket("rejected_transaction") + telnet_new_tx_113 = self.node113.subscribe_telnet("rejected_transaction") ws_new_tx_113 = self.node113.subscribe_websocket("rejected_transaction") account1 = self.Ckb_cli.util_key_info_by_private_key( @@ -298,15 +234,11 @@ def test_05_reject_tx(self): # telnet_new_tx_112_ret = telnet_new_tx_112.read_very_eager() # print("telnet_new_tx_112_ret:", telnet_new_tx_112_ret) - ws_new_tx_112_ret = ws_new_tx_112.recv() - print("ws_new_tx_112_ret:", ws_new_tx_112_ret) - # assert len(json.loads(telnet_new_tx_113_ret.decode())['params']['result']) == \ # len(json.loads(ws_new_tx_113_ret)['params']['result']) # assert len(json.loads(telnet_new_tx_113_ret.decode())['params']['result']) == \ # len(json.loads(ws_new_tx_112_ret)['params']['result']) - telnet_new_tx_112.close() - ws_new_tx_112.close() + telnet_new_tx_113.close() ws_new_tx_113.close() pass diff --git a/test_cases/replace_rpc/test_telnet.py b/test_cases/replace_rpc/test_telnet.py index 0ae20521..9fa8979c 100644 --- a/test_cases/replace_rpc/test_telnet.py +++ b/test_cases/replace_rpc/test_telnet.py @@ -24,32 +24,22 @@ def setup_class(cls): cls.node113.prepare( other_ckb_config={ "ckb_logger_filter": "debug", - "ckb_tcp_listen_address": "127.0.0.1:18115", - "ckb_ws_listen_address": "127.0.0.1:18124", + "ckb_tcp_listen_address": "0.0.0.0:18115", + "ckb_ws_listen_address": "0.0.0.0:18124", } ) - cls.node112 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V112, "telnet/node2", 8116, 8117 - ) - cls.node112.prepare( - other_ckb_config={"ckb_tcp_listen_address": "127.0.0.1:18114"} - ) - cls.node112.start() + cls.node113.start() - cls.node112.connected(cls.node113) cls.Miner.make_tip_height_number(cls.node113, 100) - cls.Node.wait_node_height(cls.node112, 90, 1000) @classmethod def teardown_class(cls): """ - 1. stop ckb 112 and 113 version - 2. clear ckb 112 and 113 dir + 1. stop ckb 113 version + 2. clear ckb 113 dir Returns: """ - cls.node112.stop() - cls.node112.clean() cls.node113.stop() cls.node113.clean() @@ -61,25 +51,9 @@ def test_link_count_max(self): 3.113: > 10234 4.test 113 max link count """ - telnets = [] - for i in range(1000): - print(i) - telnet = self.node112.subscribe_telnet("new_tip_header") - telnets.append(telnet) - - self.Miner.miner_with_version(self.node112, "0x0") - time.sleep(1) - for i in range(len(telnets)): - telnet = telnets[i] - ret = telnet.read_very_eager() - print(ret) - print(i, ":", len(ret)) - assert len(ret) > 700 - telnet.close() - # 1.test 113 max link count telnets = [] - for i in range(10000): + for i in range(100): print(i) telnet = self.node113.subscribe_telnet("new_tip_header") telnets.append(telnet) @@ -99,18 +73,14 @@ def test_link_time_max(self): 3. 113: keep link """ telnet113 = self.node113.subscribe_telnet("new_tip_header") - telnet112 = self.node112.subscribe_telnet("new_tip_header") - for i in range(300): + for i in range(30): self.Miner.miner_with_version(self.node113, "0x0") print("current idx:", i) ret113 = telnet113.read_very_eager() - ret112 = telnet112.read_very_eager() print(ret113) - print(ret112) time.sleep(1) telnet113.close() - telnet112.close() def test_link_websocket(self): """ @@ -119,18 +89,12 @@ def test_link_websocket(self): 3. 113: not support 4. assert invalid literal for int() with base 10 """ - with pytest.raises(Exception) as exc_info: - socket = self.node112.subscribe_websocket( - "new_tip_header", self.node112.ckb_config["ckb_tcp_listen_address"] - ) - expected_error_message = "invalid literal for int() with base 10" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - with pytest.raises(Exception) as exc_info: socket = self.node113.subscribe_websocket( - "new_tip_header", self.node113.ckb_config["ckb_tcp_listen_address"] + "new_tip_header", + self.node113.ckb_config["ckb_tcp_listen_address"].replace( + "0.0.0.0", "127.0.0.1" + ), ) expected_error_message = "invalid literal for int() with base 10" assert ( @@ -140,22 +104,12 @@ def test_link_websocket(self): def test_rpc(self): """ support rpc - 1. 112: not support 2. 113: not support 3. assert request time out """ - client = self.node112.getClient() - client.url = f"http://{self.node112.ckb_config['ckb_tcp_listen_address']}" - - with pytest.raises(Exception) as exc_info: - response = client.call("get_tip_block_number", [], 1) - expected_error_message = "request time out" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" client = self.node113.getClient() - client.url = f"http://{self.node113.ckb_config['ckb_tcp_listen_address']}" + client.url = f"http://{self.node113.ckb_config['ckb_tcp_listen_address'].replace('0.0.0.0','127.0.0.1')}" with pytest.raises(Exception) as exc_info: response = client.call("get_tip_block_number", [], 1) @@ -167,19 +121,9 @@ def test_rpc(self): def test_stop_node_when_link_telnet(self): """ stop ckb when socker is keep live - 1. 112: stop successful 2. 113: stop successful 3. assert "ckb" not in ret """ - self.node112.restart() - socket = self.node112.subscribe_telnet("new_tip_header") - self.node112.stop() - port = self.node112.ckb_config["ckb_tcp_listen_address"].split(":")[-1] - ret = run_command(f"lsof -i:{port} | grep ckb", check_exit_code=False) - assert "ckb" not in str(ret) - socket.close() - ret = run_command(f"lsof -i:{port} | grep ckb", check_exit_code=False) - assert "ckb" not in str(ret) self.node113.restart() socket = self.node113.subscribe_telnet("new_tip_header") @@ -190,7 +134,6 @@ def test_stop_node_when_link_telnet(self): socket.close() ret = run_command(f"lsof -i:{port} | grep ckb", check_exit_code=False) assert "ckb" not in str(ret) - self.node112.restart() self.node113.restart() def test_unsubscribe(self): @@ -202,7 +145,7 @@ def test_unsubscribe(self): """ client = self.node113.getClient() - client.url = f"http://{self.node113.ckb_config['ckb_rpc_listen_address']}" + client.url = f"http://{self.node113.ckb_config['ckb_rpc_listen_address'].replace('0.0.0.0','127.0.0.1')}" socket = self.node113.subscribe_telnet("new_tip_header") self.Miner.miner_with_version(self.node113, "0x0") ret = socket.read_very_eager() diff --git a/test_cases/replace_rpc/test_websocket.py b/test_cases/replace_rpc/test_websocket.py index c08881fc..f6922191 100644 --- a/test_cases/replace_rpc/test_websocket.py +++ b/test_cases/replace_rpc/test_websocket.py @@ -18,30 +18,17 @@ def setup_class(cls): """ cls.node113 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.CURRENT_TEST, "telnet/node", 8114, 8115 + cls.CkbNodeConfigPath.CURRENT_TEST, "telnet2/node", 8114, 8115 ) cls.node113.prepare( other_ckb_config={ "ckb_logger_filter": "debug", - "ckb_tcp_listen_address": "127.0.0.1:18114", - "ckb_ws_listen_address": "127.0.0.1:18124", + "ckb_tcp_listen_address": "0.0.0.0:18114", + "ckb_ws_listen_address": "0.0.0.0:18124", } ) - cls.node112 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V112, "telnet/node2", 8116, 8117 - ) - cls.node112.prepare( - other_ckb_config={ - "ckb_logger_filter": "debug", - "ckb_tcp_listen_address": "127.0.0.1:18115", - "ckb_ws_listen_address": "127.0.0.1:18125", - } - ) - cls.node112.start() cls.node113.start() - cls.node112.connected(cls.node113) cls.Miner.make_tip_height_number(cls.node113, 100) - cls.Node.wait_node_height(cls.node112, 100, 1000) @classmethod def teardown_class(cls): @@ -51,9 +38,6 @@ def teardown_class(cls): Returns: """ - cls.node112.stop() - cls.node112.clean() - cls.node113.stop() cls.node113.clean() @@ -65,18 +49,6 @@ def test_link_count_max(self): 4. test 113 max link count """ # test 112 max link count - websockets = [] - for i in range(100): - print(i) - websocket = self.node112.subscribe_websocket("new_tip_header") - websockets.append(websocket) - - self.Miner.miner_with_version(self.node112, "0x0") - for i in range(len(websockets)): - websocket = websockets[i] - ret = websocket.recv() - print(i, ":", len(ret)) - websocket.close() # test 113 max link count websockets = [] @@ -98,91 +70,33 @@ def test_link_time_max(self): 2. 112: keep link 3. 113: keep link """ - websocket112 = self.node112.subscribe_websocket("new_tip_header") websocket113 = self.node113.subscribe_websocket("new_tip_header") for i in range(300): self.Miner.miner_with_version(self.node113, "0x0") print("current idx:", i) - ret112 = websocket112.recv() ret113 = websocket113.recv() - print(ret112) - assert len(ret112) > 0 + assert len(ret113) > 0 print(ret113) time.sleep(1) websocket113.close() - websocket112.close() def test_rpc(self): """ 1. support rpc - 2. 112: not support 3. 113: support """ - client = self.node112.getClient() - client.url = f"http://{self.node112.ckb_config['ckb_ws_listen_address']}" - - with pytest.raises(Exception) as exc_info: - response = client.call("get_tip_block_number", [], 1) - expected_error_message = "Expecting value: line 1 column 1" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - client = self.node113.getClient() - client.url = f"http://{self.node113.ckb_config['ckb_ws_listen_address']}" + client.url = f"http://{self.node113.ckb_config['ckb_ws_listen_address'].replace('0.0.0.0','127.0.0.1')}" response = client.call("get_tip_block_number", [], 1) - # with pytest.raises(Exception) as exc_info: - # response = client.call("get_tip_block_number", [], 1) - # expected_error_message = "request time out" - # assert expected_error_message in exc_info.value.args[0], \ - # f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - - def test_telnet(self): - """ - 1. assert telnet connection closed which 112 subscribe 113 node - 2. assert telnet connection closed which 113 subscribe 112 node - Returns: - - """ - socket = self.node112.subscribe_telnet( - "new_tip_header", self.node112.ckb_config["ckb_ws_listen_address"] - ) - with pytest.raises(Exception) as exc_info: - socket.read_very_eager() - expected_error_message = "telnet connection closed" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - - socket = self.node113.subscribe_telnet( - "new_tip_header", self.node112.ckb_config["ckb_ws_listen_address"] - ) - with pytest.raises(Exception) as exc_info: - socket.read_very_eager() - expected_error_message = "telnet connection closed" - assert ( - expected_error_message in exc_info.value.args[0] - ), f"Expected substring '{expected_error_message}' not found in actual string '{exc_info.value.args[0]}'" - def test_stop_node_when_link_websocket(self): """ 1. stop ckb when socker is keep live - 2. 112: stop successful 3. 113: stop failed """ - self.node112.restart() - socket = self.node112.subscribe_websocket("new_tip_header") - self.node112.stop() - port = self.node112.ckb_config["ckb_ws_listen_address"].split(":")[-1] - ret = run_command(f"lsof -i:{port} | grep ckb", check_exit_code=False) - assert "ckb" not in str(ret) - socket.close() - ret = run_command(f"lsof -i:{port} | grep ckb", check_exit_code=False) - assert "ckb" not in str(ret) self.node113.restart() socket = self.node113.subscribe_websocket("new_tip_header") @@ -193,5 +107,4 @@ def test_stop_node_when_link_websocket(self): socket.close() ret = run_command(f"lsof -i:{port} | grep ckb", check_exit_code=False) assert "ckb" not in str(ret) - self.node112.restart() self.node113.restart() diff --git a/test_cases/soft_fork/test_mainnet_soft_fork_failed.py b/test_cases/soft_fork/test_mainnet_soft_fork_failed.py deleted file mode 100644 index e6a6f6f4..00000000 --- a/test_cases/soft_fork/test_mainnet_soft_fork_failed.py +++ /dev/null @@ -1,132 +0,0 @@ -import pytest - -from framework.basic import CkbTest - - -class TestMainNetSoftForkFailed(CkbTest): - - @classmethod - def setup_class(cls): - """ - 1. start 2 node - 2. connected 2 node - 3. miner until 200 block - Returns: - - """ - - # 1. start 2 node - node1 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_main/node1", 8119, 8227 - ) - node2 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V109_MAIN, "tx_pool_main/node2", 8120, 8228 - ) - cls.cluster = cls.Cluster([node1, node2]) - cls.node = node1 - cls.node109 = node2 - - node1.prepare( - other_ckb_spec_config={ - "ckb_params_genesis_epoch_length": "1", - "ckb_name": "ckb", - } - ) - node2.prepare( - other_ckb_spec_config={ - "ckb_params_genesis_epoch_length": "1", - "ckb_name": "ckb", - } - ) - cls.cluster.start_all_nodes() - - # 2. connected 2 node - cls.cluster.connected_all_nodes() - - # 3. miner until 200 block - cls.Miner.make_tip_height_number(node2, 200) - cls.Node.wait_cluster_height(cls.cluster, 100, 300) - - @classmethod - def teardown_class(cls): - print("\nTeardown TestClass1") - cls.cluster.stop_all_nodes() - cls.cluster.clean_all_nodes() - - @pytest.mark.skip - def test_01_get_consensus_in_ge_110(self): - """ - > 110 node softforks:light_client min_activation_epoch == 0x21c8 - > 110 node softforks:light_client start == 0x205a - > 110 node softforks:light_client timeout == 0x2168 - 1. query get_consensus - :return: - """ - - # 1. query get_consensus - consensus = self.node.getClient().get_consensus() - assert ( - consensus["softforks"]["light_client"]["rfc0043"]["min_activation_epoch"] - == "0x21c8" - ) - assert consensus["softforks"]["light_client"]["rfc0043"]["start"] == "0x205a" - assert consensus["softforks"]["light_client"]["rfc0043"]["timeout"] == "0x2168" - - def test_02_get_consensus_in_lt_110(self): - """ - < 110 node softforks == {} - :return: - 1. query get_consensus - """ - - # 1. query get_consensus - consensus = self.node109.getClient().get_consensus() - assert consensus["softforks"] == {} - - @pytest.mark.skip - def test_03_get_deployments_in_gt_110(self): - """ - > 110 node deployments:light_client min_activation_epoch == 0x21c8 - > 110 node deployments:light_client period == 0x2a - > 110 node deployments:light_client timeout == 0x2168 - 1. query get_deployments_info - :return: - """ - deployments = self.node.getClient().get_deployments_info() - assert ( - deployments["deployments"]["light_client"]["min_activation_epoch"] - == "0x21c8" - ) - assert deployments["deployments"]["light_client"]["period"] == "0x2a" - assert deployments["deployments"]["light_client"]["timeout"] == "0x2168" - - @pytest.mark.skip - def test_04_miner_use_109(self): - """ - use 109 miner block,will cause softfork failed - 1. 109 node miner to 8314 - query 110 node statue == defined - 2. 109 node miner to 8915 - query 110 node statue == started - 3. 109 node miner to 8566 - query 110 node statue == started - 4. 109 node miner to 8567 - query 110 node statue == failed - :return: - """ - self.Miner.make_tip_height_number(self.node109, 8314) - self.Node.wait_node_height(self.node, 8314, 100) - deployments_info = self.node.getClient().get_deployments_info() - assert deployments_info["deployments"]["light_client"]["state"] == "defined" - self.Miner.make_tip_height_number(self.node109, 8315) - self.Node.wait_node_height(self.node, 8315, 100) - deployments_info = self.node.getClient().get_deployments_info() - assert deployments_info["deployments"]["light_client"]["state"] == "started" - self.Miner.make_tip_height_number(self.node109, 8566) - self.Node.wait_node_height(self.node, 8566, 100) - deployments_info = self.node.getClient().get_deployments_info() - assert deployments_info["deployments"]["light_client"]["state"] == "started" - self.Miner.make_tip_height_number(self.node109, 8567) - self.Node.wait_node_height(self.node, 8567, 100) - deployments_info = self.node.getClient().get_deployments_info() - assert deployments_info["deployments"]["light_client"]["state"] == "failed" diff --git a/test_cases/soft_fork/test_sync_again_with_other_node_when_sync_failed_tx.py b/test_cases/soft_fork/test_sync_again_with_other_node_when_sync_failed_tx.py deleted file mode 100644 index 833d50b2..00000000 --- a/test_cases/soft_fork/test_sync_again_with_other_node_when_sync_failed_tx.py +++ /dev/null @@ -1,113 +0,0 @@ -import time - -from framework.basic import CkbTest -from framework.util import run_command, get_project_root - -# use ckb0.110.1-rc1: generate DaoLockSizeMismatch tx in softfork before and after -DATA_ERROR_TAT = f"{get_project_root()}/source/data/data.err.tar.gz" - - -class TestSyncAgainWithOtherNodeWhenSyncFailedTx(CkbTest): - - def teardown_method(self, method): - super().teardown_method(method) - print("\nTearing down method", method.__name__) - self.node1.stop() - self.node1.clean() - - self.node2.stop() - self.node2.clean() - - self.node3.stop() - self.node3.clean() - - def test_sync_again_with_other_node_when_sync_failed_tx(self): - """ - can't sync DaoLockSizeMismatch tx - - after softFork active - - starting_block_limiting_dao_withdrawing_lock <= dao deposit tx block number - 6000 block contains DaoLockSizeMismatch tx - 8669 block contains DaoLockSizeMismatch tx - 1. can sync 6000 block - tip block num > 6000 - 2. node2 and node3 can't sync 8669 block - tip block == 8668 - 3. node2 miner - 4. node1 stop - 5. node2 restart and miner - 6. link node2 and node3 - 7. node3 sync node2 successful - Returns: - """ - - # 1. can sync 6000 block - node1 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_MAIN, "tx_pool_test/node1", 8114, 8227 - ) - node2 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_test/node2", 8112, 8228 - ) - node3 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_test/node3", 8113, 8229 - ) - self.node1 = node1 - self.node2 = node2 - self.node3 = node3 - node1.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5494" - } - ) - node2.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5494" - } - ) - node3.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5494" - } - ) - tar_file(DATA_ERROR_TAT, node1.ckb_dir) - node1.start() - node2.start() - node3.start() - self.Miner.make_tip_height_number(node1, 15000) - node1.start_miner() - node1.connected(node2) - node1.connected(node3) - self.Node.wait_node_height(self.node2, 8668, 120) - self.Node.wait_node_height(self.node3, 8668, 120) - block_num = self.node2.getClient().get_tip_block_number() - assert block_num == 8668 - time.sleep(10) - block_num = self.node2.getClient().get_tip_block_number() - assert block_num == 8668 - - # 2. node2 and node3 can't sync 8669 block - node2_banned_result = node2.getClient().get_banned_addresses() - node3_banned_result = node3.getClient().get_banned_addresses() - assert "BlockIsInvalid" in node2_banned_result[0]["ban_reason"] - assert "BlockIsInvalid" in node3_banned_result[0]["ban_reason"] - - # 4. node1 stop - node1.stop() - node2.getClient().clear_banned_addresses() - node3.getClient().clear_banned_addresses() - - # 5. node2 restart and miner - self.Miner.make_tip_height_number(node2, 10000) - node2.restart() - self.node2.start_miner() - - # 6. link node2 and node3 - node2.connected(node3) - node3.connected(node2) - - # 7. node3 sync node2 successful - self.Node.wait_node_height(self.node2, 10001, 120) - self.Node.wait_node_height(self.node3, 10001, 120) - - -def tar_file(src_tar, dec_data): - run_command(f"tar -xvf {src_tar} -C {dec_data}") diff --git a/test_cases/soft_fork/test_sync_dao_lock_size_mismatch.py b/test_cases/soft_fork/test_sync_dao_lock_size_mismatch.py deleted file mode 100644 index 4cd0bffb..00000000 --- a/test_cases/soft_fork/test_sync_dao_lock_size_mismatch.py +++ /dev/null @@ -1,162 +0,0 @@ -import time - -from framework.basic import CkbTest -from framework.util import run_command, get_project_root - -# use ckb0.110.1-rc1: generate DaoLockSizeMismatch tx in softfork before and after -DATA_ERROR_TAT = f"{get_project_root()}/source/data/data.err.tar.gz" - - -class TestSyncDaoLockSizeMismatch(CkbTest): - - def teardown_method(self, method): - super().teardown_method(method) - print("\nTearing down method", method.__name__) - self.node1.stop_miner() - self.node1.stop() - self.node1.clean() - self.node2.stop() - self.node2.clean() - - def test_01_sync_dao_out_of_starting_block_limiting_dao_withdrawing_lock(self): - """ - can sync DaoLockSizeMismatch tx - - after softFork active - - starting_block_limiting_dao_withdrawing_lock > dao deposit tx block number - - 6000 block contains DaoLockSizeMismatch tx - 5495 block contains dao deposit tx - 8669 block contains DaoLockSizeMismatch tx use 5495 dao deposit tx - 1. start with config starting_block_limiting_dao_withdrawing_lock:5495 - 2. can sync 6000 block - tip block num > 6000 - 3. can sync 8669 block - tip block > 8668 - Returns: - """ - - # 1. start with config starting_block_limiting_dao_withdrawing_lock:5495 - node1 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_MAIN, "tx_pool_test/node1", 8114, 8227 - ) - node2 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_test/node2", 8112, 8228 - ) - self.node1 = node1 - self.node2 = node2 - node1.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5495" - } - ) - node2.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5495" - } - ) - tar_file(DATA_ERROR_TAT, node1.ckb_dir) - node1.start() - node2.start() - node1.start_miner() - node1.connected(node2) - # 2. can sync 6000 block - # 3. can sync 8669 block - self.Node.wait_node_height(self.node2, 8669, 120) - - def test_02_sync_dao_in_starting_block_limiting_dao_withdrawing_lock(self): - """ - can't sync DaoLockSizeMismatch tx - - after softFork active - - starting_block_limiting_dao_withdrawing_lock <= dao deposit tx block number - - 5495 block contains dao deposit tx - 6000 block contains DaoLockSizeMismatch tx - 8669 block contains DaoLockSizeMismatch tx - 1. start with config starting_block_limiting_dao_withdrawing_lock:5494 - 2. can sync 6000 block - tip block num > 6000 - 3. can't sync 8669 block - tip block == 8668 - Returns: - """ - - # 1. start with config starting_block_limiting_dao_withdrawing_lock:5494 - node1 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_MAIN, "tx_pool_test/node1", 8114, 8227 - ) - node2 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_test/node2", 8112, 8228 - ) - self.node1 = node1 - self.node2 = node2 - node1.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5494" - } - ) - node2.prepare( - other_ckb_spec_config={ - "starting_block_limiting_dao_withdrawing_lock": "5494" - } - ) - tar_file(DATA_ERROR_TAT, node1.ckb_dir) - node1.start() - node2.start() - node1.start_miner() - node1.connected(node2) - - # 2. can sync 6000 block - self.Node.wait_node_height(self.node2, 8668, 120) - block_num = self.node2.getClient().get_tip_block_number() - assert block_num == 8668 - time.sleep(10) - - # 3. can't sync 8669 block - block_num = self.node2.getClient().get_tip_block_number() - assert block_num == 8668 - - def test_03_sync_dao_lock_size_mismatch_before_soft_fork(self): - """ - can sync DaoLockSizeMismatch tx - - before softFork active - 6000 block contains DaoLockSizeMismatch tx - 1. can sync 6000 block - tip block num > 6000 - 2. can't sync 8669 block(DaoLockSizeMismatch tx) - tip block == 8668 - Returns: - """ - - # 1. can sync 6000 block - node1 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_MAIN, "tx_pool_test/node1", 8114, 8227 - ) - node2 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.CURRENT_MAIN, "tx_pool_test/node2", 8112, 8228 - ) - self.node1 = node1 - self.node2 = node2 - node1.prepare( - other_ckb_spec_config={"starting_block_limiting_dao_withdrawing_lock": "10"} - ) - node2.prepare( - other_ckb_spec_config={"starting_block_limiting_dao_withdrawing_lock": "10"} - ) - tar_file(DATA_ERROR_TAT, node1.ckb_dir) - node1.start() - node2.start() - node1.start_miner() - node1.connected(node2) - - self.Node.wait_node_height(self.node2, 8668, 120) - block_num = self.node2.getClient().get_tip_block_number() - assert block_num == 8668 - time.sleep(10) - - # 2. can't sync 8669 block(DaoLockSizeMismatch tx) - block_num = self.node2.getClient().get_tip_block_number() - assert block_num == 8668 - - -def tar_file(src_tar, dec_data): - run_command(f"tar -xvf {src_tar} -C {dec_data}") diff --git a/test_cases/tx_pool_refactor/test_05_node_broadcast.py b/test_cases/tx_pool_refactor/test_05_node_broadcast.py index 6335d1a9..05a2df79 100644 --- a/test_cases/tx_pool_refactor/test_05_node_broadcast.py +++ b/test_cases/tx_pool_refactor/test_05_node_broadcast.py @@ -1,3 +1,5 @@ +import pytest + from framework.basic import CkbTest @@ -9,7 +11,7 @@ def setup_class(cls): cls.CkbNodeConfigPath.CURRENT_TEST, "tx_pool/node1", 8120, 8225 ) cls.node_111 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V111, "tx_pool/node2", 8121, 8226 + cls.CkbNodeConfigPath.CURRENT_TEST, "tx_pool/node2", 8121, 8226 ) cls.cluster = cls.Cluster([cls.current_node, cls.node_111]) cls.cluster.prepare_all_nodes() @@ -23,6 +25,7 @@ def teardown_class(cls): cls.cluster.stop_all_nodes() cls.cluster.clean_all_nodes() + @pytest.mark.skip("todo") def test_111_p2p_broadcast(self): """ failed replacement transactions from node 111 can be rejected for synchronization by the current node @@ -81,6 +84,7 @@ def test_111_p2p_broadcast(self): self.Miner.miner_until_tx_committed(self.node_111, tx_hash1) self.Node.wait_get_transaction(self.current_node, tx_hash1, "committed") + @pytest.mark.skip("todo") def test_current_p2p_broadcast(self): """ successful replace transactions from the current node are synchronized to node 111: diff --git a/test_cases/tx_pool_refactor/test_08_many_tx.py b/test_cases/tx_pool_refactor/test_08_many_tx.py index a5a3d209..3ff1f01f 100644 --- a/test_cases/tx_pool_refactor/test_08_many_tx.py +++ b/test_cases/tx_pool_refactor/test_08_many_tx.py @@ -1,5 +1,7 @@ import time +import pytest + from framework.basic import CkbTest import concurrent.futures @@ -12,7 +14,7 @@ def setup_class(cls): cls.CkbNodeConfigPath.CURRENT_TEST, "tx_pool/node1", 8120, 8225 ) cls.node_111 = cls.CkbNode.init_dev_by_port( - cls.CkbNodeConfigPath.V111, "tx_pool/node2", 8121, 8226 + cls.CkbNodeConfigPath.CURRENT_TEST, "tx_pool/node2", 8121, 8226 ) cls.cluster = cls.Cluster([cls.current_node, cls.node_111]) cls.cluster.prepare_all_nodes() @@ -26,6 +28,7 @@ def teardown_class(cls): cls.cluster.stop_all_nodes() cls.cluster.clean_all_nodes() + @pytest.mark.skip("todo") def test_may_tx(self): """ 1. Concurrently send conflicting child transactions to node 1 @@ -97,6 +100,7 @@ def test_may_tx(self): ret = self.current_node.getClient().get_transaction(successfulTxHash) assert ret["tx_status"]["status"] == "rejected" + @pytest.mark.skip("todo") def test_orphan_turn_pending(self): """ 1. Send tx1 @@ -185,6 +189,7 @@ def test_orphan_turn_pending(self): assert after_pool["pending"] == "0x0" assert after_pool["orphan"] == "0x0" + @pytest.mark.skip("todo") def test_dep_tx_clean(self): """ 1. Send tx1 diff --git a/test_cases/ws/test_ws_port.py b/test_cases/ws/test_ws_port.py index c04b065c..a05f91d6 100644 --- a/test_cases/ws/test_ws_port.py +++ b/test_cases/ws/test_ws_port.py @@ -194,70 +194,6 @@ def test_remove_node(self): peers = self.cluster.ckb_nodes[1].getClient().get_peers() assert peers == [] - def test_119_add_node(self): - """ - 1. start 119 node - 2. connnet node0 ws port - linked failed - 3. connnet node0 ws port and tcp - linked success - 4. 119 send tx - 5. node0 miner tx - 6. node0 send tx - 7. 119 miner tx - Returns: - - """ - # 1. start 119 node - node119 = self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.v119, "cluster1/node119", 8124, 8235 - ) - node119.prepare(other_ckb_config={"ckb_logger_filter": "debug"}) - node119.start() - - self.cluster.ckb_nodes.append(node119) - - # 2. connnet node0 ws port - node119.connected_ws(self.cluster.ckb_nodes[0]) - time.sleep(10) - assert node119.getClient().get_tip_block_number() == 0 - peers = node119.getClient().get_peers() - assert peers == [] - - # 3. connnet node0 ws port and tcp - node119.restart() - node119.connected_all_address(self.cluster.ckb_nodes[0]) - self.Node.wait_node_height(node119, 10, 1000) - - # 4. 119 send tx - account = self.Ckb_cli.util_key_info_by_private_key( - account_private=self.Config.ACCOUNT_PRIVATE_2 - ) - tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.ACCOUNT_PRIVATE_1, - account["address"]["testnet"], - 140, - node119.getClient().url, - ) - - # 5. node0 miner tx - self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[0], tx_hash, True) - self.cluster.ckb_nodes[0].stop_miner() - - # 6. node0 send tx - tx_hash = self.Ckb_cli.wallet_transfer_by_private_key( - self.Config.ACCOUNT_PRIVATE_1, - account["address"]["testnet"], - 140, - self.cluster.ckb_nodes[0].getClient().url, - ) - - # 7. 119 miner tx - self.Miner.miner_until_tx_committed(node119, tx_hash, True) - tip_number = node119.getClient().get_tip_block_number() - self.Node.wait_node_height(self.cluster.ckb_nodes[0], tip_number, 1000) - self.cluster.ckb_nodes[0].start_miner() - def test_ckb_network_reuse_tcp_with_ws(self): # 1. new_node start with tcp new_node = self.CkbNode.init_dev_by_port(