-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: enforce max chains during new session #1582
Conversation
Thank you @h5law for this first contribution! |
@msmania Could you take a look at this review when you have a chance? |
Can you add some description to explain why we need this? Reviewpad covers what this patch does, but it doesn't cover why part. And if this is to unblock Gandalf, please mention it too. |
Thank you for adding the description. Given that this upgrade is EnforceMaxChains, probably we may want to enforce app's MaxChains too as an opportunistic change? The change would be to add a similar check in |
@h5law - can you link this PR to https://github.com/orgs/pokt-network/projects/143?pane=issue&itemId=38406491 I think you're solving for it. |
This pull request has been mentioned on Pocket Network Forum. There might be relevant details there: https://forum.pokt.network/t/pip-32-fix-maxchains-paramater-fmp/4805/1 |
@msmania I have updated the PR to check the app has not exceeded max chains when validating relays and during claim validation. Is this what you had in mind? |
Yes, the logic is something like that, but you need to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good.
One more ask. Can you exclude files if the change there is only for linting. Upon quick look, I think the following files have no actual logic change.
- app/cmd/rpc/rpc_test.go
- app/tx_test.go
- x/apps/keeper/application.go
- x/nodes/keeper/keeper.go
- x/nodes/keeper/reward.go
- x/nodes/keeper/validator.go
- x/nodes/types/validator.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, what failed is |
In `NewSessionNodes`, the variable `node` can be `nil` if the node is unstaked between `sessionCtx` and `ctx`. In such a case, `node.GetChains()` causes a panic. This patch makes sure we don't call it if the `node` is `nil`. This is a regression from #1582.
In `NewSessionNodes`, the variable `node` can be `nil` if the node is unstaked between `sessionCtx` and `ctx`. In such a case, `node.GetChains()` causes a panic. This patch makes sure we don't call it if the `node` is `nil`. This is a regression from #1582.
In `NewSessionNodes`, the variable `node` can be `nil` if the node is unstaked between `sessionCtx` and `ctx`. In such a case, `node.GetChains()` causes a panic. This patch makes sure we don't call it if the `node` is `nil`. This is a regression from #1582. ## Description <!-- reviewpad:summarize:start --> ### Summary generated by Reviewpad on 21 Dec 23 10:23 UTC This pull request fixes a regression introduced in #1582. The patch ensures that the function `node.GetChains()` is not called if the `node` is `nil`, preventing a panic in the `NewSessionNodes` function. <!-- reviewpad:summarize:end -->
This pull request has been mentioned on Pocket Network Forum. There might be relevant details there: https://forum.pokt.network/t/rc-0-11-1-upgrade-and-hi/5012/1 |
Description
Human Summary
This PR addresses the blocker for the Gandalf proposal. It does not implement any of the changes proposed in this proposal but instead enforces the
MaxChains
parameter which is currently unforced to an extent. It would prevent a node from joining a session if they are staked to more chains than allowed. This enables the future changes to this parameter to be enforceable on-chain by making sure any node joining a session is abiding by this parameter.Fixes #1584
Summary generated by Reviewpad on 06 Dec 23 01:50 UTC
This pull request includes several changes that affect multiple files:
In the "claim.go" file:
In the "run" job:
In the "go.mod" file:
In the "x/pocketcore/types/service.go" file:
In the "codec.go" file:
In the "expectedKeepers.go" file:
In the "error_codes.go" file:
In the "session.go" file:
In the "service_test.go" file:
These changes aim to improve various aspects of the code, such as readability, maintainability, error handling, and usage of newer package versions. Please review these changes thoroughly.