Skip to content
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

feat: integrate tenderdash 0.4.x #238

Merged
merged 42 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2dee7de
fix: typo
strophy May 26, 2021
737418a
chore: add new vars to tenderdash config
strophy May 26, 2021
305109e
chore: update package lock
strophy May 26, 2021
cdee1b6
feat: add support for tenderdash 0.4.0
strophy Jun 7, 2021
c951e51
fix: typo
strophy Jun 8, 2021
f319f42
feat: add network llmq types
strophy Jun 8, 2021
cb150dd
fix: use 50 quorum for devnet
strophy Jun 8, 2021
729742b
fix: set quorum type from config
strophy Jun 8, 2021
e234783
fix: set dummy quorum hash
strophy Jun 8, 2021
12e34d7
fix: store llmq types in objects
strophy Jun 8, 2021
fc762b4
fix: add dummy validator
strophy Jun 8, 2021
e6cffbb
fix: revert changes to tendermint.yml
strophy Jun 8, 2021
be0eb9b
fix: threshold_public_key must equal validator pub_key
strophy Jun 9, 2021
7c11c1a
fix: use host network to communicate with core
strophy Jun 9, 2021
8afc75f
fix: also set llmq_type_used and quorum_type in config
strophy Jun 9, 2021
b28ce99
fix: remove llmq_type_used
strophy Jun 9, 2021
5273846
fix: use persistent_peers instead of seeds
strophy Jun 10, 2021
6ae6822
fix: use hardcoded genesis_time
strophy Jun 10, 2021
2ff08a5
feat: pre-generate tenderdash Ed25519 keys
strophy Jun 14, 2021
e4f270b
fix: typo
strophy Jun 14, 2021
cfc6e89
fix: remove unnecessary type conversion
strophy Jun 14, 2021
0264a97
fix: specify seeds_count as option instead of argument
strophy Jun 15, 2021
06623f3
fix: generate tenderdash keys after masternode keys
strophy Jun 16, 2021
d523895
feat: use pregenerated keys instead of tenderdash init
strophy Jun 16, 2021
b3cfff9
fix: newline at end of file
strophy Jun 16, 2021
885a622
Update tendermint.yml
shumkov Jun 16, 2021
b8397ae
fix: try to access variable directly
strophy Jun 16, 2021
07e9455
feat: generate genesis time in config
strophy Jun 16, 2021
bb16579
Merge branch 'pregenerate_tenderdash_keys' into update-tenderdash-0.4.0
strophy Jun 16, 2021
a8d10a2
fix: don't use persistent peers
strophy Jun 16, 2021
2c65f78
fix: use genesis time from config generate
strophy Jun 16, 2021
62402f0
fix: use elastic keys from generated config
strophy Jun 16, 2021
c84efe0
fix: drop variables
strophy Jun 16, 2021
22b9f2c
fix: disable broken insight checks
strophy Jun 16, 2021
fbed4f9
feat: generate image names for config
strophy Jun 16, 2021
85ae583
fix: don't hard code domain in terraform config
strophy Jun 16, 2021
daebd03
fix: variable named `masternode` is required
strophy Jun 17, 2021
fed0e43
fix: add vars for all required settings
strophy Jun 17, 2021
ad094df
fix: remove dummy vars, sporks keys are generated
strophy Jun 17, 2021
9aa6f97
fix: remove comment
strophy Jun 17, 2021
56923e1
fix: clean up comments and temp files
strophy Jun 17, 2021
3f6fcb5
fix: uncomment insight state checks
strophy Jun 18, 2021
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ COPY ansible/requirements.yml /ansible-requirements.yml
COPY package*.json ./

RUN python3 -m pip install -U pip && \
python3 -m pip install --upgrade netaddr awscli ansible && \
python3 -m pip install --upgrade netaddr awscli jmespath ansible && \
ansible-galaxy install -r /ansible-requirements.yml && \
npm install

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ You can use the OpenVPN config generated during deployment (`<network_name>.ovpn
git clone https://github.com/dashpay/dash-network-deploy.git
```
2. Install Ansible and Terraform per instructions provided on the official websites:
2. Install Ansible (v2.10.7+) and Terraform (v0.12.x) per instructions provided on the official websites:
* [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
* [Terraform](https://www.terraform.io/intro/getting-started/install.html)
3. Ensure Python netaddr package is installed locally
3. Ensure Python netaddr and jmespath package is installed locally
```bash
pip install -U netaddr
pip install -U netaddr jmespath
```
* Note: You may need to run the above command with "pip2" instead of "pip" if
Expand Down
3 changes: 2 additions & 1 deletion ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ drive_image: dashpay/drive
drive_log_stdout_level: info
drive_log_pretty_file_level: silent
drive_log_json_file_level: silent
platform_drive_validator_set_llmq_type:

# Tendermint
tendermint_image: dashpay/tenderdash
Expand Down Expand Up @@ -73,7 +74,7 @@ dashd_rpc_port: 20002

dashd_zmq_port: 29998

# Example sport address/privkey. Please provide your own spork key in network config:
# Example spork address/privkey. Please provide your own spork key in network config:
# dashd_sporkaddr: yMtULrhoxd8vRZrsnFobWgRTidtjg2Rnjm
# dashd_sporkkey: cRsR7ywG6bhb5JsnpeRJ4c1fACabmYtK6WUVPiGG3GG4a5iYk6iL

Expand Down
5 changes: 4 additions & 1 deletion ansible/roles/dashd/templates/dash.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ maxconnections=256
debug={{ dashd_debug }}
printtoconsole=1

llmq-qvvec-sync=llmq_100_67:0


{% if dashd_indexes %}
# optional indices (required for Insight)
Expand Down Expand Up @@ -78,10 +78,13 @@ sporkkey={{ dashd_sporkkey }}
[regtest]
{% elif dash_network == 'mainnet' %}
[main]
llmq-qvvec-sync=llmq_100_67:0
{% elif dash_network == 'testnet' %}
[test]
llmq-qvvec-sync=llmq_100_67:0
{% elif dash_network == 'devnet' %}
[devnet]
llmq-qvvec-sync=llmq_50_60:0
strophy marked this conversation as resolved.
Show resolved Hide resolved

# First 1000 blocks should be mined with lowest difficulty (like in regtest, so it's instant)
# and first 500 blocks are mined with a block subsidity multiplied by 10
Expand Down
13 changes: 11 additions & 2 deletions ansible/roles/mn-evo-services/tasks/tendermint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,24 @@
chdir: '{{ mn_evo_services_path }}'
register: tendermint_node_id

- set_fact:
strophy marked this conversation as resolved.
Show resolved Hide resolved
tendermint_node_id: '{{ tendermint_node_id.stdout }}'

- name: get Tendermint validator key
command: cat {{ mn_evo_services_path }}/tendermint/config/priv_validator_key.json
register: tendermint_validator_key

- set_fact:
tendermint_node_id: '{{ tendermint_node_id.stdout }}'
tendermint_validator_key: '{{ tendermint_validator_key.stdout }}'

- name: get masternode status
command: dash-cli masternode status
register: core_masternode_status
when: inventory_hostname.find('masternode') != -1

- set_fact:
tendermint_validator_key: '{{ tendermint_validator_key.stdout }}'
core_masternode_status: '{{ core_masternode_status.stdout }}'
when: inventory_hostname.find('masternode') != -1

- name: create Tendermint config.toml
template:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ services:
- FEATURE_FLAGS_CONTRACT_ID={{ platform_feature_flags_contract_id }}
- FEATURE_FLAGS_CONTRACT_BLOCK_HEIGHT={{ platform_feature_flags_contract_block_height }}
- FEATURE_FLAGS_TOP_LEVEL_IDENTITY={{ platform_feature_flags_top_level_identity }}
- VALIDATOR_SET_LLMQ_TYPE={{ platform_drive_validator_set_llmq_type }}
ports:
- 26658:26658
depends_on:
Expand Down
19 changes: 19 additions & 0 deletions ansible/roles/mn-evo-services/templates/tendermint/config.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ priv_validator_state_file = "data/priv_validator_state.json"
# connections from an external PrivValidator process
priv_validator_laddr = ""

# Local Dash Core Host to connect to
# If this is set, the node follows a Dash Core PrivValidator process
priv_validator_core_rpc_host = "core:{{ dashd_rpc_port }}"

# Local Dash Core RPC Username
priv_validator_core_rpc_username = "{{ dashd_rpc_user }}"

# Local Dash Core RPC Password
priv_validator_core_rpc_password = "{{ dashd_rpc_password }}"

# LLMQ Type used
llmq_type_used = 100
shumkov marked this conversation as resolved.
Show resolved Hide resolved

# Path to the JSON file containing the private key to use for node authentication in the p2p protocol
node_key_file = "config/node_key.json"

Expand Down Expand Up @@ -354,6 +367,12 @@ skip_timeout_commit = false
create_empty_blocks = true
create_empty_blocks_interval = "3m"

# Set the Dash Core quorum type
quorum_type = 100

# Set the App hash size
app_hash_size = 20

# Reactor sleep duration parameters
peer_gossip_sleep_duration = "100ms"
peer_query_maj23_sleep_duration = "2s"
Expand Down
18 changes: 14 additions & 4 deletions ansible/roles/mn-evo-services/templates/tendermint/genesis.json.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"genesis_time": "{{ hostvars[groups.seed_nodes[0]].tendermint_genesis_time }}",
"chain_id": "dash-{{ ( 'devnet-' + dash_devnet_name if dash_network == 'devnet' else dash_network ) if tenderdash_chain_id is not defined else tenderdash_chain_id }}",
"initial_height": "0",
"initial_core_chain_locked_height": {{ platform_initial_core_chain_locked_height | int }},
"initial_proposal_core_chain_lock": null,
"consensus_params": {
"block": {
"max_bytes": "22020096",
Expand All @@ -14,11 +17,11 @@
},
"validator": {
"pub_key_types": [
"ed25519"
"bls12381"
]
}
},
"version": {}
},
"initial_core_chain_locked_height": {{ platform_initial_core_chain_locked_height | int }},
"validators": [
{% for masternode in groups.masternodes[:tenderdash_max_validators_count] %}
strophy marked this conversation as resolved.
Show resolved Hide resolved
{
Expand All @@ -28,10 +31,17 @@
"value": "{{ hostvars[masternode].tendermint_validator_key | json_query('pub_key.value') }}"
},
"power": "1",
"name": "{{ masternode }}"
"name": "{{ masternode }}",
"pro_tx_hash": "{{ hostvars[masternode].core_masternode_status | json_query('proTxHash') }}"
}
{% if not loop.last %},{% endif %}
{% endfor %}
],
"threshold_public_key": {
"type": "tendermint/PubKeyBLS12381",
"value": "iWbSZVOrq5y5Fda8+y4h3EyHsK77v0eadVZ562pvH3Q4Iv18lopPj00KxuTgOcFV"
},
"quorum_type": "{{ platform_drive_validator_set_llmq_type }}",
"quorum_hash": "00000201a9d68294b1aa11d689eee77fa588a76247a80e09e903dd250e4ead83",
"app_hash": ""
}
2 changes: 1 addition & 1 deletion ansible/roles/swap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
become_user: root
command: swapon -a

- name: set swapiness
- name: set swappiness
become: yes
become_user: root
sysctl:
Expand Down
11 changes: 11 additions & 0 deletions lib/configGenerator/generateAnsibleConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const crypto = require('crypto');
async function generateAnsibleConfig(network, networkName, masternodesCount) {
const config = {};

function getLLMQType() {
switch (network) {
case 'devnet': return 101;
case 'testnet': return 4;
case 'mainnet': return 4;
default: return 4;
}
}

config.platform_drive_validator_set_llmq_type = getLLMQType();
strophy marked this conversation as resolved.
Show resolved Hide resolved

if (network === 'devnet') {
// eslint-disable-next-line no-param-reassign
network = 'testnet';
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.