Skip to content

Commit

Permalink
lint fix, cosmos api version update
Browse files Browse the repository at this point in the history
  • Loading branch information
stana-miric committed Jun 11, 2024
1 parent ed92360 commit 867c65b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
5 changes: 2 additions & 3 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ require (

// Below are the long-lived replace for tests.
replace (
// Use version with lsm changes
cosmossdk.io/api => github.com/informalsystems/cosmos-sdk/api v0.7.5-lsm
// We always want to test against the latest version of the simapp.
cosmossdk.io/simapp => ../simapp
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
Expand All @@ -213,7 +215,4 @@ replace (
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
// Use version with lsm changes
cosmossdk.io/api => github.com/informalsystems/cosmos-sdk/api v0.7.3-lsm
)

6 changes: 2 additions & 4 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX
cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ=
cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79 h1:Hr1t0fCq1nbFC7hLs0Xvy9WAiH7Iti5iVLXMM5C37F0=
cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79/go.mod h1:8pN6LSVReNnIxrC2QGcvuIJ/m1pJN6FNYn2kAYtYftI=
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
Expand Down Expand Up @@ -710,8 +708,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/informalsystems/cosmos-sdk/api v0.7.3-lsm h1:jECO2vrYtqXN9QLLC5g12BWkqpkDlPUoZn2jcIZ/ACM=
github.com/informalsystems/cosmos-sdk/api v0.7.3-lsm/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
github.com/informalsystems/cosmos-sdk/api v0.7.5-lsm h1:M0+CQZLf2yS41TiWaiKw8nF5vlPaFDmVfwfyMHViRZk=
github.com/informalsystems/cosmos-sdk/api v0.7.5-lsm/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls=
github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
Expand Down
9 changes: 4 additions & 5 deletions tests/integration/staking/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/cosmos/cosmos-sdk/x/staking/testutil"
"github.com/cosmos/cosmos-sdk/x/staking/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

func TestCancelUnbondingDelegation(t *testing.T) {
Expand Down Expand Up @@ -1811,7 +1810,7 @@ func TestTokenizeAndRedeemVestedDelegation(t *testing.T) {

// Create Validators and Delegation
val1 := testutil.NewValidator(t, addrVal1, pk1)
val1.Status = stakingtypes.Bonded
val1.Status = types.Bonded
stakingKeeper.SetValidator(ctx, val1)
stakingKeeper.SetValidatorByPowerIndex(ctx, val1)
err = stakingKeeper.SetValidatorByConsAddr(ctx, val1)
Expand Down Expand Up @@ -1855,7 +1854,7 @@ func TestTokenizeAndRedeemVestedDelegation(t *testing.T) {

// Expect that tokenizing all the delegated coins fails
// since only the half are vested
_, err = msgServer.TokenizeShares(sdk.WrapSDKContext(ctx), &types.MsgTokenizeShares{
_, err = msgServer.TokenizeShares(ctx, &types.MsgTokenizeShares{
DelegatorAddress: addrAcc1.String(),
ValidatorAddress: addrVal1.String(),
Amount: originalVesting[0],
Expand All @@ -1864,7 +1863,7 @@ func TestTokenizeAndRedeemVestedDelegation(t *testing.T) {
require.Error(t, err)

// Tokenize the delegated vested coins
_, err = msgServer.TokenizeShares(sdk.WrapSDKContext(ctx), &types.MsgTokenizeShares{
_, err = msgServer.TokenizeShares(ctx, &types.MsgTokenizeShares{
DelegatorAddress: addrAcc1.String(),
ValidatorAddress: addrVal1.String(),
Amount: sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: originalVestingAmount.Quo(math.NewInt(2))},
Expand All @@ -1875,7 +1874,7 @@ func TestTokenizeAndRedeemVestedDelegation(t *testing.T) {
shareDenom := addrVal1.String() + "/1"

// Redeem the tokens
_, err = msgServer.RedeemTokensForShares(sdk.WrapSDKContext(ctx),
_, err = msgServer.RedeemTokensForShares(ctx,
&types.MsgRedeemTokensForShares{
DelegatorAddress: addrAcc1.String(),
Amount: sdk.Coin{Denom: shareDenom, Amount: originalVestingAmount.Quo(math.NewInt(2))},
Expand Down
4 changes: 2 additions & 2 deletions x/slashing/keeper/slash_redelegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ func TestSlashRedelegation(t *testing.T) {
evilValAddr := sdk.ValAddress(evilValPubKey.Address())
banktestutil.FundAccount(ctx, bankKeeper, sdk.AccAddress(evilValAddr), testCoins)
createValMsg1, _ := stakingtypes.NewMsgCreateValidator(
evilValAddr.String(), evilValPubKey, testCoins[0], stakingtypes.Description{Details: "test"}, stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)), math.OneInt())
evilValAddr.String(), evilValPubKey, testCoins[0], stakingtypes.Description{Details: "test"}, stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)))
_, err = stakingMsgServer.CreateValidator(ctx, createValMsg1)
require.NoError(t, err)

// creating good val
goodValAddr := sdk.ValAddress(goodValPubKey.Address())
banktestutil.FundAccount(ctx, bankKeeper, sdk.AccAddress(goodValAddr), testCoins)
createValMsg2, _ := stakingtypes.NewMsgCreateValidator(
goodValAddr.String(), goodValPubKey, testCoins[0], stakingtypes.Description{Details: "test"}, stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)), math.OneInt())
goodValAddr.String(), goodValPubKey, testCoins[0], stakingtypes.Description{Details: "test"}, stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)))
_, err = stakingMsgServer.CreateValidator(ctx, createValMsg2)
require.NoError(t, err)

Expand Down
4 changes: 2 additions & 2 deletions x/staking/keeper/liquid_stake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand All @@ -14,7 +16,6 @@ import (
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
)

// Tests Set/Get TotalLiquidStakedTokens
Expand Down Expand Up @@ -828,7 +829,6 @@ func (s *KeeperTestSuite) TestDelegatorIsLiquidStaker() {
}

func TestCheckVestedDelegationInVestingAccount(t *testing.T) {

var (
vestingAcct *vestingtypes.ContinuousVestingAccount
startTime = time.Now()
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
// NewMsgCreateValidator creates a new MsgCreateValidator instance.
// Delegator address and validator address are the same.
func NewMsgCreateValidator(
valAddr string, pubKey cryptotypes.PubKey, //nolint:interfacer
valAddr string, pubKey cryptotypes.PubKey,
selfDelegation sdk.Coin, description Description, commission CommissionRates,
) (*MsgCreateValidator, error) {
var pkAny *codectypes.Any
Expand Down

0 comments on commit 867c65b

Please sign in to comment.