Skip to content
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

refactor: incorporate code review changes #22

Merged
merged 22 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8c7b246
feat(`2.2.25`): emit event when updating module params
johnletey Mar 20, 2023
25cfa95
chore(`2.2.24`): only import `x/team` keeper once
johnletey Mar 20, 2023
199a36b
fix(`2.2.11`): validate msg inputs
johnletey Mar 20, 2023
9b77d64
fix(`2.2.19`): inefficient check order
mbreithecker Mar 23, 2023
6402d4e
chore(`2.2.23`): avoid implicit memory aliasing
mbreithecker Mar 23, 2023
2d9714e
chore: sync main
johnletey Mar 23, 2023
f09b544
refactor: switch relevant values to `sdk.Dec` (#19)
johnletey Mar 27, 2023
0745e73
fix(`2.2.7`): improve commission when creating staker (#25)
mbreithecker Mar 27, 2023
5aaf937
Merge branch 'main' into john/review
johnletey Mar 27, 2023
50a65d9
fix(`2.2.14`): improve error message
johnletey Mar 27, 2023
1b996c3
Merge remote-tracking branch 'origin/john/review' into john/review
mbreithecker Mar 27, 2023
9e20764
fix(`2.2.20`): typographical errors
mbreithecker Mar 27, 2023
75508a3
fix(`2.2.21`): remove unused function
mbreithecker Mar 27, 2023
f40a82e
fix(`2.2.13`): incorrect function descriptions in comments
mbreithecker Mar 29, 2023
e11e8b2
chore(`2.2.11`): switch to validation helpers
johnletey Mar 29, 2023
3a80f5f
fix(`2.2.1`): use non-manipulable pseudo-random source seed
mbreithecker Mar 29, 2023
5ec247b
chore(`2.2.16`): validate pool parameters better
johnletey Mar 29, 2023
b7777a7
chore(`2.2.16`): validate update msg and add more tests
mbreithecker Mar 29, 2023
52981ae
chore(`2.2.17`): ensure UploadTimeout and MaxPoints are positive numbers
mbreithecker Mar 30, 2023
722e253
chore: update spec files
mbreithecker Mar 31, 2023
8ecd1ed
chore: update Changelog
mbreithecker Mar 31, 2023
2c6a813
chore: improve changelog
johnletey Mar 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@

- (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Bump Cosmos SDK to [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) ([`v0.46.11-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.46.11-kyve-rc0)).
- (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Switch to CometBFT from Informal Systems' Tendermint fork.
- [#22](https://github.com/KYVENetwork/chain/pull/22) Emit an event when updating module parameters.
- [#22](https://github.com/KYVENetwork/chain/pull/22) Various minor code improvements, cleanups, and validations.

### Bug Fixes

- [#20](https://github.com/KYVENetwork/chain/pull/20) Adjust investor vesting schedules from second funding round.

### State Machine Breaking

- (`x/bundles`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `NetworkFee` param to type `sdk.Dec`.
- (`x/delegation`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `VoteSlash`, `UploadSlash`, `TimeoutSlash` params to type `sdk.Dec`.
- (`x/stakers`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `Commission` to type `sdk.Dec`.
- (`x/bundles`) [#22](https://github.com/KYVENetwork/chain/pull/22) use non-manipulable pseudo-random source seed for uploader selection.


## [v1.0.0](https://github.com/KYVENetwork/chain/releases/tag/v1.0.0) - 2023-03-10

Release for the KYVE network launch.
Expand Down
1 change: 0 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ func NewKYVEApp(
app.PoolKeeper,
app.StakersKeeper,
app.DelegationKeeper,
app.UpgradeKeeper,
)

// Create IBC Keepers
Expand Down
13 changes: 13 additions & 0 deletions proto/kyve/bundles/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@ syntax = "proto3";

package kyve.bundles.v1beta1;

import "gogoproto/gogo.proto";
import "kyve/bundles/v1beta1/bundles.proto";
import "kyve/bundles/v1beta1/params.proto";
import "kyve/bundles/v1beta1/tx.proto";

option go_package = "github.com/KYVENetwork/chain/x/bundles/types";

// EventUpdateParams is an event emitted when the module parameters are updated.
// emitted_by: MsgUpdateParams
message EventUpdateParams {
// old_params is the module's old parameters.
kyve.bundles.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false];
// new_params is the module's new parameters.
kyve.bundles.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false];
// payload is the parameter updates that were performed.
string payload = 3;
}

// EventBundleVote is an event emitted when a protocol node votes on a bundle.
// emitted_by: MsgVoteBundleProposal
message EventBundleVote {
Expand Down
5 changes: 4 additions & 1 deletion proto/kyve/bundles/v1beta1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ message Params {
(gogoproto.nullable) = false
];
// network_fee ...
string network_fee = 3;
string network_fee = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// max_points ...
uint64 max_points = 4;
}
13 changes: 13 additions & 0 deletions proto/kyve/delegation/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@ syntax = "proto3";

package kyve.delegation.v1beta1;

import "gogoproto/gogo.proto";
import "kyve/delegation/v1beta1/delegation.proto";
import "kyve/delegation/v1beta1/params.proto";

option go_package = "github.com/KYVENetwork/chain/x/delegation/types";

// EventUpdateParams is an event emitted when the module parameters are updated.
// emitted_by: MsgUpdateParams
message EventUpdateParams {
// old_params is the module's old parameters.
kyve.delegation.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false];
// new_params is the module's new parameters.
kyve.delegation.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false];
// payload is the parameter updates that were performed.
string payload = 3;
}

// ---------- Delegating Events ----------

// EventDelegate is an event emitted when someone delegates to a protocol node.
Expand Down
17 changes: 14 additions & 3 deletions proto/kyve/delegation/v1beta1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package kyve.delegation.v1beta1;

import "gogoproto/gogo.proto";

option go_package = "github.com/KYVENetwork/chain/x/delegation/types";

// Params defines the delegation module parameters.
Expand All @@ -13,9 +15,18 @@ message Params {
// unbonding_delegation_time ...
uint64 redelegation_max_amount = 3;
// vote_slash ...
string vote_slash = 4;
string vote_slash = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// upload_slash ...
string upload_slash = 5;
string upload_slash = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// timeout_slash ...
string timeout_slash = 6;
string timeout_slash = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
19 changes: 19 additions & 0 deletions proto/kyve/global/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

package kyve.global.v1beta1;

import "gogoproto/gogo.proto";
import "kyve/global/v1beta1/global.proto";

option go_package = "github.com/KYVENetwork/chain/x/global/types";

// EventUpdateParams is an event emitted when the module parameters are updated.
// emitted_by: MsgUpdateParams
message EventUpdateParams {
// old_params is the module's old parameters.
kyve.global.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false];
// new_params is the module's new parameters.
kyve.global.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false];
// payload is the parameter updates that were performed.
string payload = 3;
}
11 changes: 9 additions & 2 deletions proto/kyve/query/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package kyve.query.v1beta1;

import "gogoproto/gogo.proto";
import "kyve/pool/v1beta1/pool.proto";

option go_package = "github.com/KYVENetwork/chain/x/query/types";
Expand Down Expand Up @@ -94,7 +95,10 @@ message StakerMetadata {
// commission is the percentage of the rewards that will
// get transferred to the staker before the remaining
// rewards are split across all delegators
string commission = 1;
string commission = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// moniker is a human-readable name for displaying
// the staker in the UI
Expand All @@ -119,7 +123,10 @@ message StakerMetadata {
message CommissionChangeEntry {
// commission is the new commission that will
// become active once the change-time is over
string commission = 1;
string commission = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// creation_date is the UNIX-timestamp (in seconds)
// of when the entry was created.
Expand Down
19 changes: 18 additions & 1 deletion proto/kyve/stakers/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@ syntax = "proto3";

package kyve.stakers.v1beta1;

import "gogoproto/gogo.proto";
import "kyve/stakers/v1beta1/params.proto";

option go_package = "github.com/KYVENetwork/chain/x/stakers/types";

// EventUpdateParams is an event emitted when the module parameters are updated.
// emitted_by: MsgUpdateParams
message EventUpdateParams {
// old_params is the module's old parameters.
kyve.stakers.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false];
// new_params is the module's new parameters.
kyve.stakers.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false];
// payload is the parameter updates that were performed.
string payload = 3;
}

// EventCreateStaker is an event emitted when a protocol node stakes in a pool.
// emitted_by: MsgCreateStaker
message EventCreateStaker {
Expand Down Expand Up @@ -32,7 +46,10 @@ message EventUpdateCommission {
// staker is the account address of the protocol node.
string staker = 1;
// commission ...
string commission = 2;
string commission = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// EventJoinPool ...
Expand Down
12 changes: 10 additions & 2 deletions proto/kyve/stakers/v1beta1/stakers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package kyve.stakers.v1beta1;

import "gogoproto/gogo.proto";

option go_package = "github.com/KYVENetwork/chain/x/stakers/types";

// Staker contains all metadata for a staker
Expand All @@ -10,7 +12,10 @@ message Staker {
// address ...
string address = 1;
// commission ...
string commission = 2;
string commission = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// moniker ...
string moniker = 3;
// website ...
Expand Down Expand Up @@ -50,7 +55,10 @@ message CommissionChangeEntry {
string staker = 2;
// commission is the new commission which will
// be applied after the waiting time is over.
string commission = 3;
string commission = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// creation_date is the UNIX-timestamp in seconds
// when the entry was created.
int64 creation_date = 4;
Expand Down
18 changes: 14 additions & 4 deletions proto/kyve/stakers/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package kyve.stakers.v1beta1;

import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/KYVENetwork/chain/x/stakers/types";

Expand All @@ -24,12 +25,18 @@ service Msg {
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgStakePool defines a SDK message for staking in a pool.
// MsgCreateStaker defines a SDK message for creating a staker.
message MsgCreateStaker {
// creator ...
// creator is the address of the staker.
string creator = 1;
// amount ...
// amount is the initial self-stake of the staker.
uint64 amount = 2;
// commission is the percentage that is deducted from rewards before
// distributing the staker's delegators.
string commission = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// MsgStakePoolResponse defines the Msg/StakePool response type.
Expand All @@ -55,7 +62,10 @@ message MsgUpdateCommission {
// creator ...
string creator = 1;
// commission ...
string commission = 2;
string commission = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// MsgUpdateCommissionResponse ...
Expand Down
7 changes: 7 additions & 0 deletions testutil/integration/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ func (suite *KeeperTestSuite) RunTx(msg sdk.Msg) (*sdk.Result, error) {
return res, nil
}

func (suite *KeeperTestSuite) RunTxError(msg sdk.Msg) error {
_, err := suite.RunTx(msg)
Expect(err).To(HaveOccurred())

return err
}

func (suite *KeeperTestSuite) RunTxSuccess(msg sdk.Msg) *sdk.Result {
result, err := suite.RunTx(msg)
Expect(err).NotTo(HaveOccurred())
Expand Down
Loading