-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v0.11 feature] Built-in Reward Share (#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. - Add `RewardDelegators` in `Validator` - Add `RewardDelegators` in `MsgStake` - Add a new command `pocket nodes stakeNew` - Distributes the fee of claim/proof transaction to a node's operator address - Add a new config `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` or `MsgStake` 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 before `RewardDelegator` activation accepts an `MsgStake` transaction, ignoring the `RewardDelegators` field. And the new `Validator` structure can handle all historical states from genesis. Therefore this patch does not introduce a structure like `10.0Validaor` as the NCUST patch did before. <!-- reviewpad:summarize:start --> ### 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: 1. The file `common_test.go` was modified to replace the import of `math/rand` with `crypto/rand`. Additionally, the comment `// : deadcode unused` was removed. 2. 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. 3. The file `x/nodes/types/validator.go` was modified to add an import, add a new field to the `Validator` 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. 4. The file `x/nodes/types/validator_test.go` was modified to add import statements and a new test function. 5. The file `msg_test.go` was modified to add and remove import statements, add new test functions, and update existing test functions. 6. The file `keeper_test.go` was modified to add import statements, modify existing test functions, and add new test functions. 7. The file `go.mod` was modified to add and update package requirements. 8. The file `handler.go` was modified to add import statements and modify function implementations. 9. The file `nodes.proto` was modified to remove an import statement and add a new field to a message. 10. The file `msg.go` was modified to add import statements, add a new struct and function, and modify existing methods. 11. The file `genesis_test.go` was modified to add import statements and modify existing test functions. 12. The file `rpc_test.go` was modified to add and remove import statements, modify function implementations, and add test cases. 13. The file `expectedKeepers.go` was modified to remove comments and add a new method. 14. The file `config.go` was modified to add a new field to a struct. 15. The file `msg.proto` was modified to add a new field to a message. 16. The file `LegacyValidator.go` was modified to add a new method and update existing methods. 17. The file `errors.go` was modified to add new error codes and functions to handle them. 18. The file `reward_test.go` was modified to add import statements, add and update test functions. 19. 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. <!-- reviewpad:summarize:end --> --------- Co-authored-by: tokikuch <[email protected]>
- Loading branch information
1 parent
02149b9
commit 58217f2
Showing
37 changed files
with
1,884 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.