From e7fc4ee463d92f18fcdbfe89425cfdbf1b8723cf Mon Sep 17 00:00:00 2001 From: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:02:47 +0800 Subject: [PATCH 01/29] Update download.py --- download.py | 1 + 1 file changed, 1 insertion(+) diff --git a/download.py b/download.py index 923ba134..4577fbbe 100644 --- a/download.py +++ b/download.py @@ -27,6 +27,7 @@ "0.121.0", "0.200.0", "0.201.0", + "0.202.0-rc1", ] # Replace with your versions DOWNLOAD_DIR = "download" From b40cbcfeed6551620094aa74e5ebc49260ab0e5d Mon Sep 17 00:00:00 2001 From: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:03:36 +0800 Subject: [PATCH 02/29] Update test_node.py --- framework/test_node.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/framework/test_node.py b/framework/test_node.py index 03fa87cb..7780dc79 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -18,27 +18,34 @@ class CkbNodeConfigPath(Enum): "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", + "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.201.0", + "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.201.0", + "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.201.0", + "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 = ( From b9f2009e6e460f8739e3c3d922d515e0e91fa79f Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 9 Jun 2025 20:41:34 +0800 Subject: [PATCH 03/29] add test for listen 2address --- framework/helper/ckb_cli.py | 4 +- framework/rpc.py | 3 ++ test_cases/config/test_listen_address.py | 24 +++++++++ .../contracts/test_exceeded_maximum_cycles.py | 53 +++++++++++++++++++ 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 test_cases/config/test_listen_address.py create mode 100644 test_cases/contracts/test_exceeded_maximum_cycles.py diff --git a/framework/helper/ckb_cli.py b/framework/helper/ckb_cli.py index 70971293..7ec52622 100644 --- a/framework/helper/ckb_cli.py +++ b/framework/helper/ckb_cli.py @@ -388,7 +388,7 @@ def tx_add_input(tx_hash, index, tx_file, api_url="http://127.0.0.1:8114"): def tx_add_multisig_config(ckb_address, tx_file, api_url="http://127.0.0.1:8114"): """ - ./ckb-cli tx add-multisig-config --sighash-address ckt1qyqdfjzl8ju2vfwjtl4mttx6me09hayzfldq8m3a0y --tx-file tx.txt + ./ckb-cli tx add-multisig-config --multisig-code-hash legacy --sighash-address ckt1qyqdfjzl8ju2vfwjtl4mttx6me09hayzfldq8m3a0y --tx-file tx.txt status: success MacBook-Pro-4 0.111.0 % cat tx.txt { @@ -421,7 +421,7 @@ def tx_add_multisig_config(ckb_address, tx_file, api_url="http://127.0.0.1:8114" """ cmd = ( - f"export API_URL={api_url} && {cli_path} tx add-multisig-config --sighash-address {ckb_address} " + f"export API_URL={api_url} && {cli_path} tx add-multisig-config --multisig-code-hash legacy --sighash-address {ckb_address} " f"--tx-file {tx_file}" ) return run_command(cmd) diff --git a/framework/rpc.py b/framework/rpc.py index de2c90e1..8c9a50a9 100644 --- a/framework/rpc.py +++ b/framework/rpc.py @@ -168,6 +168,9 @@ def get_transaction_proof(self, tx_hash, block_hash): def send_transaction(self, tx, outputs_validator="passthrough"): return self.call("send_transaction", [tx, outputs_validator]) + def send_test_transaction(self, tx, outputs_validator="passthrough"): + return self.call("send_test_transaction", [tx, outputs_validator]) + def get_raw_tx_pool(self, verbose=None): return self.call("get_raw_tx_pool", [verbose]) diff --git a/test_cases/config/test_listen_address.py b/test_cases/config/test_listen_address.py new file mode 100644 index 00000000..8fc67df9 --- /dev/null +++ b/test_cases/config/test_listen_address.py @@ -0,0 +1,24 @@ +from framework.basic import CkbTest + + +class TestListenAddress(CkbTest): + + def test_listen_address(self): + """ + fix: fix multi-listen with tcp bind #4889 + Returns: + + """ + self.node = self.CkbNode.init_dev_by_port( + self.CkbNodeConfigPath.CURRENT_TEST, "node/node", 8118, 8119 + ) + self.node.prepare() + self.node.prepare(other_ckb_config={ + "ckb_network_listen_addresses": ["/ip4/0.0.0.0/tcp/8115", "/ip4/0.0.0.0/tcp/8116"], + "ckb_network_reuse_tcp_with_ws": "true" + }) + self.node.start() + local_node_info = self.node.getClient().local_node_info() + assert len(local_node_info["addresses"]) == 4 + self.node.stop() + self.node.clean() diff --git a/test_cases/contracts/test_exceeded_maximum_cycles.py b/test_cases/contracts/test_exceeded_maximum_cycles.py new file mode 100644 index 00000000..8348e9ab --- /dev/null +++ b/test_cases/contracts/test_exceeded_maximum_cycles.py @@ -0,0 +1,53 @@ +import time + +import pytest + +from framework.basic import CkbTest +from framework.util import get_project_root + + +class TestExceededMaximumCycles(CkbTest): + @classmethod + def setup_class(cls): + cls.node = cls.CkbNode.init_dev_by_port( + cls.CkbNodeConfigPath.CURRENT_TEST, "contract/node", 8114, 8115 + ) + cls.node.prepare() + cls.node.start() + cls.Miner.make_tip_height_number(cls.node, 2000) + + @classmethod + def teardown_class(cls): + cls.node.stop() + cls.node.clean() + + def test_01(self): + path = f"{get_project_root()}/source/contract/test_cases/spawn_loop_times" + account = self.Config.MINER_PRIVATE_1 + node = self.node + deploy_hash = self.Contract.deploy_ckb_contract( + account, path, enable_type_id=True, api_url=node.getClient().url + ) + self.Miner.miner_until_tx_committed(node, deploy_hash) + time.sleep(1) + tx = self.Contract.build_invoke_ckb_contract( + account_private=account, + contract_out_point_tx_hash=deploy_hash, + contract_out_point_tx_index=0, + type_script_arg="0x02", + data="0x1234", + hash_type="type", + api_url=node.getClient().url, + ) + invoke_hash = self.node.getClient().send_test_transaction(tx, "passthrough") + self.node.getClient().get_transaction(invoke_hash) + self.Node.wait_get_transaction(self.node, invoke_hash, "rejected") + + with pytest.raises(Exception) as exc_info: + invoke_hash = self.node.getClient().send_transaction(tx, "passthrough") + + expected_error_message = "ExceededMaximumCycles" + 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]}'" + From 822a7c9e65ed27e2f87cce061c607ee9ee1bdb6e Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 9 Jun 2025 21:34:06 +0800 Subject: [PATCH 04/29] add exec and spawn test --- Makefile | 3 +- framework/config.py | 5 + framework/helper/exec_arg.py | 61 +++ framework/helper/spawn_arg.py | 61 +++ source/contract/exec_arg_length | Bin 0 -> 16200 bytes source/contract/spawn_arg_length | Bin 0 -> 16400 bytes test_cases/memory/test_exec_memory_limit.py | 543 +++++++++++++++++++ test_cases/memory/test_oom.py | 107 ++++ test_cases/memory/test_spawn_memory_limit.py | 482 ++++++++++++++++ 9 files changed, 1261 insertions(+), 1 deletion(-) create mode 100644 framework/helper/exec_arg.py create mode 100644 framework/helper/spawn_arg.py create mode 100755 source/contract/exec_arg_length create mode 100755 source/contract/spawn_arg_length create mode 100644 test_cases/memory/test_exec_memory_limit.py create mode 100644 test_cases/memory/test_oom.py create mode 100644 test_cases/memory/test_spawn_memory_limit.py diff --git a/Makefile b/Makefile index 4b8bd38f..f9355b86 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,8 @@ test_cases := \ test_cases/config \ test_cases/miner \ test_cases/get_fee_rate_statistics \ - test_cases/ws + test_cases/ws \ + test_cases/memory test: diff --git a/framework/config.py b/framework/config.py index c22803c4..8ef83736 100644 --- a/framework/config.py +++ b/framework/config.py @@ -49,6 +49,11 @@ ALWAYS_SUCCESS_CONTRACT_PATH = f"{get_project_root()}/source/contract/always_success" SPAWN_CONTRACT_PATH = f"{get_project_root()}/source/contract/test_cases/spawn_demo" UDT_CONTRACT_PATH = f"{get_project_root()}/source/contract/XUDTType" +SPAWN_ARG_PATH = f"{get_project_root()}/source/contract/spawn_arg_length" +# SPAWN_ARG_PATH = "/Users/guopenglin/PycharmProjects/ckb-py-integration-test/source/contract/spawn_arg_length" +EXEC_ARG_PATH = f"{get_project_root()}/source/contract/exec_arg_length" +# EXEC_ARG_PATH = "/Users/guopenglin/RustroverProjects/nervosnetwork/ckb-test-contracts/rust/acceptance-contracts/build/release/exec_arg_length" + def get_tmp_path(): diff --git a/framework/helper/exec_arg.py b/framework/helper/exec_arg.py new file mode 100644 index 00000000..b3be7f7b --- /dev/null +++ b/framework/helper/exec_arg.py @@ -0,0 +1,61 @@ +from framework.config import EXEC_ARG_PATH +from framework.helper.contract import deploy_ckb_contract, CkbContract +from framework.helper.miner import miner_until_tx_committed +from framework.helper.ckb_cli import util_key_info_by_private_key +from framework.helper.contract import invoke_ckb_contract + +from framework.test_node import CkbNode +from framework.util import ( + ckb_hash_script, + to_big_uint128_le_compatible, + to_int_from_big_uint128_le, +) +from framework.helper.contract import get_ckb_contract_codehash + + +class ExecArgContract(CkbContract): + + def __init__(self, contract_hash=None, contract_tx_index=None): + self.contract_hash = contract_hash + self.contract_tx_index = contract_tx_index + if contract_hash is None: + self.deployed = False + else: + self.deployed = True + self.contract_path = EXEC_ARG_PATH + self.method = {"demo": {"args": "0x", "data": "0x"}} + + def deploy(self, account_private, node: CkbNode): + if self.deployed: + return + self.contract_hash = deploy_ckb_contract( + account_private, self.contract_path, api_url=node.getClient().url + ) + self.contract_tx_index = 0 + miner_until_tx_committed(node, self.contract_hash) + self.deployed = True + + def get_deploy_hash_and_index(self) -> (str, int): + if not self.deployed: + raise Exception("pls deploy first") + return self.contract_hash, self.contract_tx_index + + def get_code_hash(self, type_id, api): + return get_ckb_contract_codehash( + self.contract_hash, self.contract_tx_index, type_id, api + ) + + def get_owner_arg_by_lock_arg(self, lock_arg): + return ckb_hash_script(lock_arg) + + @classmethod + def get_test_data(cls, mb_size, kb_size, byte_size) -> (str, str): + return "0x1234", to_big_uint128_le_compatible( + mb_size * 100000000 + kb_size * 10000 + byte_size + ) + + def get_arg_and_data(self, key) -> (str, str): + if key not in self.method.keys(): + # return "0x0","0x0" + raise Exception("key not exist in method list") + return self.method[key]["args"], self.method[key]["data"] diff --git a/framework/helper/spawn_arg.py b/framework/helper/spawn_arg.py new file mode 100644 index 00000000..2ef556da --- /dev/null +++ b/framework/helper/spawn_arg.py @@ -0,0 +1,61 @@ +from framework.config import SPAWN_ARG_PATH +from framework.helper.contract import deploy_ckb_contract, CkbContract +from framework.helper.miner import miner_until_tx_committed +from framework.helper.ckb_cli import util_key_info_by_private_key +from framework.helper.contract import invoke_ckb_contract + +from framework.test_node import CkbNode +from framework.util import ( + ckb_hash_script, + to_big_uint128_le_compatible, + to_int_from_big_uint128_le, +) +from framework.helper.contract import get_ckb_contract_codehash + + +class SpawnArgContract(CkbContract): + + def __init__(self, contract_hash=None, contract_tx_index=None): + self.contract_hash = contract_hash + self.contract_tx_index = contract_tx_index + if contract_hash is None: + self.deployed = False + else: + self.deployed = True + self.contract_path = SPAWN_ARG_PATH + self.method = {"demo": {"args": "0x", "data": "0x"}} + + def deploy(self, account_private, node: CkbNode): + if self.deployed: + return + self.contract_hash = deploy_ckb_contract( + account_private, self.contract_path, api_url=node.getClient().url + ) + self.contract_tx_index = 0 + miner_until_tx_committed(node, self.contract_hash) + self.deployed = True + + def get_deploy_hash_and_index(self) -> (str, int): + if not self.deployed: + raise Exception("pls deploy first") + return self.contract_hash, self.contract_tx_index + + def get_code_hash(self, type_id, api): + return get_ckb_contract_codehash( + self.contract_hash, self.contract_tx_index, type_id, api + ) + + def get_owner_arg_by_lock_arg(self, lock_arg): + return ckb_hash_script(lock_arg) + + @classmethod + def get_test_data(cls, mb_size, kb_size, byte_size) -> (str, str): + return "0x1234", to_big_uint128_le_compatible( + mb_size * 100000000 + kb_size * 10000 + byte_size + ) + + def get_arg_and_data(self, key) -> (str, str): + if key not in self.method.keys(): + # return "0x0","0x0" + raise Exception("key not exist in method list") + return self.method[key]["args"], self.method[key]["data"] diff --git a/source/contract/exec_arg_length b/source/contract/exec_arg_length new file mode 100755 index 0000000000000000000000000000000000000000..df30d1268b8b578f750c16b3545948e4c12ac1b3 GIT binary patch literal 16200 zcmch83tSXOx^H#&^vnQ*LWTh~F*`CsaDpSu3owZb$c&20Nj%YP%t^w~3=so}F!+il z149oF!AC~GSMEUw#E{2zMI)%9>pRl{P#n?kRl}E zFupvVM>^*Fzr83>h3%6G?KYnOK>-j`(R#*~m1R#?r!KSS z7i2l+&MnAUpJ&UBn3bwtlcTofs8cO@d8z7kwyXj>C*k@Go>Sx(({lnoC$Avi!OV%( z+oR1Z4QS$JJ+FhtWn$2)79%U9jnx9 z*4gtivevABagL6$OjK05 zZB828W*E&}HCAOlx9Zs}`#O6TuRn|AEnOt&H$nde!u?|f_PmXYpw8;G`0m+^9Ce=E zQIN+qo;@#bO&-tiCxJgy;2$sVAweFqCI^gXpqlm#c8048zIhhxfa>Ht=UBzpM@{kd z2@~XLA^kV_jmMt=Oa;GxWm|wav_a4>w#P$&;r5saR|9@ipod%T8m&*B{khD12Y3M2 z`8nzK4LT;z=CJ4MGS|#DXGF)O>-A}AwrEpSRCLCiw1V{XjkCdL*D$lAbS7Oi$Ht-0 zawy+AqL#b-BY#z9hC`iYhktju$sJ<28{<#eFd#B>vo=mhEtl}^|CGS3gcQe#@puSe zegX|n#>mevNaMQt|42TT;|sru@d?vs@1#HR$_yxdb{0e^G1o&5gO`8D!7BH+g&%U-GGtZu{&V~S^&bC9cQJtS_ zW9&F&WaeZ#GHqFzo9yaD>{$uev49JLsg&PAS)k9d+cMPo*nn&Zyy`T&8q9ev2OAe{R;O)*fdrHYJu2hv(Qvt6 z*7pqH6ZO+fU<-z_@%AMEK2d*Y0moxuJiP^Q9IM9TO98)s0=xw9ITPR&fa7>JUd}55 z4iR3xCPV1x3F!6!-9+u&0630cK!>Kf@>xBAE7Kr@%R{z zzxXTodcd(=0w<8^N;tS7rxF5&kc)p5) zpE&<>!J7-_dA9Y>uCp@`$Qc`q(@e+4(Fq;sBYk=K*d}}h2zl&__?iLpD2|7}lq*gT zLJZ)tHb*8bbHHEtk)qD9Wx{F*%PA7%Vqe2ojgZG}jIUKf9>*Sh)j_pz*?7EGz-Q&z za-OrR?K$ZXbYPNGC$53T!TO~I4p?BV$+KnQ*4(I0<4}A0Ts0O7R|pO?aNWcGhj~=c zD`ZjmJic7ai@6E`7X^*y%N688b8%PH2C>CPS7I62jyXBv`fIO1kLM43Wx@~7Nl`E@ zN9m&sQN}1!lsPIUDmE%EIw~5LcF~4tW3(yS932xK8y%;Q(nss{un08jO?tCFMjxw> zGejAp4SIvYU^JKvW>`Zy3B2W)Ww@!gZ}u;n>~4pIxDgfGchlc&zl%7keHyoFzgslj}- zTXA>)Gzod^_xQRc^p~)_N8`)$*A(P|P+qhkH)57LeGN=mIcps1Y@35wrB1i!J2G>4 zZ@rr|z@OJI`e~Su7uWe>zl(k$)`Qrz3=ta$;$8*GZCP-v*$mDs?w5if9|^wz7^Fr> zQR1Zd#6kjLJPCf0fa80>14R5kAR7UA5syELajee)zn1|QeGOx!@N)tt`ZdP(!|%m0 z7?ytsewzV{g%osgGBN%!{PqJrm&a4ZI(Q-f2f%ea9wp*tfyqu`yJM?HKU^}4P3gtRpUi_nX%6WM}69B(=fNqJ2zsI6*8=L`bAz<+s zfVzmb_5hwc0X_uyZom`A&|}#_p!*}hab56*Wk&!uF9xA?7)YG71KW@Bc)<6M!?ExD z4)C7=PscLASFF4peE&mPBJ6{)E_~s%6w3!}5{K~Ee!yY@6MYcV9Re(J3@;`pEs=<@ z*1+BO&g0=8`JZUK#+ka-JydtIap05wb63yzUFdnc*!3<;IPE)Z+A?3Zj;#T4-#cr| z$c(2uXi4^&#MPm8XV0<$ZGT&`{wfo&($Bdnq<3UQDGQ5iv$R=5*%~$GNIgbbb|IIg z7*W<&k;{4nh0;qa6Qy0!<=Y;sbXh(J{3PH#h*~g!>gYdLek4tkeYLH#vPjk3(|{;T z5O7O?Y9>$_$8kRncoN|0!0i~vZ2;~WwW0Rey|Zg0m%&Hkf`6=i4b+kLV4CniNY(&byCvjN(d}3 zpF<}K_;miGe5!e($e9o*?V*J}bFSL5;>BQE%Bb2=U1|bR)<>FGcDKZ>JJcl zdab*s&Ko|Yt7dYJO0>mtyC+D67^WH>F5YQjx~tI6Bv0oN%G07k%IYNaGEJNgO1+0R z_qSQi1KOK`wd8W}!M`a`~mwxp?i==%4YaE|18=!L#j^+%e>`mMf*N9>CL zd8dgimA8UssKui4DqdRZS*zW4Hr(NMguo_^vMetOff%5qEl;;uK&ONsFKRm@r=zrG zl8dO9YMDmWzptfsE^@W(B|(oA5VHQzT)O_yF)3gK)J8%l*B?oy>)$yhkx$`u(o031 z>W;($W|~FTnCVWZ7g0y{NwQA1Rl}g<9W{fIh0* zm}oC@bdzDXryt~PWEcBZ(N-AYTtq;BS^go_zKLLh=x`#ra8bgdS+!jLH}p)x5_gb# zcQ1wWu6IH6RC*>O_X($t?Ug78efo(cM(#@z)_Z(EVRzYg+v-XVSI^yLh#5e~s+r;r zWN7U`%ssOE6Q;G%W_R~*e1|;OZ%sbEt?=B-Qoi-n2wOM3(LSu=(Psl7BZPFvTTK;h_(aLNrR<$p4GfX)Ob%(Ry$J~f=KE%^D-1`Ze;yy1>BYikqmrFXj(i1c5 zGRf5zh?zv7^lE5dc#pQ2=U}IV3e>ggreflBIQTUnoK&?oob5_YOs`9)@vOwzKs|d$ z!VJswkCiJ&xCQ*A_>>EP?_&5)>fD0u&N{iMH>Pw--f{5vVMQuwHN{mlQ4_7UEIB_*KbS3(RTq z21~-_!L0kqGL_`$v$( zt1-?bG_gkFVrwDDVMpaekUUSkS-d-LTHeapBWK|7uLnd!zz>l6NjHY~SebtS ziV?^iurfm(QiH5E-hXSetQSq)79)clmMkQ|GdMW;J+_xzyVp>13RRrY=vs%F>m8Ca zCn`>9w5`LM$kySDR_1mGdFE8br)NH`_@h!LyUAL!K8yS!>x;;5ih`9l7N8;(E49fA zcQ&(~Q;QO_?zPIz(-zdZ7NaTFrmN`Q?Drh5rY^d<*O_C zgWKS0M~^I=evmpvBbH`mTY~Gie?R=yhpq@2($oeMu80LlQ-{+Mq9egDgi z46D8*G-??^9bAC+U2qfo?k`2nmo5;GpV+nFE}EH`<`hTMCL5(Xl^|<&_r-Uw`tE0? ztYbLP<&lM;mt`Jz3_4o1x5gCA+dsEjxn4>-I|CTpWLrPwyrNIjQ^jcCen-ZWCr zrIry*InFO1spnGrh-NF!7mU<%DLbO6!1=0?dM<4k(NyAm%Sb(!wvTAG;e6*vJ(u>5 zjBQKhdN+#WYH~n!fc~FJvZCpnq@A*z^gq}6YduSscdMjbMb10@^#HPP{U!F39QsL0 z+}%%7=qEXGr=P~qjP{e1!2Kjp{c1lw!1YsH@PQAMt`P99FVLbCQFAE*4;iP~jiB$x zXdXi|s@V;FJWBPennO6vj|AU(FTfUL*OlnmqwHK^9-jYX+*<9;5O_GLq}gHZP)H}< zYxSmRy|CBnA^QWS==-!+eT4`NArRt!KgDD<;(0*A{Mb&?R)eY$8B{GW-g$0zSq+xr zW}omm$Rqa0c*MTKLq`cwQVn}@=I;%NaW{}k%iu^;6+}o0^K%19TgFOjSi$p#JuXUP zmy7aYrAST{bc8MD(S|4P=}5^%-4LWof2o z-5_c<{|PB$ROqX1%s%Pd!eofot2$AoRa?UP(uLjEE)BcRu!NqyAgmy22buIYBemsR zOWbUVG|)>D49k}j#A2AmR<)o?i`Gs1Vb1nprT>G7v1QM;S(;66kxUgG*(`aBJim*% zoHSeM^AK8Ayk%-*8AJHMPR3WKi82x?EVEC+&EMSo#?NQ_C#-rIfCcsqpa zf4k6@_O!n=<@7KLe|ce&Qc{k>*(*X#kM}TszS`-u=P48H>Wu`mM}e@^XM}mOw(8tI zru(7kti&eyuBIyj$dSKZ-#5jv{%#m$$@1z zbA~Q>nXUf!DYxDpVJN>zIeqj}kKccdJTuBs`x!&{!Wz&Zc^xr1Gbck^R=z==f5kw* zK`yKEC|Kn2p$TSH1?*V-k;0~lf@c}V*YVwvFaqxBF?8> zEzsgCOz3bGo#XrTYqsif}-+CaT8MK;M6Rk!ThVV6mPD02l;bh%6waHl|uOOjk=^5DqIy(#Q@HcjwM zWb!OGp+?TzrkAmc4OMRlUdQAw_VM`sJhEbRUzJ+dEO`?#KNS189xf)wN~w*)QZ5Nn z?#Q6#7Q@)TFsefX9m*xGp?@g%jt2=rAem3cUn`0uFMt3 z63X(QM?A%4B%Q=mmXl1m&ot^i3Ce)yxMB=Qy&v2Db(O1~8=svGh%Tcg7bUi@HU=>n zNyN2Uh&YpoB#$qWgl=Ve%8}9!NnGz$kktDMWV0CPSILwrkAx-ZrDNrKr!W;hL9Q0b zFdt3u`1hfZGT>`wu*7 zCq>DYYXThszQM_;%@$>_f8)#8kx*mbJa4YFqR2qsRdL zEk@I@&v~w}5m5*I8IRDz+^T}pay(bm5;n}2HVn5|I$L+xciEI1q(kQ2%$hG1yE8q@ zGZ53=i;l6ox_qp=E*&jl{?;zPt@3>7rab4Rl=3q->G@1bD!+3Rp6{fD@~>`mw8ZS5 zSK=v=NtnNXFV#3tA>|Wps^0ZIq*6-5rEapmh|7~2E_D<2gsGdDVXxJ}^`r_}29clMnx~_na=Z1=*(9gSvz4 zQ*1%sGyZt(DPOI~=zghX$V1Z-rmq1huE1LVVJXtFVh!j&@G{vOVhy~%yEFdbd4uF| zv9_4G)sEz;ac4vLd2e{j!H85#Z$$d-<&oa$y$e&DdLlMAc_TJxhaynq6y8^yy|g8w zC)6I%muQc;nr4saCkrA5l(d9~=R5p5YalX}r6ax3m*uIZi*k^r@Tx8^%x&shnAOy? za8;9cVY(o(e`Ewske;M1@*a=?=X-c2ui?;m1x7@f@p}{?Q{m;u(w%X`{y0mV=YA5# z!y|X>{G<<_;@Fsb=%BZY$5`c!*bMqNXm9$m3c)J%m)I&2tOCoff@S?+*+9gq$Sgz4 ztK7(MZaIRoD;KpzI5JPeD0dz~$_p%b*hxrf@GzXR;9*=IJdDeOhjDrEu#@OOVLfnp zmIGG_PJxR{fy>S1Ne!2>L_N#p!Rt7BR9}1qJo8mpi@ggyq)4Ud2yeqRzGam@62c$1 zZV$Asci}4S5VS6D8P|^9`M7n&dLxvg-fzIjE$IrN!PxRwk`&gJI~pXq6wagali)#dTYmgC|I4!vYK}{e_tbNGY11Ei;yTZ#qHzhM^h~W5SE!3+mo_d;DA|ZF4W-V}X z$#FYhn{|-3%s9wvSq|J{N$UQor|a0dR5Bf(zVWslhm%&?BA%kCVV{bhR_EN6)LJlp%`xpGj z-WqZNcJ>GAgD5@1ID_X&WSxDOkS~*Hj0Wv0n=orY>#Tk5RgfdZYp|x8EdYl!jfU zEEN=MX;!?Fz?^OHwe?=ErHl&FWvn1WA!e`16_s~9}^|=LoGU+AKFEn{a{yCjzHb5 zq<<(}tch4ck#>#ZP4cS`GK!nu+fUqT85@uH$)qSo9*E|a9WB-sH=c78Omfjuq#PKW-2G>I*kuVu9>)LyCj=C8tCVzE!qHwC%qi5_?aXr$=tDEQ9`x1@ z9{WqBp{EKllhWlL+KQfT_0Zu+xhow#U6J{rhc?6gNx0wG%J^T9VlB*Pv;@yjuo9cZ zTx`W;KnMOWg8Ho>qIj@YVBqfw_D@0xxT_dlP zFuJz+AndafjV@*#OH$UYRH22n8hl@kXa3kh&gwYN63IJjlUX=*;p13HcMdz`GHoR( zlOMT18%yiTO?1>b$c9LA&syWnTBXz<;rQuHP?@Xx{%a^ew3$J zg>DBGejJdy0>&)%QQ9*7U{Ds`Kc~2P?|9{+!6zO(@-}$n9_*2XNX>#r2G*W0Hnb!W z6KHn6?QUYZvs3OAuKruRHyw@FF!w2Gdva5sLjLyECT>ns((Q%Xs}SGdt(fsqJHCOB zZ{zr_qx|joNpJg0zse8up{QRjhxvlnpV-tFiSE|#&*?vi_(*$a-cY{+^Pt-!D?k_b zHJ82?&-`5#Xed=Bc$UQ?ri={m6l{PsJ+u83YL;D(KkTMTz@HzG4Jj9dpt)77jFsNL zVUPtAgmvdx&$`l)W7RI8@Vq7)@|+4m^Qv#d$qM>65wx%L z`eaYFoIJX_ErShL?v|3~-TJEOwaOX;npV?Hz8LQrG@#~n!NiOr1N=8v8>CVy;bnc* zpD#0|q&#@rTo?GKqT0pue1tp{QV>?p1r54*zFOK$eunnC_opdO-58nf+T*IoczU~G z{TBqByucaKbl3jXdkVj*Y#!_+M2e@k@6W*$$EprjDLa6xXpigZZH9Fh2#;Gz>Z-f< zuK4+tR>HF9v`Y&1jm{jmRW#TK=hs%x;EBoGXr0GnnxuG-J`~?v@CQ^`=BYLzmx)3% zC|foR>~s%Dm^+IH%yikt;&rM;AeM!M3%1yRK73#T4b%C3*3sn+g1 zT2(*!=rAjr>kd4PpIzhF-Q5)o>!w`#M~DhYZeR!F8E*p_f;~stU}Y_3)NHMq>(YsK{Zs8fHA(EpQGY9g(c-;ULqT0B-O``bHOkDoyZuL^PO)t7o!Sddbd zOL}Ah4}^3;4JTXYG5@#@aV$#8Txs;3Wo0(BPx44_fL(#`yyRXQ_93Vd^&TV^c;pGB zhqRG3!LTlC?l6{R+`CP>md)6=?dSpz6)$bQG)V8;etmM2+hDT8`!WV;JM~^kN4&CH zMlE{TAiY2-9}gxHij?avy=0I$$in~Z2-#FkB?Y54Pjhh}ylE#z_0D4Sa}9Me1i4Ph z;B4q5GPt`?J#r%rx{lU{ba(v~PW{$%_3i$-aX=YNgKVgS`{)ADKw64C(s*ez+^Jr% zsuFf?4B1rWvZ`Pe4=WK_AUalq&m}d^*N~o_W$n&t@0ZdZ>Gva>swja<2~_5qdIYs}?0NjP1YEE(#}_Pxx$D?da0rF30RHXHcrL?#!-sFh@5Tfe z-9Be44qSicjm1y8V=uI48=d2>krC##=A&N!e_y$;cFsFV=)BevZ8%uJCNtqbHUo z`WZq$e~L8B(R|o>?Spf}m%jPNc=U^+@9v%d^!ASiBmQGMDc0`<&H?o9{p{Z!d*^;S zf2z6f$AR5d=MN=+GcRoNy3d3ZzUo-_U*E zJ^tj&olB*E>~|)O$7j#K?{8h^X}?8IZ_LIM3G>DJ?cuMfdxcc2?-}6|%Y}3gXAJzC zCETC|^XJc1!<*^RdYxVug}Bc=)$pNZKK_CtS{Gx|MX4i3Kl@a}`~HU6(fZl?=vin< zX3q2Wyt(QnOOn*lF}f(7871KFKk_p3nRSRz!>uHM&Rb_TX6kdJpUu|iMm=l8cMROY ztI>ID(rpeK(%Dx%n~`VBwj-UxzQKWXJen^gY5Dm`$Ngj0WM{*7S-^-D=-`vJyv(!$ z{3Vnwe-(Ud=&+@M%KzDgy&3<+_t$q2ynl=DQ1_4h=nv?G;V`Ncj}puQn{MuM3h(VZ zg%3o$^TUH14iojiBgBVy9^yI1*O!+rO5@+x$1+8J zF}{fWNPV})@%-=#KUaV7ue&ah|KILHd0GsKaw)%_?z+k{|(f|(LewI literal 0 HcmV?d00001 diff --git a/source/contract/spawn_arg_length b/source/contract/spawn_arg_length new file mode 100755 index 0000000000000000000000000000000000000000..b12519c7dc74bde1644d028e34d5f5154d3da9b6 GIT binary patch literal 16400 zcmch830xFc*6*#VuIdIGg)|MW`C3{CGTK5n-7HxKlxh`~Nqo^s%p{>Hnuq~pY1|Ss zKvT^kxTFQ#@_h(_5GKjzh-hMxQAW{dG?OvWB$G_0WfL9EkObTY<(*p#A|dm8?|t)o z_4{?-y8k-MJ@=k_?x|Z@khlIjK-m8#K8YJiEc+K=KH@rD1@@HeSdmnY|dXuuw2U4bGD2Od#WyZ zsXZ@0!x0;spS3pEmK{1XS+_b%XUozhv$?s+x;3_pe7hjQ8YFVc{BrrAgwM&%&vS5d zqK)u&;Qccn3G`r1gi!nt+80Tc9r{vml*U#Zr=i2Aw z<#Kb<9roNgj$B*1BX5q4=+_a3Kv($2lOIv=ERFQ&}SbEM9;rP-kiB=4zoqVinARR%N~5 zSSdCO=_s*Xvn08={1yC0<4*ymg`edYB7K5XCQ4iXF*2Uc^l!wqIbguo`C&kLy3&9a)2{+72gJCQPvO?2PqeQa>fx^Nhr;ffC1^(Rd(W<0KkfjF6v~pCY)<|B-ww#~XfQ$sbGa z6rfd(L67l~@oHpyg#O8eiS#czXaxOF<}Zl;N&8s9yvD#k25jOO_yxeG{|r8L4E!s= zCXa!C0~pquYtP9~&$Z|2G9h5;GGTV+uGhib(8|=Ed*t6oXV*wXJ zM;XyyO+xLbc8!C}SiT*m|9U7#j|*n^83X?Tu!u46n}Cf)-}y82mnHfPyDd$ZhYiSt zK(0%%>%g2BvaoRx7G27Em`Fg0P_0t5M=#WV+TJsOk2Ov+fGq&7jkYfy@Ug}t3~)Rb zM$@x^2aka-0sO%+@Djl1jDc4Gj^pBJ`L9VhtQfl0Y0^NCLAMj=#_Hz=z;XNSH z+%Nyuc$H?$bBqdCDlbq3#|q&ep$sVT{1}bD@-z5az_DGU>9+!g?fSR2KWlZ?^Ny9d zc3Wy5EXwy;@{wdmD(J)qUO(|Tj>f|P3x}VaPYA(V24ya}dZm8_d&m$NJ#} z0q9@$7W)a?gpXvYj(rgy(_vl4@$jc|<>f(&0YcU0NQblu{6(B8x-?rlWLH?uIY}<| zHGEu>>bQ^b@vcTcWOL$axba+fecm$-15vGX9 z2y=ubA}S&}BE}eQj4&D@sf;w5jTU2+G1?eo3O7ZVj3$#Q(quMSOi`w2Q%q!dWJIJf z(i9mPX^yl+Mny(P#+bv+5oV*=WR5gLW@?TyN1J0T;g$%C(PFYhTFe%UCCU(=rU~%Zlx~Op65u<620|)(qtb|zwD>^QeD1pkjGv23%MP{ zhNXyDM-Wrgq;Ly_W6ghpGt2j1{!qucX)#RFNGQ?V@o{qt354+k_|*cA&jI(9@!vpo z58y>2{y4_5J_r05SoCCH!&oW&`hiyVYmDuI-wz`&EPo&T`T&cD5_AbNG5!(!d_iWc zh$qW!@Ic)NxIx6jWgM@s3jhaESk5r+3muaTIJR}9{7}FhfG-yD0s;hKnmE9l0EceF z^w}#4iBhtRdR5`3w=-4BYE_Nb4)2}gcByy!2ZmGTt5ug z4Whib$M0Pi9TP9lsUZkMTIbePJ+0;@Eed0z3=wR4fC0#VXn%jz3&G7;~@f zSZ67g57>A(#|Ost0QMGOvJYZxA7Hg3crh)>&O(H>2F@-O91U@+KBaMvGbzV4Sa-9r z|8(CcSI_lc=z6Ev`5sRc*tgok%DnkHz6Qhr{U$Q)*%P!P^UT~;LH2^KrTt-jZHdOK zobQTp1uFx)hlVuDhKJhNHfs=Hqr)7vZ4|p5IoV=FSzkv^>j4x*FR7f%bTG>{KT+vq zKL`9c;9ZEC-;e6(KUe;dNl|{a`Fv%Owxz29QLI03D}ZVSP(_a7eiHBmz*B+SF^by+ z+|z4=?6bRP*M_RZ)+B!-pLx#GEa$a?AXuK&7rciW*n0TaN0%Xeq!-eMzlrpZ>_k1; zR!5_QS>KaxUDdeC%T`n%*hqIPYp|`ZZlCX2Q8Ma*h>kJ3!8hzG&4%@ngJM1SR#-oI z6Q8^3?g_Gf-Cq%+dRWT6h9L^CXx1>K*Ofp>FJC~^MzM7MS}eKeiVEWWm@Zlxv)WY~ zm%kD~Gn}>^)g{LhMFoD{VjGUOAtc#(9HD1(TwQgZkU>K=mvvAPR;;qS{k4eWs?q-9 zZ7kPWg|;QQ&mW-Nty-k1PC&2H#3}#e2WU%Qo7K`EcGItx?AIt2L@4t26{W_#U1y(b zFFbo^*za5)cNqN6qv&c(W>PyGHt44gyVR!lA)_UTLVcv)EBf%lSM-l; zds!bneWN}yVxvAhexv@8CtiwTe9;t!`P@Xb#RXb`p6S`3?ojn`0d#B>4cF*_`7Pdi zk%s86tzOs`QSGm=jhNHj|CDtuJ~n`feT>wc>*C`a`Nyixr=Z$z^xS}(f(gJxVK zMIL&AcUAp?X0m>hHxd#1LO|YaCQDU^K=W>%UszrxN{jo%YPX#Yakw0Ta9c*Pt>u9b zC1AYmZ7k?ih^>js{5UP1?TfRNww~x+}Z?WsM1H8 z3B^TPQGcLZp^{pCPlD%4X#2~9Ocu{=iVfjx?NGoYRr>R*iN_NdnFzN?zIMKym=UJ$y-k2QG$LY zHq(YG#YJ4>>5Y@>4;&^t1H1;OoL>l@>HCmLkr2-%w=+@NLw}w^SLGK?BDJR0H%aq0 zccd0IZx{P`Kxy*Yi+)a5^0AS+^x?sTsO^qF)^@o+;;1BLev9JgrJy4tr3|-Nkdf0* zVgCZZ$DW1#Oq3{i{Jv&pI*a}Bo%vljf}cscQCE&ktzJrhc9QOFGSM(n|;rNJoEf&lZxw0%N1hmweQ6m+^+6= zK~stS12?^ol;X`2?`kndp-McD`zDC?7C=5BMj<2eIZv9dy~4BdMw5J%M9gVWs-mE_k#p6HWd7#xmer2)Wvb-D99DU zgWn4?ur^MlrKg|flU(N{YF$(aUzbffI#TDR*QJxIScs~GA9FRRH>4}9SmfxQ79>$0 z4Q?(bPKCfc07Q@)Hz$PeNS>QomrCPxORzzodQZZ1cG^dp<;N-QcW(bkRCbC#zLyP= zW5TWJO@(K$4vIBDG6MgOI9oSDsuc59z?~!8D9z$pNMzq}?XTkc&m)2@Dv;Nq;S~s0 zo_9v9K*yyOC=zWJR-o~)0`2|j3MAwoIu@@$JKH+!5w&=|*|_W#EluBBb&3kq_QF#t z+h%&YHITxirtdB)@X2v~S9hhc=X6KX-KDpeUpJP$Qyx|v3bPscx)sP*jvczGAw9Hx zx2nBp78#1l5(w)BS7J%wd}0C4khpPGDxQT^Pu0N2U*4atp^-0_V;&bu7P3jwD0m`& z0K9Jk_mbJixJvLrWpF+Cvu`+ZgSMqoAH{{ci@f?Yw6|}-54?SMX?v0S0oxlb5F+Obtl? zVg1q#`!|?j+>>x*6#5RuG#4AnW+7;+=pU059)08tLLVJTTs%|=a`<66p`^%@{IGoH ziCuO`u!m{bjxGO0%J0xy2&HIkRXC3KCP;oo`h$@Vb^0q zk3Pr?eVYCb>DHQ2U=L(YjEmo2RbeaQDKkZ=Z2ALrXeR4ZtA`}EsDNgtH~FxBO%1Gm z-+qLz6%}Zq&C{Tc&)L)N8v_&cXaJd%?Wlgjjk{%5?(PXyJs^4let^`Ezj1e`mHQD; zj6iL#l^Z<4n3T0~KAT#U-DuM0C?(w0DFc1o0|OJ@=ex$oOK`*F^!E8}m_-mS=3r z!fh@5dGfKEJJ$U*CfB7nuJZ)6Sly|kY)6kSnASv{q!CZ^%8dc_TQ1%G>WDK`iS)GrgfnzL(%0d#1nFPLp>rNa$pGS<;%G(%v5|uUvLSXYTh`XTX)jiE6I6+MpP4x zG$kx*DLsiepJP*elDKil^!kD?kn;rOm(C~@pHwf@f|0)P3v{?-a>@32Q=Td%cK@df znO1&D=yghhYMPIBUvLq-A1p;JJr{^4k8PiSAI%I*b5fvbQw~#|j90d}dgD4*etTP^ zJaO00=~f1!SCwv86gpV7tHvB4+83Dcfj$DYi{JR4FO&^K`bu1H9jX_~_96XdTt7clFO=Ow zBl}Xb)`en(mh4sTrT=G=tZ14bX`6Bz{jYWY+{n`9om!@&sNmjsJ%m_cyyS6G!8kF* z{o};IIH`zx<1~V1c$^plkCR08v*YxTFitT6dq31T1Hrq#Kns&(&7}xDWRzwXg0UZ= zc?8X{W*3a{FxAg$4iq#$8gT1ZgM9$*9}S3eHIN#1V5qqYVy=R_-9XapNNM(8iM-v5Woc}Z zEZdhx>GUv7Te-_h4|^-Aw|U0ZF`2Rt(F;Z~h7G*_0UyVne$ z7R#qd6QxC8ZRU0}v4x2cuUDQ&mDaEl-kUD$yw-Eqd4?y9`~^8n8sJjjniW;FW;>uQ3$%eV;ahS9HuEysVh_hwRwy`bdw@I#wp4Fmwn>@FjyPPmv zUOJ=Z3@-JHifFY^Je6oKwzZCR)PYlB`3uT*mBvuTr0a=cqnPST53@ZZU~*x#nnnkPZhK8GObIgljh zcxYQo*(SvGte-@WGtrsEMa3tZIyJ#}rq^Dn^sD{0ENQs+j$Y(!Z-s=FgT`XIGU9}fE`k#FL&1HlBorwLVk%O}b?r}eGnX@LC=vnb${j*fy^;D1~=V)njwzuO-YGQhG zy7#J{4c3<$Ut(VF$*^WNW-h^*voPxIGsID6S-4jb@+r>=xK9wS(R%S39d-VYh;&aE zk#6IuBO=nS6Ond(n?%!~5s}~-yfjPsDI!Aa@ytq>ID@B2bo!?yPTE^Uc>Oeaeoq#W zZhfUh)9xc8Y?K@s8q^}v5QS&6S(46%ifH>RZEc|F-w#Q2p)w~OA|iBbm1KME+p_KL z27JxUvvXwX2EkG{A3R+gCmm#n({fx_>v|izPJ5CDm)>07zoPHCt0}!{UCm`w3{OJF zOmQi}fiz1jGHHVeZXHCTaU41B0fz3(XuV4v^ddR#W3yET2sv2 zF)<&j2Z=Rn^wjzGFAOf@;WYWk(b;1_R#X-JGJDx7R6hL`>xo_`A9K2Qc7(& zmeM0hxhI2)Erz*&VOX2afa%Wtgie*LwpDmayVSPgZpFpv{>#fdxo2+q)e?(S_?~2I zYGW#s-m!k}hPn;pOC2xH&8W)=9`;T8pW^uNgYp=3-x3k~G}&A6=F3ivK4TvtI6&Dq@ zuh#o>X$i!&T8KE~i3GPdQUq<{y2_De98x&nuOO)p)X2t~=-0`lDz}0s=_MoOdM0ue zUjEKj#a%I);Q8-flaE>g{)*fut`FryOle2%d@V9D`{JAjfi5io8LKe0rJAxb0<~%R z1w@xW+QFes-rS96#+kG{tlarTN)`7aKMrRHTRVL1{+uFj)oF6I>tr*#g0$*(1 zck;+WEW;~zju5{tDmo{Y_b)A;Ud!=bY9c|lMP(Z+ZZ>8!j-FI&dSg1Xs$;|4m+D?3 zU+&15n^~7>A0G4e6ViAo)8Q8BRItDyJSk;nWl0AX{SiDBx#SuaF zgy2ge8vIXLGTkH5-3H$fWYlKLGT1Kh8hi8nA%A$@d_kd6!fehwgjD$&CFCqQ-K2JN z%d&&W1mi77)9y1OSN9EBN4wOP_Ul4cA!s?8EoVTtlN7ImT-S>SKZONzjRUVa}1^V%tg9CV@S=nF2emSLumfy zLI+DMa3|_6Q7X89Tw?SECz0mYE~?&n2}*|23#E&!FB0mcUMO8eeW6e%^iWPOss}E8 z@fWDRB#_XT{2JA}UO;-+T2#-UB=r0jM1AokVr$COo;%t-9gn$A-E#9-+W_f*Q6EVY z>dXGuhWq0WQh!{RM+wWCX>n*9fbot7|{I&eR2ytPu-jU zu!Eu4UmRA<-D*dw4>IymwOp-mEaP%gc7)1LY>qLB~R4zLLIzLphxw^2f#C5hg|GE7$J2sO^13Ku8BRX z@lp^zxOcmtcRdSMh7CgRik1oe=$VImx17g4o5+iOTW~#*mwQ(CUtUcbx|k{UH1ZmS zLV?#S6=+aNeQiy@*W32b#=9}bvgTsG{oYPLQa8gstFXF= zAW}_xB@sU%6@7D$Uwa{2+BLH_h_??Gbiva_&|TpXcVfwO8X`D;niu2=E1q}rc)Clo@^c&=+^6FG&z*Wiv=i|>uQ_cwb)iQS;VOVAKHQG5z2;EcU(SUTj+GN1jw zWj_0dWAV9Z`*5pt@cJgiD%|^K{zIW1t^9{Y1zYn=bEan12sxz$%^}NWK8^N?)QhX*fPr|V|iG`du>$eV#@up zKRV>?hqz)ja(nM1KiQ+nPe9tUaIa2s*}qc|u!}uTagK)!-UYc?BQxke5r8aJ8w218 z+x6MC)C`bOF$s7-B{8RMfJmeue)p+y`0iI28sui`s^EB`Bg(X=D0 zMrrZT{381M?HQ{C3yP}!ZkfEc#@~5*%g8RM}CWfGuQIsEYtNMI2Dl{R{MKrnT0OVI`s4}=XMe6vCfx#y^ zbYZ-cW{{?TU_$4g>AOxg0J$Cg1Uw<2xLc*9lMO+;l(42yXSZ-KC}0dN=(_*gTSe@z zm8PyL#Enl?xoInU_K=$nL7MHU=-G<&BW~IP=f~lE{UOfh0)w@1pV11uK0zinp1XFQ zgmMCR`8?^g2Ebb>A;^9GI;B~AgQBdUMf>)){mf)|zeTg=I<;)`pDUvnm^G#Cq)!|7 zikWDk-$YIxcG4L%$bH!k&tW-uJ&0)PoN69A&2tJb1Z!RyS4k?U$W0J=VRj9@Ny6;f z?1iw;jy1cuH9SdKH&KNwZ#8+p9>@LZ1Ud7>Ii5(|R-4Gfa~v^_1$JifgHH1%k}{7Y z_he#e9ocgobq;cUNBZ1Vb*so1r^6U}v0PvyB`o%cPU93fS z{0l$w&0Y?37W*j8PHXbd!1vEdF3~$)yJ+%?1CP7|9=Q{HBq3At;E{f{=Za0O3B(wh z3*K=x^TN|u;kjP@H#lb-j@PjEX=r<5bFW(U&ei6=z;?V-%Wnv~3h@oz#2Fp6;~K>H zHj3XmihteD^6$OJuTsH!A?lyo+&c^1uir<|--N_SdvD#)y$0)`%dN~u7k9Umz7fa$ zL+fWM)yBJ*MkB6_^mXU2gPfk*auT&DugC3oQ6=Ed4=D#V^8-Aa?UwUw1W4wroC+4lzS$cj@&B?rIfz za7SAjAEMd8kd__Bs%f>F8WWma(?Y%y=N>SjmNfyy^db}dTdGYAL&d*ptork1u9Q>- zY>st;f2ymUT-P6wn?h>B>b{^y7td8QE#zltmupXo=H!i`Y0jO_inM39nAUzlz>^nv zhBVE&XVuQauPR#x&J!}lvs?CLVT!|5`>Ql3fU9Vy^V!X&H5Uk2A4x-X=dR_qUpqvw zJ5Mx#-RAM?_vw9cE%|>ym1XW~Gjf_KG@TMP%X%*c z7^=Ikx8%##?XPO#X{v3T0Wzih9HyIMX=ErZoF7iSxnNS0MtOZGMVqtjU{(EugLipl ztjq5d-n+)JyR#zz@}_M1dx#21W#R|oI8Os9cphW_CC`>w=Sp+y=%(i6g^>5vV6SvF z{1VfPvrhLpLjO-%sj;-u(Id4c7mw7+M&HwV^bA5cE5xzaSn6KRB8@VebSr%y3OoTV zoWMkJKVFA87S3>28og&)xpnR1-OLThZ~S1tWC{)UA*c~`HxcvQs(8{(+Q^y!$je$7 zb6MJy%}frTwtMrz`EDwXIn*;i@7{8KLbJ2P)#KSpf-0)aWA~x$DsOxVsyKPIv$9eCzbGQ=r}UDI#4}w zAw9Z|asoR${svF|)(Y+IyxrKZ37|nXw83?7K4>7>A~zGqw7{A6HLEs$+xox_RZgoG zvUtculz!-N4Sp`EFL(nP`I*+vjP^c;b~BfTHdIj(l?JFRHT4MY_R$;ASGeYe9;@0S zjy4}KmoK!689d4qV;98A0>PJDJS)D5Fz>R;W*Dw3s#* zb^HH+6lLJAG~j^j93PMl3rEp!;6W5Ve8sm)=tcem}?F5L0-z>hWVs=8iK3ef|t-nxj8* z{@RD1-0k`L>&Sy&6n#5o-m_c&I1u`qEu`GOW4H#;dk^w|f8yN->AXpn-tYT&RGr(G z`1NDK6V`ktmGCvmnty&1oiFSCxl-0QZ{2~M<11eF{+o0xOtLOaTKMGCubyAR{Hd=X zVKhE_-qgQ$SSJ4x6?mf7AB&$Sw{NF-Oxh)ta(mB6hkRWscM8V9-%RNQ&7U_fRtImy zM;Hx8LpTyXSJlA>qj~ttjR-@O*$}P^9sYb(2j3Z(W=9xj8zW|-#pziu+H+%dix(&8 zBBBi81`CSE-<{;9=W%Ngp@UO}FP*!_5}9tyj(9%Pm>vGS4WDsv2Cro2u1>W%Y{+0= z`FvWgEz^z+4*NO>GKgrNRHWqPA%pP8t3e}s@y9E09G5SM)!}!s zrK<347v`70A(X$XmcO?i{;pbL7$pu(0vz*03M3rz_to-u*Y8TWT*&W&%k}?&lac&= z(s$Z@u_A@s4>J8|e%QPbY?AdCNb#ZI5s_nbd$F#O$1JE|nKHi|Uu1ryyI Date: Mon, 9 Jun 2025 23:24:27 +0800 Subject: [PATCH 05/29] compare cycle vs 200 --- test_cases/contracts/test_01_contract.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test_cases/contracts/test_01_contract.py b/test_cases/contracts/test_01_contract.py index 478b0efe..adb3027a 100644 --- a/test_cases/contracts/test_01_contract.py +++ b/test_cases/contracts/test_01_contract.py @@ -67,11 +67,20 @@ def setup_class(cls): cls.node.prepare() cls.node.start() cls.Miner.make_tip_height_number(cls.node, 2000) + cls.node1 = cls.CkbNode.init_dev_by_port( + cls.CkbNodeConfigPath.v200, "contract/node1", 8116, 8117 + ) + cls.node1.prepare() + cls.node1.start() + cls.node1.connected(cls.node) + cls.Node.wait_node_height(cls.node1, 2000,200) @classmethod def teardown_class(cls): cls.node.stop() cls.node.clean() + cls.node1.stop() + cls.node1.clean() @parameterized.expand(success_files) # @pytest.mark.skip @@ -80,7 +89,9 @@ def test_01_deploy_and_invoke_demo(self, path): 1. Retrieve the paths of successful files from `project_root/source/contract/test_cases` by excluding the files specified in `files_list`. 2. deploy and invoke contract """ - return self.deploy_and_invoke(self.Config.MINER_PRIVATE_1, path, self.node) + self.deploy_and_invoke(self.Config.MINER_PRIVATE_1, path, self.node) + tip_number = self.node.getClient().get_tip_block_number() + self.Node.wait_node_height(self.node1, tip_number,200) @parameterized.expand(failed_files) def test_02_deploy_and_invoke_demo_failed(self, path): @@ -94,6 +105,8 @@ def test_02_deploy_and_invoke_demo_failed(self, path): self.fail("Did not raise an exception as expected!") except Exception as e: print(e) + tip_number = self.node.getClient().get_tip_block_number() + self.Node.wait_node_height(self.node1, tip_number, 200) def deploy_and_invoke(self, account, path, node, try_count=5): if try_count < 0: From 18dce10997d76cf17513083451b855c4598559dd Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Tue, 10 Jun 2025 09:27:40 +0800 Subject: [PATCH 06/29] fix path not found --- source/contract/test_cases/exec_oom | Bin 0 -> 1496 bytes source/contract/test_cases/spawn_oom | Bin 0 -> 1736 bytes test_cases/memory/test_oom.py | 5 +++-- test_cases/memory/test_spawn_memory_limit.py | 7 ++----- 4 files changed, 5 insertions(+), 7 deletions(-) create mode 100755 source/contract/test_cases/exec_oom create mode 100755 source/contract/test_cases/spawn_oom diff --git a/source/contract/test_cases/exec_oom b/source/contract/test_cases/exec_oom new file mode 100755 index 0000000000000000000000000000000000000000..945bc7eff795d276cf91bdc0bc368e5518abf7fd GIT binary patch literal 1496 zcmbtU%}*0i5T94t?rN%lL_Wg7O*R@p*lf2*2{EPwx_BV*;~#*s6lvtk?LvrApoMCT z)qvFy^&;WI(a50(PsUghA<@JbOgt$8VvO;CwH~DUw)+O57h`&*OSelzplzUjEX zU9}McxNNWmrnOLPVLs+~S70e7>Vrmb(qA4pDgo>{%<}tkY%|8u{4W!kbfE}o z@Nh3+zA%%$p=#L_KTi>n&`pu~gPH7oRokMdiBM}!)qbX&9`2Fvz|BQ&9V%{nIeKQU ztSFIA7e0-x+b%uuTwj9tb5TlWweKnW%JcY=Sd+|(waM%URohP4R+i$+E6ed$B^>u7 zruMz5UF}<~eIG3?$+SWAaLgItA~TDzx3*KW+v<~9&$UgTww8kEglo;U>H6&YN_n;~ z$?07)kh}1k|N2V4~Gp+7zyg((BOdJmb@n9AV@}V)BwpswZZ=W-~csq>7;;R=%KD*BNzrL+#5D@BhW<) z{O>Z~qq(iu2Y~l8jSn@i0M0eS`~Jc&$3Q0Y`6Y~xvxoDIbH6j+jE{X{+6uQtQZ_f7zc{9B$Ez^R&PIB{*hv98){m3bBB+CD73|6r_Tj!$mO zsvCMO@s|jW``Zqc#9!eLzb>vvc-)ESU585bMj6{nZHvO^kkzvW>T_z&a!4mD*Yo_8 zGChHJ>FPk^6CK$x*Gp&&@BT_I(=%~v;kzb%vs@m${3=|W;${^AC->-DqpZ4Po7UiaUu*PCyCs>`<*fUM;* zEqe3pv)CuL{%vt{qfv$p2n%1seB);I1H-IV#CaT%5uP|Q->_M|W|)t0lti#MXPEy~ zJYiurR{znWunI>%jtKa>2(3-Ujg7{y@~hlCpMRi5%2o48#l3Q;uq>Y}SLI;2 z`oJ)^E8NO*;qJ=a!goGF*vcChe+b^YcrW-+@EFg*So*(%@ZH`PM_|U0_{>rQ#3_|)TOj-N~2aPofsaH zLQ14lQKdjsvqD{Jbnv{Ssap6{NIRv4+Mz!&^tP4imiqh8NTGOR(&i{2 z37hUFJ~i6ak(8Xk<>aZs!a1Lsrmqy>s?UA94SqULZiX$@g_ zx118U?Ns92CEH4alD?3(Q+E6uZt#Bxd39t``GBkRey-AodA6nj(=isVtKqZzy-)c^ zSR%z*zK`;m)-XL|I=821l+X6b${wYBDsRAajp-fJ1D0Rg|9Q&C-{Zg#seZkBAj(ww lDF*O5(Y%_pJ^f=k$JXh!Fc-QV{+`c_9PNLG1t`|?{{?BI4~qZ* literal 0 HcmV?d00001 diff --git a/test_cases/memory/test_oom.py b/test_cases/memory/test_oom.py index 51c60a6b..bb44a4f3 100644 --- a/test_cases/memory/test_oom.py +++ b/test_cases/memory/test_oom.py @@ -3,6 +3,7 @@ import pytest from framework.basic import CkbTest +from framework.util import get_project_root class TestOom(CkbTest): @@ -39,7 +40,7 @@ def teardown_class(cls): def test_spawn(self): with pytest.raises(Exception) as exc_info: self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_1, - f"/Users/guopenglin/RustroverProjects/nervosnetwork/ckb-test-contracts/rust/acceptance-contracts/build/release/spawn_oom", + f"{get_project_root()}/source/contract/test_cases/spawn_oom", self.node,"type" ) expected_error_message = "MemOutOfStack" @@ -52,7 +53,7 @@ def test_spawn(self): def test_exec(self): with pytest.raises(Exception) as exc_info: self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_1, - "/Users/guopenglin/RustroverProjects/nervosnetwork/ckb-test-contracts/rust/acceptance-contracts/build/release/exec_oom", + f"{get_project_root()}/source/contract/test_cases/exec_oom", self.node ) expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" diff --git a/test_cases/memory/test_spawn_memory_limit.py b/test_cases/memory/test_spawn_memory_limit.py index fb556406..87c9995c 100644 --- a/test_cases/memory/test_spawn_memory_limit.py +++ b/test_cases/memory/test_spawn_memory_limit.py @@ -4,6 +4,7 @@ from framework.basic import CkbTest from framework.helper.spawn_arg import SpawnArgContract +from framework.util import get_project_root class MemoryLimitTest(CkbTest): @@ -45,7 +46,7 @@ def teardown_class(cls): def test_spawn(self): with pytest.raises(Exception) as exc_info: self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_1, - "/Users/guopenglin/RustroverProjects/nervosnetwork/ckb-test-contracts/rust/acceptance-contracts/build/release/spawn_oom", + f"{get_project_root()}/source/contract/test_cases/spawn_oom", self.node ) # expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" @@ -432,10 +433,6 @@ def test_argv_limit(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - # def test_0000(self): - # path = "/Users/guopenglin/RustroverProjects/nervosnetwork/ckb-test-contracts/rust/acceptance-contracts/build/release/spawn_limit" - # self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_2, path, self.node) - def deploy_and_invoke(self, account, path, node, try_count=5): if try_count < 0: raise Exception("try out of times") From 9637fa33c71ff12846026c24e121aeea3a3d8fe9 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Tue, 10 Jun 2025 09:34:31 +0800 Subject: [PATCH 07/29] black code --- framework/config.py | 3 -- test_cases/config/test_listen_address.py | 13 ++++-- test_cases/contracts/test_01_contract.py | 4 +- .../contracts/test_exceeded_maximum_cycles.py | 3 +- test_cases/memory/test_exec_memory_limit.py | 39 +++++++++++------- test_cases/memory/test_oom.py | 19 +++++---- test_cases/memory/test_spawn_memory_limit.py | 41 +++++++++++++------ 7 files changed, 76 insertions(+), 46 deletions(-) diff --git a/framework/config.py b/framework/config.py index 8ef83736..bfdbb802 100644 --- a/framework/config.py +++ b/framework/config.py @@ -50,10 +50,7 @@ SPAWN_CONTRACT_PATH = f"{get_project_root()}/source/contract/test_cases/spawn_demo" UDT_CONTRACT_PATH = f"{get_project_root()}/source/contract/XUDTType" SPAWN_ARG_PATH = f"{get_project_root()}/source/contract/spawn_arg_length" -# SPAWN_ARG_PATH = "/Users/guopenglin/PycharmProjects/ckb-py-integration-test/source/contract/spawn_arg_length" EXEC_ARG_PATH = f"{get_project_root()}/source/contract/exec_arg_length" -# EXEC_ARG_PATH = "/Users/guopenglin/RustroverProjects/nervosnetwork/ckb-test-contracts/rust/acceptance-contracts/build/release/exec_arg_length" - def get_tmp_path(): diff --git a/test_cases/config/test_listen_address.py b/test_cases/config/test_listen_address.py index 8fc67df9..7cad86a8 100644 --- a/test_cases/config/test_listen_address.py +++ b/test_cases/config/test_listen_address.py @@ -13,10 +13,15 @@ def test_listen_address(self): self.CkbNodeConfigPath.CURRENT_TEST, "node/node", 8118, 8119 ) self.node.prepare() - self.node.prepare(other_ckb_config={ - "ckb_network_listen_addresses": ["/ip4/0.0.0.0/tcp/8115", "/ip4/0.0.0.0/tcp/8116"], - "ckb_network_reuse_tcp_with_ws": "true" - }) + self.node.prepare( + other_ckb_config={ + "ckb_network_listen_addresses": [ + "/ip4/0.0.0.0/tcp/8115", + "/ip4/0.0.0.0/tcp/8116", + ], + "ckb_network_reuse_tcp_with_ws": "true", + } + ) self.node.start() local_node_info = self.node.getClient().local_node_info() assert len(local_node_info["addresses"]) == 4 diff --git a/test_cases/contracts/test_01_contract.py b/test_cases/contracts/test_01_contract.py index adb3027a..ce6aa1bb 100644 --- a/test_cases/contracts/test_01_contract.py +++ b/test_cases/contracts/test_01_contract.py @@ -73,7 +73,7 @@ def setup_class(cls): cls.node1.prepare() cls.node1.start() cls.node1.connected(cls.node) - cls.Node.wait_node_height(cls.node1, 2000,200) + cls.Node.wait_node_height(cls.node1, 2000, 200) @classmethod def teardown_class(cls): @@ -91,7 +91,7 @@ def test_01_deploy_and_invoke_demo(self, path): """ self.deploy_and_invoke(self.Config.MINER_PRIVATE_1, path, self.node) tip_number = self.node.getClient().get_tip_block_number() - self.Node.wait_node_height(self.node1, tip_number,200) + self.Node.wait_node_height(self.node1, tip_number, 200) @parameterized.expand(failed_files) def test_02_deploy_and_invoke_demo_failed(self, path): diff --git a/test_cases/contracts/test_exceeded_maximum_cycles.py b/test_cases/contracts/test_exceeded_maximum_cycles.py index 8348e9ab..1f5d2f07 100644 --- a/test_cases/contracts/test_exceeded_maximum_cycles.py +++ b/test_cases/contracts/test_exceeded_maximum_cycles.py @@ -48,6 +48,5 @@ def test_01(self): expected_error_message = "ExceededMaximumCycles" assert ( - expected_error_message in exc_info.value.args[0] + 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/memory/test_exec_memory_limit.py b/test_cases/memory/test_exec_memory_limit.py index 4d0b90cd..1f0baed2 100644 --- a/test_cases/memory/test_exec_memory_limit.py +++ b/test_cases/memory/test_exec_memory_limit.py @@ -93,7 +93,6 @@ def test_block_err(self): 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( self.Config.MINER_PRIVATE_1 @@ -121,9 +120,6 @@ def test_block_err_type(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - - - def test_tx_pool_err(self): account2 = self.Ckb_cli.util_key_info_by_private_key( self.Config.MINER_PRIVATE_1 @@ -151,7 +147,6 @@ def test_tx_pool_err(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - def test_oom(self): account2 = self.Ckb_cli.util_key_info_by_private_key( self.Config.MINER_PRIVATE_1 @@ -159,7 +154,9 @@ def test_oom(self): deploy_hash, deploy_index = self.execArgContract.get_deploy_hash_and_index() print("deploy_hash:", deploy_hash) print("deploy_index:", deploy_index) - invoke_arg, invoke_data = self.execArgContract.get_test_data(1024 * 8 * 2, 0, 111) + invoke_arg, invoke_data = self.execArgContract.get_test_data( + 1024 * 8 * 2, 0, 111 + ) with pytest.raises(Exception) as exc_info: tx_hash = self.Contract.invoke_ckb_contract( account_private=self.Config.MINER_PRIVATE_1, @@ -187,7 +184,9 @@ def test_oom_type(self): deploy_hash, deploy_index = self.execArgContract.get_deploy_hash_and_index() print("deploy_hash:", deploy_hash) print("deploy_index:", deploy_index) - invoke_arg, invoke_data = self.execArgContract.get_test_data(1024 * 8 * 2, 0, 111) + invoke_arg, invoke_data = self.execArgContract.get_test_data( + 1024 * 8 * 2, 0, 111 + ) with pytest.raises(Exception) as exc_info: tx_hash = self.Contract.invoke_ckb_contract( account_private=self.Config.MINER_PRIVATE_1, @@ -216,7 +215,9 @@ def test_MemWriteOnExecutablePage(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) + 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, @@ -239,7 +240,9 @@ def test_MemWriteOnExecutablePage(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data(3, 895 + 32, 93) + 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, @@ -285,7 +288,9 @@ def test_MemWriteOnExecutablePage(self): # ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data(3, 9949, 2300 + 36) + invoke_arg, invoke_data = self.execArgContract.get_test_data( + 3, 9949, 2300 + 36 + ) tx_hash = self.Contract.invoke_ckb_contract( account_private=self.Config.ACCOUNT_PRIVATE_2, contract_out_point_tx_hash=deploy_hash, @@ -305,7 +310,6 @@ def test_MemWriteOnExecutablePage(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - def test_MemWriteOnExecutablePage_type(self): self.Miner.miner_with_version(self.node, "0x0") account2 = self.Ckb_cli.util_key_info_by_private_key( @@ -314,7 +318,9 @@ 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) + 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, @@ -337,7 +343,9 @@ def test_MemWriteOnExecutablePage_type(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data(3, 895 + 32, 93) + 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, @@ -384,7 +392,9 @@ def test_MemWriteOnExecutablePage_type(self): # ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.execArgContract.get_test_data(3, 9949, 2300 + 36) + invoke_arg, invoke_data = self.execArgContract.get_test_data( + 3, 9949, 2300 + 36 + ) tx_hash = self.Contract.invoke_ckb_contract( account_private=self.Config.ACCOUNT_PRIVATE_2, contract_out_point_tx_hash=deploy_hash, @@ -496,7 +506,6 @@ def test_exec_limit_type(self): f"not found in actual string '{exc_info.value.args[0]}'" ) - def deploy_and_invoke(self, account, path, node, try_count=5): if try_count < 0: raise Exception("try out of times") diff --git a/test_cases/memory/test_oom.py b/test_cases/memory/test_oom.py index bb44a4f3..199c9394 100644 --- a/test_cases/memory/test_oom.py +++ b/test_cases/memory/test_oom.py @@ -39,10 +39,12 @@ def teardown_class(cls): def test_spawn(self): with pytest.raises(Exception) as exc_info: - self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_1, - f"{get_project_root()}/source/contract/test_cases/spawn_oom", - self.node,"type" - ) + self.deploy_and_invoke( + self.Config.ACCOUNT_PRIVATE_1, + f"{get_project_root()}/source/contract/test_cases/spawn_oom", + self.node, + "type", + ) expected_error_message = "MemOutOfStack" # expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" assert expected_error_message in exc_info.value.args[0], ( @@ -52,10 +54,11 @@ def test_spawn(self): def test_exec(self): with pytest.raises(Exception) as exc_info: - self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_1, - f"{get_project_root()}/source/contract/test_cases/exec_oom", - self.node - ) + self.deploy_and_invoke( + self.Config.ACCOUNT_PRIVATE_1, + f"{get_project_root()}/source/contract/test_cases/exec_oom", + self.node, + ) expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" assert expected_error_message in exc_info.value.args[0], ( f"Expected substring '{expected_error_message}' " diff --git a/test_cases/memory/test_spawn_memory_limit.py b/test_cases/memory/test_spawn_memory_limit.py index 87c9995c..08f1f885 100644 --- a/test_cases/memory/test_spawn_memory_limit.py +++ b/test_cases/memory/test_spawn_memory_limit.py @@ -45,10 +45,11 @@ def teardown_class(cls): def test_spawn(self): with pytest.raises(Exception) as exc_info: - self.deploy_and_invoke(self.Config.ACCOUNT_PRIVATE_1, - f"{get_project_root()}/source/contract/test_cases/spawn_oom", - self.node - ) + self.deploy_and_invoke( + self.Config.ACCOUNT_PRIVATE_1, + f"{get_project_root()}/source/contract/test_cases/spawn_oom", + self.node, + ) # expected_error_message = "@@@VM@@@UNEXPECTED@@@ARGV@@@TOOLONG@@@" expected_error_message = "MemOutOfStack" assert expected_error_message in exc_info.value.args[0], ( @@ -64,7 +65,9 @@ def test_oom(self): # oom with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(1024 * 8 * 2, 0, 0) + invoke_arg, invoke_data = self.spawnArgContract.get_test_data( + 1024 * 8 * 2, 0, 0 + ) tx_hash = self.Contract.invoke_ckb_contract( account_private=self.Config.MINER_PRIVATE_1, contract_out_point_tx_hash=deploy_hash, @@ -155,7 +158,9 @@ def test_MemOutOfStack(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(3, 895 + 32, 92) + 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, @@ -178,7 +183,9 @@ def test_MemOutOfStack(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(3, 895 + 32, 92) + 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, @@ -216,7 +223,9 @@ def test_bug(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, 9949, 2300 + 36) + 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, @@ -245,7 +254,9 @@ 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) + 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, @@ -268,7 +279,9 @@ def test_MemWriteOnExecutablePage(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(3, 895 + 32, 93) + 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, @@ -292,7 +305,9 @@ def test_MemWriteOnExecutablePage(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(3, 9949, 2300 + 36) + 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, @@ -315,7 +330,9 @@ def test_MemWriteOnExecutablePage(self): ) with pytest.raises(Exception) as exc_info: - invoke_arg, invoke_data = self.spawnArgContract.get_test_data(3, 9949, 2300 + 36) + 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, From 64d9ef13dd121a70d5fcacef209b7c4c7539392e Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Tue, 10 Jun 2025 11:49:36 +0800 Subject: [PATCH 08/29] fix contract call err --- test_cases/contracts/test_01_contract.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test_cases/contracts/test_01_contract.py b/test_cases/contracts/test_01_contract.py index ce6aa1bb..84f38d9d 100644 --- a/test_cases/contracts/test_01_contract.py +++ b/test_cases/contracts/test_01_contract.py @@ -30,6 +30,8 @@ def get_successful_files(): "loop_contract", "exec_with_block_opcode", "rfc49_atomic", + "exec_oom", + "spawn_oom" ] return [s for s in files if not any(s.endswith(suffix) for suffix in files_list)] @@ -50,6 +52,8 @@ def get_failed_files(): "loop_contract", "exec_with_block_opcode", "rfc49_atomic", + "exec_oom", + "spawn_oom" ] # return [s for s in files if not any(s.endswith(suffix) for suffix in files_list)] return [f"{project_root}/source/contract/test_cases/{x}" for x in files_list] From fc3882d83b14927b4969a22d465bbe9d9863ea77 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Tue, 10 Jun 2025 11:53:25 +0800 Subject: [PATCH 09/29] format code --- test_cases/contracts/test_01_contract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_cases/contracts/test_01_contract.py b/test_cases/contracts/test_01_contract.py index 84f38d9d..11f83bd2 100644 --- a/test_cases/contracts/test_01_contract.py +++ b/test_cases/contracts/test_01_contract.py @@ -31,7 +31,7 @@ def get_successful_files(): "exec_with_block_opcode", "rfc49_atomic", "exec_oom", - "spawn_oom" + "spawn_oom", ] return [s for s in files if not any(s.endswith(suffix) for suffix in files_list)] @@ -53,7 +53,7 @@ def get_failed_files(): "exec_with_block_opcode", "rfc49_atomic", "exec_oom", - "spawn_oom" + "spawn_oom", ] # return [s for s in files if not any(s.endswith(suffix) for suffix in files_list)] return [f"{project_root}/source/contract/test_cases/{x}" for x in files_list] From 3c9c4c69bf96aa01f874c73003f706f225082e1e Mon Sep 17 00:00:00 2001 From: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com> Date: Thu, 12 Jun 2025 09:20:15 +0800 Subject: [PATCH 10/29] Update download.py --- download.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download.py b/download.py index 4577fbbe..d0ec8a51 100644 --- a/download.py +++ b/download.py @@ -27,7 +27,7 @@ "0.121.0", "0.200.0", "0.201.0", - "0.202.0-rc1", + "0.202.0", ] # Replace with your versions DOWNLOAD_DIR = "download" From b0ffc9a5c6c895f43929a35aab50a305f60f0227 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Thu, 12 Jun 2025 16:39:39 +0800 Subject: [PATCH 11/29] update light-client main branch --- .../test_09_ckb_light_client_mainnet.py | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 test_cases/ckb2023/test_09_ckb_light_client_mainnet.py diff --git a/test_cases/ckb2023/test_09_ckb_light_client_mainnet.py b/test_cases/ckb2023/test_09_ckb_light_client_mainnet.py new file mode 100644 index 00000000..41e4fc3c --- /dev/null +++ b/test_cases/ckb2023/test_09_ckb_light_client_mainnet.py @@ -0,0 +1,157 @@ +import time + +from framework.basic import CkbTest +from framework.helper.spawn_contract import SpawnContract + +# https://github.com/nervosnetwork/ckb/pull/4807 +# pub const CKB2023_START_EPOCH: u64 = 12_293; + +main_number = 12_293 + + +class CKBTestnet(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/node{i}".format(i=i), + 8114 + i, + 8225 + i, + ) + for i in range(1, 5) + ] + 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() + cls.Miner.make_tip_height_number(cls.cluster.ckb_nodes[0], 2000) + + # todo start 2 light client nodes + cls.ckb_light_node_current = cls.CkbLightClientNode.init_by_nodes( + cls.CkbLightClientConfigPath.CURRENT_TEST, + cls.cluster.ckb_nodes, + "tx_pool_light/node1", + 8001, + ) + + cls.ckb_light_node_current.prepare() + cls.ckb_light_node_current.start() + + # 6. wait light sync 2000 block + account = cls.Ckb_cli.util_key_info_by_private_key(cls.Config.MINER_PRIVATE_1) + cls.ckb_light_node_current.getClient().set_scripts( + [ + { + "script": { + "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hash_type": "type", + "args": account["lock_arg"], + }, + "script_type": "lock", + "block_number": "0x0", + } + ] + ) + + cls.cluster.ckb_nodes[0].start_miner() + cls.Node.wait_light_sync_height(cls.ckb_light_node_current, 2000, 200) + cls.cluster.ckb_nodes[0].stop_miner() + + @classmethod + def teardown_class(cls): + print("\nTeardown TestClass1") + cls.cluster.stop_all_nodes() + cls.cluster.clean_all_nodes() + cls.ckb_light_node_current.stop() + cls.ckb_light_node_current.clean() + + def test_before_and_after_fork(self): + """ + 1. generate_epochs(hex(12_293)) + 2. get_consensus(0048) == 12_293 + 3. get_consensus(0049) == 12_293 + 4. miner with 0x1 + 6. light client invoke spawn + Returns: + + """ + self.cluster.ckb_nodes[0].getClient().get_consensus() + self.Miner.make_tip_height_number(self.cluster.ckb_nodes[0], main_number) + # 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 == main_number + res = get_epoch_number_by_consensus_response(consensus, "0049") + assert res == main_number + 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") + + # 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") + + tip_number = self.cluster.ckb_nodes[0].client.get_tip_block_number() + self.cluster.ckb_nodes[0].start_miner() + self.Node.wait_light_sync_height(self.ckb_light_node_current, tip_number, 200) + self.cluster.ckb_nodes[0].stop_miner() + + tx = self.Contract.build_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[0].getClient().url, + ) + tx_hash = self.ckb_light_node_current.getClient().send_transaction(tx) + self.Miner.miner_until_tx_committed(self.cluster.ckb_nodes[0], tx_hash, True) + tip_number = self.cluster.ckb_nodes[0].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, + ) From 584d7f9aacdaab94233076fbb7f2cdfea009e6b5 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Thu, 19 Jun 2025 15:18:31 +0800 Subject: [PATCH 12/29] update ckb-light version --- download_ckb_light_client.py | 1 + framework/test_light_client.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/download_ckb_light_client.py b/download_ckb_light_client.py index 4c7ca3d2..ea8b0993 100644 --- a/download_ckb_light_client.py +++ b/download_ckb_light_client.py @@ -22,6 +22,7 @@ "0.3.5", "0.3.6", "0.4.1", + "0.5.0", ] # Replace with your versions DOWNLOAD_DIR = "download" diff --git a/framework/test_light_client.py b/framework/test_light_client.py index 9c3e46c8..a3b60023 100644 --- a/framework/test_light_client.py +++ b/framework/test_light_client.py @@ -44,9 +44,14 @@ class CkbLightClientConfigPath(Enum): "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", + ) + CURRENT_TEST = ( "source/template/ckb_light_client/0.3.0/testnet.toml.j2", - "download/0.4.1/ckb-light-client", + "download/0.5.0/ckb-light-client", ) def __init__(self, ckb_light_client_config_path, ckb_light_bin_path): From 49633d3912e7fcb5133b0346aeabb8baf263204e Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Thu, 19 Jun 2025 17:12:20 +0800 Subject: [PATCH 13/29] update light client download url --- download_ckb_light_client.py | 2 +- framework/helper/contract.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/download_ckb_light_client.py b/download_ckb_light_client.py index ea8b0993..31c791f4 100644 --- a/download_ckb_light_client.py +++ b/download_ckb_light_client.py @@ -35,7 +35,7 @@ "Linux": { "x86_64": { "url": "https://github.com/nervosnetwork/ckb-light-client/releases/download/v{version}/ckb-light-client_v{" - "version}-x86_64-linux.tar.gz", + "version}-x86_64-linux-portable.tar.gz", "ext": ".tar.gz", }, }, diff --git a/framework/helper/contract.py b/framework/helper/contract.py index 5989f1c7..0362184c 100644 --- a/framework/helper/contract.py +++ b/framework/helper/contract.py @@ -302,7 +302,8 @@ def build_invoke_ckb_contract( ) # get input_cell account = util_key_info_by_private_key(account_private) - account_address = account["address"]["testnet"] + net = "testnet" if RPCClient(api_url).get_consensus()["id"] != "ckb" else "mainnet" + account_address = account["address"][net] account_live_cells = wallet_get_live_cells(account_address, api_url=api_url) assert len(account_live_cells["live_cells"]) > 0 input_cell_out_points = [] From eb8704acb8649b9d8d594105d5c1b5843ca165d5 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Thu, 4 Sep 2025 21:10:34 +0800 Subject: [PATCH 14/29] support docker --- .../workflows/ci_integration_tests_docker.yml | 59 +++++++++++++++++++ framework/test_node.py | 39 +++++++++++- framework/util.py | 2 +- 3 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci_integration_tests_docker.yml diff --git a/.github/workflows/ci_integration_tests_docker.yml b/.github/workflows/ci_integration_tests_docker.yml new file mode 100644 index 00000000..3672b475 --- /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 + +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/framework/test_node.py b/framework/test_node.py index 7780dc79..4195b07c 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -11,6 +11,11 @@ import shutil import telnetlib from websocket import create_connection, WebSocket +import os + + +DOCKER = os.getenv("DOCKER", False) +DOCKER_CKB_VERSION = os.getenv("DOCKER_CKB_VERSION", "nervos/ckb:v0.202.0-rc1") class CkbNodeConfigPath(Enum): @@ -224,7 +229,9 @@ 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" + ) ) self.client = RPCClient(self.rpcUrl) @@ -244,6 +251,12 @@ 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("//", "") + ) + # peer_address = peer_address.replace("127.0.0.1",node.ckb_dir.split("/")[-1]) + peer_address = peer_address.replace("127.0.0.1", "172.17.0.1") + print("add node response:", self.getClient().add_node(peer_id, peer_address)) def connected_ws(self, node): @@ -282,13 +295,27 @@ 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 &" + # ) + 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 @@ -314,6 +341,14 @@ def stop(self): self.stop_miner() # run_command("kill {pid}".format(pid=self.ckb_pid)) # self.ckb_pid = -1 + if DOCKER: + 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 + ) + return port = self.rpcUrl.split(":")[-1] run_command(f"kill $(lsof -t -i:{port})", check_exit_code=False) diff --git a/framework/util.py b/framework/util.py index 8044f953..7b390077 100644 --- a/framework/util.py +++ b/framework/util.py @@ -32,7 +32,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", From 82e48fd1153c546d4222d7065a7c007612d83628 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Fri, 5 Sep 2025 10:49:47 +0800 Subject: [PATCH 15/29] fix docker --- .github/workflows/ci_integration_tests_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_integration_tests_docker.yml b/.github/workflows/ci_integration_tests_docker.yml index 3672b475..962908d1 100644 --- a/.github/workflows/ci_integration_tests_docker.yml +++ b/.github/workflows/ci_integration_tests_docker.yml @@ -1,7 +1,7 @@ # 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 +name: ci_integration_tests_docker on: push: From f2dab3f4a5fe8d75ef3de2db47c0f795db299420 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 8 Sep 2025 16:03:48 +0800 Subject: [PATCH 16/29] fix ci for docker --- framework/basic.py | 6 ++++ framework/test_node.py | 31 ++++++++++++++++--- .../test_sub_telnet_with_websocket.py | 5 +-- test_cases/replace_rpc/test_telnet.py | 21 ++++++++----- test_cases/replace_rpc/test_websocket.py | 13 +++++--- 5 files changed, 56 insertions(+), 20 deletions(-) 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/test_node.py b/framework/test_node.py index 4195b07c..9fc83014 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -233,6 +233,8 @@ def __init__( "0.0.0.0", "127.0.0.1" ) ) + print("rpcUrl:", self.rpcUrl) + self.client = RPCClient(self.rpcUrl) def __str__(self): @@ -254,9 +256,11 @@ def connected(self, node): peer_address = peer_address.replace( "127.0.0.1", node.client.url.split(":")[1].replace("//", "") ) - # peer_address = peer_address.replace("127.0.0.1",node.ckb_dir.split("/")[-1]) - peer_address = peer_address.replace("127.0.0.1", "172.17.0.1") - + 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): @@ -304,6 +308,15 @@ def start(self): # 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 &" @@ -341,17 +354,21 @@ def stop(self): self.stop_miner() # run_command("kill {pid}".format(pid=self.ckb_pid)) # self.ckb_pid = -1 - if DOCKER: + 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) @@ -447,6 +464,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 @@ -454,6 +472,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 = ( @@ -478,6 +497,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/test_cases/replace_rpc/test_sub_telnet_with_websocket.py b/test_cases/replace_rpc/test_sub_telnet_with_websocket.py index ed1d3348..3a620f92 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,8 +22,8 @@ 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( diff --git a/test_cases/replace_rpc/test_telnet.py b/test_cases/replace_rpc/test_telnet.py index 0ae20521..4afb97ef 100644 --- a/test_cases/replace_rpc/test_telnet.py +++ b/test_cases/replace_rpc/test_telnet.py @@ -24,8 +24,8 @@ 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( @@ -62,7 +62,7 @@ def test_link_count_max(self): 4.test 113 max link count """ telnets = [] - for i in range(1000): + for i in range(100): print(i) telnet = self.node112.subscribe_telnet("new_tip_header") telnets.append(telnet) @@ -79,7 +79,7 @@ def test_link_count_max(self): # 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) @@ -101,7 +101,7 @@ def test_link_time_max(self): 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() @@ -130,7 +130,10 @@ def test_link_websocket(self): 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 ( @@ -155,7 +158,7 @@ def test_rpc(self): ), 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) @@ -171,6 +174,8 @@ def test_stop_node_when_link_telnet(self): 2. 113: stop successful 3. assert "ckb" not in ret """ + if self.skip_docker(): + return self.node112.restart() socket = self.node112.subscribe_telnet("new_tip_header") self.node112.stop() @@ -202,7 +207,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..b92b2cec 100644 --- a/test_cases/replace_rpc/test_websocket.py +++ b/test_cases/replace_rpc/test_websocket.py @@ -18,17 +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.CkbNodeConfigPath.V112, "telnet2/node2", 8116, 8117 ) cls.node112.prepare( other_ckb_config={ @@ -131,7 +131,7 @@ def test_rpc(self): ), 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) @@ -174,6 +174,9 @@ def test_stop_node_when_link_websocket(self): 2. 112: stop successful 3. 113: stop failed """ + if self.skip_docker(): + pytest.skip("docker not support lsof") + return self.node112.restart() socket = self.node112.subscribe_websocket("new_tip_header") self.node112.stop() From 834dd1782a92f84bec1f92aac6bf383bd7d28f3b Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 29 Sep 2025 17:43:23 +0800 Subject: [PATCH 17/29] update 203 --- download.py | 1 + framework/test_node.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/download.py b/download.py index d0ec8a51..83da9127 100644 --- a/download.py +++ b/download.py @@ -28,6 +28,7 @@ "0.200.0", "0.201.0", "0.202.0", + "0.203.0-rc1", ] # Replace with your versions DOWNLOAD_DIR = "download" diff --git a/framework/test_node.py b/framework/test_node.py index 7780dc79..06c1b778 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -18,27 +18,34 @@ class CkbNodeConfigPath(Enum): "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", + "download/0.203.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", + "download/0.203.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", + "download/0.203.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", + "download/0.203.0", + ) + + v203 = ( + "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", ) v202 = ( From e2d2a4b489b5b08819b335615c522e55642ea4a6 Mon Sep 17 00:00:00 2001 From: gpBlockchain <32102187+gpBlockchain@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:39:59 +0800 Subject: [PATCH 18/29] Remove 'replace_rpc' from test cases --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index f9355b86..c5f994d8 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ develop_prepare: bash develop_prepare.sh test_cases := \ - test_cases/replace_rpc \ test_cases/ckb_cli \ test_cases/ckb2023 \ test_cases/contracts \ From 53a466272fd674c699d35998ce9e6b274d1b7efd Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Tue, 30 Sep 2025 15:47:00 +0800 Subject: [PATCH 19/29] update cli --- framework/helper/ckb_cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/helper/ckb_cli.py b/framework/helper/ckb_cli.py index d982bc60..9ecf5768 100644 --- a/framework/helper/ckb_cli.py +++ b/framework/helper/ckb_cli.py @@ -642,6 +642,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] From 206328ab63a0560f18d53139293774ea40d5e508 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Thu, 9 Oct 2025 10:06:21 +0800 Subject: [PATCH 20/29] update makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9355b86..76fc53ef 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,11 @@ 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 \ From 36d4d30128289ec98313e3ef5d7e75482f2fc25c Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Thu, 9 Oct 2025 10:08:29 +0800 Subject: [PATCH 21/29] update light client --- download_ckb_light_client.py | 2 +- framework/test_light_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/download_ckb_light_client.py b/download_ckb_light_client.py index 31c791f4..6463d8a0 100644 --- a/download_ckb_light_client.py +++ b/download_ckb_light_client.py @@ -22,7 +22,7 @@ "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/test_light_client.py b/framework/test_light_client.py index a3b60023..b124b5b0 100644 --- a/framework/test_light_client.py +++ b/framework/test_light_client.py @@ -51,7 +51,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): From 7734b5d0cc39665fa1f42947dedb6f63a91fb036 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Sun, 12 Oct 2025 22:29:08 +0800 Subject: [PATCH 22/29] update test --- .gitignore | 4 + Makefile | 4 - download.py | 11 - framework/helper/ckb_cli.py | 31 +- framework/test_light_client.py | 2 +- framework/test_node.py | 318 +++++++--------- prepare.sh | 2 - source/template/ckb/v109/ckb-miner.toml.j2 | 45 --- source/template/ckb/v109/ckb.toml.j2 | 172 --------- .../ckb/v109/specs/benchmark-spec.toml | 0 source/template/ckb/v109/specs/dev.toml | 106 ------ source/template/ckb/v109/specs/mainnet.toml | 69 ---- source/template/ckb/v109/specs/testnet.toml | 90 ----- source/template/ckb/v110/ckb-miner.toml.j2 | 45 --- source/template/ckb/v110/ckb.toml.j2 | 179 --------- source/template/ckb/v110/default.db-options | 22 -- .../ckb/v110/specs/benchmark-spec.toml | 0 source/template/ckb/v110/specs/dev.toml | 107 ------ source/template/ckb/v110/specs/mainnet.toml | 69 ---- source/template/ckb/v110/specs/testnet.toml | 90 ----- source/template/ckb/v111/ckb-miner.toml.j2 | 46 --- source/template/ckb/v111/ckb.toml.j2 | 180 --------- source/template/ckb/v111/default.db-options | 22 -- .../ckb/v111/specs/benchmark-spec.toml | 0 source/template/ckb/v111/specs/dev.toml | 101 ----- source/template/ckb/v111/specs/mainnet.toml | 69 ---- source/template/ckb/v111/specs/testnet.toml | 90 ----- source/template/ckb/v112/ckb-miner.toml.j2 | 45 --- source/template/ckb/v112/ckb.toml.j2 | 186 ---------- source/template/ckb/v112/default.db-options | 22 -- .../ckb/v112/specs/benchmark-spec.toml | 0 source/template/ckb/v112/specs/dev.toml | 100 ----- source/template/ckb/v112/specs/mainnet.toml | 69 ---- source/template/ckb/v112/specs/testnet.toml | 90 ----- source/template/ckb/v113/ckb-miner.toml.j2 | 45 --- source/template/ckb/v113/ckb.toml.j2 | 187 ---------- source/template/ckb/v113/default.db-options | 22 -- .../ckb/v113/specs/benchmark-spec.toml | 0 source/template/ckb/v113/specs/dev.toml | 100 ----- source/template/ckb/v113/specs/mainnet.toml | 69 ---- source/template/ckb/v113/specs/testnet.toml | 90 ----- source/template/ckb/v114/ckb-miner.toml.j2 | 45 --- source/template/ckb/v114/ckb.toml.j2 | 204 ---------- source/template/ckb/v114/default.db-options | 22 -- .../ckb/v114/specs/benchmark-spec.toml | 0 source/template/ckb/v114/specs/dev.toml | 100 ----- source/template/ckb/v114/specs/mainnet.toml | 69 ---- source/template/ckb/v114/specs/testnet.toml | 90 ----- source/template/ckb/v115/ckb-miner.toml.j2 | 45 --- source/template/ckb/v115/ckb.toml.j2 | 204 ---------- source/template/ckb/v115/default.db-options | 22 -- .../ckb/v115/specs/benchmark-spec.toml | 0 source/template/ckb/v115/specs/dev.toml | 100 ----- source/template/ckb/v115/specs/mainnet.toml | 69 ---- source/template/ckb/v115/specs/testnet.toml | 90 ----- source/template/ckb/v116/ckb-miner.toml.j2 | 45 --- source/template/ckb/v116/ckb.toml.j2 | 206 ----------- source/template/ckb/v116/default.db-options | 22 -- .../ckb/v116/specs/benchmark-spec.toml | 0 source/template/ckb/v116/specs/dev.toml | 100 ----- source/template/ckb/v116/specs/mainnet.toml | 69 ---- source/template/ckb/v116/specs/testnet.toml | 90 ----- source/template/ckb/v117/ckb-miner.toml.j2 | 45 --- source/template/ckb/v117/ckb.toml.j2 | 206 ----------- source/template/ckb/v117/default.db-options | 22 -- .../ckb/v117/specs/benchmark-spec.toml | 0 source/template/ckb/v117/specs/dev.toml | 100 ----- source/template/ckb/v117/specs/mainnet.toml | 69 ---- source/template/ckb/v117/specs/testnet.toml | 90 ----- source/template/ckb/v118/ckb-miner.toml.j2 | 45 --- source/template/ckb/v118/ckb.toml.j2 | 219 ----------- source/template/ckb/v118/default.db-options | 22 -- .../ckb/v118/specs/benchmark-spec.toml | 0 source/template/ckb/v118/specs/dev.toml | 100 ----- source/template/ckb/v118/specs/mainnet.toml | 69 ---- source/template/ckb/v118/specs/testnet.toml | 90 ----- source/template/ckb/v200/specs/dev.toml | 2 +- test_cases/ckb2023/test_01_before_hardfork.py | 350 ------------------ test_cases/ckb2023/test_02_after_hardfork.py | 11 +- ...est_04_ckb_light_client_before_hardfork.py | 6 +- test_cases/light_client/test_diff_overflow.py | 6 +- test_cases/light_client/test_light_sync.py | 6 +- .../light_client/test_link_v110_node.py | 6 +- test_cases/memory/test_exec_memory_limit.py | 111 +----- test_cases/memory/test_oom.py | 16 +- test_cases/memory/test_spawn_memory_limit.py | 184 +-------- .../miner/test_01_miner_wrong_witness.py | 26 +- .../test_after_ckb_2023_hardfork.py | 87 ----- .../test_before_ckb2023_hardfork.py | 162 -------- .../test_duration_ckb_2023_mainnet.py | 193 ++++++++++ .../test_duration_ckb_2023_testnet.py | 191 ++++++++++ test_cases/replace_rpc/test_rpc.py | 65 +--- .../test_sub_telnet_with_websocket.py | 91 +---- test_cases/replace_rpc/test_telnet.py | 66 +--- test_cases/replace_rpc/test_websocket.py | 90 +---- .../test_mainnet_soft_fork_failed.py | 132 ------- ...ain_with_other_node_when_sync_failed_tx.py | 113 ------ .../test_sync_dao_lock_size_mismatch.py | 162 -------- .../test_05_node_broadcast.py | 6 +- .../tx_pool_refactor/test_08_many_tx.py | 7 +- test_cases/ws/test_ws_port.py | 64 ---- 101 files changed, 609 insertions(+), 7112 deletions(-) delete mode 100644 source/template/ckb/v109/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v109/ckb.toml.j2 delete mode 100644 source/template/ckb/v109/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v109/specs/dev.toml delete mode 100644 source/template/ckb/v109/specs/mainnet.toml delete mode 100644 source/template/ckb/v109/specs/testnet.toml delete mode 100644 source/template/ckb/v110/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v110/ckb.toml.j2 delete mode 100644 source/template/ckb/v110/default.db-options delete mode 100644 source/template/ckb/v110/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v110/specs/dev.toml delete mode 100644 source/template/ckb/v110/specs/mainnet.toml delete mode 100644 source/template/ckb/v110/specs/testnet.toml delete mode 100644 source/template/ckb/v111/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v111/ckb.toml.j2 delete mode 100644 source/template/ckb/v111/default.db-options delete mode 100644 source/template/ckb/v111/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v111/specs/dev.toml delete mode 100644 source/template/ckb/v111/specs/mainnet.toml delete mode 100644 source/template/ckb/v111/specs/testnet.toml delete mode 100644 source/template/ckb/v112/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v112/ckb.toml.j2 delete mode 100644 source/template/ckb/v112/default.db-options delete mode 100644 source/template/ckb/v112/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v112/specs/dev.toml delete mode 100644 source/template/ckb/v112/specs/mainnet.toml delete mode 100644 source/template/ckb/v112/specs/testnet.toml delete mode 100644 source/template/ckb/v113/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v113/ckb.toml.j2 delete mode 100644 source/template/ckb/v113/default.db-options delete mode 100644 source/template/ckb/v113/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v113/specs/dev.toml delete mode 100644 source/template/ckb/v113/specs/mainnet.toml delete mode 100644 source/template/ckb/v113/specs/testnet.toml delete mode 100644 source/template/ckb/v114/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v114/ckb.toml.j2 delete mode 100644 source/template/ckb/v114/default.db-options delete mode 100644 source/template/ckb/v114/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v114/specs/dev.toml delete mode 100644 source/template/ckb/v114/specs/mainnet.toml delete mode 100644 source/template/ckb/v114/specs/testnet.toml delete mode 100644 source/template/ckb/v115/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v115/ckb.toml.j2 delete mode 100644 source/template/ckb/v115/default.db-options delete mode 100644 source/template/ckb/v115/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v115/specs/dev.toml delete mode 100644 source/template/ckb/v115/specs/mainnet.toml delete mode 100644 source/template/ckb/v115/specs/testnet.toml delete mode 100644 source/template/ckb/v116/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v116/ckb.toml.j2 delete mode 100644 source/template/ckb/v116/default.db-options delete mode 100644 source/template/ckb/v116/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v116/specs/dev.toml delete mode 100644 source/template/ckb/v116/specs/mainnet.toml delete mode 100644 source/template/ckb/v116/specs/testnet.toml delete mode 100644 source/template/ckb/v117/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v117/ckb.toml.j2 delete mode 100644 source/template/ckb/v117/default.db-options delete mode 100644 source/template/ckb/v117/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v117/specs/dev.toml delete mode 100644 source/template/ckb/v117/specs/mainnet.toml delete mode 100644 source/template/ckb/v117/specs/testnet.toml delete mode 100644 source/template/ckb/v118/ckb-miner.toml.j2 delete mode 100644 source/template/ckb/v118/ckb.toml.j2 delete mode 100644 source/template/ckb/v118/default.db-options delete mode 100644 source/template/ckb/v118/specs/benchmark-spec.toml delete mode 100644 source/template/ckb/v118/specs/dev.toml delete mode 100644 source/template/ckb/v118/specs/mainnet.toml delete mode 100644 source/template/ckb/v118/specs/testnet.toml delete mode 100644 test_cases/ckb2023/test_01_before_hardfork.py delete mode 100644 test_cases/node_compatible/test_after_ckb_2023_hardfork.py delete mode 100644 test_cases/node_compatible/test_before_ckb2023_hardfork.py create mode 100644 test_cases/node_compatible/test_duration_ckb_2023_mainnet.py create mode 100644 test_cases/node_compatible/test_duration_ckb_2023_testnet.py delete mode 100644 test_cases/soft_fork/test_mainnet_soft_fork_failed.py delete mode 100644 test_cases/soft_fork/test_sync_again_with_other_node_when_sync_failed_tx.py delete mode 100644 test_cases/soft_fork/test_sync_dao_lock_size_mismatch.py 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 c5f994d8..2445d3b5 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,7 @@ prepare: python3 -m pip install --upgrade pip pip install -r requirements.txt echo "install ckb" - python3 -m download - python3 -m download_ckb_light_client - echo "install ckb cli" - sh prepare.sh develop_prepare: python3 -m venv venv . venv/bin/activate diff --git a/download.py b/download.py index 83da9127..db65dba3 100644 --- a/download.py +++ b/download.py @@ -12,17 +12,6 @@ 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", diff --git a/framework/helper/ckb_cli.py b/framework/helper/ckb_cli.py index 9ecf5768..cab91cd5 100644 --- a/framework/helper/ckb_cli.py +++ b/framework/helper/ckb_cli.py @@ -13,33 +13,8 @@ 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 +42,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 +106,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, diff --git a/framework/test_light_client.py b/framework/test_light_client.py index a3b60023..b124b5b0 100644 --- a/framework/test_light_client.py +++ b/framework/test_light_client.py @@ -51,7 +51,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 06c1b778..84d3dcf8 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -11,180 +11,23 @@ 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.203.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.203.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.203.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.203.0", - ) - - v203 = ( - "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", - ) - - 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.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 @@ -198,6 +41,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.200.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.202.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( @@ -231,8 +123,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): @@ -251,6 +147,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): @@ -289,13 +193,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} -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} -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 @@ -310,6 +237,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 @@ -321,9 +271,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) @@ -362,7 +324,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( @@ -419,6 +381,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 @@ -426,6 +389,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 = ( @@ -450,6 +414,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/prepare.sh b/prepare.sh index c32e7171..017c5d05 100644 --- a/prepare.sh +++ b/prepare.sh @@ -4,8 +4,6 @@ set -e 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 #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_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 index 5d270b8c..fdde75fd 100644 --- a/test_cases/light_client/test_link_v110_node.py +++ b/test_cases/light_client/test_link_v110_node.py @@ -41,7 +41,7 @@ def test_110_main_link_ckb_light_successful(self): """ nodes = [ self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_MAIN, + self.CkbNodeConfigPath.CURRENT_TEST, "cluster/hardfork/node{i}".format(i=i), 8124 + i, 8225 + i, @@ -100,7 +100,7 @@ def test_110_testnet_link_ckb_light_successful(self): """ nodes = [ self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110_TEST, + self.CkbNodeConfigPath.CURRENT_TEST, "cluster/hardfork/node{i}".format(i=i), 8124 + i, 8225 + i, @@ -158,7 +158,7 @@ def test_110_devnet_link_ckb_light_failed(self): """ nodes = [ self.CkbNode.init_dev_by_port( - self.CkbNodeConfigPath.V110, + self.CkbNodeConfigPath.CURRENT_TEST, "cluster/hardfork/node{i}".format(i=i), 8114 + i, 8225 + i, 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..da84b195 100644 --- a/test_cases/replace_rpc/test_sub_telnet_with_websocket.py +++ b/test_cases/replace_rpc/test_sub_telnet_with_websocket.py @@ -25,32 +25,18 @@ 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", 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 +52,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 +74,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 +89,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 +105,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 +120,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 +135,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 +157,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 +172,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 +233,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..f0505a11 100644 --- a/test_cases/replace_rpc/test_telnet.py +++ b/test_cases/replace_rpc/test_telnet.py @@ -28,28 +28,18 @@ 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: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,22 +51,6 @@ 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): @@ -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): 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,15 +89,6 @@ 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"] @@ -140,19 +101,9 @@ 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']}" @@ -167,19 +118,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 +131,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): diff --git a/test_cases/replace_rpc/test_websocket.py b/test_cases/replace_rpc/test_websocket.py index c08881fc..dc78bd75 100644 --- a/test_cases/replace_rpc/test_websocket.py +++ b/test_cases/replace_rpc/test_websocket.py @@ -27,21 +27,9 @@ 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_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 +39,6 @@ def teardown_class(cls): Returns: """ - cls.node112.stop() - cls.node112.clean() - cls.node113.stop() cls.node113.clean() @@ -65,18 +50,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 +71,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']}" 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 +108,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( From e8227dad1d2ef277a055f29b04e0ed95201a034e Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Sun, 12 Oct 2025 22:35:24 +0800 Subject: [PATCH 23/29] format code --- framework/helper/ckb_cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/framework/helper/ckb_cli.py b/framework/helper/ckb_cli.py index cab91cd5..8b96bd26 100644 --- a/framework/helper/ckb_cli.py +++ b/framework/helper/ckb_cli.py @@ -13,8 +13,6 @@ cli_path = f"cd {get_project_root()}/source && ./ckb-cli" - - 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 From 9a58ee08042291ebae990ab038eec96cf63a83b8 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Sun, 12 Oct 2025 22:40:27 +0800 Subject: [PATCH 24/29] remove exception_use_old_ckb --- framework/helper/contract.py | 4 ---- 1 file changed, 4 deletions(-) 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, From 58409c17e5656f66833d3a79e8d37f7231e15428 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Sun, 12 Oct 2025 23:41:11 +0800 Subject: [PATCH 25/29] update ckb-cli --- prepare.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prepare.sh b/prepare.sh index 017c5d05..926f4b91 100644 --- a/prepare.sh +++ b/prepare.sh @@ -1,9 +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 +# 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 From ac90f85eaef343dff83e7b99da2908fc45e6c0d1 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 13 Oct 2025 08:58:28 +0800 Subject: [PATCH 26/29] update 203 --- download.py | 2 -- framework/test_node.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/download.py b/download.py index db65dba3..fec05bbe 100644 --- a/download.py +++ b/download.py @@ -12,8 +12,6 @@ from tqdm import tqdm versions = [ - "0.120.0", - "0.121.0", "0.200.0", "0.201.0", "0.202.0", diff --git a/framework/test_node.py b/framework/test_node.py index 84d3dcf8..faf37de8 100644 --- a/framework/test_node.py +++ b/framework/test_node.py @@ -45,7 +45,7 @@ def __str__(self): "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", + "download/0.203.0", ) CkbNodeConfigPath.TESTNET = CkbNodeConfigPath( "source/template/ckb/v200/ckb.toml.j2", @@ -58,7 +58,7 @@ def __str__(self): "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", + "download/0.203.0", ) CkbNodeConfigPath.PREVIEW_DUMMY = CkbNodeConfigPath( From 9f5a517d20d79d7bce94ac01764b44faa5341a1e Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 13 Oct 2025 09:07:49 +0800 Subject: [PATCH 27/29] fix ckb download --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 2445d3b5..d506ec39 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,11 @@ prepare: python3 -m pip install --upgrade pip pip install -r requirements.txt echo "install ckb" + python3 -m download + + python3 -m download_ckb_light_client + echo "install ckb cli" + sh prepare.sh develop_prepare: python3 -m venv venv From 4c9cf2817fb4ddac1740896f724a93376424d01f Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 13 Oct 2025 09:40:59 +0800 Subject: [PATCH 28/29] update light-client --- download_ckb_light_client.py | 10 +---- framework/test_light_client.py | 38 ---------------- ...test_03_ckb_light_client_after_hardfork.py | 43 ------------------- 3 files changed, 1 insertion(+), 90 deletions(-) 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/test_light_client.py b/framework/test_light_client.py index b124b5b0..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", 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 From c2257f7876229c9e62da7541ced531d387b1b490 Mon Sep 17 00:00:00 2001 From: gpBlockchain <744158715@qq.com> Date: Mon, 13 Oct 2025 10:45:36 +0800 Subject: [PATCH 29/29] remove ckb 110 for light-client --- .../light_client/test_link_v110_node.py | 186 ------------------ 1 file changed, 186 deletions(-) delete mode 100644 test_cases/light_client/test_link_v110_node.py 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 fdde75fd..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.CURRENT_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": "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.CURRENT_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.CURRENT_TEST, - "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