Skip to content

Commit

Permalink
Merge branch 'main' into cbrumm/merkle-bundles-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbrumm committed Jan 30, 2025
2 parents 4758266 + 6a10c14 commit 82c17d2
Show file tree
Hide file tree
Showing 31 changed files with 884 additions and 197 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: run all jobs
on: push

jobs:
verify-migration-proofs:
uses: ./.github/workflows/migration.yml

lint:
uses: ./.github/workflows/lint.yml

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/migration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: migration
on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Check out repository code
uses: actions/checkout@v4
# Setup Python
- name: Install dependencies
run: pip3 install bech32 requests
- name: Verify migration proofs
working-directory: ./app/upgrades/v2_0/validator-proofs
run: python3 verify.py
8 changes: 5 additions & 3 deletions app/upgrades/v2_0/validator-proofs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ all stake is returned to the original delegators during the migration.

### Steps

1. Enter the `mainnet`-directory and copy the `example-validator.json` config file and name it after your validator.
1. Enter the `mainnet`-directory and copy an existing config file and name it after your validator.

2. Fill out the `name`, `protocol_address` and `consensus_address`

3. Send 1 $KYVE from the protocol-address to the consensus-validator-operator address using the memo "Shared-Staking"
and put the tx-hash in proof_1.

4. Send 1 $KYVE from the consensus-validator-operator address to the protocol address using the memo "Shared-Staking"
4. Send 1 $KYVE from the consensus-validator-operator address to the protocol-address using the memo "Shared-Staking"
and put the tx-hash in proof_2.

5. Submit a Pull-Request to https://github.com/KYVENetwork/chain

6. (Optional) Perform the same steps for the `kaon` directory with your Kaon validators.
6. (Optional) Perform the same steps for the `kaon` directory with your Kaon validators. (Transactions must be submitted on the Kaon network.)

7. Check if the GitHub action (verify-migration-proofs) is passing. You can also run `python3 verify.py` locally to check if everything is correct.

## General Upgrade Procedure

Expand Down
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/kaon/LiveRaveN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "LiveRaveN",
"consensus_address": "kyvevaloper13eduhc6ds4fvcatt8vj472rwkr5vvup79wnz2y",
"protocol_address": "kyve13eduhc6ds4fvcatt8vj472rwkr5vvup7h7nzyx",
"proof_1": "03A0651F91A42BCCEB31C1752B037C240C3CDB652FDD4B8C4217D0BCA3ACFE31",
"proof_2": "03A0651F91A42BCCEB31C1752B037C240C3CDB652FDD4B8C4217D0BCA3ACFE31"
}

This file was deleted.

