Skip to content

Commit

Permalink
revert: SupplierStakingFee rename
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Nov 21, 2024
1 parent 349c7f8 commit fe562ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions x/supplier/keeper/msg_server_stake_supplier.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
var (
// TODO_BETA(@bryanchriswhite): Make supplier staking fee a governance parameter
// TODO_BETA(@red-0ne): Update supplier staking documentation to remove the upstaking requirement and introduce the staking fee.
StakingFee = sdk.NewInt64Coin(volatile.DenomuPOKT, 1)
SupplierStakingFee = sdk.NewInt64Coin(volatile.DenomuPOKT, 1)
)

func (k msgServer) StakeSupplier(ctx context.Context, msg *suppliertypes.MsgStakeSupplier) (*suppliertypes.MsgStakeSupplierResponse, error) {
Expand Down Expand Up @@ -147,7 +147,7 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *suppliertypes.MsgStak
}

// Send the coins from the message signer account to the staked supplier pool
stakeWithFee := sdk.NewCoins(coinsToEscrow.Add(StakingFee))
stakeWithFee := sdk.NewCoins(coinsToEscrow.Add(SupplierStakingFee))
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, msgSignerAddress, suppliertypes.ModuleName, stakeWithFee)
if err != nil {
logger.Info(fmt.Sprintf("ERROR: could not send %v coins from %q to %q module account due to %v", coinsToEscrow, msgSignerAddress, suppliertypes.ModuleName, err))
Expand Down
2 changes: 1 addition & 1 deletion x/supplier/keeper/msg_server_stake_supplier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) {
require.Len(t, foundSupplier.Services[0].Endpoints, 1)
require.Equal(t, "http://localhost:8080", foundSupplier.Services[0].Endpoints[0].Url)
// Assert that the supplier's account balance was reduced by the staking fee
balanceDecrease := keeper.StakingFee.Amount.Int64() + foundSupplier.Stake.Amount.Int64()
balanceDecrease := keeper.SupplierStakingFee.Amount.Int64() + foundSupplier.Stake.Amount.Int64()
// SupplierBalanceMap reflects the relative changes to the supplier's balance
// (i.e. it starts from 0 and can go below it).
// It is not using coins that enforce non-negativity of the balance nor account
Expand Down
4 changes: 2 additions & 2 deletions x/supplier/keeper/msg_server_unstake_supplier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) {

// Balance decrease is the total amount deducted from the supplier's balance, including
// the initial stake and the staking fee.
balanceDecrease := keeper.StakingFee.Amount.Int64() + foundSupplier.Stake.Amount.Int64()
balanceDecrease := keeper.SupplierStakingFee.Amount.Int64() + foundSupplier.Stake.Amount.Int64()
// Ensure that the initial stake is not returned to the owner yet
require.Equal(t, -balanceDecrease, supplierModuleKeepers.SupplierBalanceMap[ownerAddr])

Expand All @@ -415,5 +415,5 @@ func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) {

// Ensure that the initial stake is returned to the owner while the staking fee
// remains deducted from the supplier's balance.
require.Equal(t, -keeper.StakingFee.Amount.Int64(), supplierModuleKeepers.SupplierBalanceMap[ownerAddr])
require.Equal(t, -keeper.SupplierStakingFee.Amount.Int64(), supplierModuleKeepers.SupplierBalanceMap[ownerAddr])
}
4 changes: 2 additions & 2 deletions x/supplier/keeper/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestParams_ValidateStakingFee(t *testing.T) {
expectedErr: suppliertypes.ErrSupplierParamInvalid.Wrapf("invalid parameter type: string"),
},
{
desc: "StakingFee less than zero",
desc: "SupplierStakingFee less than zero",
minStake: &cosmostypes.Coin{
Denom: volatile.DenomuPOKT,
Amount: math.NewInt(-1),
Expand All @@ -95,7 +95,7 @@ func TestParams_ValidateStakingFee(t *testing.T) {
),
},
{
desc: "valid StakingFee",
desc: "valid SupplierStakingFee",
minStake: &suppliertypes.DefaultStakingFee,
},
}
Expand Down

0 comments on commit fe562ae

Please sign in to comment.