-
Notifications
You must be signed in to change notification settings - Fork 108
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
[v0.11 feature] Built-in Reward Share #1581
Conversation
This pull request has been mentioned on Pocket Network Forum. There might be relevant details there: https://forum.pokt.network/t/unleashing-the-potential-of-pocket/4720/1 |
This pull request has been mentioned on Pocket Network Forum. There might be relevant details there: https://forum.pokt.network/t/unleashing-the-potential-of-non-custodial-node-running/4796/1 |
@msmania Please note that I updated the base to |
f6371ad
to
67d95a2
Compare
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.
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.
2446c1c
to
56e09be
Compare
900363f
to
36062dd
Compare
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 coming patch #1581 uses Go Generics that is available since Go 1.18. Since .github/workflows/Dockerfile pulls a container with Go 1.17, that patch breaks CI workflow. This patch upgrades Go version in all CI workflows to the latest version 1.21.
36062dd
to
3031344
Compare
Tests to verify compatibility will come with a subsequent patch.
The existing `nodes stake` command is not very user-friendly for the following reasons: - Need to specify a subcommand custodial or non-custodial - Need to specify `isBefore8.0` parameter - Unclear about which wallet signs a message It's time to introduce a new stake command that is aligned with the latest node structure.
3031344
to
15e2488
Compare
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.
@msmania I took another look and I think this is as good of a review as I can do too (reaching PR exhaustion).
I added one small NIT, one #PUC request, but otherwise the only blocker is to get the CI green after we merge the other PR.
15e2488
to
c7b8fd8
Compare
The coming patch #1581 uses Go Generics that is available since Go 1.18. Since .github/workflows/Dockerfile pulls a container with Go 1.17, that patch breaks CI workflow. This patch upgrades Go version in all CI workflows to the latest version 1.21. ## Description <!-- reviewpad:summarize:start --> ### Summary generated by Reviewpad on 21 Dec 23 08:47 UTC This pull request upgrades the Go version in all CI workflows to version 1.21. The current version 1.18 is causing issues with the coming patch that uses Go Generics available since Go 1.18. The upgrade is done in the .circleci/config.yml file for the build, test, and trigger-pocket-core-deployments-branches sections. It is also done in the .github/workflows/Dockerfile file. Additionally, the go.mod and README.md files are updated to reflect the new Go version. The patch includes a total of 13 insertions and 10 deletions across 6 files. <!-- reviewpad:summarize:end -->
Comparing the test results of #1589 to the results of #1587, the following tests failed in both of the test runs.
The difference is TestRPC_QueryUnconfirmedTxs, which I think is flaky and can be ignored as it failed on #1582 too as mentioned here. So I think this is good to be merged. What do you think, @Olshansk? |
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.
@msmania Going to approve this since we've iterated quite a bit and it's the last day before the holidays.
However, three requests:
- Please make sure to get a 🟢 in RewardShare for CI stabilization #1589
- Please use
squash and merge
and merging into main. - Please
git merge
instead ofgit rebase
in future PRs. It makes it MUCH easier for the reviewer to leverage the "changes since last review" feature.
This patch fixes the following tests: - TestValidators_String - TestDefaultParams/Default_Test - TestValidateGenesis/Test_ValidateGenesis_8 This test expected a failure in validation because `GetParams` returned 50 for `MinSignedPerWindow`, but that bug was fixed. The expected result is a success now. and disabled `TestRPC_QueryUnconfirmedTxs` that was flaky. It passed on a local environment, but sometimes failed on GitHub CI.
8591f71
to
bc86da9
Compare
#1589 got a green light. |
@Olshansk Looks like a force-push revoked your approval. Can you sign off again? |
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.
@msmania Left one small nit / comment, so please tend to that before merging.
Note: No matter how many times I review this, I'm still a bit worried (i.e. chain halt) given the size and scope of the change, so let's make sure to do our due diligence in testing once we're in TestNet.
--- Regarding Git Flow ---
Bullet points with extra context below.
- I left a comment related to this in one of the PRs a couple weeks ago with a bit more details [1]
- For some extra "cred", even Mitchell Hashimoto understood the value of using this GitHub workflow
- We documented this in the
pocket
repo but not thepocket-core
one unfortunately. I'll make sure we transfer it into thepoktroll
repo - I want to emphasize that this is not a
how Pocket does thing
but aHow GitHub expects users to use Git
. A friend of mine is a PM there and I've brought this up a few times.
[1] #1581 (review)
[2] https://x.com/olshansky/status/1708314683738820998?s=20
[3] https://github.com/pokt-network/pocket/blob/main/docs/development/CODE_REVIEW_GUIDELINES.md
app/cmd/rpc/rpc_test.go
Outdated
cleanup() | ||
stopCli() | ||
} | ||
// Disabling the test because this is flaky. |
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.
Uncomment this and use t.skip("TODO: Figure out why this test is flaky")
instead.
## Description This is a fix for a regression introduced by #1581. When a node stores a validator with the new `RewardDelegators` field, its marshaled product is not deterministic because the order of map iteration is not deterministic. As a result, the merkle tree of application.db can differ between nodes, leading to consensus failure. The proposed fix is to sort the keys of `RewardDelegators` by using the stable marshaler. <!-- reviewpad:summarize:start --> ### Summary generated by Reviewpad on 15 Jan 24 18:21 UTC This pull request includes changes to the `nodes.proto` file and a file diff. The changes in the `nodes.proto` file include: - Added an option `stable_marshaler` with a value of `true`. This option is used to make the order of `RewardDelegators` deterministic. - Updated the `Address` field to include additional options `(gogoproto.casttype)`, `(gogoproto.moretags)`, and `(gogoproto.jsontag)`. - Updated the `PublicKey` field to include additional options `(gogoproto.moretags)` and `(gogoproto.jsontag)`. - Updated the `jailed` field to include an additional option `(gogoproto.jsontag)`. The file diff includes the following changes: - Imported the "encoding/hex", "math/rand", "reflect", "strconv", and "time" packages. - Added a test case for marshalling RewardDelegators. - Added the "Test_Marshal_RewardDelegators" function. - Created variables and constants within the test function. - Generated random numbers to be used as reward delegator addresses. - Created and initialized a map, "delegatorMap", with random numbers as keys and their corresponding modulo 10 values as values. - Created a "Validator" struct with various fields and assigned values to them. - Marshaled the validator struct and ensured that the resulting hash is the same for every iteration of the test. Please let me know if there is anything specific you would like me to focus on. <!-- 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 |
This patch implements a new feature Reward Delegators ([PIP-32](https://forum.pokt.network/t/pip32-unleashing-the-potential-of-non-custodial-node-running/4796); introduced by pokt-network/pocket-core#1581).
Description
This patch implements the Built-in Reward Share feature which lets the network itself to distribute the relay/block rewards into multiple addresses. The change consists of the following parts.
RewardDelegators
inValidator
RewardDelegators
inMsgStake
pocket nodes stakeNew
prevent_negative_reward_claim
not to claim a potential loss evidence.This change is consensus-breaking. The new behavior is put behind a new feature key
RewardDelegator
. The new field is kept unavailable until activation.The new structure of
Validator
orMsgStake
is backward/forward compatible, meaning the new binary can still unmarshal data marshaled by an older binary, and vice versa. In other words, the network beforeRewardDelegator
activation accepts anMsgStake
transaction, ignoring theRewardDelegators
field. And the newValidator
structure can handle all historical states from genesis. Therefore this patch does not introduce a structure like10.0Validaor
as the NCUST patch did before.Summary generated by Reviewpad on 26 Dec 23 01:21 UTC
This pull request includes changes to multiple files. Here is a summary of the diff:
The file
common_test.go
was modified to replace the import ofmath/rand
withcrypto/rand
. Additionally, the comment// : deadcode unused
was removed.The file
x/nodes/keeper/abci_test.go
was modified to add and remove import statements, as well as comment out unnecessary code related to state conversion.The file
x/nodes/types/validator.go
was modified to add an import, add a new field to theValidator
struct, add a new function to create a validator from a message, modify several methods to include a new field in the output, and add a new struct and comment.The file
x/nodes/types/validator_test.go
was modified to add import statements and a new test function.The file
msg_test.go
was modified to add and remove import statements, add new test functions, and update existing test functions.The file
keeper_test.go
was modified to add import statements, modify existing test functions, and add new test functions.The file
go.mod
was modified to add and update package requirements.The file
handler.go
was modified to add import statements and modify function implementations.The file
nodes.proto
was modified to remove an import statement and add a new field to a message.The file
msg.go
was modified to add import statements, add a new struct and function, and modify existing methods.The file
genesis_test.go
was modified to add import statements and modify existing test functions.The file
rpc_test.go
was modified to add and remove import statements, modify function implementations, and add test cases.The file
expectedKeepers.go
was modified to remove comments and add a new method.The file
config.go
was modified to add a new field to a struct.The file
msg.proto
was modified to add a new field to a message.The file
LegacyValidator.go
was modified to add a new method and update existing methods.The file
errors.go
was modified to add new error codes and functions to handle them.The file
reward_test.go
was modified to add import statements, add and update test functions.The file
util_test.go
was modified to rearrange import statements and add new test functions.Please review these changes and provide any necessary feedback. Let me know if you need more information or if there's anything else I can assist you with.