diff --git a/.github/scripts/kava-mainnet-ci/check-setup.sh b/.github/scripts/kava-mainnet-ci/check-setup.sh new file mode 100755 index 0000000..22d019f --- /dev/null +++ b/.github/scripts/kava-mainnet-ci/check-setup.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +block_tip=($(curl -s --location --request POST 'http://localhost:8080/network/status' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "network_identifier": { + "blockchain": "Kava", + "network": "kava-mainnet" + } +}' | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["current_block_identifier"]["index"])')) + +echo "latest block index is" $block_tip diff --git a/.github/scripts/kava-mainnet-ci/cli.sh b/.github/scripts/kava-mainnet-ci/cli.sh new file mode 100755 index 0000000..4ca1786 --- /dev/null +++ b/.github/scripts/kava-mainnet-ci/cli.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# downloading cli +curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s + +echo "start check:data" +./bin/rosetta-cli --configuration-file rosetta-cli-conf/kava-mainnet-ci/config.json check:data diff --git a/.github/scripts/kava-mainnet-ci/setup.sh b/.github/scripts/kava-mainnet-ci/setup.sh new file mode 100755 index 0000000..9fd2c05 --- /dev/null +++ b/.github/scripts/kava-mainnet-ci/setup.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +MODE=online NETWORK=kava-mainnet PORT=8080 KAVA_RPC_URL=http://localhost:26657 go run . run diff --git a/rosetta-cli-conf/kava-mainnet-ci/bootstrap_balances.json b/rosetta-cli-conf/kava-mainnet-ci/bootstrap_balances.json new file mode 100644 index 0000000..cf1672d --- /dev/null +++ b/rosetta-cli-conf/kava-mainnet-ci/bootstrap_balances.json @@ -0,0 +1,92 @@ +[ + { + "account_identifier": { + "address":"kava1tygms3xhhs3yv487phx3dw4a95jn7t7lawprey" + }, + "currency":{ + "symbol":"KAVA", + "decimals":6 + }, + "value": "2009330115376" + }, + { + "account_identifier": { + "address":"kava17xpfvakm2amg962yls6f84z3kell8c5lvvhaa6" + }, + "currency":{ + "symbol":"KAVA", + "decimals":6 + }, + "value": "5000" + }, + { + "account_identifier": { + "address":"kava1cj7njkw2g9fqx4e768zc75dp9sks8u9znxrf0w" + }, + "currency":{ + "symbol":"KAVA", + "decimals":6 + }, + "value": "7092167014564" + }, + { + "account_identifier": { + "address":"kava1cj7njkw2g9fqx4e768zc75dp9sks8u9znxrf0w" + }, + "currency":{ + "symbol":"HARD", + "decimals":6 + }, + "value": "77495545031555" + }, + { + "account_identifier": { + "address":"kava1cj7njkw2g9fqx4e768zc75dp9sks8u9znxrf0w" + }, + "currency":{ + "symbol":"SWP", + "decimals":6 + }, + "value": "118904294906784" + }, + { + "account_identifier": { + "address":"kava1a575m9wg78pzr4phguc6pdlztd568qmxdml5ry" + }, + "currency":{ + "symbol":"KAVA", + "decimals":6 + }, + "value": "32412329" + }, + { + "account_identifier": { + "address":"kava1a575m9wg78pzr4phguc6pdlztd568qmxdml5ry" + }, + "currency":{ + "symbol":"HARD", + "decimals":6 + }, + "value": "1212166" + }, + { + "account_identifier": { + "address":"kava1a575m9wg78pzr4phguc6pdlztd568qmxdml5ry" + }, + "currency":{ + "symbol":"SWP", + "decimals":6 + }, + "value": "2139677473" + }, + { + "account_identifier": { + "address":"kava1v858wrcs9xt2h435kar87vxar86mu2fvearprd" + }, + "currency":{ + "symbol":"KAVA", + "decimals":6 + }, + "value": "13480" + } +] diff --git a/rosetta-cli-conf/kava-mainnet-ci/config.json b/rosetta-cli-conf/kava-mainnet-ci/config.json new file mode 100644 index 0000000..d0118fb --- /dev/null +++ b/rosetta-cli-conf/kava-mainnet-ci/config.json @@ -0,0 +1,73 @@ +{ + "network": { + "blockchain": "Kava", + "network": "kava-mainnet" + }, + "online_url": "http://localhost:8080", + "data_directory": "/home/chain-user/.kava/data/rosetta/cache", + "http_timeout": 30, + "max_retries": 25, + "retry_elapsed_time": 0, + "max_online_connections": 120, + "max_sync_concurrency": 5, + "tip_delay": 30, + "max_reorg_depth": 100, + "log_configuration": false, + "compression_disabled": false, + "construction": { + "offline_url": "http://localhost:8080", + "max_offline_connections": 100, + "force_retry": true, + "stale_depth": 5, + "broadcast_limit": 5, + "ignore_broadcast_failures": false, + "clear_broadcasts": false, + "constructor_dsl_file": "kava.ros", + "end_conditions": { + "create_account": 1, + "transfer": 1 + }, + "quiet": false, + "initial_balance_fetch_disabled": false, + "prefunded_accounts": [ + { + "privkey": "4138d62905f516574d1301c805136ef391221ee6541adcd6cedf0c3adb04e34a", + "account_identifier": { + "address": "kava173kayarl9c8tl0m673ppcwkgv8v7kw496pqfpd" + }, + "curve_type": "secp256k1", + "currency":{ + "symbol": "KAVA", + "decimals": 6 + } + } + ] + }, + "data": { + "active_reconciliation_concurrency": 16, + "inactive_reconciliation_concurrency": 4, + "inactive_reconciliation_frequency": 250, + "log_blocks": false, + "log_transactions": false, + "log_balance_changes": false, + "log_reconciliations": false, + "ignore_reconciliation_error": false, + "exempt_accounts": "exempt_accounts.json", + "bootstrap_balances": "bootstrap_balances.json", + "interesting_accounts": "", + "reconciliation_disabled": false, + "reconciliation_drain_disabled": false, + "balance_tracking_disabled": false, + "coin_tracking_disabled": false, + "status_port": 9090, + "results_output_file": "", + "initial_balance_fetch_disabled": false, + "end_conditions": { + "reconciliation_coverage": { + "coverage": 0.95, + "from_tip": true, + "tip": true + } + } + } +} diff --git a/rosetta-cli-conf/kava-mainnet-ci/exempt_accounts.json b/rosetta-cli-conf/kava-mainnet-ci/exempt_accounts.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/rosetta-cli-conf/kava-mainnet-ci/exempt_accounts.json @@ -0,0 +1 @@ +[] diff --git a/rosetta-cli-conf/kava-mainnet-ci/kava.ros b/rosetta-cli-conf/kava-mainnet-ci/kava.ros new file mode 100644 index 0000000..e018630 --- /dev/null +++ b/rosetta-cli-conf/kava-mainnet-ci/kava.ros @@ -0,0 +1,66 @@ +create_account(1){ + create{ + network = set_variable({"network":"kava-testnet", "blockchain":"Kava"}); + key = generate_key({"curve_type": "secp256k1"}); + account = derive({ + "network_identifier": {{network}}, + "public_key": {{key.public_key}} + }); + save_account({ + "account_identifier": {{account.account_identifier}}, + "keypair": {{key}} + }); + } +} + +transfer(1){ + transfer{ + transfer.network = set_variable({"network":"kava-testnet", "blockchain":"Kava"}); + currency = {"symbol":"KAVA", "decimals":6}; + sender = find_balance({ + "minimum_balance":{ + "value": "100000", + "currency": {{currency}} + } + }); + + // Set the recipient_amount as some value <= sender.balance-max_fee + max_fee = "1000"; + recipient_amount = "1001"; + print_message({"recipient_amount":{{recipient_amount}}}); + + // Find recipient and construct operations + sender_amount = 0 - {{recipient_amount}}; + recipient = find_balance({ + "not_account_identifier":[{{sender.account_identifier}}], + "minimum_balance":{ + "value": "0", + "currency": {{currency}} + }, + "create_limit": 100, + "create_probability": 50 + }); + transfer.confirmation_depth = "1"; + transfer.operations = [ + { + "operation_identifier":{"index":0}, + "type":"transfer", + "account":{{sender.account_identifier}}, + "amount":{ + "value":{{sender_amount}}, + "currency":{{currency}} + } + }, + { + "operation_identifier":{"index":1}, + "related_operations":[{"index":0}], + "type":"transfer", + "account":{{recipient.account_identifier}}, + "amount":{ + "value":{{recipient_amount}}, + "currency":{{currency}} + } + } + ]; + } +}