Skip to content

Commit

Permalink
chore: update chlog for v18 (#2499)
Browse files Browse the repository at this point in the history
* update chlog

* run make format

* fix lint warnings

* fix lint warnings

---------

Co-authored-by: GAtom22 <GAtom22@users.noreply.github.com>
  • Loading branch information
GAtom22 and GAtom22 committed Apr 22, 2024
1 parent b2a09ca commit 2f9b757
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [v18.0.0] - 2024-04-22

### State Machine Breaking

- (vesting) Refactor vesting module.

## [v17.0.0] - 2024-04-08

### State Machine Breaking
Expand Down
4 changes: 2 additions & 2 deletions app/app.go
Expand Up @@ -160,11 +160,11 @@ import (
inflation "github.com/evmos/evmos/v18/x/inflation/v1"
inflationkeeper "github.com/evmos/evmos/v18/x/inflation/v1/keeper"
inflationtypes "github.com/evmos/evmos/v18/x/inflation/v1/types"
"github.com/evmos/evmos/v18/x/staking"
stakingkeeper "github.com/evmos/evmos/v18/x/staking/keeper"
revenue "github.com/evmos/evmos/v18/x/revenue/v1"
revenuekeeper "github.com/evmos/evmos/v18/x/revenue/v1/keeper"
revenuetypes "github.com/evmos/evmos/v18/x/revenue/v1/types"
"github.com/evmos/evmos/v18/x/staking"
stakingkeeper "github.com/evmos/evmos/v18/x/staking/keeper"
"github.com/evmos/evmos/v18/x/vesting"
vestingclient "github.com/evmos/evmos/v18/x/vesting/client"
vestingkeeper "github.com/evmos/evmos/v18/x/vesting/keeper"
Expand Down
1 change: 0 additions & 1 deletion testutil/integration/ibc/coordinator/coordinator.go
Expand Up @@ -40,7 +40,6 @@ type Coordinator interface {
CommitAll() error
}

// TODO: Replace for a config
var AmountOfDummyChains = 2

var _ Coordinator = (*IntegrationCoordinator)(nil)
Expand Down
12 changes: 6 additions & 6 deletions x/staking/keeper/msg_server_test.go
Expand Up @@ -30,7 +30,7 @@ func TestMsgDelegate(t *testing.T) {
funderAddr, _ = utiltx.NewAccAddressAndKey()
)

testCases := []struct {
testCases := []struct { //nolint:dupl
name string
setup func() sdk.Coin
expErr bool
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestMsgDelegate(t *testing.T) {
// after first vesting period and before lockup
// some vested tokens, but still all locked
cliffDuration := time.Duration(testutil.TestVestingSchedule.CliffPeriodLength)
nw.NextBlockAfter(cliffDuration * time.Second)
require.NoError(t, nw.NextBlockAfter(cliffDuration*time.Second))
ctx = nw.GetContext()

acc := nw.App.AccountKeeper.GetAccount(ctx, delegatorAddr)
Expand All @@ -99,7 +99,7 @@ func TestMsgDelegate(t *testing.T) {
// Between first and second lockup periods
// vested coins are unlocked
lockDuration := time.Duration(testutil.TestVestingSchedule.LockupPeriodLength)
nw.NextBlockAfter(lockDuration * time.Second)
require.NoError(t, nw.NextBlockAfter(lockDuration*time.Second))
ctx = nw.GetContext()

acc := nw.App.AccountKeeper.GetAccount(ctx, delegatorAddr)
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestMsgCreateValidator(t *testing.T) {
funderAddr, _ = utiltx.NewAccAddressAndKey()
)

testCases := []struct {
testCases := []struct { //nolint:dupl
name string
setup func() sdk.Coin
expErr bool
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestMsgCreateValidator(t *testing.T) {
// after first vesting period and before lockup
// some vested tokens, but still all locked
cliffDuration := time.Duration(testutil.TestVestingSchedule.CliffPeriodLength)
nw.NextBlockAfter(cliffDuration * time.Second)
require.NoError(t, nw.NextBlockAfter(cliffDuration*time.Second))
ctx = nw.GetContext()

acc := nw.App.AccountKeeper.GetAccount(ctx, validatorAddr)
Expand All @@ -218,7 +218,7 @@ func TestMsgCreateValidator(t *testing.T) {
// Between first and second lockup periods
// vested coins are unlocked
lockDuration := time.Duration(testutil.TestVestingSchedule.LockupPeriodLength)
nw.NextBlockAfter(lockDuration * time.Second)
require.NoError(t, nw.NextBlockAfter(lockDuration*time.Second))
ctx = nw.GetContext()

acc := nw.App.AccountKeeper.GetAccount(ctx, validatorAddr)
Expand Down
2 changes: 1 addition & 1 deletion x/vesting/keeper/msg_server.go
Expand Up @@ -375,7 +375,7 @@ func (k Keeper) ConvertVestingAccount(
if vestingAcc.HasLockedCoins(ctx.BlockTime()) {
return nil, errorsmod.Wrapf(errortypes.ErrInvalidRequest, "locked up coins still left in account: %s", msg.VestingAddress)
}

// if gov clawback is disabled, remove the entry from the store.
// if no entry is found for the address, this will no-op
k.DeleteGovClawbackDisabled(ctx, address)
Expand Down
18 changes: 9 additions & 9 deletions x/vesting/keeper/msg_server_test.go
Expand Up @@ -97,7 +97,7 @@ func (suite *KeeperTestSuite) TestMsgFundVestingAccount() {
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
suite.SetupTest() // Reset
suite.Require().NoError(suite.SetupTest()) // Reset
ctx := sdk.WrapSDKContext(suite.ctx)

// fund the recipient account to set the account and then
Expand Down Expand Up @@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestMsgFundVestingAccountSpecialCases() {
// ---------------------------
// Test blocked address
suite.Run("fail - blocked address", func() {
suite.SetupTest()
suite.Require().NoError(suite.SetupTest())
msg := &types.MsgFundVestingAccount{
FunderAddress: funder.String(),
VestingAddress: authtypes.NewModuleAddress("transfer").String(),
Expand All @@ -183,7 +183,7 @@ func (suite *KeeperTestSuite) TestMsgFundVestingAccountSpecialCases() {
// Test wrong funder by first creating a clawback vesting account
// and then trying to fund it with a different funder
suite.Run("fail - wrong funder", func() {
suite.SetupTest()
suite.Require().NoError(suite.SetupTest())

// fund the recipient account to set the account
err = testutil.FundAccount(suite.ctx, suite.app.BankKeeper, vestingAddr, balances)
Expand Down Expand Up @@ -284,7 +284,7 @@ func (suite *KeeperTestSuite) TestMsgCreateClawbackVestingAccount() {
for _, tc := range testcases {
tc := tc
suite.Run(tc.name, func() {
suite.SetupTest() // Reset
suite.Require().NoError(suite.SetupTest()) // Reset
ctx := sdk.WrapSDKContext(suite.ctx)

tc.malleate(tc.funder, tc.vestingAddr)
Expand Down Expand Up @@ -425,7 +425,7 @@ func (suite *KeeperTestSuite) TestMsgClawback() {
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
suite.SetupTest() // reset
suite.Require().NoError(suite.SetupTest()) // reset
ctx := sdk.WrapSDKContext(suite.ctx)

// fund the vesting target address to initialize it as an account and
Expand Down Expand Up @@ -553,7 +553,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateVestingFunder() {
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
suite.SetupTest() // reset
suite.Require().NoError(suite.SetupTest()) // reset
ctx := sdk.WrapSDKContext(suite.ctx)

// fund the account at the vesting address to initialize it and then sund all funds to the funder account
Expand Down Expand Up @@ -596,7 +596,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateVestingFunder() {
}

func (suite *KeeperTestSuite) TestClawbackVestingAccountStore() {
suite.SetupTest()
suite.Require().NoError(suite.SetupTest())

// Create and set clawback vesting account
vestingStart := s.ctx.BlockTime()
Expand All @@ -612,7 +612,7 @@ func (suite *KeeperTestSuite) TestClawbackVestingAccountStore() {
}

func (suite *KeeperTestSuite) TestClawbackVestingAccountMarshal() {
suite.SetupTest()
suite.Require().NoError(suite.SetupTest())

// Create and set clawback vesting account
vestingStart := s.ctx.BlockTime()
Expand Down Expand Up @@ -718,7 +718,7 @@ func (suite *KeeperTestSuite) TestConvertVestingAccount() {
for _, tc := range testCases {
tc := tc
suite.Run(tc.name, func() {
suite.SetupTest() // reset
suite.Require().NoError(suite.SetupTest()) // reset
acc := tc.malleate()

msg := types.NewMsgConvertVestingAccount(acc.GetAddress())
Expand Down
1 change: 0 additions & 1 deletion x/vesting/types/clawback_vesting_account.go
Expand Up @@ -174,7 +174,6 @@ func (va ClawbackVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {
return ReadSchedule(va.GetStartTime(), va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())
}


// GetPassedPeriodCount returns the amount of passed periods at blockTime.
func (va ClawbackVestingAccount) GetPassedPeriodCount(blockTime time.Time) int {
return ReadPastPeriodCount(va.GetStartTime(), va.EndTime, va.VestingPeriods, blockTime.Unix())
Expand Down
1 change: 1 addition & 0 deletions x/vesting/types/clawback_vesting_account_test.go
Expand Up @@ -293,6 +293,7 @@ func (suite *VestingAccountTestSuite) TestGetCoinsFunctions() {
})
}
}

func (suite *VestingAccountTestSuite) TestTrackDelegationUndelegation() {
now := tmtime.Now()
endTime := now.Add(24 * time.Hour)
Expand Down

0 comments on commit 2f9b757

Please sign in to comment.