-
Notifications
You must be signed in to change notification settings - Fork 26
[Morse -> Shannon Migration] account import & claim E2E tests (part 1) #1133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
d7443ae
chore: refactor migrate module cmds
bryanchriswhite 92e6be9
feat: add poktrolld migrate claim-account
bryanchriswhite 792837f
chore: remove TODO comment
bryanchriswhite 8119185
chore: CLI todos
bryanchriswhite fccc241
chore: self-review improvements
bryanchriswhite 4b20720
refactor: migration CLI flags & logger
bryanchriswhite b1a5657
refactor: rename CLI files to match commands
bryanchriswhite 356cf42
chore: self-review improvements
bryanchriswhite ae6ba56
chore: add logging to MsgImportMorseClaimableAccounts handler
bryanchriswhite b39b417
feat: poktrolld tx migration import-morse-accounts
bryanchriswhite 216c216
refactor: flags & logger
bryanchriswhite d3b4ad6
refactor: rename CLI files to match commands
bryanchriswhite 790f1e9
chore: self-review improvements
bryanchriswhite 403b26b
chore: self-review improvements
bryanchriswhite eb4dc21
fix: goimports
bryanchriswhite 7d1b478
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite fe587b6
chore: add MsgImportMorseClaimableAccounts localnet genesis authoriza…
bryanchriswhite 8e8ad01
refactor: testutils
bryanchriswhite 327052e
test: E2E coverage:
bryanchriswhite 1e68f98
chore: update make targets
bryanchriswhite 8af4a05
chore: self-review improvements
bryanchriswhite 025d6f3
chore: self-review improvements
bryanchriswhite 5593745
Merge branch 'main' into issues/1034/cli/claim_account
Olshansk cd6032a
Review of 1105
Olshansk 80d37fc
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
Olshansk 6145f3c
Review 1132
Olshansk 87756bb
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
Olshansk 28ba54e
A couple of small nits
Olshansk 780fa3b
chore: review feedback improvements
bryanchriswhite 6e9fe09
chore: review feedback improvements
bryanchriswhite f242652
chore: fix import hierarchy
bryanchriswhite 4ac255c
chore: review feedback improvements
bryanchriswhite c766440
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
bryanchriswhite 48696fa
chore: review feedback improvements
bryanchriswhite 6c10856
chore: update make targets
bryanchriswhite 13e83a6
chore: defer make targets
bryanchriswhite 0495162
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite 640cd63
Merge remote-tracking branch 'pokt/issues/1034/cli/import' into issue…
bryanchriswhite 92feb63
fixup! HEAD^
bryanchriswhite 2c2ac2a
chore: review feedback improvemenst
bryanchriswhite c988877
chore: review feedback improvements
bryanchriswhite d03c120
chore: review feedback improvemenst
bryanchriswhite 136d2f7
Merge branch 'main' into issues/1034/cli/claim_account
bryanchriswhite eeb723b
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite ab2c67c
chore: review feedback improvements
bryanchriswhite 33ba3c0
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
bryanchriswhite 9bfd3a6
Merge remote-tracking branch 'pokt/main' into issues/1034/cli/claim_a…
bryanchriswhite fecbd00
chore: replace poktrolld with pocketd
bryanchriswhite c789b14
fix: module detection via pkg path
bryanchriswhite 9de6c45
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite dc957b4
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
bryanchriswhite 51c9211
fix: make targets
bryanchriswhite a39a8db
fix: localnet genesis authorizations
bryanchriswhite 88c2434
Merge branch 'main' into issues/1034/cli/claim_account
Olshansk 1a03083
NITs and edits
Olshansk c4a4bf6
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
Olshansk 0f52871
NITs and edits
Olshansk 60c9aaa
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
Olshansk e59090b
NITs and edits
Olshansk b06f2fc
chore: review feedback improvements
bryanchriswhite aa93556
Merge remote-tracking branch 'pokt/main' into issues/1034/cli/claim_a…
bryanchriswhite 982cbc6
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite e795966
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
bryanchriswhite 7b08e2b
fix: linter
bryanchriswhite 5b9e615
Merge remote-tracking branch 'pokt/main' into issues/1034/cli/claim_a…
bryanchriswhite 63c932e
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite eebc0ac
Merge branch 'main' into issues/1034/cli/claim_account
bryanchriswhite 340d3fd
Merge branch 'issues/1034/cli/claim_account' into issues/1034/cli/import
bryanchriswhite fa78550
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
bryanchriswhite 58752e5
Merge remote-tracking branch 'pokt/main' into issues/1034/cli/import
bryanchriswhite 2ab198f
Merge branch 'issues/1034/cli/import' into issues/1034/test/e2e
bryanchriswhite e19ab36
Merge remote-tracking branch 'pokt/main' into issues/1034/test/e2e
bryanchriswhite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package cmd | ||
|
|
||
| // TODO_TECHDEBT: This file is not part of pkg/crypto because it is intended to be removed after the migration. | ||
|
|
||
| // ArmoredJson is a data structure which is used to (de)serialize the encrypted exported Morse private key file. | ||
| // Copy-pasted from https://github.com/pokt-network/pocket-core/blob/2cd25e82095dc52939fef58e9cc3deb1923c01f7/crypto/keys/mintkey/mintkey.go#L96 | ||
| type ArmoredJson struct { | ||
| Kdf string `json:"kdf" yaml:"kdf"` | ||
| Salt string `json:"salt" yaml:"salt"` | ||
| SecParam string `json:"secparam" yaml:"secparam"` | ||
| Hint string `json:"hint" yaml:"hint"` | ||
| Ciphertext string `json:"ciphertext" yaml:"ciphertext"` | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # NOTE: The @oneshot tag allows this feature to be | ||
| # excluded from any wildcard feature file execution (e.g. *.feature). | ||
| # | ||
| # The @oneshot tag indicates that a given feature is non-idempotent with respect to its impact on the network state. | ||
| # In such cases, a complete network reset is required before running these features again. | ||
| @oneshot | ||
|
Olshansk marked this conversation as resolved.
|
||
| Feature: Morse account import and claim all account types (with fixture data) | ||
|
|
||
| Background: | ||
| Given the user has the pocketd binary installed | ||
| And a MorseAccountState with "10" accounts in a "round-robin" distribution has successfully been imported | ||
| And an unclaimed MorseClaimableAccount with a known private key exists | ||
| And a Shannon destination key exists in the local keyring | ||
|
|
||
| Rule: Non-actor account claims MAY reference existing Shannon accounts | ||
| Scenario: Morse account-holder claims as a new non-actor account | ||
| Given the Shannon destination account does not exist onchain | ||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite): Use a new token denomination. | ||
| And the Shannon account is funded with "1upokt" | ||
| When the Morse private key is used to claim a MorseClaimableAccount as a non-actor account | ||
| Then the Shannon destination account balance is increased by the sum of all MorseClaimableAccount tokens | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
|
|
||
| Scenario: Morse account-holder claims as an existing non-actor account | ||
| Given the Shannon destination account exists onchain | ||
| And the Shannon destination account upokt balance is non-zero | ||
| When the Morse private key is used to claim a MorseClaimableAccount as a non-actor account | ||
| Then the Shannon destination account balance is increased by the sum of all MorseClaimableAccount tokens | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
|
|
||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite, #1034: Uncomment the following scenarios once application and supplier Morse account claiming is available. | ||
| # | ||
| # Rule: Actor (re-)stake claims MAY reference existing Shannon actors | ||
| # Scenario Outline: Morse account-holder claims as a new staked actor | ||
| # Given the Shannon destination account is not staked as an "<actor>" | ||
| # When the Morse private key is used to claim a MorseClaimableAccount as an "<actor>" | ||
| # Then the Shannon destination account balance is increased by the unstaked balance amount of the MorseClaimableAccount | ||
| # And the Shannon destination account is staked as an "<actor>" | ||
| # And the Shannon "<actor>" stake increased by the "<stake_amount_field>" of the MorseClaimableAccount | ||
| # And the Shannon "<actor>" service config is updated, if applicable | ||
| # | ||
| # Examples: | ||
| # | actor | stake_amount_field | | ||
| # | application | application_stake | | ||
| # | supplier | supplier_stake | | ||
| # | ||
| # Scenario Outline: Morse account-holder claims as an existing staked actor | ||
| # Given the Shannon destination account is staked as an "<actor>" | ||
| # When the Morse private key is used to claim a MorseClaimableAccount as an "<actor>" | ||
| # Then the Shannon destination account balance is increased by the unstaked balance amount of the MorseClaimableAccount | ||
| # And the Shannon destination account is staked as an "<actor>" | ||
| # And the Shannon "<actor>" stake increased by the "<stake_amount_field>" of the MorseClaimableAccount | ||
| # And the Shannon "<actor>" service config is updated, if applicable | ||
| # | ||
| # Examples: | ||
| # | actor | stake_amount_field | | ||
| # | application | application_stake | | ||
| # | supplier | supplier_stake | | ||
|
|
||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite, #1034): Enumerate and implement error scenarios. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # NOTE: The @oneshot & @manual tags allows this feature to be | ||
|
bryanchriswhite marked this conversation as resolved.
|
||
| # excluded from any wildcard feature file execution (e.g. *.feature). | ||
| # | ||
| # The @manual tag indicates that a given feature depends on some non-automated | ||
| # setup which MUST be performed manually, prior to running the feature. | ||
| # | ||
| # The @oneshot tag indicates that a given feature is non-idempotent with respect | ||
| # to its impact on the network state. In such cases, a complete network reset | ||
| # is required before running these features again. | ||
| @oneshot @manual | ||
| Feature: Morse account import and claim all account types (with snapshot data) | ||
|
|
||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite, #1034): The snapshot based Morse account import feature is incomplete. | ||
|
|
||
| Scenario: Authority generates and imports MorseAccountState | ||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite, #1034): Print a link to the latest liquify snapshot if no local state exists. | ||
| Given a local Morse node persisted state exists | ||
| # TODO_POST_MAINNET: Replace current height with the published "canonical" export/migration/cutover height. | ||
| When the authority exports the Morse Account State at height "130000" to "morse_state_export.json" | ||
| Then a MorseStateExport is written to "morse_state_export.json" | ||
|
|
||
| When the authority executes "poktrolld tx migration collect-morse-accounts morse_state_export.json morse_account_state.json" | ||
| Then a MorseAccountState is written to "morse_account_state.json" | ||
|
|
||
| Given no MorseClaimableAccounts exist | ||
| And the MorseAccountState in "morse_account_state.json" is valid | ||
|
bryanchriswhite marked this conversation as resolved.
|
||
| When the authority executes "poktrolld tx migration import-morse-accounts morse_account_state.json" | ||
| Then the MorseClaimableAccounts are persisted onchain | ||
|
|
||
| Scenario: | ||
| Given a Morse node snapshot is available | ||
| And the authority successfully imports MorseAccountState generated from the snapshot state | ||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite): Ensure the liquify Morse snapshot includes known Morse | ||
| # private keys such that valid claim signatures can be generated for testing. | ||
| # | ||
| # Use a distinct SECRET random number to seed each private key needed. | ||
| # The implementation could read these out of a single new-line delimited | ||
| # env var (e.g. MORSE_KEY_SEED_0). | ||
| And "6" Morse private keys are available in a "round-robin" actor type distribution | ||
|
|
||
| When a Morse account-holder claims as a new non-actor account | ||
| Then the Shannon destination account balance is increased by the sum of all MorseClaimableAccount tokens | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
|
|
||
|
bryanchriswhite marked this conversation as resolved.
|
||
| When a Morse account-holder claims as an existing non-actor account | ||
| Then the Shannon destination account balance is increased by the MorseClaimableAccount unstaked balance | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
|
|
||
| When a Morse account-holder claims as a new application | ||
| Then the Shannon destination account balance is increased by the MorseClaimableAccount unstaked balance | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
| And the Shannon destination account is staked as an application with the stake equal to the onchain MorseClaimableAccount | ||
|
|
||
| Given an application is staked | ||
| When a Morse account-holder claims as an existing application | ||
| Then the Shannon destination account balance is increased by the MorseClaimableAccount unstaked balance | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
| And the Shannon destination account application stake is increased by the MorseClaimableAccount application stake | ||
|
|
||
| When a Morse account-holder claims as a new supplier | ||
| Then the Shannon destination account balance is increased by the MorseClaimableAccount unstaked balance | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
| And the Shannon destination account is staked as an supplier with the stake equal to the onchain MorseClaimableAccount | ||
|
|
||
| Given a supplier is staked | ||
| When a Morse account-holder claims as an existing supplier | ||
| Then the Shannon destination account balance is increased by the MorseClaimableAccount unstaked balance | ||
| And the Morse claimable account is marked as claimed by the shannon account at a recent block height | ||
| And the Shannon destination account supplier stake is increased by the MorseClaimableAccount supplier stake | ||
|
|
||
| # TODO_MAINNET_CRITICAL(@bryanchriswhite, #1034): Enumerate and implement error scenarios. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| //go:build e2e && oneshot && manual | ||
|
|
||
| package e2e | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/regen-network/gocuke" | ||
| ) | ||
|
|
||
| // TestMigrationWithSnapshotData runs the migration_snapshot.feature file ONLY. | ||
| // NOTE: This test depends on a large Morse node snapshot being available locally. | ||
|
bryanchriswhite marked this conversation as resolved.
|
||
| // See: https://pocket-snapshot.liquify.com/#/pruned/ | ||
| // | ||
| // To run this test use: | ||
| // | ||
| // $ make test_e2e_migration_snapshot | ||
| // | ||
| // TODO_MAINNET_CRITICAL(@bryanchriswhite): Add an example of how to get the snapshot (e.g. wget ...) | ||
| func TestMigrationWithSnapshotData(t *testing.T) { | ||
| gocuke.NewRunner(t, &migrationSuite{}). | ||
| Path("migration_snapshot.feature"). | ||
| Run() | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.