Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Feb 19, 2025
1 parent 4a24635 commit a1e15ae
Show file tree
Hide file tree
Showing 14 changed files with 577 additions and 361 deletions.
1 change: 1 addition & 0 deletions api/poktroll/migration/event.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 80 additions & 75 deletions api/poktroll/migration/tx.pulsar.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions proto/poktroll/migration/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ message MsgClaimMorseApplication {
string morse_signature = 3 [(gogoproto.jsontag) = "morse_signature"];

// TODO_IN_THIS_COMMIT: comments...
cosmos.base.v1beta1.Coin stake = 4 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin stake = 4 [(gogoproto.jsontag) = "stake"];

// TODO_IN_THIS_COMMIT: comments...
shared.ApplicationServiceConfig service_config = 5;
shared.ApplicationServiceConfig service_config = 5 [(gogoproto.jsontag) = "service_config"];
}

// TODO_IN_THIS_COMMIT: comments...
Expand All @@ -133,12 +133,12 @@ message MsgClaimMorseApplicationResponse {
cosmos.base.v1beta1.Coin claimed_balance = 2 [(gogoproto.jsontag) = "claimed_balance", (gogoproto.nullable) = false];

// TODO_IN_THIS_COMMIT: comments...
cosmos.base.v1beta1.Coin claimedApplicationStake = 3 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin claimedApplicationStake = 3 [(gogoproto.jsontag) = "claimed_application_stake", (gogoproto.nullable) = false];

// The height (on Shannon) at which the claim was created.
int64 claimed_at_height = 4;
int64 claimed_at_height = 4 [(gogoproto.jsontag) = "claimed_at_height"];

// TODO_IN_THIS_COMMIT: comments...
string service_id = 5;
string service_id = 5 [(gogoproto.jsontag) = "service_id"];
}

130 changes: 0 additions & 130 deletions tests/integration/migration/morse_app_import_and_claim_test.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,58 +1,16 @@
package migration

import (
"testing"

"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/pokt-network/poktroll/app/volatile"
"github.com/pokt-network/poktroll/testutil/integration/suites"
"github.com/pokt-network/poktroll/testutil/sample"
migrationtypes "github.com/pokt-network/poktroll/x/migration/types"
)

type MigrationModuleTestSuite struct {
suites.MigrationModuleSuite

// numMorseClaimableAccounts is the number of morse claimable accounts to
// generate when calling #GenerateMorseAccountState.
numMorseClaimableAccounts int
}

func (s *MigrationModuleTestSuite) SetupTest() {
// Initialize a new integration app for the suite.
s.NewApp(s.T())

s.numMorseClaimableAccounts = 10

// Assign the app to nested suites.
// TODO_UPNEXT(@bryanchriswhite, #1043): Initialize the app module suite.
// s.AppSuite.SetApp(s.GetApp())
}

func TestMigrationModuleSuite(t *testing.T) {
suite.Run(t, &MigrationModuleTestSuite{})
}

// TestImportMorseClaimableAccounts tests claiming of morse claimable accounts.
// It only claims account balances and does not test staking any actors as a result of claiming.
func (s *MigrationModuleTestSuite) TestImportMorseClaimableAccounts() {
s.GenerateMorseAccountState(s.T(), s.numMorseClaimableAccounts)
msgImportRes := s.ImportMorseClaimableAccounts(s.T())
morseAccountStateHash, err := s.GetAccountState(s.T()).GetHash()
require.NoError(s.T(), err)

expectedMsgImportRes := &migrationtypes.MsgImportMorseClaimableAccountsResponse{
StateHash: morseAccountStateHash,
NumAccounts: uint64(s.numMorseClaimableAccounts),
}
require.Equal(s.T(), expectedMsgImportRes, msgImportRes)
}

// TestClaimMorseAccount tests claiming of a MorseClaimableAccounts.
// It only exercises claiming of account balances and does not exercise
// the staking any actors as a result of claiming.
Expand All @@ -61,8 +19,9 @@ func (s *MigrationModuleTestSuite) TestClaimMorseAccount() {
s.ImportMorseClaimableAccounts(s.T())

shannonDestAddr := sample.AccAddress()

bankClient := s.GetBankQueryClient(s.T())

// Assert that the shannonDestAddr account initially has a zero balance.
shannonDestBalance, err := bankClient.GetBalance(s.SdkCtx(), shannonDestAddr)
require.NoError(s.T(), err)
require.Equal(s.T(), int64(0), shannonDestBalance.Amount.Int64())
Expand Down
Loading

0 comments on commit a1e15ae

Please sign in to comment.