-
Notifications
You must be signed in to change notification settings - Fork 15
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 ConsumeGas for delayed staking #102
Milestone
Comments
Using this test code: func (suite *KeeperTestSuite) TestEstimateGasUsage_Stake() {
for i := 1; i <= 10; i++ {
suite.SetRatioPlan(uint64(i), suite.addrs[4], map[string]string{
denom1: "0.5",
denom2: "0.5",
}, "0.01")
}
addrs := simapp.AddTestAddrs(suite.app, suite.ctx, 10000, sdk.ZeroInt())
for i, addr := range addrs {
err := simapp.FundAccount(suite.app.BankKeeper, suite.ctx, addr, sdk.NewCoins(
sdk.NewInt64Coin(denom1, 100000000), sdk.NewInt64Coin(denom2, 100000000)))
suite.Require().NoError(err)
if i > 0 {
suite.Stake(addr, sdk.NewCoins(sdk.NewInt64Coin(denom1, 100000000), sdk.NewInt64Coin(denom2, 100000000)))
}
}
suite.AdvanceEpoch()
suite.AdvanceEpoch()
for i := 0; i < 3; i++ {
suite.Stake(addrs[0], sdk.NewCoins(sdk.NewInt64Coin(denom1, 10000000), sdk.NewInt64Coin(denom2, 10000000)))
err := suite.keeper.AllocateRewards(suite.ctx)
suite.Require().NoError(err)
suite.ctx = suite.ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
suite.keeper.ProcessQueuedCoins(suite.ctx)
fmt.Println(suite.ctx.GasMeter().GasConsumed())
}
} It seems it takes about 60,000 gases to handle queued staking(with withdrawing rewards) per staking coin denom. |
hallazzang
added a commit
to hallazzang/farming
that referenced
this issue
Oct 15, 2021
See tendermint#102 for details
9 tasks
dongsam
added a commit
that referenced
this issue
Oct 15, 2021
* feat: impose DelayedStakingGasFee when staking See #102 for details * chore: Update x/farming/types/params_test.go Co-authored-by: dongsam <dongsamb@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Problem Definition
As Delayed Staking is introduced into F1, add staking in the queue and runs in end-of-epoch, so the gas of
MsgStake
is consumed less than the total computation amount, which can adversely affect the chain.Proposal
Therefore, it is necessary to add the average amount of gas to be calculated at the end-of-epoch of the end-block to the params and add the gas to the MsgStake step in the same way as
ctx.GasMeter().ConsumeGas(params.EndBlockStakingGasFee, "EndBlockStakingGasFee")
Tasks
ConsumeGas
logic forMsgStake
on msg_serverQueuedStaking
params.delayed_staking_gas_fee
References
PrepareRequest
bandprotocol/chain#81For Admin Use
The text was updated successfully, but these errors were encountered: