Skip to content

Commit

Permalink
Cleanup TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Feb 11, 2025
1 parent 6347a04 commit 79f0c82
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 51 deletions.
3 changes: 2 additions & 1 deletion cmd/poktrolld/cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ func transformMorseState(
func collectInputAccountBalances(inputState *migrationtypes.MorseStateExport, morseWorkspace *morseImportWorkspace) error {
for exportAccountIdx, exportAccount := range inputState.AppState.Auth.Accounts {
// DEV_NOTE: Ignore module accounts.
// TODO_IN_THIS_PR: Create a GitHub issue based on this thread: https://github.com/pokt-network/poktroll/pull/1039/files#r1934711993
// TODO_MAINNET(@olshansky): Revisit this business logic to ensure that no tokens go missing from Morse to Shannon.
// Ref: https://github.com/pokt-network/poktroll/pull/1039/files#r1934711993
if exportAccount.Type != "posmint/Account" {
logger.Warn().
Str("type", exportAccount.Type).
Expand Down
7 changes: 4 additions & 3 deletions cmd/poktrolld/cmd/migrate/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
migrationtypes "github.com/pokt-network/poktroll/x/migration/types"
)

// TODO_IN_THIS_PR: Add a TODO to an E2E assuming this approach is sufficient
// for what we need to do: https://github.com/pokt-network/poktroll/pull/1039#discussion_r1947036729
// Not in CI. Get the user to run wget and download the 90GB, and verify things on their computer.
// TODO_MAINNET(@bryanchriswhite): Add an E2E/integration test using real data.
// Note: This test should not be included in CI due to its size (90GB).
// Users should manually run wget to download the data and verify it on their computer.
// Reference: https://github.com/pokt-network/poktroll/pull/1039#discussion_r1947036729

func init() {
logger = polyzero.NewLogger(polyzero.WithLevel(polyzero.DebugLevel))
Expand Down
69 changes: 22 additions & 47 deletions proto/poktroll/migration/morse_onchain.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,26 @@ option (gogoproto.stable_marshaler_all) = true;

// MorseAccountState is the onchain representation of the imported account state from Morse.
message MorseAccountState {
// TODO_IN_THIS_PR: #PUC to the rationale of needing to index this.
// TODO_MAINNET(@bryanchriswhite): Explain the rationale of this mapping/index/#PUC or refactor.
map<string, uint64> accounts_idx_by_address = 1 [(gogoproto.jsontag) = "accounts_idx_by_address", (gogoproto.moretags) = "yaml:\"accounts_idx_by_address\""];
repeated MorseAccount accounts = 2 [(gogoproto.jsontag) = "accounts", (gogoproto.moretags) = "yaml:\"accounts\""];
}

// TODO_MAINNET(@bryanchriswhite): Refactor morse_onchain and morse_offchain to support
// the full all migration requirements.
// This is being merged in as an interim step in #1039 but will not be the final implementation.
// Example:
// 1. Assume a Supplier in Morse with 100 staked POKT (in escrow) and 100 unstaked POKT (balance)
// 2. When ClaimPOKTMorseAsSupplier is called:
// - A single new Supplier in Shannon will be staked with 100 POKT (escrow) and 100 POKT (balance)
// - The configs (i.e. the data) staked for can vary as long as the total POKT (staked + unstaked) is equivalent
// - The following situations ARE NOT allowed:
// - Claiming different variations of total amounts (e.g. 99 unstaked POKT + 101 staked POKT)
// - Partial claiming (e.g. 1 staked POKT + 1 unstaked POKT)
// - Claiming to multiple Supplier
// 3. The above needs to be done for each actor
// 4. Caveats: edge cases like "min stake amounts" will be accounted for in the operational process to ensure they're non issues

// MorseAccount is an analog of the Morse ProtoBaseAccount type.
// It encapsulates the minimum information required to import accounts.
//
Expand All @@ -26,62 +41,22 @@ message MorseAccount {
option (gogoproto.goproto_stringer) = true;
option (cosmos_proto.implements_interface) = "Account";

// A binary representation of the address corresponding to a Morse application's ed25519 public key.
// TODO_IN_THIS_PR: #PUC if this is hex or not?
// address is a binary (not hex) representation of the Account's ed25519 public key.
bytes address = 1 [(gogoproto.jsontag) = "address", (gogoproto.casttype) = "github.com/cometbft/cometbft/crypto.Address"];

// The ed25519 public key of the account.
MorsePublicKey pub_key = 2 [(gogoproto.jsontag) = "public_key", (gogoproto.moretags) = "yaml:\"public_key\""];

enum MorseAccountType {
MORSE_ACCOUNT_UNSPECIFIED = 0;
MORSE_ACCOUNT_APPLICATION = 1;
MORSE_ACCOUNT_NODE = 2;
}

// The amount of uPOKT held by the account.
// TODO_IN_THIS_PR: #PUC how we distinguish staked tokens from regular tokens?
// repeated cosmos.base.v1beta1.Coin coins = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "coins"];
// TODO_MAINNET/UPNEXT
// The amount of uPOKT held by the account
// TODO_MAINNET(@bryanchriswhite): Refactor to another approach supporting the new requirements to claim as a staked actor.
// This could be a split to "staked_coins" + "unstaked_coins" (as an example), but any other approaches is valid.
repeated cosmos.base.v1beta1.Coin coins = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "coins"];
repeated cosmos.base.v1beta1.Coin staked_coins = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "coins"];
repeated cosmos.base.v1beta1.Coin unstaked_coins = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "coins"];
}

// Goals:
// 1. Minimizing on-chain
// 2. PR exhaustion + iterating on main
// 3. Olshansky will update TODO_IN_THIS_PR
// 4.

// TODO_MAINNET: Enforce AppStake & SupplierStake is mapped 1:1 between Morse & Shannon during staked claiming
// Open Questions to enable enforcing the above:
// - Minimum stake amounts (e.g. adjust parameters)
// -

addr1: 200 POKT

I am a morse Application (addr1)
- 100 stakd POKT
- 100 unstaked POKT

ClaimAsApplication(config; ):
- 100 staked POKT
- 100 unstaked POKT

Example:
- Addr1 is staked in Morse (as supplier)
- Addr1 claims as application in Shannon



Case 1 (incorrect)
- ClaimAsApplication(config.stake=99 POKT)
-> error (ShannonClaimStake != MorseStake)



// MorsePublicKey is required to conform to the encoding of the Morse state export.
// NB: All Morse account public keys will be ed25519 keys by definition.
message MorsePublicKey {
bytes value = 2 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"];
}
}

0 comments on commit 79f0c82

Please sign in to comment.