Skip to content

Commit

Permalink
chore: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Dec 23, 2024
1 parent 8a76d53 commit f8d0076
Show file tree
Hide file tree
Showing 35 changed files with 402 additions and 402 deletions.
62 changes: 31 additions & 31 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -858,22 +858,22 @@ paths:

the staker will no longer participate in that
pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized
to vote
pool address is the address which is
authorized to vote

and submit bundles. If the server gets
compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
indicates
balance is the pool address account balance
and indicates

whether or not the valaccount needs additional
funds to
Expand Down Expand Up @@ -2053,7 +2053,7 @@ paths:
format: uint64
tags:
- QueryBundles
/kyve/query/v1beta1/can_validate/{pool_id}/{valaddress}:
/kyve/query/v1beta1/can_validate/{pool_id}/{pool_address}:
get:
summary: CanValidate ...
operationId: CanValidate
Expand Down Expand Up @@ -2270,8 +2270,8 @@ paths:
required: true
type: string
format: uint64
- name: valaddress
description: valaddress ...
- name: pool_address
description: pool_address ...
in: path
required: true
type: string
Expand Down Expand Up @@ -4397,22 +4397,22 @@ paths:

the staker will no longer participate in that
pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized
to vote
pool address is the address which is
authorized to vote

and submit bundles. If the server gets
compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
indicates
balance is the pool address account balance
and indicates

