diff --git a/.github/workflows/process_kava_dispatch.yml b/.github/workflows/process_kava_dispatch.yml index 51ecd74..94de7b8 100644 --- a/.github/workflows/process_kava_dispatch.yml +++ b/.github/workflows/process_kava_dispatch.yml @@ -54,6 +54,9 @@ jobs: - 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 working-directory: ./rosetta-kava diff --git a/Makefile b/Makefile index 42b7a6d..c3b7cc3 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,10 @@ run-testnet: run-local: MODE=online NETWORK=kava-localnet PORT=8000 KAVA_RPC_URL=http://localhost:26657 go run . run +.PHONY: run-local-offline +run-local-offline: + MODE=offline NETWORK=kava-localnet PORT=8001 KAVA_RPC_URL=http://localhost:26657 go run . run + .PHONY: test test: go test -v ./... diff --git a/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/000000.vlog b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/000000.vlog new file mode 100644 index 0000000..8ac3604 Binary files /dev/null and b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/000000.vlog differ diff --git a/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/000001.sst b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/000001.sst new file mode 100644 index 0000000..6979cd1 Binary files /dev/null and b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/000001.sst differ diff --git a/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/KEYREGISTRY b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/KEYREGISTRY new file mode 100644 index 0000000..ac83e62 --- /dev/null +++ b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/KEYREGISTRY @@ -0,0 +1 @@ +pJwMe4B_Hello Badger \ No newline at end of file diff --git a/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/MANIFEST b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/MANIFEST new file mode 100644 index 0000000..2f2676e Binary files /dev/null and b/rosetta-cli-conf/cache2/check-construction/c598498cd0d1e6539e3d4e906839c9efa54ee613403a679dae9bec3f741d9f8f/MANIFEST differ diff --git a/rosetta-cli-conf/kava-localnet-ci/config.json b/rosetta-cli-conf/kava-localnet-ci/config.json new file mode 100644 index 0000000..d63fa59 --- /dev/null +++ b/rosetta-cli-conf/kava-localnet-ci/config.json @@ -0,0 +1,73 @@ +{ + "network": { + "blockchain": "Kava", + "network": "kava-localnet" + }, + "online_url": "http://localhost:8000", + "data_directory": "./rosetta-cli-conf/cache2", + "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": "aa50f4c6c15190d9e18bf8b14fc09bfba0e7306331a4f232d10a77c2879e7966", + "account_identifier": { + "address": "kava1q0dkky0505r555etn6u2nz4h4kjcg5y8dg863a" + }, + "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-localnet-ci/kava.ros b/rosetta-cli-conf/kava-localnet-ci/kava.ros new file mode 100644 index 0000000..e6b2483 --- /dev/null +++ b/rosetta-cli-conf/kava-localnet-ci/kava.ros @@ -0,0 +1,71 @@ +create_account(1){ + create{ + network = set_variable({"network":"kava-localnet", "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-localnet", "blockchain":"Kava"}); + currency = {"symbol":"KAVA", "decimals":6}; + sender = find_balance({ + "minimum_balance":{ + "value": "100000", + "currency": {{currency}} + } + }); + + print_message({"sender":{{sender}}}); + + // Set the recipient_amount as some value <= sender.balance-max_fee + max_fee = "1000"; + recipient_amount = "1001"; + print_message({"recipient_amount":{{recipient_amount}}}); + print_message({"debug":{{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 + }); + print_message({"debug2":{{recipient_amount}}}); + print_message({"recipient":{{recipient}}}); + 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}} + } + } + ]; + } +} diff --git a/rosetta-cli-conf/kava-localnet/kava.ros b/rosetta-cli-conf/kava-localnet/kava.ros index 0af2277..b8d6341 100644 --- a/rosetta-cli-conf/kava-localnet/kava.ros +++ b/rosetta-cli-conf/kava-localnet/kava.ros @@ -48,8 +48,7 @@ transfer(10){ // Set the recipient_amount as some value <= sender.balance-max_fee max_fee = "1000"; - available_amount = {{sender.balance.value}} - {{max_fee}}; - recipient_amount = random_number({"minimum": "1", "maximum": {{available_amount}}}); + recipient_amount = "1001"; print_message({"recipient_amount":{{recipient_amount}}}); // Find recipient and construct operations @@ -100,6 +99,8 @@ return_funds(10){ } }); + print_message({"sender":{{sender}}}); + // Set the recipient_amount as some sender.balance-max_fee available_amount = {{sender.balance.value}} - {{max_fee}}; print_message({"available_amount":{{available_amount}}}); diff --git a/rosetta-cli-conf/kava-testnet-ci/kava.ros b/rosetta-cli-conf/kava-testnet-ci/kava.ros index e018630..b7a94d3 100644 --- a/rosetta-cli-conf/kava-testnet-ci/kava.ros +++ b/rosetta-cli-conf/kava-testnet-ci/kava.ros @@ -28,6 +28,7 @@ transfer(1){ max_fee = "1000"; recipient_amount = "1001"; print_message({"recipient_amount":{{recipient_amount}}}); + print_message({"debug":{{recipient_amount}}}); // Find recipient and construct operations sender_amount = 0 - {{recipient_amount}}; @@ -40,6 +41,8 @@ transfer(1){ "create_limit": 100, "create_probability": 50 }); + print_message({"debug2":{{recipient_amount}}}); + print_message({"recipient":{{recipient}}}); transfer.confirmation_depth = "1"; transfer.operations = [ {