From 7340f3cb4627462d0b1fb40b66fffa3427e800e2 Mon Sep 17 00:00:00 2001 From: Riccardo <9119016+RiccardoM@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:33:57 +0900 Subject: [PATCH] refactor: remove initia-labs dependencies (#203) ## Description This PR removes the `initia-labs/initia` and `initia-labs/opinit` dependencies as they are no longer necessary. Closes: MILK-153 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/milkyway-labs/milkyway/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html) - [ ] included the necessary unit and integration [tests](https://github.com/milkyway-labs/milkyway/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- .github/CODEOWNERS | 2 +- app/genesis.go | 109 ++------------ app/test_helpers.go | 207 --------------------------- go.mod | 6 +- go.sum | 18 +-- proto/README.md | 17 --- scripts/protoc-swagger-gen.sh | 8 -- utils/ibc_test.go | 8 -- x/liquidvesting/testutils/keeper.go | 3 +- x/rewards/types/dec_pool_test.go | 3 +- x/rewards/types/pool_test.go | 3 +- x/tokenfactory/keeper/common_test.go | 20 ++- x/tokenfactory/types/msgs_test.go | 15 +- 13 files changed, 46 insertions(+), 373 deletions(-) delete mode 100644 app/test_helpers.go delete mode 100644 proto/README.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0e3528ae1..38bf5be15 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,4 +4,4 @@ # most precedence. # Primary repo maintainers -* @initia-labs/core +* @milkyway-labs/core diff --git a/app/genesis.go b/app/genesis.go index 189dbc6d2..31a49b50c 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -2,19 +2,9 @@ package milkyway import ( "encoding/json" - "time" - - sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto/secp256k1" - tmtypes "github.com/cometbft/cometbft/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/initia-labs/initia/app/genesis_markets" + "slices" + + "github.com/skip-mev/connect/v2/cmd/constants/marketmaps" marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" @@ -48,17 +38,21 @@ func (genState GenesisState) AddMarketData(cdc codec.JSONCodec) GenesisState { cdc.MustUnmarshalJSON(genState[marketmaptypes.ModuleName], &marketGenState) // Load initial markets - markets, err := genesis_markets.ReadMarketsFromFile(genesis_markets.GenesisMarkets) - if err != nil { - panic(err) + coreMarkets := marketmaps.CoreMarketMap + markets := coreMarkets.Markets + + // Sort keys so we can deterministically iterate over map items. + keys := make([]string, 0, len(markets)) + for name := range markets { + keys = append(keys, name) } - marketGenState.MarketMap = genesis_markets.ToMarketMap(markets) + slices.Sort(keys) // Initialize all markets var id uint64 currencyPairGenesis := make([]oracletypes.CurrencyPairGenesis, len(markets)) - for i, market := range markets { - currencyPairGenesis[i] = oracletypes.CurrencyPairGenesis{ + for _, market := range markets { + currencyPairGenesis[id] = oracletypes.CurrencyPairGenesis{ CurrencyPair: market.Ticker.CurrencyPair, CurrencyPairPrice: nil, Nonce: 0, @@ -93,80 +87,3 @@ func (genState GenesisState) ConfigureIBCAllowedClients(cdc codec.JSONCodec) Gen return genState } - -// NewDefaultGenesisStateWithValidator generates the default application state with a validator. -func NewDefaultGenesisStateWithValidator(cdc codec.Codec, mbm module.BasicManager) GenesisState { - privVal := mock.NewPV() - pubKey, _ := privVal.GetPubKey() - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) - - // generate genesis account - senderPrivKey := secp256k1.GenPrivKey() - senderPrivKey.PubKey().Address() - acc := authtypes.NewBaseAccountWithAddress(senderPrivKey.PubKey().Address().Bytes()) - - ////////////////////// - var balances []banktypes.Balance - genesisState := NewDefaultGenesisState(cdc, mbm) - genAccs := []authtypes.GenesisAccount{acc} - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = cdc.MustMarshalJSON(authGenesis) - - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.DefaultPowerReduction - - for _, val := range valSet.Validators { - pk, _ := cryptocodec.FromCmtPubKeyInterface(val.PubKey) - pkAny, _ := codectypes.NewAnyWithValue(pk) - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: sdkmath.LegacyNewDec(1), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), - MinSelfDelegation: sdkmath.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyNewDec(1))) - } - // set validators and delegations - stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) - genesisState[stakingtypes.ModuleName] = cdc.MustMarshalJSON(stakingGenesis) - - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens to total supply - totalSupply = totalSupply.Add(b.Coins...) - } - - for range delegations { - // add delegated tokens to total supply - totalSupply = totalSupply.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)) - } - - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, - }) - - // update total supply - bankGenesis := banktypes.NewGenesisState( - banktypes.DefaultGenesisState().Params, - balances, - totalSupply, - []banktypes.Metadata{}, - []banktypes.SendEnabled{}, - ) - genesisState[banktypes.ModuleName] = cdc.MustMarshalJSON(bankGenesis) - - return genesisState -} diff --git a/app/test_helpers.go b/app/test_helpers.go deleted file mode 100644 index 092d05e2a..000000000 --- a/app/test_helpers.go +++ /dev/null @@ -1,207 +0,0 @@ -package milkyway - -// DONTCOVER - -import ( - "encoding/json" - "testing" - "time" - - "cosmossdk.io/log" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtypes "github.com/cometbft/cometbft/types" - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/server" - simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - oracleconfig "github.com/skip-mev/connect/v2/oracle/config" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - opchildtypes "github.com/initia-labs/OPinit/x/opchild/types" -) - -// defaultConsensusParams defines the default Tendermint consensus params used in -// MilkyWayApp testing. -var defaultConsensusParams = &tmproto.ConsensusParams{ - Block: &tmproto.BlockParams{ - MaxBytes: 8000000, - MaxGas: 1234000000, - }, - Evidence: &tmproto.EvidenceParams{ - MaxAgeNumBlocks: 302400, - MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration - MaxBytes: 10000, - }, - Validator: &tmproto.ValidatorParams{ - PubKeyTypes: []string{ - tmtypes.ABCIPubKeyTypeEd25519, - }, - }, -} - -func getOrCreateMemDB(db *dbm.DB) dbm.DB { - if db != nil { - return *db - } - return dbm.NewMemDB() -} - -func setup(t *testing.T, db *dbm.DB, withGenesis bool) (*MilkyWayApp, GenesisState) { - t.Helper() - - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - encCdc := MakeEncodingConfig() - app := NewMilkyWayApp( - log.NewNopLogger(), - getOrCreateMemDB(db), - nil, - true, - map[int64]bool{}, - t.TempDir(), - oracleconfig.NewDefaultAppConfig(), - simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), - []wasmkeeper.Option{}, - baseapp.SetChainID("milkyway-app"), - ) - - if withGenesis { - return app, NewDefaultGenesisStateWithValidator(encCdc.Marshaler, app.ModuleBasics) - } - - return app, GenesisState{} -} - -// Setup initializes a new MilkyWayApp for testing. -// A single validator will be created and registered in opchild module. -func Setup(t *testing.T, isCheckTx bool) *MilkyWayApp { - t.Helper() - - app, genState := setup(t, nil, true) - if !isCheckTx { - genStateBytes, err := json.Marshal(genState) - if err != nil { - panic(err) - } - _, err = app.InitChain(&abci.RequestInitChain{ - ChainId: "milkyway-app", - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: defaultConsensusParams, - AppStateBytes: genStateBytes, - }) - if err != nil { - panic(err) - } - } - - return app -} - -// SetupWithGenesisAccounts setup initiaapp with genesis account -func SetupWithGenesisAccounts( - t *testing.T, - valSet *tmtypes.ValidatorSet, - genAccs []authtypes.GenesisAccount, - balances ...banktypes.Balance, -) *MilkyWayApp { - t.Helper() - - app, genesisState := setup(t, nil, true) - - if len(genAccs) == 0 { - privAcc := secp256k1.GenPrivKey() - genAccs = []authtypes.GenesisAccount{ - authtypes.NewBaseAccount(privAcc.PubKey().Address().Bytes(), privAcc.PubKey(), 0, 0), - } - } - - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) - - // allow empty validator - if valSet == nil || len(valSet.Validators) == 0 { - privVal := ed25519.GenPrivKey() - pubKey, err := cryptocodec.ToCmtPubKeyInterface(privVal.PubKey()) - if err != nil { - panic(err) - } - - validator := tmtypes.NewValidator(pubKey, 1) - valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) - } - - validators := make([]opchildtypes.Validator, 0, len(valSet.Validators)) - for _, val := range valSet.Validators { - pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey) - if err != nil { - panic(err) - } - pkAny, err := codectypes.NewAnyWithValue(pk) - if err != nil { - panic(err) - } - - validator := opchildtypes.Validator{ - Moniker: "test-validator", - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - ConsPower: 1, - } - - validators = append(validators, validator) - } - - // set validators and delegations - var opchildGenesis opchildtypes.GenesisState - app.AppCodec().MustUnmarshalJSON(genesisState[opchildtypes.ModuleName], &opchildGenesis) - opchildGenesis.Params.Admin = sdk.AccAddress(valSet.Validators[0].Address.Bytes()).String() - opchildGenesis.Params.BridgeExecutors = []string{sdk.AccAddress(valSet.Validators[0].Address.Bytes()).String()} - - // set validators and delegations - opchildGenesis = *opchildtypes.NewGenesisState(opchildGenesis.Params, validators, nil) - genesisState[opchildtypes.ModuleName] = app.AppCodec().MustMarshalJSON(&opchildGenesis) - - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, sdk.NewCoins(), []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) - - stateBytes, err := json.MarshalIndent(genesisState, "", " ") - if err != nil { - panic(err) - } - - _, err = app.InitChain( - &abci.RequestInitChain{ - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: defaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - if err != nil { - panic(err) - } - - _, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1}) - if err != nil { - panic(err) - } - - _, err = app.Commit() - if err != nil { - panic(err) - } - - return app -} diff --git a/go.mod b/go.mod index 950940878..6cdbda560 100644 --- a/go.mod +++ b/go.mod @@ -38,8 +38,6 @@ require ( github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 - github.com/initia-labs/OPinit v0.5.1 - github.com/initia-labs/initia v0.5.1 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.20.5 github.com/rakyll/statik v0.1.7 @@ -161,6 +159,7 @@ require ( github.com/firefart/nonamedreturns v1.0.5 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/ghostiam/protogetter v0.3.6 // indirect github.com/go-critic/go-critic v0.11.4 // indirect @@ -169,6 +168,7 @@ require ( github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.2.0 // indirect @@ -179,6 +179,7 @@ require ( github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect + github.com/gobwas/ws v1.1.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.12.1 // indirect @@ -218,6 +219,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-plugin v1.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect diff --git a/go.sum b/go.sum index f3330c8d1..cc5efedc9 100644 --- a/go.sum +++ b/go.sum @@ -338,7 +338,6 @@ github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= -github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= @@ -593,11 +592,11 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= @@ -905,10 +904,6 @@ 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/initia-labs/OPinit v0.5.1 h1:TzpjkuSjbbaYF6hc/8E94E/m3zkGE3oOXRdrdARXA3Y= -github.com/initia-labs/OPinit v0.5.1/go.mod h1:lx1amLMszculwPu8ln+btJno38UV28fd2nP7XC88ZeE= -github.com/initia-labs/initia v0.5.1 h1:QY926Uy7MQhFGQlp6n0gzNy1aIobrCZdiCCViOlRAMI= -github.com/initia-labs/initia v0.5.1/go.mod h1:GASs+khG6RbWIkeQV116wppMEnVi7NcfANjowj66Rjo= github.com/jgautheron/goconst v1.7.1 h1:VpdAG7Ca7yvvJk5n8dMwQhfEZJh95kl/Hl9S1OI5Jkk= github.com/jgautheron/goconst v1.7.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= @@ -985,8 +980,8 @@ github.com/ldez/gomoddirectives v0.2.4/go.mod h1:oWu9i62VcQDYp9EQ0ONTfqLNh+mDLWW github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -1671,6 +1666,7 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/proto/README.md b/proto/README.md deleted file mode 100644 index df40d9109..000000000 --- a/proto/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Maintaining Initia Proto Files - -All of the Initia proto files are defined here. This folder should -be synced regularly with buf.build/initia-labs/initia regularly by -a maintainer by running `buf push` in this folder. - -User facing documentation should not be placed here but instead goes in -`buf.md` and in each protobuf package following the guidelines in -. - -## Generate - -To get the Initia proto given a commit, run: - -```bash -buf export buf.build/initia-labs/initia:${commit} --output . -``` diff --git a/scripts/protoc-swagger-gen.sh b/scripts/protoc-swagger-gen.sh index a9e0cef07..70540a634 100755 --- a/scripts/protoc-swagger-gen.sh +++ b/scripts/protoc-swagger-gen.sh @@ -6,8 +6,6 @@ set -eo pipefail COSMOS_URL=github.com/cosmos/cosmos-sdk IBC_URL=github.com/cosmos/ibc-go IBC_V=v8 -INITIA_URL=github.com/initia-labs/initia -OPINIT_URL=github.com/initia-labs/OPinit COSMWASM_URL=github.com/CosmWasm/wasmd CONNECT_URL=github.com/skip-mev/connect CONNECT_V=v2 @@ -15,14 +13,10 @@ CONNECT_V=v2 COSMOS_SDK_VERSION=$(cat ./go.mod | grep "$COSMOS_URL v" | sed -n -e "s/^.* //p") IBC_VERSION=$(cat ./go.mod | grep "$IBC_URL/$IBC_V v" | sed -n -e "s/^.* //p") COSMWASM_VERSION=$(cat ./go.mod | grep "$COSMWASM_URL v" | sed -n -e "s/^.* //p") -INITIA_VERSION=$(cat ./go.mod | grep "$INITIA_URL v" | sed -n -e "s/^.* //p") -OPINIT_VERSION=$(cat ./go.mod | grep "$OPINIT_URL v" | sed -n -e "s/^.* //p") CONNECT_VERSION=$(cat ./go.mod | grep "$CONNECT_URL/$CONNECT_V v" | sed -n -e "s/^.* //p") mkdir -p ./third_party cd third_party -git clone -b $INITIA_VERSION https://$INITIA_URL -git clone -b $OPINIT_VERSION https://$OPINIT_URL git clone -b $COSMOS_SDK_VERSION https://$COSMOS_URL git clone -b $IBC_VERSION https://$IBC_URL git clone -b $COSMWASM_VERSION https://$COSMWASM_URL @@ -37,8 +31,6 @@ proto_dirs=$(find \ ./milkyway \ ../third_party/cosmos-sdk/proto/cosmos \ ../third_party/ibc-go/proto/ibc \ - ../third_party/initia/proto \ - ../third_party/opinit/proto \ ../third_party/wasmd/proto \ ../third_party/connect/proto \ -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) diff --git a/utils/ibc_test.go b/utils/ibc_test.go index ac97e4bf4..765afe6a8 100644 --- a/utils/ibc_test.go +++ b/utils/ibc_test.go @@ -5,7 +5,6 @@ import ( "testing" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" "github.com/stretchr/testify/require" "github.com/milkyway-labs/milkyway/utils" @@ -19,11 +18,4 @@ func Test_DeserializeFungibleTokenPacketData(t *testing.T) { msg, ok := utils.DeserializeFungibleTokenPacketData(bz) require.True(t, ok) require.Equal(t, expected, msg) - - nftTransferMsg := nfttransfertypes.NewNonFungibleTokenPacketData("class_id", "uri", "data", []string{"1", "2", "3"}, []string{"uri1", "uri2", "uri3"}, []string{"data1", "data2", "data3"}, "sender", "receiver", "memo") - bz, err = json.Marshal(nftTransferMsg) - require.NoError(t, err) - - _, ok = utils.DeserializeFungibleTokenPacketData(bz) - require.False(t, ok) } diff --git a/x/liquidvesting/testutils/keeper.go b/x/liquidvesting/testutils/keeper.go index 89a636b66..a50d1f0e9 100644 --- a/x/liquidvesting/testutils/keeper.go +++ b/x/liquidvesting/testutils/keeper.go @@ -11,7 +11,6 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - ibchookstypes "github.com/initia-labs/initia/x/ibc-hooks/types" "github.com/milkyway-labs/milkyway/testutils/storetesting" "github.com/milkyway-labs/milkyway/x/liquidvesting" @@ -51,7 +50,7 @@ func NewKeeperTestData(t *testing.T) KeeperTestData { types.StoreKey, authtypes.StoreKey, banktypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey, servicestypes.StoreKey, restakingtypes.StoreKey, stakingtypes.StoreKey, - distributiontypes.StoreKey, ibchookstypes.StoreKey, + distributiontypes.StoreKey, }), } diff --git a/x/rewards/types/dec_pool_test.go b/x/rewards/types/dec_pool_test.go index 9fc05cf19..aa86e5e4c 100644 --- a/x/rewards/types/dec_pool_test.go +++ b/x/rewards/types/dec_pool_test.go @@ -5,8 +5,9 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/initia-labs/initia/x/distribution/types" "github.com/stretchr/testify/suite" + + "github.com/milkyway-labs/milkyway/x/rewards/types" ) type decpoolTestSuite struct { diff --git a/x/rewards/types/pool_test.go b/x/rewards/types/pool_test.go index 2fc8111ac..f1faf2fb8 100644 --- a/x/rewards/types/pool_test.go +++ b/x/rewards/types/pool_test.go @@ -5,8 +5,9 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/initia-labs/initia/x/distribution/types" "github.com/stretchr/testify/suite" + + "github.com/milkyway-labs/milkyway/x/rewards/types" ) var ( diff --git a/x/tokenfactory/keeper/common_test.go b/x/tokenfactory/keeper/common_test.go index 13349bd94..b38cc25e8 100644 --- a/x/tokenfactory/keeper/common_test.go +++ b/x/tokenfactory/keeper/common_test.go @@ -5,14 +5,13 @@ import ( "testing" "time" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "cosmossdk.io/core/address" "cosmossdk.io/log" "cosmossdk.io/math" "cosmossdk.io/store" "cosmossdk.io/store/metrics" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "cosmossdk.io/x/tx/signing" "github.com/cometbft/cometbft/crypto" @@ -35,8 +34,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" authz "github.com/cosmos/cosmos-sdk/x/authz/module" - initiaappparams "github.com/initia-labs/initia/app/params" - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -49,6 +46,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/milkyway-labs/milkyway/app/params" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" "github.com/milkyway-labs/milkyway/x/tokenfactory" tokenfactorykeeper "github.com/milkyway-labs/milkyway/x/tokenfactory/keeper" @@ -107,10 +105,10 @@ var ( ) func MakeTestCodec(t testing.TB) codec.Codec { - return MakeEncodingConfig(t).Codec + return MakeEncodingConfig(t).Marshaler } -func MakeEncodingConfig(_ testing.TB) initiaappparams.EncodingConfig { +func MakeEncodingConfig(_ testing.TB) params.EncodingConfig { interfaceRegistry, _ := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{ ProtoFiles: proto.HybridResolver, SigningOptions: signing.Options{ @@ -128,9 +126,9 @@ func MakeEncodingConfig(_ testing.TB) initiaappparams.EncodingConfig { ModuleBasics.RegisterLegacyAminoCodec(legacyAmino) ModuleBasics.RegisterInterfaces(interfaceRegistry) - return initiaappparams.EncodingConfig{ + return params.EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Codec: appCodec, + Marshaler: appCodec, TxConfig: txConfig, Amino: legacyAmino, } @@ -199,7 +197,7 @@ type TestKeepers struct { WasmKeeper *wasmkeeper.Keeper TokenFactoryKeeper *tokenfactorykeeper.Keeper CommunityPoolKeeper *distrkeeper.Keeper - EncodingConfig initiaappparams.EncodingConfig + EncodingConfig params.EncodingConfig Faucet *TestFaucet MultiStore storetypes.CommitMultiStore AddressCodec address.Codec @@ -262,7 +260,7 @@ func _createTestInput( }, isCheckTx, log.NewNopLogger()) encodingConfig := MakeEncodingConfig(t) - appCodec := encodingConfig.Codec + appCodec := encodingConfig.Marshaler maccPerms := map[string][]string{ // module account permissions authtypes.FeeCollectorName: nil, diff --git a/x/tokenfactory/types/msgs_test.go b/x/tokenfactory/types/msgs_test.go index 6180a03cb..268a8e6f5 100644 --- a/x/tokenfactory/types/msgs_test.go +++ b/x/tokenfactory/types/msgs_test.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" "github.com/stretchr/testify/require" + "github.com/milkyway-labs/milkyway/app/params" "github.com/milkyway-labs/milkyway/x/tokenfactory/types" "github.com/cometbft/cometbft/crypto/ed25519" @@ -20,7 +21,6 @@ import ( authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" "github.com/cosmos/gogoproto/proto" - initiaappparams "github.com/initia-labs/initia/app/params" ) func testMessageAuthzSerialization(t *testing.T, msg sdk.Msg) { @@ -36,7 +36,7 @@ func testMessageAuthzSerialization(t *testing.T, msg sdk.Msg) { mockMsgExec authz.MsgExec ) - encodingConfig := initiaappparams.MakeEncodingConfig() + encodingConfig := params.MakeEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) legacyAmino := encodingConfig.Amino @@ -66,7 +66,6 @@ func testMessageAuthzSerialization(t *testing.T, msg sdk.Msg) { testSerDeser(&msgRevoke, &mockMsgRevoke) // Authz: Exec Msg - msgAny, err := codectypes.NewAnyWithValue(msg) require.NoError(t, err) @@ -144,7 +143,7 @@ func TestMsgCreateDenom(t *testing.T) { return msg }) - codec := initiaappparams.MakeEncodingConfig().Codec + codec := params.MakeEncodingConfig().Marshaler ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) signers, _, err := codec.GetMsgV1Signers(&msg) @@ -214,7 +213,7 @@ func TestMsgMint(t *testing.T) { msg := createMsg(func(msg types.MsgMint) types.MsgMint { return msg }) - codec := initiaappparams.MakeEncodingConfig().Codec + codec := params.MakeEncodingConfig().Marshaler ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) signers, _, err := codec.GetMsgV1Signers(&msg) @@ -284,7 +283,7 @@ func TestMsgBurn(t *testing.T) { ) // validate burn message was created as intended - codec := initiaappparams.MakeEncodingConfig().Codec + codec := params.MakeEncodingConfig().Marshaler ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) signers, _, err := codec.GetMsgV1Signers(baseMsg) @@ -362,7 +361,7 @@ func TestMsgChangeAdmin(t *testing.T) { ) // validate changeAdmin message was created as intended - codec := initiaappparams.MakeEncodingConfig().Codec + codec := params.MakeEncodingConfig().Marshaler ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) signers, _, err := codec.GetMsgV1Signers(baseMsg) @@ -471,7 +470,7 @@ func TestMsgSetDenomMetadata(t *testing.T) { ) // validate setDenomMetadata message was created as intended - codec := initiaappparams.MakeEncodingConfig().Codec + codec := params.MakeEncodingConfig().Marshaler ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) signers, _, err := codec.GetMsgV1Signers(baseMsg)