Skip to content

Commit

Permalink
readme, getx checker
Browse files Browse the repository at this point in the history
  • Loading branch information
onsails committed Sep 2, 2022
0 parents commit ecad165
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI
on:
pull_request:
branches: [ "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 14.18.1

- id: files
name: Check gentx
uses: jitterbit/get-changed-files@v1
with:
format: 'json'
- run: |
readarray -t added_modified_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added_modified }}')"
if [[ ${#added_modified_files[@]} > 1 ]]; then
echo "More than one file found"
exit 1
fi
for added_modified_file in ${added_modified_files[@]}; do
node gentx_checker.js ${added_modified_file}
done
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
![haqq (1)](https://user-images.githubusercontent.com/104348282/188024190-b43f56d0-2dc6-4e4a-be0e-a7e9f615f751.png)
# Prepare intensivized testnet Haqq
*Instructions on how to prepare for the testnet*

**Update packages and install required packages**
```bash
sudo apt update && sudo apt upgrade -y && \
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu gcc git jq chrony liblz4-tool -y
```

**Install Go 1.18.3**
```bash
wget https://golang.org/dl/go1.18.3.linux-amd64.tar.gz; \
rm -rv /usr/local/go; \
tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz && \
rm -v go1.18.3.linux-amd64.tar.gz && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bash_profile && \
source ~/.bash_profile && \
go version > /dev/null
```

**Install binary project**
```bash
cd $HOME && git clone https://github.com/haqq-network/haqq && \
cd haqq && \
make install && \
haqqd version
```

**Init moniker and set chainid**
```bash
haqqd init YOURMONIKER --chain-id haqq_54211-2 && \
haqqd config chain-id haqq_54211-2
```

**Create wallet**
```bash
haqqd keys add YOURWALLETNAME
```

**Add genesis account**
```bash
haqqd add-genesis-account YOURWALLETNAME 10000000aISLM
```

**Create gentx**
```bash
haqqd gentx YOURWALLETNAME 10000000aISLM \
--chain-id=haqq_54211-2 \
--moniker="YOURMONIKERNAME" \
--commission-max-change-rate 0.05 \
--commission-max-rate 0.20 \
--commission-rate 0.05 \
--website="" \
--security-contact="" \
--identity="" \
--details=""
```

After executing this command, you have a gentx. Submit a pull request (gentx folder) with the given gentx
```bash
File Genesis transaction written to "/.haqqd/config/gentx/gentx-xxx.json"
```







1 change: 1 addition & 0 deletions gentx/gentx-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"dragon","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.050000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.050000000000000000"},"min_self_delegation":"1","delegator_address":"haqq1eh0g874kpst9td70r7sw8ru8sgwv5u7xnvggy6","validator_address":"haqqvaloper1eh0g874kpst9td70r7sw8ru8sgwv5u7xlwyxqm","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Byy2CdiwGcNmWccIb6OKwAc4Gu4H7oUtpku9Lh4Q0Aw="},"value":{"denom":"aISLM","amount":"10000000"}}],"memo":"[email protected]:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AuH7SzhWv9JzFJvRxI5/reQgZJzoTIWkgPram/7lX3IZ"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["2AWq//h7Zo94OvqWi5MKNRoMdRrDfEQj0w7vk6Z0TXpFBn4ZRW3NgJIcPOK5hMNxiGd6zqqeWlAVvPpBzKkHVQE="]}
41 changes: 41 additions & 0 deletions gentx_checker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const fs = require('fs');

class GentxChecker {
constructor(gentx) {
this._validator_data = gentx.body.messages[0];
}

isHealthyDelegatorAddress() {
return this._validator_data.delegator_address.startsWith('haqq');
}

isHealthyValidatorAddress() {
return this._validator_data.validator_address.startsWith('haqq');
}

isHealthyAmount() {
return parseInt(this._validator_data.value.amount) / 10000000 === 1.0;
}

isHealthyDenom() {
return this._validator_data.value['denom'] === 'aISLM'
}
}

let rawData = fs.readFileSync(process.argv[2]);
let gentx_json = JSON.parse(rawData);

const gentxChecker = new GentxChecker(gentx_json)
const str_errors = []

if (!gentxChecker.isHealthyDelegatorAddress())
str_errors.push('Incorrect delegator address.');
if (!gentxChecker.isHealthyValidatorAddress())
str_errors.push('Incorrect validator address.');
if (!gentxChecker.isHealthyAmount())
str_errors.push('Incorrect amount.');
if (!gentxChecker.isHealthyDenom())
str_errors.push('Incorrect denom.');

console.log(str_errors.length === 0 ? 'No errors found' : str_errors.join('\n'))
process.exit(str_errors.length === 0 ? 0 : 1)

0 comments on commit ecad165

Please sign in to comment.