7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/IONode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "IONode Online",
"consensus_address": "kyvevaloper186n5up4j80j02vpfrr9tq8cml3h2ju5uara3ye",
"protocol_address": "kyve186n5up4j80j02vpfrr9tq8cml3h2ju5u0na32m",
"proof_1": "6D33A0FE5544B73AED2492E5C4AB93CDF7418B021F52410736DE4FE12194F1E3",
"proof_2": "DD7CE5C254297E57EFB89083CC345FAED20B992BD12AF2A613EA40DC9772BFF0"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/Lefey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Lefey",
"consensus_address": "kyvevaloper1w3etlejq78tn4vwmqhepzcl2a6zyth0wg4ae02",
"protocol_address": "kyve1xccnldlwmgpq4hc855f3nzvshfl5nw7493c9l9",
"proof_1": "B62F9BDC97739110624A170F953C4345888D8590A69EDDCA78E7CA33BF2D177F",
"proof_2": "9E44B457568470274020E59A91D09E84BDC8222BDAFB5C1B84548BFE8BB5A844"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/LiveRaveN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "LiveRaveN",
"consensus_address": "kyvevaloper13eduhc6ds4fvcatt8vj472rwkr5vvup79wnz2y",
"protocol_address": "kyve13eduhc6ds4fvcatt8vj472rwkr5vvup7h7nzyx",
"proof_1": "CFFE09093C83A3525E9BC3A3BF76DCACD2EA034B19EED3043AE0ABA52559B3D9",
"proof_2": "CFFE09093C83A3525E9BC3A3BF76DCACD2EA034B19EED3043AE0ABA52559B3D9"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/MELLIFERA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "MELLIFERA",
"consensus_address": "kyvevaloper13am3qms82sevhv9nv7z9jwfuffjsfqfum2dc2h",
"protocol_address": "kyve1dsk7wfy6n2ylwj8x2el6txgsyff8av6wa5yl28",
"proof_1": "9F636AD173DBB92C911E7E4230E43995F3E12A43FC20131EF7D9B64FB16B76E9",
"proof_2": "5837D0555B087E4BBBCCBBC9B53323555891C3ABA232E8CBB6E969715026FC51"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/Meria.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Meria",
"consensus_address": "kyvevaloper1hy44ra3hv8vf294fs49zqzykt9hpzegrse4epk",
"protocol_address": "kyve1gqg64xv8uh8zvnym5qkavd882d67ks4ewhhrdf",
"proof_1": "6DA7C83F1B18FE90268C79D414B1871BDD96FCC9720BDDF0333DA3A9E3B29DAC",
"proof_2": "29DB08AAD05EF660BD75FE4EBDC869AB3A1686D2B2DFCC39B9F4EBE7CCEE22CE"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/NodesHub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Nodes Hub 🛡️ 100% Slash Protected 🛡️",
"consensus_address": "kyvevaloper1hvlarv7f2cyjd8y82f6dd6ue0v6xexsskdsxzn",
"protocol_address": "kyve1hvlarv7f2cyjd8y82f6dd6ue0v6xexssyasxv3",
"proof_1": "2D095EE9FFA025D97442B67C3758A479875A95C93EFBF70473AD00FB3F525522",
"proof_2": "8FA9DCABA4310126505C0A7E0A82F4017341343F1D3989F93A6FA180A01D85BE"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/POSTHUMAN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "POSTHUMAN",
"consensus_address": "kyvevaloper16hnse4c852xg4vxjnqhx648e02z32n72l66nv7",
"protocol_address": "kyve16hnse4c852xg4vxjnqhx648e02z32n72d26nzu",
"proof_1": "030342E61AFF1A24277936BE32EB8ECCAD364A4296DBC5CDE8270FCC7CAFC80F",
"proof_2": "030342E61AFF1A24277936BE32EB8ECCAD364A4296DBC5CDE8270FCC7CAFC80F"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/Pro-Nodes75.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Pro-Nodes75",
"consensus_address": "kyvevaloper18y8xcyecmuffkhexvqdpnqc3y7urh02u83ctx4",
"protocol_address": "kyve129y2x3m9muxmg42ua5wjzquadclk2j3yy6ztkw",
"proof_1": "152C4D15BD1941B4EF359487391C7210F6BE001E9C64C98102293434862B9A9B",
"proof_2": "86C105E630D6C9F65960E3401A2B54AA38374FB21A407D2A4FDC71CE10FA78F2"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/Proxier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Proxier",
"consensus_address": "kyvevaloper1jeytlpcq2w60hxpedl9yy0wa447zrr3dpg6ccp",
"protocol_address": "kyve1r5gvlzt03a0a9rks3s57cppmfqx2lzjr5pw5cv",
"proof_1": "E456242563993DCDCCAA78A0BE05AE850D12046785E08B43B584AE1DD43C9B8A",
"proof_2": "B8941CD7248A729649CC2AC4CDEC60D3570FF11E9EF1C2C308FC4228E1131DA1"
}
7 changes: 7 additions & 0 deletions app/upgrades/v2_0/validator-proofs/mainnet/STAVR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "STAVR",
"consensus_address": "kyvevaloper16qwtkeadppy3u9z6pu9tuy8zq02u3vecun3s0d",
"protocol_address": "kyve162ydfdt3j34cx9ndrajfsjxcf5e2hfuxqt49d0",
"proof_1": "519B03D2F88CA680B395EC7D0DA306DAE816B92BAD0487DE76CA4363BAA5846E",
"proof_2": "6CEC9CAE20E2BD131C59CCA5673CB836FB84F534F855FA3983C08F5E921F1B1A"
}

