From b014c2c9d70126f54f0dfb54082874145a13b526 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 16 Oct 2024 11:40:29 +0530 Subject: [PATCH 1/6] fix: thorchain claim server address --- x/claim/keeper/msg_server_claim_thorchain.go | 2 +- .../keeper/msg_server_claim_thorchain_test.go | 74 ++++++++++++++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/x/claim/keeper/msg_server_claim_thorchain.go b/x/claim/keeper/msg_server_claim_thorchain.go index 31d4d2fb..b28a851c 100644 --- a/x/claim/keeper/msg_server_claim_thorchain.go +++ b/x/claim/keeper/msg_server_claim_thorchain.go @@ -15,7 +15,7 @@ func (k msgServer) ClaimThorchain(goCtx context.Context, msg *types.MsgClaimThor k.Logger(ctx).Info(msg.Creator) // only allow thorchain claim server address to call this function - if msg.Creator != "tarkeo1z02ke8639m47g9dfrheegr2u9zecegt5qvtj00" || msg.Creator == "arkeo1z02ke8639m47g9dfrheegr2u9zecegt50fjg7v" { + if msg.Creator != "tarkeo1z02ke8639m47g9dfrheegr2u9zecegt5qvtj00" && msg.Creator != "arkeo1z02ke8639m47g9dfrheegr2u9zecegt50fjg7v" { return nil, errors.Wrapf(types.ErrInvalidCreator, "Invalid Creator %s", msg.Creator) } diff --git a/x/claim/keeper/msg_server_claim_thorchain_test.go b/x/claim/keeper/msg_server_claim_thorchain_test.go index bff4b920..8d30ca62 100644 --- a/x/claim/keeper/msg_server_claim_thorchain_test.go +++ b/x/claim/keeper/msg_server_claim_thorchain_test.go @@ -10,7 +10,7 @@ import ( "github.com/arkeonetwork/arkeo/x/claim/types" ) -func TestClaimThorchain(t *testing.T) { +func TestClaimThorchainTestnetAddress(t *testing.T) { msgServer, keepers, ctx := setupMsgServer(t) sdkCtx := sdk.UnwrapSDKContext(ctx) @@ -81,3 +81,75 @@ func TestClaimThorchain(t *testing.T) { _, err = msgServer.ClaimThorchain(ctx, &claimMessage) require.ErrorIs(t, err, types.ErrNoClaimableAmount) } + +func TestClaimThorchainMainnetAddress(t *testing.T) { + msgServer, keepers, ctx := setupMsgServer(t) + sdkCtx := sdk.UnwrapSDKContext(ctx) + + config := sdk.GetConfig() + config.SetBech32PrefixForAccount("arkeo", "arkeopub") + + arkeoServerAddress, err := sdk.AccAddressFromBech32("arkeo1z02ke8639m47g9dfrheegr2u9zecegt50fjg7v") + require.NoError(t, err) + + fromAddr := utils.GetRandomArkeoAddress() + toAddr := utils.GetRandomArkeoAddress() + + claimRecordFrom := types.ClaimRecord{ + Chain: types.ARKEO, + Address: fromAddr.String(), + AmountClaim: sdk.NewInt64Coin(types.DefaultClaimDenom, 100), + AmountVote: sdk.NewInt64Coin(types.DefaultClaimDenom, 100), + AmountDelegate: sdk.NewInt64Coin(types.DefaultClaimDenom, 100), + } + claimRecordTo := types.ClaimRecord{ + Chain: types.ARKEO, + Address: toAddr.String(), + AmountClaim: sdk.NewInt64Coin(types.DefaultClaimDenom, 100), + AmountVote: sdk.NewInt64Coin(types.DefaultClaimDenom, 100), + AmountDelegate: sdk.NewInt64Coin(types.DefaultClaimDenom, 100), + } + err = keepers.ClaimKeeper.SetClaimRecord(sdkCtx, claimRecordFrom) + require.NoError(t, err) + err = keepers.ClaimKeeper.SetClaimRecord(sdkCtx, claimRecordTo) + require.NoError(t, err) + + // mint coins to module account + err = keepers.BankKeeper.MintCoins(sdkCtx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(types.DefaultClaimDenom, 10000))) + require.NoError(t, err) + + invalidClaimMessage := types.MsgClaimThorchain{ + Creator: fromAddr.String(), + FromAddress: fromAddr.String(), + ToAddress: toAddr.String(), + } + _, err = msgServer.ClaimThorchain(ctx, &invalidClaimMessage) + require.ErrorIs(t, types.ErrInvalidCreator, err) + + claimMessage := types.MsgClaimThorchain{ + Creator: arkeoServerAddress.String(), + FromAddress: fromAddr.String(), + ToAddress: toAddr.String(), + } + _, err = msgServer.ClaimThorchain(ctx, &claimMessage) + require.NoError(t, err) + + // check if claimrecord is updated + claimRecordFrom, err = keepers.ClaimKeeper.GetClaimRecord(sdkCtx, fromAddr.String(), types.ARKEO) + require.NoError(t, err) + require.True(t, claimRecordFrom.IsEmpty()) + + claimRecordTo, err = keepers.ClaimKeeper.GetClaimRecord(sdkCtx, toAddr.String(), types.ARKEO) + require.NoError(t, err) + require.True(t, !claimRecordTo.IsEmpty()) + + require.Equal(t, claimRecordTo.Address, toAddr.String()) + require.Equal(t, claimRecordTo.Chain, types.ARKEO) + require.Equal(t, claimRecordTo.AmountClaim, sdk.NewInt64Coin(types.DefaultClaimDenom, 200)) + require.Equal(t, claimRecordTo.AmountVote, sdk.NewInt64Coin(types.DefaultClaimDenom, 200)) + require.Equal(t, claimRecordTo.AmountDelegate, sdk.NewInt64Coin(types.DefaultClaimDenom, 200)) + + // attempt to claim again to ensure it fails. + _, err = msgServer.ClaimThorchain(ctx, &claimMessage) + require.ErrorIs(t, err, types.ErrNoClaimableAmount) +} From bd84c3965e4cca62954a7d2a47a21f40f0d8b698 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 16 Oct 2024 12:40:17 +0530 Subject: [PATCH 2/6] fix: regression tests version issues --- CHANGELOG.md | 9 +++++++++ test/regression/cmd/export.go | 1 + .../mnt/exports/suites_contracts_pay-as-you-go.json | 1 - .../mnt/exports/suites_contracts_subscription.json | 1 - test/regression/mnt/exports/suites_core_send.json | 1 - test/regression/mnt/exports/suites_initialize.json | 1 - .../mnt/exports/suites_providers_providers.json | 1 - .../mnt/exports/suites_sentinel_contract_config.json | 1 - .../regression/mnt/exports/suites_sentinel_sentinel.json | 1 - 9 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb3ab2f..8aa1f47e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,15 @@ Contains bug fixes. Contains all the PRs that improved the code without changing the behaviors. --> +# v1.0.2-Prerelease + +## Added + +## Changed + +## Fixed +- Fixed Regression Test Version Issues + # v1.0.1-Prerelease ## Added diff --git a/test/regression/cmd/export.go b/test/regression/cmd/export.go index dae96fb8..ffbcd419 100644 --- a/test/regression/cmd/export.go +++ b/test/regression/cmd/export.go @@ -44,6 +44,7 @@ func export(path string) error { appState, _ := export["app_state"].(map[string]any) claimArkeo, _ := appState["claimarkeo"].(map[string]any) params, _ := claimArkeo["params"].(map[string]any) + delete(export, "app_version") delete(params, "airdrop_start_time") staking, _ := appState["staking"].(map[string]any) validators, _ := staking["validators"].([]any) diff --git a/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json b/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json index 7a501b76..2c532eb8 100644 --- a/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json +++ b/test/regression/mnt/exports/suites_contracts_pay-as-you-go.json @@ -690,7 +690,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { diff --git a/test/regression/mnt/exports/suites_contracts_subscription.json b/test/regression/mnt/exports/suites_contracts_subscription.json index 0f673df1..c3eeea7b 100644 --- a/test/regression/mnt/exports/suites_contracts_subscription.json +++ b/test/regression/mnt/exports/suites_contracts_subscription.json @@ -708,7 +708,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { diff --git a/test/regression/mnt/exports/suites_core_send.json b/test/regression/mnt/exports/suites_core_send.json index d72943be..88a02d22 100644 --- a/test/regression/mnt/exports/suites_core_send.json +++ b/test/regression/mnt/exports/suites_core_send.json @@ -583,7 +583,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { diff --git a/test/regression/mnt/exports/suites_initialize.json b/test/regression/mnt/exports/suites_initialize.json index 13d7817d..559c4ace 100644 --- a/test/regression/mnt/exports/suites_initialize.json +++ b/test/regression/mnt/exports/suites_initialize.json @@ -580,7 +580,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { diff --git a/test/regression/mnt/exports/suites_providers_providers.json b/test/regression/mnt/exports/suites_providers_providers.json index 07cd9f65..0595f67a 100644 --- a/test/regression/mnt/exports/suites_providers_providers.json +++ b/test/regression/mnt/exports/suites_providers_providers.json @@ -594,7 +594,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { diff --git a/test/regression/mnt/exports/suites_sentinel_contract_config.json b/test/regression/mnt/exports/suites_sentinel_contract_config.json index dc413497..7978be7d 100644 --- a/test/regression/mnt/exports/suites_sentinel_contract_config.json +++ b/test/regression/mnt/exports/suites_sentinel_contract_config.json @@ -667,7 +667,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { diff --git a/test/regression/mnt/exports/suites_sentinel_sentinel.json b/test/regression/mnt/exports/suites_sentinel_sentinel.json index efdd4fa1..2fa669f4 100644 --- a/test/regression/mnt/exports/suites_sentinel_sentinel.json +++ b/test/regression/mnt/exports/suites_sentinel_sentinel.json @@ -560,7 +560,6 @@ "upgrade": {}, "vesting": {} }, - "app_version": "v1.0.0-prerelease", "chain_id": "arkeo", "consensus": { "params": { From c7ae4afdf3d6dbb961a546215b8c98d4539b92d8 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 16 Oct 2024 12:41:36 +0530 Subject: [PATCH 3/6] chore: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aa1f47e..2ab79942 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Contains all the PRs that improved the code without changing the behaviors. ## Added ## Changed +- Updated thorchain claim server address handling ## Fixed - Fixed Regression Test Version Issues From ef3f861c9ba41e99b47f21a405a9eb6b55cc3b34 Mon Sep 17 00:00:00 2001 From: shreyasbhat0 Date: Wed, 16 Oct 2024 12:46:37 +0530 Subject: [PATCH 4/6] fix: go releaser checksum file --- .goreleaser-cross.yaml | 2 +- .goreleaser.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser-cross.yaml b/.goreleaser-cross.yaml index e4eedb22..dab046c3 100644 --- a/.goreleaser-cross.yaml +++ b/.goreleaser-cross.yaml @@ -134,7 +134,7 @@ archives: - none* checksum: - name_template: '{{ .ProjectName }}d_v{{ .Version }}_{{ if eq .Env.BUILD_TAG "testnet" }}_testnet{{ end }}_cross_checksums.txt' + name_template: '{{ .ProjectName }}d_v{{ .Version }}_{{ if eq .Env.BUILD_TAG "testnet" }}testnet{{ end }}_cross_checksums.txt' dockers: - use: buildx diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 72e55ff7..b316b364 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -60,7 +60,7 @@ archives: files: - none* checksum: - name_template: '{{ .ProjectName }}d_v{{ .Version }}_{{ if eq .Env.BUILD_TAG "testnet" }}_testnet{{ end }}_checksums.txt' + name_template: '{{ .ProjectName }}d_v{{ .Version }}_{{ if eq .Env.BUILD_TAG "testnet" }}testnet{{ end }}_checksums.txt' dockers: - use: buildx goos: linux From b5e410dcdc7ed434beb6bcc3c70775b7d6c1193a Mon Sep 17 00:00:00 2001 From: toshiSat <10103480+toshiSat@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:42:07 -0600 Subject: [PATCH 5/6] Fix thor mainnet error --- x/claim/keeper/msg_server_claim_thorchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/claim/keeper/msg_server_claim_thorchain.go b/x/claim/keeper/msg_server_claim_thorchain.go index 31d4d2fb..b28a851c 100644 --- a/x/claim/keeper/msg_server_claim_thorchain.go +++ b/x/claim/keeper/msg_server_claim_thorchain.go @@ -15,7 +15,7 @@ func (k msgServer) ClaimThorchain(goCtx context.Context, msg *types.MsgClaimThor k.Logger(ctx).Info(msg.Creator) // only allow thorchain claim server address to call this function - if msg.Creator != "tarkeo1z02ke8639m47g9dfrheegr2u9zecegt5qvtj00" || msg.Creator == "arkeo1z02ke8639m47g9dfrheegr2u9zecegt50fjg7v" { + if msg.Creator != "tarkeo1z02ke8639m47g9dfrheegr2u9zecegt5qvtj00" && msg.Creator != "arkeo1z02ke8639m47g9dfrheegr2u9zecegt50fjg7v" { return nil, errors.Wrapf(types.ErrInvalidCreator, "Invalid Creator %s", msg.Creator) } From 715ea96a108e9b4488568868dd9fabba98a5245d Mon Sep 17 00:00:00 2001 From: toshiSat <10103480+toshiSat@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:44:38 -0600 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb3ab2f..7433c930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ Contains all the PRs that improved the code without changing the behaviors. - Updated Tests on arkeo module keeper - version issue on begin blocker - Fixed Genesis Url +- Fixed thorchain claim server address mainnet # v1.0.0-Prerelease