whether or not the valaccount needs additional
funds to
Expand Down Expand Up @@ -6992,20 +6992,20 @@ paths:
is_leaving indicates if a user has scheduled a
a PoolLeave entry. After the leave-time is over
the staker will no longer participate in that pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional funds
Expand Down Expand Up @@ -7654,20 +7654,20 @@ paths:
is_leaving indicates if a user has scheduled a
a PoolLeave entry. After the leave-time is over
the staker will no longer participate in that pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional
Expand Down Expand Up @@ -8420,20 +8420,20 @@ paths:
is_leaving indicates if a user has scheduled a
a PoolLeave entry. After the leave-time is over
the staker will no longer participate in that pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional
Expand Down Expand Up @@ -9095,20 +9095,20 @@ paths:
is_leaving indicates if a user has scheduled a
a PoolLeave entry. After the leave-time is over
the staker will no longer participate in that pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional
Expand Down
6 changes: 3 additions & 3 deletions proto/kyve/query/v1beta1/bundles.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ service QueryBundles {

// CanValidate ...
rpc CanValidate(QueryCanValidateRequest) returns (QueryCanValidateResponse) {
option (google.api.http).get = "/kyve/query/v1beta1/can_validate/{pool_id}/{valaddress}";
option (google.api.http).get = "/kyve/query/v1beta1/can_validate/{pool_id}/{pool_address}";
}

// CanPropose ...
Expand Down Expand Up @@ -189,8 +189,8 @@ message QueryCurrentVoteStatusResponse {
message QueryCanValidateRequest {
// pool_id defines the unique ID of the pool.
uint64 pool_id = 1;
// valaddress ...
string valaddress = 2;
// pool_address ...
string pool_address = 2;
}

// QueryCanProposeResponse is the response type for the Query/CanPropose RPC method.
Expand Down
8 changes: 4 additions & 4 deletions proto/kyve/query/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ message PoolMembership {
// the staker will no longer participate in that pool
bool is_leaving = 3;

// Valaddress is the address which is authorized to vote
// pool address is the address which is authorized to vote
// and submit bundles. If the server gets compromised
// the staker can just change the valaddress.
string valaddress = 4;
// the staker can just change the pool address .
string pool_address = 4;

// balance is the valaddress account balance and indicates
// balance is the pool address account balance and indicates
// whether or not the valaccount needs additional funds to
// pay for gas fees
uint64 balance = 5;
Expand Down
6 changes: 3 additions & 3 deletions proto/kyve/stakers/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ message EventJoinPool {
uint64 pool_id = 1;
// staker is the address of the staker
string staker = 2;
// valaddress is the address of the protocol node which
// pool_address is the address of the protocol node which
// votes in favor of the staker
string valaddress = 3;
// amount is the amount of funds transferred to the valaddress
string pool_address = 3;
// amount is the amount of funds transferred to the pool address
uint64 amount = 4;
// commission ...
string commission = 5 [
Expand Down
4 changes: 2 additions & 2 deletions proto/kyve/stakers/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ message MsgJoinPool {
string creator = 1;
// pool_id ...
uint64 pool_id = 2;
// valaddress ...
string valaddress = 3;
// pool_address ...
string pool_address = 3;
// amount ...
uint64 amount = 4;
// commission ...
Expand Down
32 changes: 16 additions & 16 deletions x/bundles/keeper/logic_bundles.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k Keeper) AssertCanVote(ctx sdk.Context, poolId uint64, staker string, vot
}

// Check if sender is a staker in pool
if err := k.stakerKeeper.AssertValaccountAuthorized(ctx, poolId, staker, voter); err != nil {
if err := k.stakerKeeper.AssertPoolAccountAuthorized(ctx, staker, poolId, voter); err != nil {
return err
}

Expand Down Expand Up @@ -99,7 +99,7 @@ func (k Keeper) AssertCanPropose(ctx sdk.Context, poolId uint64, staker string,
}

// Check if sender is a staker in pool
if err := k.stakerKeeper.AssertValaccountAuthorized(ctx, poolId, staker, proposer); err != nil {
if err := k.stakerKeeper.AssertPoolAccountAuthorized(ctx, staker, poolId, proposer); err != nil {
return err
}

Expand Down Expand Up @@ -162,16 +162,16 @@ func (k Keeper) validateSubmitBundleArgs(ctx sdk.Context, bundleProposal *types.

// slashDelegatorsAndRemoveStaker slashes a staker with a certain slashType and all including
// delegators and removes him from the storage pool
func (k Keeper) slashDelegatorsAndRemoveStaker(ctx sdk.Context, poolId uint64, stakerAddress string, slashType stakersTypes.SlashType) {
func (k Keeper) slashDelegatorsAndRemoveStaker(ctx sdk.Context, stakerAddress string, poolId uint64, slashType stakersTypes.SlashType) {
k.stakerKeeper.Slash(ctx, poolId, stakerAddress, slashType)
k.stakerKeeper.LeavePool(ctx, stakerAddress, poolId)
}

// resetPoints resets the points from a valaccount to zero
func (k Keeper) resetPoints(ctx sdk.Context, poolId uint64, stakerAddress string) {
previousPoints := k.stakerKeeper.ResetPoints(ctx, poolId, stakerAddress)
// resetPoints resets the points from a pool account to zero
func (k Keeper) resetPoints(ctx sdk.Context, stakerAddress string, poolId uint64) {
previousPoints := k.stakerKeeper.ResetPoints(ctx, stakerAddress, poolId)

// only reset points if valaccount has at least a point
// only reset points if pool account has at least a point
if previousPoints > 0 {
_ = ctx.EventManager().EmitTypedEvent(&types.EventPointsReset{
PoolId: poolId,
Expand All @@ -180,11 +180,11 @@ func (k Keeper) resetPoints(ctx sdk.Context, poolId uint64, stakerAddress string
}
}

// addPoint increases the points of a valaccount with one and automatically
// addPoint increases the points of a pool account with one and automatically
// slashes and removes the staker once he reaches max points
func (k Keeper) addPoint(ctx sdk.Context, poolId uint64, stakerAddress string) {
func (k Keeper) addPoint(ctx sdk.Context, stakerAddress string, poolId uint64) {
// Add one point to staker in given pool
points := k.stakerKeeper.IncrementPoints(ctx, poolId, stakerAddress)
points := k.stakerKeeper.IncrementPoints(ctx, stakerAddress, poolId)

_ = ctx.EventManager().EmitTypedEvent(&types.EventPointIncreased{
PoolId: poolId,
Expand All @@ -194,8 +194,8 @@ func (k Keeper) addPoint(ctx sdk.Context, poolId uint64, stakerAddress string) {

if points >= k.GetMaxPoints(ctx) {
// slash all delegators with a timeout slash and remove staker from pool.
// points are reset due to the valaccount being deleted while leaving the pool
k.slashDelegatorsAndRemoveStaker(ctx, poolId, stakerAddress, stakersTypes.SLASH_TYPE_TIMEOUT)
// points are reset due to the pool account being deleted while leaving the pool
k.slashDelegatorsAndRemoveStaker(ctx, stakerAddress, poolId, stakersTypes.SLASH_TYPE_TIMEOUT)
}
}

Expand All @@ -221,7 +221,7 @@ func (k Keeper) handleNonVoters(ctx sdk.Context, poolId uint64) {

for _, staker := range k.stakerKeeper.GetAllStakerAddressesOfPool(ctx, poolId) {
if !voters[staker] {
k.addPoint(ctx, poolId, staker)
k.addPoint(ctx, staker, poolId)
}
}
}
Expand Down Expand Up @@ -583,7 +583,7 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle

// slash stakers who voted incorrectly
for _, voter := range bundleProposal.VotersInvalid {
k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, stakersTypes.SLASH_TYPE_VOTE)
k.slashDelegatorsAndRemoveStaker(ctx, voter, poolId, stakersTypes.SLASH_TYPE_VOTE)
}

return types.TallyResult{
Expand All @@ -602,9 +602,9 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle
// slash stakers who voted incorrectly - uploader receives upload slash
for _, voter := range bundleProposal.VotersValid {
if voter == bundleProposal.Uploader {
k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, stakersTypes.SLASH_TYPE_UPLOAD)
k.slashDelegatorsAndRemoveStaker(ctx, voter, poolId, stakersTypes.SLASH_TYPE_UPLOAD)
} else {
k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, stakersTypes.SLASH_TYPE_VOTE)
k.slashDelegatorsAndRemoveStaker(ctx, voter, poolId, stakersTypes.SLASH_TYPE_VOTE)
}
}

Expand Down
6 changes: 3 additions & 3 deletions x/bundles/keeper/logic_end_block_handle_upload_timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ func (k Keeper) HandleUploadTimeout(goCtx context.Context) {
k.SetBundleProposal(ctx, bundleProposal)
}

// Now we increase the points of the valaccount
// Now we increase the points of the pool account
// (if he is still active in the pool)
if _, active := k.stakerKeeper.GetValaccount(ctx, pool.Id, timedoutUploader); active {
k.addPoint(ctx, pool.Id, timedoutUploader)
if _, active := k.stakerKeeper.GetPoolAccount(ctx, timedoutUploader, pool.Id); active {
k.addPoint(ctx, timedoutUploader, pool.Id)
}
}
}
2 changes: 1 addition & 1 deletion x/bundles/keeper/msg_server_claim_uploader_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (k msgServer) ClaimUploaderRole(
return nil, poolErr
}

if err := k.stakerKeeper.AssertValaccountAuthorized(ctx, msg.PoolId, msg.Staker, msg.Creator); err != nil {
if err := k.stakerKeeper.AssertPoolAccountAuthorized(ctx, msg.Staker, msg.PoolId, msg.Creator); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion x/bundles/keeper/msg_server_skip_uploader_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (k msgServer) SkipUploaderRole(goCtx context.Context, msg *types.MsgSkipUpl
bundleProposal, _ := k.GetBundleProposal(ctx, msg.PoolId)

// reset points of uploader as node has proven to be active
k.resetPoints(ctx, msg.PoolId, msg.Staker)
k.resetPoints(ctx, msg.Staker, msg.PoolId)

// If previous bundle was dropped just skip uploader role
// No previous round needs to be evaluated
Expand Down
2 changes: 1 addition & 1 deletion x/bundles/keeper/msg_server_submit_bundle_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (k msgServer) SubmitBundleProposal(goCtx context.Context, msg *types.MsgSub
}

// Reset points of uploader as node has proven to be active.
k.resetPoints(ctx, msg.PoolId, msg.Staker)
k.resetPoints(ctx, msg.Staker, msg.PoolId)

// If previous bundle was dropped just register the new bundle.
// No previous round needs to be evaluated
Expand Down
2 changes: 1 addition & 1 deletion x/bundles/keeper/msg_server_vote_bundle_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (k msgServer) VoteBundleProposal(
k.SetBundleProposal(ctx, bundleProposal)

// reset points as user has now proven to be active
k.resetPoints(ctx, msg.PoolId, msg.Staker)
k.resetPoints(ctx, msg.Staker, msg.PoolId)

// Emit a vote event.
_ = ctx.EventManager().EmitTypedEvent(&types.EventBundleVote{
Expand Down
Loading

0 comments on commit f8d0076

Please sign in to comment.