This file was deleted.

69 changes: 69 additions & 0 deletions app/upgrades/v2_0/validator-proofs/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import os
import json
import sys

import requests
import bech32


def verify_tx(api_endpoint, tx_hash, expect_from_address, expect_to_address):
x = requests.get(api_endpoint + "/cosmos/tx/v1beta1/txs/" + tx_hash)
if x.status_code != 200:
raise Exception("transaction does not exist: ", tx_hash)

tx = x.json()
if tx["tx"]["body"]["memo"] != "Shared-Staking":
raise Exception("incorrect memo for transaction: ", tx_hash)

if tx["tx"]["body"]["messages"][0]["from_address"] != expect_from_address:
raise Exception("Incorrect from_address. Expected: {}, got: {}"
.format(expect_from_address, tx["tx"]["body"]["messages"][0]["from_address"]))

if tx["tx"]["body"]["messages"][0]["to_address"] != expect_to_address:
raise Exception("Incorrect to_address. Expected: {}, got: {}"
.format(expect_to_address, tx["tx"]["body"]["messages"][0]["to_address"]))


def verify_proof(api_endpoint, entry):
x = requests.get(api_endpoint + "/cosmos/staking/v1beta1/validators/" + entry["consensus_address"])
if x.status_code != 200:
raise Exception("Consensus validator does not exist: ", entry["consensus_address"])

x = requests.get(api_endpoint + "/kyve/query/v1beta1/staker/" + entry["protocol_address"])
if x.status_code != 200:
raise Exception("Protocol validator does not exist: ", entry["protocol_address"])

prefix, address_bytes = bech32.bech32_decode(entry["consensus_address"])
validator_acc_address = bech32.bech32_encode("kyve", address_bytes)

verify_tx(api_endpoint, entry["proof_1"], entry["protocol_address"], validator_acc_address)
verify_tx(api_endpoint, entry["proof_2"], validator_acc_address, entry["protocol_address"])


def verify_network(name, api_endpoint):
status = {"correct": 0, "error": 0}
for file in os.listdir("./" + name):
try:
proof = json.load(open("./{}/{}".format(name, file)))
verify_proof(api_endpoint, proof)
print("[{}]".format(name.title()), file, "✅")
status["correct"] += 1

except Exception as e:
print("[{}]".format(name.title()), file, "❌")
print(e)
status["error"] += 1

return status


status_kaon = verify_network("kaon", "https://api.kaon.kyve.network")
print("\n[Kaon] Correct: {}, Error: {}".format(status_kaon["correct"], status_kaon["error"]))

print("\n")

status_mainnet = verify_network("mainnet", "https://api.kyve.network")
print("\n[Mainnet] Correct: {}, Error: {}".format(status_mainnet["correct"], status_mainnet["error"]))

if status_kaon["error"] != 0 or status_mainnet["error"] != 0:
sys.exit(1)
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ genesis:
total_bundles: "0"
upload_interval: "60"
protocol:
version: "1.1.6"
version: "1.2.8"
binaries: "{\"kyve-linux-arm64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint%401.1.6/kyve-linux-arm64.zip\",\"kyve-linux-x64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint%401.1.6/kyve-linux-x64.zip\",\"kyve-macos-x64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint%401.1.6/kyve-macos-x64.zip\"}"
last_upgrade: "0"
upgrade_plan:
Expand Down Expand Up @@ -226,4 +226,4 @@ validators:
config:
consensus:
timeout_commit: "2s"
timeout_propose: "2s"
timeout_propose: "2s"
Loading

0 comments on commit 82c17d2

Please sign in to comment.