Skip to content

Commit

Permalink
Create kava-localnet-ci directory
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Aug 9, 2024
1 parent 618978a commit 7bed257
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/process_kava_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ jobs:
- name: Run kava docker container
run: KAVA_TAG=local kvtool t bootstrap

- name: Wait until kava node is ready to serve traffic
run: bash ${GITHUB_WORKSPACE}/rosetta-kava/.github/scripts/wait-for-node-init.sh
# - name: Wait until kava node is ready to serve traffic
# run: bash ${GITHUB_WORKSPACE}/rosetta-kava/.github/scripts/wait-for-node-init.sh

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3

- name: Run integration tests
run: KAVA_RPC_URL=http://localhost:26657 NETWORK=kava-local PORT=4000 SKIP_LIVE_NODE_TESTS=true make test-integration
Expand Down
73 changes: 73 additions & 0 deletions rosetta-cli-conf/kava-localnet-ci/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"network": {
"blockchain": "Kava",
"network": "kava-testnet"
},
"online_url": "http://localhost:8000",
"data_directory": "./rosetta-cli-conf/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:8000",
"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
}
}
}
}
66 changes: 66 additions & 0 deletions rosetta-cli-conf/kava-localnet-ci/kava.ros
Original file line number Diff line number Diff line change
@@ -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}}
}
}
];
}
}

0 comments on commit 7bed257

Please sign in to comment.