Skip to content

Commit 0756c4e

Browse files
authored
Merge pull request #146 from xpladev/release/v1.5.x
v1.5.1
2 parents 29a75c2 + 86b8d08 commit 0756c4e

File tree

15 files changed

+50434
-118970
lines changed

15 files changed

+50434
-118970
lines changed

.github/workflows/integration-test.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: End-to-end test
22

33
on:
44
push:
5-
branches: [ "main", "cube", "tesseract", "release/*" ]
5+
branches: [ "main", "cube", "release/**" ]
66
pull_request:
7-
branches: [ "*" ]
7+
types: [opened, reopened]
88

99
jobs:
1010

@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup network
1818
run: |
1919
mkdir ~/genesis
20-
cd tests/e2e && docker-compose up -d
20+
cd tests/e2e && docker compose up -d
2121
docker ps
2222
sleep 20
2323
@@ -30,4 +30,4 @@ jobs:
3030
run: cd tests/e2e && go test
3131

3232
- name: Teardown
33-
run: cd tests/e2e && docker-compose down
33+
run: cd tests/e2e && docker compose down

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ GO_VERSION ?= "1.19"
2121

2222
# for dockerized protobuf tools
2323
DOCKER := $(shell which docker)
24-
DOCKER_COMPOSE := $(shell which docker-compose)
2524
BUF_IMAGE=bufbuild/buf@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
2625
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
2726

app/encoding.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package app
22

