Skip to content

PSE Query CLI and Integration tests#35

Merged
TxCorpi0x merged 9 commits into
masterfrom
mehdi/pse-query-cli
Dec 2, 2025
Merged

PSE Query CLI and Integration tests#35
TxCorpi0x merged 9 commits into
masterfrom
mehdi/pse-query-cli

Conversation

@TxCorpi0x

@TxCorpi0x TxCorpi0x commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Description

This pull request adds new CLI query commands to the x/pse module and introduces tests to verify their functionality. The main improvements are the ability to query scheduled distributions and clearing account balances, along with comprehensive test coverage for all query commands.

New CLI query commands:

  • Added CmdQueryScheduledDistributions to allow users to query all future scheduled distributions from the CLI.
  • Added CmdQueryClearingAccountBalances to enable querying the current balances of all PSE clearing accounts from the CLI.

Test coverage:

  • Introduced x/pse/client/cli/query_test.go with unit tests for all query commands, including the new scheduled distributions and clearing account balances queries. These tests verify correct responses and ensure all expected clearing accounts are returned.

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@TxCorpi0x TxCorpi0x requested a review from a team as a code owner November 24, 2025 18:54
@TxCorpi0x TxCorpi0x requested review from masihyeganeh, miladz68 and ysv and removed request for a team November 24, 2025 18:54

@ysv ysv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ysv reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @masihyeganeh and @miladz68)


integration-tests/modules/pse_test.go line 91 at r1 (raw file):

	// Score should be non-negative
	requireT.False(finalResp.Score.IsNegative(), "score should not be negative")

what about 0 ?
zero is not negative so it might be successful here


integration-tests/modules/pse_test.go line 291 at r1 (raw file):

	// Score should still be non-negative and should have increased
	requireT.False(scoreAfterUndelegate.Score.IsNegative(), "score should not be negative")
	requireT.True(scoreAfterUndelegate.Score.GT(scoreAfterDelegate.Score), "score should increase after more blocks")

I think we should also verify that after undelegation it stops increasing


integration-tests/modules/pse_test.go line 342 at r1 (raw file):

		// Score should be non-negative
		requireT.False(scoreResp.Score.IsNegative(), "validator score should not be negative")

do we really have score for validators ? is it correct ?


integration-tests/modules/pse_test.go line 375 at r1 (raw file):

		// Verify account name is valid
		requireT.Contains(allAccounts, balance.ClearingAccount, "clearing account should be valid")

nit: maybe we should also verify that clearingAcc balance is > 0
Or it is not true on znet ?


integration-tests/modules/pse_test.go line 390 at r1 (raw file):

// TestPSEQueryScheduledDistributions tests the ScheduledDistributions query endpoint.
func TestPSEQueryScheduledDistributions(t *testing.T) {

do we have ScheduledDistributions on znet ?
if no distributions exist should we even test this ?
@miladz68 WDYT ?

@TxCorpi0x TxCorpi0x left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @masihyeganeh, @miladz68, and @ysv)


integration-tests/modules/pse_test.go line 91 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

what about 0 ?
zero is not negative so it might be successful here

Done


integration-tests/modules/pse_test.go line 291 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I think we should also verify that after undelegation it stops increasing

Done


integration-tests/modules/pse_test.go line 342 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

do we really have score for validators ? is it correct ?

The names were inconsistent, i replaced it with alternative test that covers no delegations, the intent in this test was to track self delegation which is not needed anymore


integration-tests/modules/pse_test.go line 375 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

nit: maybe we should also verify that clearingAcc balance is > 0
Or it is not true on znet ?

Clearing accounts have balances (with the other merged PR for znet mint). Modified for clarity


integration-tests/modules/pse_test.go line 390 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

do we have ScheduledDistributions on znet ?
if no distributions exist should we even test this ?
@miladz68 WDYT ?

The test removed

ysv
ysv previously approved these changes Nov 26, 2025

@ysv ysv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ysv reviewed 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh and @miladz68)

@miladz68 miladz68 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@miladz68 reviewed 2 of 3 files at r1, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @masihyeganeh)


integration-tests/modules/pse_test.go line 390 at r1 (raw file):

Previously, TxCorpi0x wrote…

The test removed

@TxCorpi0x is the test removed now ?


x/pse/client/cli/query_test.go line 42 at r3 (raw file):

}

func TestQueryScore_WithValidatorAddress(t *testing.T) {

how is this test different than TestQueryScore_NoScore

@TxCorpi0x TxCorpi0x left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @masihyeganeh, @miladz68, and @ysv)


integration-tests/modules/pse_test.go line 390 at r1 (raw file):

Previously, miladz68 (milad) wrote…

@TxCorpi0x is the test removed now ?

There was conflicts in local branch after multiple merges to master, fixed and removed the test


x/pse/client/cli/query_test.go line 42 at r3 (raw file):

Previously, miladz68 (milad) wrote…

how is this test different than TestQueryScore_NoScore

There was conflicts in local branch after multiple merges to master, fixed and removed the test

@miladz68 miladz68 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@miladz68 reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)

@ysv ysv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ysv reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)

@TxCorpi0x TxCorpi0x merged commit 02672a2 into master Dec 2, 2025
9 checks passed
TxCorpi0x added a commit that referenced this pull request Dec 2, 2025
* ClI Query for clearing accounts and schedule

* PSE queries integration tests

* Merge branch 'master' into mehdi/pse-query-cli

* Merge branch 'master' into mehdi/pse-query-cli

* Resolve comments

* Lint fix

* Merge branch 'master' into mehdi/pse-query-cli

* Fix conflicts

* Merge branch 'master' into mehdi/pse-query-cli
TxCorpi0x added a commit that referenced this pull request Dec 2, 2025
* PSE upgrade integration test

* Change start time to 12:00 GMT on 28th of month

* Rename period to month in PSE init

* Fix first day in upgrade test

* fix a comment

* changed the wait logic

* fix linter

* Merge branch 'master' into milad/add-wait-pse-upgrade-test

* Fix lint issues

* PSE Query CLI and Integration tests (#35)

* ClI Query for clearing accounts and schedule

* PSE queries integration tests

* Merge branch 'master' into mehdi/pse-query-cli

* Merge branch 'master' into mehdi/pse-query-cli

* Resolve comments

* Lint fix

* Merge branch 'master' into mehdi/pse-query-cli

* Fix conflicts

* Merge branch 'master' into mehdi/pse-query-cli

* Fix tests

* Lint Fix

---------

Co-authored-by: milad <mza1989@gmail.com>
@ysv ysv deleted the mehdi/pse-query-cli branch December 19, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants