Skip to content

Preview #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: v118
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ test_cases := \
test_cases/soft_fork \
test_cases/issue \
test_cases/tx_pool_refactor \
test_cases/feature
test_cases/feature \
test_cases/config

test:
@failed_cases=; \
Expand Down
21 changes: 14 additions & 7 deletions framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@

class CkbNodeConfigPath(Enum):
CURRENT_TEST = (
"source/template/ckb/v117/ckb.toml.j2",
"source/template/ckb/v117/ckb-miner.toml.j2",
"source/template/ckb/v117/specs/dev.toml",
"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",
)

PREVIEW_DUMMY = (
"source/template/ckb/v118/ckb.toml.j2",
"source/template/ckb/v118/ckb-miner.toml.j2",
"source/template/specs/preview_dev.toml",
"download/0.118.0",
)

Expand All @@ -29,9 +36,9 @@ class CkbNodeConfigPath(Enum):
)

v118 = (
"source/template/ckb/v117/ckb.toml.j2",
"source/template/ckb/v117/ckb-miner.toml.j2",
"source/template/ckb/v117/specs/dev.toml",
"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",
)

Expand Down Expand Up @@ -274,7 +281,7 @@ def prepare(
root_path=get_project_root(),
spec_path=self.ckb_config_path.ckb_spec_path,
),
self.ckb_dir,
self.ckb_specs_config_path,
)

shutil.copy(
Expand Down
45 changes: 45 additions & 0 deletions source/template/ckb/v118/ckb-miner.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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 %}
218 changes: 218 additions & 0 deletions source/template/ckb/v118/ckb.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# 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 <privkey-path>
#
# The command `ckb init` also accepts options to generate the block assembler
# directly. See `ckb init --help` for details.
#
# ckb init <lock_arg>
#
# secp256k1_blake160_sighash_all example:
# [block_assembler]
# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8"
# args = "ckb-cli util blake2b --prefix-160 <compressed-pubkey>"
# 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 }}"
22 changes: 22 additions & 0 deletions source/template/ckb/v118/default.db-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
Empty file.
Loading
Loading