Skip to content

Commit 76cf511

Browse files
V200 (#83)
* Update download.py * Update test_node.py * update ckb version * 121.0-rc2 test * 121.0-rc2 test * Update download.py * v200 ckb test * v200 ckb test * format download.py * Update test_node.py * add 121 config for ckb * add mainnet hardfork * update mainnet pull link * format code * Update download.py * Update download.py --------- Co-authored-by: 15168316096 <15168316096@163.com>
1 parent 229eced commit 76cf511

File tree

18 files changed

+1262
-19
lines changed

18 files changed

+1262
-19
lines changed

download.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"0.119.0",
2626
"0.120.0",
2727
"0.121.0",
28+
"0.200.0",
2829
] # Replace with your versions
2930

3031
DOWNLOAD_DIR = "download"

framework/helper/contract.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ def deploy_ckb_contract(
5050
with open(tmp_deploy_toml_path, "w") as f:
5151
f.write(deploy_toml_str)
5252
account = util_key_info_by_private_key(private_key)
53+
net = (
54+
"testnet"
55+
if RPCClient(api_url).get_consensus()["id"] != "ckb"
56+
else "mainnet"
57+
)
5358
deploy_gen_txs(
54-
account["address"]["testnet"],
59+
account["address"][net],
5560
tmp_deploy_toml_path,
5661
tmp_tx_info_path,
5762
api_url,
@@ -61,7 +66,8 @@ def deploy_ckb_contract(
6166
return deploy_tx_result["cell_tx"]
6267

6368
# rand ckb address ,provider contract cell cant be used
64-
to_ckb_address = "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwgx292hnvmn68xf779vmzrshpmm6epn4g6eqkaw"
69+
pre_address = "ckb" if RPCClient(api_url).get_consensus()["id"] == "ckb" else "ckt"
70+
to_ckb_address = f"{pre_address}1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwgx292hnvmn68xf779vmzrshpmm6epn4g6eqkaw"
6571
with open(contract_path, "rb") as f:
6672
# +100 provider capacity enough deploy contract
6773
capacity = len(f.read()) + 100
@@ -149,7 +155,8 @@ def invoke_ckb_contract(
149155
)
150156
# get input_cell
151157
account = util_key_info_by_private_key(account_private)
152-
account_address = account["address"]["testnet"]
158+
net = "testnet" if RPCClient(api_url).get_consensus()["id"] != "ckb" else "mainnet"
159+
account_address = account["address"][net]
153160
account_live_cells = wallet_get_live_cells(account_address, api_url=api_url)
154161
assert len(account_live_cells["live_cells"]) > 0
155162
input_cell_out_points = []

framework/test_node.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,43 @@
1515

1616
class CkbNodeConfigPath(Enum):
1717
CURRENT_TEST = (
18-
"source/template/ckb/v120/ckb.toml.j2",
19-
"source/template/ckb/v120/ckb-miner.toml.j2",
20-
"source/template/ckb/v120/specs/dev.toml",
21-
"download/0.121.0",
18+
"source/template/ckb/v200/ckb.toml.j2",
19+
"source/template/ckb/v200/ckb-miner.toml.j2",
20+
"source/template/ckb/v200/specs/dev.toml",
21+
"download/0.200.0",
2222
)
2323
TESTNET = (
24-
"source/template/ckb/v120/ckb.toml.j2",
25-
"source/template/ckb/v120/ckb-miner.toml.j2",
24+
"source/template/ckb/v200/ckb.toml.j2",
25+
"source/template/ckb/v200/ckb-miner.toml.j2",
2626
"source/template/specs/testnet.toml.j2",
27-
"download/0.121.0",
27+
"download/0.200.0",
2828
)
2929

3030
CURRENT_MAIN = (
31-
"source/template/ckb/v120/ckb.toml.j2",
32-
"source/template/ckb/v120/ckb-miner.toml.j2",
31+
"source/template/ckb/v200/ckb.toml.j2",
32+
"source/template/ckb/v200/ckb-miner.toml.j2",
3333
"source/template/specs/mainnet.toml.j2",
34-
"download/0.121.0",
34+
"download/0.200.0",
3535
)
3636

3737
PREVIEW_DUMMY = (
38-
"source/template/ckb/v120/ckb.toml.j2",
39-
"source/template/ckb/v120/ckb-miner.toml.j2",
38+
"source/template/ckb/v200/ckb.toml.j2",
39+
"source/template/ckb/v200/ckb-miner.toml.j2",
4040
"source/template/specs/preview_dev.toml",
41-
"download/0.121.0",
41+
"download/0.200.0",
42+
)
43+
44+
v200 = (
45+
"source/template/ckb/v200/ckb.toml.j2",
46+
"source/template/ckb/v200/ckb-miner.toml.j2",
47+
"source/template/ckb/v200/specs/dev.toml",
48+
"download/0.200.0",
4249
)
4350

4451
v121 = (
45-
"source/template/ckb/v120/ckb.toml.j2",
46-
"source/template/ckb/v120/ckb-miner.toml.j2",
47-
"source/template/ckb/v120/specs/dev.toml",
52+
"source/template/ckb/v121/ckb.toml.j2",
53+
"source/template/ckb/v121/ckb-miner.toml.j2",
54+
"source/template/ckb/v121/specs/dev.toml",
4855
"download/0.121.0",
4956
)
5057

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Config generated by `ckb init --chain dev`
2+
3+
data_dir = "{{ ckb_miner_data_dir | default(ckb_data_dir) }}"
4+
5+
[chain]
6+
{# Choose the kind of chains to run, possible values: #}
7+
{# - { file = "specs/dev.toml" } #}
8+
{# - { bundled = "specs/testnet.toml" } #}
9+
{# - { bundled = "specs/mainnet.toml" } #}
10+
spec = {{ ckb_chain_spec }}
11+
12+
13+
[logger]
14+
filter = "{{ ckb_miner_logger_filter | default("info") }}"
15+
color = {{ ckb_miner_logger_color | default("true") }}
16+
log_to_file = {{ ckb_miner_logger_log_to_file | default("true") }}
17+
log_to_stdout = {{ ckb_miner_logger_log_to_stdout | default("true") }}
18+
19+
[sentry]
20+
# set to blank to disable sentry error collection
21+
dsn = "{{ ckb_miner_sentry_dsn | default("") }}"
22+
# if you are willing to help us to improve,
23+
# please leave a way to contact you when we have troubles to reproduce the errors.
24+
# org_contact = "{{ ckb_miner_sentry_org_contact | default() }}"
25+
26+
[miner.client]
27+
rpc_url = "http://{{ ckb_miner_rpc_url | default("127.0.0.1:8114") }}"
28+
block_on_submit = {{ ckb_miner_block_on_submit | default("true") }}
29+
30+
# block template polling interval in milliseconds
31+
poll_interval = {{ ckb_miner_poll_interval | default("1000") }}
32+
33+
#{% if ckb_miner_workers is defined %}
34+
# {% for worker in ckb_miner_workers %}
35+
# [[miner.workers]]
36+
# worker_type = "{{ worker.worker_type }}"
37+
# delay_type = "{{ worker.delay_type }}"
38+
# value = {{ worker.value }}
39+
# {% endfor %}
40+
#{% else %}
41+
[[miner.workers]]
42+
worker_type = "Dummy"
43+
delay_type = "Constant"
44+
value = 1000
45+
#{% endif %}
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
# Config generated by `ckb init --chain dev`
2+
3+
data_dir = "{{ ckb_data_dir | default("data") }}"
4+
5+
6+
[chain]
7+
# Choose the kind of chains to run, possible values:
8+
# - { file = "specs/dev.toml" }
9+
# - { bundled = "specs/testnet.toml" }
10+
# - { bundled = "specs/mainnet.toml" }
11+
spec = {{ ckb_chain_spec }}
12+
13+
14+
[logger]
15+
filter = "{{ ckb_logger_filter | default("info") }}"
16+
color = {{ ckb_logger_color | default("true") }}
17+
log_to_file = {{ ckb_logger_log_to_file | default("true") }}
18+
log_to_stdout = {{ ckb_logger_log_to_stdout | default("true") }}
19+
20+
21+
[sentry]
22+
# set to blank to disable sentry error collection
23+
dsn = "{{ ckb_sentry_dsn | default("") }}"
24+
# if you are willing to help us to improve,
25+
# please leave a way to contact you when we have troubles to reproduce the errors.
26+
org_contact = "{{ ckb_sentry_org_contact | default("") }}"
27+
28+
29+
# # **Experimental** Monitor memory changes.
30+
# [memory_tracker]
31+
# # Seconds between checking the process, 0 is disable, default is 0.
32+
# interval = 600
33+
34+
[db]
35+
# The capacity of RocksDB cache, which caches uncompressed data blocks, indexes and filters, default is 128MB.
36+
# Rocksdb will automatically create and use an 8MB internal cache if you set this value to 0.
37+
# To turning off cache, you need to set this value to 0 and set `no_block_cache = true` in the options_file,
38+
# however, we strongly discourage this setting, it may lead to severe performance degradation.
39+
cache_size = {{ ckb_db_cache_size | default("134217728") }}
40+
41+
# Provide an options file to tune RocksDB for your workload and your system configuration.
42+
# More details can be found in [the official tuning guide](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide).
43+
options_file = "{{ ckb_db_options_file | default("default.db-options") }}"
44+
45+
[network]
46+
listen_addresses = {{ ckb_network_listen_addresses | default(["/ip4/0.0.0.0/tcp/8115"]) | to_json }}
47+
### Specify the public and routable network addresses
48+
public_addresses = {{ ckb_network_public_addresses | default([]) | to_json }}
49+
50+
# Node connects to nodes listed here to discovery other peers when there's no local stored peers.
51+
# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain.
52+
bootnodes = {{ ckb_network_bootnodes | default([]) | to_json }}
53+
54+
### Whitelist-only mode
55+
whitelist_only = {{ ckb_network_whitelist_only | default("false") }}
56+
### Whitelist peers connecting from the given IP addresses
57+
whitelist_peers = {{ ckb_network_whitelist_peers | default([]) | to_json }}
58+
### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet
59+
# reuse_port_on_linux = true
60+
61+
max_peers = {{ ckb_network_max_peers | default(125) }}
62+
max_outbound_peers = {{ ckb_network_max_outbound_peers | default(8) }}
63+
# 2 minutes
64+
ping_interval_secs = {{ ckb_network_ping_interval_secs | default(120) }}
65+
# 20 minutes
66+
ping_timeout_secs = {{ ckb_network_ping_timeout_secs | default(1200) }}
67+
connect_outbound_interval_secs = 15
68+
# If set to true, try to register upnp
69+
upnp = {{ ckb_network_upnp | default("false") }}
70+
# If set to true, network service will add discovered local address to peer store, it's helpful for private net development
71+
discovery_local_address = {{ ckb_network_discovery_local_address | default("true") }}
72+
# If set to true, random cleanup when there are too many inbound nodes
73+
# Ensure that itself can continue to serve as a bootnode node
74+
bootnode_mode = {{ ckb_network_bootnode_mode | default("false") }}
75+
76+
# Supported protocols list, only "Sync" and "Identify" are mandatory, others are optional
77+
support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"]
78+
# reuse_tcp_with_ws = true
79+
reuse_tcp_with_ws = {{ ckb_network_reuse_tcp_with_ws | default("false") }}
80+
# [network.sync.header_map]
81+
# memory_limit = "600MB"
82+
83+
[rpc]
84+
# By default RPC only binds to localhost, thus it only allows accessing from the same machine.
85+
#
86+
# Allowing arbitrary machines to access the JSON-RPC port is dangerous and strongly discouraged.
87+
# Please strictly limit the access to only trusted machines.
88+
listen_address = "{{ ckb_rpc_listen_address | default("127.0.0.1:8114") }}"
89+
90+
# Default is 10MiB = 10 * 1024 * 1024
91+
max_request_body_size = {{ ckb_rpc_max_request_body_size | default(10485760) }}
92+
93+
# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"]
94+
#modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug"]
95+
modules = {{ ckb_rpc_modules | to_json }}
96+
97+
# By default RPC only binds to HTTP service, you can bind it to TCP and WebSocket.
98+
#{% if ckb_tcp_listen_address is defined %}
99+
tcp_listen_address = "{{ ckb_tcp_listen_address }}"
100+
#{% endif %}
101+
102+
#{% if ckb_ws_listen_address is defined %}
103+
ws_listen_address = "{{ ckb_ws_listen_address }}"
104+
#{% endif %}
105+
106+
reject_ill_transactions = {{ ckb_rpc_reject_ill_transactions | default("true") }}
107+
108+
# By default deprecated rpc methods are disabled.
109+
enable_deprecated_rpc = {{ ckb_rpc_enable_deprecated_rpc | default("false") }}
110+
111+
112+
{% if ckb_rpc_batch_limit is defined %}
113+
rpc_batch_limit = {{ ckb_rpc_batch_limit | default("2000") }}
114+
{% endif %}
115+
116+
117+
[tx_pool]
118+
max_tx_pool_size = {{ ckb_tx_pool_max_tx_pool_size | default("180_000_000") }}
119+
min_fee_rate = {{ ckb_tx_pool_min_fee_rate | default("1_000") }}
120+
max_tx_verify_cycles = {{ ckb_tx_pool_max_tx_verify_cycles | default("70_000_000") }}
121+
max_ancestors_count = {{ ckb_tx_pool_max_ancestors_count | default("25") }}
122+
min_rbf_rate = {{ ckb_tx_pool_min_rbf_rate | default("1_500") }}
123+
124+
125+
[store]
126+
header_cache_size = {{ ckb_store_header_cache_size | default("4096")}}
127+
cell_data_cache_size = {{ ckb_store_cell_data_cache_size | default("128")}}
128+
block_proposals_cache_size = {{ ckb_store_block_proposals_cache_size | default("30")}}
129+
block_tx_hashes_cache_size = {{ ckb_store_block_tx_hashes_cache_size | default("30")}}
130+
block_uncles_cache_size = {{ ckb_store_block_uncles_cache_size | default("30")}}
131+
132+
133+
# [notify]
134+
# # Execute command when the new tip block changes, first arg is block hash.
135+
# new_block_notify_script = "your_new_block_notify_script.sh"
136+
# # Execute command when node received an network alert, first arg is alert message string.
137+
# network_alert_notify_script = "your_network_alert_notify_script.sh"
138+
139+
140+
# Set the lock script to protect mined CKB.
141+
#
142+
# CKB uses CS architecture for miner. Miner process (ckb miner) gets block
143+
# template from the Node process (ckb run) via RPC. Thus the lock script is
144+
# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect
145+
# after restarting Node process.
146+
#
147+
# The `code_hash` identifies different cryptography algorithm. Read the manual
148+
# of the lock script provider about how to generate this config.
149+
#
150+
# CKB provides an secp256k1 implementation, it requires a hash on the
151+
# compressed public key. The hash algorithm is blake2b, with personal
152+
# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg.
153+
#
154+
# You can use any tool you trust to generate a Bitcoin private key and public
155+
# key pair, which can be used in CKB as well. CKB CLI provides the function for
156+
# you to convert the public key into block assembler configuration parameters.
157+
#
158+
# Here is an example using ckb-cli to generate an account, this command will
159+
# print the block assembler args(lock_arg) to screen:
160+
#
161+
# ckb-cli account new
162+
#
163+
# If you already have a raw secp256k1 private key, you can get the lock_arg by:
164+
#
165+
# ckb-cli util key-info --privkey-path <privkey-path>
166+
#
167+
# The command `ckb init` also accepts options to generate the block assembler
168+
# directly. See `ckb init --help` for details.
169+
#
170+
# ckb init <lock_arg>
171+
#
172+
# secp256k1_blake160_sighash_all example:
173+
# [block_assembler]
174+
# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8"
175+
# args = "ckb-cli util blake2b --prefix-160 <compressed-pubkey>"
176+
# hash_type = "type"
177+
# message = "A 0x-prefixed hex string"
178+
# #
179+
# # CKB will prepend the binary version to message, to identify the block miner client. (default true, false to disable it)
180+
# use_binary_version_as_message_prefix = true
181+
# #
182+
# # Block assembler will notify new block template through http post to specified endpoints when update
183+
# notify = ["http://127.0.0.1:8888"]
184+
# # Or you may want use more flexible scripts, block template as arg.
185+
# notify_scripts = ["{cmd} {blocktemplate}"]
186+
187+
188+
{% if ckb_request_limit is defined %}
189+
[indexer_v2]
190+
request_limit = {{ ckb_request_limit | default("400") }}
191+
{% endif %}
192+
193+
194+
195+
# # Indexing the pending txs in the ckb tx-pool
196+
# index_tx_pool = false
197+
# # Customize block filtering rules to index only retained blocks
198+
#block_filter = "block.header.number.to_uint() >= \"0x0\".to_uint()"
199+
# # Customize cell filtering rules to index only retained cells
200+
#cell_filter = "let script = output.type;script!=() && script.code_hash == \"0x00000000000000000000000000000000000000000000000000545950455f4944\""
201+
# # The initial tip can be set higher than the current indexer tip as the starting height for indexing.
202+
# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44"
203+
#
204+
# # CKB rich-indexer has its unique configuration.
205+
206+
#[indexer_v2.rich_indexer]
207+
# # By default, it uses an embedded SQLite database.
208+
# # Alternatively, you can set up a PostgreSQL database service and provide the connection parameters.
209+
# db_type = "postgres"
210+
# db_name = "ckb-rich-indexer"
211+
# db_host = "127.0.0.1"
212+
# db_port = 5432
213+
# db_user = "postgres"
214+
# db_password = "123456"
215+
216+
[block_assembler]
217+
code_hash = "{{ ckb_block_assembler_code_hash }}"
218+
args = "{{ ckb_block_assembler_args }}"
219+
hash_type = "{{ ckb_block_assembler_hash_type }}"
220+
message = "{{ ckb_block_assembler_message }}"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This is a RocksDB option file.
2+
#
3+
# For detailed file format spec, please refer to the official documents
4+
# in https://rocksdb.org/docs/
5+
#
6+
7+
[DBOptions]
8+
bytes_per_sync=1048576
9+
max_background_jobs=6
10+
max_total_wal_size=134217728
11+
keep_log_file_num=32
12+
13+
[CFOptions "default"]
14+
level_compaction_dynamic_level_bytes=true
15+
write_buffer_size=8388608
16+
min_write_buffer_number_to_merge=1
17+
max_write_buffer_number=2
18+
max_write_buffer_size_to_maintain=-1
19+
20+
[TableOptions/BlockBasedTable "default"]
21+
cache_index_and_filter_blocks=true
22+
pin_l0_filter_and_index_blocks_in_cache=true

source/template/ckb/v121/specs/benchmark-spec.toml

Whitespace-only changes.

0 commit comments

Comments
 (0)