Skip to content

Commit

Permalink
chore: review feedback improvements
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Olshansky <[email protected]>
  • Loading branch information
bryanchriswhite and Olshansk committed Feb 12, 2025
1 parent ac97ff4 commit 7f9e980
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 60 deletions.
5 changes: 3 additions & 2 deletions api/poktroll/application/types.pulsar.go

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

29 changes: 16 additions & 13 deletions api/poktroll/migration/morse_offchain.pulsar.go

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

15 changes: 10 additions & 5 deletions api/poktroll/migration/morse_onchain.pulsar.go

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

2 changes: 1 addition & 1 deletion cmd/poktrolld/cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func collectInputAccountBalances(inputState *migrationtypes.MorseStateExport, mo
for exportAccountIdx, exportAccount := range inputState.AppState.Auth.Accounts {
// DEV_NOTE: Ignore module accounts.
// 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
// See: https://github.com/pokt-network/poktroll/issues/1066 regarding supply validation.
if exportAccount.Type != "posmint/Account" {
logger.Warn().
Str("type", exportAccount.Type).
Expand Down
27 changes: 6 additions & 21 deletions proto/poktroll/migration/morse_onchain.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,13 @@ option go_package = "github.com/pokt-network/poktroll/x/migration/types";
option (gogoproto.stable_marshaler_all) = true;

// MorseAccountState is the onchain representation of the imported account state from Morse.
//
// TODO_UPNEXT(@bryanchriswhite): Decompose this on-chain structure.
message MorseAccountState {
// 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 @@ -41,20 +27,19 @@ message MorseAccount {
option (gogoproto.goproto_stringer) = true;
option (cosmos_proto.implements_interface) = "Account";

// address is a binary (not hex) representation of the Account's ed25519 public key.
// A hex-encoded representation of the address corresponding to a Morse application'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\""];

// 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.
// The total amount of uPOKT owned by the account; this is a sum of the balance and any actor stakes.
// NB: The default stake/balance proportion is derived from Morse query response(s) at the time of claiming.
repeated cosmos.base.v1beta1.Coin coins = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "coins"];
}

// 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"];
}
}
2 changes: 1 addition & 1 deletion x/application/types/types.pb.go

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

29 changes: 16 additions & 13 deletions x/migration/types/morse_offchain.pb.go

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

13 changes: 9 additions & 4 deletions x/migration/types/morse_onchain.pb.go

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

0 comments on commit 7f9e980

Please sign in to comment.