-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: add in distribution to x/protocolpool
#23972
base: exp/distr-options
Are you sure you want to change the base?
Conversation
@aljo242 your pull request is missing a changelog! |
ModuleName: authtypes.ModuleName, | ||
KvStoreKey: "acc", | ||
}, | ||
ModuleConfig = []*appv1alpha1.ModuleConfig{ |
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.
factored this out so that we can do some modifications to it in the network tests
network *network.Network | ||
} | ||
|
||
func NewGRPCQueryTestSuite(protocolPoolEnabled bool) *GRPCQueryTestSuite { |
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.
we can now create this test suite with the x/protocolpool
enabled or not
@@ -7,6 +7,11 @@ import ( | |||
"net/http" | |||
) | |||
|
|||
type ErrorResponse struct { |
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.
defining a common struct that is returned when your query fails. tests can just decode to this
"github.com/cosmos/cosmos-sdk/x/distribution/types" | ||
) | ||
|
||
const truncationBlockInterval = 1000 |
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.
This is what was defined before (not as a constant). I am not sure why this number was chosen - I'm assuming arbitrary
if err := k.AllocateTokens(ctx, previousTotalPower, ctx.VoteInfos()); err != nil { | ||
return err | ||
} | ||
if err := k.BeginBlocker(ctx); err != nil { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
// ref https://github.com/cosmos/cosmos-sdk/issues/3095 | ||
height := ctx.BlockHeight() | ||
if height > 1 { | ||
if err := k.AllocateTokens(ctx, previousTotalPower, ctx.VoteInfos()); err != nil { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
|
||
// every 1000 blocks send whole coins from community pool to x/protocolpool if enabled | ||
if height%truncationBlockInterval == 0 && k.protocolPoolEnabled { | ||
if err := k.sendCommunityPoolToProtocolPool(ctx); err != nil { |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
|
||
// record the proposer for when we pay out on the next block | ||
consAddr := sdk.ConsAddress(ctx.BlockHeader().ProposerAddress) | ||
return k.SetPreviousProposerConsAddr(ctx, consAddr) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
sendCommunityPoolToProtocolPool
function call in beginblocker every 1000 blocksx/distribution
whenx/protocolpool
is enabled