33
import (
4+
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
5+
46
"github.com/xpladev/xpla/app/params"
57

68
"github.com/xpladev/ethermint/encoding/codec"
@@ -16,5 +18,9 @@ func MakeTestEncodingConfig() params.EncodingConfig {
1618
codec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
1719
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
1820
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
21+
22+
// for removing vesting module
23+
vestingtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
24+
1925
return encodingConfig
2026
}

app/genesis_account.go

-47
This file was deleted.

app/modules.go

-7
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"github.com/cosmos/cosmos-sdk/x/auth"
99
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
1010
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
11-
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
12-
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
1311
"github.com/cosmos/cosmos-sdk/x/authz"
1412
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
1513
"github.com/cosmos/cosmos-sdk/x/bank"
@@ -128,7 +126,6 @@ var ModuleBasics = module.NewBasicManager(
128126
upgrade.AppModuleBasic{},
129127
evidence.AppModuleBasic{},
130128
transfer.AppModuleBasic{},
131-
vesting.AppModuleBasic{},
132129
router.AppModuleBasic{},
133130
ica.AppModuleBasic{},
134131
erc20.AppModuleBasic{},
@@ -154,7 +151,6 @@ func appModules(
154151
encodingConfig.TxConfig,
155152
),
156153
ethermintauth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
157-
vesting.NewAppModule(app.AccountKeeper.AccountKeeper, app.BankKeeper),
158154
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
159155
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
160156
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
@@ -203,7 +199,6 @@ func orderBeginBlockers() []string {
203199
authz.ModuleName,
204200
feegrant.ModuleName,
205201
paramstypes.ModuleName,
206-
vestingtypes.ModuleName,
207202
ibcexported.ModuleName,
208203
consensusparamtypes.ModuleName,
209204
ibctransfertypes.ModuleName,
@@ -236,7 +231,6 @@ func orderEndBlockers() []string {
236231
evidencetypes.ModuleName,
237232
paramstypes.ModuleName,
238233
upgradetypes.ModuleName,
239-
vestingtypes.ModuleName,
240234
ibcexported.ModuleName,
241235
consensusparamtypes.ModuleName,
242236
ibctransfertypes.ModuleName,
@@ -280,7 +274,6 @@ func orderInitBlockers() []string {
280274
ibcfeetypes.ModuleName,
281275
paramstypes.ModuleName,
282276
upgradetypes.ModuleName,
283-
vestingtypes.ModuleName,
284277
wasmtypes.ModuleName,
285278
erc20types.ModuleName,
286279
rewardtypes.ModuleName,

app/upgrades/v1_5/const.go

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1_5
22

33
import (
44
store "github.com/cosmos/cosmos-sdk/store/types"
5+
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
56
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
67
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
78

@@ -20,5 +21,8 @@ var Upgrade = upgrades.Upgrade{
2021
consensustypes.ModuleName,
2122
crisistypes.ModuleName,
2223
},
24+
Deleted: []string{
25+
vestingtypes.ModuleName,
26+
},
2327
},
2428
}

app/upgrades/v1_5/upgrades.go

+16
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
sdk "github.com/cosmos/cosmos-sdk/types"
99
"github.com/cosmos/cosmos-sdk/types/module"
1010
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
11+
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
1112
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
1213
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
1314
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
@@ -26,6 +27,8 @@ import (
2627
"github.com/cosmos/ibc-go/v7/modules/core/exported"
2728
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations"
2829

30+
"github.com/ethereum/go-ethereum/common"
31+
etherminttypes "github.com/xpladev/ethermint/types"
2932
evmtypes "github.com/xpladev/ethermint/x/evm/types"
3033
feemarkettypes "github.com/xpladev/ethermint/x/feemarket/types"
3134

@@ -40,6 +43,19 @@ func CreateUpgradeHandler(
4043
cdc codec.BinaryCodec,
4144
) upgradetypes.UpgradeHandler {
4245
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
46+
// migrate VestingAccount to EthAccount
47+
keepers.AccountKeeper.IterateAccounts(ctx, func(account authtypes.AccountI) bool {
48+
acc, ok := account.(vestexported.VestingAccount)
49+
if ok {
50+
newacc := authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence())
51+
ethAcc := &etherminttypes.EthAccount{
52+
BaseAccount: newacc,
53+
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).String(),
54+
}
55+
keepers.AccountKeeper.SetAccount(ctx, ethAcc)
56+
}
57+
return false
58+
})
4359
// Set param key table for params module migration
4460
for _, subspace := range keepers.ParamsKeeper.GetSubspaces() {
4561
var keyTable paramstypes.KeyTable

cmd/xplad/cmd/genaccounts.go

+4-53
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"bufio"
55
"encoding/json"
6-
"errors"
76
"fmt"
87

98
"github.com/ethereum/go-ethereum/common"
@@ -15,7 +14,6 @@ import (
1514
"github.com/cosmos/cosmos-sdk/server"
1615
sdk "github.com/cosmos/cosmos-sdk/types"
1716
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
18-
authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
1917
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
2018
"github.com/cosmos/cosmos-sdk/x/genutil"
2119
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
@@ -25,12 +23,6 @@ import (
2523
evmtypes "github.com/xpladev/ethermint/x/evm/types"
2624
)
2725

28-
const (
29-
flagVestingStart = "vesting-start-time"
30-
flagVestingEnd = "vesting-end-time"
31-
flagVestingAmt = "vesting-amount"
32-
)
33-
3426
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
3527
func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command {
3628
cmd := &cobra.Command{
@@ -39,7 +31,7 @@ func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command {
3931
Long: `Add a genesis account to genesis.json. The provided account must specify
4032
the account address or key name and a list of initial coins. If a key name is given,
4133
the address will be looked up in the local Keybase. The list of initial tokens must
42-
contain valid denominations. Accounts may optionally be supplied with vesting parameters.
34+
contain valid denominations.
4335
`,
4436
Args: cobra.ExactArgs(2),
4537
RunE: func(cmd *cobra.Command, args []string) error {
@@ -91,53 +83,15 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
9183
return fmt.Errorf("failed to parse coins: %w", err)
9284
}
9385

94-
vestingStart, err := cmd.Flags().GetInt64(flagVestingStart)
95-
if err != nil {
96-
return err
97-
}
98-
vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd)
99-
if err != nil {
100-
return err
101-
}
102-
vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt)
103-
if err != nil {
104-
return err
105-
}
106-
107-
vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr)
108-
if err != nil {
109-
return fmt.Errorf("failed to parse vesting amount: %w", err)
110-
}
111-
11286
// create concrete account type based on input parameters
11387
var genAccount authtypes.GenesisAccount
11488

11589
balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}
11690
baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0)
11791

118-
if !vestingAmt.IsZero() {
119-
baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
120-
121-
if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) ||
122-
baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) {
123-
return errors.New("vesting amount cannot be greater than total amount")
124-
}
125-
126-
switch {
127-
case vestingStart != 0 && vestingEnd != 0:
128-
genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart)
129-
130-
case vestingEnd != 0:
131-
genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount)
132-
133-
default:
134-
return errors.New("invalid vesting parameters; must supply start and end time or end time")
135-
}
136-
} else {
137-
genAccount = &ethermint.EthAccount{
138-
BaseAccount: baseAccount,
139-
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
140-
}
92+
genAccount = &ethermint.EthAccount{
93+
BaseAccount: baseAccount,
94+
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
14195
}
14296

14397
if err := genAccount.Validate(); err != nil {
@@ -203,9 +157,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
203157

204158
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
205159
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)")
206-
cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
207-
cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
208-
cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
209160
flags.AddQueryFlagsToCmd(cmd)
210161

211162
return cmd

0 commit comments

Comments
 (0)