Skip to content
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

[Application] chore: implement app transfer period #789

Merged
merged 173 commits into from
Oct 4, 2024

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented Sep 4, 2024

Summary

  • Reconcile the need for a transfer period with [Application] feat: app stake transfer #743.
  • Ensure the app transfer message handler returns grpc status errors consistently.
  • Improve some shared E2E tests.
  • Implement ApplicationIntegrationSuite test suite.
  • Port app transfer E2E tests to integration tests.

Depends on

Issue

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Documentation: make docusaurus_start; only needed if you make doc changes
  • Unit Tests: make go_develop_and_test
  • LocalNet E2E Tests: make test_e2e
  • DevNet E2E Tests: Add the devnet-test-e2e label to the PR.

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have commented my code
  • I have performed a self-review of my own code; both comments & source code
  • I create and reference any new tickets, if applicable
  • I have left TODOs throughout the codebase, if applicable

bryanchriswhite and others added 27 commits August 21, 2024 22:21
…ke-transfer

* pokt/main:
  [Application] Implement unbonding period (#735)
  [Docs] Move over docs from poktroll-docker-compose-example (#757)
  [Performance] Reduce RelayMiner memory consumption under load (#739)
@bryanchriswhite bryanchriswhite added application Changes related to the Application actor on-chain On-chain business logic labels Sep 4, 2024
tests/integration/application/application_transfer_test.go Outdated Show resolved Hide resolved
testutil/integration/suites/application.go Outdated Show resolved Hide resolved
testutil/integration/suites/application.go Outdated Show resolved Hide resolved
testutil/integration/suites/application.go Outdated Show resolved Hide resolved
Copy link
Contributor

@red-0ne red-0ne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

Left some NITs and a suggestion about undelegations merging.

x/application/keeper/transfer_applications.go Outdated Show resolved Hide resolved
}

// Transfer sends a MsgApplicationTransfer to begin an application transfer
// from srcBech32 to dstDst32.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// from srcBech32 to dstDst32.
// from srcBech32 to dstBech32.

I'm not a big fan of the bech32 term.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to disambiguate between cosmostypes.AccAddress and the string representation. I agree that it's not the prettiest and gets monotonous more quickly than addr. Do you think bech is to far removed to be clear or have a better idea?

tests/integration/application/application_transfer_test.go Outdated Show resolved Hide resolved
tests/integration/application/application_transfer_test.go Outdated Show resolved Hide resolved
x/application/keeper/transfer_applications.go Outdated Show resolved Hide resolved
…ansfer-period

* pokt/main:
  [Gateway] chore: add `MsgUpdateParam` to gateway module (#808)
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bryanchriswhite Approving since I won't be available and overall it LGTM.

My biggest concerns / asks for the future:

  1. Think of ways to make sure we use the test helpers you introduced
  2. Add SIMPLE (< 7 elements per )mermaid diagrams in the docs showing what merging does and how it works

e2e/tests/init_test.go Show resolved Hide resolved

// Only process application transfers at the end of the session in
// order to avoid inconsistent/unpredictable mid-session behavior.
if !shared.IsSessionEndHeight(&sharedParams, currentHeight) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a debug log please that includes current height and the next session end height

Copy link
Contributor Author

@bryanchriswhite bryanchriswhite Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to push back on this. This would produce a log for every block that's not a session end height. EndBlockerUnbondApplications() and EndBlockerUnbondSuppliers() both have a simliar conditional branch and neither includes the log that you're suggesting here.

Can you elaborate on the rationale or concern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the current and session end height to the logger output:

	currentHeight := sdkCtx.BlockHeight()
	sharedParams := k.sharedKeeper.GetParams(ctx)
	sessionEndHeight := shared.GetSessionEndHeight(&sharedParams, currentHeight)
	logger := k.Logger().
		With("method", "EndBlockerTransferApplication").
		With("current_height", currentHeight).
		With("session_end_height", sessionEndHeight)

}

// Iterate over all applications and transfer the ones that have finished the transfer period.
// TODO_MAINNET: Use an index to iterate over the applications that have initiated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add your name here?

Would love it if you can start looking into indexing on-chain!

Copy link
Contributor Author

@bryanchriswhite bryanchriswhite Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #854.

x/application/keeper/transfer_applications.go Show resolved Hide resolved
x/application/keeper/msg_server_transfer_application.go Outdated Show resolved Hide resolved

// MergeAppServiceConfigs takes the union of the srcApp and dstApp's service configs
// and sets the result in dstApp. It is exported for testing purposes.
func MergeAppServiceConfigs(srcApp, dstApp *types.Application) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a followup PR that updates the docs on this?

Would love a simple excalidraw/mermaid diagram for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will include it in #790. 👍

x/application/keeper/transfer_applications.go Outdated Show resolved Hide resolved
Copy link
Contributor

@red-0ne red-0ne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🥳

@bryanchriswhite bryanchriswhite merged commit 600ba59 into main Oct 4, 2024
13 checks passed
@bryanchriswhite bryanchriswhite deleted the issues/657/chore/app-transfer-period branch October 4, 2024 09:20
bryanchriswhite added a commit that referenced this pull request Oct 4, 2024
…ake-gateway

* pokt/main:
  [Application] chore: implement app transfer period (#789)
bryanchriswhite added a commit that referenced this pull request Oct 4, 2024
…e-param

* issues/612/gateway/logic:
  [Application] chore: implement app transfer period (#789)
  chore: review feedback improvements
  chore: improve logging & ensure gRPC status error returns
  chore: add godoc style comment to min_stake params field
  chore: apply improvements
  Empty commit
  Empty commit
bryanchriswhite added a commit that referenced this pull request Oct 4, 2024
…ation/min-stake-param

* issues/612/app/msg-update-param:
  [Application] chore: implement app transfer period (#789)
  chore: review feedback improvements
  chore: improve logging & ensure gRPC status error returns
  chore: add godoc style comment to min_stake params field
  chore: apply improvements
  Empty commit
  Empty commit

# Conflicts:
#	api/poktroll/application/tx.pulsar.go
#	x/application/types/errors.go
#	x/application/types/tx.pb.go
bryanchriswhite added a commit that referenced this pull request Oct 4, 2024
…/application/staking

* issues/612/application/min-stake-param:
  [Application] chore: implement app transfer period (#789)
  chore: review feedback improvements
  chore: improve logging & ensure gRPC status error returns
  chore: improve logging & ensure gRPC status error returns
  chore: improvements:
  chore: add godoc style comment to min_stake params field
  chore: add godoc style comment to min_stake params field
  chore: apply improvements
  Empty commit
  Empty commit

# Conflicts:
#	x/application/keeper/msg_server_transfer_application_stake_test.go
bryanchriswhite added a commit that referenced this pull request Oct 4, 2024
…tion/burning

* issues/612/application/staking:
  test: simplify coin equality assertions
  [Application] chore: implement app transfer period (#789)
  chore: review feedback improvements
  chore: improve logging & ensure gRPC status error returns
  chore: improve logging & ensure gRPC status error returns
  chore: improvements:
  chore: add godoc style comment to min_stake params field
  chore: add godoc style comment to min_stake params field
  chore: apply improvements
  Empty commit
  Empty commit

# Conflicts:
#	x/application/keeper/unbond_applications.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application Changes related to the Application actor devnet devnet-test-e2e on-chain On-chain business logic push-image CI related - pushes images to ghcr.io
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[Utility][Morse Parity] Staked App Transfer
4 participants