Skip to content

PSE Proposals message hanlders#31

Merged
TxCorpi0x merged 8 commits into
masterfrom
mehdi/pse-gov-proposals
Nov 25, 2025
Merged

PSE Proposals message hanlders#31
TxCorpi0x merged 8 commits into
masterfrom
mehdi/pse-gov-proposals

Conversation

@TxCorpi0x

@TxCorpi0x TxCorpi0x commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Description

This pull request introduces new governance operations and query endpoints for managing and retrieving allocation schedules and clearing account mappings in the PSE module. It adds new gRPC query and message types, updates the keeper logic to support schedule replacement, and improves test clarity and error handling. The most important changes are grouped below.

Governance Operations and Query API Enhancements:

  • Added new gRPC query endpoint and types for retrieving all future allocation schedules (QueryAllocationScheduleRequest/QueryAllocationScheduleResponse), with corresponding documentation and proto definitions.
  • Introduced new governance message types and endpoints to update the allocation schedule (MsgUpdateAllocationSchedule) and clearing account mappings (MsgUpdateClearingAccountMappings), including full documentation and proto definitions.

Keeper Logic Improvements:

  • Implemented UpdateAllocationSchedule in the keeper to allow governance to replace the entire distribution schedule, with authority checks and validation.
  • Clarified documentation and logic in GetAllocationSchedule to specify that only future schedules are returned after processing.

Testing and Error Handling Updates:

  • Improved error messages in genesis validation tests for missing allocations and mappings, making them more generic and accurate.
  • Updated distribution tests to clarify expected community pool remainders and allocation logic, and improved recipient funding logic.

These changes collectively improve the governance flexibility, transparency, and maintainability of allocation schedules and recipient mappings in the PSE module.

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 review from a team, masihyeganeh, miladz68 and ysv and removed request for a team November 18, 2025 16:26
@TxCorpi0x TxCorpi0x requested a review from a team as a code owner November 18, 2025 16:26

@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 19 of 19 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @masihyeganeh and @miladz68)


a discussion (no related file):
Would be nice to use proper names for proper processes

image.png


x/pse/keeper/distribution.go line 224 at r1 (raw file):

// Returns an empty slice if no allocations are scheduled.
// Note: Past schedules are removed after processing, so this only contains future schedules.
func (k Keeper) GetAllocationSchedule(ctx context.Context) ([]types.ScheduledDistribution, error) {

IMO this should be DistributionSchedule


proto/tx/pse/v1/query.proto line 26 at r1 (raw file):

    option (google.api.http).get = "/tx/pse/v1/score/{address}";
  }
  

nit: pls check all files for whitespaces


proto/tx/pse/v1/query.proto line 67 at r1 (raw file):

// QueryAllocationScheduleResponse defines the response type for querying future allocation schedules.
message QueryAllocationScheduleResponse {

this query returns SheduledDistributions, so better name for it is either
QueryDistributionSchedule or QueryScheduledDistributions.

It is also more consistent with other places


proto/tx/pse/v1/tx.proto line 23 at r1 (raw file):

  
  // UpdateAllocationSchedule is a governance operation to update the distribution schedule.
  rpc UpdateAllocationSchedule(MsgUpdateAllocationSchedule) returns (EmptyResponse);

UpdateDistributionSchedule is more correct IMO

@TxCorpi0x TxCorpi0x force-pushed the mehdi/pse-gov-proposals branch from 35d5dba to 1162161 Compare November 19, 2025 07:11
@TxCorpi0x TxCorpi0x force-pushed the mehdi/pse-gov-proposals branch from 1162161 to 11bb9fe Compare November 19, 2025 07:18

@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: 8 of 19 files reviewed, 5 unresolved discussions (waiting on @masihyeganeh, @miladz68, and @ysv)


proto/tx/pse/v1/tx.proto line 23 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

UpdateDistributionSchedule is more correct IMO

The method updates allocations (not paid yet). that is why it is named as AllocationSchedule, in fact it is not distributed yet.

btw, the query PR is the other one. i removed unnecessary queries from this PR


x/pse/keeper/distribution.go line 224 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

IMO this should be DistributionSchedule

Same here, this returns the allocations which is not distributed yet.

btw, the query PR is the other one. i removed unnecessary queries from this PR


proto/tx/pse/v1/query.proto line 26 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

nit: pls check all files for whitespaces

May i define a new task for it to check the nits and fix them all together after the main PRs went through. i see more whitespaces which is not related to this PR concept


proto/tx/pse/v1/query.proto line 67 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

this query returns SheduledDistributions, so better name for it is either
QueryDistributionSchedule or QueryScheduledDistributions.

It is also more consistent with other places

I will address it in the related PR (other open)

@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 17 of 19 files at r1.
Reviewable status: 8 of 19 files reviewed, 7 unresolved discussions (waiting on @masihyeganeh, @TxCorpi0x, and @ysv)


proto/tx/pse/v1/tx.proto line 23 at r1 (raw file):

Previously, TxCorpi0x wrote…

The method updates allocations (not paid yet). that is why it is named as AllocationSchedule, in fact it is not distributed yet.

btw, the query PR is the other one. i removed unnecessary queries from this PR

I agree with yaroslav, this method should be called UpdateDistributionSchedule.


x/pse/types/genesis.go line 27 at r1 (raw file):

	}

	// Note: No need for ValidateScheduleMappingConsistency since:

the comment seems redundant. feel free to remove it.


x/pse/keeper/params.go line 72 at r1 (raw file):

// Note: All validation is performed in MsgUpdateClearingAccountMappings.ValidateBasic()
// before the proposal is stored. This keeper method only handles authority check and state updates.
func (k Keeper) UpdateClearingMappings(

UpdateClearingAccountMappings

@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: 0 of 21 files reviewed, 7 unresolved discussions (waiting on @masihyeganeh, @miladz68, and @ysv)


proto/tx/pse/v1/tx.proto line 23 at r1 (raw file):

Previously, miladz68 (milad) wrote…

I agree with yaroslav, this method should be called UpdateDistributionSchedule.

Done


x/pse/keeper/distribution.go line 224 at r1 (raw file):

Previously, TxCorpi0x wrote…

Same here, this returns the allocations which is not distributed yet.

btw, the query PR is the other one. i removed unnecessary queries from this PR

Done


x/pse/keeper/params.go line 72 at r1 (raw file):

Previously, miladz68 (milad) wrote…

UpdateClearingAccountMappings

Done


x/pse/types/genesis.go line 27 at r1 (raw file):

Previously, miladz68 (milad) wrote…

the comment seems redundant. feel free to remove it.

Done

miladz68
miladz68 previously approved these changes Nov 19, 2025

@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 6 of 11 files at r2, 11 of 14 files at r3, 5 of 5 files at r4, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @masihyeganeh, @TxCorpi0x, and @ysv)

ysv
ysv previously approved these changes Nov 19, 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 6 of 11 files at r2, 11 of 14 files at r3, 5 of 5 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)

@TxCorpi0x TxCorpi0x dismissed stale reviews from miladz68 and ysv via ee7c586 November 20, 2025 08:09
miladz68
miladz68 previously approved these changes Nov 21, 2025

@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 4 of 4 files at r5, 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 3 of 4 files at r5, 5 of 5 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)

@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 5 of 5 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)

@TxCorpi0x TxCorpi0x merged commit 6ec6c7e into master Nov 25, 2025
18 of 23 checks passed
@ysv ysv deleted the mehdi/pse-gov-proposals 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