diff --git a/go.mod b/go.mod index ff463418a..e11e6bcf5 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( github.com/rs/cors v1.9.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/zondax/hid v0.9.1 // indirect - golang.org/x/net v0.22.0 // indirect + golang.org/x/net v0.23.0 // indirect ) require ( diff --git a/go.sum b/go.sum index bb081e135..05e975d6e 100644 --- a/go.sum +++ b/go.sum @@ -1698,6 +1698,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/x/assets/types/genesis.go b/x/assets/types/genesis.go index 415517439..7b675b44d 100644 --- a/x/assets/types/genesis.go +++ b/x/assets/types/genesis.go @@ -200,12 +200,13 @@ func (gs GenesisState) Validate() error { assetID, info, ) } - // check that the withdrawable amount is not greater than the total deposit amount. - // since withdrawable amount should be less than or equal to the amount deposited. - if info.WithdrawableAmount.GT(info.TotalDepositAmount) { + // check that the withdrawable amount and the deposited amount are equal. + // this is because this module's genesis only sets up free deposits. + // the delegation module bonds them, thereby altering the withdrawable amount. + if !info.WithdrawableAmount.Equal(info.TotalDepositAmount) { return errorsmod.Wrapf( ErrInvalidGenesisData, - "withdrawable amount exceeds total deposit amount for %s: %+v", + "withdrawable amount is not equal to total deposit amount for %s: %+v", assetID, info, ) } diff --git a/x/assets/types/genesis_test.go b/x/assets/types/genesis_test.go index eb7d3741a..12ab18cfa 100644 --- a/x/assets/types/genesis_test.go +++ b/x/assets/types/genesis_test.go @@ -67,7 +67,7 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { AssetID: assetID, Info: types.StakerAssetInfo{ TotalDepositAmount: math.NewInt(100), - WithdrawableAmount: math.NewInt(0), + WithdrawableAmount: math.NewInt(100), WaitUnbondingAmount: math.NewInt(0), }, }, @@ -493,9 +493,12 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { malleate: func(gs *types.GenesisState) { gs.Deposits[0].Deposits[0].Info.TotalDepositAmount = stakingInfo.AssetBasicInfo.TotalSupply.Add(math.NewInt(1)) + gs.Deposits[0].Deposits[0].Info.WithdrawableAmount = + stakingInfo.AssetBasicInfo.TotalSupply.Add(math.NewInt(1)) }, unmalleate: func(gs *types.GenesisState) { gs.Deposits[0].Deposits[0].Info.TotalDepositAmount = math.NewInt(100) + gs.Deposits[0].Deposits[0].Info.WithdrawableAmount = math.NewInt(100) }, }, {