diff --git a/Makefile b/Makefile index 456545169..334c4097d 100644 --- a/Makefile +++ b/Makefile @@ -249,22 +249,29 @@ mockgen: ### Tests & Simulation ### ############################################################################### +include sims.mk + test: test-unit test-all: test-unit test-ledger-mock test-race test-cover +PACKAGES_UNIT=$(shell go list ./... | grep -v -e '/tests/e2e') +PACKAGES_E2E=$(shell cd tests/e2e && go list ./... | grep '/e2e') TEST_PACKAGES=./... -TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test-race test-ledger test-race +TEST_TARGETS := test-unit test-unit-cover test-race test-e2e # Test runs-specific rules. To add a new test target, just add # a new rule, customise ARGS or TEST_PACKAGES ad libitum, and # append the new rule to the TEST_TARGETS list. -test-unit: test_tags += cgo ledger test_ledger_mock norace -test-unit-amino: test_tags += ledger test_ledger_mock test_amino norace +test-unit: ARGS=-timeout=5m -tags='norace' +test-unit: TEST_PACKAGES=$(PACKAGES_UNIT) +test-unit-cover: ARGS=-timeout=5m -tags='norace' -coverprofile=coverage.txt -covermode=atomic +test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT) test-ledger: test_tags += cgo ledger norace test-ledger-mock: test_tags += ledger test_ledger_mock norace -test-race: test_tags += cgo ledger test_ledger_mock -test-race: ARGS=-race -test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION) +test-race: ARGS=-timeout=5m -race +test-race: TEST_PACKAGES=$(PACKAGES_UNIT) +test-e2e: ARGS=-timeout=35m -v +test-e2e: TEST_PACKAGES=$(PACKAGES_E2E) $(TEST_TARGETS): run-tests ARGS += -tags "$(test_tags)" @@ -273,12 +280,14 @@ CURRENT_DIR = $(shell pwd) run-tests: ifneq (,$(shell which tparse 2>/dev/null)) - go test -mod=readonly -json $(ARGS) $(TEST_PACKAGES) | tparse + @echo "--> Running tests" + @go test -mod=readonly -json $(ARGS) $(TEST_PACKAGES) | tparse else - go test -mod=readonly $(ARGS) $(TEST_PACKAGES) + @echo "--> Running tests" + @go test -mod=readonly $(ARGS) $(TEST_PACKAGES) endif -.PHONY: run-tests test test-all $(TEST_TARGETS) +.PHONY: run-tests $(TEST_TARGETS) ############################################################################### ### Benchmark ### @@ -310,3 +319,21 @@ format: find . -name '*.go' -type f -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name "*_mocks.go" -not -name '*.pb.go' -not -name '*.pulsar.go' | xargs misspell -w find . -name '*.go' -type f -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name "*_mocks.go" -not -name '*.pb.go' -not -name '*.pulsar.go' | xargs goimports -w -local github.com/milkyway-labs/milkyway .PHONY: format + +############################################################################### +### Localnet ### +############################################################################### + +start-localnet-ci: build + rm -rf ~/.milkywayd-liveness + ./build/milkywayd init liveness --chain-id liveness --home ~/.milkywayd-liveness + ./build/milkywayd config set client chain-id liveness --home ~/.milkywayd-liveness + ./build/milkywayd config set client keyring-backend test --home ~/.milkywayd-liveness + ./build/milkywayd keys add val --home ~/.milkywayd-liveness --keyring-backend test + ./build/milkywayd genesis add-genesis-account val 10000000000000000000000000stake --home ~/.milkywayd-liveness --keyring-backend test + ./build/milkywayd genesis gentx val 1000000000stake --home ~/.milkywayd-liveness --chain-id liveness --keyring-backend test + ./build/milkywayd genesis collect-gentxs --home ~/.milkywayd-liveness + sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0stake"/' ~/.milkywayd-liveness/config/app.toml + ./build/milkywayd start --home ~/.milkywayd-liveness --x-crisis-skip-assert-invariants + +.PHONY: start-localnet-ci \ No newline at end of file diff --git a/ante/ante.go b/ante/ante.go new file mode 100644 index 000000000..cf9a86fb5 --- /dev/null +++ b/ante/ante.go @@ -0,0 +1,110 @@ +package ante + +import ( + feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante" + feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" + + milkywayerrors "github.com/milkyway-labs/milkyway/types/errors" + + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + + corestoretypes "cosmossdk.io/core/store" + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + txsigning "cosmossdk.io/x/tx/signing" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" +) + +// UseFeeMarketDecorator to make the integration testing easier: we can switch off its ante and post decorators with this flag +var UseFeeMarketDecorator = true + +// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC +// channel keeper. +type HandlerOptions struct { + ExtensionOptionChecker ante.ExtensionOptionChecker + FeegrantKeeper ante.FeegrantKeeper + SignModeHandler *txsigning.HandlerMap + SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error + + AccountKeeper feemarketante.AccountKeeper + BankKeeper feemarketante.BankKeeper + Codec codec.BinaryCodec + IBCkeeper *ibckeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + FeeMarketKeeper *feemarketkeeper.Keeper + TxFeeChecker ante.TxFeeChecker + TXCounterStoreService corestoretypes.KVStoreService + WasmConfig *wasmtypes.WasmConfig +} + +func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { + if opts.AccountKeeper == nil { + return nil, errorsmod.Wrap(milkywayerrors.ErrLogic, "account keeper is required for AnteHandler") + } + if opts.BankKeeper == nil { + return nil, errorsmod.Wrap(milkywayerrors.ErrLogic, "bank keeper is required for AnteHandler") + } + if opts.SignModeHandler == nil { + return nil, errorsmod.Wrap(milkywayerrors.ErrLogic, "sign mode handler is required for AnteHandler") + } + if opts.IBCkeeper == nil { + return nil, errorsmod.Wrap(milkywayerrors.ErrLogic, "IBC keeper is required for AnteHandler") + } + if opts.FeeMarketKeeper == nil { + return nil, errorsmod.Wrap(milkywayerrors.ErrLogic, "FeeMarket keeper is required for AnteHandler") + } + + if opts.StakingKeeper == nil { + return nil, errorsmod.Wrap(milkywayerrors.ErrNotFound, "staking param store is required for AnteHandler") + } + + sigGasConsumer := opts.SigGasConsumer + if sigGasConsumer == nil { + sigGasConsumer = ante.DefaultSigVerificationGasConsumer + } + + anteDecorators := []sdk.AnteDecorator{ + ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first + wasmkeeper.NewLimitSimulationGasDecorator(opts.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early + wasmkeeper.NewCountTXDecorator(opts.TXCounterStoreService), + ante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker), + ante.NewValidateBasicDecorator(), + ante.NewTxTimeoutHeightDecorator(), + ante.NewValidateMemoDecorator(opts.AccountKeeper), + ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper), + NewGovVoteDecorator(opts.Codec, opts.StakingKeeper), + NewGovExpeditedProposalsDecorator(opts.Codec), + ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators + ante.NewValidateSigCountDecorator(opts.AccountKeeper), + ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer), + ante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler), + ante.NewIncrementSequenceDecorator(opts.AccountKeeper), + ibcante.NewRedundantRelayDecorator(opts.IBCkeeper), + } + + if UseFeeMarketDecorator { + anteDecorators = append(anteDecorators, + feemarketante.NewFeeMarketCheckDecorator( + opts.AccountKeeper, + opts.BankKeeper, + opts.FeegrantKeeper, + opts.FeeMarketKeeper, + ante.NewDeductFeeDecorator( + opts.AccountKeeper, + opts.BankKeeper, + opts.FeegrantKeeper, + opts.TxFeeChecker))) + } + + return sdk.ChainAnteDecorators(anteDecorators...), nil +} diff --git a/ante/gov_expedited_ante.go b/ante/gov_expedited_ante.go new file mode 100644 index 000000000..6d20b4eac --- /dev/null +++ b/ante/gov_expedited_ante.go @@ -0,0 +1,80 @@ +package ante + +import ( + errorsmod "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + + milkywayerrors "github.com/milkyway-labs/milkyway/types/errors" +) + +var expeditedPropDecoratorEnabled = true + +// SetExpeditedProposalsEnabled toggles the expedited proposals decorator on/off. +// Should only be used in testing - this is to allow simtests to pass. +func SetExpeditedProposalsEnabled(val bool) { + expeditedPropDecoratorEnabled = val +} + +var expeditedPropsWhitelist = map[string]struct{}{ + "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade": {}, + "/cosmos.upgrade.v1beta1.MsgCancelUpgrade": {}, +} + +// Check if the proposal is whitelisted for expedited voting. +type GovExpeditedProposalsDecorator struct { + cdc codec.BinaryCodec +} + +func NewGovExpeditedProposalsDecorator(cdc codec.BinaryCodec) GovExpeditedProposalsDecorator { + return GovExpeditedProposalsDecorator{ + cdc: cdc, + } +} + +// AnteHandle checks if the proposal is whitelisted for expedited voting. +// Only proposals submitted using "milkywayd tx gov submit-proposal" can be expedited. +// Legacy proposals submitted using "milkywayd tx gov submit-legacy-proposal" cannot be marked as expedited. +func (g GovExpeditedProposalsDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if expeditedPropDecoratorEnabled { + for _, msg := range tx.GetMsgs() { + prop, ok := msg.(*govv1.MsgSubmitProposal) + if !ok { + continue + } + if prop.Expedited { + if err := g.validateExpeditedGovProp(prop); err != nil { + return ctx, err + } + } + } + } + return next(ctx, tx, simulate) +} + +func (g GovExpeditedProposalsDecorator) isWhitelisted(msgType string) bool { + _, ok := expeditedPropsWhitelist[msgType] + return ok +} + +func (g GovExpeditedProposalsDecorator) validateExpeditedGovProp(prop *govv1.MsgSubmitProposal) error { + msgs := prop.GetMessages() + if len(msgs) == 0 { + return milkywayerrors.ErrInvalidExpeditedProposal + } + for _, message := range msgs { + // in case of legacy content submitted using govv1.MsgSubmitProposal + if sdkMsg, isLegacy := message.GetCachedValue().(*govv1.MsgExecLegacyContent); isLegacy { + if !g.isWhitelisted(sdkMsg.Content.TypeUrl) { + return errorsmod.Wrapf(milkywayerrors.ErrInvalidExpeditedProposal, "invalid Msg type: %s", sdkMsg.Content.TypeUrl) + } + continue + } + if !g.isWhitelisted(message.TypeUrl) { + return errorsmod.Wrapf(milkywayerrors.ErrInvalidExpeditedProposal, "invalid Msg type: %s", message.TypeUrl) + } + } + return nil +} diff --git a/ante/gov_expedited_ante_test.go b/ante/gov_expedited_ante_test.go new file mode 100644 index 000000000..bfe87a16f --- /dev/null +++ b/ante/gov_expedited_ante_test.go @@ -0,0 +1,218 @@ +package ante_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "cosmossdk.io/math" + upgradetypes "cosmossdk.io/x/upgrade/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + + "github.com/milkyway-labs/milkyway/ante" + "github.com/milkyway-labs/milkyway/app/helpers" +) + +func TestGovExpeditedProposalsDecorator(t *testing.T) { + milkyWayApp := helpers.Setup(t) + + testCases := []struct { + name string + ctx sdk.Context + msgs []sdk.Msg + expectErr bool + }{ + // these cases should pass + { + name: "expedited - govv1.MsgSubmitProposal - MsgSoftwareUpgrade", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&upgradetypes.MsgSoftwareUpgrade{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Plan: upgradetypes.Plan{ + Name: "upgrade plan-plan", + Info: "some text here", + Height: 123456789, + }, + }}, true), + }, + expectErr: false, + }, + { + name: "expedited - govv1.MsgSubmitProposal - MsgCancelUpgrade", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&upgradetypes.MsgCancelUpgrade{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + }}, true), + }, + expectErr: false, + }, + { + name: "normal - govv1.MsgSubmitProposal - TextProposal", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newLegacyTextProp(false), // normal + }, + expectErr: false, + }, + { + name: "normal - govv1.MsgSubmitProposal - MsgCommunityPoolSpend", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&distrtypes.MsgCommunityPoolSpend{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Recipient: sdk.AccAddress{}.String(), + Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(100))), + }}, false), // normal + }, + expectErr: false, + }, + { + name: "normal - govv1.MsgSubmitProposal - MsgTransfer", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&banktypes.MsgSend{ + FromAddress: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + ToAddress: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(100))), + }}, false), // normal + }, + expectErr: false, + }, + { + name: "normal - govv1.MsgSubmitProposal - MsgUpdateParams", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&banktypes.MsgUpdateParams{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + }}, false), + }, + expectErr: false, + }, + // legacy proposals - antehandler should not affect them + // submitted using "milkywayd tx gov submit-legacy-proposal" + { + name: "normal - govv1beta.MsgSubmitProposal - LegacySoftwareUpgrade", + ctx: sdk.Context{}, + msgs: []sdk.Msg{newGovV1BETA1LegacyUpgradeProp()}, + expectErr: false, + }, + { + name: "normal - govv1beta.MsgSubmitProposal - LegacyCancelSoftwareUpgrade", + ctx: sdk.Context{}, + msgs: []sdk.Msg{newGovV1BETA1LegacyCancelUpgradeProp()}, + expectErr: false, + }, + // these cases should fail + // these are normal proposals, not whitelisted for expedited voting + { + name: "fail - expedited - govv1.MsgSubmitProposal - Empty", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{}, true), + }, + expectErr: true, + }, + { + name: "fail - expedited - govv1.MsgSubmitProposal - TextProposal", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newLegacyTextProp(true), // expedite + }, + expectErr: true, + }, + { + name: "fail - expedited - govv1.MsgSubmitProposal - MsgCommunityPoolSpend", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&distrtypes.MsgCommunityPoolSpend{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Recipient: sdk.AccAddress{}.String(), + Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(100))), + }}, true), + }, + expectErr: true, + }, + { + name: "fail - expedited - govv1.MsgSubmitProposal - MsgTransfer", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&banktypes.MsgSend{ + FromAddress: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + ToAddress: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Amount: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(100))), + }}, true), + }, + expectErr: true, + }, + { + name: "fail - expedited - govv1.MsgSubmitProposal - MsgUpdateParams", + ctx: sdk.Context{}, + msgs: []sdk.Msg{ + newGovProp([]sdk.Msg{&banktypes.MsgUpdateParams{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + }}, true), + }, + expectErr: true, + }, + } + + for _, tc := range testCases { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + txCfg := milkyWayApp.GetTxConfig() + decorator := ante.NewGovExpeditedProposalsDecorator(milkyWayApp.AppCodec()) + + txBuilder := txCfg.NewTxBuilder() + require.NoError(t, txBuilder.SetMsgs(tc.msgs...)) + + _, err := decorator.AnteHandle(tc.ctx, txBuilder.GetTx(), false, + func(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) { return ctx, nil }) + if tc.expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func newLegacyTextProp(expedite bool) *govv1.MsgSubmitProposal { + testProposal := govv1beta1.NewTextProposal("Proposal", "Test as normal proposal") + msgContent, err := govv1.NewLegacyContent(testProposal, "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn") + if err != nil { + return nil + } + return newGovProp([]sdk.Msg{msgContent}, expedite) +} + +func newGovV1BETA1LegacyUpgradeProp() *govv1beta1.MsgSubmitProposal { + legacyContent := upgradetypes.NewSoftwareUpgradeProposal("test legacy upgrade", "test legacy upgrade", upgradetypes.Plan{ + Name: "upgrade plan-plan", + Info: "some text here", + Height: 123456789, + }) + + msg, _ := govv1beta1.NewMsgSubmitProposal(legacyContent, sdk.NewCoins(), sdk.AccAddress{}) + return msg +} + +func newGovV1BETA1LegacyCancelUpgradeProp() *govv1beta1.MsgSubmitProposal { + legacyContent := upgradetypes.NewCancelSoftwareUpgradeProposal("test legacy upgrade", "test legacy upgrade") + + msg, _ := govv1beta1.NewMsgSubmitProposal(legacyContent, sdk.NewCoins(), sdk.AccAddress{}) + return msg +} + +func newGovProp(msgs []sdk.Msg, expedite bool) *govv1.MsgSubmitProposal { + msg, _ := govv1.NewMsgSubmitProposal(msgs, sdk.NewCoins(), sdk.AccAddress{}.String(), "", "expedite", "expedite", expedite) + // fmt.Println("### msg ###", msg, "err", err) + return msg +} diff --git a/ante/gov_vote_ante.go b/ante/gov_vote_ante.go new file mode 100644 index 000000000..45bf2a247 --- /dev/null +++ b/ante/gov_vote_ante.go @@ -0,0 +1,145 @@ +package ante + +import ( + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + milkywayerrors "github.com/milkyway-labs/milkyway/types/errors" +) + +var ( + minStakedTokens = math.LegacyNewDec(1000000) // 1_000_000 uatom (or 1 atom) + maxDelegationsChecked = 100 // number of delegation to check for the minStakedTokens +) + +// SetMinStakedTokens sets the minimum amount of staked tokens required to vote +// Should only be used in testing +func SetMinStakedTokens(tokens math.LegacyDec) { + minStakedTokens = tokens +} + +type GovVoteDecorator struct { + stakingKeeper *stakingkeeper.Keeper + cdc codec.BinaryCodec +} + +func NewGovVoteDecorator(cdc codec.BinaryCodec, stakingKeeper *stakingkeeper.Keeper) GovVoteDecorator { + return GovVoteDecorator{ + stakingKeeper: stakingKeeper, + cdc: cdc, + } +} + +func (g GovVoteDecorator) AnteHandle( + ctx sdk.Context, tx sdk.Tx, + simulate bool, next sdk.AnteHandler, +) (newCtx sdk.Context, err error) { + // do not run check during simulations + if simulate { + return next(ctx, tx, simulate) + } + + msgs := tx.GetMsgs() + if err = g.ValidateVoteMsgs(ctx, msgs); err != nil { + return ctx, err + } + + return next(ctx, tx, simulate) +} + +// ValidateVoteMsgs checks if a voter has enough stake to vote +func (g GovVoteDecorator) ValidateVoteMsgs(ctx sdk.Context, msgs []sdk.Msg) error { + validMsg := func(m sdk.Msg) error { + var accAddr sdk.AccAddress + var err error + + switch msg := m.(type) { + case *govv1beta1.MsgVote: + accAddr, err = sdk.AccAddressFromBech32(msg.Voter) + if err != nil { + return err + } + case *govv1.MsgVote: + accAddr, err = sdk.AccAddressFromBech32(msg.Voter) + if err != nil { + return err + } + default: + // not a vote message - nothing to validate + return nil + } + + if minStakedTokens.IsZero() { + return nil + } + + enoughStake := false + delegationCount := 0 + stakedTokens := math.LegacyNewDec(0) + err = g.stakingKeeper.IterateDelegatorDelegations(ctx, accAddr, func(delegation stakingtypes.Delegation) bool { + validatorAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) // shouldn't happen + } + validator, err := g.stakingKeeper.GetValidator(ctx, validatorAddr) + if err == nil { + shares := delegation.Shares + tokens := validator.TokensFromSharesTruncated(shares) + stakedTokens = stakedTokens.Add(tokens) + if stakedTokens.GTE(minStakedTokens) { + enoughStake = true + return true // break the iteration + } + } + delegationCount++ + // break the iteration if maxDelegationsChecked were already checked + return delegationCount >= maxDelegationsChecked + }) + if err != nil { + return err + } + + if !enoughStake { + return errorsmod.Wrapf(milkywayerrors.ErrInsufficientStake, "insufficient stake for voting - min required %v", minStakedTokens) + } + + return nil + } + + validAuthz := func(execMsg *authz.MsgExec) error { + for _, v := range execMsg.Msgs { + var innerMsg sdk.Msg + if err := g.cdc.UnpackAny(v, &innerMsg); err != nil { + return errorsmod.Wrap(milkywayerrors.ErrUnauthorized, "cannot unmarshal authz exec msgs") + } + if err := validMsg(innerMsg); err != nil { + return err + } + } + + return nil + } + + for _, m := range msgs { + if msg, ok := m.(*authz.MsgExec); ok { + if err := validAuthz(msg); err != nil { + return err + } + continue + } + + // validate normal msgs + if err := validMsg(m); err != nil { + return err + } + } + return nil +} diff --git a/ante/gov_vote_ante_test.go b/ante/gov_vote_ante_test.go new file mode 100644 index 000000000..31cac555b --- /dev/null +++ b/ante/gov_vote_ante_test.go @@ -0,0 +1,273 @@ +package ante_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + + "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/milkyway-labs/milkyway/ante" + "github.com/milkyway-labs/milkyway/app/helpers" +) + +// Test that the GovVoteDecorator rejects v1beta1 vote messages from accounts with less than 1 atom staked +// Submitting v1beta1.VoteMsg should not be possible through the CLI, but it's still possible to craft a transaction +func TestVoteSpamDecoratorGovV1Beta1(t *testing.T) { + milkyWayApp := helpers.Setup(t) + ctx := milkyWayApp.NewUncachedContext(true, tmproto.Header{}) + decorator := ante.NewGovVoteDecorator(milkyWayApp.AppCodec(), milkyWayApp.StakingKeeper) + stakingKeeper := milkyWayApp.StakingKeeper + + // Get validator + validators, err := stakingKeeper.GetAllValidators(ctx) + require.NoError(t, err) + valAddr1, err := stakingKeeper.ValidatorAddressCodec().StringToBytes(validators[0].GetOperator()) + require.NoError(t, err) + valAddr1 = sdk.ValAddress(valAddr1) + + // Create one more validator + pk := ed25519.GenPrivKeyFromSecret([]byte{uint8(13)}).PubKey() + validator2, err := stakingtypes.NewValidator( + sdk.ValAddress(pk.Address()).String(), + pk, + stakingtypes.Description{}, + ) + require.NoError(t, err) + valAddr2, err := stakingKeeper.ValidatorAddressCodec().StringToBytes(validator2.GetOperator()) + valAddr2 = sdk.ValAddress(valAddr2) + require.NoError(t, err) + // Make sure the validator is bonded so it's not removed on Undelegate + validator2.Status = stakingtypes.Bonded + err = stakingKeeper.SetValidator(ctx, validator2) + require.NoError(t, err) + err = stakingKeeper.SetValidatorByConsAddr(ctx, validator2) + require.NoError(t, err) + err = stakingKeeper.SetNewValidatorByPowerIndex(ctx, validator2) + require.NoError(t, err) + err = stakingKeeper.Hooks().AfterValidatorCreated(ctx, valAddr2) + require.NoError(t, err) + + // Get delegator (this account was created during setup) + addr, err := milkyWayApp.AccountKeeper.Accounts.Indexes.Number.MatchExact(ctx, 0) + require.NoError(t, err) + delegator, err := sdk.AccAddressFromBech32(addr.String()) + require.NoError(t, err) + + tests := []struct { + name string + bondAmt math.Int + validators []sdk.ValAddress + expectPass bool + }{ + { + name: "delegate 0 atom", + bondAmt: math.ZeroInt(), + validators: []sdk.ValAddress{valAddr1}, + expectPass: false, + }, + { + name: "delegate 0.1 atom", + bondAmt: math.NewInt(100000), + validators: []sdk.ValAddress{valAddr1}, + expectPass: false, + }, + { + name: "delegate 1 atom", + bondAmt: math.NewInt(1000000), + validators: []sdk.ValAddress{valAddr1}, + expectPass: true, + }, + { + name: "delegate 1 atom to two validators", + bondAmt: math.NewInt(1000000), + validators: []sdk.ValAddress{valAddr1, valAddr2}, + expectPass: true, + }, + { + name: "delegate 0.9 atom to two validators", + bondAmt: math.NewInt(900000), + validators: []sdk.ValAddress{valAddr1, valAddr2}, + expectPass: false, + }, + { + name: "delegate 10 atom", + bondAmt: math.NewInt(10000000), + validators: []sdk.ValAddress{valAddr1}, + expectPass: true, + }, + } + + for _, tc := range tests { + // Unbond all tokens for this delegator + delegations, err := stakingKeeper.GetAllDelegatorDelegations(ctx, delegator) + require.NoError(t, err) + for _, del := range delegations { + valAddr, err := sdk.ValAddressFromBech32(del.GetValidatorAddr()) + require.NoError(t, err) + _, _, err = stakingKeeper.Undelegate(ctx, delegator, valAddr, del.GetShares()) + require.NoError(t, err) + } + + // Delegate tokens + if !tc.bondAmt.IsZero() { + amt := tc.bondAmt.Quo(math.NewInt(int64(len(tc.validators)))) + for _, valAddr := range tc.validators { + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) + _, err = stakingKeeper.Delegate(ctx, delegator, amt, stakingtypes.Unbonded, val, true) + require.NoError(t, err) + } + } + + // Create vote message + msg := govv1beta1.NewMsgVote( + delegator, + 0, + govv1beta1.OptionYes, + ) + + // Validate vote message + err = decorator.ValidateVoteMsgs(ctx, []sdk.Msg{msg}) + if tc.expectPass { + require.NoError(t, err, "expected %v to pass", tc.name) + } else { + require.Error(t, err, "expected %v to fail", tc.name) + } + } +} + +// Test that the GovVoteDecorator rejects v1 vote messages from accounts with less than 1 atom staked +// Usually, only v1.VoteMsg can be submitted using the CLI. +func TestVoteSpamDecoratorGovV1(t *testing.T) { + milkyWayApp := helpers.Setup(t) + ctx := milkyWayApp.NewUncachedContext(true, tmproto.Header{}) + decorator := ante.NewGovVoteDecorator(milkyWayApp.AppCodec(), milkyWayApp.StakingKeeper) + stakingKeeper := milkyWayApp.StakingKeeper + + // Get validator + validators, err := stakingKeeper.GetAllValidators(ctx) + require.NoError(t, err) + valAddr1, err := stakingKeeper.ValidatorAddressCodec().StringToBytes(validators[0].GetOperator()) + require.NoError(t, err) + valAddr1 = sdk.ValAddress(valAddr1) + + // Create one more validator + pk := ed25519.GenPrivKeyFromSecret([]byte{uint8(13)}).PubKey() + validator2, err := stakingtypes.NewValidator( + sdk.ValAddress(pk.Address()).String(), + pk, + stakingtypes.Description{}, + ) + require.NoError(t, err) + valAddr2, err := stakingKeeper.ValidatorAddressCodec().StringToBytes(validator2.GetOperator()) + require.NoError(t, err) + valAddr2 = sdk.ValAddress(valAddr2) + // Make sure the validator is bonded so it's not removed on Undelegate + validator2.Status = stakingtypes.Bonded + err = stakingKeeper.SetValidator(ctx, validator2) + require.NoError(t, err) + err = stakingKeeper.SetValidatorByConsAddr(ctx, validator2) + require.NoError(t, err) + err = stakingKeeper.SetNewValidatorByPowerIndex(ctx, validator2) + require.NoError(t, err) + err = stakingKeeper.Hooks().AfterValidatorCreated(ctx, valAddr2) + require.NoError(t, err) + + // Get delegator (this account was created during setup) + addr, err := milkyWayApp.AccountKeeper.Accounts.Indexes.Number.MatchExact(ctx, 0) + require.NoError(t, err) + delegator, err := sdk.AccAddressFromBech32(addr.String()) + require.NoError(t, err) + + tests := []struct { + name string + bondAmt math.Int + validators []sdk.ValAddress + expectPass bool + }{ + { + name: "delegate 0 atom", + bondAmt: math.ZeroInt(), + validators: []sdk.ValAddress{valAddr1}, + expectPass: false, + }, + { + name: "delegate 0.1 atom", + bondAmt: math.NewInt(100000), + validators: []sdk.ValAddress{valAddr1}, + expectPass: false, + }, + { + name: "delegate 1 atom", + bondAmt: math.NewInt(1000000), + validators: []sdk.ValAddress{valAddr1}, + expectPass: true, + }, + { + name: "delegate 1 atom to two validators", + bondAmt: math.NewInt(1000000), + validators: []sdk.ValAddress{valAddr1, valAddr2}, + expectPass: true, + }, + { + name: "delegate 0.9 atom to two validators", + bondAmt: math.NewInt(900000), + validators: []sdk.ValAddress{valAddr1, valAddr2}, + expectPass: false, + }, + { + name: "delegate 10 atom", + bondAmt: math.NewInt(10000000), + validators: []sdk.ValAddress{valAddr1}, + expectPass: true, + }, + } + + for _, tc := range tests { + // Unbond all tokens for this delegator + delegations, err := stakingKeeper.GetAllDelegatorDelegations(ctx, delegator) + require.NoError(t, err) + for _, del := range delegations { + valAddr, err := sdk.ValAddressFromBech32(del.GetValidatorAddr()) + require.NoError(t, err) + _, _, err = stakingKeeper.Undelegate(ctx, delegator, valAddr, del.GetShares()) + require.NoError(t, err) + } + + // Delegate tokens + if !tc.bondAmt.IsZero() { + amt := tc.bondAmt.Quo(math.NewInt(int64(len(tc.validators)))) + for _, valAddr := range tc.validators { + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) + _, err = stakingKeeper.Delegate(ctx, delegator, amt, stakingtypes.Unbonded, val, true) + require.NoError(t, err) + } + } + + // Create vote message + msg := govv1.NewMsgVote( + delegator, + 0, + govv1.VoteOption_VOTE_OPTION_YES, + "new-v1-vote-message-test", + ) + + // Validate vote message + err = decorator.ValidateVoteMsgs(ctx, []sdk.Msg{msg}) + if tc.expectPass { + require.NoError(t, err, "expected %v to pass", tc.name) + } else { + require.Error(t, err, "expected %v to fail", tc.name) + } + } +} diff --git a/app/abci/abci_extensions.go b/app/abci/abci_extensions.go new file mode 100644 index 000000000..f3375f73c --- /dev/null +++ b/app/abci/abci_extensions.go @@ -0,0 +1,167 @@ +package abci + +import ( + "context" + "fmt" + "time" + + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/skip-mev/connect/v2/abci/strategies/aggregator" + oracleconfig "github.com/skip-mev/connect/v2/oracle/config" + "github.com/skip-mev/connect/v2/pkg/math/voteweighted" + oracleclient "github.com/skip-mev/connect/v2/service/clients/oracle" + servicemetrics "github.com/skip-mev/connect/v2/service/metrics" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/skip-mev/connect/v2/abci/proposals" + compression "github.com/skip-mev/connect/v2/abci/strategies/codec" + "github.com/skip-mev/connect/v2/abci/strategies/currencypair" + "github.com/skip-mev/connect/v2/abci/ve" + + oraclepreblock "github.com/skip-mev/connect/v2/abci/preblock/oracle" + + "github.com/milkyway-labs/milkyway/app/keepers" +) + +type SetupData struct { + ChainID string + Logger log.Logger + Keepers keepers.AppKeepers + ModuleManager *module.Manager + OracleConfig oracleconfig.AppConfig +} + +type ExtensionsData struct { + OracleClient oracleclient.OracleClient + + PrepareProposalHandler sdk.PrepareProposalHandler + ProposalHandler sdk.PrepareProposalHandler + ProcessProposalHandler sdk.ProcessProposalHandler + PreBlockHandler sdk.PreBlocker + + ExtendVoteHandler sdk.ExtendVoteHandler + VerifyVoteExtensionHandler sdk.VerifyVoteExtensionHandler +} + +// initializeOracle initializes the oracle client and metrics. +func initializeOracle(chainID string, cfg oracleconfig.AppConfig, logger log.Logger) (oracleclient.OracleClient, servicemetrics.Metrics, error) { + // If app level instrumentation is enabled, then wrap the oracle service with a metrics client + // to get metrics on the oracle service (for ABCI++). This will allow the instrumentation to track + // latency in VerifyVoteExtension requests and more. + oracleMetrics, err := servicemetrics.NewMetricsFromConfig(cfg, chainID) + if err != nil { + return nil, nil, err + } + + // Create the oracle service. + oracleClient, err := oracleclient.NewPriceDaemonClientFromConfig( + cfg, + logger.With("client", "oracle"), + oracleMetrics, + ) + if err != nil { + return nil, nil, err + } + + // Connect to the oracle service (default timeout of 5 seconds). + go func() { + logger.Info("attempting to start oracle client...", "address", cfg.OracleAddress) + if err := oracleClient.Start(context.Background()); err != nil { + logger.Error("failed to start oracle client", "err", err) + panic(err) + } + }() + + return oracleClient, oracleMetrics, nil +} + +func InitializeOracleABCIExtensions(data SetupData) ExtensionsData { + // Initialize the oracle client and metrics + oracleClient, oracleMetrics, err := initializeOracle(data.ChainID, data.OracleConfig, data.Logger) + if err != nil { + panic(fmt.Errorf("failed to initialize oracle client and metrics: %w", err)) + } + + // Create the proposal handler that will be used to fill proposals with + // transactions and oracle data. + proposalHandler := proposals.NewProposalHandler( + data.Logger, + baseapp.NoOpPrepareProposal(), + baseapp.NoOpProcessProposal(), + ve.NewDefaultValidateVoteExtensionsFn(data.Keepers.StakingKeeper), + compression.NewCompressionVoteExtensionCodec( + compression.NewDefaultVoteExtensionCodec(), + compression.NewZLibCompressor(), + ), + compression.NewCompressionExtendedCommitCodec( + compression.NewDefaultExtendedCommitCodec(), + compression.NewZStdCompressor(), + ), + currencypair.NewDeltaCurrencyPairStrategy(data.Keepers.OracleKeeper), + oracleMetrics, + ) + + // Create the aggregation function that will be used to aggregate oracle data + // from each validator. + aggregatorFn := voteweighted.MedianFromContext( + data.Logger, + data.Keepers.StakingKeeper, + voteweighted.DefaultPowerThreshold, + ) + veCodec := compression.NewCompressionVoteExtensionCodec( + compression.NewDefaultVoteExtensionCodec(), + compression.NewZLibCompressor(), + ) + ecCodec := compression.NewCompressionExtendedCommitCodec( + compression.NewDefaultExtendedCommitCodec(), + compression.NewZStdCompressor(), + ) + + // Create the pre-finalize block hook that will be used to apply oracle data + // to the state before any transactions are executed (in finalize block). + oraclePreBlockHandler := oraclepreblock.NewOraclePreBlockHandler( + data.Logger, + aggregatorFn, + data.Keepers.OracleKeeper, + oracleMetrics, + currencypair.NewDeltaCurrencyPairStrategy(data.Keepers.OracleKeeper), // IMPORTANT: always construct new currency pair strategy objects when functions require them as arguments. + veCodec, + ecCodec, + ) + + // Create the vote extensions handler that will be used to extend and verify + // vote extensions (i.e. oracle data). + voteExtensionsHandler := ve.NewVoteExtensionHandler( + data.Logger, + oracleClient, + time.Second, // timeout + currencypair.NewDeltaCurrencyPairStrategy(data.Keepers.OracleKeeper), // IMPORTANT: always construct new currency pair strategy objects when functions require them as arguments. + veCodec, + aggregator.NewOraclePriceApplier( + aggregator.NewDefaultVoteAggregator( + data.Logger, + aggregatorFn, + // we need a separate price strategy here, so that we can optimistically apply the latest prices + // and extend our vote based on these prices + currencypair.NewDeltaCurrencyPairStrategy(data.Keepers.OracleKeeper), // IMPORTANT: always construct new currency pair strategy objects when functions require them as arguments. + ), + data.Keepers.OracleKeeper, + veCodec, + ecCodec, + data.Logger, + ), + oracleMetrics, + ) + + return ExtensionsData{ + OracleClient: oracleClient, + PrepareProposalHandler: proposalHandler.PrepareProposalHandler(), + ProcessProposalHandler: proposalHandler.ProcessProposalHandler(), + ProposalHandler: proposalHandler.PrepareProposalHandler(), + PreBlockHandler: oraclePreBlockHandler.WrappedPreBlocker(data.ModuleManager), + ExtendVoteHandler: voteExtensionsHandler.ExtendVoteHandler(), + VerifyVoteExtensionHandler: voteExtensionsHandler.VerifyVoteExtensionHandler(), + } +} diff --git a/app/ante/ante.go b/app/ante/ante.go deleted file mode 100644 index de1af74d2..000000000 --- a/app/ante/ante.go +++ /dev/null @@ -1,131 +0,0 @@ -package ante - -import ( - corestoretypes "cosmossdk.io/core/store" - errorsmod "cosmossdk.io/errors" - txsigning "cosmossdk.io/x/tx/signing" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - - opchildante "github.com/initia-labs/OPinit/x/opchild/ante" - opchildtypes "github.com/initia-labs/OPinit/x/opchild/types" - "github.com/initia-labs/initia/app/ante/accnum" - - "github.com/skip-mev/block-sdk/v2/block" - auctionante "github.com/skip-mev/block-sdk/v2/x/auction/ante" - auctionkeeper "github.com/skip-mev/block-sdk/v2/x/auction/keeper" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" -) - -// HandlerOptions extends the SDK's AnteHandler options by requiring the IBC -// channel keeper. -type HandlerOptions struct { - ante.HandlerOptions - Codec codec.BinaryCodec - IBCkeeper *ibckeeper.Keeper - OPChildKeeper opchildtypes.AnteKeeper - AuctionKeeper auctionkeeper.Keeper - TxEncoder sdk.TxEncoder - MevLane auctionante.MEVLane - FreeLane block.Lane - - // wasm ante options - WasmKeeper *wasmkeeper.Keeper - WasmConfig *wasmtypes.WasmConfig - TXCounterStoreService corestoretypes.KVStoreService -} - -// NewAnteHandler returns an AnteHandler that checks and increments sequence -// numbers, checks signatures & account numbers, and deducts fees from the first -// signer. -func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { - if options.AccountKeeper == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder") - } - - if options.BankKeeper == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder") - } - - if options.SignModeHandler == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") - } - - if options.WasmConfig == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder") - } - - if options.WasmKeeper == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm keeper is required for ante builder") - } - - if options.TXCounterStoreService == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm store service is required for ante builder") - } - - sigGasConsumer := options.SigGasConsumer - if sigGasConsumer == nil { - sigGasConsumer = ante.DefaultSigVerificationGasConsumer - } - - txFeeChecker := options.TxFeeChecker - if txFeeChecker == nil { - txFeeChecker = opchildante.NewMempoolFeeChecker(options.OPChildKeeper).CheckTxFeeWithMinGasPrices - } - - freeLaneFeeChecker := func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) { - // skip fee checker if the tx is free lane tx. - if !options.FreeLane.Match(ctx, tx) { - return txFeeChecker(ctx, tx) - } - - // return fee without fee check - feeTx, ok := tx.(sdk.FeeTx) - if !ok { - return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") - } - - return feeTx.GetFee(), 1 /* FIFO */, nil - } - - anteDecorators := []sdk.AnteDecorator{ - accnum.NewAccountNumberDecorator(options.AccountKeeper), - ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first - ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), - // NOTE - WASM simulation gas limit can affect other module messages. - wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), - wasmkeeper.NewCountTXDecorator(options.TXCounterStoreService), - wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()), - ante.NewValidateBasicDecorator(), - ante.NewTxTimeoutHeightDecorator(), - ante.NewValidateMemoDecorator(options.AccountKeeper), - ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), - ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, freeLaneFeeChecker), - // SetPubKeyDecorator must be called before all signature verification decorators - ante.NewSetPubKeyDecorator(options.AccountKeeper), - ante.NewValidateSigCountDecorator(options.AccountKeeper), - ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), - ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), - ante.NewIncrementSequenceDecorator(options.AccountKeeper), - ibcante.NewRedundantRelayDecorator(options.IBCkeeper), - auctionante.NewAuctionDecorator(options.AuctionKeeper, options.TxEncoder, options.MevLane), - } - - return sdk.ChainAnteDecorators(anteDecorators...), nil -} - -func CreateAnteHandlerForOPinit(ak ante.AccountKeeper, signModeHandler *txsigning.HandlerMap) sdk.AnteHandler { - return sdk.ChainAnteDecorators( - ante.NewSetPubKeyDecorator(ak), - ante.NewValidateSigCountDecorator(ak), - ante.NewSigGasConsumeDecorator(ak, ante.DefaultSigVerificationGasConsumer), - ante.NewSigVerificationDecorator(ak, signModeHandler), - ante.NewIncrementSequenceDecorator(ak), - ) -} diff --git a/app/app.go b/app/app.go index 215eb5d0c..d6320b5e1 100644 --- a/app/app.go +++ b/app/app.go @@ -1,30 +1,25 @@ -package app +package milkyway import ( + "context" "fmt" "io" "net/http" "os" "path/filepath" - "slices" - "strings" - - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" - "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/core/address" + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/feegrant" - feegrantkeeper "cosmossdk.io/x/feegrant/keeper" - feegrantmodule "cosmossdk.io/x/feegrant/module" - "cosmossdk.io/x/upgrade" - upgradekeeper "cosmossdk.io/x/upgrade/keeper" + "cosmossdk.io/x/tx/signing" upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" tmos "github.com/cometbft/cometbft/libs/os" @@ -32,10 +27,10 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" @@ -44,1165 +39,220 @@ import ( "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/msgservice" + sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth" - cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante" authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/authz" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" "github.com/cosmos/cosmos-sdk/x/crisis" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/group" - groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/gogoproto/proto" + ibctesting "github.com/cosmos/ibc-go/v8/testing" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + "github.com/gorilla/mux" + "github.com/rakyll/statik/fs" + oracleconfig "github.com/skip-mev/connect/v2/oracle/config" + oracleclient "github.com/skip-mev/connect/v2/service/clients/oracle" + feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" + "github.com/spf13/cast" - // ibc imports - "github.com/Stride-Labs/ibc-rate-limiting/ratelimit" - ratelimitkeeper "github.com/Stride-Labs/ibc-rate-limiting/ratelimit/keeper" - ratelimittypes "github.com/Stride-Labs/ibc-rate-limiting/ratelimit/types" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" - packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" - packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - ibctransfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - - // initia imports - - appheaderinfo "github.com/initia-labs/initia/app/header_info" - initialanes "github.com/initia-labs/initia/app/lanes" - "github.com/initia-labs/initia/app/params" - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - ibchookskeeper "github.com/initia-labs/initia/x/ibc-hooks/keeper" - ibchookstypes "github.com/initia-labs/initia/x/ibc-hooks/types" - ibctestingtypes "github.com/initia-labs/initia/x/ibc/testing/types" - icaauth "github.com/initia-labs/initia/x/intertx" - icaauthkeeper "github.com/initia-labs/initia/x/intertx/keeper" - icaauthtypes "github.com/initia-labs/initia/x/intertx/types" - - // OPinit imports - "github.com/initia-labs/OPinit/x/opchild" - opchildkeeper "github.com/initia-labs/OPinit/x/opchild/keeper" - opchildlanes "github.com/initia-labs/OPinit/x/opchild/lanes" - opchildtypes "github.com/initia-labs/OPinit/x/opchild/types" - - // skip imports - mevabci "github.com/skip-mev/block-sdk/v2/abci" - blockchecktx "github.com/skip-mev/block-sdk/v2/abci/checktx" - signer_extraction "github.com/skip-mev/block-sdk/v2/adapters/signer_extraction_adapter" - "github.com/skip-mev/block-sdk/v2/block" - blockbase "github.com/skip-mev/block-sdk/v2/block/base" - mevlane "github.com/skip-mev/block-sdk/v2/lanes/mev" - "github.com/skip-mev/block-sdk/v2/x/auction" - auctionante "github.com/skip-mev/block-sdk/v2/x/auction/ante" - auctionkeeper "github.com/skip-mev/block-sdk/v2/x/auction/keeper" - auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types" - "github.com/skip-mev/connect/v2/x/marketmap" - marketmapkeeper "github.com/skip-mev/connect/v2/x/marketmap/keeper" - marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" - "github.com/skip-mev/connect/v2/x/oracle" - oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper" - oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" - - // CosmWasm imports - "github.com/CosmWasm/wasmd/x/wasm" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - // local imports - appante "github.com/milkyway-labs/milkyway/app/ante" - ibcwasmhooks "github.com/milkyway-labs/milkyway/app/ibc-hooks" - appkeepers "github.com/milkyway-labs/milkyway/app/keepers" + milkywayante "github.com/milkyway-labs/milkyway/ante" + milkywayabci "github.com/milkyway-labs/milkyway/app/abci" + "github.com/milkyway-labs/milkyway/app/keepers" "github.com/milkyway-labs/milkyway/app/upgrades" - "github.com/milkyway-labs/milkyway/utils" - "github.com/milkyway-labs/milkyway/x/assets" - assetskeeper "github.com/milkyway-labs/milkyway/x/assets/keeper" - assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" - "github.com/milkyway-labs/milkyway/x/bank" - bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" - "github.com/milkyway-labs/milkyway/x/epochs" - epochskeeper "github.com/milkyway-labs/milkyway/x/epochs/keeper" - epochstypes "github.com/milkyway-labs/milkyway/x/epochs/types" - "github.com/milkyway-labs/milkyway/x/icacallbacks" - icacallbackskeeper "github.com/milkyway-labs/milkyway/x/icacallbacks/keeper" - icacallbackstypes "github.com/milkyway-labs/milkyway/x/icacallbacks/types" - "github.com/milkyway-labs/milkyway/x/interchainquery" - icqkeeper "github.com/milkyway-labs/milkyway/x/interchainquery/keeper" - icqtypes "github.com/milkyway-labs/milkyway/x/interchainquery/types" - "github.com/milkyway-labs/milkyway/x/liquidvesting" - liquidvestinghooks "github.com/milkyway-labs/milkyway/x/liquidvesting/hooks" - liquidvestingkeeper "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" - liquidvestingtypes "github.com/milkyway-labs/milkyway/x/liquidvesting/types" - "github.com/milkyway-labs/milkyway/x/operators" - operatorskeeper "github.com/milkyway-labs/milkyway/x/operators/keeper" - operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" - "github.com/milkyway-labs/milkyway/x/pools" - poolskeeper "github.com/milkyway-labs/milkyway/x/pools/keeper" - poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" - "github.com/milkyway-labs/milkyway/x/records" - recordskeeper "github.com/milkyway-labs/milkyway/x/records/keeper" - recordstypes "github.com/milkyway-labs/milkyway/x/records/types" - "github.com/milkyway-labs/milkyway/x/restaking" - restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper" - restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" - "github.com/milkyway-labs/milkyway/x/rewards" - rewardskeeper "github.com/milkyway-labs/milkyway/x/rewards/keeper" - rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" - "github.com/milkyway-labs/milkyway/x/services" - serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper" - servicestypes "github.com/milkyway-labs/milkyway/x/services/types" - "github.com/milkyway-labs/milkyway/x/stakeibc" - stakeibckeeper "github.com/milkyway-labs/milkyway/x/stakeibc/keeper" - stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" - "github.com/milkyway-labs/milkyway/x/tokenfactory" - tokenfactorykeeper "github.com/milkyway-labs/milkyway/x/tokenfactory/keeper" - tokenfactorytypes "github.com/milkyway-labs/milkyway/x/tokenfactory/types" - - // noble forwarding keeper - "github.com/noble-assets/forwarding/v2/x/forwarding" - forwardingkeeper "github.com/noble-assets/forwarding/v2/x/forwarding/keeper" - forwardingtypes "github.com/noble-assets/forwarding/v2/x/forwarding/types" - - // kvindexer - indexer "github.com/initia-labs/kvindexer" - indexerconfig "github.com/initia-labs/kvindexer/config" - blocksubmodule "github.com/initia-labs/kvindexer/submodules/block" - "github.com/initia-labs/kvindexer/submodules/tx" - nft "github.com/initia-labs/kvindexer/submodules/wasm-nft" - pair "github.com/initia-labs/kvindexer/submodules/wasm-pair" - indexermodule "github.com/initia-labs/kvindexer/x/kvindexer" - indexerkeeper "github.com/initia-labs/kvindexer/x/kvindexer/keeper" - - // unnamed import of statik for swagger UI support _ "github.com/milkyway-labs/milkyway/client/docs/statik" + liquidvestingtypes "github.com/milkyway-labs/milkyway/x/liquidvesting/types" ) var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - ModuleBasics = module.NewBasicManager( - auth.AppModule{}, - bank.AppModule{}, - crisis.AppModule{}, - opchild.AppModule{}, - capability.AppModule{}, - feegrantmodule.AppModule{}, - upgrade.AppModule{}, - authzmodule.AppModule{}, - groupmodule.AppModule{}, - consensus.AppModule{}, - wasm.AppModule{}, - auction.AppModule{}, - tokenfactory.AppModule{}, - // ibc modules - ibc.AppModule{}, - ibctransfer.AppModule{}, - ica.AppModule{}, - icaauth.AppModule{}, - ibcfee.AppModule{}, - ibctm.AppModule{}, - solomachine.AppModule{}, - packetforward.AppModule{}, - ibchooks.AppModule{}, - forwarding.AppModule{}, - ratelimit.AppModule{}, - // connect modules - oracle.AppModule{}, - marketmap.AppModule{}, - // liquid staking modules - stakeibc.AppModule{}, - epochs.AppModule{}, - interchainquery.AppModule{}, - records.AppModule{}, - icacallbacks.AppModule{}, - // custom modules - services.AppModule{}, - operators.AppModule{}, - pools.AppModule{}, - restaking.AppModule{}, - assets.AppModule{}, - rewards.AppModule{}, - liquidvesting.AppModule{}, - ) - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - icatypes.ModuleName: nil, - ibcfeetypes.ModuleName: nil, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - // x/auction's module account must be instantiated upon genesis to accrue auction rewards not - // distributed to proposers - auctiontypes.ModuleName: nil, - opchildtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - icqtypes.ModuleName: nil, - stakeibctypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - stakeibctypes.RewardCollectorName: nil, - rewardstypes.RewardsPoolName: nil, - - // connect oracle permissions - oracletypes.ModuleName: nil, - - // MilkyWay permissions - liquidvestingtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - - // this is only for testing - authtypes.Minter: {authtypes.Minter}, - } + Upgrades []upgrades.Upgrade ) -var _ servertypes.Application = (*MilkyWayApp)(nil) - -func init() { - userHomeDir, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+AppName) -} +var ( + _ runtime.AppI = (*MilkyWayApp)(nil) + _ servertypes.Application = (*MilkyWayApp)(nil) + _ ibctesting.TestingApp = (*MilkyWayApp)(nil) +) // MilkyWayApp extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. type MilkyWayApp struct { *baseapp.BaseApp + keepers.AppKeepers legacyAmino *codec.LegacyAmino appCodec codec.Codec txConfig client.TxConfig interfaceRegistry types.InterfaceRegistry - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - memKeys map[string]*storetypes.MemoryStoreKey - - // keepers - // TODO: add gov keeper - AccountKeeper *authkeeper.AccountKeeper - BankKeeper *bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - GroupKeeper *groupkeeper.Keeper - ConsensusParamsKeeper *consensusparamkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - TransferKeeper *ibctransferkeeper.Keeper - AuthzKeeper *authzkeeper.Keeper - FeeGrantKeeper *feegrantkeeper.Keeper - ICAHostKeeper *icahostkeeper.Keeper - ICAControllerKeeper *icacontrollerkeeper.Keeper - ICAAuthKeeper *icaauthkeeper.Keeper - IBCFeeKeeper *ibcfeekeeper.Keeper - WasmKeeper *wasmkeeper.Keeper - OPChildKeeper *opchildkeeper.Keeper - AuctionKeeper *auctionkeeper.Keeper // x/auction keeper used to process bids for POB auctions - PacketForwardKeeper *packetforwardkeeper.Keeper - OracleKeeper *oraclekeeper.Keeper // x/oracle keeper used for the connect oracle - MarketMapKeeper *marketmapkeeper.Keeper - TokenFactoryKeeper *tokenfactorykeeper.Keeper - IBCHooksKeeper *ibchookskeeper.Keeper - ForwardingKeeper *forwardingkeeper.Keeper - RateLimitKeeper ratelimitkeeper.Keeper - - EpochsKeeper epochskeeper.Keeper - InterchainQueryKeeper icqkeeper.Keeper - ICACallbacksKeeper icacallbackskeeper.Keeper - RecordsKeeper recordskeeper.Keeper - StakeIBCKeeper stakeibckeeper.Keeper - - ServicesKeeper *serviceskeeper.Keeper - OperatorsKeeper *operatorskeeper.Keeper - PoolsKeeper *poolskeeper.Keeper - RestakingKeeper *restakingkeeper.Keeper - AssetsKeeper *assetskeeper.Keeper - RewardsKeeper *rewardskeeper.Keeper - LiquidVestingKeeper *liquidvestingkeeper.Keeper - - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAAuthKeeper capabilitykeeper.ScopedKeeper - ScopedWasmKeeper capabilitykeeper.ScopedKeeper - ScopedFetchPriceKeeper capabilitykeeper.ScopedKeeper + invCheckPeriod uint + + // external fields + oracleClient oracleclient.OracleClient // the module manager - ModuleManager *module.Manager - BasicModuleManager module.BasicManager + mm *module.Manager + ModuleBasics module.BasicManager // the configurator + sm *module.SimulationManager configurator module.Configurator +} - // Override of BaseApp's CheckTx - checkTxHandler blockchecktx.CheckTx +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } - // kvindexer - indexerKeeper *indexerkeeper.Keeper - indexerModule indexermodule.AppModuleBasic + DefaultNodeHome = filepath.Join(userHomeDir, "."+appName) } // NewMilkyWayApp returns a reference to an initialized Initia. func NewMilkyWayApp( logger log.Logger, db dbm.DB, - kvindexerDB dbm.DB, traceStore io.Writer, loadLatest bool, - wasmOpts []wasmkeeper.Option, + skipUpgradeHeights map[int64]bool, + homePath string, + oracleConfig oracleconfig.AppConfig, appOpts servertypes.AppOptions, + wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *MilkyWayApp { - // load the configs - mempoolTxs := cast.ToInt(appOpts.Get(server.FlagMempoolMaxTxs)) - queryGasLimit := cast.ToInt(appOpts.Get(server.FlagQueryGasLimit)) + legacyAmino := codec.NewLegacyAmino() + interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { + panic(err) + } - logger.Info("mempool max txs", "max_txs", mempoolTxs) - logger.Info("query gas limit", "gas_limit", queryGasLimit) + encodingCfg := MakeEncodingConfig() + appCodec := encodingCfg.Marshaler + txConfig := encodingCfg.TxConfig - encodingConfig := params.MakeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + std.RegisterLegacyAminoCodec(legacyAmino) + std.RegisterInterfaces(interfaceRegistry) - appCodec := encodingConfig.Codec - legacyAmino := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - txConfig := encodingConfig.TxConfig + // App Opts + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) + invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) + + bApp := baseapp.NewBaseApp( + appName, + logger, + db, + txConfig.TxDecoder(), + baseAppOptions..., + ) - bApp := baseapp.NewBaseApp(AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) bApp.SetTxEncoder(txConfig.TxEncoder()) - keys := storetypes.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, group.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, - ibcexported.StoreKey, upgradetypes.StoreKey, ibctransfertypes.StoreKey, - capabilitytypes.StoreKey, authzkeeper.StoreKey, feegrant.StoreKey, - icahosttypes.StoreKey, icacontrollertypes.StoreKey, icaauthtypes.StoreKey, - ibcfeetypes.StoreKey, wasmtypes.StoreKey, opchildtypes.StoreKey, - auctiontypes.StoreKey, packetforwardtypes.StoreKey, oracletypes.StoreKey, - tokenfactorytypes.StoreKey, ibchookstypes.StoreKey, forwardingtypes.StoreKey, - marketmaptypes.StoreKey, - ratelimittypes.StoreKey, epochstypes.StoreKey, icqtypes.StoreKey, - icacallbackstypes.StoreKey, recordstypes.StoreKey, stakeibctypes.StoreKey, - - // Custom modules - servicestypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey, restakingtypes.StoreKey, - assetstypes.StoreKey, rewardstypes.StoreKey, liquidvestingtypes.StoreKey, - ) - tkeys := storetypes.NewTransientStoreKeys(forwardingtypes.TransientStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - - // register streaming services - if err := bApp.RegisterStreamingServices(appOpts, keys); err != nil { - panic(err) - } - app := &MilkyWayApp{ BaseApp: bApp, legacyAmino: legacyAmino, - appCodec: appCodec, txConfig: txConfig, + appCodec: appCodec, interfaceRegistry: interfaceRegistry, - keys: keys, - tkeys: tkeys, - memKeys: memKeys, - } - - ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) - vc := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) - cc := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) - - authorityAccAddr := authtypes.NewModuleAddress(opchildtypes.ModuleName) - authorityAddr, err := ac.BytesToString(authorityAccAddr) - if err != nil { - panic(err) + invCheckPeriod: invCheckPeriod, } - // set the BaseApp's parameter store - consensusParamsKeeper := consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authorityAddr, runtime.EventService{}) - app.ConsensusParamsKeeper = &consensusParamsKeeper - bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - - // grant capabilities for the ibc and ibc-transfer modules - app.ScopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - app.ScopedTransferKeeper = app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - app.ScopedICAHostKeeper = app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - app.ScopedICAControllerKeeper = app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - app.ScopedICAAuthKeeper = app.CapabilityKeeper.ScopeToModule(icaauthtypes.ModuleName) - app.ScopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) - app.CapabilityKeeper.Seal() - - // add keepers - app.WasmKeeper = &wasmkeeper.Keeper{} - - accountKeeper := authkeeper.NewAccountKeeper( - appCodec, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), - authtypes.ProtoBaseAccount, - maccPerms, - ac, - sdk.GetConfig().GetBech32AccountAddrPrefix(), - authorityAddr, - ) - app.AccountKeeper = &accountKeeper - - bankKeeper := bankkeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), - app.AccountKeeper, - BlacklistedModuleAccountAddrs(), - authorityAddr, - logger, - ) - app.BankKeeper = &bankKeeper - - communityPoolKeeper := appkeepers.NewCommunityPoolKeeper(app.BankKeeper, authtypes.FeeCollectorName) - - invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) - app.CrisisKeeper = crisiskeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[crisistypes.StoreKey]), - invCheckPeriod, - app.BankKeeper, - authtypes.FeeCollectorName, - authorityAddr, - app.AccountKeeper.AddressCodec(), - ) - - //////////////////////////////// - // OPChildKeeper Configuration // - //////////////////////////////// - - // initialize oracle keeper - marketMapKeeper := marketmapkeeper.NewKeeper( - runtime.NewKVStoreService(keys[marketmaptypes.StoreKey]), - appCodec, - authorityAccAddr, - ) - app.MarketMapKeeper = marketMapKeeper - - oracleKeeper := oraclekeeper.NewKeeper( - runtime.NewKVStoreService(keys[oracletypes.StoreKey]), - appCodec, - marketMapKeeper, - authorityAccAddr, - ) - app.OracleKeeper = &oracleKeeper - - // Add the oracle keeper as a hook to market map keeper so new market map entries can be created - // and propogated to the oracle keeper. - app.MarketMapKeeper.SetHooks(app.OracleKeeper.Hooks()) + moduleAccountAddresses := ModuleAccountAddrs() - app.OPChildKeeper = opchildkeeper.NewKeeper( + // Setup keepers + app.AppKeepers = keepers.NewAppKeeper( appCodec, - runtime.NewKVStoreService(keys[opchildtypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - app.OracleKeeper, - appante.CreateAnteHandlerForOPinit(app.AccountKeeper, txConfig.SignModeHandler()), - txConfig.TxDecoder(), - app.MsgServiceRouter(), - authorityAddr, - ac, - vc, - cc, - logger, - ) - - err = app.RegisterExecutorChangePlans() - if err != nil { - panic(err) - } - - // get skipUpgradeHeights from the app options - skipUpgradeHeights := map[int64]bool{} - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - homePath := cast.ToString(appOpts.Get(flags.FlagHome)) - app.UpgradeKeeper = upgradekeeper.NewKeeper( + bApp, + legacyAmino, + MaccPerms, + BlockedModuleAccountAddrs(moduleAccountAddresses), skipUpgradeHeights, - runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), - appCodec, homePath, - app.BaseApp, - authorityAddr, - ) - - feeGrantKeeper := feegrantkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), app.AccountKeeper) - app.FeeGrantKeeper = &feeGrantKeeper - - authzKeeper := authzkeeper.NewKeeper(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.BaseApp.MsgServiceRouter(), app.AccountKeeper) - app.AuthzKeeper = &authzKeeper - - groupConfig := group.DefaultConfig() - groupKeeper := groupkeeper.NewKeeper( - keys[group.StoreKey], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - groupConfig, - ) - app.GroupKeeper = &groupKeeper - - // Create IBC Keeper - app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, - keys[ibcexported.StoreKey], - nil, // we don't need migration - app.OPChildKeeper, - app.UpgradeKeeper, - app.ScopedIBCKeeper, - authorityAddr, - ) - - app.IBCKeeper.ClientKeeper.WithPostUpdateHandler( - app.OPChildKeeper.UpdateHostValidatorSet, - ) - - ibcFeeKeeper := ibcfeekeeper.NewKeeper( - appCodec, - keys[ibcfeetypes.StoreKey], - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - ) - app.IBCFeeKeeper = &ibcFeeKeeper - - app.IBCHooksKeeper = ibchookskeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[ibchookstypes.StoreKey]), - authorityAddr, - ac, - ) - - app.ForwardingKeeper = forwardingkeeper.NewKeeper( - appCodec, + invCheckPeriod, logger, - runtime.NewKVStoreService(keys[forwardingtypes.StoreKey]), - runtime.NewTransientStoreService(tkeys[forwardingtypes.TransientStoreKey]), - appheaderinfo.NewHeaderInfoService(), - runtime.ProvideEventService(), - authorityAddr, - app.AccountKeeper, - app.BankKeeper, - app.IBCKeeper.ChannelKeeper, - app.TransferKeeper, - ) - app.BankKeeper.AppendSendRestriction(app.ForwardingKeeper.SendRestrictionFn) - - app.RateLimitKeeper = *ratelimitkeeper.NewKeeper( - appCodec, - keys[ratelimittypes.StoreKey], - authorityAddr, - app.BankKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCFeeKeeper, - ) - - // Custom modules - app.ServicesKeeper = serviceskeeper.NewKeeper( - app.appCodec, - keys[servicestypes.StoreKey], - runtime.NewKVStoreService(keys[servicestypes.StoreKey]), - app.AccountKeeper, - communityPoolKeeper, - authorityAddr, - ) - app.OperatorsKeeper = operatorskeeper.NewKeeper( - app.appCodec, - keys[operatorstypes.StoreKey], - runtime.NewKVStoreService(keys[operatorstypes.StoreKey]), - app.AccountKeeper, - communityPoolKeeper, - authorityAddr, - ) - app.PoolsKeeper = poolskeeper.NewKeeper( - app.appCodec, - keys[poolstypes.StoreKey], - runtime.NewKVStoreService(keys[poolstypes.StoreKey]), - app.AccountKeeper, - ) - app.RestakingKeeper = restakingkeeper.NewKeeper( - app.appCodec, - keys[restakingtypes.StoreKey], - runtime.NewKVStoreService(keys[restakingtypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - app.PoolsKeeper, - app.OperatorsKeeper, - app.ServicesKeeper, - authorityAddr, - ) - app.OperatorsKeeper.SetHooks(app.RestakingKeeper.OperatorsHooks()) - app.ServicesKeeper.SetHooks(app.RestakingKeeper.ServicesHooks()) - - app.AssetsKeeper = assetskeeper.NewKeeper( - app.appCodec, - runtime.NewKVStoreService(keys[assetstypes.StoreKey]), - authorityAddr, - ) - app.RewardsKeeper = rewardskeeper.NewKeeper( - app.appCodec, - runtime.NewKVStoreService(keys[rewardstypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - communityPoolKeeper, - app.OracleKeeper, - app.PoolsKeeper, - app.OperatorsKeeper, - app.ServicesKeeper, - app.RestakingKeeper, - app.AssetsKeeper, - authorityAddr, - ) - app.RestakingKeeper.SetHooks(app.RewardsKeeper.Hooks()) - - app.LiquidVestingKeeper = liquidvestingkeeper.NewKeeper( - app.appCodec, - keys[liquidvestingtypes.StoreKey], - runtime.NewKVStoreService(keys[liquidvestingtypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - app.OperatorsKeeper, - app.PoolsKeeper, - app.ServicesKeeper, - app.RestakingKeeper, - authtypes.NewModuleAddress(liquidvestingtypes.ModuleName).String(), - authorityAddr, - ) - app.BankKeeper.AppendSendRestriction(app.LiquidVestingKeeper.SendRestrictionFn) - - hooksICS4Wrapper := ibchooks.NewICS4Middleware( - app.RateLimitKeeper, - ibcwasmhooks.NewWasmHooks(appCodec, ac, app.WasmKeeper), - ) - - hooksICS4LiquidVesting := ibchooks.NewICS4Middleware( - hooksICS4Wrapper, - liquidvestinghooks.NewIBCHooks(app.LiquidVestingKeeper), - ) - - app.InterchainQueryKeeper = icqkeeper.NewKeeper(appCodec, keys[icqtypes.StoreKey], app.IBCKeeper) - - app.ICACallbacksKeeper = *icacallbackskeeper.NewKeeper( - appCodec, - keys[icacallbackstypes.StoreKey], - keys[icacallbackstypes.MemStoreKey], - *app.IBCKeeper, - ) - - //////////////////////////// - // Transfer configuration // - //////////////////////////// - // Send : transfer -> packet forward -> wasm -> fee -> channel - // Receive: channel -> fee -> wasm -> packet forward -> forwarding -> transfer - - var transferStack porttypes.IBCModule - { - packetForwardKeeper := &packetforwardkeeper.Keeper{} - - // Create Transfer Keepers - transferKeeper := ibctransferkeeper.NewKeeper( - appCodec, - keys[ibctransfertypes.StoreKey], - nil, // we don't need migration - // ics4wrapper: transfer -> packet forward - packetForwardKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - app.ScopedTransferKeeper, - authorityAddr, - ) - app.TransferKeeper = &transferKeeper - transferStack = ibctransfer.NewIBCModule(*app.TransferKeeper) - - // forwarding middleware - transferStack = forwarding.NewMiddleware( - // receive: forwarding -> transfer - transferStack, - app.AccountKeeper, - app.ForwardingKeeper, - ) - - // create packet forward middleware - *packetForwardKeeper = *packetforwardkeeper.NewKeeper( - appCodec, - keys[packetforwardtypes.StoreKey], - app.TransferKeeper, - app.IBCKeeper.ChannelKeeper, - communityPoolKeeper, - app.BankKeeper, - // ics4wrapper: transfer -> packet forward -> fee - hooksICS4Wrapper, // TODO: is it correct? - authorityAddr, - ) - app.PacketForwardKeeper = packetForwardKeeper - transferStack = packetforward.NewIBCMiddleware( - // receive: packet forward -> forwarding -> transfer - transferStack, - app.PacketForwardKeeper, - 0, - packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, - packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, - ) - - // create wasm middleware for transfer - transferStack = ibchooks.NewIBCMiddleware( - // receive: wasm -> packet forward -> forwarding -> transfer - transferStack, - hooksICS4Wrapper, - app.IBCHooksKeeper, - ) - - transferStack = ibchooks.NewIBCMiddleware( - // receive: liquidvesting -> wasm -> packet forward -> forwarding -> transfer - transferStack, - hooksICS4LiquidVesting, - app.IBCHooksKeeper, - ) - - transferStack = ratelimit.NewIBCMiddleware(app.RateLimitKeeper, transferStack) - - app.RecordsKeeper = *recordskeeper.NewKeeper( - appCodec, - keys[recordstypes.StoreKey], - keys[recordstypes.MemStoreKey], - app.AccountKeeper, - *app.TransferKeeper, - *app.IBCKeeper, - app.ICACallbacksKeeper, - ) - transferStack = records.NewIBCModule(app.RecordsKeeper, transferStack) - - // create ibcfee middleware for transfer - transferStack = ibcfee.NewIBCMiddleware( - // receive: fee -> wasm -> packet forward -> forwarding -> transfer - transferStack, - // ics4wrapper: transfer -> packet forward -> wasm -> fee -> channel - *app.IBCFeeKeeper, - ) - } - - /////////////////////// - // ICA configuration // - /////////////////////// - - var icaHostStack porttypes.IBCModule - var icaControllerStack porttypes.IBCModule - var icaCallbacksStack porttypes.IBCModule - { - icaHostKeeper := icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], - nil, // we don't need migration - app.IBCFeeKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.ScopedICAHostKeeper, - app.MsgServiceRouter(), - authorityAddr, - ) - icaHostKeeper.WithQueryRouter(bApp.GRPCQueryRouter()) - app.ICAHostKeeper = &icaHostKeeper - - icaControllerKeeper := icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], - nil, // we don't need migration - app.IBCFeeKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.ScopedICAControllerKeeper, - app.MsgServiceRouter(), - authorityAddr, - ) - app.ICAControllerKeeper = &icaControllerKeeper - - icaAuthKeeper := icaauthkeeper.NewKeeper( - appCodec, - *app.ICAControllerKeeper, - app.ScopedICAAuthKeeper, - ac, - ) - app.ICAAuthKeeper = &icaAuthKeeper - - icaHostIBCModule := icahost.NewIBCModule(*app.ICAHostKeeper) - icaHostStack = ibcfee.NewIBCMiddleware(icaHostIBCModule, *app.IBCFeeKeeper) - - icaAuthIBCModule := icaauth.NewIBCModule(*app.ICAAuthKeeper) - icaControllerIBCModule := icacontroller.NewIBCMiddleware(icaAuthIBCModule, *app.ICAControllerKeeper) - icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerIBCModule, *app.IBCFeeKeeper) - - icaCallbacksStack = icacallbacks.NewIBCModule(app.ICACallbacksKeeper) - - app.StakeIBCKeeper = stakeibckeeper.NewKeeper( - appCodec, - keys[stakeibctypes.StoreKey], - keys[stakeibctypes.MemStoreKey], - runtime.NewKVStoreService(keys[stakeibctypes.StoreKey]), - authorityAddr, - app.AccountKeeper, - app.BankKeeper, - *app.ICAControllerKeeper, - *app.IBCKeeper, - app.InterchainQueryKeeper, - app.RecordsKeeper, - app.ICACallbacksKeeper, - app.RateLimitKeeper, - app.OPChildKeeper, - ) - app.StakeIBCKeeper.SetHooks(stakeibctypes.NewMultiStakeIBCHooks()) - icaCallbacksStack = stakeibc.NewIBCMiddleware(icaCallbacksStack, app.StakeIBCKeeper) - icaCallbacksStack = icacontroller.NewIBCMiddleware(icaCallbacksStack, *app.ICAControllerKeeper) - icaCallbacksStack = ibcfee.NewIBCMiddleware(icaCallbacksStack, *app.IBCFeeKeeper) - } - - ////////////////////////////// - // Wasm IBC Configuration // - ////////////////////////////// - - var wasmIBCStack porttypes.IBCModule - { - wasmIBCModule := wasm.NewIBCHandler( - app.WasmKeeper, - app.IBCKeeper.ChannelKeeper, - // ics4wrapper: wasm -> fee - app.IBCFeeKeeper, - ) - - // create wasm middleware for wasm IBC stack - hookMiddleware := ibchooks.NewIBCMiddleware( - // receive: hook -> wasm - wasmIBCModule, - hooksICS4Wrapper, // TODO: is it correct? - app.IBCHooksKeeper, - ) - - wasmIBCStack = ibcfee.NewIBCMiddleware( - // receive: fee -> hook -> wasm - hookMiddleware, - *app.IBCFeeKeeper, - ) - } - - ////////////////////////////// - // IBC router Configuration // - ////////////////////////////// - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack). - // TODO: add ica callbacks stack - AddRoute(icahosttypes.SubModuleName, icaHostStack). - AddRoute(icacontrollertypes.SubModuleName, icaCallbacksStack). - AddRoute(icaauthtypes.ModuleName, icaControllerStack). - AddRoute(wasmtypes.ModuleName, wasmIBCStack) - - app.IBCKeeper.SetRouter(ibcRouter) - - epochsKeeper := epochskeeper.NewKeeper(appCodec, keys[epochstypes.StoreKey]) - app.EpochsKeeper = *epochsKeeper.SetHooks( - epochstypes.NewMultiEpochHooks( - app.StakeIBCKeeper.Hooks(), - ), + appOpts, + wasmOpts, ) - // Register ICQ callbacks - err = app.InterchainQueryKeeper.SetCallbackHandler(stakeibctypes.ModuleName, app.StakeIBCKeeper.ICQCallbackHandler()) - if err != nil { - panic(err) - } + // NOTE: Any module instantiated in the module manager that is later modified + // must be passed by reference here. + app.mm = module.NewManager(appModules(app, appCodec, txConfig, skipGenesisInvariants)...) + app.ModuleBasics = newBasicManagerFromManager(app) - // Register IBC callbacks - if err := app.ICACallbacksKeeper.SetICACallbacks( - app.StakeIBCKeeper.Callbacks(), - app.RecordsKeeper.Callbacks(), - ); err != nil { - panic(err) - } + enabledSignModes := append([]sigtypes.SignMode(nil), authtx.DefaultSignModes...) + enabledSignModes = append(enabledSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) - ////////////////////////////// - // WasmKeeper Configuration // - ////////////////////////////// - wasmDir := filepath.Join(homePath, "wasm") - wasmConfig, err := wasm.ReadWasmConfig(appOpts) - if err != nil { - panic(fmt.Sprintf("error while reading wasm config: %s", err)) + txConfigOpts := authtx.ConfigOptions{ + EnabledSignModes: enabledSignModes, + TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper), } - - // allow connect queries - queryAllowlist := make(map[string]proto.Message) - queryAllowlist["/connect.oracle.v2.Query/GetAllCurrencyPairs"] = &oracletypes.GetAllCurrencyPairsResponse{} - queryAllowlist["/connect.oracle.v2.Query/GetPrice"] = &oracletypes.GetPriceResponse{} - queryAllowlist["/connect.oracle.v2.Query/GetPrices"] = &oracletypes.GetPricesResponse{} - queryAllowlist["/milkyway.operators.v1.Query/Operator"] = &operatorstypes.QueryOperatorResponse{} - queryAllowlist["/milkyway.restaking.v1.Query/ServiceOperators"] = &restakingtypes.QueryServiceOperatorsResponse{} - - // use accept list stargate querier - wasmOpts = append(wasmOpts, wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ - Stargate: wasmkeeper.AcceptListStargateQuerier(queryAllowlist, app.GRPCQueryRouter(), appCodec), - })) - - // The last arguments can contain custom message handlers, and custom query handlers, - // if we want to allow any custom callbacks - *app.WasmKeeper = wasmkeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - // we do not support staking feature, so don't need to provide these keepers - nil, - nil, - app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.ScopedWasmKeeper, - app.TransferKeeper, - app.MsgServiceRouter(), - app.GRPCQueryRouter(), - wasmDir, - wasmConfig, - slices.DeleteFunc(wasmkeeper.BuiltInCapabilities(), func(s string) bool { - return s == "staking" - }), - authorityAddr, - wasmOpts..., - ) - - // x/auction module keeper initialization - - // initialize the keeper - auctionKeeper := auctionkeeper.NewKeeperWithRewardsAddressProvider( - app.appCodec, - app.keys[auctiontypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - opchildlanes.NewRewardsAddressProvider(authtypes.FeeCollectorName), - authorityAddr, - ) - app.AuctionKeeper = &auctionKeeper - - contractKeeper := wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper) - - tokenfactoryKeeper := tokenfactorykeeper.NewKeeper( - ac, + txConfig, err = authtx.NewTxConfigWithOptions( appCodec, - runtime.NewKVStoreService(keys[tokenfactorytypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - communityPoolKeeper, - authorityAddr, - ) - app.TokenFactoryKeeper = &tokenfactoryKeeper - app.TokenFactoryKeeper.SetContractKeeper(contractKeeper) - - app.BankKeeper.SetHooks(app.TokenFactoryKeeper.Hooks()) - - /**** Module Options ****/ - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - // NOTE: Any module instantiated in the module manager that is later modified - // must be passed by reference here. - - app.ModuleManager = module.NewManager( - auth.NewAppModule(appCodec, *app.AccountKeeper, nil, nil), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, nil), - crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, nil), - opchild.NewAppModule(appCodec, app.OPChildKeeper), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, *app.FeeGrantKeeper, app.interfaceRegistry), - upgrade.NewAppModule(app.UpgradeKeeper, ac), - authzmodule.NewAppModule(appCodec, *app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - groupmodule.NewAppModule(appCodec, *app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - consensus.NewAppModule(appCodec, *app.ConsensusParamsKeeper), - wasm.NewAppModule(appCodec, app.WasmKeeper, nil /* unused */, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), nil), - auction.NewAppModule(app.appCodec, *app.AuctionKeeper), - tokenfactory.NewAppModule(appCodec, app.TokenFactoryKeeper, *app.AccountKeeper, *app.BankKeeper), - // ibc modules - ibc.NewAppModule(app.IBCKeeper), - ibctransfer.NewAppModule(*app.TransferKeeper), - ica.NewAppModule(app.ICAControllerKeeper, app.ICAHostKeeper), - icaauth.NewAppModule(appCodec, *app.ICAAuthKeeper), - ibcfee.NewAppModule(*app.IBCFeeKeeper), - ibctm.NewAppModule(), - solomachine.NewAppModule(), - packetforward.NewAppModule(app.PacketForwardKeeper, nil), - ibchooks.NewAppModule(appCodec, *app.IBCHooksKeeper), - forwarding.NewAppModule(app.ForwardingKeeper), - ratelimit.NewAppModule(appCodec, app.RateLimitKeeper), - // connect modules - oracle.NewAppModule(appCodec, *app.OracleKeeper), - marketmap.NewAppModule(appCodec, app.MarketMapKeeper), - // liquid staking modules - stakeibc.NewAppModule(appCodec, app.StakeIBCKeeper, app.AccountKeeper, app.BankKeeper), - epochs.NewAppModule(appCodec, app.EpochsKeeper), - interchainquery.NewAppModule(appCodec, app.InterchainQueryKeeper), - records.NewAppModule(appCodec, app.RecordsKeeper, app.AccountKeeper, app.BankKeeper), - icacallbacks.NewAppModule(appCodec, app.ICACallbacksKeeper, app.AccountKeeper, app.BankKeeper), - // custom modules - services.NewAppModule(appCodec, app.ServicesKeeper, app.PoolsKeeper), - operators.NewAppModule(appCodec, app.OperatorsKeeper), - pools.NewAppModule(appCodec, app.PoolsKeeper), - restaking.NewAppModule(appCodec, app.RestakingKeeper), - assets.NewAppModule(appCodec, app.AssetsKeeper), - rewards.NewAppModule(appCodec, app.RewardsKeeper), - liquidvesting.NewAppModule(appCodec, app.LiquidVestingKeeper), + txConfigOpts, ) - - if err := app.setupIndexer(kvindexerDB, appOpts, ac, vc, appCodec); err != nil { + if err != nil { panic(err) } - - // BasicModuleManager defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration and genesis verification. - // By default it is composed of all the module from the module manager. - // Additionally, app module basics can be overwritten by passing them as argument. - app.BasicModuleManager = module.NewBasicManagerFromManager( - app.ModuleManager, - map[string]module.AppModuleBasic{ - genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - }) - app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) - app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + app.txConfig = txConfig // NOTE: upgrade module is required to be prioritized - app.ModuleManager.SetOrderPreBlockers( + app.mm.SetOrderPreBlockers( upgradetypes.ModuleName, ) - // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, - opchildtypes.ModuleName, - authz.ModuleName, - ibcexported.ModuleName, - oracletypes.ModuleName, - marketmaptypes.ModuleName, - stakeibctypes.ModuleName, - epochstypes.ModuleName, - ratelimittypes.ModuleName, - - rewardstypes.ModuleName, - servicestypes.ModuleName, - operatorstypes.ModuleName, - poolstypes.ModuleName, - restakingtypes.ModuleName, - ) + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + // Tell the app's module manager how to set the order of BeginBlockers, which are run at the beginning of every block. + app.mm.SetOrderBeginBlockers(orderBeginBlockers()...) - app.ModuleManager.SetOrderEndBlockers( - crisistypes.ModuleName, - opchildtypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - oracletypes.ModuleName, - marketmaptypes.ModuleName, - forwardingtypes.ModuleName, - stakeibctypes.ModuleName, - icqtypes.ModuleName, - ratelimittypes.ModuleName, - - servicestypes.ModuleName, - operatorstypes.ModuleName, - poolstypes.ModuleName, - restakingtypes.ModuleName, - liquidvestingtypes.ModuleName, - ) + app.mm.SetOrderEndBlockers(orderEndBlockers()...) // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. // NOTE: Capability module must occur first so that it can initialize any capabilities // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. - genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, - opchildtypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, group.ModuleName, - upgradetypes.ModuleName, feegrant.ModuleName, consensusparamtypes.ModuleName, - ibcexported.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, - icaauthtypes.ModuleName, ibcfeetypes.ModuleName, auctiontypes.ModuleName, - wasmtypes.ModuleName, oracletypes.ModuleName, marketmaptypes.ModuleName, - packetforwardtypes.ModuleName, tokenfactorytypes.ModuleName, - ibchookstypes.ModuleName, forwardingtypes.ModuleName, - stakeibctypes.ModuleName, epochstypes.ModuleName, icqtypes.ModuleName, - recordstypes.ModuleName, ratelimittypes.ModuleName, icacallbackstypes.ModuleName, - - servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, restakingtypes.ModuleName, - assetstypes.ModuleName, rewardstypes.ModuleName, liquidvestingtypes.ModuleName, - crisistypes.ModuleName, - } + app.mm.SetOrderInitGenesis(orderInitBlockers()...) - app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) - app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) - - app.ModuleManager.RegisterInvariants(app.CrisisKeeper) + // Uncomment if you want to set a custom migration order here. + // app.mm.SetOrderMigrations(custom order) + app.mm.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - err = app.ModuleManager.RegisterServices(app.configurator) + err = app.mm.RegisterServices(app.configurator) if err != nil { panic(err) } - app.indexerModule.RegisterServices(app.configurator) - - // register upgrade handler for later use - app.RegisterUpgradeHandlers() - - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) reflectionSvc, err := runtimeservices.NewReflectionService() if err != nil { @@ -1210,118 +260,99 @@ func NewMilkyWayApp( } reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + // add test gRPC service for testing gRPC queries in isolation + testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) + + // create the simulation manager and define the order of the modules for deterministic simulations + // + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions + app.sm = module.NewSimulationManager(simulationModules(app, appCodec, skipGenesisInvariants)...) + + app.sm.RegisterStoreDecoders() + // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memKeys) + app.MountKVStores(app.GetKVStoreKey()) + app.MountTransientStores(app.GetTransientStoreKey()) + app.MountMemoryStores(app.GetMemoryStoreKey()) - // initialize BaseApp - app.SetInitChainer(app.InitChainer) - app.SetPreBlocker(app.PreBlocker) - app.SetBeginBlocker(app.BeginBlocker) - app.setPostHandler() - app.SetEndBlocker(app.EndBlocker) + wasmConfig, err := wasm.ReadWasmConfig(appOpts) + if err != nil { + panic("error while reading wasm config: " + err.Error()) + } - // initialize and set the InitiaApp mempool. The current mempool will be the - // x/auction module's mempool which will extract the top bid from the current block's auction - // and insert the txs at the top of the block spots. - signerExtractor := signer_extraction.NewDefaultAdapter() - - systemLane := initialanes.NewSystemLane(blockbase.LaneConfig{ - Logger: app.Logger(), - TxEncoder: app.txConfig.TxEncoder(), - TxDecoder: app.txConfig.TxDecoder(), - MaxBlockSpace: math.LegacyMustNewDecFromStr("0.01"), - MaxTxs: 1, - SignerExtractor: signerExtractor, - }, opchildlanes.SystemLaneMatchHandler()) - - factory := mevlane.NewDefaultAuctionFactory(app.txConfig.TxDecoder(), signerExtractor) - mevLane := mevlane.NewMEVLane(blockbase.LaneConfig{ - Logger: app.Logger(), - TxEncoder: app.txConfig.TxEncoder(), - TxDecoder: app.txConfig.TxDecoder(), - MaxBlockSpace: math.LegacyMustNewDecFromStr("0.09"), - MaxTxs: 100, - SignerExtractor: signerExtractor, - }, factory, factory.MatchHandler()) - - freeLane := initialanes.NewFreeLane(blockbase.LaneConfig{ - Logger: app.Logger(), - TxEncoder: app.txConfig.TxEncoder(), - TxDecoder: app.txConfig.TxDecoder(), - MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"), - MaxTxs: 100, - SignerExtractor: signerExtractor, - }, opchildlanes.NewFreeLaneMatchHandler(ac, app.OPChildKeeper).MatchHandler()) - - defaultLane := initialanes.NewDefaultLane(blockbase.LaneConfig{ - Logger: app.Logger(), - TxEncoder: app.txConfig.TxEncoder(), - TxDecoder: app.txConfig.TxDecoder(), - MaxBlockSpace: math.LegacyMustNewDecFromStr("0.8"), - MaxTxs: mempoolTxs, - SignerExtractor: signerExtractor, - }) + anteHandler, err := milkywayante.NewAnteHandler( + milkywayante.HandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + FeegrantKeeper: app.FeeGrantKeeper, + SignModeHandler: txConfig.SignModeHandler(), + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - lanes := []block.Lane{systemLane, mevLane, freeLane, defaultLane} - mempool, err := block.NewLanedMempool(app.Logger(), lanes) + Codec: appCodec, + IBCkeeper: app.IBCKeeper, + StakingKeeper: app.StakingKeeper, + FeeMarketKeeper: app.FeeMarketKeeper, + WasmConfig: &wasmConfig, + TXCounterStoreService: runtime.NewKVStoreService(app.AppKeepers.GetKey(wasmtypes.StoreKey)), + TxFeeChecker: func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) { + return minTxFeesChecker(ctx, tx, *app.FeeMarketKeeper) + }, + }, + ) + if err != nil { + panic(fmt.Errorf("failed to create AnteHandler: %s", err)) + } + + postHandlerOptions := PostHandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + FeeMarketKeeper: app.FeeMarketKeeper, + } + postHandler, err := NewPostHandler(postHandlerOptions) if err != nil { panic(err) } - app.SetMempool(mempool) - anteHandler := app.setAnteHandler(mevLane, freeLane, wasmConfig, keys[wasmtypes.StoreKey]) + // set ante and post handlers + app.SetAnteHandler(anteHandler) + app.SetPostHandler(postHandler) - // set the ante handler for each lane - // - opt := []blockbase.LaneOption{ - blockbase.WithAnteHandler(anteHandler), - } - systemLane.(*blockbase.BaseLane).WithOptions( - opt..., - ) - mevLane.WithOptions( - opt..., - ) - freeLane.(*blockbase.BaseLane).WithOptions( - opt..., - ) - defaultLane.(*blockbase.BaseLane).WithOptions( - opt..., - ) + // Initialize the ABCI extensions + data := milkywayabci.InitializeOracleABCIExtensions(milkywayabci.SetupData{ + ChainID: app.ChainID(), + Logger: app.Logger(), + Keepers: app.AppKeepers, + ModuleManager: app.mm, + OracleConfig: oracleConfig, + }) - // override the base-app's ABCI methods (CheckTx, PrepareProposal, ProcessProposal) - proposalHandlers := mevabci.NewProposalHandler( - app.Logger(), - app.txConfig.TxDecoder(), - app.txConfig.TxEncoder(), - mempool, - ) + // Set the oracle client + app.SetOracleClient(data.OracleClient) - // override base-app's ProcessProposal + PrepareProposal - app.SetPrepareProposal(proposalHandlers.PrepareProposalHandler()) - app.SetProcessProposal(proposalHandlers.ProcessProposalHandler()) - - // overrde base-app's CheckTx - mevCheckTx := blockchecktx.NewMEVCheckTxHandler( - app.BaseApp, - app.txConfig.TxDecoder(), - mevLane, - anteHandler, - app.BaseApp.CheckTx, - ) - checkTxHandler := blockchecktx.NewMempoolParityCheckTx( - app.Logger(), mempool, - app.txConfig.TxDecoder(), mevCheckTx.CheckTx(), - ) - app.SetCheckTx(checkTxHandler.CheckTx()) + // Set the standard callbacks + app.SetInitChainer(app.InitChainer) + app.SetBeginBlocker(app.BeginBlocker) + app.SetEndBlocker(app.EndBlocker) - //////////////// - /// lane end /// - //////////////// + // Set the callbacks used by ABCI vote extensions + app.SetPrepareProposal(data.PrepareProposalHandler) + app.SetProcessProposal(data.ProcessProposalHandler) + app.SetPreBlocker(data.PreBlockHandler) + app.SetExtendVoteHandler(data.ExtendVoteHandler) + app.SetVerifyVoteExtensionHandler(data.VerifyVoteExtensionHandler) - // At startup, after all modules have been registered, check that all proto + if manager := app.SnapshotManager(); manager != nil { + err = manager.RegisterExtensions(wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.AppKeepers.WasmKeeper)) + if err != nil { + panic("failed to register snapshot extension: " + err.Error()) + } + } + + app.setupUpgradeHandlers() + app.setupUpgradeStoreLoaders() + + // At startup, after all modules have been registered, check that all prot // annotations are correct. protoFiles, err := proto.MergedRegistry() if err != nil { @@ -1329,128 +360,42 @@ func NewMilkyWayApp( } err = msgservice.ValidateProtoAnnotations(protoFiles) if err != nil { - errMsg := "" - - // ignore injective and ibc-rate-limiting proto annotations comes from github.com/cosoms/relayer - for _, s := range strings.Split(err.Error(), "\n") { - if strings.Contains(s, "injective") || strings.Contains(s, "ratelimit") { - continue - } - - errMsg += s + "\n" - } - - if errMsg != "" { - // Once we switch to using protoreflect-based antehandlers, we might - // want to panic here instead of logging a warning. - fmt.Fprintln(os.Stderr, errMsg) - } - } - - // must be before Loading version - // requires the snapshot store to be created and registered as a BaseAppOption - // see cmd/wasmd/root.go: 206 - 214 approx - if manager := app.SnapshotManager(); manager != nil { - err := manager.RegisterExtensions( - wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), app.WasmKeeper), - ) - if err != nil { - panic(fmt.Errorf("failed to register snapshot extension: %s", err)) - } + // Once we switch to using protoreflect-based antehandlers, we might + // want to panic here instead of logging a warning. + fmt.Fprintln(os.Stderr, err.Error()) } - // Load the latest state from disk if necessary, and initialize the base-app. From this point on - // no more modifications to the base-app can be made if loadLatest { if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) + tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err)) } ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) - // Initialize pinned codes in wasmvm as they are not persisted there - if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { - tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) + if err := app.AppKeepers.WasmKeeper.InitializePinnedCodes(ctx); err != nil { + tmos.Exit(fmt.Sprintf("WasmKeeper failed initialize pinned codes %s", err)) } } return app } -// CheckTx will check the transaction with the provided checkTxHandler. We override the default -// handler so that we can verify bid transactions before they are inserted into the mempool. -// With the POB CheckTx, we can verify the bid transaction and all of the bundled transactions -// before inserting the bid transaction into the mempool. -func (app *MilkyWayApp) CheckTx(req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) { - return app.checkTxHandler(req) -} - -// SetCheckTx sets the checkTxHandler for the app. -func (app *MilkyWayApp) SetCheckTx(handler blockchecktx.CheckTx) { - app.checkTxHandler = handler -} - -func (app *MilkyWayApp) setAnteHandler( - mevLane auctionante.MEVLane, - freeLane block.Lane, - wasmConfig wasmtypes.WasmConfig, - txCounterStoreKey *storetypes.KVStoreKey, -) sdk.AnteHandler { - anteHandler, err := appante.NewAnteHandler( - appante.HandlerOptions{ - HandlerOptions: cosmosante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - FeegrantKeeper: app.FeeGrantKeeper, - SignModeHandler: app.txConfig.SignModeHandler(), - }, - IBCkeeper: app.IBCKeeper, - Codec: app.appCodec, - OPChildKeeper: app.OPChildKeeper, - TxEncoder: app.txConfig.TxEncoder(), - AuctionKeeper: *app.AuctionKeeper, - MevLane: mevLane, - FreeLane: freeLane, - WasmKeeper: app.WasmKeeper, - WasmConfig: &wasmConfig, - TXCounterStoreService: runtime.NewKVStoreService(txCounterStoreKey), - }, - ) - if err != nil { - panic(err) - } - - app.SetAnteHandler(anteHandler) - return anteHandler -} - -func (app *MilkyWayApp) setPostHandler() { - postHandler, err := posthandler.NewPostHandler( - posthandler.HandlerOptions{}, - ) - if err != nil { - panic(err) - } - - app.SetPostHandler(postHandler) +// SetOracleClient sets the oracle client +func (app *MilkyWayApp) SetOracleClient(oracleClient oracleclient.OracleClient) { + app.oracleClient = oracleClient } // Name returns the name of the App func (app *MilkyWayApp) Name() string { return app.BaseApp.Name() } -// PreBlocker application updates every pre block -func (app *MilkyWayApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { - return app.ModuleManager.PreBlock(ctx) -} - // BeginBlocker application updates every begin block func (app *MilkyWayApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { - return app.ModuleManager.BeginBlock(ctx) + return app.mm.BeginBlock(ctx) } // EndBlocker application updates every end block func (app *MilkyWayApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { - return app.ModuleManager.EndBlock(ctx) + return app.mm.EndBlock(ctx) } // InitChainer application update at chain initialization @@ -1459,10 +404,17 @@ func (app *MilkyWayApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { + + if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()); err != nil { + panic(err) + } + + response, err := app.mm.InitGenesis(ctx, app.appCodec, genesisState) + if err != nil { panic(err) } - return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) + + return response, nil } // LoadHeight loads a particular height @@ -1473,31 +425,27 @@ func (app *MilkyWayApp) LoadHeight(height int64) error { // ModuleAccountAddrs returns all the app's module account addresses. func ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) - for acc := range maccPerms { + for acc := range MaccPerms { modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true } return modAccAddrs } -// BlacklistedModuleAccountAddrs returns all the app's blacklisted module account addresses. -func BlacklistedModuleAccountAddrs() map[string]bool { - modAccAddrs := make(map[string]bool) - // DO NOT REMOVE: StringMapKeys fixes non-deterministic map iteration - for _, acc := range utils.StringMapKeys(maccPerms) { - // don't blacklist stakeibc module account, so that it can ibc transfer tokens - if acc == stakeibctypes.ModuleName || - acc == stakeibctypes.RewardCollectorName || - // don't blacklist liquidvesting module account, so that it can receive ibc transfers - acc == liquidvestingtypes.ModuleName { - continue - } - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true - } +// BlockedModuleAccountAddrs returns all the app's blocked module account +// addresses. +func BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[string]bool { + // remove module accounts that are ALLOWED to received funds + delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + delete(modAccAddrs, authtypes.NewModuleAddress(liquidvestingtypes.ModuleName).String()) + + // Remove the ConsumerRewardsPool from the group of blocked recipient addresses in bank + delete(modAccAddrs, authtypes.NewModuleAddress(providertypes.ConsumerRewardsPool).String()) + return modAccAddrs } -// LegacyAmino returns SimApp's amino codec. +// LegacyAmino returns MilkyWayApp's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. @@ -1505,7 +453,7 @@ func (app *MilkyWayApp) LegacyAmino() *codec.LegacyAmino { return app.legacyAmino } -// AppCodec returns Initia's app codec. +// AppCodec returns MilkyWay's app codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. @@ -1513,74 +461,45 @@ func (app *MilkyWayApp) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns Initia's InterfaceRegistry +// InterfaceRegistry returns MilkyWay's InterfaceRegistry func (app *MilkyWayApp) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } -// GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *MilkyWayApp) GetKey(storeKey string) *storetypes.KVStoreKey { - return app.keys[storeKey] -} - -// GetTKey returns the TransientStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *MilkyWayApp) GetTKey(storeKey string) *storetypes.TransientStoreKey { - return app.tkeys[storeKey] -} - -// GetMemKey returns the MemStoreKey for the provided mem key. -// -// NOTE: This is solely used for testing purposes. -func (app *MilkyWayApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { - return app.memKeys[storeKey] +// SimulationManager implements the SimulationApp interface +func (app *MilkyWayApp) SimulationManager() *module.SimulationManager { + return app.sm } // RegisterAPIRoutes registers all application module routes with the provided // API server. func (app *MilkyWayApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx - // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register node gRPC service for grpc-gateway. - nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register grpc-gateway routes for all modules. - app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register legacy and grpc-gateway routes for all modules. + app.ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register grpc-gateway routes for indexer module. - app.indexerModule.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register nodeservice grpc-gateway routes. + nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily - if apiConfig.Swagger { - RegisterSwaggerAPI(apiSvr.Router) + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) } } -// Simulate customize gas simulation to add fee deduction gas amount. -func (app *MilkyWayApp) Simulate(txBytes []byte) (sdk.GasInfo, *sdk.Result, error) { - gasInfo, result, err := app.BaseApp.Simulate(txBytes) - if err != nil { - return gasInfo, result, err - } - gasInfo.GasUsed += FeeDeductionGasAmount - return gasInfo, result, err +// RegisterNodeService allows query minimum-gas-prices in app.toml +func (app *MilkyWayApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) } // RegisterTxService implements the Application.RegisterTxService method. func (app *MilkyWayApp) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService( - app.BaseApp.GRPCQueryRouter(), clientCtx, - app.Simulate, app.interfaceRegistry, - ) + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) } // RegisterTendermintService implements the Application.RegisterTendermintService method. @@ -1588,31 +507,40 @@ func (app *MilkyWayApp) RegisterTendermintService(clientCtx client.Context) { cmtservice.RegisterTendermintService( clientCtx, app.BaseApp.GRPCQueryRouter(), - app.interfaceRegistry, app.Query, + app.interfaceRegistry, + app.Query, ) } -func (app *MilkyWayApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) -} - -// Configurator returns the app's configurator. -func (app *MilkyWayApp) Configurator() module.Configurator { - return app.configurator -} - -// registerUpgrade registers the given upgrade to be supported by the app -func (app *MilkyWayApp) registerUpgrade(upgrade upgrades.Upgrade) { - app.UpgradeKeeper.SetUpgradeHandler(upgrade.Name(), upgrade.Handler()) - +// configure store loader that checks if version == upgradeHeight and applies store upgrades +func (app *MilkyWayApp) setupUpgradeStoreLoaders() { upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() if err != nil { - panic(err) + panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) + } + + if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + return + } + + for _, upgrade := range Upgrades { + if upgradeInfo.Name == upgrade.UpgradeName { + storeUpgrades := upgrade.StoreUpgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } } +} - if upgradeInfo.Name == upgrade.Name() && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - // Configure store loader that checks if version == upgradeHeight and applies store upgrades - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, upgrade.StoreUpgrades())) +func (app *MilkyWayApp) setupUpgradeHandlers() { + for _, upgrade := range Upgrades { + app.UpgradeKeeper.SetUpgradeHandler( + upgrade.UpgradeName, + upgrade.CreateUpgradeHandler( + app.mm, + app.configurator, + &app.AppKeepers, + ), + ) } } @@ -1627,16 +555,32 @@ func RegisterSwaggerAPI(rtr *mux.Router) { rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) } -// GetMaccPerms returns a copy of the module account permissions -func GetMaccPerms() map[string][]string { - dupMaccPerms := make(map[string][]string) - for k, v := range maccPerms { - dupMaccPerms[k] = v +func (app *MilkyWayApp) OnTxSucceeded(_ sdk.Context, _, _ string, _ []byte, _ []byte) { +} + +func (app *MilkyWayApp) OnTxFailed(_ sdk.Context, _, _ string, _ []byte, _ []byte) { +} + +// AutoCliOpts returns the autocli options for the app. +func (app *MilkyWayApp) AutoCliOpts() autocli.AppOptions { + modules := make(map[string]appmodule.AppModule, 0) + for _, m := range app.mm.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } + } + } + + return autocli.AppOptions{ + Modules: modules, + AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), } - return dupMaccPerms } -////////////////////////////////////// // TestingApp functions // GetBaseApp implements the TestingApp interface. @@ -1644,121 +588,89 @@ func (app *MilkyWayApp) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } -// GetAccountKeeper implements the TestingApp interface. -func (app *MilkyWayApp) GetAccountKeeper() *authkeeper.AccountKeeper { - return app.AccountKeeper -} - -// GetStakingKeeper implements the TestingApp interface. -// It returns opchild instead of original staking keeper. -func (app *MilkyWayApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { - return app.OPChildKeeper -} - -// GetIBCKeeper implements the TestingApp interface. -func (app *MilkyWayApp) GetIBCKeeper() *ibckeeper.Keeper { - return app.IBCKeeper +// GetTxConfig implements the TestingApp interface. +func (app *MilkyWayApp) GetTxConfig() client.TxConfig { + return app.txConfig } -// GetICAControllerKeeper implements the TestingApp interface. -func (app *MilkyWayApp) GetICAControllerKeeper() *icacontrollerkeeper.Keeper { - return app.ICAControllerKeeper +// GetTestGovKeeper implements the TestingApp interface. +func (app *MilkyWayApp) GetTestGovKeeper() *govkeeper.Keeper { + return app.AppKeepers.GovKeeper } -// GetICAAuthKeeper implements the TestingApp interface. -func (app *MilkyWayApp) GetICAAuthKeeper() *icaauthkeeper.Keeper { - return app.ICAAuthKeeper -} +// EmptyAppOptions is a stub implementing AppOptions +type EmptyAppOptions struct{} -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *MilkyWayApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} +// EmptyWasmOptions is a stub implementing Wasmkeeper Option +var EmptyWasmOptions []wasmkeeper.Option -// TxConfig implements the TestingApp interface. -func (app *MilkyWayApp) TxConfig() client.TxConfig { - return app.txConfig +// Get implements AppOptions +func (ao EmptyAppOptions) Get(_ string) interface{} { + return nil } -func (app *MilkyWayApp) setupIndexer(db dbm.DB, appOpts servertypes.AppOptions, ac, vc address.Codec, appCodec codec.Codec) error { - // initialize the indexer fake-keeper - indexerConfig, err := indexerconfig.NewConfig(appOpts) - if err != nil { - panic(err) - } - app.indexerKeeper = indexerkeeper.NewKeeper( - appCodec, - "wasm", - db, - indexerConfig, - ac, - vc, - ) - smBlock, err := blocksubmodule.NewBlockSubmodule(appCodec, app.indexerKeeper, app.OPChildKeeper) - if err != nil { - panic(err) - } - smTx, err := tx.NewTxSubmodule(appCodec, app.indexerKeeper) - if err != nil { - panic(err) - } - smPair, err := pair.NewPairSubmodule(appCodec, app.indexerKeeper, app.IBCKeeper.ChannelKeeper, app.TransferKeeper) - if err != nil { - panic(err) - } - smNft, err := nft.NewWasmNFTSubmodule(ac, appCodec, app.indexerKeeper, app.WasmKeeper, smPair) - if err != nil { - panic(err) - } - err = app.indexerKeeper.RegisterSubmodules(smBlock, smTx, smPair, smNft) - if err != nil { - panic(err) - } - - app.indexerModule = indexermodule.NewAppModuleBasic(app.indexerKeeper) - // Add your implementation here - - indexer, err := indexer.NewIndexer(app.GetBaseApp().Logger(), app.indexerKeeper) - if err != nil || indexer == nil { - return nil +// minTxFeesChecker will be executed only if the feemarket module is disabled. +// In this case, the auth module's DeductFeeDecorator is executed, and +// we use the minTxFeesChecker to enforce the minimum transaction fees. +// Min tx fees are calculated as gas_limit * feemarket_min_base_gas_price +func minTxFeesChecker(ctx sdk.Context, tx sdk.Tx, feemarketKp feemarketkeeper.Keeper) (sdk.Coins, int64, error) { + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") } - if err = indexer.Validate(); err != nil { - return err + // To keep the gentxs with zero fees, we need to skip the validation in the first block + if ctx.BlockHeight() == 0 { + return feeTx.GetFee(), 0, nil } - if err = indexer.Prepare(nil); err != nil { - return err + feeMarketParams, err := feemarketKp.GetParams(ctx) + if err != nil { + return nil, 0, err } - if err = app.indexerKeeper.Seal(); err != nil { - return err - } + feeRequired := sdk.NewCoins( + sdk.NewCoin( + feeMarketParams.FeeDenom, + feeMarketParams.MinBaseGasPrice.MulInt(math.NewIntFromUint64(feeTx.GetGas())).Ceil().RoundInt(), + ), + ) - if err = indexer.Start(nil); err != nil { - return err + feeCoins := feeTx.GetFee() + if len(feeCoins) != 1 { + return nil, 0, fmt.Errorf( + "expected exactly one fee coin; got %s, required: %s", feeCoins.String(), feeRequired.String()) } - streamingManager := storetypes.StreamingManager{ - ABCIListeners: []storetypes.ABCIListener{indexer}, - StopNodeOnErr: true, + if !feeCoins.IsAnyGTE(feeRequired) { + return nil, 0, fmt.Errorf( + "not enough fees provided; got %s, required: %s", feeCoins.String(), feeRequired.String()) } - app.SetStreamingManager(streamingManager) - return nil + return feeTx.GetFee(), 0, nil } // Close closes the underlying baseapp, the oracle service, and the prometheus server if required. // This method blocks on the closure of both the prometheus server, and the oracle-service func (app *MilkyWayApp) Close() error { - if app.indexerKeeper != nil { - if err := app.indexerKeeper.Close(); err != nil { + if err := app.BaseApp.Close(); err != nil { + return err + } + + // Close the oracle service + if app.oracleClient != nil { + if err := app.oracleClient.Stop(); err != nil { return err } } - if err := app.BaseApp.Close(); err != nil { - return err + return nil +} + +// StartOracleClient starts the oracle client +func (app *MilkyWayApp) StartOracleClient(ctx context.Context) error { + if app.oracleClient != nil { + return app.oracleClient.Start(ctx) } return nil diff --git a/app/app_helpers.go b/app/app_helpers.go new file mode 100644 index 000000000..58d1c6997 --- /dev/null +++ b/app/app_helpers.go @@ -0,0 +1,55 @@ +package milkyway + +import ( + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" + icstest "github.com/cosmos/interchain-security/v6/testutil/integration" + ibcproviderkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" +) + +// ProviderApp interface implementations for icstest tests + +// GetProviderKeeper implements the ProviderApp interface. +func (app *MilkyWayApp) GetProviderKeeper() ibcproviderkeeper.Keeper { //nolint:nolintlint + return app.ProviderKeeper +} + +// GetStakingKeeper implements the TestingApp interface. Needed for ICS. +func (app *MilkyWayApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { //nolint:nolintlint + return app.StakingKeeper +} + +// GetIBCKeeper implements the TestingApp interface. +func (app *MilkyWayApp) GetIBCKeeper() *ibckeeper.Keeper { //nolint:nolintlint + return app.IBCKeeper +} + +// GetScopedIBCKeeper implements the TestingApp interface. +func (app *MilkyWayApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { //nolint:nolintlint + return app.ScopedIBCKeeper +} + +// GetTestStakingKeeper implements the ProviderApp interface. +func (app *MilkyWayApp) GetTestStakingKeeper() icstest.TestStakingKeeper { //nolint:nolintlint + return app.StakingKeeper +} + +// GetTestBankKeeper implements the ProviderApp interface. +func (app *MilkyWayApp) GetTestBankKeeper() icstest.TestBankKeeper { //nolint:nolintlint + return app.BankKeeper +} + +// GetTestSlashingKeeper implements the ProviderApp interface. +func (app *MilkyWayApp) GetTestSlashingKeeper() icstest.TestSlashingKeeper { //nolint:nolintlint + return app.SlashingKeeper +} + +// GetTestDistributionKeeper implements the ProviderApp interface. +func (app *MilkyWayApp) GetTestDistributionKeeper() icstest.TestDistributionKeeper { //nolint:nolintlint + return app.DistrKeeper +} + +func (app *MilkyWayApp) GetTestAccountKeeper() icstest.TestAccountKeeper { //nolint:nolintlint + return app.AccountKeeper +} diff --git a/app/app_test.go b/app/app_test.go index 5a4eb63a5..8bed4c6e1 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -1,145 +1,25 @@ -package app +package milkyway_test import ( - "encoding/json" - "fmt" - "os" "testing" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - "github.com/cosmos/cosmos-sdk/x/crisis" - "github.com/golang/mock/gomock" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" - "cosmossdk.io/log" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - dbm "github.com/cosmos/cosmos-db" - - "github.com/cosmos/cosmos-sdk/testutil/mock" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/consensus" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/ibc-go/modules/capability" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - "cosmossdk.io/x/upgrade" - "github.com/cosmos/cosmos-sdk/x/bank" - - ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" - "github.com/cosmos/ibc-go/v8/modules/apps/transfer" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - - "github.com/initia-labs/OPinit/x/opchild" - - "github.com/CosmWasm/wasmd/x/wasm" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + milkyway "github.com/milkyway-labs/milkyway/app" + milkywayhelpers "github.com/milkyway-labs/milkyway/app/helpers" ) -func TestSimAppExportAndBlockedAddrs(t *testing.T) { - app := SetupWithGenesisAccounts(t, nil, nil) - - // BlockedAddresses returns a map of addresses in app v1 and a map of modules name in app v2. - for acc := range BlacklistedModuleAccountAddrs() { - var addr sdk.AccAddress - if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil { - addr = modAddr - } else { - addr = app.AccountKeeper.GetModuleAddress(acc) - } - - require.True( - t, - app.BankKeeper.BlockedAddr(addr), - fmt.Sprintf("ensure that blocked addresses are properly set in bank keeper: %s should be blocked", acc), - ) - } -} - -func TestGetMaccPerms(t *testing.T) { - dup := GetMaccPerms() - require.Equal(t, maccPerms, dup, "duplicated module account permissions differed from actual module account permissions") -} - -func TestInitGenesisOnMigration(t *testing.T) { - db := dbm.NewMemDB() - logger := log.NewLogger(os.Stdout) - app := NewMilkyWayApp( - logger, - db, - getOrCreateMemDB(nil), - nil, - true, - []wasmkeeper.Option{}, - simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), - ) - ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) - - // Create a mock module. This module will serve as the new module we're - // adding during a migration. - mockCtrl := gomock.NewController(t) - t.Cleanup(mockCtrl.Finish) - mockModule := mock.NewMockAppModuleWithAllExtensions(mockCtrl) - mockDefaultGenesis := json.RawMessage(`{"key": "value"}`) - mockModule.EXPECT().DefaultGenesis(gomock.Eq(app.appCodec)).Times(1).Return(mockDefaultGenesis) - mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(app.appCodec), gomock.Eq(mockDefaultGenesis)).Times(1) - mockModule.EXPECT().ConsensusVersion().Times(1).Return(uint64(0)) +func TestMilkyWayApp_BlockedModuleAccountAddrs(t *testing.T) { + moduleAccountAddresses := milkyway.ModuleAccountAddrs() + blockedAddrs := milkyway.BlockedModuleAccountAddrs(moduleAccountAddresses) - app.ModuleManager.Modules["mock"] = mockModule - app.ModuleManager.OrderMigrations = []string{"mock"} - - // Run migrations only for "mock" module. We exclude it from - // the VersionMap to simulate upgrading with a new module. - _, err := app.ModuleManager.RunMigrations(ctx, app.configurator, - module.VersionMap{ - "bank": bank.AppModule{}.ConsensusVersion(), - "crisis": crisis.AppModule{}.ConsensusVersion(), - "auth": auth.AppModule{}.ConsensusVersion(), - "authz": authzmodule.AppModule{}.ConsensusVersion(), - "upgrade": upgrade.AppModule{}.ConsensusVersion(), - "capability": capability.AppModule{}.ConsensusVersion(), - "group": groupmodule.AppModule{}.ConsensusVersion(), - "consensus": consensus.AppModule{}.ConsensusVersion(), - "ibc": ibc.AppModule{}.ConsensusVersion(), - "transfer": transfer.AppModule{}.ConsensusVersion(), - "interchainaccounts": ica.AppModule{}.ConsensusVersion(), - "wasm": wasm.AppModule{}.ConsensusVersion(), - "opchild": opchild.AppModule{}.ConsensusVersion(), - }, - ) - require.NoError(t, err) + require.NotContains(t, blockedAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) } -func TestUpgradeStateOnGenesis(t *testing.T) { - app := SetupWithGenesisAccounts(t, nil, nil) - - // make sure the upgrade keeper has version map in state - ctx := app.NewContext(true) - vm, err := app.UpgradeKeeper.GetModuleVersionMap(ctx) - require.NoError(t, err) - - for v, i := range app.ModuleManager.Modules { - if i, ok := i.(module.HasConsensusVersion); ok { - require.Equal(t, vm[v], i.ConsensusVersion()) - } - } -} - -func TestGetKey(t *testing.T) { - db := dbm.NewMemDB() - app := NewMilkyWayApp( - log.NewLogger(os.Stdout), - db, - dbm.NewMemDB(), - nil, - true, - []wasmkeeper.Option{}, - simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), - ) - - require.NotEmpty(t, app.GetKey(banktypes.StoreKey)) - require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey)) +func TestMilkyWayApp_Export(t *testing.T) { + app := milkywayhelpers.Setup(t) + _, err := app.ExportAppStateAndValidators(true, []string{}, []string{}) + require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } diff --git a/app/const.go b/app/const.go index 855d8e33c..c6f5916e0 100644 --- a/app/const.go +++ b/app/const.go @@ -1,14 +1,14 @@ -package app +package milkyway const ( // FeeDeductionGasAmount is a estimated gas amount of fee payment FeeDeductionGasAmount = 50_000 // AccountAddressPrefix is the prefix of bech32 encoded address - AccountAddressPrefix = "init" + AccountAddressPrefix = "milk" - // AppName is the application name - AppName = "milkyway" + // appName is the application name + appName = "milkyway" // EnvPrefix is environment variable prefix for the app EnvPrefix = "MILKYWAY" @@ -41,7 +41,4 @@ const ( moveMsgPublishModuleBundle = "/initia.move.v1.MsgPublish" moveMsgExecuteEntryFunction = "/initia.move.v1.MsgExecute" moveMsgExecuteScript = "/initia.move.v1.MsgScript" - - // UpgradeName gov proposal name - UpgradeName = "0.0.0" ) diff --git a/app/encoding.go b/app/encoding.go index 12a63f4f4..ebcbb7530 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -1,89 +1,30 @@ -package app +package milkyway import ( - "os" - - "cosmossdk.io/client/v2/autocli" - "cosmossdk.io/core/appmodule" - "cosmossdk.io/log" - "cosmossdk.io/x/tx/signing" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/codec" - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/std" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/cosmos/gogoproto/proto" - "github.com/initia-labs/initia/app/params" + "github.com/milkyway-labs/milkyway/app/keepers" + "github.com/milkyway-labs/milkyway/app/params" ) -// MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() params.EncodingConfig { - // Build the interface registry specifying the validator and address codec - interfaceRegistry, _ := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{ - ProtoFiles: proto.HybridResolver, - SigningOptions: signing.Options{ - AddressCodec: codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), - ValidatorAddressCodec: codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), - }, - }) - cdc := codec.NewProtoCodec(interfaceRegistry) - amino := codec.NewLegacyAmino() +var encodingConfig params.EncodingConfig = MakeEncodingConfig() - // Build the encoding config - encodingConfig := params.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: cdc, - TxConfig: tx.NewTxConfig(cdc, tx.DefaultSignModes), - Amino: amino, - } +func GetEncodingConfig() params.EncodingConfig { + return encodingConfig +} - // Register the stdlib and module basics +// MakeEncodingConfig creates an EncodingConfig. +func MakeEncodingConfig() params.EncodingConfig { + encodingConfig := params.MakeEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - + keepers.AppModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) return encodingConfig } -// MakeCodecs creates the necessary testing codecs for Amino and Protobuf +// MakeCodecs constructs the *codec.Codec and *codec.LegacyAmino instances used by MilkyWayApp. func MakeCodecs() (codec.Codec, *codec.LegacyAmino) { - encodingConfig := MakeEncodingConfig() - return encodingConfig.Codec, encodingConfig.Amino -} - -// AutoCLIOpts returns the options for the auto-generated CLI -func AutoCLIOpts() (autocli.AppOptions, error) { - // Create a temp app with a temp home dir - tempDir, err := os.MkdirTemp(os.TempDir(), "milkyway-autocli-opts") - if err != nil { - return autocli.AppOptions{}, err - } - - tempApp := NewMilkyWayApp(log.NewNopLogger(), dbm.NewMemDB(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, simtestutil.NewAppOptionsWithFlagHome(tempDir)) - modules := make(map[string]appmodule.AppModule, 0) - for _, m := range tempApp.ModuleManager.Modules { - if moduleWithName, ok := m.(module.HasName); ok { - moduleName := moduleWithName.Name() - if appModule, ok := moduleWithName.(appmodule.AppModule); ok { - modules[moduleName] = appModule - } - } - } - - return autocli.AppOptions{ - Modules: modules, - ModuleOptions: runtimeservices.ExtractAutoCLIOptions(tempApp.ModuleManager.Modules), - AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), - ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), - ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), - }, nil + encodingCfg := MakeEncodingConfig() + return encodingCfg.Marshaler, encodingCfg.Amino } diff --git a/app/executor_change.go b/app/executor_change.go index 90d0c81e9..d69f99016 100644 --- a/app/executor_change.go +++ b/app/executor_change.go @@ -1,4 +1,4 @@ -package app +package milkyway // Executor change plans diff --git a/app/export.go b/app/export.go index 917e95bad..c205d0165 100644 --- a/app/export.go +++ b/app/export.go @@ -1,46 +1,274 @@ -package app +package milkyway import ( "encoding/json" - "github.com/initia-labs/OPinit/x/opchild" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + + storetypes "cosmossdk.io/store/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // ExportAppStateAndValidators exports the state of the application for a genesis // file. func (app *MilkyWayApp) ExportAppStateAndValidators( - forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, + forZeroHeight bool, + jailAllowedAddrs []string, + modulesToExport []string, ) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true) + ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which // Tendermint will start InitChain. height := app.LastBlockHeight() + 1 if forZeroHeight { height = 0 + app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) - if err != nil { - return servertypes.ExportedApp{}, err - } - appState, err := json.MarshalIndent(genState, "", " ") + genState, err := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) if err != nil { return servertypes.ExportedApp{}, err } - validators, err := opchild.WriteValidators(ctx, app.OPChildKeeper) + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err } + validators, err := staking.WriteValidators(ctx, app.StakingKeeper) return servertypes.ExportedApp{ AppState: appState, Validators: validators, Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), - }, nil + }, err +} + +// prepare for fresh start at zero height +// NOTE zero height genesis is a temporary feature which will be deprecated +// in favour of export at a block height +func (app *MilkyWayApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { + applyAllowedAddrs := false + + // check if there is a allowed address list + if len(jailAllowedAddrs) > 0 { + applyAllowedAddrs = true + } + + allowedAddrsMap := make(map[string]bool) + + for _, addr := range jailAllowedAddrs { + _, err := sdk.ValAddressFromBech32(addr) + if err != nil { + panic(err) + } + allowedAddrsMap[addr] = true + } + + /* Just to be safe, assert the invariants on current state. */ + app.CrisisKeeper.AssertInvariants(ctx) + + /* Handle fee distribution state. */ + + // withdraw all validator commission + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valAddr, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + app.Logger().Error(err.Error(), "ValOperatorAddress", val.GetOperator()) + } + _, err = app.DistrKeeper.WithdrawValidatorCommission(ctx, valAddr) + if err != nil { + app.Logger().Error(err.Error(), "ValOperatorAddress", val.GetOperator()) + } + return false + }) + if err != nil { + panic(err) + } + + // withdraw all delegator rewards + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) + } + + delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + panic(err) + } + + _, err = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) + if err != nil { + panic(err) + } + } + + // clear validator slash events + app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) + + // clear validator historical rewards + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + + // set context height to zero + height := ctx.BlockHeight() + ctx = ctx.WithBlockHeight(0) + + // reinitialize all validators (v0.46 version) + // app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + // // donate any unwithdrawn outstanding reward fraction tokens to the community pool + // scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + // feePool := app.DistrKeeper.GetFeePool(ctx) + // feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + // app.DistrKeeper.SetFeePool(ctx, feePool) + + // err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + // if err != nil { + // panic(err) + // } + // return false + // }) + + // reinitialize all validators + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + // donate any unwithdrawn outstanding reward fraction tokens to the community pool + valAddr, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valAddr) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } + feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + err = app.DistrKeeper.FeePool.Set(ctx, feePool) + if err != nil { + panic(err) + } + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valAddr); err != nil { + panic(err) + } + return false + }) + if err != nil { + panic(err) + } + + // reinitialize all delegations + for _, del := range dels { + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + if err != nil { + panic(err) + } + delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) + if err != nil { + panic(err) + } + if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { + panic(err) + } + if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil { + panic(err) + } + } + + // reset context height + ctx = ctx.WithBlockHeight(height) + + /* Handle staking state. */ + + // iterate through redelegations, reset creation height + err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + for i := range red.Entries { + red.Entries[i].CreationHeight = 0 + } + if err := app.StakingKeeper.SetRedelegation(ctx, red); err != nil { + panic(err) + } + return false + }) + if err != nil { + panic(err) + } + + // iterate through unbonding delegations, reset creation height + err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + for i := range ubd.Entries { + ubd.Entries[i].CreationHeight = 0 + } + if err := app.StakingKeeper.SetUnbondingDelegation(ctx, ubd); err != nil { + panic(err) + } + return false + }) + if err != nil { + panic(err) + } + + // Iterate through validators by power descending, reset bond heights, and + // update bond intra-tx counters. + store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + + counter := int16(0) + + // Closure to ensure iterator doesn't leak. + func() { + defer iter.Close() + for ; iter.Valid(); iter.Next() { + addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { + panic("expected validator, not found") + } + + validator.UnbondingHeight = 0 + if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { + validator.Jailed = true + } + + if err = app.StakingKeeper.SetValidator(ctx, validator); err != nil { + panic(err) + } + + counter++ + } + }() + + _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + panic(err) + } + + /* Handle slashing state. */ + + // reset start height on signing infos + err = app.SlashingKeeper.IterateValidatorSigningInfos( + ctx, + func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { + info.StartHeight = 0 + if err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info); err != nil { + panic(err) + } + return false + }, + ) + if err != nil { + panic(err) + } } diff --git a/app/genesis.go b/app/genesis.go index 58f5eda27..108bcf070 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -1,10 +1,23 @@ -package app +package milkyway import ( - "encoding/hex" "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" + marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" - "cosmossdk.io/core/address" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/module" icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" @@ -13,15 +26,6 @@ import ( icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibctypes "github.com/cosmos/ibc-go/v8/modules/core/types" - - l2connect "github.com/initia-labs/OPinit/x/opchild/l2connect" - opchildtypes "github.com/initia-labs/OPinit/x/opchild/types" - "github.com/initia-labs/initia/app/genesis_markets" - - auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types" - connecttypes "github.com/skip-mev/connect/v2/pkg/types" - marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" - oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" ) // GenesisState - The genesis state of the blockchain is represented here as a map of raw json @@ -34,16 +38,14 @@ import ( type GenesisState map[string]json.RawMessage // NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState(cdc codec.Codec, mbm module.BasicManager, denom string) GenesisState { +func NewDefaultGenesisState(cdc codec.Codec, mbm module.BasicManager) GenesisState { return GenesisState(mbm.DefaultGenesis(cdc)). - ConfigureMinGasPrices(cdc). ConfigureICA(cdc). ConfigureIBCAllowedClients(cdc). - ConfigureAuctionFee(cdc, denom). - AddMarketData(cdc, cdc.InterfaceRegistry().SigningContext().AddressCodec()) + AddMarketData(cdc) } -func (genState GenesisState) AddMarketData(cdc codec.JSONCodec, ac address.Codec) GenesisState { +func (genState GenesisState) AddMarketData(cdc codec.JSONCodec) GenesisState { var oracleGenState oracletypes.GenesisState cdc.MustUnmarshalJSON(genState[oracletypes.ModuleName], &oracleGenState) @@ -57,37 +59,11 @@ func (genState GenesisState) AddMarketData(cdc codec.JSONCodec, ac address.Codec } marketGenState.MarketMap = genesis_markets.ToMarketMap(markets) - // Skip Admin account. - adminAddrBz, err := hex.DecodeString("51B89E89D58FFB3F9DB66263FF10A216CF388A0E") - if err != nil { - panic(err) - } - - adminAddr, err := ac.BytesToString(adminAddrBz) - if err != nil { - panic(err) - } - - marketGenState.Params.MarketAuthorities = []string{adminAddr} - marketGenState.Params.Admin = adminAddr - + // Initialize all markets var id uint64 - - // Initialize all markets plus ReservedCPTimestamp - currencyPairGenesis := make([]oracletypes.CurrencyPairGenesis, len(markets)+1) - cp, err := connecttypes.CurrencyPairFromString(l2connect.ReservedCPTimestamp) - if err != nil { - panic(err) - } - currencyPairGenesis[id] = oracletypes.CurrencyPairGenesis{ - CurrencyPair: cp, - CurrencyPairPrice: nil, - Nonce: 0, - Id: id, - } - id++ + currencyPairGenesis := make([]oracletypes.CurrencyPairGenesis, len(markets)) for i, market := range markets { - currencyPairGenesis[i+1] = oracletypes.CurrencyPairGenesis{ + currencyPairGenesis[i] = oracletypes.CurrencyPairGenesis{ CurrencyPair: market.Ticker.CurrencyPair, CurrencyPairPrice: nil, Nonce: 0, @@ -105,26 +81,6 @@ func (genState GenesisState) AddMarketData(cdc codec.JSONCodec, ac address.Codec return genState } -func (genState GenesisState) ConfigureAuctionFee(cdc codec.JSONCodec, denom string) GenesisState { - var auctionGenState auctiontypes.GenesisState - cdc.MustUnmarshalJSON(genState[auctiontypes.ModuleName], &auctionGenState) - auctionGenState.Params.ReserveFee.Denom = denom - auctionGenState.Params.MinBidIncrement.Denom = denom - genState[auctiontypes.ModuleName] = cdc.MustMarshalJSON(&auctionGenState) - - return genState -} - -// ConfigureMinGasPrices generates the default state for the application. -func (genState GenesisState) ConfigureMinGasPrices(cdc codec.JSONCodec) GenesisState { - var opChildGenState opchildtypes.GenesisState - cdc.MustUnmarshalJSON(genState[opchildtypes.ModuleName], &opChildGenState) - opChildGenState.Params.MinGasPrices = nil - genState[opchildtypes.ModuleName] = cdc.MustMarshalJSON(&opChildGenState) - - return genState -} - func (genState GenesisState) ConfigureICA(cdc codec.JSONCodec) GenesisState { // create ICS27 Controller submodule params controllerParams := icacontrollertypes.Params{ @@ -188,3 +144,80 @@ 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/genesis_account.go b/app/genesis_account.go new file mode 100644 index 000000000..66d6d0ce5 --- /dev/null +++ b/app/genesis_account.go @@ -0,0 +1,56 @@ +package milkyway + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +var _ authtypes.GenesisAccount = (*SimGenesisAccount)(nil) + +// SimGenesisAccount defines a type that implements the GenesisAccount interface +// to be used for simulation accounts in the genesis state. +type SimGenesisAccount struct { + *authtypes.BaseAccount + + // vesting account fields + OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization + DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation + DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation + StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time) + EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time) + + // module account fields + ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account + ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account +} + +// Validate checks for errors on the vesting and module account parameters +func (sga SimGenesisAccount) Validate() error { + if sga.OriginalVesting.IsAnyNil() { + return errors.New("OriginalVesting amount must not be nil") + } + + if !sga.OriginalVesting.IsZero() { + if sga.StartTime >= sga.EndTime { + return errors.New("vesting start-time cannot be before end-time") + } + } + + if sga.BaseAccount == nil { + return errors.New("BaseAccount must not be nil") + } + + if sga.ModuleName != "" { + ma := authtypes.ModuleAccount{ + BaseAccount: sga.BaseAccount, Name: sga.ModuleName, Permissions: sga.ModulePermissions, + } + + if err := ma.Validate(); err != nil { + return err + } + } + + return sga.BaseAccount.Validate() +} diff --git a/app/genesis_account_fuzz_test.go b/app/genesis_account_fuzz_test.go new file mode 100644 index 000000000..79dc98bd2 --- /dev/null +++ b/app/genesis_account_fuzz_test.go @@ -0,0 +1,37 @@ +package milkyway_test + +import ( + "runtime/debug" + "testing" + + fuzz "github.com/google/gofuzz" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +func TestFuzzGenesisAccountValidate(t *testing.T) { + if testing.Short() { + t.Skip("running in -short mode") + } + + t.Parallel() + + acct := new(milkyway.SimGenesisAccount) + i := 0 + defer func() { + r := recover() + if r == nil { + return + } + + // Otherwise report on the configuration and iteration. + t.Fatalf("Failed SimGenesisAccount on iteration #%d: %#v\n\n%s\n\n%s", i, acct, r, debug.Stack()) + }() + + f := fuzz.New() + for i = 0; i < 1e5; i++ { + acct = new(milkyway.SimGenesisAccount) + f.Fuzz(acct) + acct.Validate() //nolint:errcheck + } +} diff --git a/app/genesis_test.go b/app/genesis_test.go new file mode 100644 index 000000000..074186a39 --- /dev/null +++ b/app/genesis_test.go @@ -0,0 +1,33 @@ +package milkyway_test + +import ( + "testing" + + "cosmossdk.io/log" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/baseapp" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + oracleconfig "github.com/skip-mev/connect/v2/oracle/config" + marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +func TestNewDefaultGenesisState(t *testing.T) { + app := milkyway.NewMilkyWayApp( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + map[int64]bool{}, + t.TempDir(), + oracleconfig.NewDefaultAppConfig(), + simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), + []wasmkeeper.Option{}, + baseapp.SetChainID("milkyway-app"), + ) + + genesis := milkyway.NewDefaultGenesisState(app.AppCodec(), app.ModuleBasics) + println(genesis[marketmaptypes.ModuleName]) +} diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go new file mode 100644 index 000000000..64555eca6 --- /dev/null +++ b/app/helpers/test_helpers.go @@ -0,0 +1,216 @@ +package helpers + +import ( + "encoding/json" + "os" + "testing" + "time" + + oracleconfig "github.com/skip-mev/connect/v2/oracle/config" + "github.com/stretchr/testify/require" + + 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" + + "cosmossdk.io/log" + "cosmossdk.io/math" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/testutil/mock" + 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" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +// SimAppChainID hardcoded chainID for simulation +const ( + SimAppChainID = "milkyway-app" +) + +// DefaultConsensusParams defines the default Tendermint consensus params used +// in MilkyWayApp testing. +var DefaultConsensusParams = &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ + MaxBytes: 200000, + MaxGas: 2000000, + }, + Evidence: &tmproto.EvidenceParams{ + MaxAgeNumBlocks: 302400, + MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration + MaxBytes: 10000, + }, + Validator: &tmproto.ValidatorParams{ + PubKeyTypes: []string{ + tmtypes.ABCIPubKeyTypeEd25519, + }, + }, +} + +type PV struct { + PrivKey cryptotypes.PrivKey +} + +type EmptyAppOptions struct{} + +func (EmptyAppOptions) Get(_ string) interface{} { return nil } + +func Setup(t *testing.T) *milkyway.MilkyWayApp { + t.Helper() + + privVal := mock.NewPV() + pubKey, err := privVal.GetPubKey() + require.NoError(t, err) + // create validator set with single validator + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + + // generate genesis account + senderPrivKey := mock.NewPV() + senderPubKey := senderPrivKey.PrivKey.PubKey() + + acc := authtypes.NewBaseAccount(senderPubKey.Address().Bytes(), senderPubKey, 0, 0) + balance := banktypes.Balance{ + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000000000000))), + } + genesisAccounts := []authtypes.GenesisAccount{acc} + app := SetupWithGenesisValSet(t, valSet, genesisAccounts, balance) + + return app +} + +// SetupWithGenesisValSet initializes a new MilkyWayApp with a validator set and genesis accounts +// that also act as delegators. For simplicity, each validator is bonded with a delegation +// of one consensus engine unit in the default token of the MilkyWayApp from first genesis +// account. A Nop logger is set in MilkyWayApp. +func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *milkyway.MilkyWayApp { + t.Helper() + + milkyWayApp, genesisState := setup() + genesisState = genesisStateWithValSet(t, milkyWayApp, genesisState, valSet, genAccs, balances...) + + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) + + // init chain will set the validator set and initialize the genesis accounts + _, err = milkyWayApp.InitChain( + &abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: DefaultConsensusParams, + AppStateBytes: stateBytes, + }, + ) + require.NoError(t, err) + + require.NoError(t, err) + _, err = milkyWayApp.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: milkyWayApp.LastBlockHeight() + 1, + Hash: milkyWayApp.LastCommitID().Hash, + NextValidatorsHash: valSet.Hash(), + }) + require.NoError(t, err) + + return milkyWayApp +} + +func setup() (*milkyway.MilkyWayApp, milkyway.GenesisState) { + db := dbm.NewMemDB() + dir, err := os.MkdirTemp("", "milkyway-test-app") + if err != nil { + panic(err) + } + + appOptions := make(simtestutil.AppOptionsMap, 0) + emptyWasmOpts := []wasmkeeper.Option{} + appOptions[server.FlagInvCheckPeriod] = 5 + appOptions[server.FlagMinGasPrices] = "0uatom" + + milkyWayApp := milkyway.NewMilkyWayApp( + log.NewNopLogger(), + db, + nil, + true, + map[int64]bool{}, + dir, + oracleconfig.NewDefaultAppConfig(), + appOptions, + emptyWasmOpts, + ) + return milkyWayApp, milkyWayApp.ModuleBasics.DefaultGenesis(milkyWayApp.AppCodec()) +} + +func genesisStateWithValSet(t *testing.T, + app *milkyway.MilkyWayApp, genesisState milkyway.GenesisState, + valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, + balances ...banktypes.Balance, +) milkyway.GenesisState { + t.Helper() + // set genesis accounts + authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) + genesisState[authtypes.ModuleName] = app.AppCodec().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, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey) + require.NoError(t, err) + pkAny, err := codectypes.NewAnyWithValue(pk) + require.NoError(t, err) + validator := stakingtypes.Validator{ + OperatorAddress: sdk.ValAddress(val.Address).String(), + ConsensusPubkey: pkAny, + Jailed: false, + Status: stakingtypes.Bonded, + Tokens: bondAmt, + DelegatorShares: math.LegacyOneDec(), + Description: stakingtypes.Description{}, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), + } + validators = append(validators, validator) + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), math.LegacyOneDec())) + + } + // set validators and delegations + stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) + genesisState[stakingtypes.ModuleName] = app.AppCodec().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] = app.AppCodec().MustMarshalJSON(bankGenesis) + + return genesisState +} diff --git a/app/ibc-hooks/README.md b/app/ibc-hooks/README.md deleted file mode 100644 index 30e7b0a88..000000000 --- a/app/ibc-hooks/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# IBC-hooks - -## Wasm Hooks - -The wasm hook is an IBC middleware which is used to allow ICS-20 token transfers to initiate contract calls. -This allows cross-chain contract calls, that involve token movement. -This is useful for a variety of usecases. -One of primary importance is cross-chain swaps, which is an extremely powerful primitive. - -The mechanism enabling this is a `memo` field on every ICS20 or ICS721 transfer packet as of [IBC v3.4.0](https://medium.com/the-interchain-foundation/moving-beyond-simple-token-transfers-d42b2b1dc29b). -Wasm hooks is an IBC middleware that parses an ICS20 transfer, and if the `memo` field is of a particular form, executes a wasm contract call. We now detail the `memo` format for `wasm` contract calls, and the execution guarantees provided. - -### Cosmwasm Contract Execution Format - -Before we dive into the IBC metadata format, we show the cosmwasm execute message format, so the reader has a sense of what are the fields we need to be setting in. -The cosmwasm `MsgExecuteContract` is defined [here](https://github.com/CosmWasm/wasmd/blob/4fe2fbc8f322efdaf187e2e5c99ce32fd1df06f0/x/wasm/types/tx.pb.go#L340-L349 -) as the following type: - -```go -// HookData defines a wrapper for wasm execute message -// and async callback. -type HookData struct { - // Message is a wasm execute message which will be executed - // at `OnRecvPacket` of receiver chain. - Message *wasmtypes.MsgExecuteContract `json:"message,omitempty"` - - // AsyncCallback is a contract address - AsyncCallback string `json:"async_callback,omitempty"` -} - -type MsgExecuteContract struct { - // Contract is the address of the smart contract - Contract string - // Msg json encoded message to be passed to the contract - Msg RawContractMessage -} -``` - -So we detail where we want to get each of these fields from: - -* Sender: We cannot trust the sender of an IBC packet, the counterparty chain has full ability to lie about it. -We cannot risk this sender being confused for a particular user or module address on the chain. -So we replace the sender with an account to represent the sender prefixed by the channel and a wasm module prefix. -This is done by setting the sender to `Bech32(Hash("ibc-wasm-hook-intermediary" || channelID || sender))`, where the channelId is the channel id on the local chain. -* Contract: This field should be directly obtained from the ICS-20 packet metadata -* Msg: This field should be directly obtained from the ICS-20 packet metadata. - -> **_WARNING:_** Due to a [bug](https://twitter.com/SCVSecurity/status/1682329758020022272) in the packet forward middleware, we cannot trust the sender from chains that use PFM. Until that is fixed, we recommend chains to not trust the sender on contracts executed via IBC hooks. - -So our constructed cosmwasm message that we execute will look like: - -```go -msg := MsgExecuteContract{ - // Contract is the address of the smart contract - Contract: packet.data.memo["wasm"]["contract"], - // Msg json encoded message to be passed to the contract - Msg: packet.data.memo["wasm"]["msg"], -} -``` - -### ICS20 packet structure - -So given the details above, we propagate the implied ICS20 packet data structure. -ICS20 is JSON native, so we use JSON for the memo format. - -```json -{ - //... other ibc fields that we don't care about - "data":{ - "denom": "denom on counterparty chain (e.g. uatom)", // will be transformed to the local denom (ibc/...) - "amount": "1000", - "sender": "addr on counterparty chain", // will be transformed - "receiver": "contract addr or blank", - "memo": { - "wasm": { - "message": { - "contract": "init1contractAddr", - "msg": { - "raw_message_fields": "raw_message_data", - } - } - } - } - } -} -``` - -An ICS20 packet is formatted correctly for wasmhooks iff the following all hold: - -* `memo` is not blank -* `memo` is valid JSON -* `memo` has at least one key, with value `"wasm"` -* `memo["wasm"]["message"]` has exactly two entries, `"contract"` and `"msg"` -* `memo["wasm"]["message"]["msg"]` is a valid JSON object -* `receiver == "" || receiver == memo["wasm"]["contract"]` - -We consider an ICS20 packet as directed towards wasmhooks iff all of the following hold: - -* `memo` is not blank -* `memo` is valid JSON -* `memo` has at least one key, with name `"wasm"` - -If an ICS20 packet is not directed towards wasmhooks, wasmhooks doesn't do anything. -If an ICS20 packet is directed towards wasmhooks, and is formatted incorrectly, then wasmhooks returns an error. - -### Execution flow - -Pre wasm hooks: - -* Ensure the incoming IBC packet is cryptogaphically valid -* Ensure the incoming IBC packet is not timed out. - -In Wasm hooks, pre packet execution: - -* Ensure the packet is correctly formatted (as defined above) -* Edit the receiver to be the hardcoded IBC module account - -In wasm hooks, post packet execution: - -* Construct wasm message as defined before -* Execute wasm message -* if wasm message has error, return ErrAck -* otherwise continue through middleware - -## Ack callbacks - -A contract that sends an IBC transfer, may need to listen for the ACK from that packet. To allow -contracts to listen on the ack of specific packets, we provide Ack callbacks. - -### Design - -The sender of an IBC transfer packet may specify a callback for when the ack of that packet is received in the memo -field of the transfer packet. - -Crucially, _only_ the IBC packet sender can set the callback. - -### Use case - -The crosschain swaps implementation sends an IBC transfer. If the transfer were to fail, we want to allow the sender -to be able to retrieve their funds (which would otherwise be stuck in the contract). To do this, we allow users to -retrieve the funds after the timeout has passed, but without the ack information, we cannot guarantee that the send -hasn't failed (i.e.: returned an error ack notifying that the receiving change didn't accept it) - -### Implementation - -#### Callback information in memo - -For the callback to be processed, the transfer packet's memo should contain the following in its JSON: - -```json -{ - "wasm": { - "async_callback": "init1contractAddr" - } -} -``` - -When an ack is received, it will notify the specified contract via a sudo message. - -#### Interface for receiving the Acks and Timeouts - -The contract that awaits the callback should implement the following interface for a sudo message: - -```rust -#[cw_serde] -pub enum IBCLifecycleComplete { - #[serde(rename = "ibc_ack")] - IBCAck { - /// The source channel (milkyway side) of the IBC packet - channel: String, - /// The sequence number that the packet was sent with - sequence: u64, - /// String encoded version of the ack as seen by OnAcknowledgementPacket(..) - ack: String, - /// Weather an ack is a success of failure according to the transfer spec - success: bool, - }, - #[serde(rename = "ibc_timeout")] - IBCTimeout { - /// The source channel (milkyway side) of the IBC packet - channel: String, - /// The sequence number that the packet was sent with - sequence: u64, - }, -} - -/// Message type for `sudo` entry_point -#[cw_serde] -pub enum SudoMsg { - #[serde(rename = "ibc_lifecycle_complete")] - IBCLifecycleComplete(IBCLifecycleComplete), -} -``` diff --git a/app/ibc-hooks/ack.go b/app/ibc-hooks/ack.go deleted file mode 100644 index 921d75a6b..000000000 --- a/app/ibc-hooks/ack.go +++ /dev/null @@ -1,195 +0,0 @@ -package wasm_hooks - -import ( - "encoding/json" - "fmt" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - "github.com/initia-labs/initia/x/ibc-hooks/types" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" -) - -func (h WasmHooks) onAckIcs20Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet channeltypes.Packet, - acknowledgement []byte, - relayer sdk.AccAddress, - data transfertypes.FungibleTokenPacketData, -) error { - if err := im.App.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer); err != nil { - return err - } - - isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo()) - if !isWasmRouted || hookData.AsyncCallback == "" { - return nil - } else if err != nil { - h.wasmKeeper.Logger(ctx).Error("failed to parse memo", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to parse memo"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } - - // create a new cache context to ignore errors during - // the execution of the callback - cacheCtx, write := ctx.CacheContext() - - callback := hookData.AsyncCallback - if allowed, err := h.checkACL(im, cacheCtx, callback); err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } else if !allowed { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "not allowed") - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, "not allowed"), - )) - - return nil - } - - contractAddr, err := h.ac.StringToBytes(callback) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("invalid contract address", "error", err) - return nil - } - - success := "false" - if !isAckError(h.codec, acknowledgement) { - success = "true" - } - - // Notify the sender that the ack has been received - ackAsJson, err := json.Marshal(acknowledgement) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("ack is not json object", "error", err) - return nil - } - - sudoMsg := []byte(fmt.Sprintf( - `{"ibc_lifecycle_complete": {"ibc_ack": {"channel": "%s", "sequence": %d, "ack": %s, "success": %s}}}`, - packet.SourceChannel, packet.Sequence, ackAsJson, success)) - _, err = h.wasmKeeper.Sudo(cacheCtx, contractAddr, sudoMsg) - if err != nil { - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to execute callback"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return errorsmod.Wrap(err, "Ack callback error") - } - - // write the cache context only if the callback execution was successful - write() - - return nil -} - -func (h WasmHooks) onAckIcs721Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet channeltypes.Packet, - acknowledgement []byte, - relayer sdk.AccAddress, - data nfttransfertypes.NonFungibleTokenPacketData, -) error { - if err := im.App.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer); err != nil { - return err - } - - isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo()) - if !isWasmRouted || hookData.AsyncCallback == "" { - return nil - } else if err != nil { - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to parse memo"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - h.wasmKeeper.Logger(ctx).Error("failed to parse memo", "error", err) - return nil - } - - // create a new cache context to ignore errors during - // the execution of the callback - cacheCtx, write := ctx.CacheContext() - - callback := hookData.AsyncCallback - if allowed, err := h.checkACL(im, cacheCtx, callback); err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } else if !allowed { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "not allowed") - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, "not allowed"), - )) - - return nil - } - - contractAddr, err := h.ac.StringToBytes(callback) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("invalid contract address", "error", err) - return nil - } - - success := "false" - if !isAckError(h.codec, acknowledgement) { - success = "true" - } - - // Notify the sender that the ack has been received - ackAsJson, err := json.Marshal(acknowledgement) - if err != nil { - // If the ack is not a json object, error - h.wasmKeeper.Logger(cacheCtx).Error("ack is not json object", "error", err) - return nil - } - - sudoMsg := []byte(fmt.Sprintf( - `{"ibc_lifecycle_complete": {"ibc_ack": {"channel": "%s", "sequence": %d, "ack": %s, "success": %s}}}`, - packet.SourceChannel, packet.Sequence, ackAsJson, success)) - _, err = h.wasmKeeper.Sudo(cacheCtx, contractAddr, sudoMsg) - if err != nil { - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to execute callback"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - h.wasmKeeper.Logger(cacheCtx).Error("failed to execute callback", "error", err) - return nil - } - - // write the cache context only if the callback execution was successful - write() - - return nil -} diff --git a/app/ibc-hooks/ack_test.go b/app/ibc-hooks/ack_test.go deleted file mode 100644 index cb953ce74..000000000 --- a/app/ibc-hooks/ack_test.go +++ /dev/null @@ -1,246 +0,0 @@ -package wasm_hooks_test - -import ( - "encoding/json" - "errors" - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func Test_OnAckPacket(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - _, _, addr2 := keyPubAddr() - - data := transfertypes.FungibleTokenPacketData{ - Denom: "foo", - Amount: "10000", - Sender: addr.String(), - Receiver: addr2.String(), - Memo: "", - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - ackBz, err := json.Marshal(channeltypes.NewResultAcknowledgement([]byte{byte(1)})) - require.NoError(t, err) - - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, ackBz, addr) - require.NoError(t, err) -} - -func Test_OnAckPacket_memo(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - - code, err := os.ReadFile("./contracts/artifacts/counter-aarch64.wasm") - require.NoError(t, err) - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper) - storeRes, err := wasmMsgServer.StoreCode(ctx, &wasmtypes.MsgStoreCode{ - Sender: addr.String(), - WASMByteCode: code, - }) - require.NoError(t, err) - - instantiateRes, err := wasmMsgServer.InstantiateContract(ctx, &wasmtypes.MsgInstantiateContract{ - Sender: addr.String(), - Admin: addr.String(), - CodeID: storeRes.CodeID, - Label: "Counter", - Msg: []byte("{}"), - Funds: nil, - }) - require.NoError(t, err) - - contractAddrBech32 := instantiateRes.Address - contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32) - require.NoError(t, err) - - data := transfertypes.FungibleTokenPacketData{ - Denom: "foo", - Amount: "10000", - Sender: addr.String(), - Receiver: contractAddrBech32, - Memo: fmt.Sprintf(`{ - "wasm": { - "async_callback": "%s" - } - }`, contractAddrBech32), - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - successAckBz := channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement() - failedAckBz := channeltypes.NewErrorAcknowledgement(errors.New("failed")).Acknowledgement() - - // hook should not be called to due to acl - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, successAckBz, addr) - require.NoError(t, err) - - queryRes, err := input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "0", string(queryRes)) - - // set acl - require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr, true)) - - // success with success ack - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - Sequence: 99, - }, successAckBz, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err = input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "99", string(queryRes)) - - // success with failed ack - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - Sequence: 99, - }, failedAckBz, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err = input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "100", string(queryRes)) -} - -func Test_OnAckPacket_ICS721(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - _, _, addr2 := keyPubAddr() - - data := nfttransfertypes.NonFungibleTokenPacketDataWasm{ - ClassId: "classId", - ClassUri: "classUri", - ClassData: "classData", - TokenIds: []string{"tokenId"}, - TokenUris: []string{"tokenUri"}, - TokenData: []string{"tokenData"}, - Sender: addr.String(), - Receiver: addr2.String(), - Memo: "", - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - ackBz, err := json.Marshal(channeltypes.NewResultAcknowledgement([]byte{byte(1)})) - require.NoError(t, err) - - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, ackBz, addr) - require.NoError(t, err) -} - -func Test_OnAckPacket_memo_ICS721(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - - code, err := os.ReadFile("./contracts/artifacts/counter-aarch64.wasm") - require.NoError(t, err) - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper) - storeRes, err := wasmMsgServer.StoreCode(ctx, &wasmtypes.MsgStoreCode{ - Sender: addr.String(), - WASMByteCode: code, - }) - require.NoError(t, err) - - instantiateRes, err := wasmMsgServer.InstantiateContract(ctx, &wasmtypes.MsgInstantiateContract{ - Sender: addr.String(), - Admin: addr.String(), - CodeID: storeRes.CodeID, - Label: "Counter", - Msg: []byte("{}"), - Funds: nil, - }) - require.NoError(t, err) - - contractAddrBech32 := instantiateRes.Address - contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32) - require.NoError(t, err) - - data := nfttransfertypes.NonFungibleTokenPacketDataWasm{ - ClassId: "classId", - ClassUri: "classUri", - ClassData: "classData", - TokenIds: []string{"tokenId"}, - TokenUris: []string{"tokenUri"}, - TokenData: []string{"tokenData"}, - Sender: addr.String(), - Receiver: contractAddrBech32, - Memo: fmt.Sprintf(`{ - "wasm": { - "async_callback": "%s" - } - }`, contractAddrBech32), - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - successAckBz := channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement() - failedAckBz := channeltypes.NewErrorAcknowledgement(errors.New("failed")).Acknowledgement() - - // success with success ack - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, successAckBz, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err := input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "0", string(queryRes)) - - // set acl - require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr, true)) - - // success with success ack - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - Sequence: 99, - }, successAckBz, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err = input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "99", string(queryRes)) - - // success with failed ack - err = input.IBCHooksMiddleware.OnAcknowledgementPacket(ctx, channeltypes.Packet{ - Data: dataBz, - Sequence: 99, - }, failedAckBz, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err = input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "100", string(queryRes)) -} diff --git a/app/ibc-hooks/common_test.go b/app/ibc-hooks/common_test.go deleted file mode 100644 index dcb415428..000000000 --- a/app/ibc-hooks/common_test.go +++ /dev/null @@ -1,394 +0,0 @@ -package wasm_hooks_test - -import ( - "encoding/binary" - "slices" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/ed25519" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - - "cosmossdk.io/log" - "cosmossdk.io/math" - "cosmossdk.io/store" - "cosmossdk.io/store/metrics" - storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/tx/signing" - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/std" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gogoproto/proto" - - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - ibchookskeeper "github.com/initia-labs/initia/x/ibc-hooks/keeper" - ibchookstypes "github.com/initia-labs/initia/x/ibc-hooks/types" - - "github.com/CosmWasm/wasmd/x/wasm" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - wasmhooks "github.com/milkyway-labs/milkyway/app/ibc-hooks" -) - -var ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - ibchooks.AppModuleBasic{}, - wasm.AppModuleBasic{}, - ibc.AppModuleBasic{}, -) - -var ( - initiaSupply = math.NewInt(100_000_000_000) - testDenoms = []string{ - "test1", - "test2", - "test3", - "test4", - "test5", - } -) - -type EncodingConfig struct { - InterfaceRegistry codectypes.InterfaceRegistry - Codec codec.Codec - TxConfig client.TxConfig - Amino *codec.LegacyAmino -} - -func MakeTestCodec(t testing.TB) codec.Codec { - return MakeEncodingConfig(t).Codec -} - -func MakeEncodingConfig(_ testing.TB) EncodingConfig { - interfaceRegistry, _ := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{ - ProtoFiles: proto.HybridResolver, - SigningOptions: signing.Options{ - AddressCodec: codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), - ValidatorAddressCodec: codecaddress.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), - }, - }) - appCodec := codec.NewProtoCodec(interfaceRegistry) - legacyAmino := codec.NewLegacyAmino() - txConfig := tx.NewTxConfig(appCodec, tx.DefaultSignModes) - - std.RegisterInterfaces(interfaceRegistry) - std.RegisterLegacyAminoCodec(legacyAmino) - - ModuleBasics.RegisterLegacyAminoCodec(legacyAmino) - ModuleBasics.RegisterInterfaces(interfaceRegistry) - - return EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: appCodec, - TxConfig: txConfig, - Amino: legacyAmino, - } -} - -var bondDenom = sdk.DefaultBondDenom - -func initialTotalSupply() sdk.Coins { - faucetBalance := sdk.NewCoins(sdk.NewCoin(bondDenom, initiaSupply)) - for _, testDenom := range testDenoms { - faucetBalance = faucetBalance.Add(sdk.NewCoin(testDenom, initiaSupply)) - } - - return faucetBalance -} - -type TestFaucet struct { - t testing.TB - bankKeeper bankkeeper.Keeper - sender sdk.AccAddress - balance sdk.Coins - minterModuleName string -} - -func NewTestFaucet(t testing.TB, ctx sdk.Context, bankKeeper bankkeeper.Keeper, minterModuleName string, initiaSupply ...sdk.Coin) *TestFaucet { - require.NotEmpty(t, initiaSupply) - r := &TestFaucet{t: t, bankKeeper: bankKeeper, minterModuleName: minterModuleName} - _, _, addr := keyPubAddr() - r.sender = addr - r.Mint(ctx, addr, initiaSupply...) - r.balance = initiaSupply - return r -} - -func (f *TestFaucet) Mint(parentCtx sdk.Context, addr sdk.AccAddress, amounts ...sdk.Coin) { - amounts = sdk.Coins(amounts).Sort() - require.NotEmpty(f.t, amounts) - ctx := parentCtx.WithEventManager(sdk.NewEventManager()) // discard all faucet related events - err := f.bankKeeper.MintCoins(ctx, f.minterModuleName, amounts) - require.NoError(f.t, err) - err = f.bankKeeper.SendCoinsFromModuleToAccount(ctx, f.minterModuleName, addr, amounts) - require.NoError(f.t, err) - f.balance = f.balance.Add(amounts...) -} - -func (f *TestFaucet) Fund(parentCtx sdk.Context, receiver sdk.AccAddress, amounts ...sdk.Coin) { - require.NotEmpty(f.t, amounts) - // ensure faucet is always filled - if !f.balance.IsAllGTE(amounts) { - f.Mint(parentCtx, f.sender, amounts...) - } - ctx := parentCtx.WithEventManager(sdk.NewEventManager()) // discard all faucet related events - err := f.bankKeeper.SendCoins(ctx, f.sender, receiver, amounts) - require.NoError(f.t, err) - f.balance = f.balance.Sub(amounts...) -} - -func (f *TestFaucet) NewFundedAccount(ctx sdk.Context, amounts ...sdk.Coin) sdk.AccAddress { - _, _, addr := keyPubAddr() - f.Fund(ctx, addr, amounts...) - return addr -} - -type TestKeepers struct { - AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.Keeper - IBCHooksKeeper *ibchookskeeper.Keeper - IBCHooksMiddleware ibchooks.IBCMiddleware - WasmKeeper wasmkeeper.Keeper - - EncodingConfig EncodingConfig - Faucet *TestFaucet - MultiStore storetypes.CommitMultiStore -} - -// createDefaultTestInput common settings for createTestInput -func createDefaultTestInput(t testing.TB) (sdk.Context, TestKeepers) { - return createTestInput(t, false) -} - -// createTestInput encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) -func createTestInput(t testing.TB, isCheckTx bool) (sdk.Context, TestKeepers) { - // Load default move config - return _createTestInput(t, isCheckTx, dbm.NewMemDB()) -} - -var keyCounter uint64 - -// we need to make this deterministic (same every test run), as encoded address size and thus gas cost, -// depends on the actual bytes (due to ugly CanonicalAddress encoding) -func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) { - keyCounter++ - seed := make([]byte, 8) - binary.BigEndian.PutUint64(seed, keyCounter) - - key := ed25519.GenPrivKeyFromSecret(seed) - pub := key.PubKey() - addr := sdk.AccAddress(pub.Address()) - return key, pub, addr -} - -// encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) -func _createTestInput( - t testing.TB, - isCheckTx bool, - db dbm.DB, -) (sdk.Context, TestKeepers) { - keys := storetypes.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, - distributiontypes.StoreKey, wasmtypes.StoreKey, ibchookstypes.StoreKey, - ) - ms := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) - for _, v := range keys { - ms.MountStoreWithDB(v, storetypes.StoreTypeIAVL, db) - } - memKeys := storetypes.NewMemoryStoreKeys() - for _, v := range memKeys { - ms.MountStoreWithDB(v, storetypes.StoreTypeMemory, db) - } - - require.NoError(t, ms.LoadLatestVersion()) - - ctx := sdk.NewContext(ms, tmproto.Header{ - Height: 1, - Time: time.Date(2020, time.April, 22, 12, 0, 0, 0, time.UTC), - }, isCheckTx, log.NewNopLogger()).WithHeaderHash(make([]byte, 32)) - - encodingConfig := MakeEncodingConfig(t) - appCodec := encodingConfig.Codec - - maccPerms := map[string][]string{ // module account permissions - authtypes.FeeCollectorName: nil, - - // for testing - authtypes.Minter: {authtypes.Minter, authtypes.Burner}, - } - - ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) - - accountKeeper := authkeeper.NewAccountKeeper( - appCodec, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), // target store - authtypes.ProtoBaseAccount, // prototype - maccPerms, - ac, - sdk.GetConfig().GetBech32AccountAddrPrefix(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - blockedAddrs := make(map[string]bool) - for acc := range maccPerms { - blockedAddrs[authtypes.NewModuleAddress(acc).String()] = true - } - - bankKeeper := bankkeeper.NewBaseKeeper( - appCodec, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), - accountKeeper, - blockedAddrs, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ctx.Logger().With("module", "x/"+banktypes.ModuleName), - ) - require.NoError(t, bankKeeper.SetParams(ctx, banktypes.DefaultParams())) - - ibcHooksKeeper := ibchookskeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[ibchookstypes.StoreKey]), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ac, - ) - require.NoError(t, ibcHooksKeeper.Params.Set(ctx, ibchookstypes.DefaultParams())) - - wasmKeeper := wasmkeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), - accountKeeper, - bankKeeper, - nil, - nil, - nil, - nil, - nil, - nil, - nil, - nil, - nil, - t.TempDir(), - wasmtypes.DefaultWasmConfig(), - slices.DeleteFunc(wasmkeeper.BuiltInCapabilities(), func(s string) bool { - return s == "staking" - }), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - wasmParams := wasmtypes.DefaultParams() - require.NoError(t, wasmKeeper.SetParams(ctx, wasmParams)) - - faucet := NewTestFaucet(t, ctx, bankKeeper, authtypes.Minter, initialTotalSupply()...) - - // ibc middleware setup - - mockIBCMiddleware := mockIBCMiddleware{} - wasmHooks := wasmhooks.NewWasmHooks(appCodec, ac, &wasmKeeper) - - middleware := ibchooks.NewICS4Middleware(mockIBCMiddleware, wasmHooks) - ibcHookMiddleware := ibchooks.NewIBCMiddleware(mockIBCMiddleware, middleware, ibcHooksKeeper) - - keepers := TestKeepers{ - AccountKeeper: accountKeeper, - IBCHooksKeeper: ibcHooksKeeper, - IBCHooksMiddleware: ibcHookMiddleware, - WasmKeeper: wasmKeeper, - BankKeeper: bankKeeper, - EncodingConfig: encodingConfig, - Faucet: faucet, - MultiStore: ms, - } - return ctx, keepers -} - -// do nothing ibc middleware -var _ porttypes.IBCModule = mockIBCMiddleware{} -var _ porttypes.ICS4Wrapper = mockIBCMiddleware{} - -type mockIBCMiddleware struct{} - -// GetAppVersion implements types.ICS4Wrapper. -func (m mockIBCMiddleware) GetAppVersion(ctx sdk.Context, portID string, channelID string) (string, bool) { - return "", false -} - -// SendPacket implements types.ICS4Wrapper. -func (m mockIBCMiddleware) SendPacket(ctx sdk.Context, chanCap *capabilitytypes.Capability, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (sequence uint64, err error) { - return 0, nil -} - -// WriteAcknowledgement implements types.ICS4Wrapper. -func (m mockIBCMiddleware) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, ack ibcexported.Acknowledgement) error { - return nil -} - -// OnAcknowledgementPacket implements types.IBCModule. -func (m mockIBCMiddleware) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { - return nil -} - -// OnChanCloseConfirm implements types.IBCModule. -func (m mockIBCMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID string, channelID string) error { - return nil -} - -// OnChanCloseInit implements types.IBCModule. -func (m mockIBCMiddleware) OnChanCloseInit(ctx sdk.Context, portID string, channelID string) error { - return nil -} - -// OnChanOpenAck implements types.IBCModule. -func (m mockIBCMiddleware) OnChanOpenAck(ctx sdk.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error { - return nil -} - -// OnChanOpenConfirm implements types.IBCModule. -func (m mockIBCMiddleware) OnChanOpenConfirm(ctx sdk.Context, portID string, channelID string) error { - return nil -} - -// OnChanOpenInit implements types.IBCModule. -func (m mockIBCMiddleware) OnChanOpenInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string) (string, error) { - return "", nil -} - -// OnChanOpenTry implements types.IBCModule. -func (m mockIBCMiddleware) OnChanOpenTry(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string) (version string, err error) { - return "", nil -} - -// OnRecvPacket implements types.IBCModule. -func (m mockIBCMiddleware) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) ibcexported.Acknowledgement { - return channeltypes.NewResultAcknowledgement([]byte{byte(1)}) -} - -// OnTimeoutPacket implements types.IBCModule. -func (m mockIBCMiddleware) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error { - return nil -} diff --git a/app/ibc-hooks/contracts/.cargo/config b/app/ibc-hooks/contracts/.cargo/config deleted file mode 100644 index 336b618a1..000000000 --- a/app/ibc-hooks/contracts/.cargo/config +++ /dev/null @@ -1,4 +0,0 @@ -[alias] -wasm = "build --release --target wasm32-unknown-unknown" -unit-test = "test --lib" -schema = "run --example schema" diff --git a/app/ibc-hooks/contracts/.editorconfig b/app/ibc-hooks/contracts/.editorconfig deleted file mode 100644 index 3d36f20b1..000000000 --- a/app/ibc-hooks/contracts/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.rs] -indent_size = 4 diff --git a/app/ibc-hooks/contracts/.gitignore b/app/ibc-hooks/contracts/.gitignore deleted file mode 100644 index dfdaaa6bc..000000000 --- a/app/ibc-hooks/contracts/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# Build results -/target - -# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327) -.cargo-ok - -# Text file backups -**/*.rs.bk - -# macOS -.DS_Store - -# IDEs -*.iml -.idea diff --git a/app/ibc-hooks/contracts/Cargo.lock b/app/ibc-hooks/contracts/Cargo.lock deleted file mode 100644 index a805e0aeb..000000000 --- a/app/ibc-hooks/contracts/Cargo.lock +++ /dev/null @@ -1,695 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bnum" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "cosmwasm-crypto" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7a339f6b59ff7ad4ae05a70512a4f3c19bf8fcc845d46bfef90f4ec0810f72c" -dependencies = [ - "digest 0.10.7", - "ed25519-zebra", - "k256", - "rand_core 0.6.4", - "thiserror", -] - -[[package]] -name = "cosmwasm-derive" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d3bfea6af94a83880fb05478135ed0c256d9a2fcde58c595a10d64dcb9c925d" -dependencies = [ - "syn 1.0.109", -] - -[[package]] -name = "cosmwasm-schema" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "101d0739564bd34cba9b84bf73665f0822487ae3b29b2dd59930608ed3aafd43" -dependencies = [ - "cosmwasm-schema-derive", - "schemars", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "cosmwasm-schema-derive" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4be75f60158478da2c5d319ed59295bca1687ad50c18215a0485aa91a995ea" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cosmwasm-std" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded932165de44cd0717979c34fc3b84d8e8066b8dde4f5bd78f96a643b090f90" -dependencies = [ - "base64", - "bech32", - "bnum", - "cosmwasm-crypto", - "cosmwasm-derive", - "derivative", - "forward_ref", - "hex", - "schemars", - "serde", - "serde-json-wasm", - "sha2 0.10.8", - "static_assertions", - "thiserror", -] - -[[package]] -name = "counter" -version = "0.1.0" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus", -] - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "cw-storage-plus" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", -] - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - -[[package]] -name = "ed25519-zebra" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" -dependencies = [ - "curve25519-dalek", - "hashbrown", - "hex", - "rand_core 0.6.4", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "forward_ref" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "k256" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2 0.10.8", - "signature", -] - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "schemars" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" -dependencies = [ - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.70", -] - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "serde" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-json-wasm" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.70", -] - -[[package]] -name = "serde_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.70", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.70", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/app/ibc-hooks/contracts/Cargo.toml b/app/ibc-hooks/contracts/Cargo.toml deleted file mode 100644 index 323f76c96..000000000 --- a/app/ibc-hooks/contracts/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "counter" -version = "0.1.0" -authors = ["beer-1@codingcats.xyz"] -edition = "2018" - -exclude = [ - # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. - "contract.wasm", - "hash.txt", -] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -crate-type = ["cdylib", "rlib"] - -[profile.release] -opt-level = 3 -debug = false -rpath = false -lto = true -debug-assertions = false -codegen-units = 1 -panic = 'abort' -incremental = false -overflow-checks = true - - -[dependencies] -cosmwasm-std = "2.0.4" -cosmwasm-schema = "2.0.4" -cw-storage-plus = "2.0.0" - -[dev-dependencies] - diff --git a/app/ibc-hooks/contracts/NOTICE b/app/ibc-hooks/contracts/NOTICE deleted file mode 100644 index 3fb176561..000000000 --- a/app/ibc-hooks/contracts/NOTICE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2020 orkunkl - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/app/ibc-hooks/contracts/README.md b/app/ibc-hooks/contracts/README.md deleted file mode 100644 index fdb22f277..000000000 --- a/app/ibc-hooks/contracts/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Counter - -This contract is a simple implementation of a counter using the IBC Hooks library. It allows you to increment and decrement the counter value. diff --git a/app/ibc-hooks/contracts/artifacts/checksums.txt b/app/ibc-hooks/contracts/artifacts/checksums.txt deleted file mode 100644 index ed5527eb8..000000000 --- a/app/ibc-hooks/contracts/artifacts/checksums.txt +++ /dev/null @@ -1,2 +0,0 @@ -c132532b9641facc9afe6c4ad81bebd1237292c26f50ec782426b51cee4cdc90 counter-aarch64.wasm -c7ef9d37456ef0e7754f0e7df70f6f2488a185ea2a1acdee464daf65428d66c3 counter.wasm diff --git a/app/ibc-hooks/contracts/artifacts/checksums_intermediate.txt b/app/ibc-hooks/contracts/artifacts/checksums_intermediate.txt deleted file mode 100644 index f260b2e6f..000000000 --- a/app/ibc-hooks/contracts/artifacts/checksums_intermediate.txt +++ /dev/null @@ -1 +0,0 @@ -9069c93a592c79de64adf23be85f0f8345819c00df1bebaa57705e4d7d1779b7 ./target/wasm32-unknown-unknown/release/counter.wasm diff --git a/app/ibc-hooks/contracts/artifacts/counter-aarch64.wasm b/app/ibc-hooks/contracts/artifacts/counter-aarch64.wasm deleted file mode 100644 index 6cf31d35d..000000000 Binary files a/app/ibc-hooks/contracts/artifacts/counter-aarch64.wasm and /dev/null differ diff --git a/app/ibc-hooks/contracts/artifacts/counter.wasm b/app/ibc-hooks/contracts/artifacts/counter.wasm deleted file mode 100644 index 1df344f67..000000000 Binary files a/app/ibc-hooks/contracts/artifacts/counter.wasm and /dev/null differ diff --git a/app/ibc-hooks/contracts/examples/schema.rs b/app/ibc-hooks/contracts/examples/schema.rs deleted file mode 100644 index d422ceaa6..000000000 --- a/app/ibc-hooks/contracts/examples/schema.rs +++ /dev/null @@ -1,11 +0,0 @@ -use cosmwasm_schema::write_api; - -use counter::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; - -fn main() { - write_api! { - instantiate: InstantiateMsg, - query: QueryMsg, - execute: ExecuteMsg, - } -} diff --git a/app/ibc-hooks/contracts/rustfmt.toml b/app/ibc-hooks/contracts/rustfmt.toml deleted file mode 100644 index 11a85e6a9..000000000 --- a/app/ibc-hooks/contracts/rustfmt.toml +++ /dev/null @@ -1,15 +0,0 @@ -# stable -newline_style = "unix" -hard_tabs = false -tab_spaces = 4 - -# unstable... should we require `rustup run nightly cargo fmt` ? -# or just update the style guide when they are stable? -#fn_single_line = true -#format_code_in_doc_comments = true -#overflow_delimited_expr = true -#reorder_impl_items = true -#struct_field_align_threshold = 20 -#struct_lit_single_line = true -#report_todo = "Always" - diff --git a/app/ibc-hooks/contracts/schema/counter.json b/app/ibc-hooks/contracts/schema/counter.json deleted file mode 100644 index d1e8f0e3e..000000000 --- a/app/ibc-hooks/contracts/schema/counter.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "contract_name": "counter", - "contract_version": "0.1.0", - "idl_version": "1.0.0", - "instantiate": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InstantiateMsg", - "type": "object", - "additionalProperties": false - }, - "execute": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ExecuteMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "increase" - ], - "properties": { - "increase": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "query": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "get" - ], - "properties": { - "get": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "migrate": null, - "sudo": null, - "responses": { - "get": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "uint64", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } -} diff --git a/app/ibc-hooks/contracts/schema/raw/execute.json b/app/ibc-hooks/contracts/schema/raw/execute.json deleted file mode 100644 index a11e7e140..000000000 --- a/app/ibc-hooks/contracts/schema/raw/execute.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ExecuteMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "increase" - ], - "properties": { - "increase": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] -} diff --git a/app/ibc-hooks/contracts/schema/raw/instantiate.json b/app/ibc-hooks/contracts/schema/raw/instantiate.json deleted file mode 100644 index 1352613d5..000000000 --- a/app/ibc-hooks/contracts/schema/raw/instantiate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InstantiateMsg", - "type": "object", - "additionalProperties": false -} diff --git a/app/ibc-hooks/contracts/schema/raw/query.json b/app/ibc-hooks/contracts/schema/raw/query.json deleted file mode 100644 index d717c8e2d..000000000 --- a/app/ibc-hooks/contracts/schema/raw/query.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "get" - ], - "properties": { - "get": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] -} diff --git a/app/ibc-hooks/contracts/schema/raw/response_to_get.json b/app/ibc-hooks/contracts/schema/raw/response_to_get.json deleted file mode 100644 index 7b729a7b9..000000000 --- a/app/ibc-hooks/contracts/schema/raw/response_to_get.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "uint64", - "type": "integer", - "format": "uint64", - "minimum": 0.0 -} diff --git a/app/ibc-hooks/contracts/src/contract.rs b/app/ibc-hooks/contracts/src/contract.rs deleted file mode 100644 index c87be2032..000000000 --- a/app/ibc-hooks/contracts/src/contract.rs +++ /dev/null @@ -1,94 +0,0 @@ -use cosmwasm_std::{ - to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, -}; - -use crate::msg::{ExecuteMsg, IBCLifecycleComplete, InstantiateMsg, QueryMsg, SudoMsg}; -use crate::state::{Count, COUNT}; - -#[cfg(not(feature = "library"))] -use cosmwasm_std::entry_point; - -// Note, you can use StdResult in some functions where you do not -// make use of the custom errors -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn instantiate( - deps: DepsMut, - _env: Env, - _info: MessageInfo, - _msg: InstantiateMsg, -) -> Result { - let count = Count { val: 0 }; - - COUNT.save(deps.storage, &count)?; - - Ok(Response::default()) -} - -// And declare a custom Error variant for the ones where you will want to make use of it -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn execute( - deps: DepsMut, - env: Env, - info: MessageInfo, - msg: ExecuteMsg, -) -> Result { - match msg { - ExecuteMsg::Increase {} => execute_increase(deps, env, info), - } -} - -pub fn execute_increase( - deps: DepsMut, - _env: Env, - _info: MessageInfo, -) -> Result { - let mut count = COUNT.load(deps.storage)?; - count.val += 1; - COUNT.save(deps.storage, &count)?; - Ok(Response::new()) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::Get {} => to_json_binary(&query_get(deps)?), - } -} - -fn query_get(deps: Deps) -> StdResult { - Ok(COUNT.load(deps.storage)?.val) -} - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn sudo(deps: DepsMut, _env: Env, msg: SudoMsg) -> Result { - match msg { - SudoMsg::IBCLifecycleComplete(inner_msg) => match inner_msg { - IBCLifecycleComplete::IBCAck { - channel: _, - ack: _, - sequence, - success, - } => { - let mut count = COUNT.load(deps.storage)?; - if success { - count.val += sequence; - } else { - count.val += 1; - } - - COUNT.save(deps.storage, &count)?; - Ok(Response::new()) - } - IBCLifecycleComplete::IBCTimeout { - channel: _, - sequence, - } => { - let mut count = COUNT.load(deps.storage)?; - count.val += sequence; - - COUNT.save(deps.storage, &count)?; - Ok(Response::new()) - } - }, - } -} diff --git a/app/ibc-hooks/contracts/src/lib.rs b/app/ibc-hooks/contracts/src/lib.rs deleted file mode 100644 index 4934c19d5..000000000 --- a/app/ibc-hooks/contracts/src/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod contract; -pub mod msg; -pub mod state; diff --git a/app/ibc-hooks/contracts/src/msg.rs b/app/ibc-hooks/contracts/src/msg.rs deleted file mode 100644 index 6a2a29b1e..000000000 --- a/app/ibc-hooks/contracts/src/msg.rs +++ /dev/null @@ -1,46 +0,0 @@ -use cosmwasm_schema::{cw_serde, QueryResponses}; - -#[cw_serde] -pub struct InstantiateMsg {} - -#[cw_serde] -pub enum ExecuteMsg { - Increase {}, -} - -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(u64)] - Get {}, -} - - -#[cw_serde] -pub enum IBCLifecycleComplete { - #[serde(rename = "ibc_ack")] - IBCAck { - /// The source channel (milkyway side) of the IBC packet - channel: String, - /// The sequence number that the packet was sent with - sequence: u64, - /// String encoded version of the ack as seen by OnAcknowledgementPacket(..) - ack: String, - /// Weather an ack is a success of failure according to the transfer spec - success: bool, - }, - #[serde(rename = "ibc_timeout")] - IBCTimeout { - /// The source channel (milkyway side) of the IBC packet - channel: String, - /// The sequence number that the packet was sent with - sequence: u64, - }, -} - -/// Message type for `sudo` entry_point -#[cw_serde] -pub enum SudoMsg { - #[serde(rename = "ibc_lifecycle_complete")] - IBCLifecycleComplete(IBCLifecycleComplete), -} diff --git a/app/ibc-hooks/contracts/src/state.rs b/app/ibc-hooks/contracts/src/state.rs deleted file mode 100644 index b77802d6d..000000000 --- a/app/ibc-hooks/contracts/src/state.rs +++ /dev/null @@ -1,9 +0,0 @@ -use cosmwasm_schema::cw_serde; -use cw_storage_plus::Item; - -#[cw_serde] -pub struct Count { - pub val: u64, -} - -pub const COUNT: Item = Item::new("count"); diff --git a/app/ibc-hooks/hooks.go b/app/ibc-hooks/hooks.go deleted file mode 100644 index bf94f6a78..000000000 --- a/app/ibc-hooks/hooks.go +++ /dev/null @@ -1,79 +0,0 @@ -package wasm_hooks - -import ( - "cosmossdk.io/core/address" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - - "github.com/milkyway-labs/milkyway/utils" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" -) - -var ( - _ ibchooks.OnRecvPacketOverrideHooks = WasmHooks{} - _ ibchooks.OnAcknowledgementPacketOverrideHooks = WasmHooks{} - _ ibchooks.OnTimeoutPacketOverrideHooks = WasmHooks{} -) - -type WasmHooks struct { - codec codec.Codec - ac address.Codec - wasmKeeper *wasmkeeper.Keeper -} - -func NewWasmHooks(codec codec.Codec, ac address.Codec, wasmKeeper *wasmkeeper.Keeper) *WasmHooks { - return &WasmHooks{ - codec: codec, - ac: ac, - wasmKeeper: wasmKeeper, - } -} - -func (h WasmHooks) OnRecvPacketOverride(im ibchooks.IBCMiddleware, ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) ibcexported.Acknowledgement { - if isIcs20, ics20Data := utils.IsIcs20Packet(packet.GetData()); isIcs20 { - return h.onRecvIcs20Packet(ctx, im, packet, relayer, ics20Data) - } - - if isIcs721, ics721Data := isIcs721Packet(packet.GetData()); isIcs721 { - return h.onRecvIcs721Packet(ctx, im, packet, relayer, ics721Data) - } - - return im.App.OnRecvPacket(ctx, packet, relayer) -} - -func (h WasmHooks) OnAcknowledgementPacketOverride(im ibchooks.IBCMiddleware, ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { - if isIcs20, ics20Data := utils.IsIcs20Packet(packet.GetData()); isIcs20 { - return h.onAckIcs20Packet(ctx, im, packet, acknowledgement, relayer, ics20Data) - } - - if isIcs721, ics721Data := isIcs721Packet(packet.GetData()); isIcs721 { - return h.onAckIcs721Packet(ctx, im, packet, acknowledgement, relayer, ics721Data) - } - - return im.App.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) -} - -func (h WasmHooks) OnTimeoutPacketOverride(im ibchooks.IBCMiddleware, ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error { - if isIcs20, ics20Data := utils.IsIcs20Packet(packet.GetData()); isIcs20 { - return h.onTimeoutIcs20Packet(ctx, im, packet, relayer, ics20Data) - } - - if isIcs721, ics721Data := isIcs721Packet(packet.GetData()); isIcs721 { - return h.onTimeoutIcs721Packet(ctx, im, packet, relayer, ics721Data) - } - - return im.App.OnTimeoutPacket(ctx, packet, relayer) -} - -func (h WasmHooks) checkACL(im ibchooks.IBCMiddleware, ctx sdk.Context, addrStr string) (bool, error) { - addr, err := h.ac.StringToBytes(addrStr) - if err != nil { - return false, err - } - - return im.HooksKeeper.GetAllowed(ctx, addr) -} diff --git a/app/ibc-hooks/message.go b/app/ibc-hooks/message.go deleted file mode 100644 index 8ed5208c8..000000000 --- a/app/ibc-hooks/message.go +++ /dev/null @@ -1,21 +0,0 @@ -package wasm_hooks - -import ( - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" -) - -const ( - // The memo key is used to parse ics-20 or ics-712 memo fields. - wasmHookMemoKey = "wasm" -) - -// HookData defines a wrapper for wasm execute message -// and async callback. -type HookData struct { - // Message is a wasm execute message which will be executed - // at `OnRecvPacket` of receiver chain. - Message *wasmtypes.MsgExecuteContract `json:"message,omitempty"` - - // AsyncCallback is a contract address - AsyncCallback string `json:"async_callback,omitempty"` -} diff --git a/app/ibc-hooks/receive.go b/app/ibc-hooks/receive.go deleted file mode 100644 index c6f63260c..000000000 --- a/app/ibc-hooks/receive.go +++ /dev/null @@ -1,148 +0,0 @@ -package wasm_hooks - -import ( - "encoding/json" - "fmt" - - "cosmossdk.io/math" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" - - "github.com/milkyway-labs/milkyway/types" -) - -func (h WasmHooks) onRecvIcs20Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet channeltypes.Packet, - relayer sdk.AccAddress, - data transfertypes.FungibleTokenPacketData, -) ibcexported.Acknowledgement { - isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo()) - if !isWasmRouted || hookData.Message == nil { - return im.App.OnRecvPacket(ctx, packet, relayer) - } else if err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - - msg := hookData.Message - if allowed, err := h.checkACL(im, ctx, msg.Contract); err != nil { - return types.NewEmitErrorAcknowledgement(err) - } else if !allowed { - return types.NewEmitErrorAcknowledgement(fmt.Errorf("contract `%s` is not allowed to be used in ibchooks", msg.Contract)) - } - - // Validate whether the receiver is correctly specified or not. - if err := validateReceiver(msg, data.Receiver); err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - - // Calculate the receiver / contract caller based on the packet's channel and sender - intermediateSender := DeriveIntermediateSender(packet.GetDestChannel(), data.GetSender()) - - // The funds sent on this packet need to be transferred to the intermediary account for the sender. - // For this, we override the ICS20 packet's Receiver (essentially hijacking the funds to this new address) - // and execute the underlying OnRecvPacket() call (which should eventually land on the transfer app's - // relay.go and send the funds to the intermediary account. - // - // If that succeeds, we make the contract call - data.Receiver = intermediateSender - bz, err := json.Marshal(data) - if err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - packet.Data = bz - - ack := im.App.OnRecvPacket(ctx, packet, relayer) - if !ack.Success() { - return ack - } - - // Extract the denom and amount from the packet data - denom := MustExtractDenomFromPacketOnRecv(packet) - amount, ok := math.NewIntFromString(data.GetAmount()) - if !ok { - return types.NewEmitErrorAcknowledgement(fmt.Errorf("invalid amount: %s", data.GetAmount())) - } - - msg.Sender = intermediateSender - msg.Funds = sdk.NewCoins(sdk.NewCoin(denom, amount)) - _, err = h.execMsg(ctx, msg) - if err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - - return ack -} - -func (h WasmHooks) onRecvIcs721Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet channeltypes.Packet, - relayer sdk.AccAddress, - data nfttransfertypes.NonFungibleTokenPacketData, -) ibcexported.Acknowledgement { - isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo()) - if !isWasmRouted || hookData.Message == nil { - return im.App.OnRecvPacket(ctx, packet, relayer) - } else if err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - - msg := hookData.Message - if allowed, err := h.checkACL(im, ctx, msg.Contract); err != nil { - return types.NewEmitErrorAcknowledgement(err) - } else if !allowed { - return types.NewEmitErrorAcknowledgement(fmt.Errorf("contract `%s` is not allowed to be used in ibchooks", msg.Contract)) - } - - // Validate whether the receiver is correctly specified or not. - if err := validateReceiver(msg, data.Receiver); err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - - // Calculate the receiver / contract caller based on the packet's channel and sender - intermediateSender := DeriveIntermediateSender(packet.GetDestChannel(), data.GetSender()) - - // The funds sent on this packet need to be transferred to the intermediary account for the sender. - // For this, we override the ICS721 packet's Receiver (essentially hijacking the funds to this new address) - // and execute the underlying OnRecvPacket() call (which should eventually land on the transfer app's - // relay.go and send the funds to the intermediary account. - // - // If that succeeds, we make the contract call - data.Receiver = intermediateSender - bz, err := json.Marshal(data) - if err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - packet.Data = bz - - ack := im.App.OnRecvPacket(ctx, packet, relayer) - if !ack.Success() { - return ack - } - - msg.Sender = intermediateSender - msg.Funds = sdk.NewCoins() - _, err = h.execMsg(ctx, msg) - if err != nil { - return types.NewEmitErrorAcknowledgement(err) - } - - return ack -} - -func (im WasmHooks) execMsg(ctx sdk.Context, msg *wasmtypes.MsgExecuteContract) (*wasmtypes.MsgExecuteContractResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(im.wasmKeeper) - return wasmMsgServer.ExecuteContract(ctx, msg) -} diff --git a/app/ibc-hooks/receive_test.go b/app/ibc-hooks/receive_test.go deleted file mode 100644 index f2a8120f2..000000000 --- a/app/ibc-hooks/receive_test.go +++ /dev/null @@ -1,223 +0,0 @@ -package wasm_hooks_test - -import ( - "encoding/json" - "fmt" - "os" - "testing" - - "cosmossdk.io/math" - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - ibchooks "github.com/milkyway-labs/milkyway/app/ibc-hooks" -) - -func Test_OnReceivePacket(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - _, _, addr2 := keyPubAddr() - - data := transfertypes.FungibleTokenPacketData{ - Denom: "foo", - Amount: "10000", - Sender: addr.String(), - Receiver: addr2.String(), - Memo: "", - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - ack := input.IBCHooksMiddleware.OnRecvPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - - require.True(t, ack.Success()) -} - -func Test_onReceivePacket_memo(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - - code, err := os.ReadFile("./contracts/artifacts/counter-aarch64.wasm") - require.NoError(t, err) - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper) - storeRes, err := wasmMsgServer.StoreCode(ctx, &wasmtypes.MsgStoreCode{ - Sender: addr.String(), - WASMByteCode: code, - }) - require.NoError(t, err) - - instantiateRes, err := wasmMsgServer.InstantiateContract(ctx, &wasmtypes.MsgInstantiateContract{ - Sender: addr.String(), - Admin: addr.String(), - CodeID: storeRes.CodeID, - Label: "Counter", - Msg: []byte("{}"), - Funds: nil, - }) - require.NoError(t, err) - - contractAddrBech32 := instantiateRes.Address - data := transfertypes.FungibleTokenPacketData{ - Denom: "foo", - Amount: "10000", - Sender: addr.String(), - Receiver: contractAddrBech32, - Memo: fmt.Sprintf(`{ - "wasm": { - "message": { - "contract": "%s", - "msg": {"increase":{}} - } - } - }`, contractAddrBech32), - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - // funds foo coins to the intermediate sender - intermediateSender, err := sdk.AccAddressFromBech32(ibchooks.DeriveIntermediateSender("channel-0", data.GetSender())) - require.NoError(t, err) - denom := ibchooks.MustExtractDenomFromPacketOnRecv(channeltypes.Packet{ - Data: dataBz, - DestinationPort: "wasm", - DestinationChannel: "channel-0", - }) - input.Faucet.Fund(ctx, intermediateSender, sdk.NewCoin(denom, math.NewInt(10000))) - - // failed to due to acl - ack := input.IBCHooksMiddleware.OnRecvPacket(ctx, channeltypes.Packet{ - Data: dataBz, - DestinationPort: "wasm", - DestinationChannel: "channel-0", - }, addr) - require.False(t, ack.Success()) - - // set acl - contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32) - require.NoError(t, err) - require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr, true)) - - // success - ack = input.IBCHooksMiddleware.OnRecvPacket(ctx, channeltypes.Packet{ - Data: dataBz, - DestinationPort: "wasm", - DestinationChannel: "channel-0", - }, addr) - fmt.Println(string(ack.Acknowledgement())) - require.True(t, ack.Success()) - - // check the contract state - queryRes, err := input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "1", string(queryRes)) -} - -func Test_OnReceivePacket_ICS721(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - _, _, addr2 := keyPubAddr() - - data := nfttransfertypes.NonFungibleTokenPacketDataWasm{ - ClassId: "classId", - ClassUri: "classUri", - ClassData: "classData", - TokenIds: []string{"tokenId"}, - TokenUris: []string{"tokenUri"}, - TokenData: []string{"tokenData"}, - Sender: addr.String(), - Receiver: addr2.String(), - Memo: "", - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - ack := input.IBCHooksMiddleware.OnRecvPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - - require.True(t, ack.Success()) -} - -func Test_onReceivePacket_memo_ICS721(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - - code, err := os.ReadFile("./contracts/artifacts/counter-aarch64.wasm") - require.NoError(t, err) - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper) - storeRes, err := wasmMsgServer.StoreCode(ctx, &wasmtypes.MsgStoreCode{ - Sender: addr.String(), - WASMByteCode: code, - }) - require.NoError(t, err) - - instantiateRes, err := wasmMsgServer.InstantiateContract(ctx, &wasmtypes.MsgInstantiateContract{ - Sender: addr.String(), - Admin: addr.String(), - CodeID: storeRes.CodeID, - Label: "Counter", - Msg: []byte("{}"), - Funds: nil, - }) - require.NoError(t, err) - - contractAddrBech32 := instantiateRes.Address - data := nfttransfertypes.NonFungibleTokenPacketDataWasm{ - ClassId: "classId", - ClassUri: "classUri", - ClassData: "classData", - TokenIds: []string{"tokenId"}, - TokenUris: []string{"tokenUri"}, - TokenData: []string{"tokenData"}, - Sender: addr.String(), - Receiver: contractAddrBech32, - Memo: fmt.Sprintf(`{ - "wasm": { - "message": { - "contract": "%s", - "msg": {"increase":{}} - } - } - }`, contractAddrBech32), - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - // failed to due to acl - ack := input.IBCHooksMiddleware.OnRecvPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - require.False(t, ack.Success()) - - // set acl - contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32) - require.NoError(t, err) - require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr, true)) - - // success - ack = input.IBCHooksMiddleware.OnRecvPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - require.True(t, ack.Success()) - - // check the contract state - queryRes, err := input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "1", string(queryRes)) -} diff --git a/app/ibc-hooks/timeout.go b/app/ibc-hooks/timeout.go deleted file mode 100644 index 5fbcc796f..000000000 --- a/app/ibc-hooks/timeout.go +++ /dev/null @@ -1,155 +0,0 @@ -package wasm_hooks - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - "github.com/initia-labs/initia/x/ibc-hooks/types" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" -) - -func (h WasmHooks) onTimeoutIcs20Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet channeltypes.Packet, - relayer sdk.AccAddress, - data transfertypes.FungibleTokenPacketData, -) error { - if err := im.App.OnTimeoutPacket(ctx, packet, relayer); err != nil { - return err - } - - isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo()) - if !isWasmRouted || hookData.AsyncCallback == "" { - return nil - } else if err != nil { - h.wasmKeeper.Logger(ctx).Error("failed to parse memo", "error", err) - return nil - } - - // create a new cache context to ignore errors during - // the execution of the callback - cacheCtx, write := ctx.CacheContext() - - callback := hookData.AsyncCallback - if allowed, err := h.checkACL(im, cacheCtx, callback); err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } else if !allowed { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "not allowed") - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, "not allowed"), - )) - - return nil - } - - contractAddr, err := h.ac.StringToBytes(callback) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("invalid contract address", "error", err) - return nil - } - - sudoMsg := []byte(fmt.Sprintf( - `{"ibc_lifecycle_complete": {"ibc_timeout": {"channel": "%s", "sequence": %d}}}`, - packet.SourceChannel, packet.Sequence)) - _, err = h.wasmKeeper.Sudo(cacheCtx, contractAddr, sudoMsg) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("failed to execute callback", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to execute callback"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } - - // write the cache context only if the callback execution was successful - write() - - return nil -} - -func (h WasmHooks) onTimeoutIcs721Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet channeltypes.Packet, - relayer sdk.AccAddress, - data nfttransfertypes.NonFungibleTokenPacketData, -) error { - if err := im.App.OnTimeoutPacket(ctx, packet, relayer); err != nil { - return err - } - - isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo()) - if !isWasmRouted || hookData.AsyncCallback == "" { - return nil - } else if err != nil { - h.wasmKeeper.Logger(ctx).Error("failed to parse memo", "error", err) - return nil - } - - // create a new cache context to ignore errors during - // the execution of the callback - cacheCtx, write := ctx.CacheContext() - - callback := hookData.AsyncCallback - if allowed, err := h.checkACL(im, cacheCtx, callback); err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } else if !allowed { - h.wasmKeeper.Logger(cacheCtx).Error("failed to check ACL", "not allowed") - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to check ACL"), - sdk.NewAttribute(types.AttributeKeyError, "not allowed"), - )) - - return nil - } - - contractAddr, err := h.ac.StringToBytes(callback) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("invalid contract address", "error", err) - return nil - } - - sudoMsg := []byte(fmt.Sprintf( - `{"ibc_lifecycle_complete": {"ibc_timeout": {"channel": "%s", "sequence": %d}}}`, - packet.SourceChannel, packet.Sequence)) - _, err = h.wasmKeeper.Sudo(cacheCtx, contractAddr, sudoMsg) - if err != nil { - h.wasmKeeper.Logger(cacheCtx).Error("failed to execute callback", "error", err) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeHookFailed, - sdk.NewAttribute(types.AttributeKeyReason, "failed to execute callback"), - sdk.NewAttribute(types.AttributeKeyError, err.Error()), - )) - - return nil - } - - // write the cache context only if the callback execution was successful - write() - - return nil -} diff --git a/app/ibc-hooks/timeout_test.go b/app/ibc-hooks/timeout_test.go deleted file mode 100644 index 6d14172cd..000000000 --- a/app/ibc-hooks/timeout_test.go +++ /dev/null @@ -1,209 +0,0 @@ -package wasm_hooks_test - -import ( - "encoding/json" - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func Test_OnTimeoutPacket(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - _, _, addr2 := keyPubAddr() - - data := transfertypes.FungibleTokenPacketData{ - Denom: "foo", - Amount: "10000", - Sender: addr.String(), - Receiver: addr2.String(), - Memo: "", - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - err = input.IBCHooksMiddleware.OnTimeoutPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - require.NoError(t, err) -} - -func Test_OnTimeoutPacket_memo(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - - code, err := os.ReadFile("./contracts/artifacts/counter-aarch64.wasm") - require.NoError(t, err) - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper) - storeRes, err := wasmMsgServer.StoreCode(ctx, &wasmtypes.MsgStoreCode{ - Sender: addr.String(), - WASMByteCode: code, - }) - require.NoError(t, err) - - instantiateRes, err := wasmMsgServer.InstantiateContract(ctx, &wasmtypes.MsgInstantiateContract{ - Sender: addr.String(), - Admin: addr.String(), - CodeID: storeRes.CodeID, - Label: "Counter", - Msg: []byte("{}"), - Funds: nil, - }) - require.NoError(t, err) - - contractAddrBech32 := instantiateRes.Address - contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32) - require.NoError(t, err) - - data := transfertypes.FungibleTokenPacketData{ - Denom: "foo", - Amount: "10000", - Sender: addr.String(), - Receiver: contractAddrBech32, - Memo: fmt.Sprintf(`{ - "wasm": { - "async_callback": "%s" - } - }`, contractAddrBech32), - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - // hook should not be called to due to acl - err = input.IBCHooksMiddleware.OnTimeoutPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - require.NoError(t, err) - - queryRes, err := input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "0", string(queryRes)) - - // set acl - require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr, true)) - - // success - err = input.IBCHooksMiddleware.OnTimeoutPacket(ctx, channeltypes.Packet{ - Data: dataBz, - Sequence: 99, - }, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err = input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "99", string(queryRes)) -} - -func Test_OnTimeoutPacket_ICS721(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - _, _, addr2 := keyPubAddr() - - data := nfttransfertypes.NonFungibleTokenPacketDataWasm{ - ClassId: "classId", - ClassUri: "classUri", - ClassData: "classData", - TokenIds: []string{"tokenId"}, - TokenUris: []string{"tokenUri"}, - TokenData: []string{"tokenData"}, - Sender: addr.String(), - Receiver: addr2.String(), - Memo: "", - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - err = input.IBCHooksMiddleware.OnTimeoutPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - require.NoError(t, err) -} - -func Test_OnTimeoutPacket_memo_ICS721(t *testing.T) { - ctx, input := createDefaultTestInput(t) - _, _, addr := keyPubAddr() - - code, err := os.ReadFile("./contracts/artifacts/counter-aarch64.wasm") - require.NoError(t, err) - - wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper) - storeRes, err := wasmMsgServer.StoreCode(ctx, &wasmtypes.MsgStoreCode{ - Sender: addr.String(), - WASMByteCode: code, - }) - require.NoError(t, err) - - instantiateRes, err := wasmMsgServer.InstantiateContract(ctx, &wasmtypes.MsgInstantiateContract{ - Sender: addr.String(), - Admin: addr.String(), - CodeID: storeRes.CodeID, - Label: "Counter", - Msg: []byte("{}"), - Funds: nil, - }) - require.NoError(t, err) - - contractAddrBech32 := instantiateRes.Address - contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32) - require.NoError(t, err) - - data := nfttransfertypes.NonFungibleTokenPacketDataWasm{ - ClassId: "classId", - ClassUri: "classUri", - ClassData: "classData", - TokenIds: []string{"tokenId"}, - TokenUris: []string{"tokenUri"}, - TokenData: []string{"tokenData"}, - Sender: addr.String(), - Receiver: contractAddrBech32, - Memo: fmt.Sprintf(`{ - "wasm": { - "async_callback": "%s" - } - }`, contractAddrBech32), - } - - dataBz, err := json.Marshal(&data) - require.NoError(t, err) - - // success with success ack - err = input.IBCHooksMiddleware.OnTimeoutPacket(ctx, channeltypes.Packet{ - Data: dataBz, - }, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err := input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "0", string(queryRes)) - - // set acl - require.NoError(t, input.IBCHooksKeeper.SetAllowed(ctx, contractAddr, true)) - - // success - err = input.IBCHooksMiddleware.OnTimeoutPacket(ctx, channeltypes.Packet{ - Data: dataBz, - Sequence: 99, - }, addr) - require.NoError(t, err) - - // check the contract state - queryRes, err = input.WasmKeeper.QuerySmart(ctx, contractAddr, []byte(`{"get":{}}`)) - require.NoError(t, err) - require.Equal(t, "99", string(queryRes)) -} diff --git a/app/ibc-hooks/util.go b/app/ibc-hooks/util.go deleted file mode 100644 index a5e860dcc..000000000 --- a/app/ibc-hooks/util.go +++ /dev/null @@ -1,121 +0,0 @@ -package wasm_hooks - -import ( - "encoding/json" - "fmt" - - "cosmossdk.io/errors" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" - - "github.com/milkyway-labs/milkyway/utils" -) - -const senderPrefix = "ibc-wasm-hook-intermediary" - -// DeriveIntermediateSender compute intermediate sender address -// Bech32(Hash(Hash("ibc-hook-intermediary") + channelID/sender)) -func DeriveIntermediateSender(channel, originalSender string) string { - senderStr := fmt.Sprintf("%s/%s", channel, originalSender) - senderAddr := sdk.AccAddress(address.Hash(senderPrefix, []byte(senderStr))) - return senderAddr.String() -} - -const wasmPortPrefix = "wasm." - -func isIcs721Packet(packetData []byte) (isIcs721 bool, ics721data nfttransfertypes.NonFungibleTokenPacketData) { - // Use wasm port prefix to ack like normal wasm chain. - // - // initia l1 is handling encoding and decoding depends on port id, - // so milkyway should ack like normal wasm chain. - if data, err := nfttransfertypes.DecodePacketData(packetData, wasmPortPrefix); err != nil { - return false, data - } else { - return true, data - } -} - -func validateAndParseMemo(memo string) ( - isWasmRouted bool, - hookData HookData, - err error, -) { - isWasmRouted, metadata := utils.JSONStringHasKey(memo, wasmHookMemoKey) - if !isWasmRouted { - return - } - - wasmHookRaw := metadata[wasmHookMemoKey] - - // parse wasm raw bytes to execute message - bz, err := json.Marshal(wasmHookRaw) - if err != nil { - err = errors.Wrap(channeltypes.ErrInvalidPacket, err.Error()) - return - } - - err = json.Unmarshal(bz, &hookData) - if err != nil { - err = errors.Wrap(channeltypes.ErrInvalidPacket, err.Error()) - return - } - - return -} - -func validateReceiver(msg *wasmtypes.MsgExecuteContract, receiver string) error { - if receiver != msg.Contract { - return errors.Wrap(channeltypes.ErrInvalidPacket, "receiver is not properly set") - } - - return nil -} - -// isAckError checks an IBC acknowledgement to see if it's an error. -// This is a replacement for ack.Success() which is currently not working on some circumstances -func isAckError(appCodec codec.Codec, acknowledgement []byte) bool { - var ack channeltypes.Acknowledgement - if err := appCodec.UnmarshalJSON(acknowledgement, &ack); err == nil && !ack.Success() { - return true - } - - return false -} - -// MustExtractDenomFromPacketOnRecv takes a packet with a valid ICS20 token data in the Data field and returns the -// denom as represented in the local chain. -// If the data cannot be unmarshalled this function will panic -func MustExtractDenomFromPacketOnRecv(packet ibcexported.PacketI) string { - var data transfertypes.FungibleTokenPacketData - if err := json.Unmarshal(packet.GetData(), &data); err != nil { - panic("unable to unmarshal ICS20 packet data") - } - - var denom string - if transfertypes.ReceiverChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), data.Denom) { - // remove prefix added by sender chain - voucherPrefix := transfertypes.GetDenomPrefix(packet.GetSourcePort(), packet.GetSourceChannel()) - - unprefixedDenom := data.Denom[len(voucherPrefix):] - - // coin denomination used in sending from the escrow address - denom = unprefixedDenom - - // The denomination used to send the coins is either the native denom or the hash of the path - // if the denomination is not native. - denomTrace := transfertypes.ParseDenomTrace(unprefixedDenom) - if denomTrace.Path != "" { - denom = denomTrace.IBCDenom() - } - } else { - prefixedDenom := transfertypes.GetDenomPrefix(packet.GetDestPort(), packet.GetDestChannel()) + data.Denom - denom = transfertypes.ParseDenomTrace(prefixedDenom).IBCDenom() - } - return denom -} diff --git a/app/ibc-hooks/util_test.go b/app/ibc-hooks/util_test.go deleted file mode 100644 index a09be96bd..000000000 --- a/app/ibc-hooks/util_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package wasm_hooks - -import ( - "testing" - - "cosmossdk.io/math" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - 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" -) - -func Test_isIcs721Packet(t *testing.T) { - nftTransferMsg := nfttransfertypes.NewNonFungibleTokenPacketData("class_id", "uri", "data", []string{"1", "2", "3"}, []string{"uri1", "uri2", "uri3"}, []string{"data1", "data2", "data3"}, "sender", "receiver", "memo") - - ok, _nftTransferMsg := isIcs721Packet(nftTransferMsg.GetBytes(wasmPortPrefix)) - require.True(t, ok) - require.Equal(t, nftTransferMsg, _nftTransferMsg) - - transferMsg := transfertypes.NewFungibleTokenPacketData("denom", "1000000", "0x1", "0x2", "memo") - ok, _ = isIcs721Packet(transferMsg.GetBytes()) - require.False(t, ok) -} - -func Test_validateAndParseMemo_without_callback(t *testing.T) { - memo := `{ - "wasm" : { - "message": { - "sender": "init_addr", - "contract": "contract_addr", - "msg": {}, - "funds": [{"denom":"foo","amount":"100"}] - } - } - }` - isWasmRouted, hookData, err := validateAndParseMemo(memo) - require.True(t, isWasmRouted) - require.NoError(t, err) - require.Equal(t, HookData{ - Message: &wasmtypes.MsgExecuteContract{ - Sender: "init_addr", - Contract: "contract_addr", - Msg: []byte("{}"), - Funds: sdk.Coins{{ - Denom: "foo", - Amount: math.NewInt(100), - }}, - }, - AsyncCallback: "", - }, hookData) - require.NoError(t, validateReceiver(hookData.Message, "contract_addr")) - - // invalid receiver - require.NoError(t, err) - require.Error(t, validateReceiver(hookData.Message, "invalid_addr")) - - isWasmRouted, _, err = validateAndParseMemo("hihi") - require.False(t, isWasmRouted) - require.NoError(t, err) -} - -func Test_validateAndParseMemo_with_callback(t *testing.T) { - memo := `{ - "wasm" : { - "message": { - "sender": "init_addr", - "contract": "contract_addr", - "msg": {}, - "funds": [{"denom":"foo","amount":"100"}] - }, - "async_callback": "callback_addr" - } - }` - isWasmRouted, hookData, err := validateAndParseMemo(memo) - require.True(t, isWasmRouted) - require.NoError(t, err) - require.Equal(t, HookData{ - Message: &wasmtypes.MsgExecuteContract{ - Sender: "init_addr", - Contract: "contract_addr", - Msg: []byte("{}"), - Funds: sdk.Coins{{ - Denom: "foo", - Amount: math.NewInt(100), - }}, - }, - AsyncCallback: "callback_addr", - }, hookData) - require.NoError(t, validateReceiver(hookData.Message, "contract_addr")) -} diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go new file mode 100644 index 000000000..0996b5ec6 --- /dev/null +++ b/app/keepers/keepers.go @@ -0,0 +1,884 @@ +package keepers + +import ( + "fmt" + "os" + + "github.com/cosmos/cosmos-sdk/x/group" + "github.com/cosmos/gogoproto/proto" + marketmapkeeper "github.com/skip-mev/connect/v2/x/marketmap/keeper" + marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper" + oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" + feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" + feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" + + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/runtime" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/params" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + pfmroutertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + + evidencekeeper "cosmossdk.io/x/evidence/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + pfmrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" + pfmrouterkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" + ratelimit "github.com/cosmos/ibc-apps/modules/rate-limiting/v8" + ratelimitkeeper "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/keeper" + icsprovider "github.com/cosmos/interchain-security/v6/x/ccv/provider" + icsproviderkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + + assetskeeper "github.com/milkyway-labs/milkyway/x/assets/keeper" + assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" + epochskeeper "github.com/milkyway-labs/milkyway/x/epochs/keeper" + epochstypes "github.com/milkyway-labs/milkyway/x/epochs/types" + "github.com/milkyway-labs/milkyway/x/icacallbacks" + icacallbackskeeper "github.com/milkyway-labs/milkyway/x/icacallbacks/keeper" + icacallbackstypes "github.com/milkyway-labs/milkyway/x/icacallbacks/types" + icqkeeper "github.com/milkyway-labs/milkyway/x/interchainquery/keeper" + icqtypes "github.com/milkyway-labs/milkyway/x/interchainquery/types" + "github.com/milkyway-labs/milkyway/x/liquidvesting" + liquidvestingkeeper "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" + liquidvestingtypes "github.com/milkyway-labs/milkyway/x/liquidvesting/types" + operatorskeeper "github.com/milkyway-labs/milkyway/x/operators/keeper" + operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + poolskeeper "github.com/milkyway-labs/milkyway/x/pools/keeper" + poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" + "github.com/milkyway-labs/milkyway/x/records" + recordskeeper "github.com/milkyway-labs/milkyway/x/records/keeper" + recordstypes "github.com/milkyway-labs/milkyway/x/records/types" + restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper" + restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" + rewardskeeper "github.com/milkyway-labs/milkyway/x/rewards/keeper" + rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" + serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper" + servicestypes "github.com/milkyway-labs/milkyway/x/services/types" + "github.com/milkyway-labs/milkyway/x/stakeibc" + stakeibckeeper "github.com/milkyway-labs/milkyway/x/stakeibc/keeper" + stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" + tokenfactorykeeper "github.com/milkyway-labs/milkyway/x/tokenfactory/keeper" + tokenfactorytypes "github.com/milkyway-labs/milkyway/x/tokenfactory/types" +) + +type AppKeepers struct { + // keys to access the substores + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey + + // keepers + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.BaseKeeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper *govkeeper.Keeper + GroupKeeper groupkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + WasmKeeper wasmkeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + AuthzKeeper authzkeeper.Keeper + ConsensusParamsKeeper consensusparamkeeper.Keeper + TokenFactoryKeeper tokenfactorykeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + + // Skip + MarketMapKeeper *marketmapkeeper.Keeper + OracleKeeper *oraclekeeper.Keeper + FeeMarketKeeper *feemarketkeeper.Keeper + + // IBC + IBCKeeper *ibckeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + PFMRouterKeeper *pfmrouterkeeper.Keeper + RateLimitKeeper *ratelimitkeeper.Keeper + + // ICS + ProviderKeeper icsproviderkeeper.Keeper + + // Stride + EpochsKeeper *epochskeeper.Keeper + InterchainQueryKeeper icqkeeper.Keeper + ICACallbacksKeeper *icacallbackskeeper.Keeper + RecordsKeeper *recordskeeper.Keeper + StakeIBCKeeper stakeibckeeper.Keeper + + // Custom + ServicesKeeper *serviceskeeper.Keeper + OperatorsKeeper *operatorskeeper.Keeper + PoolsKeeper *poolskeeper.Keeper + RestakingKeeper *restakingkeeper.Keeper + AssetsKeeper *assetskeeper.Keeper + RewardsKeeper *rewardskeeper.Keeper + LiquidVestingKeeper *liquidvestingkeeper.Keeper + + // Modules + ICAModule ica.AppModule + IBCFeeKeeper ibcfeekeeper.Keeper + TransferModule transfer.AppModule + PFMRouterModule pfmrouter.AppModule + RateLimitModule ratelimit.AppModule + ProviderModule icsprovider.AppModule + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICSproviderkeeper capabilitykeeper.ScopedKeeper + scopedWasmKeeper capabilitykeeper.ScopedKeeper +} + +func NewAppKeeper( + appCodec codec.Codec, + bApp *baseapp.BaseApp, + legacyAmino *codec.LegacyAmino, + maccPerms map[string][]string, + blockedAddress map[string]bool, + skipUpgradeHeights map[int64]bool, + homePath string, + invCheckPeriod uint, + logger log.Logger, + appOpts servertypes.AppOptions, + wasmOpts []wasmkeeper.Option, +) AppKeepers { + appKeepers := AppKeepers{} + + // Create codecs + addressCodec := address.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + + // Set keys KVStoreKey, TransientStoreKey, MemoryStoreKey + appKeepers.GenerateKeys() + + if err := bApp.RegisterStreamingServices(appOpts, appKeepers.keys); err != nil { + logger.Error("failed to load state streaming", "err", err) + os.Exit(1) + } + + appKeepers.ParamsKeeper = initParamsKeeper( + appCodec, + legacyAmino, + appKeepers.keys[paramstypes.StoreKey], + appKeepers.tkeys[paramstypes.TStoreKey], + ) + + // set the BaseApp's parameter store + appKeepers.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[consensusparamtypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + runtime.EventService{}, + ) + bApp.SetParamStore(appKeepers.ConsensusParamsKeeper.ParamsStore) + + // add capability keeper and ScopeToModule for ibc module + appKeepers.CapabilityKeeper = capabilitykeeper.NewKeeper( + appCodec, + appKeepers.keys[capabilitytypes.StoreKey], + appKeepers.memKeys[capabilitytypes.MemStoreKey], + ) + + appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + appKeepers.ScopedICAHostKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + appKeepers.ScopedICAControllerKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + appKeepers.ScopedICSproviderkeeper = appKeepers.CapabilityKeeper.ScopeToModule(providertypes.ModuleName) + appKeepers.scopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) + + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating + // their scoped modules in `NewApp` with `ScopeToModule` + appKeepers.CapabilityKeeper.Seal() + + // Add normal keepers + appKeepers.AccountKeeper = authkeeper.NewAccountKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, + maccPerms, + addressCodec, + sdk.GetConfig().GetBech32AccountAddrPrefix(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[banktypes.StoreKey]), + appKeepers.AccountKeeper, + blockedAddress, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + logger, + ) + + communityPoolKeeper := NewCommunityPoolKeeper(appKeepers.BankKeeper, authtypes.FeeCollectorName) + + appKeepers.CrisisKeeper = crisiskeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[crisistypes.StoreKey]), + invCheckPeriod, + appKeepers.BankKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appKeepers.AccountKeeper.AddressCodec(), + ) + + appKeepers.AuthzKeeper = authzkeeper.NewKeeper( + runtime.NewKVStoreService(appKeepers.keys[authzkeeper.StoreKey]), + appCodec, + bApp.MsgServiceRouter(), + appKeepers.AccountKeeper, + ) + + appKeepers.FeeGrantKeeper = feegrantkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[feegrant.StoreKey]), + appKeepers.AccountKeeper, + ) + + appKeepers.StakingKeeper = stakingkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[stakingtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + ) + + appKeepers.DistrKeeper = distrkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[distrtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.StakingKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( + appCodec, + legacyAmino, + runtime.NewKVStoreService(appKeepers.keys[slashingtypes.StoreKey]), + appKeepers.StakingKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + appKeepers.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + appKeepers.DistrKeeper.Hooks(), + appKeepers.SlashingKeeper.Hooks(), + appKeepers.ProviderKeeper.Hooks(), + ), + ) + + appKeepers.FeeMarketKeeper = feemarketkeeper.NewKeeper( + appCodec, + appKeepers.keys[feemarkettypes.StoreKey], + appKeepers.AccountKeeper, + &DefaultFeemarketDenomResolver{}, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.MarketMapKeeper = marketmapkeeper.NewKeeper( + runtime.NewKVStoreService(appKeepers.keys[marketmaptypes.StoreKey]), + appCodec, + authtypes.NewModuleAddress(govtypes.ModuleName), + ) + + oracleKeeper := oraclekeeper.NewKeeper( + runtime.NewKVStoreService(appKeepers.keys[oracletypes.StoreKey]), + appCodec, + appKeepers.MarketMapKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName), + ) + appKeepers.OracleKeeper = &oracleKeeper + + // Add the oracle keeper as a hook to market map keeper so new market map entries can be created + // and propagated to the oracle keeper. + appKeepers.MarketMapKeeper.SetHooks(appKeepers.OracleKeeper.Hooks()) + + // UpgradeKeeper must be created before IBCKeeper + appKeepers.UpgradeKeeper = upgradekeeper.NewKeeper( + skipUpgradeHeights, + runtime.NewKVStoreService(appKeepers.keys[upgradetypes.StoreKey]), + appCodec, + homePath, + bApp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.GroupKeeper = groupkeeper.NewKeeper( + appKeepers.keys[group.StoreKey], + appCodec, + bApp.MsgServiceRouter(), + appKeepers.AccountKeeper, + group.DefaultConfig(), + ) + + // UpgradeKeeper must be created before IBCKeeper + appKeepers.IBCKeeper = ibckeeper.NewKeeper( + appCodec, + appKeepers.keys[ibcexported.StoreKey], + appKeepers.GetSubspace(ibcexported.ModuleName), + appKeepers.StakingKeeper, + appKeepers.UpgradeKeeper, + appKeepers.ScopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.ProviderKeeper = icsproviderkeeper.NewKeeper( + appCodec, + appKeepers.keys[providertypes.StoreKey], + appKeepers.GetSubspace(providertypes.ModuleName), + appKeepers.ScopedICSproviderkeeper, + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.IBCKeeper.ConnectionKeeper, + appKeepers.IBCKeeper.ClientKeeper, + appKeepers.StakingKeeper, + appKeepers.SlashingKeeper, + appKeepers.AccountKeeper, + appKeepers.DistrKeeper, + appKeepers.BankKeeper, + govkeeper.Keeper{}, // cyclic dependency between provider and governance, will be set later + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + authtypes.FeeCollectorName, + ) + + contractKeeper := wasmkeeper.NewDefaultPermissionKeeper(appKeepers.WasmKeeper) + appKeepers.TokenFactoryKeeper = tokenfactorykeeper.NewKeeper( + addressCodec, + appCodec, + runtime.NewKVStoreService(appKeepers.keys[tokenfactorytypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + communityPoolKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + appKeepers.TokenFactoryKeeper.SetContractKeeper(contractKeeper) + + // Set the hooks based on the token factory keeper + appKeepers.BankKeeper.SetHooks(appKeepers.TokenFactoryKeeper.Hooks()) + + // gov depends on provider, so needs to be set after + govConfig := govtypes.DefaultConfig() + // set the MaxMetadataLen for proposals to the same value as it was pre-sdk v0.47.x + govConfig.MaxMetadataLen = 10200 + appKeepers.GovKeeper = govkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[govtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + // use the ProviderKeeper as StakingKeeper for gov + // because governance should be based on the consensus-active validators + appKeepers.ProviderKeeper, + appKeepers.DistrKeeper, + bApp.MsgServiceRouter(), + govConfig, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // mint keeper must be created after provider keeper + appKeepers.MintKeeper = mintkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[minttypes.StoreKey]), + appKeepers.ProviderKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.ProviderKeeper.SetGovKeeper(*appKeepers.GovKeeper) + + appKeepers.ProviderModule = icsprovider.NewAppModule( + &appKeepers.ProviderKeeper, + appKeepers.GetSubspace(providertypes.ModuleName), + appKeepers.keys[providertypes.StoreKey], + ) + + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://docs.cosmos.network/main/modules/gov#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter. + AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)) + + // Set legacy router for backwards compatibility with gov v1beta1 + appKeepers.GovKeeper.SetLegacyRouter(govRouter) + + appKeepers.GovKeeper = appKeepers.GovKeeper.SetHooks( + govtypes.NewMultiGovHooks( + appKeepers.ProviderKeeper.Hooks(), + ), + ) + + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[evidencetypes.StoreKey]), + appKeepers.StakingKeeper, + appKeepers.SlashingKeeper, + appKeepers.AccountKeeper.AddressCodec(), + runtime.ProvideCometInfoService(), + ) + // If evidence needs to be handled for the app, set routes in router here and seal + appKeepers.EvidenceKeeper = *evidenceKeeper + + appKeepers.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + appCodec, appKeepers.keys[ibcfeetypes.StoreKey], + appKeepers.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, appKeepers.AccountKeeper, appKeepers.BankKeeper, + ) + + // ICA Host keeper + appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, + appKeepers.keys[icahosttypes.StoreKey], + appKeepers.GetSubspace(icahosttypes.SubModuleName), + appKeepers.IBCKeeper.ChannelKeeper, // ICS4Wrapper + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + appKeepers.ScopedICAHostKeeper, + bApp.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // required since ibc-go v7.5.0 + appKeepers.ICAHostKeeper.WithQueryRouter(bApp.GRPCQueryRouter()) + + govAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + // Create RateLimit keeper + appKeepers.RateLimitKeeper = ratelimitkeeper.NewKeeper( + appCodec, // BinaryCodec + runtime.NewKVStoreService(appKeepers.keys[ratelimittypes.StoreKey]), // StoreKey + appKeepers.GetSubspace(ratelimittypes.ModuleName), // param Subspace + govAuthority, // authority + appKeepers.BankKeeper, + appKeepers.IBCKeeper.ChannelKeeper, // ChannelKeeper + appKeepers.IBCFeeKeeper, // ICS4Wrapper + ) + + // ICA Controller keeper + appKeepers.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, + appKeepers.keys[icacontrollertypes.StoreKey], + appKeepers.GetSubspace(icacontrollertypes.SubModuleName), + appKeepers.IBCKeeper.ChannelKeeper, // ICS4Wrapper + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.ScopedICAControllerKeeper, + bApp.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // PFMRouterKeeper must be created before TransferKeeper + appKeepers.PFMRouterKeeper = pfmrouterkeeper.NewKeeper( + appCodec, + appKeepers.keys[pfmroutertypes.StoreKey], + nil, // Will be zero-value here. Reference is set later on with SetTransferKeeper. + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.DistrKeeper, + appKeepers.BankKeeper, + appKeepers.RateLimitKeeper, // ICS4Wrapper + govAuthority, + ) + + appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, + appKeepers.keys[ibctransfertypes.StoreKey], + appKeepers.GetSubspace(ibctransfertypes.ModuleName), + appKeepers.PFMRouterKeeper, // ISC4 Wrapper: PFM Router middleware + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.ScopedTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // ---------------------- + // --- Custom modules --- + // ---------------------- + + // Custom modules + appKeepers.ServicesKeeper = serviceskeeper.NewKeeper( + appCodec, + appKeepers.keys[servicestypes.StoreKey], + runtime.NewKVStoreService(appKeepers.keys[servicestypes.StoreKey]), + appKeepers.AccountKeeper, + communityPoolKeeper, + govAuthority, + ) + appKeepers.OperatorsKeeper = operatorskeeper.NewKeeper( + appCodec, + appKeepers.keys[operatorstypes.StoreKey], + runtime.NewKVStoreService(appKeepers.keys[operatorstypes.StoreKey]), + appKeepers.AccountKeeper, + communityPoolKeeper, + govAuthority, + ) + appKeepers.PoolsKeeper = poolskeeper.NewKeeper( + appCodec, + appKeepers.keys[poolstypes.StoreKey], + runtime.NewKVStoreService(appKeepers.keys[poolstypes.StoreKey]), + appKeepers.AccountKeeper, + ) + appKeepers.RestakingKeeper = restakingkeeper.NewKeeper( + appCodec, + appKeepers.keys[restakingtypes.StoreKey], + runtime.NewKVStoreService(appKeepers.keys[restakingtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.PoolsKeeper, + appKeepers.OperatorsKeeper, + appKeepers.ServicesKeeper, + govAuthority, + ) + + // Set hooks based on the restaking keeper + appKeepers.OperatorsKeeper.SetHooks(appKeepers.RestakingKeeper.OperatorsHooks()) + appKeepers.ServicesKeeper.SetHooks(appKeepers.RestakingKeeper.ServicesHooks()) + + appKeepers.AssetsKeeper = assetskeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[assetstypes.StoreKey]), + govAuthority, + ) + appKeepers.RewardsKeeper = rewardskeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[rewardstypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + communityPoolKeeper, + appKeepers.OracleKeeper, + appKeepers.PoolsKeeper, + appKeepers.OperatorsKeeper, + appKeepers.ServicesKeeper, + appKeepers.RestakingKeeper, + appKeepers.AssetsKeeper, + govAuthority, + ) + + // Set hooks based on the rewards keeper + appKeepers.RestakingKeeper.SetHooks(appKeepers.RewardsKeeper.Hooks()) + + appKeepers.LiquidVestingKeeper = liquidvestingkeeper.NewKeeper( + appCodec, + appKeepers.keys[liquidvestingtypes.StoreKey], + runtime.NewKVStoreService(appKeepers.keys[liquidvestingtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.OperatorsKeeper, + appKeepers.PoolsKeeper, + appKeepers.ServicesKeeper, + appKeepers.RestakingKeeper, + authtypes.NewModuleAddress(liquidvestingtypes.ModuleName).String(), + govAuthority, + ) + + // Set hooks based on the liquid vesting keeper + appKeepers.BankKeeper.AppendSendRestriction(appKeepers.LiquidVestingKeeper.SendRestrictionFn) + + // ---------------------- // + // --- Stride Keepers --- // + // ---------------------- // + + appKeepers.InterchainQueryKeeper = icqkeeper.NewKeeper( + appCodec, + appKeepers.keys[icqtypes.StoreKey], + appKeepers.IBCKeeper, + ) + + appKeepers.ICACallbacksKeeper = icacallbackskeeper.NewKeeper( + appCodec, + appKeepers.keys[icacallbackstypes.StoreKey], + appKeepers.keys[icacallbackstypes.MemStoreKey], + *appKeepers.IBCKeeper, + ) + + appKeepers.RecordsKeeper = recordskeeper.NewKeeper( + appCodec, + appKeepers.keys[recordstypes.StoreKey], + appKeepers.keys[recordstypes.MemStoreKey], + appKeepers.AccountKeeper, + appKeepers.TransferKeeper, + *appKeepers.IBCKeeper, + *appKeepers.ICACallbacksKeeper, + ) + + appKeepers.StakeIBCKeeper = stakeibckeeper.NewKeeper( + appCodec, + appKeepers.keys[stakeibctypes.StoreKey], + appKeepers.keys[stakeibctypes.MemStoreKey], + runtime.NewKVStoreService(appKeepers.keys[stakeibctypes.StoreKey]), + govAuthority, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.ICAControllerKeeper, + *appKeepers.IBCKeeper, + appKeepers.InterchainQueryKeeper, + *appKeepers.RecordsKeeper, + *appKeepers.ICACallbacksKeeper, + appKeepers.RateLimitKeeper, + ) + + appKeepers.EpochsKeeper = epochskeeper.NewKeeper(appCodec, appKeepers.keys[epochstypes.StoreKey]) + + // Must be called on PFMRouter AFTER TransferKeeper initialized + appKeepers.PFMRouterKeeper.SetTransferKeeper(appKeepers.TransferKeeper) + + wasmDir := homePath + wasmConfig, err := wasm.ReadWasmConfig(appOpts) + if err != nil { + panic("error while reading wasm config: " + err.Error()) + } + + // allow connect queries + queryAllowlist := make(map[string]proto.Message) + queryAllowlist["/connect.oracle.v2.Query/GetAllCurrencyPairs"] = &oracletypes.GetAllCurrencyPairsResponse{} + queryAllowlist["/connect.oracle.v2.Query/GetPrice"] = &oracletypes.GetPriceResponse{} + queryAllowlist["/connect.oracle.v2.Query/GetPrices"] = &oracletypes.GetPricesResponse{} + queryAllowlist["/milkyway.operators.v1.Query/Operator"] = &operatorstypes.QueryOperatorResponse{} + queryAllowlist["/milkyway.restaking.v1.Query/ServiceOperators"] = &restakingtypes.QueryServiceOperatorsResponse{} + + // use accept list stargate querier + wasmOpts = append(wasmOpts, wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ + Stargate: wasmkeeper.AcceptListStargateQuerier(queryAllowlist, bApp.GRPCQueryRouter(), appCodec), + })) + + appKeepers.WasmKeeper = wasmkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[wasmtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.StakingKeeper, + distrkeeper.NewQuerier(appKeepers.DistrKeeper), + appKeepers.IBCFeeKeeper, + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.scopedWasmKeeper, + appKeepers.TransferKeeper, + bApp.MsgServiceRouter(), + bApp.GRPCQueryRouter(), + wasmDir, + wasmConfig, + wasmkeeper.BuiltInCapabilities(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + wasmOpts..., + ) + + // Middleware Stacks + appKeepers.ICAModule = ica.NewAppModule(&appKeepers.ICAControllerKeeper, &appKeepers.ICAHostKeeper) + appKeepers.TransferModule = transfer.NewAppModule(appKeepers.TransferKeeper) + appKeepers.PFMRouterModule = pfmrouter.NewAppModule(appKeepers.PFMRouterKeeper, appKeepers.GetSubspace(pfmroutertypes.ModuleName)) + appKeepers.RateLimitModule = ratelimit.NewAppModule(appCodec, *appKeepers.RateLimitKeeper) + + // Create Transfer Stack (from bottom to top of stack) + // - core IBC + // - ibcfee + // - ratelimit + // - pfm + // - provider + // - transfer + // + // This is how transfer stack will work in the end: + // * RecvPacket -> IBC core -> Fee -> RateLimit -> PFM -> Provider -> Transfer (AddRoute) + // * SendPacket -> Transfer -> Provider -> PFM -> RateLimit -> Fee -> IBC core (ICS4Wrapper) + + var transferStack porttypes.IBCModule + transferStack = transfer.NewIBCModule(appKeepers.TransferKeeper) + transferStack = icsprovider.NewIBCMiddleware( + transferStack, + appKeepers.ProviderKeeper, + ) + transferStack = pfmrouter.NewIBCMiddleware( + transferStack, + appKeepers.PFMRouterKeeper, + 0, // retries on timeout + pfmrouterkeeper.DefaultForwardTransferPacketTimeoutTimestamp, + pfmrouterkeeper.DefaultRefundTransferPacketTimeoutTimestamp, + ) + transferStack = liquidvesting.NewIBCMiddleware( + transferStack, + appKeepers.LiquidVestingKeeper, + ) + transferStack = ratelimit.NewIBCMiddleware( + *appKeepers.RateLimitKeeper, + transferStack, + ) + transferStack = records.NewIBCModule( + *appKeepers.RecordsKeeper, + transferStack, + ) + transferStack = ibcfee.NewIBCMiddleware( + transferStack, + appKeepers.IBCFeeKeeper, + ) + + // Create ICAHost Stack + var icaHostStack porttypes.IBCModule = icahost.NewIBCModule(appKeepers.ICAHostKeeper) + + // Create InterChain Callbacks Stack + var icaCallbacksStack porttypes.IBCModule = icacallbacks.NewIBCModule(*appKeepers.ICACallbacksKeeper) + appKeepers.StakeIBCKeeper.SetHooks(stakeibctypes.NewMultiStakeIBCHooks()) + icaCallbacksStack = stakeibc.NewIBCMiddleware(icaCallbacksStack, appKeepers.StakeIBCKeeper) + icaCallbacksStack = icacontroller.NewIBCMiddleware(icaCallbacksStack, appKeepers.ICAControllerKeeper) + + var wasmStack porttypes.IBCModule + wasmStack = wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCFeeKeeper) + wasmStack = ibcfee.NewIBCMiddleware(wasmStack, appKeepers.IBCFeeKeeper) + + // Create IBC Router & seal + ibcRouter := porttypes.NewRouter(). + AddRoute(icahosttypes.SubModuleName, icaHostStack). + AddRoute(icacontrollertypes.SubModuleName, icaCallbacksStack). + AddRoute(ibctransfertypes.ModuleName, transferStack). + AddRoute(providertypes.ModuleName, appKeepers.ProviderModule). + AddRoute(wasmtypes.ModuleName, wasmStack) + + appKeepers.IBCKeeper.SetRouter(ibcRouter) + + appKeepers.EpochsKeeper = appKeepers.EpochsKeeper.SetHooks( + epochstypes.NewMultiEpochHooks( + appKeepers.StakeIBCKeeper.Hooks(), + ), + ) + + // Register ICQ callbacks + err = appKeepers.InterchainQueryKeeper.SetCallbackHandler(stakeibctypes.ModuleName, appKeepers.StakeIBCKeeper.ICQCallbackHandler()) + if err != nil { + panic(err) + } + + // Register IBC callbacks + err = appKeepers.ICACallbacksKeeper.SetICACallbacks(appKeepers.StakeIBCKeeper.Callbacks(), appKeepers.RecordsKeeper.Callbacks()) + if err != nil { + panic(err) + } + + return appKeepers +} + +// GetSubspace returns a param subspace for a given module name. +func (appKeepers *AppKeepers) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, ok := appKeepers.ParamsKeeper.GetSubspace(moduleName) + if !ok { + panic("couldn't load subspace for module: " + moduleName) + } + return subspace +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable()) //nolint: staticcheck + paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) //nolint: staticcheck // SA1019 + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) + paramsKeeper.Subspace(pfmroutertypes.ModuleName).WithKeyTable(pfmroutertypes.ParamKeyTable()) + paramsKeeper.Subspace(ratelimittypes.ModuleName).WithKeyTable(ratelimittypes.ParamKeyTable()) + paramsKeeper.Subspace(providertypes.ModuleName).WithKeyTable(providertypes.ParamKeyTable()) + paramsKeeper.Subspace(wasmtypes.ModuleName) + + return paramsKeeper +} + +type DefaultFeemarketDenomResolver struct{} + +func (r *DefaultFeemarketDenomResolver) ConvertToDenom(_ sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { + if coin.Denom == denom { + return coin, nil + } + + return sdk.DecCoin{}, fmt.Errorf("error resolving denom") +} + +func (r *DefaultFeemarketDenomResolver) ExtraDenoms(_ sdk.Context) ([]string, error) { + return []string{}, nil +} diff --git a/app/keepers/keys.go b/app/keepers/keys.go new file mode 100644 index 000000000..f54a356a2 --- /dev/null +++ b/app/keepers/keys.go @@ -0,0 +1,143 @@ +package keepers + +import ( + "github.com/cosmos/cosmos-sdk/x/group" + routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" + feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" + + storetypes "cosmossdk.io/store/types" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + upgradetypes "cosmossdk.io/x/upgrade/types" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" + epochstypes "github.com/milkyway-labs/milkyway/x/epochs/types" + icacallbackstypes "github.com/milkyway-labs/milkyway/x/icacallbacks/types" + icqtypes "github.com/milkyway-labs/milkyway/x/interchainquery/types" + liquidvestingtypes "github.com/milkyway-labs/milkyway/x/liquidvesting/types" + operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" + recordstypes "github.com/milkyway-labs/milkyway/x/records/types" + restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" + rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" + servicestypes "github.com/milkyway-labs/milkyway/x/services/types" + stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" + tokenfactorytypes "github.com/milkyway-labs/milkyway/x/tokenfactory/types" +) + +func (appKeepers *AppKeepers) GenerateKeys() { + // Define what keys will be used in the cosmos-sdk key/value store. + // Cosmos-SDK modules each have a "key" that allows the application to reference what they've stored on the chain. + appKeepers.keys = storetypes.NewKVStoreKeys( + authtypes.StoreKey, + banktypes.StoreKey, + stakingtypes.StoreKey, + crisistypes.StoreKey, + minttypes.StoreKey, + distrtypes.StoreKey, + slashingtypes.StoreKey, + govtypes.StoreKey, + paramstypes.StoreKey, + ibcexported.StoreKey, + upgradetypes.StoreKey, + evidencetypes.StoreKey, + ibctransfertypes.StoreKey, + ibcfeetypes.StoreKey, + icahosttypes.StoreKey, + icacontrollertypes.StoreKey, + capabilitytypes.StoreKey, + feegrant.StoreKey, + authzkeeper.StoreKey, + routertypes.StoreKey, + ratelimittypes.StoreKey, + providertypes.StoreKey, + consensusparamtypes.StoreKey, + wasmtypes.StoreKey, + tokenfactorytypes.StoreKey, + group.StoreKey, + + // Skip + marketmaptypes.StoreKey, + oracletypes.StoreKey, + feemarkettypes.StoreKey, + + // Stride + epochstypes.StoreKey, + icqtypes.StoreKey, + icacallbackstypes.StoreKey, + recordstypes.StoreKey, + stakeibctypes.StoreKey, + + // Custom modules + servicestypes.StoreKey, + operatorstypes.StoreKey, + poolstypes.StoreKey, + restakingtypes.StoreKey, + assetstypes.StoreKey, + rewardstypes.StoreKey, + liquidvestingtypes.StoreKey, + ) + + // Define transient store keys + appKeepers.tkeys = storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + + // MemKeys are for information that is stored only in RAM. + appKeepers.memKeys = storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) +} + +func (appKeepers *AppKeepers) GetKVStoreKey() map[string]*storetypes.KVStoreKey { + return appKeepers.keys +} + +func (appKeepers *AppKeepers) GetTransientStoreKey() map[string]*storetypes.TransientStoreKey { + return appKeepers.tkeys +} + +func (appKeepers *AppKeepers) GetMemoryStoreKey() map[string]*storetypes.MemoryStoreKey { + return appKeepers.memKeys +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (appKeepers *AppKeepers) GetKey(storeKey string) *storetypes.KVStoreKey { + return appKeepers.keys[storeKey] +} + +// GetTKey returns the TransientStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (appKeepers *AppKeepers) GetTKey(storeKey string) *storetypes.TransientStoreKey { + return appKeepers.tkeys[storeKey] +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (appKeepers *AppKeepers) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + return appKeepers.memKeys[storeKey] +} diff --git a/app/keepers/modules.go b/app/keepers/modules.go new file mode 100644 index 000000000..3bdf49f30 --- /dev/null +++ b/app/keepers/modules.go @@ -0,0 +1,97 @@ +package keepers + +import ( + "cosmossdk.io/x/evidence" + feegrantmodule "cosmossdk.io/x/feegrant/module" + "cosmossdk.io/x/upgrade" + "github.com/CosmWasm/wasmd/x/wasm" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + "github.com/cosmos/cosmos-sdk/x/consensus" + "github.com/cosmos/cosmos-sdk/x/crisis" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + "github.com/cosmos/cosmos-sdk/x/gov" + "github.com/cosmos/cosmos-sdk/x/mint" + sdkparams "github.com/cosmos/cosmos-sdk/x/params" + "github.com/cosmos/cosmos-sdk/x/slashing" + pfmrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" + ratelimit "github.com/cosmos/ibc-apps/modules/rate-limiting/v8" + "github.com/cosmos/ibc-go/modules/capability" + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + no_valupdates_staking "github.com/cosmos/interchain-security/v6/x/ccv/no_valupdates_staking" + icsprovider "github.com/cosmos/interchain-security/v6/x/ccv/provider" + "github.com/skip-mev/connect/v2/x/marketmap" + "github.com/skip-mev/connect/v2/x/oracle" + "github.com/skip-mev/feemarket/x/feemarket" + + "github.com/milkyway-labs/milkyway/x/assets" + "github.com/milkyway-labs/milkyway/x/epochs" + "github.com/milkyway-labs/milkyway/x/icacallbacks" + "github.com/milkyway-labs/milkyway/x/interchainquery" + "github.com/milkyway-labs/milkyway/x/liquidvesting" + "github.com/milkyway-labs/milkyway/x/operators" + "github.com/milkyway-labs/milkyway/x/pools" + "github.com/milkyway-labs/milkyway/x/records" + "github.com/milkyway-labs/milkyway/x/restaking" + "github.com/milkyway-labs/milkyway/x/rewards" + "github.com/milkyway-labs/milkyway/x/services" + "github.com/milkyway-labs/milkyway/x/stakeibc" +) + +var AppModuleBasics = module.NewBasicManager( + auth.AppModuleBasic{}, + vesting.AppModuleBasic{}, + bank.AppModuleBasic{}, + capability.AppModuleBasic{}, + crisis.AppModuleBasic{}, + gov.AppModuleBasic{}, + mint.AppModuleBasic{}, + slashing.AppModuleBasic{}, + distr.AppModuleBasic{}, + no_valupdates_staking.AppModuleBasic{}, + upgrade.AppModuleBasic{}, + evidence.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, + ibc.AppModuleBasic{}, + ibctm.AppModuleBasic{}, + sdkparams.AppModuleBasic{}, + consensus.AppModuleBasic{}, + wasm.AppModuleBasic{}, + + // Skip modules + feemarket.AppModuleBasic{}, + oracle.AppModuleBasic{}, + marketmap.AppModuleBasic{}, + + // IBC Modules + ibcfee.AppModuleBasic{}, + transfer.AppModuleBasic{}, + ica.AppModuleBasic{}, + pfmrouter.AppModuleBasic{}, + ratelimit.AppModuleBasic{}, + icsprovider.AppModuleBasic{}, + + // Stride modules + stakeibc.AppModuleBasic{}, + epochs.AppModuleBasic{}, + interchainquery.AppModuleBasic{}, + records.AppModuleBasic{}, + icacallbacks.AppModuleBasic{}, + + // MilkyWay modules + services.AppModuleBasic{}, + operators.AppModuleBasic{}, + pools.AppModuleBasic{}, + restaking.AppModuleBasic{}, + assets.AppModuleBasic{}, + rewards.AppModuleBasic{}, + liquidvesting.AppModuleBasic{}, +) diff --git a/app/modules.go b/app/modules.go new file mode 100644 index 000000000..531341cba --- /dev/null +++ b/app/modules.go @@ -0,0 +1,413 @@ +package milkyway + +import ( + "github.com/skip-mev/connect/v2/x/marketmap" + marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + "github.com/skip-mev/connect/v2/x/oracle" + oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" + "github.com/skip-mev/feemarket/x/feemarket" + feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" + + pfmroutertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + no_valupdates_genutil "github.com/cosmos/interchain-security/v6/x/ccv/no_valupdates_genutil" + no_valupdates_staking "github.com/cosmos/interchain-security/v6/x/ccv/no_valupdates_staking" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + + "cosmossdk.io/x/evidence" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantmodule "cosmossdk.io/x/feegrant/module" + "cosmossdk.io/x/upgrade" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/consensus" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/mint" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + sdkparams "github.com/cosmos/cosmos-sdk/x/params" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + "github.com/milkyway-labs/milkyway/x/assets" + assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" + "github.com/milkyway-labs/milkyway/x/epochs" + epochstypes "github.com/milkyway-labs/milkyway/x/epochs/types" + "github.com/milkyway-labs/milkyway/x/icacallbacks" + icacallbackstypes "github.com/milkyway-labs/milkyway/x/icacallbacks/types" + "github.com/milkyway-labs/milkyway/x/interchainquery" + icqtypes "github.com/milkyway-labs/milkyway/x/interchainquery/types" + "github.com/milkyway-labs/milkyway/x/liquidvesting" + liquidvestingtypes "github.com/milkyway-labs/milkyway/x/liquidvesting/types" + "github.com/milkyway-labs/milkyway/x/operators" + operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + "github.com/milkyway-labs/milkyway/x/pools" + poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" + "github.com/milkyway-labs/milkyway/x/records" + recordstypes "github.com/milkyway-labs/milkyway/x/records/types" + "github.com/milkyway-labs/milkyway/x/restaking" + restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" + "github.com/milkyway-labs/milkyway/x/rewards" + rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" + "github.com/milkyway-labs/milkyway/x/services" + servicestypes "github.com/milkyway-labs/milkyway/x/services/types" + "github.com/milkyway-labs/milkyway/x/stakeibc" + stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" + tokenfactorytypes "github.com/milkyway-labs/milkyway/x/tokenfactory/types" +) + +var MaccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + icatypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + providertypes.ConsumerRewardsPool: nil, + wasmtypes.ModuleName: {authtypes.Burner}, + feemarkettypes.ModuleName: nil, + feemarkettypes.FeeCollectorName: nil, + tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + + // Skip + oracletypes.ModuleName: nil, + + // Stride + icqtypes.ModuleName: nil, + stakeibctypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, + stakeibctypes.RewardCollectorName: nil, + + // MilkyWay permissions + rewardstypes.RewardsPoolName: nil, + liquidvestingtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, +} + +func appModules( + app *MilkyWayApp, + appCodec codec.Codec, + txConfig client.TxEncodingConfig, + skipGenesisInvariants bool, +) []module.AppModule { + return []module.AppModule{ + no_valupdates_genutil.NewAppModule( + app.AccountKeeper, + app.StakingKeeper, + app, + txConfig, + ), + auth.NewAppModule(appCodec, app.AccountKeeper, nil, app.GetSubspace(authtypes.ModuleName)), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + no_valupdates_staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), + evidence.NewAppModule(app.EvidenceKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + ibc.NewAppModule(app.IBCKeeper), + ibctm.NewAppModule(), + sdkparams.NewAppModule(app.ParamsKeeper), + consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), + wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), + + // Skip modules + feemarket.NewAppModule(appCodec, *app.FeeMarketKeeper), + oracle.NewAppModule(appCodec, *app.OracleKeeper), + marketmap.NewAppModule(appCodec, app.MarketMapKeeper), + + // IBC Modules + ibcfee.NewAppModule(app.IBCFeeKeeper), + app.TransferModule, + app.ICAModule, + app.PFMRouterModule, + app.RateLimitModule, + app.ProviderModule, + + // Stride modules + stakeibc.NewAppModule(appCodec, app.StakeIBCKeeper, app.AccountKeeper, app.BankKeeper), + epochs.NewAppModule(appCodec, *app.EpochsKeeper), + interchainquery.NewAppModule(appCodec, app.InterchainQueryKeeper), + records.NewAppModule(appCodec, *app.RecordsKeeper, app.AccountKeeper, app.BankKeeper), + icacallbacks.NewAppModule(appCodec, *app.ICACallbacksKeeper, app.AccountKeeper, app.BankKeeper), + + // MilkyWay modules + services.NewAppModule(appCodec, app.ServicesKeeper, app.PoolsKeeper), + operators.NewAppModule(appCodec, app.OperatorsKeeper), + pools.NewAppModule(appCodec, app.PoolsKeeper), + restaking.NewAppModule(appCodec, app.RestakingKeeper), + assets.NewAppModule(appCodec, app.AssetsKeeper), + rewards.NewAppModule(appCodec, app.RewardsKeeper), + liquidvesting.NewAppModule(appCodec, app.LiquidVestingKeeper), + } +} + +// ModuleBasics defines the module BasicManager that is in charge of setting up basic, +// non-dependant module elements, such as codec registration +// and genesis verification. +func newBasicManagerFromManager(app *MilkyWayApp) module.BasicManager { + basicManager := module.NewBasicManagerFromManager( + app.mm, + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }, + ), + }) + basicManager.RegisterLegacyAminoCodec(app.legacyAmino) + basicManager.RegisterInterfaces(app.interfaceRegistry) + return basicManager +} + +// simulationModules returns modules for simulation manager +// define the order of the modules for deterministic simulations +func simulationModules( + app *MilkyWayApp, + appCodec codec.Codec, + _ bool, +) []module.AppModuleSimulation { + return []module.AppModuleSimulation{ + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), + sdkparams.NewAppModule(app.ParamsKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), + ibc.NewAppModule(app.IBCKeeper), + app.TransferModule, + app.ICAModule, + } +} + +/* +orderBeginBlockers tells the app's module manager how to set the order of +BeginBlockers, which are run at the beginning of every block. + +Interchain Security Requirements: +During begin block slashing happens after distr.BeginBlocker so that +there is nothing left over in the validator fee pool, so as to keep the +CanWithdrawInvariant invariant. +NOTE: staking module is required if HistoricalEntries param > 0 +NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) +*/ +func orderBeginBlockers() []string { + return []string{ + capabilitytypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + govtypes.ModuleName, + crisistypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + pfmroutertypes.ModuleName, + ratelimittypes.ModuleName, + ibcfeetypes.ModuleName, + genutiltypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + vestingtypes.ModuleName, + providertypes.ModuleName, + consensusparamtypes.ModuleName, + wasmtypes.ModuleName, + + // Skip modules + oracletypes.ModuleName, + marketmaptypes.ModuleName, + feemarkettypes.ModuleName, + + // Stride modules + stakeibctypes.ModuleName, + epochstypes.ModuleName, + ratelimittypes.ModuleName, + + // MilkyWay modules + rewardstypes.ModuleName, + servicestypes.ModuleName, + operatorstypes.ModuleName, + poolstypes.ModuleName, + restakingtypes.ModuleName, + } +} + +/* +Interchain Security Requirements: +- provider.EndBlock gets validator updates from the staking module; +thus, staking.EndBlock must be executed before provider.EndBlock; +- creating a new consumer chain requires the following order, +CreateChildClient(), staking.EndBlock, provider.EndBlock; +thus, gov.EndBlock must be executed before staking.EndBlock +*/ +func orderEndBlockers() []string { + return []string{ + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + pfmroutertypes.ModuleName, + ratelimittypes.ModuleName, + capabilitytypes.ModuleName, + ibcfeetypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + minttypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + providertypes.ModuleName, + consensusparamtypes.ModuleName, + wasmtypes.ModuleName, + + // Skip modules + marketmaptypes.ModuleName, + oracletypes.ModuleName, + feemarkettypes.ModuleName, + + // Stride modules + stakeibctypes.ModuleName, + icqtypes.ModuleName, + + // MilkyWay modules + servicestypes.ModuleName, + operatorstypes.ModuleName, + poolstypes.ModuleName, + restakingtypes.ModuleName, + liquidvestingtypes.ModuleName, + } +} + +/* +NOTE: The genutils module must occur after staking so that pools are +properly initialized with tokens from genesis accounts. +NOTE: The genutils module must also occur after auth so that it can access the params from auth. +NOTE: Capability module must occur first so that it can initialize any capabilities +so that other modules that want to create or claim capabilities afterwards in InitChain +can do so safely. +*/ +func orderInitBlockers() []string { + return []string{ + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + minttypes.ModuleName, + genutiltypes.ModuleName, + ibctransfertypes.ModuleName, + ibcexported.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + pfmroutertypes.ModuleName, + ratelimittypes.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + + // Skip modules + oracletypes.ModuleName, + marketmaptypes.ModuleName, + + // Stride modules + stakeibctypes.ModuleName, + epochstypes.ModuleName, + icqtypes.ModuleName, + recordstypes.ModuleName, + icacallbackstypes.ModuleName, + + // MilkyWay modules + servicestypes.ModuleName, + operatorstypes.ModuleName, + poolstypes.ModuleName, + restakingtypes.ModuleName, + assetstypes.ModuleName, + rewardstypes.ModuleName, + liquidvestingtypes.ModuleName, + + // The feemarket module should ideally be initialized before the genutil module in theory: + // The feemarket antehandler performs checks in DeliverTx, which is called by gentx. + // When the fee > 0, gentx needs to pay the fee. However, this is not expected. + // To resolve this issue, we should initialize the feemarket module after genutil, ensuring that the + // min fee is empty when gentx is called. + // A similar issue existed for the 'globalfee' module, which was previously used instead of 'feemarket'. + // For more details, please refer to the following link: https://github.com/cosmos/gaia/issues/2489 + feemarkettypes.ModuleName, + providertypes.ModuleName, + consensusparamtypes.ModuleName, + wasmtypes.ModuleName, + // crisis needs to be last so that the genesis state is consistent + // when it checks invariants + crisistypes.ModuleName, + } +} diff --git a/app/params/amino.go b/app/params/amino.go new file mode 100644 index 000000000..364e917b3 --- /dev/null +++ b/app/params/amino.go @@ -0,0 +1,23 @@ +//go:build test_amino +// +build test_amino + +package params + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" +) + +func MakeTestEncodingConfig() EncodingConfig { + cdc := codec.NewLegacyAmino() + interfaceRegistry := cdctypes.NewInterfaceRegistry() + codec := codec.NewProtoCodec(interfaceRegistry) + + return EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: codec, + TxConfig: legacytx.StdTxConfig{Cdc: cdc}, + Amino: cdc, + } +} diff --git a/app/params/config.go b/app/params/config.go new file mode 100644 index 000000000..c072e3958 --- /dev/null +++ b/app/params/config.go @@ -0,0 +1,77 @@ +package params + +import ( + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + HumanCoinUnit = "milk" + BaseCoinUnit = "umilk" + MilkExponent = 6 + + DefaultBondDenom = BaseCoinUnit + + // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address. + Bech32PrefixAccAddr = "milk" +) + +var ( + // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key. + Bech32PrefixAccPub = Bech32PrefixAccAddr + "pub" + // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address. + Bech32PrefixValAddr = Bech32PrefixAccAddr + "valoper" + // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key. + Bech32PrefixValPub = Bech32PrefixAccAddr + "valoperpub" + // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address. + Bech32PrefixConsAddr = Bech32PrefixAccAddr + "valcons" + // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key. + Bech32PrefixConsPub = Bech32PrefixAccAddr + "valconspub" +) + +func init() { + SetAddressPrefixes() + RegisterDenoms() +} + +// RegisterDenoms registers token denoms. +func RegisterDenoms() { + err := sdk.RegisterDenom(HumanCoinUnit, math.LegacyOneDec()) + if err != nil { + panic(err) + } + err = sdk.RegisterDenom(BaseCoinUnit, math.LegacyNewDecWithPrec(1, MilkExponent)) + if err != nil { + panic(err) + } +} + +// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format. +func SetAddressPrefixes() { + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) + config.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) + config.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) + + // This is copied from the cosmos sdk v0.43.0-beta1 + // source: https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/types/address.go#L141 + config.SetAddressVerifier(func(bytes []byte) error { + if len(bytes) == 0 { + return errorsmod.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty") + } + + if len(bytes) > address.MaxAddrLen { + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d, %x", address.MaxAddrLen, len(bytes), bytes) + } + + // TODO: Do we want to allow addresses of lengths other than 20 and 32 bytes? + if len(bytes) != 20 && len(bytes) != 32 { + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d, %x", len(bytes), bytes) + } + + return nil + }) +} diff --git a/app/params/doc.go b/app/params/doc.go new file mode 100644 index 000000000..a7783a682 --- /dev/null +++ b/app/params/doc.go @@ -0,0 +1,19 @@ +/* +Package params defines the simulation parameters in the milkyway. + +It contains the default weights used for each transaction used on the module's +simulation. These weights define the chance for a transaction to be simulated at +any given operation. + +You can replace the default values for the weights by providing a params.json +file with the weights defined for each of the transaction operations: + + { + "op_weight_msg_send": 60, + "op_weight_msg_delegate": 100, + } + +In the example above, the `MsgSend` has 60% chance to be simulated, while the +`MsgDelegate` will always be simulated. +*/ +package params diff --git a/app/params/encoding.go b/app/params/encoding.go new file mode 100644 index 000000000..3d634abf1 --- /dev/null +++ b/app/params/encoding.go @@ -0,0 +1,16 @@ +package params + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Marshaler codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} diff --git a/app/params/proto.go b/app/params/proto.go new file mode 100644 index 000000000..868902d9a --- /dev/null +++ b/app/params/proto.go @@ -0,0 +1,28 @@ +package params + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/testutil" + "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. +func MakeEncodingConfig() EncodingConfig { + amino := codec.NewLegacyAmino() + interfaceRegistry := testutil.CodecOptions{AccAddressPrefix: "milk", ValAddressPrefix: "milkvaloper"}.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) + + return EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: txCfg, + Amino: amino, + } +} + +// MakeCodecs creates the necessary testing codecs for Amino and Protobuf +func MakeCodecs() (codec.Codec, *codec.LegacyAmino) { + encodingConfig := MakeEncodingConfig() + return encodingConfig.Marshaler, encodingConfig.Amino +} diff --git a/app/post.go b/app/post.go new file mode 100644 index 000000000..50082b12a --- /dev/null +++ b/app/post.go @@ -0,0 +1,48 @@ +package milkyway + +import ( + feemarketpost "github.com/skip-mev/feemarket/x/feemarket/post" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/milkyway-labs/milkyway/ante" +) + +// PostHandlerOptions are the options required for constructing a FeeMarket PostHandler. +type PostHandlerOptions struct { + AccountKeeper feemarketpost.AccountKeeper + BankKeeper feemarketpost.BankKeeper + FeeMarketKeeper feemarketpost.FeeMarketKeeper +} + +// NewPostHandler returns a PostHandler chain with the fee deduct decorator. +func NewPostHandler(options PostHandlerOptions) (sdk.PostHandler, error) { + if !ante.UseFeeMarketDecorator { + return nil, nil + } + + if options.AccountKeeper == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for post builder") + } + + if options.BankKeeper == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for post builder") + } + + if options.FeeMarketKeeper == nil { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "feemarket keeper is required for post builder") + } + + postDecorators := []sdk.PostDecorator{ + feemarketpost.NewFeeMarketDeductDecorator( + options.AccountKeeper, + options.BankKeeper, + options.FeeMarketKeeper, + ), + } + + return sdk.ChainPostDecorators(postDecorators...), nil +} diff --git a/app/sim/sim_config.go b/app/sim/sim_config.go new file mode 100644 index 000000000..43c150303 --- /dev/null +++ b/app/sim/sim_config.go @@ -0,0 +1,75 @@ +package sim + +import ( + "flag" + + "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// List of available flags for the simulator +var ( + FlagGenesisFileValue string + FlagParamsFileValue string + FlagExportParamsPathValue string + FlagExportParamsHeightValue int + FlagExportStatePathValue string + FlagExportStatsPathValue string + FlagSeedValue int64 + FlagInitialBlockHeightValue int + FlagNumBlocksValue int + FlagBlockSizeValue int + FlagLeanValue bool + FlagCommitValue bool + FlagOnOperationValue bool // TODO: Remove in favor of binary search for invariant violation + FlagAllInvariantsValue bool + + FlagEnabledValue bool + FlagVerboseValue bool + FlagPeriodValue uint + FlagGenesisTimeValue int64 +) + +// GetSimulatorFlags gets the values of all the available simulation flags +func GetSimulatorFlags() { + // config fields + flag.StringVar(&FlagGenesisFileValue, "Genesis", "", "custom simulation genesis file; cannot be used with params file") + flag.StringVar(&FlagParamsFileValue, "Params", "", "custom simulation params file which overrides any random params; cannot be used with genesis") + flag.StringVar(&FlagExportParamsPathValue, "ExportParamsPath", "", "custom file path to save the exported params JSON") + flag.IntVar(&FlagExportParamsHeightValue, "ExportParamsHeight", 0, "height to which export the randomly generated params") + flag.StringVar(&FlagExportStatePathValue, "ExportStatePath", "", "custom file path to save the exported app state JSON") + flag.StringVar(&FlagExportStatsPathValue, "ExportStatsPath", "", "custom file path to save the exported simulation statistics JSON") + flag.Int64Var(&FlagSeedValue, "Seed", 42, "simulation random seed") + flag.IntVar(&FlagInitialBlockHeightValue, "InitialBlockHeight", 1, "initial block to start the simulation") + flag.IntVar(&FlagNumBlocksValue, "NumBlocks", 500, "number of new blocks to simulate from the initial block height") + flag.IntVar(&FlagBlockSizeValue, "BlockSize", 200, "operations per block") + flag.BoolVar(&FlagLeanValue, "Lean", false, "lean simulation log output") + flag.BoolVar(&FlagCommitValue, "Commit", false, "have the simulation commit") + flag.BoolVar(&FlagOnOperationValue, "SimulateEveryOperation", false, "run slow invariants every operation") + flag.BoolVar(&FlagAllInvariantsValue, "PrintAllInvariants", false, "print all invariants if a broken invariant is found") + + // simulation flags + flag.BoolVar(&FlagEnabledValue, "Enabled", false, "enable the simulation") + flag.BoolVar(&FlagVerboseValue, "Verbose", false, "verbose log output") + flag.UintVar(&FlagPeriodValue, "Period", 0, "run slow invariants only once every period assertions") + flag.Int64Var(&FlagGenesisTimeValue, "GenesisTime", 0, "override genesis UNIX time instead of using a random UNIX time") +} + +// NewConfigFromFlags creates a simulation from the retrieved values of the flags. +func NewConfigFromFlags() simulation.Config { + return simulation.Config{ + GenesisFile: FlagGenesisFileValue, + ParamsFile: FlagParamsFileValue, + ExportParamsPath: FlagExportParamsPathValue, + ExportParamsHeight: FlagExportParamsHeightValue, + ExportStatePath: FlagExportStatePathValue, + ExportStatsPath: FlagExportStatsPathValue, + Seed: FlagSeedValue, + InitialBlockHeight: FlagInitialBlockHeightValue, + NumBlocks: FlagNumBlocksValue, + BlockSize: FlagBlockSizeValue, + Lean: FlagLeanValue, + Commit: FlagCommitValue, + OnOperation: FlagOnOperationValue, + AllInvariants: FlagAllInvariantsValue, + } +} diff --git a/app/sim/sim_state.go b/app/sim/sim_state.go new file mode 100644 index 000000000..51cc20260 --- /dev/null +++ b/app/sim/sim_state.go @@ -0,0 +1,257 @@ +package sim + +import ( + "encoding/json" + "fmt" + "io" + "math/rand" + "os" + "time" + + cmtjson "github.com/cometbft/cometbft/libs/json" + tmtypes "github.com/cometbft/cometbft/types" + + "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + 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" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +// Simulation parameter constants +const ( + StakePerAccount = "stake_per_account" + InitiallyBondedValidators = "initially_bonded_validators" +) + +// AppStateFn returns the initial application state using a genesis or the simulation parameters. +// It panics if the user provides files for both of them. +// If a file is not given for the genesis or the sim params, it creates a randomized one. +func AppStateFn(cdc codec.Codec, simManager *module.SimulationManager, genesisState map[string]json.RawMessage) simtypes.AppStateFn { + return func(r *rand.Rand, accs []simtypes.Account, config simtypes.Config, + ) (appState json.RawMessage, simAccs []simtypes.Account, chainID string, genesisTimestamp time.Time) { + if FlagGenesisTimeValue == 0 { + genesisTimestamp = simtypes.RandTimestamp(r) + } else { + genesisTimestamp = time.Unix(FlagGenesisTimeValue, 0) + } + + chainID = config.ChainID + switch { + case config.ParamsFile != "" && config.GenesisFile != "": + panic("cannot provide both a genesis file and a params file") + + case config.GenesisFile != "": + // override the default chain-id from simapp to set it later to the config + genesisDoc, accounts, err := AppStateFromGenesisFileFn(r, cdc, config.GenesisFile) + if err != nil { + panic(err) + } + + if FlagGenesisTimeValue == 0 { + // use genesis timestamp if no custom timestamp is provided (i.e no random timestamp) + genesisTimestamp = genesisDoc.GenesisTime + } + + appState = genesisDoc.AppState + chainID = genesisDoc.ChainID + simAccs = accounts + + case config.ParamsFile != "": + appParams := make(simtypes.AppParams) + bz, err := os.ReadFile(config.ParamsFile) + if err != nil { + panic(err) + } + + err = json.Unmarshal(bz, &appParams) + if err != nil { + panic(err) + } + appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams, genesisState) + + default: + appParams := make(simtypes.AppParams) + appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams, genesisState) + } + + rawState := make(map[string]json.RawMessage) + err := json.Unmarshal(appState, &rawState) + if err != nil { + panic(err) + } + + stakingStateBz, ok := rawState[stakingtypes.ModuleName] + if !ok { + panic("staking genesis state is missing") + } + + stakingState := new(stakingtypes.GenesisState) + err = cdc.UnmarshalJSON(stakingStateBz, stakingState) + if err != nil { + panic(err) + } + // compute not bonded balance + notBondedTokens := math.ZeroInt() + for _, val := range stakingState.Validators { + if val.Status != stakingtypes.Unbonded { + continue + } + notBondedTokens = notBondedTokens.Add(val.GetTokens()) + } + notBondedCoins := sdk.NewCoin(stakingState.Params.BondDenom, notBondedTokens) + // edit bank state to make it have the not bonded pool tokens + bankStateBz, ok := rawState[banktypes.ModuleName] + // TODO(fdymylja/jonathan): should we panic in this case + if !ok { + panic("bank genesis state is missing") + } + bankState := new(banktypes.GenesisState) + err = cdc.UnmarshalJSON(bankStateBz, bankState) + if err != nil { + panic(err) + } + + stakingAddr := authtypes.NewModuleAddress(stakingtypes.NotBondedPoolName).String() + var found bool + for _, balance := range bankState.Balances { + if balance.Address == stakingAddr { + found = true + break + } + } + if !found { + bankState.Balances = append(bankState.Balances, banktypes.Balance{ + Address: stakingAddr, + Coins: sdk.NewCoins(notBondedCoins), + }) + } + + // change appState back + rawState[stakingtypes.ModuleName] = cdc.MustMarshalJSON(stakingState) + rawState[banktypes.ModuleName] = cdc.MustMarshalJSON(bankState) + + // replace appstate + appState, err = json.Marshal(rawState) + if err != nil { + panic(err) + } + return appState, simAccs, chainID, genesisTimestamp + } +} + +// AppStateRandomizedFn creates calls each module's GenesisState generator function +// and creates the simulation params +func AppStateRandomizedFn( + simManager *module.SimulationManager, r *rand.Rand, cdc codec.Codec, + accs []simtypes.Account, genesisTimestamp time.Time, appParams simtypes.AppParams, + genesisState map[string]json.RawMessage, +) (json.RawMessage, []simtypes.Account) { + numAccs := int64(len(accs)) + // generate a random amount of initial stake coins and a random initial + // number of bonded accounts + var ( + numInitiallyBonded int64 + initialStake math.Int + ) + + appParams.GetOrGenerate( + StakePerAccount, &initialStake, r, + func(r *rand.Rand) { initialStake = math.NewInt(r.Int63n(1e12)) }, + ) + appParams.GetOrGenerate( + InitiallyBondedValidators, &numInitiallyBonded, r, + func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(300)) }, + ) + + if numInitiallyBonded > numAccs { + numInitiallyBonded = numAccs + } + + fmt.Printf( + `Selected randomly generated parameters for simulated genesis: +{ + stake_per_account: "%d", + initially_bonded_validators: "%d" +} +`, initialStake, numInitiallyBonded, + ) + + simState := &module.SimulationState{ + AppParams: appParams, + Cdc: cdc, + Rand: r, + GenState: genesisState, + Accounts: accs, + InitialStake: initialStake, + NumBonded: numInitiallyBonded, + GenTimestamp: genesisTimestamp, + } + + simManager.GenerateGenesisStates(simState) + + appState, err := json.Marshal(genesisState) + if err != nil { + panic(err) + } + + return appState, accs +} + +// AppStateFromGenesisFileFn util function to generate the genesis AppState +// from a genesis.json file. +func AppStateFromGenesisFileFn(r io.Reader, cdc codec.JSONCodec, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account, error) { + bytes, err := os.ReadFile(genesisFile) + if err != nil { + panic(err) + } + + var genesis tmtypes.GenesisDoc + // NOTE: Comet uses a custom JSON decoder for GenesisDoc + err = cmtjson.Unmarshal(bytes, &genesis) + if err != nil { + panic(err) + } + + var appState milkyway.GenesisState + err = json.Unmarshal(genesis.AppState, &appState) + if err != nil { + panic(err) + } + + var authGenesis authtypes.GenesisState + if appState[authtypes.ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[authtypes.ModuleName], &authGenesis) + } + + newAccs := make([]simtypes.Account, len(authGenesis.Accounts)) + for i, acc := range authGenesis.Accounts { + // Pick a random private key, since we don't know the actual key + // This should be fine as it's only used for mock Tendermint validators + // and these keys are never actually used to sign by mock Tendermint. + privkeySeed := make([]byte, 15) + if _, err := r.Read(privkeySeed); err != nil { + panic(err) + } + + privKey := secp256k1.GenPrivKeyFromSecret(privkeySeed) + + a, ok := acc.GetCachedValue().(sdk.AccountI) + if !ok { + return genesis, nil, fmt.Errorf("expected account") + } + + // create simulator accounts + simAcc := simtypes.Account{PrivKey: privKey, PubKey: privKey.PubKey(), Address: a.GetAddress()} + newAccs[i] = simAcc + } + + return genesis, newAccs, nil +} diff --git a/app/sim/sim_utils.go b/app/sim/sim_utils.go new file mode 100644 index 000000000..155a2fe8c --- /dev/null +++ b/app/sim/sim_utils.go @@ -0,0 +1,77 @@ +package sim + +import ( + "encoding/json" + "fmt" + "os" + + dbm "github.com/cosmos/cosmos-db" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +// SimulationOperations retrieves the simulation params from the provided file path +// and returns all the modules weighted operations +func SimulationOperations(app *milkyway.MilkyWayApp, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation { + simState := module.SimulationState{ + AppParams: make(simtypes.AppParams), + Cdc: cdc, + } + + if config.ParamsFile != "" { + bz, err := os.ReadFile(config.ParamsFile) + if err != nil { + panic(err) + } + + err = json.Unmarshal(bz, &simState.AppParams) + if err != nil { + panic(err) + } + } + + simState.LegacyProposalContents = app.SimulationManager().GetProposalContents(simState) //nolint:staticcheck + simState.ProposalMsgs = app.SimulationManager().GetProposalMsgs(simState) + return app.SimulationManager().WeightedOperations(simState) +} + +// CheckExportSimulation exports the app state and simulation parameters to JSON +// if the export paths are defined. +func CheckExportSimulation(app runtime.AppI, config simtypes.Config, params simtypes.Params) error { + if config.ExportStatePath != "" { + fmt.Println("exporting app state...") + exported, err := app.ExportAppStateAndValidators(false, nil, nil) + if err != nil { + return err + } + + if err := os.WriteFile(config.ExportStatePath, []byte(exported.AppState), 0o600); err != nil { + return err + } + } + + if config.ExportParamsPath != "" { + fmt.Println("exporting simulation params...") + paramsBz, err := json.MarshalIndent(params, "", " ") + if err != nil { + return err + } + + if err := os.WriteFile(config.ExportParamsPath, paramsBz, 0o600); err != nil { + return err + } + } + return nil +} + +// PrintStats prints the corresponding statistics from the app DB. +func PrintStats(db dbm.DB) { + fmt.Println("\nLevelDB Stats") + fmt.Println(db.Stats()["leveldb.stats"]) + fmt.Println("LevelDB cached block size", db.Stats()["leveldb.cachedblock"]) +} diff --git a/app/sim_test.go b/app/sim_test.go new file mode 100644 index 000000000..4f1184a51 --- /dev/null +++ b/app/sim_test.go @@ -0,0 +1,152 @@ +package milkyway_test + +import ( + "encoding/json" + "fmt" + "math/rand" + "os" + "testing" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + oracleconfig "github.com/skip-mev/connect/v2/oracle/config" + "github.com/stretchr/testify/require" + + dbm "github.com/cosmos/cosmos-db" + + "cosmossdk.io/log" + "cosmossdk.io/math" + "cosmossdk.io/store" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + simulation2 "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" + + "github.com/milkyway-labs/milkyway/ante" + "github.com/milkyway-labs/milkyway/app/sim" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +// AppChainID hardcoded chainID for simulation +const AppChainID = "milkyway-app" + +func init() { + sim.GetSimulatorFlags() +} + +// interBlockCacheOpt returns a BaseApp option function that sets the persistent +// inter-block write-through cache. +func interBlockCacheOpt() func(*baseapp.BaseApp) { + return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) +} + +// TODO: Make another test for the fuzzer itself, which just has noOp txs +// and doesn't depend on the application. +func TestAppStateDeterminism(t *testing.T) { + if !sim.FlagEnabledValue { + t.Skip("skipping application simulation") + } + + // since we can't provide tx fees to SimulateFromSeed(), we must switch off the feemarket + ante.UseFeeMarketDecorator = false + + config := sim.NewConfigFromFlags() + config.InitialBlockHeight = 1 + config.ExportParamsPath = "" + config.OnOperation = false + config.AllInvariants = false + config.ChainID = AppChainID + + numSeeds := 3 + numTimesToRunPerSeed := 5 + + // We will be overriding the random seed and just run a single simulation on the provided seed value + if config.Seed != simcli.DefaultSeedValue { + numSeeds = 1 + } + + appHashList := make([]json.RawMessage, numTimesToRunPerSeed) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[server.FlagInvCheckPeriod] = sim.FlagPeriodValue + + for i := 0; i < numSeeds; i++ { + if config.Seed == simcli.DefaultSeedValue { + config.Seed = rand.Int63() + } + + fmt.Println("config.Seed: ", config.Seed) + + for j := 0; j < numTimesToRunPerSeed; j++ { + var logger log.Logger + if sim.FlagVerboseValue { + logger = log.NewTestLogger(t) + } else { + logger = log.NewNopLogger() + } + + db := dbm.NewMemDB() + dir, err := os.MkdirTemp("", "milkyway-simulation") + require.NoError(t, err) + appOptions[flags.FlagHome] = dir + app := milkyway.NewMilkyWayApp( + logger, + db, + nil, + true, + map[int64]bool{}, + dir, + oracleconfig.NewDefaultAppConfig(), + appOptions, + []wasmkeeper.Option{}, + interBlockCacheOpt(), + baseapp.SetChainID(AppChainID), + ) + + // NOTE: setting to zero to avoid failing the simulation + // due to the minimum staked tokens required to submit a vote + ante.SetMinStakedTokens(math.LegacyZeroDec()) + + // NOTE: setting to zero to avoid failing the simulation + // milkyway ante allows only certain proposals to be expedited - the simulation doesn't know about this + ante.SetExpeditedProposalsEnabled(false) + + fmt.Printf( + "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", + config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + + blockedAddresses := milkyway.BlockedModuleAccountAddrs(milkyway.ModuleAccountAddrs()) + + _, _, err = simulation.SimulateFromSeed( + t, + os.Stdout, + app.BaseApp, + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.ModuleBasics.DefaultGenesis(app.AppCodec())), + simulation2.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 + simtestutil.SimulationOperations(app, app.AppCodec(), config), + blockedAddresses, + config, + app.AppCodec(), + ) + require.NoError(t, err) + + if config.Commit { + sim.PrintStats(db) + } + + appHash := app.LastCommitID().Hash + appHashList[j] = appHash + + if j != 0 { + require.Equal( + t, string(appHashList[0]), string(appHashList[j]), + "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + } + } + } +} diff --git a/app/test_helpers.go b/app/test_helpers.go index 6d695cdc2..092d05e2a 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -1,4 +1,4 @@ -package app +package milkyway // DONTCOVER @@ -12,6 +12,10 @@ import ( 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" @@ -24,8 +28,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" opchildtypes "github.com/initia-labs/OPinit/x/opchild/types" - - "github.com/milkyway-labs/milkyway/types" ) // defaultConsensusParams defines the default Tendermint consensus params used in @@ -57,19 +59,25 @@ func getOrCreateMemDB(db *dbm.DB) dbm.DB { 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), - getOrCreateMemDB(nil), nil, true, - []wasmkeeper.Option{}, + map[int64]bool{}, + t.TempDir(), + oracleconfig.NewDefaultAppConfig(), simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), + []wasmkeeper.Option{}, + baseapp.SetChainID("milkyway-app"), ) if withGenesis { - return app, NewDefaultGenesisState(encCdc.Codec, app.BasicModuleManager, types.BaseDenom) + return app, NewDefaultGenesisStateWithValidator(encCdc.Marshaler, app.ModuleBasics) } return app, GenesisState{} @@ -81,36 +89,13 @@ func Setup(t *testing.T, isCheckTx bool) *MilkyWayApp { t.Helper() app, genState := setup(t, nil, true) - - // Create a validator which will be the admin of the chain as well as the - // bridge executor. - privVal := ed25519.GenPrivKey() // TODO: make it deterministic? - pubKey := privVal.PubKey() - pubKeyAny, err := codectypes.NewAnyWithValue(privVal.PubKey()) - if err != nil { - panic(err) - } - validator := opchildtypes.Validator{ - Moniker: "test-validator", - OperatorAddress: sdk.ValAddress(privVal.PubKey().Address()).String(), - ConsensusPubkey: pubKeyAny, - ConsPower: 1, - } - - // set validators and delegations - var opchildGenesis opchildtypes.GenesisState - app.AppCodec().MustUnmarshalJSON(genState[opchildtypes.ModuleName], &opchildGenesis) - opchildGenesis.Params.Admin = sdk.AccAddress(pubKey.Address().Bytes()).String() - opchildGenesis.Params.BridgeExecutors = []string{sdk.AccAddress(pubKey.Address().Bytes()).String()} - opchildGenesis.Validators = []opchildtypes.Validator{validator} - genState[opchildtypes.ModuleName] = app.AppCodec().MustMarshalJSON(&opchildGenesis) - 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, diff --git a/app/upgrade.go b/app/upgrade.go deleted file mode 100644 index b464f494e..000000000 --- a/app/upgrade.go +++ /dev/null @@ -1,14 +0,0 @@ -package app - -import ( - v110 "github.com/milkyway-labs/milkyway/app/upgrades/v110" - v122 "github.com/milkyway-labs/milkyway/app/upgrades/v122" - v130 "github.com/milkyway-labs/milkyway/app/upgrades/v130" -) - -// RegisterUpgradeHandlers returns upgrade handlers -func (app *MilkyWayApp) RegisterUpgradeHandlers() { - app.registerUpgrade(v110.NewUpgrade(app.ModuleManager, app.Configurator(), app.appCodec, app.keys, app.RewardsKeeper)) - app.registerUpgrade(v122.NewUpgrade(app.ModuleManager, app.Configurator(), app.StakeIBCKeeper)) - app.registerUpgrade(v130.NewUpgrade(app.ModuleManager, app.Configurator(), app.LiquidVestingKeeper)) -} diff --git a/app/upgrades/types.go b/app/upgrades/types.go new file mode 100644 index 000000000..121a13711 --- /dev/null +++ b/app/upgrades/types.go @@ -0,0 +1,41 @@ +package upgrades + +import ( + store "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/milkyway-labs/milkyway/app/keepers" +) + +// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal +// must have written, in order for the state migration to go smoothly. +// An upgrade must implement this struct, and then set it in the app.go. +// The app.go will then define the handler. +type Upgrade struct { + // Upgrade version name, for the upgrade handler, e.g. `v7` + UpgradeName string + + // CreateUpgradeHandler defines the function that creates an upgrade handler + CreateUpgradeHandler func(*module.Manager, module.Configurator, *keepers.AppKeepers) upgradetypes.UpgradeHandler + + // Store upgrades, should be used for any new modules introduced, new modules deleted, or store names renamed. + StoreUpgrades store.StoreUpgrades +} + +// Fork defines a struct containing the requisite fields for a non-software upgrade proposal +// Hard Fork at a given height to implement. +// There is one time code that can be added for the start of the Fork, in `BeginForkLogic`. +// Any other change in the code should be height-gated, if the goal is to have old and new binaries +// to be compatible prior to the upgrade height. +type Fork struct { + // Upgrade version name, for the upgrade handler, e.g. `v7` + UpgradeName string + // height the upgrade occurs at + UpgradeHeight int64 + + // Function that runs some custom state transition code at the beginning of a fork. + BeginForkLogic func(ctx sdk.Context, keepers *keepers.AppKeepers) +} diff --git a/app/upgrades/upgrade.go b/app/upgrades/upgrade.go deleted file mode 100644 index c8cee3283..000000000 --- a/app/upgrades/upgrade.go +++ /dev/null @@ -1,13 +0,0 @@ -package upgrades - -import ( - storetypes "cosmossdk.io/store/types" - upgradetypes "cosmossdk.io/x/upgrade/types" -) - -// Upgrade represents a generic on-chain upgrade -type Upgrade interface { - Name() string - Handler() upgradetypes.UpgradeHandler - StoreUpgrades() *storetypes.StoreUpgrades -} diff --git a/app/upgrades/v110/upgrade.go b/app/upgrades/v110/upgrade.go deleted file mode 100644 index b9c32a6a1..000000000 --- a/app/upgrades/v110/upgrade.go +++ /dev/null @@ -1,113 +0,0 @@ -package v710 - -import ( - "context" - - storetypes "cosmossdk.io/store/types" - upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/milkyway-labs/milkyway/app/upgrades" - assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" - operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" - poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" - restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" - rewardskeeper "github.com/milkyway-labs/milkyway/x/rewards/keeper" - rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" - servicestypes "github.com/milkyway-labs/milkyway/x/services/types" -) - -var _ upgrades.Upgrade = &Upgrade{} - -// Upgrade represents the v1.1.0 upgrade -type Upgrade struct { - mm *module.Manager - configurator module.Configurator - - cdc codec.BinaryCodec - keys map[string]*storetypes.KVStoreKey - rewardsKeeper *rewardskeeper.Keeper -} - -// NewUpgrade returns a new Upgrade instance -func NewUpgrade( - mm *module.Manager, - configurator module.Configurator, - cdc codec.BinaryCodec, - keys map[string]*storetypes.KVStoreKey, - rewardsKeeper *rewardskeeper.Keeper, -) *Upgrade { - return &Upgrade{ - mm: mm, - configurator: configurator, - cdc: cdc, - keys: keys, - rewardsKeeper: rewardsKeeper, - } -} - -// Name implements upgrades.Upgrade -func (u *Upgrade) Name() string { - return "v1.1.0" -} - -// Handler implements upgrades.Upgrade -func (u *Upgrade) Handler() upgradetypes.UpgradeHandler { - return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - // Set the operators module params - store := sdkCtx.KVStore(u.keys[operatorstypes.ModuleName]) - operatorsParams := operatorstypes.DefaultParams() - store.Set(operatorstypes.ParamsKey, u.cdc.MustMarshal(&operatorsParams)) - - // Set the pools params - store = sdkCtx.KVStore(u.keys[poolstypes.ModuleName]) - poolsParams := poolstypes.DefaultParams() - store.Set(poolstypes.ParamsKey, u.cdc.MustMarshal(&poolsParams)) - - // Set the restaking params - store = sdkCtx.KVStore(u.keys[restakingtypes.ModuleName]) - restakingParams := restakingtypes.DefaultParams() - store.Set(restakingtypes.ParamsKey, u.cdc.MustMarshal(&restakingParams)) - - // Set the rewards params - if err := u.rewardsKeeper.Params.Set(ctx, rewardstypes.DefaultParams()); err != nil { - return nil, err - } - - // Set the services params - store = sdkCtx.KVStore(u.keys[servicestypes.ModuleName]) - servicesParams := servicestypes.DefaultParams() - store.Set(servicestypes.ParamsKey, u.cdc.MustMarshal(&servicesParams)) - - // Set the module versions - fromVM[assetstypes.ModuleName] = 1 - fromVM[operatorstypes.ModuleName] = 1 - fromVM[poolstypes.ModuleName] = 1 - fromVM[restakingtypes.ModuleName] = 1 - fromVM[rewardstypes.ModuleName] = 1 - fromVM[servicestypes.ModuleName] = 1 - - // This upgrade does not require any migration, so we can simply return the current version map - return u.mm.RunMigrations(ctx, u.configurator, fromVM) - } -} - -// StoreUpgrades implements upgrades.Upgrade -func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{ - Added: []string{ - assetstypes.ModuleName, - operatorstypes.ModuleName, - poolstypes.ModuleName, - restakingtypes.ModuleName, - rewardstypes.ModuleName, - servicestypes.ModuleName, - }, - Renamed: nil, - Deleted: nil, - } -} diff --git a/app/upgrades/v122/upgrade.go b/app/upgrades/v122/upgrade.go deleted file mode 100644 index 4db3394a3..000000000 --- a/app/upgrades/v122/upgrade.go +++ /dev/null @@ -1,70 +0,0 @@ -package v122 - -import ( - "context" - - storetypes "cosmossdk.io/store/types" - upgradetypes "cosmossdk.io/x/upgrade/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/milkyway-labs/milkyway/app/upgrades" - stakeibckeeper "github.com/milkyway-labs/milkyway/x/stakeibc/keeper" - stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" -) - -var ( - _ upgrades.Upgrade = &Upgrade{} -) - -// Upgrade represents the v1.2.2 upgrade -type Upgrade struct { - mm *module.Manager - configurator module.Configurator - stakeIBCKeeper stakeibckeeper.Keeper -} - -// NewUpgrade returns a new Upgrade instance -func NewUpgrade( - mm *module.Manager, - configurator module.Configurator, - rewardsKeeper stakeibckeeper.Keeper, -) *Upgrade { - return &Upgrade{ - mm: mm, - configurator: configurator, - stakeIBCKeeper: rewardsKeeper, - } -} - -// Name implements upgrades.Upgrade -func (u *Upgrade) Name() string { - return "v1.2.2" -} - -// Handler implements upgrades.Upgrade -func (u *Upgrade) Handler() upgradetypes.UpgradeHandler { - return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - // Update the unbonding period of the host zone to 21 days. - hostZone, found := u.stakeIBCKeeper.GetHostZone(sdkCtx, "initiation-2") - if !found { - return nil, stakeibctypes.ErrHostZoneNotFound - } - hostZone.UnbondingPeriod = 21 - u.stakeIBCKeeper.SetHostZone(sdkCtx, hostZone) - - // This upgrade does not require any migration, so we can simply return the current version map - return u.mm.RunMigrations(ctx, u.configurator, fromVM) - } -} - -// StoreUpgrades implements upgrades.Upgrade -func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{ - Added: nil, - Renamed: nil, - Deleted: nil, - } -} diff --git a/app/upgrades/v122/upgrade_test.go b/app/upgrades/v122/upgrade_test.go deleted file mode 100644 index c5d0f58e4..000000000 --- a/app/upgrades/v122/upgrade_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package v122_test - -import ( - "testing" - - "cosmossdk.io/core/header" - upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/stretchr/testify/suite" - - "github.com/milkyway-labs/milkyway/app/testutil" - v122 "github.com/milkyway-labs/milkyway/app/upgrades/v122" - stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" -) - -type KeeperTestSuite struct { - testutil.KeeperTestSuite -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.KeeperTestSuite.SetupTest() -} - -func (suite *KeeperTestSuite) TestUpgradeV122() { - suite.Ctx = suite.Ctx.WithHeaderInfo(header.Info{Height: 1}) - - // Set the host zone. - suite.App.StakeIBCKeeper.SetHostZone(suite.Ctx, stakeibctypes.HostZone{ - ChainId: "initiation-2", - Bech32Prefix: "init", - ConnectionId: "connection-0", - TransferChannelId: "channel-0", - IbcDenom: "ibc/37A3FB4FED4CA04ED6D9E5DA36C6D27248645F0E22F585576A1488B8A89C5A50", - HostDenom: "uinit", - UnbondingPeriod: 7, - }) - - upgradeHeight := suite.Ctx.HeaderInfo().Height + 1 - - upgrade := v122.NewUpgrade(suite.App.ModuleManager, suite.App.Configurator(), suite.App.StakeIBCKeeper) - plan := upgradetypes.Plan{Name: upgrade.Name(), Height: upgradeHeight} - err := suite.App.UpgradeKeeper.ScheduleUpgrade(suite.Ctx, plan) - suite.Require().NoError(err) - - _, err = suite.App.UpgradeKeeper.GetUpgradePlan(suite.Ctx) - suite.Require().NoError(err) - - suite.Ctx = suite.Ctx.WithHeaderInfo(header.Info{Height: upgradeHeight}) - // PreBlocker triggers the upgrade - _, err = suite.App.PreBlocker(suite.Ctx, nil) - suite.Require().NoError(err) - - // Check if the unbonding period has been updated to 21 days. - hostZone, found := suite.App.StakeIBCKeeper.GetHostZone(suite.Ctx, "initiation-2") - suite.Require().True(found) - suite.Require().EqualValues(21, hostZone.UnbondingPeriod) -} diff --git a/app/upgrades/v130/upgrade.go b/app/upgrades/v130/upgrade.go deleted file mode 100644 index 4183b9d36..000000000 --- a/app/upgrades/v130/upgrade.go +++ /dev/null @@ -1,73 +0,0 @@ -package v122 - -import ( - "context" - - storetypes "cosmossdk.io/store/types" - upgradetypes "cosmossdk.io/x/upgrade/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/milkyway-labs/milkyway/app/upgrades" - liquidvestingkeeper "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" - liquidvestingtypes "github.com/milkyway-labs/milkyway/x/liquidvesting/types" -) - -var ( - _ upgrades.Upgrade = &Upgrade{} -) - -// Upgrade represents the v1.3.0 upgrade -type Upgrade struct { - mm *module.Manager - configurator module.Configurator - - liquidVestingKeeper *liquidvestingkeeper.Keeper -} - -// NewUpgrade returns a new Upgrade instance -func NewUpgrade( - mm *module.Manager, - configurator module.Configurator, - liquidVestingKeeper *liquidvestingkeeper.Keeper, -) *Upgrade { - return &Upgrade{ - mm: mm, - configurator: configurator, - - liquidVestingKeeper: liquidVestingKeeper, - } -} - -// Name implements upgrades.Upgrade -func (u *Upgrade) Name() string { - return "v1.3.0" -} - -// Handler implements upgrades.Upgrade -func (u *Upgrade) Handler() upgradetypes.UpgradeHandler { - return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - // Set up the new x/liquidvesting module - err := u.liquidVestingKeeper.SetParams(sdkCtx, liquidvestingtypes.DefaultParams()) - if err != nil { - return nil, err - } - fromVM[liquidvestingtypes.ModuleName] = 1 - - // This upgrade does not require any migration, so we can simply return the current version map - return u.mm.RunMigrations(ctx, u.configurator, fromVM) - } -} - -// StoreUpgrades implements upgrades.Upgrade -func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{ - Added: []string{ - liquidvestingtypes.ModuleName, - }, - Renamed: nil, - Deleted: nil, - } -} diff --git a/app/upgrades/v130/upgrade_test.go b/app/upgrades/v130/upgrade_test.go deleted file mode 100644 index c5d0f58e4..000000000 --- a/app/upgrades/v130/upgrade_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package v122_test - -import ( - "testing" - - "cosmossdk.io/core/header" - upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/stretchr/testify/suite" - - "github.com/milkyway-labs/milkyway/app/testutil" - v122 "github.com/milkyway-labs/milkyway/app/upgrades/v122" - stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" -) - -type KeeperTestSuite struct { - testutil.KeeperTestSuite -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.KeeperTestSuite.SetupTest() -} - -func (suite *KeeperTestSuite) TestUpgradeV122() { - suite.Ctx = suite.Ctx.WithHeaderInfo(header.Info{Height: 1}) - - // Set the host zone. - suite.App.StakeIBCKeeper.SetHostZone(suite.Ctx, stakeibctypes.HostZone{ - ChainId: "initiation-2", - Bech32Prefix: "init", - ConnectionId: "connection-0", - TransferChannelId: "channel-0", - IbcDenom: "ibc/37A3FB4FED4CA04ED6D9E5DA36C6D27248645F0E22F585576A1488B8A89C5A50", - HostDenom: "uinit", - UnbondingPeriod: 7, - }) - - upgradeHeight := suite.Ctx.HeaderInfo().Height + 1 - - upgrade := v122.NewUpgrade(suite.App.ModuleManager, suite.App.Configurator(), suite.App.StakeIBCKeeper) - plan := upgradetypes.Plan{Name: upgrade.Name(), Height: upgradeHeight} - err := suite.App.UpgradeKeeper.ScheduleUpgrade(suite.Ctx, plan) - suite.Require().NoError(err) - - _, err = suite.App.UpgradeKeeper.GetUpgradePlan(suite.Ctx) - suite.Require().NoError(err) - - suite.Ctx = suite.Ctx.WithHeaderInfo(header.Info{Height: upgradeHeight}) - // PreBlocker triggers the upgrade - _, err = suite.App.PreBlocker(suite.Ctx, nil) - suite.Require().NoError(err) - - // Check if the unbonding period has been updated to 21 days. - hostZone, found := suite.App.StakeIBCKeeper.GetHostZone(suite.Ctx, "initiation-2") - suite.Require().True(found) - suite.Require().EqualValues(21, hostZone.UnbondingPeriod) -} diff --git a/cmd/milkywayd/cmd/bech32_convert.go b/cmd/milkywayd/cmd/bech32_convert.go new file mode 100644 index 000000000..ccdad6e86 --- /dev/null +++ b/cmd/milkywayd/cmd/bech32_convert.go @@ -0,0 +1,53 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" + + addressutil "github.com/milkyway-labs/milkyway/pkg/address" +) + +var flagBech32Prefix = "prefix" + +// AddBech32ConvertCommand returns bech32-convert cobra Command. +func AddBech32ConvertCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "bech32-convert [address]", + Short: "Convert any bech32 string to the MilkyWay prefix", + Long: `Convert any bech32 string to the MilkyWay prefix + +Example: + milkywayd debug bech32-convert akash1a6zlyvpnksx8wr6wz8wemur2xe8zyh0ytz6d88 + + milkywayd debug bech32-convert stride1673f0t8p893rqyqe420mgwwz92ac4qv6synvx2 --prefix osmo + `, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + bech32prefix, err := cmd.Flags().GetString(flagBech32Prefix) + if err != nil { + return err + } + + address := args[0] + convertedAddress, err := addressutil.ConvertBech32Prefix(address, bech32prefix) + if err != nil { + return fmt.Errorf("conversation failed: %s", err) + } + + cmd.Println(convertedAddress) + + return nil + }, + } + + cmd.Flags().StringP(flagBech32Prefix, "p", "cosmos", "Bech32 Prefix to encode to") + + return cmd +} + +// addDebugCommands injects custom debug commands into another command as children. +func addDebugCommands(cmd *cobra.Command) *cobra.Command { + cmd.AddCommand(AddBech32ConvertCommand()) + return cmd +} diff --git a/cmd/milkywayd/cmd/root.go b/cmd/milkywayd/cmd/root.go new file mode 100644 index 000000000..595493b24 --- /dev/null +++ b/cmd/milkywayd/cmd/root.go @@ -0,0 +1,497 @@ +package cmd + +import ( + "context" + "errors" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/prometheus/client_golang/prometheus" + "github.com/spf13/cast" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "golang.org/x/sync/errgroup" + + tmcfg "github.com/cometbft/cometbft/config" + tmcli "github.com/cometbft/cometbft/libs/cli" + + dbm "github.com/cosmos/cosmos-db" + + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/snapshots" + snapshottypes "cosmossdk.io/store/snapshots/types" + storetypes "cosmossdk.io/store/types" + confixcmd "cosmossdk.io/tools/confix/cmd" + rosettaCmd "github.com/cosmos/rosetta/cmd" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" + "github.com/cosmos/cosmos-sdk/codec" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + cosmosgenutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + oracleconfig "github.com/skip-mev/connect/v2/oracle/config" + + genutilcli "github.com/milkyway-labs/milkyway/x/genutil/client/cli" + + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + milkyway "github.com/milkyway-labs/milkyway/app" +) + +// NewRootCmd creates a new root command for simd. It is called once in the +// main function. +func NewRootCmd() *cobra.Command { + // we "pre"-instantiate the application for getting the injected/configured encoding configuration + initAppOptions := viper.New() + tempDir := tempDir() + initAppOptions.Set(flags.FlagHome, tempDir) + tempApplication := milkyway.NewMilkyWayApp( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + map[int64]bool{}, + tempDir, + oracleconfig.NewDefaultAppConfig(), + initAppOptions, + milkyway.EmptyWasmOptions, + ) + defer func() { + if err := tempApplication.Close(); err != nil { + panic(err) + } + if tempDir != milkyway.DefaultNodeHome { + os.RemoveAll(tempDir) + } + }() + + initClientCtx := client.Context{}. + WithCodec(tempApplication.AppCodec()). + WithInterfaceRegistry(tempApplication.InterfaceRegistry()). + WithLegacyAmino(tempApplication.LegacyAmino()). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(milkyway.DefaultNodeHome). + WithViper("") + + rootCmd := &cobra.Command{ + Use: "milkywayd", + Short: "MilkyWay Chain App", + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + + initClientCtx = initClientCtx.WithCmdContext(cmd.Context()) + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) + if err != nil { + return err + } + + initClientCtx, err = config.ReadFromClientConfig(initClientCtx) + if err != nil { + return err + } + + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode + // is only available if the client is online. + if !initClientCtx.Offline { + txConfigOpts := tx.ConfigOptions{ + EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL), + TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx), + } + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + initClientCtx.Codec, + txConfigOpts, + ) + if err != nil { + return err + } + initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual) + } + + if err = client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + customCometConfig := initCometConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCometConfig) + }, + } + + initRootCmd(rootCmd, tempApplication.ModuleBasics, tempApplication.AppCodec(), tempApplication.InterfaceRegistry(), tempApplication.GetTxConfig()) + + autoCliOpts := enrichAutoCliOpts(tempApplication.AutoCliOpts(), initClientCtx) + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + + return rootCmd +} + +func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autocli.AppOptions { + autoCliOpts.AddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) + autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) + + autoCliOpts.ClientCtx = clientCtx + + return autoCliOpts +} + +// initCometConfig helps to override default CometBFT Config values. +// return tmcfg.DefaultConfig if no custom configuration is required for the application. +func initCometConfig() *tmcfg.Config { + cfg := tmcfg.DefaultConfig() + + // these values put a higher strain on node memory + // cfg.P2P.MaxNumInboundPeers = 100 + // cfg.P2P.MaxNumOutboundPeers = 40 + + return cfg +} + +func initAppConfig() (string, interface{}) { + // Embed additional configurations + type CustomAppConfig struct { + serverconfig.Config + + Wasm wasmtypes.WasmConfig `mapstructure:"wasm"` + Oracle oracleconfig.AppConfig `mapstructure:"oracle" json:"oracle"` + } + + // Can optionally overwrite the SDK's default server config. + srvCfg := serverconfig.DefaultConfig() + srvCfg.StateSync.SnapshotInterval = 1000 + srvCfg.StateSync.SnapshotKeepRecent = 10 + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + Wasm: wasmtypes.DefaultWasmConfig(), + Oracle: oracleconfig.NewDefaultAppConfig(), + } + + defaultAppTemplate := serverconfig.DefaultConfigTemplate + + wasmtypes.DefaultConfigTemplate() + + oracleconfig.DefaultConfigTemplate + + return defaultAppTemplate, customAppConfig +} + +func initRootCmd(rootCmd *cobra.Command, + basicManager module.BasicManager, + cdc codec.Codec, + interfaceRegistry codectypes.InterfaceRegistry, + txConfig client.TxConfig, +) { + cfg := sdk.GetConfig() + cfg.Seal() + + ac := appCreator{} + + rootCmd.AddCommand( + genutilcli.InitCmd(basicManager, milkyway.DefaultNodeHome), + tmcli.NewCompletionCmd(rootCmd, true), + NewTestnetCmd(basicManager, banktypes.GenesisBalancesIterator{}, ac), + addDebugCommands(debug.Cmd()), + confixcmd.ConfigCommand(), + pruning.Cmd(ac.newApp, milkyway.DefaultNodeHome), + snapshot.Cmd(ac.newApp), + ) + + server.AddCommandsWithStartCmdOptions( + rootCmd, + milkyway.DefaultNodeHome, + ac.newApp, + ac.appExport, + server.StartCmdOptions{ + AddFlags: addModuleInitFlags, + PostSetup: func(svrCtx *server.Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error { + g.Go(func() error { + errCh := make(chan error, 1) + go func() { + err := ac.app.StartOracleClient(ctx) + errCh <- err + }() + + select { + case err := <-errCh: + return err + case <-ctx.Done(): + return nil + } + }) + + return nil + }, + }, + ) + + // add keybase, auxiliary RPC, query, and tx child commands + rootCmd.AddCommand( + server.StatusCommand(), + genesisCommand(txConfig, basicManager), + queryCommand(), + txCommand(basicManager), + keys.Commands(), + ) + + // add rosetta + rootCmd.AddCommand(rosettaCmd.RosettaCommand(interfaceRegistry, cdc)) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) + wasm.AddModuleInitFlags(startCmd) +} + +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := cosmosgenutilcli.Commands(txConfig, basicManager, milkyway.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + rpc.ValidatorCommand(), + server.QueryBlocksCmd(), + server.QueryBlockCmd(), + server.QueryBlockResultsCmd(), + authcmd.QueryTxsByEventsCmd(), + authcmd.QueryTxCmd(), + ) + + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand(basicManager module.BasicManager) *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + ) + + // NOTE: this must be registered for now so that submit-legacy-proposal + // message (e.g. consumer-addition proposal) can be routed to the its handler and processed correctly. + basicManager.AddTxCommands(cmd) + + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +type appCreator struct { + app *milkyway.MilkyWayApp +} + +func (a *appCreator) newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + var cache storetypes.MultiStorePersistentCache + + if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { + cache = store.NewCommitKVStoreCacheManager() + } + + var wasmOpts []wasmkeeper.Option + if cast.ToBool(appOpts.Get("telemetry.enabled")) { + wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) + } + + pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) + if err != nil { + panic(err) + } + + skipUpgradeHeights := make(map[int64]bool) + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + + homeDir := cast.ToString(appOpts.Get(flags.FlagHome)) + chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) + if chainID == "" { + // fallback to genesis chain-id + genDocFile := filepath.Join(homeDir, cast.ToString(appOpts.Get("genesis_file"))) + appGenesis, err := genutiltypes.AppGenesisFromFile(genDocFile) + if err != nil { + panic(err) + } + + chainID = appGenesis.ChainID + } + + snapshotDir := filepath.Join(homeDir, "data", "snapshots") + snapshotDB, err := dbm.NewDB("metadata", server.GetAppDBBackend(appOpts), snapshotDir) + if err != nil { + panic(err) + } + snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) + if err != nil { + panic(err) + } + + // BaseApp Opts + snapshotOptions := snapshottypes.NewSnapshotOptions( + cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), + cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), + ) + baseappOptions := []func(*baseapp.BaseApp){ + baseapp.SetChainID(chainID), + baseapp.SetPruning(pruningOpts), + baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), + baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), + baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), + baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), + baseapp.SetInterBlockCache(cache), + baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), + baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), + baseapp.SetSnapshot(snapshotStore, snapshotOptions), + baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))), + } + + oracleConfig, err := oracleconfig.ReadConfigFromAppOpts(appOpts) + if err != nil { + logger.Error("failed to read oracle config", "error", err) + os.Exit(-1) + } + + a.app = milkyway.NewMilkyWayApp( + logger, + db, + traceStore, + true, + skipUpgradeHeights, + cast.ToString(appOpts.Get(flags.FlagHome)), + oracleConfig, + appOpts, + wasmOpts, + baseappOptions..., + ) + + return a.app +} + +func (a appCreator) appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var milkyWayApp *milkyway.MilkyWayApp + + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home is not set") + } + + // InvCheckPeriod + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + + var loadLatest bool + if height == -1 { + loadLatest = true + } + + var emptyWasmOpts []wasmkeeper.Option + milkyWayApp = milkyway.NewMilkyWayApp( + logger, + db, + traceStore, + loadLatest, + map[int64]bool{}, + homePath, + oracleconfig.NewDefaultAppConfig(), + appOpts, + emptyWasmOpts, + ) + + if height != -1 { + if err := milkyWayApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } + + return milkyWayApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} + +var tempDir = func() string { + dir, err := os.MkdirTemp("", ".milkyway") + if err != nil { + panic(fmt.Sprintf("failed creating temp directory: %s", err.Error())) + } + defer os.RemoveAll(dir) + + return dir +} diff --git a/cmd/milkywayd/cmd/testnet.go b/cmd/milkywayd/cmd/testnet.go new file mode 100644 index 000000000..ed31ce36e --- /dev/null +++ b/cmd/milkywayd/cmd/testnet.go @@ -0,0 +1,545 @@ +package cmd + +import ( + "bufio" + "encoding/json" + "fmt" + "net" + "os" + "path/filepath" + + "github.com/spf13/cobra" + "github.com/spf13/pflag" + + cmtconfig "github.com/cometbft/cometbft/config" + tmrand "github.com/cometbft/cometbft/libs/rand" + "github.com/cometbft/cometbft/types" + tmtime "github.com/cometbft/cometbft/types/time" + + "cosmossdk.io/math" + "cosmossdk.io/simapp" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/server" + srvconfig "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/testutil" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +var ( + flagNodeDirPrefix = "node-dir-prefix" + flagNumValidators = "v" + flagOutputDir = "output-dir" + flagNodeDaemonHome = "node-daemon-home" + flagStartingIPAddress = "starting-ip-address" + flagEnableLogging = "enable-logging" + flagGRPCAddress = "grpc.address" + flagRPCAddress = "rpc.address" + flagAPIAddress = "api.address" + flagPrintMnemonic = "print-mnemonic" + unsafeStartValidatorFn UnsafeStartValidatorCmdCreator +) + +type UnsafeStartValidatorCmdCreator func(ac appCreator) *cobra.Command + +type initArgs struct { + algo string + chainID string + keyringBackend string + minGasPrices string + nodeDaemonHome string + nodeDirPrefix string + numValidators int + outputDir string + startingIPAddress string +} + +type startArgs struct { + algo string + apiAddress string + chainID string + enableLogging bool + grpcAddress string + minGasPrices string + numValidators int + outputDir string + printMnemonic bool + rpcAddress string +} + +func addTestnetFlagsToCmd(cmd *cobra.Command) { + cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with") + cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet") + cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") + cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") + cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") + + // support old flags name for backwards compatibility + cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { + if name == "algo" { + name = flags.FlagKeyType + } + + return pflag.NormalizedName(name) + }) +} + +// NewTestnetCmd creates a root testnet command with subcommands to: +// 1. run an in-process testnet or +// 2. initialize validator configuration files for running a multi-validator testnet in a separate process or +// 3. update application and consensus state with the local validator info +func NewTestnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator, appCreator appCreator) *cobra.Command { + testnetCmd := &cobra.Command{ + Use: "testnet", + Short: "subcommands for starting or configuring local testnets", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + testnetCmd.AddCommand(testnetStartCmd()) + testnetCmd.AddCommand(testnetInitFilesCmd(mbm, genBalIterator)) + // if the binary is built with the unsafe_start_local_validator tag, unsafeStartValidatorFn will be set + // and the subcommand will be added + if unsafeStartValidatorFn != nil { + testnetCmd.AddCommand(unsafeStartValidatorFn(appCreator)) + } + + return testnetCmd +} + +// testnetInitFilesCmd returns a cmd to initialize all files for tendermint testnet and application +func testnetInitFilesCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { + cmd := &cobra.Command{ + Use: "init-files", + Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", + Long: `init-files will setup "v" number of directories and populate each with +necessary files (private validator, genesis, config, etc.) for running "v" validator nodes. + +Booting up a network with these validator folders is intended to be used with Docker Compose, +or a similar setup where each node has a manually configurable IP address. + +Note, strict routability for addresses is turned off in the config file. + +Example: + simd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 + `, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + args := initArgs{} + args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) + args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend) + args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) + args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) + args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix) + args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome) + args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress) + args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) + args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) + + return initTestnetFiles(clientCtx, cmd, config, mbm, genBalIterator, args) + }, + } + + addTestnetFlagsToCmd(cmd) + cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") + cmd.Flags().String(flagNodeDaemonHome, "simd", "Home directory of the node's daemon configuration") + cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") + cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") + + return cmd +} + +// testnetStartCmd returns a cmd to start multi validator in-process testnet +func testnetStartCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "start", + Short: "Launch an in-process multi-validator testnet", + Long: `testnet will launch an in-process multi-validator testnet, +and generate "v" directories, populated with necessary validator configuration files +(private validator, genesis, config, etc.). + +Example: + simd testnet --v 4 --output-dir ./.testnets + `, + RunE: func(cmd *cobra.Command, _ []string) error { + args := startArgs{} + args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) + args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) + args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) + args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) + args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) + args.enableLogging, _ = cmd.Flags().GetBool(flagEnableLogging) + args.rpcAddress, _ = cmd.Flags().GetString(flagRPCAddress) + args.apiAddress, _ = cmd.Flags().GetString(flagAPIAddress) + args.grpcAddress, _ = cmd.Flags().GetString(flagGRPCAddress) + args.printMnemonic, _ = cmd.Flags().GetBool(flagPrintMnemonic) + + return startTestnet(cmd, args) + }, + } + + addTestnetFlagsToCmd(cmd) + cmd.Flags().Bool(flagEnableLogging, false, "Enable INFO logging of tendermint validator nodes") + cmd.Flags().String(flagRPCAddress, "tcp://0.0.0.0:26657", "the RPC address to listen on") + cmd.Flags().String(flagAPIAddress, "tcp://0.0.0.0:1317", "the address to listen on for REST API") + cmd.Flags().String(flagGRPCAddress, "0.0.0.0:9090", "the gRPC server address to listen on") + cmd.Flags().Bool(flagPrintMnemonic, true, "print mnemonic of first validator to stdout for manual testing") + return cmd +} + +const nodeDirPerm = 0o755 + +// initTestnetFiles initializes testnet files for a testnet to be run in a separate process +func initTestnetFiles( + clientCtx client.Context, + cmd *cobra.Command, + nodeConfig *cmtconfig.Config, + mbm module.BasicManager, + genBalIterator banktypes.GenesisBalancesIterator, + args initArgs, +) error { + if args.chainID == "" { + args.chainID = "chain-" + tmrand.Str(6) + } + nodeIDs := make([]string, args.numValidators) + valPubKeys := make([]cryptotypes.PubKey, args.numValidators) + + simappConfig := srvconfig.DefaultConfig() + simappConfig.MinGasPrices = args.minGasPrices + simappConfig.API.Enable = true + simappConfig.Telemetry.Enabled = true + simappConfig.Telemetry.PrometheusRetentionTime = 60 + simappConfig.Telemetry.EnableHostnameLabel = false + simappConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}} + + var ( + genAccounts []authtypes.GenesisAccount + genBalances []banktypes.Balance + genFiles []string + ) + + inBuf := bufio.NewReader(cmd.InOrStdin()) + // generate private keys, node IDs, and initial transactions + for i := 0; i < args.numValidators; i++ { + nodeDirName := fmt.Sprintf("%s%d", args.nodeDirPrefix, i) + nodeDir := filepath.Join(args.outputDir, nodeDirName, args.nodeDaemonHome) + gentxsDir := filepath.Join(args.outputDir, "gentxs") + + nodeConfig.SetRoot(nodeDir) + nodeConfig.Moniker = nodeDirName + nodeConfig.RPC.ListenAddress = "tcp://0.0.0.0:26657" + + if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + ip, err := getIP(i, args.startingIPAddress) + if err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(nodeConfig) + if err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + memo := fmt.Sprintf("%s@%s:26656", nodeIDs[i], ip) + genFiles = append(genFiles, nodeConfig.GenesisFile()) + + kb, err := keyring.New(sdk.KeyringServiceName(), args.keyringBackend, nodeDir, inBuf, clientCtx.Codec) + if err != nil { + return err + } + + keyringAlgos, _ := kb.SupportedAlgorithms() + algo, err := keyring.NewSigningAlgoFromString(args.algo, keyringAlgos) + if err != nil { + return err + } + + addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) + if err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + info := map[string]string{"secret": secret} + + cliPrint, err := json.Marshal(info) + if err != nil { + return err + } + + // save private key seed words + if err := writeFile(fmt.Sprintf("%v.json", "key_seed"), nodeDir, cliPrint); err != nil { + return err + } + + accTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction) + accStakingTokens := sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction) + coins := sdk.Coins{ + sdk.NewCoin("testtoken", accTokens), + sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens), + } + + genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) + + valTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) + createValMsg, err := stakingtypes.NewMsgCreateValidator( + sdk.ValAddress(addr).String(), + valPubKeys[i], + sdk.NewCoin(sdk.DefaultBondDenom, valTokens), + stakingtypes.NewDescription(nodeDirName, "", "", "", ""), + stakingtypes.NewCommissionRates(math.LegacyOneDec(), math.LegacyOneDec(), math.LegacyOneDec()), + math.NewInt(1_000_000), + ) + if err != nil { + return err + } + + txBuilder := clientCtx.TxConfig.NewTxBuilder() + if err := txBuilder.SetMsgs(createValMsg); err != nil { + return err + } + + txBuilder.SetMemo(memo) + + txFactory := tx.Factory{} + txFactory = txFactory. + WithChainID(args.chainID). + WithMemo(memo). + WithKeybase(kb). + WithTxConfig(clientCtx.TxConfig) + + if err := tx.Sign(cmd.Context(), txFactory, nodeDirName, txBuilder, true); err != nil { + return err + } + + txBz, err := clientCtx.TxConfig.TxJSONEncoder()(txBuilder.GetTx()) + if err != nil { + return err + } + + if err := writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz); err != nil { + return err + } + + srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), simappConfig) + } + + if err := initGenFiles(clientCtx, mbm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil { + return err + } + + err := collectGenFiles( + clientCtx, nodeConfig, args.chainID, nodeIDs, valPubKeys, args.numValidators, + args.outputDir, args.nodeDirPrefix, args.nodeDaemonHome, genBalIterator, clientCtx.TxConfig.SigningContext().ValidatorAddressCodec(), + ) + if err != nil { + return err + } + + cmd.PrintErrf("Successfully initialized %d node directories\n", args.numValidators) + return nil +} + +func initGenFiles( + clientCtx client.Context, mbm module.BasicManager, chainID string, + genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, + genFiles []string, numValidators int, +) error { + appGenState := mbm.DefaultGenesis(clientCtx.Codec) + + // set the accounts in the genesis state + var authGenState authtypes.GenesisState + clientCtx.Codec.MustUnmarshalJSON(appGenState[authtypes.ModuleName], &authGenState) + + accounts, err := authtypes.PackAccounts(genAccounts) + if err != nil { + return err + } + + authGenState.Accounts = accounts + appGenState[authtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&authGenState) + + // set the balances in the genesis state + var bankGenState banktypes.GenesisState + clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState) + + bankGenState.Balances = banktypes.SanitizeGenesisBalances(genBalances) + for _, bal := range bankGenState.Balances { + bankGenState.Supply = bankGenState.Supply.Add(bal.Coins...) + } + appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState) + + appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ") + if err != nil { + return err + } + + genDoc := types.GenesisDoc{ + ChainID: chainID, + AppState: appGenStateJSON, + Validators: nil, + } + + // generate empty genesis files for each validator and save + for i := 0; i < numValidators; i++ { + if err := genDoc.SaveAs(genFiles[i]); err != nil { + return err + } + } + return nil +} + +func collectGenFiles( + clientCtx client.Context, nodeConfig *cmtconfig.Config, chainID string, + nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int, + outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator, valAddrCodec runtime.ValidatorAddressCodec, +) error { + var appState json.RawMessage + genTime := tmtime.Now() + + for i := 0; i < numValidators; i++ { + nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i) + nodeDir := filepath.Join(outputDir, nodeDirName, nodeDaemonHome) + gentxsDir := filepath.Join(outputDir, "gentxs") + nodeConfig.Moniker = nodeDirName + + nodeConfig.SetRoot(nodeDir) + + nodeID, valPubKey := nodeIDs[i], valPubKeys[i] + initCfg := genutiltypes.NewInitConfig(chainID, gentxsDir, nodeID, valPubKey) + + appGenesis, err := genutiltypes.AppGenesisFromFile(nodeConfig.GenesisFile()) + if err != nil { + return err + } + + nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, appGenesis, genBalIterator, genutiltypes.DefaultMessageValidator, + valAddrCodec) + if err != nil { + return err + } + + if appState == nil { + // set the canonical application state (they should not differ) + appState = nodeAppState + } + + genFile := nodeConfig.GenesisFile() + + // overwrite each validator's genesis file to have a canonical genesis time + if err := genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime); err != nil { + return err + } + } + + return nil +} + +func getIP(i int, startingIPAddr string) (ip string, err error) { + if len(startingIPAddr) == 0 { + ip, err = server.ExternalIP() + if err != nil { + return "", err + } + return ip, nil + } + return calculateIP(startingIPAddr, i) +} + +func calculateIP(ip string, i int) (string, error) { + ipv4 := net.ParseIP(ip).To4() + if ipv4 == nil { + return "", fmt.Errorf("%v: non ipv4 address", ip) + } + + for j := 0; j < i; j++ { + ipv4[3]++ + } + + return ipv4.String(), nil +} + +func writeFile(name string, dir string, contents []byte) error { + file := filepath.Join(dir, name) + + if err := os.MkdirAll(dir, 0o755); err != nil { + return fmt.Errorf("could not create directory %q: %w", dir, err) + } + + if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec + return err + } + + return nil +} + +// startTestnet starts an in-process testnet +func startTestnet(cmd *cobra.Command, args startArgs) error { + networkConfig := network.DefaultConfig(simapp.NewTestNetworkFixture) + + // Default networkConfig.ChainID is random, and we should only override it if chainID provided + // is non-empty + if args.chainID != "" { + networkConfig.ChainID = args.chainID + } + networkConfig.SigningAlgo = args.algo + networkConfig.MinGasPrices = args.minGasPrices + networkConfig.NumValidators = args.numValidators + networkConfig.EnableLogging = args.enableLogging + networkConfig.RPCAddress = args.rpcAddress + networkConfig.APIAddress = args.apiAddress + networkConfig.GRPCAddress = args.grpcAddress + networkConfig.PrintMnemonic = args.printMnemonic + networkLogger := network.NewCLILogger(cmd) + + baseDir := fmt.Sprintf("%s/%s", args.outputDir, networkConfig.ChainID) + if _, err := os.Stat(baseDir); !os.IsNotExist(err) { + return fmt.Errorf( + "testnests directory already exists for chain-id '%s': %s, please remove or select a new --chain-id", + networkConfig.ChainID, baseDir) + } + + testnet, err := network.New(networkLogger, baseDir, networkConfig) + if err != nil { + return err + } + + if _, err := testnet.WaitForHeight(1); err != nil { + return err + } + cmd.Println("press the Enter Key to terminate") + if _, err := fmt.Scanln(); err != nil { // wait for Enter Key + return err + } + testnet.Cleanup() + + return nil +} diff --git a/cmd/milkywayd/config.go b/cmd/milkywayd/config.go deleted file mode 100644 index 2677567ba..000000000 --- a/cmd/milkywayd/config.go +++ /dev/null @@ -1,105 +0,0 @@ -package main - -import ( - "fmt" - "time" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - tmcfg "github.com/cometbft/cometbft/config" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" - indexerconfig "github.com/initia-labs/kvindexer/config" - - "github.com/milkyway-labs/milkyway/types" -) - -// milkyWayAppConfig initia specify app config -type milkyWayAppConfig struct { - serverconfig.Config - WasmConfig wasmtypes.WasmConfig `mapstructure:"wasm"` - IndexerConfig indexerconfig.IndexerConfig `mapstructure:"indexer"` -} - -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = fmt.Sprintf("0%s", types.BaseDenom) - srvCfg.Mempool.MaxTxs = 2000 - srvCfg.QueryGasLimit = 3000000 - - // Enable API and unsafe CORS (CORS allowed from any host) - srvCfg.API.Enable = true - srvCfg.API.Swagger = true - srvCfg.API.EnableUnsafeCORS = true - srvCfg.API.Address = "tcp://0.0.0.0:1317" - - srvCfg.GRPC.Enable = true - srvCfg.GRPC.Address = "0.0.0.0:9090" - - milkywayAppConfig := milkyWayAppConfig{ - Config: *srvCfg, - WasmConfig: wasmtypes.DefaultWasmConfig(), - IndexerConfig: indexerconfig.DefaultConfig(), - } - - milkyWayAppTemplate := serverconfig.DefaultConfigTemplate + - wasmtypes.DefaultConfigTemplate() + indexerconfig.DefaultConfigTemplate - - return milkyWayAppTemplate, milkywayAppConfig -} - -// initTendermintConfig helps to override default Tendermint Config values. -// return tmcfg.DefaultConfig if no custom configuration is required for the application. -func initTendermintConfig() *tmcfg.Config { - cfg := tmcfg.DefaultConfig() - - // empty block configure - cfg.Consensus.CreateEmptyBlocks = false - cfg.Consensus.CreateEmptyBlocksInterval = time.Minute - - // rpc configure - cfg.RPC.ListenAddress = "tcp://0.0.0.0:26657" - cfg.RPC.CORSAllowedOrigins = []string{"*"} - - // performance turning configs - cfg.P2P.SendRate = 20480000 - cfg.P2P.RecvRate = 20480000 - cfg.P2P.MaxPacketMsgPayloadSize = 1000000 // 1MB - cfg.P2P.FlushThrottleTimeout = 10 * time.Millisecond - cfg.Consensus.PeerGossipSleepDuration = 30 * time.Millisecond - - // mempool configs - cfg.Mempool.Size = 1000 - cfg.Mempool.MaxTxsBytes = 10737418240 - cfg.Mempool.MaxTxBytes = 2048576 - - // propose timeout to 1s - cfg.Consensus.TimeoutPropose = 1 * time.Second - cfg.Consensus.TimeoutProposeDelta = 500 * time.Millisecond - - // do not wait straggler for prevote and precommit on l2 - cfg.Consensus.TimeoutPrevote = 0 * time.Millisecond - cfg.Consensus.TimeoutPrevoteDelta = 0 * time.Millisecond - cfg.Consensus.TimeoutPrecommit = 0 * time.Millisecond - cfg.Consensus.TimeoutPrecommitDelta = 0 * time.Millisecond - - // commit time to 0.5s - cfg.Consensus.TimeoutCommit = 500 * time.Millisecond - - return cfg -} diff --git a/cmd/milkywayd/launch.go b/cmd/milkywayd/launch.go deleted file mode 100644 index 5518cdbeb..000000000 --- a/cmd/milkywayd/launch.go +++ /dev/null @@ -1,131 +0,0 @@ -package main - -import ( - "encoding/json" - "os" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/initia-labs/OPinit/contrib/launchtools" - "github.com/initia-labs/OPinit/contrib/launchtools/steps" - "github.com/initia-labs/initia/app/params" - "github.com/pkg/errors" - "github.com/spf13/cobra" - - milkywayapp "github.com/milkyway-labs/milkyway/app" -) - -// DefaultLaunchStepFactories is a list of default launch step factories. -var DefaultLaunchStepFactories = []launchtools.LauncherStepFuncFactory[*launchtools.Config]{ - steps.InitializeConfig, - steps.InitializeRPCHelpers, - - // Initialize genesis - steps.InitializeGenesis, - - // Add system keys to the keyring - steps.InitializeKeyring, - - // Run the app - steps.RunApp, - - // MINIWASM: Store/Instantiate cw721 and ics721 contracts - StoreAndInstantiateNFTContracts, - - // Establish IBC channels for fungible and NFT transfer - // MINIWASM: Use wasm contract addresses for srcPort, dstPort, channelVersion - steps.EstablishIBCChannelsWithNFTTransfer(func() (string, string, string) { - return "wasm." + wasmkeeper.BuildContractAddressClassic(2, 1).String(), - "nft-transfer", - "ics721-1" - }), - - // Create OP Bridge, using open channel states - steps.InitializeOpBridge, - - // Set bridge info and update clients - steps.SetBridgeInfo, - - // Get the L1 and L2 heights - steps.GetL1Height, - steps.GetL2Height, - - // Cleanup - steps.StopApp, -} - -func LaunchCommand(ac *appCreator, enc params.EncodingConfig, mbm module.BasicManager) *cobra.Command { - return launchtools.LaunchCmd( - ac, - func(denom string) map[string]json.RawMessage { - return milkywayapp.NewDefaultGenesisState(enc.Codec, mbm, denom) - }, - DefaultLaunchStepFactories, - ) -} - -// StoreAndInstantiateNFTContracts stores and instantiates cw721 and ics721 contracts -func StoreAndInstantiateNFTContracts(input *launchtools.Config) launchtools.LauncherStepFunc { - return func(ctx launchtools.Launcher) error { - ctx.Logger().Info("Storing and instantiating cw721 and ics721 contracts") - - cw721, err := os.ReadFile("contrib/wasm/cw721_base.wasm") - if err != nil { - return errors.Wrapf(err, "failed to read cw721_base.wasm") - } - - ics721, err := os.ReadFile("contrib/wasm/ics721_base.wasm") - if err != nil { - return errors.Wrapf(err, "failed to read ics721_base.wasm") - } - - msgs := []sdk.Msg{ - &wasmtypes.MsgStoreCode{ - Sender: input.SystemKeys.Validator.L2Address, - WASMByteCode: cw721, - InstantiatePermission: nil, - }, - &wasmtypes.MsgStoreCode{ - Sender: input.SystemKeys.Validator.L2Address, - WASMByteCode: ics721, - InstantiatePermission: nil, - }, - &wasmtypes.MsgInstantiateContract{ - Sender: input.SystemKeys.Validator.L2Address, - Admin: input.SystemKeys.Validator.L2Address, - CodeID: 2, - Label: "ics721", - Msg: []byte(`{"cw721_base_code_id":1}`), - Funds: nil, - }, - } - - for i, msg := range msgs { - ctx.Logger().Info( - "Broadcasting tx to store and instantiate cw721 and ics721 contracts", - "step", i+1, - ) - - res, err := ctx.GetRPCHelperL2().BroadcastTxAndWait( - input.SystemKeys.Validator.L2Address, - input.SystemKeys.Validator.Mnemonic, - 10000000, - sdk.NewCoins(), - msg, - ) - - if err != nil { - return errors.Wrapf(err, "failed to store and instantiate nft contracts") - } - - ctx.Logger().Info( - "Successfully stored and instantiated cw721 and ics721 contracts", - "tx_hash", res.Hash, - ) - } - - return nil - } -} diff --git a/cmd/milkywayd/main.go b/cmd/milkywayd/main.go index d7aab99cd..3338d1f67 100644 --- a/cmd/milkywayd/main.go +++ b/cmd/milkywayd/main.go @@ -1,19 +1,18 @@ package main import ( - "fmt" "os" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" milkywayapp "github.com/milkyway-labs/milkyway/app" + "github.com/milkyway-labs/milkyway/cmd/milkywayd/cmd" ) func main() { - rootCmd, _ := NewRootCmd() + rootCmd := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, milkywayapp.EnvPrefix, milkywayapp.DefaultNodeHome); err != nil { - fmt.Fprintln(rootCmd.OutOrStderr(), err) os.Exit(1) } } diff --git a/cmd/milkywayd/rollback.go b/cmd/milkywayd/rollback.go deleted file mode 100644 index bb7cdc83b..000000000 --- a/cmd/milkywayd/rollback.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "fmt" - "path/filepath" - "strconv" - - cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" - "github.com/spf13/cobra" - - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/server/types" -) - -// NewMultipleRollbackCmd creates a command to rollback CometBFT and multistore state by one height. -func NewMultipleRollbackCmd(appCreator types.AppCreator) *cobra.Command { - removeBlock := false - cmd := &cobra.Command{ - Use: "mrollback [height]", - Short: "rollback Cosmos SDK and CometBFT state to the given height", - Long: ` -A state rollback is performed to recover from an incorrect application state transition, -when CometBFT has persisted an incorrect app hash and is thus unable to make -progress. Rollback overwrites a state with the state at the given height. All -blocks after the given height are removed from the blockchain. -`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - ctx := server.GetServerContextFromCmd(cmd) - - height, err := strconv.ParseInt(args[0], 10, 64) - if err != nil { - return err - } - if height <= 0 { - return fmt.Errorf("height must be greater than 0") - } - - dataDir := filepath.Join(ctx.Config.RootDir, "data") - db, err := dbm.NewDB("application", server.GetAppDBBackend(ctx.Viper), dataDir) - if err != nil { - return err - } - app := appCreator(ctx.Logger, db, nil, ctx.Viper) - if curHeight := app.CommitMultiStore().LatestVersion(); height >= curHeight { - return fmt.Errorf("height must be less than the current height %d", curHeight) - } - - // rollback CometBFT state - height, hash, err := cmtcmd.RollbackStateTo(ctx.Config, height, removeBlock) - if err != nil { - return fmt.Errorf("failed to rollback CometBFT state: %w", err) - } - // rollback the multistore - - if err := app.CommitMultiStore().RollbackToVersion(height); err != nil { - return fmt.Errorf("failed to rollback to version: %w", err) - } - - fmt.Printf("Rolled back state to height %d and hash %X\n", height, hash) - return nil - }, - } - cmd.Flags().BoolVar(&removeBlock, "hard", false, "remove blocks as well as state") - return cmd -} diff --git a/cmd/milkywayd/root.go b/cmd/milkywayd/root.go deleted file mode 100644 index f75fcd6b3..000000000 --- a/cmd/milkywayd/root.go +++ /dev/null @@ -1,386 +0,0 @@ -package main - -import ( - "errors" - "io" - "os" - "path" - "path/filepath" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/prometheus/client_golang/prometheus" - "github.com/spf13/cast" - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "cosmossdk.io/log" - confixcmd "cosmossdk.io/tools/confix/cmd" - - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/debug" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/pruning" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/client/snapshot" - "github.com/cosmos/cosmos-sdk/server" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - - wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - opchildcli "github.com/initia-labs/OPinit/x/opchild/client/cli" - "github.com/initia-labs/initia/app/params" - kvindexerconfig "github.com/initia-labs/kvindexer/config" - kvindexerstore "github.com/initia-labs/kvindexer/store" - kvindexerkeeper "github.com/initia-labs/kvindexer/x/kvindexer/keeper" - - milkywayapp "github.com/milkyway-labs/milkyway/app" -) - -// NewRootCmd creates a new root command for initiad. It is called once in the -// main function. -func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - sdkConfig := sdk.GetConfig() - sdkConfig.SetCoinType(milkywayapp.CoinType) - - accountPubKeyPrefix := milkywayapp.AccountAddressPrefix + "pub" - validatorAddressPrefix := milkywayapp.AccountAddressPrefix + "valoper" - validatorPubKeyPrefix := milkywayapp.AccountAddressPrefix + "valoperpub" - consNodeAddressPrefix := milkywayapp.AccountAddressPrefix + "valcons" - consNodePubKeyPrefix := milkywayapp.AccountAddressPrefix + "valconspub" - - sdkConfig.SetBech32PrefixForAccount(milkywayapp.AccountAddressPrefix, accountPubKeyPrefix) - sdkConfig.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) - sdkConfig.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) - sdkConfig.SetAddressVerifier(wasmtypes.VerifyAddressLen()) - - // seal moved to post setup - // sdkConfig.Seal() - - encodingConfig := milkywayapp.MakeEncodingConfig() - - // Get the executable name and configure the viper instance so that environmental - // variables are checked based off that name. The underscore character is used - // as a separator - executableName, err := os.Executable() - if err != nil { - panic(err) - } - - basename := path.Base(executableName) - - // Configure the viper instance - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(milkywayapp.DefaultNodeHome). - WithViper(milkywayapp.EnvPrefix) - - rootCmd := &cobra.Command{ - Use: basename, - Short: "milkyway App", - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // except for launch command, seal the config - if cmd.Name() != "launch" { - sdk.GetConfig().Seal() - } - - // set the default command outputs - cmd.SetOut(cmd.OutOrStdout()) - cmd.SetErr(cmd.ErrOrStderr()) - - // read envs before reading persistent flags - // TODO - should we handle this for tx flags & query flags? - initClientCtx, err := readEnv(initClientCtx) - if err != nil { - return err - } - - // read persistent flags if they changed, and override the env configs. - initClientCtx, err = client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) - if err != nil { - return err - } - - // unsafe-reset-all is not working without viper set - viper.Set(tmcli.HomeFlag, initClientCtx.HomeDir) - - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) - if err != nil { - return err - } - - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - initiaappTemplate, initiaappConfig := initAppConfig() - customTMConfig := initTendermintConfig() - - return server.InterceptConfigsPreRunHandler(cmd, initiaappTemplate, initiaappConfig, customTMConfig) - }, - } - - initRootCmd(rootCmd, encodingConfig) - - initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) - - // Add auto-generated CLI options - autoCliOpts, err := milkywayapp.AutoCLIOpts() - if err != nil { - panic(err) - } - autoCliOpts.ClientCtx = initClientCtx - - err = autoCliOpts.EnhanceRootCommand(rootCmd) - if err != nil { - panic(err) - } - - return rootCmd, encodingConfig -} - -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { - a := &appCreator{} - - rootCmd.AddCommand( - InitCmd(milkywayapp.ModuleBasics, milkywayapp.DefaultNodeHome), - debug.Cmd(), - confixcmd.ConfigCommand(), - pruning.Cmd(a.AppCreator(), milkywayapp.DefaultNodeHome), - snapshot.Cmd(a.AppCreator()), - ) - - server.AddCommands(rootCmd, milkywayapp.DefaultNodeHome, a.AppCreator(), a.appExport, addModuleInitFlags) - wasmcli.ExtendUnsafeResetAllCmd(rootCmd) - - // add keybase, auxiliary RPC, query, and tx child commands - rootCmd.AddCommand( - server.StatusCommand(), - genesisCommand(encodingConfig, milkywayapp.ModuleBasics), - queryCommand(), - txCommand(), - keys.Commands(), - ) - - // add launch commands - rootCmd.AddCommand(LaunchCommand(a, encodingConfig, milkywayapp.ModuleBasics)) - rootCmd.AddCommand(NewMultipleRollbackCmd(a.AppCreator())) -} - -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) -} - -func genesisCommand(encodingConfig params.EncodingConfig, basicManager module.BasicManager) *cobra.Command { - cmd := &cobra.Command{ - Use: "genesis", - Short: "Application's genesis-related subcommands", - DisableFlagParsing: false, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - ac := encodingConfig.TxConfig.SigningContext().AddressCodec() - - cmd.AddCommand( - genutilcli.AddGenesisAccountCmd(milkywayapp.DefaultNodeHome, ac), - opchildcli.AddGenesisValidatorCmd(basicManager, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, milkywayapp.DefaultNodeHome), - opchildcli.AddFeeWhitelistCmd(milkywayapp.DefaultNodeHome, ac), - genutilcli.ValidateGenesisCmd(basicManager), - genutilcli.GenTxCmd(basicManager, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, milkywayapp.DefaultNodeHome, ac), - ) - - return cmd -} - -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - rpc.QueryEventForTxCmd(), - server.QueryBlockCmd(), - authcmd.QueryTxsByEventsCmd(), - server.QueryBlocksCmd(), - authcmd.QueryTxCmd(), - server.QueryBlockResultsCmd(), - ) - - return cmd -} - -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetMultiSignBatchCmd(), - authcmd.GetValidateSignaturesCommand(), - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - authcmd.GetSimulateCmd(), - ) - - return cmd -} - -type appCreator struct { - app servertypes.Application -} - -// newApp is an AppCreator -func (a *appCreator) AppCreator() servertypes.AppCreator { - return func(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { - baseappOptions := server.DefaultBaseappOptions(appOpts) - - var wasmOpts []wasmkeeper.Option - if cast.ToBool(appOpts.Get("telemetry.enabled")) { - wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) - } - - dbDir, kvdbConfig := getDBConfig(appOpts) - kvindexerDB, err := kvindexerstore.OpenDB(dbDir, kvindexerkeeper.StoreName, kvdbConfig.BackendConfig) - if err != nil { - panic(err) - } - - app := milkywayapp.NewMilkyWayApp( - logger, db, kvindexerDB, traceStore, true, - wasmOpts, - appOpts, - baseappOptions..., - ) - - a.app = app - return app - } -} - -func (a *appCreator) App() servertypes.Application { - return a.app -} - -func (a appCreator) appExport( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home not set") - } - - var initiaApp *milkywayapp.MilkyWayApp - if height != -1 { - initiaApp = milkywayapp.NewMilkyWayApp(logger, db, dbm.NewMemDB(), traceStore, false, []wasmkeeper.Option{}, appOpts) - - if err := initiaApp.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } - } else { - initiaApp = milkywayapp.NewMilkyWayApp(logger, db, dbm.NewMemDB(), traceStore, true, []wasmkeeper.Option{}, appOpts) - } - - return initiaApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) -} - -func readEnv(clientCtx client.Context) (client.Context, error) { - if outputFormat := clientCtx.Viper.GetString(tmcli.OutputFlag); outputFormat != "" { - clientCtx = clientCtx.WithOutputFormat(outputFormat) - } - - if homeDir := clientCtx.Viper.GetString(flags.FlagHome); homeDir != "" { - clientCtx = clientCtx.WithHomeDir(homeDir) - } - - if clientCtx.Viper.GetBool(flags.FlagDryRun) { - clientCtx = clientCtx.WithSimulation(true) - } - - if keyringDir := clientCtx.Viper.GetString(flags.FlagKeyringDir); keyringDir != "" { - clientCtx = clientCtx.WithKeyringDir(clientCtx.Viper.GetString(flags.FlagKeyringDir)) - } - - if chainID := clientCtx.Viper.GetString(flags.FlagChainID); chainID != "" { - clientCtx = clientCtx.WithChainID(chainID) - } - - if keyringBackend := clientCtx.Viper.GetString(flags.FlagKeyringBackend); keyringBackend != "" { - kr, err := client.NewKeyringFromBackend(clientCtx, keyringBackend) - if err != nil { - return clientCtx, err - } - - clientCtx = clientCtx.WithKeyring(kr) - } - - if nodeURI := clientCtx.Viper.GetString(flags.FlagNode); nodeURI != "" { - clientCtx = clientCtx.WithNodeURI(nodeURI) - - client, err := client.NewClientFromNode(nodeURI) - if err != nil { - return clientCtx, err - } - - clientCtx = clientCtx.WithClient(client) - } - - return clientCtx, nil -} - -// getDBConfig returns the database configuration for the EVM indexer -func getDBConfig(appOpts servertypes.AppOptions) (string, *kvindexerconfig.IndexerConfig) { - rootDir := cast.ToString(appOpts.Get("home")) - dbDir := cast.ToString(appOpts.Get("db_dir")) - dbBackend, err := kvindexerconfig.NewConfig(appOpts) - if err != nil { - panic(err) - } - - return rootify(dbDir, rootDir), dbBackend -} - -// helper function to make config creation independent of root dir -func rootify(path, root string) string { - if filepath.IsAbs(path) { - return path - } - return filepath.Join(root, path) -} diff --git a/go.mod b/go.mod index f9eb12f8b..a476e227d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/milkyway-labs/milkyway -go 1.22.5 +go 1.22.7 + +toolchain go1.22.8 require ( cosmossdk.io/api v0.7.6 @@ -8,59 +10,59 @@ require ( cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.11.1 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.5.0 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 + cosmossdk.io/simapp v0.0.0-20231211060251-d8fb76d4c267 cosmossdk.io/store v1.1.1 cosmossdk.io/tools/confix v0.1.2 + cosmossdk.io/x/evidence v0.1.1 cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.13.5 cosmossdk.io/x/upgrade v0.1.4 - // we also need to update `LIBWASMVM_VERSION` of images/private/Dockerfile#5 - github.com/CosmWasm/wasmd v0.52.0 + github.com/CosmWasm/wasmd v0.53.0 github.com/CosmWasm/wasmvm/v2 v2.1.3 - github.com/Stride-Labs/ibc-rate-limiting v0.0.0-00010101000000-000000000000 github.com/aptos-labs/serde-reflection/serde-generate/runtime/golang v0.0.0-20231213012317-73b6bbf74833 github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.10 - github.com/cosmos/go-bip39 v1.0.0 + github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 + github.com/cosmos/ibc-apps/modules/rate-limiting/v8 v8.0.0 github.com/cosmos/ibc-go/modules/capability v1.0.1 - github.com/cosmos/ibc-go/v8 v8.5.0 + github.com/cosmos/ibc-go/v8 v8.5.1 github.com/cosmos/ics23/go v0.11.0 - github.com/golang/mock v1.6.0 + github.com/cosmos/interchain-security/v6 v6.3.0 + github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 github.com/golangci/golangci-lint v1.61.0 + github.com/google/gofuzz v1.2.0 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/initia-labs/kvindexer v0.1.8 - github.com/initia-labs/kvindexer/submodules/block v0.1.0 - github.com/initia-labs/kvindexer/submodules/tx v0.1.0 - github.com/initia-labs/kvindexer/submodules/wasm-nft v0.1.5 - github.com/initia-labs/kvindexer/submodules/wasm-pair v0.1.0 - github.com/noble-assets/forwarding/v2 v2.0.0-20240521090705-86712c4c9e43 - github.com/pkg/errors v0.9.1 + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.20.5 github.com/rakyll/statik v0.1.7 - github.com/skip-mev/block-sdk/v2 v2.1.2 github.com/skip-mev/connect/v2 v2.0.1 + github.com/skip-mev/feemarket v1.1.1 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 + github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 go.uber.org/mock v0.4.0 - golang.org/x/crypto v0.29.0 + golang.org/x/crypto v0.28.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 - google.golang.org/grpc v1.67.0 + google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v2 v2.4.0 ) +require github.com/cosmos/rosetta v0.50.10 + require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect @@ -71,7 +73,8 @@ require ( cloud.google.com/go/iam v1.2.0 // indirect cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/depinject v1.0.0 // indirect - cosmossdk.io/x/evidence v0.1.1 // indirect + cosmossdk.io/x/circuit v0.1.1 // indirect + cosmossdk.io/x/nft v0.1.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/4meepo/tagalign v1.3.4 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -88,16 +91,14 @@ require ( github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.3.0 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect - github.com/StackExchange/wmi v1.2.1 // indirect - github.com/VictoriaMetrics/fastcache v1.12.2 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/alecthomas/go-check-sumtype v0.1.4 // indirect github.com/alexkohler/nakedret/v2 v2.0.4 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/allegro/bigcache/v3 v3.1.0 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect - github.com/avast/retry-go/v4 v4.5.1 // indirect github.com/aws/aws-sdk-go v1.44.312 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -108,25 +109,16 @@ require ( github.com/bombsimon/wsl/v4 v4.4.1 // indirect github.com/breml/bidichk v0.2.7 // indirect github.com/breml/errchkjson v0.3.6 // indirect - github.com/btcsuite/btcd v0.24.2 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect - github.com/btcsuite/btcd/btcutil v1.1.6 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/butuzov/ireturn v0.3.0 // indirect github.com/butuzov/mirror v1.2.0 // indirect - github.com/bytedance/sonic v1.12.3 // indirect - github.com/bytedance/sonic/loader v0.2.0 // indirect github.com/catenacyber/perfsprint v0.7.1 // indirect github.com/ccojocar/zxcvbn-go v1.0.2 // indirect - github.com/celestiaorg/go-square/v2 v2.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.1.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/ckaznocha/intrange v0.2.0 // indirect - github.com/cloudwego/base64x v0.1.4 // indirect - github.com/cloudwego/iasm v0.2.0 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect @@ -134,35 +126,30 @@ require ( github.com/cockroachdb/pebble v1.1.2 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft-db v0.12.0 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect + github.com/cometbft/cometbft-db v0.14.1 // indirect + github.com/containerd/continuity v0.4.3 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/interchain-security/v6 v6.0.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/cosmos/relayer/v2 v2.5.2 // indirect - github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect - github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect - github.com/creachadair/atomicfile v0.3.1 // indirect - github.com/creachadair/tomledit v0.0.24 // indirect + github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/creachadair/atomicfile v0.3.3 // indirect + github.com/creachadair/tomledit v0.0.26 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.13.5 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/denis-tingaikin/go-header v0.5.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/distribution/reference v0.5.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.1 // indirect - github.com/ethereum/c-kzg-4844 v1.0.0 // indirect - github.com/ethereum/go-ethereum v1.14.9 // indirect - github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect + github.com/dvsekhvalnov/jose2go v1.7.0 // indirect + github.com/emicklei/dot v1.6.2 // indirect github.com/ettle/strcase v0.2.0 // indirect github.com/fatih/color v1.17.0 // indirect github.com/fatih/structtag v1.2.0 // indirect @@ -178,7 +165,6 @@ 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-ole/go-ole v1.3.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 @@ -189,10 +175,11 @@ 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/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 github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect @@ -203,12 +190,9 @@ require ( github.com/golangci/plugin-module-register v0.1.1 // indirect github.com/golangci/revgrep v0.5.3 // indirect github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect - github.com/google/btree v1.1.2 // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/go-github/v43 v43.0.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect @@ -221,6 +205,7 @@ require ( github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect github.com/gostaticanalysis/nilerr v0.1.1 // indirect + github.com/goware/urlx v0.3.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -236,27 +221,22 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.3.1 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/initia-labs/OPinit/api v0.5.1 // indirect github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jjti/go-spancheck v0.6.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/jsternberg/zap-logfmt v1.3.0 // indirect github.com/julz/importas v0.1.0 // indirect github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect github.com/kisielk/errcheck v1.7.0 // indirect github.com/kkHAIKE/contextcheck v1.1.5 // indirect github.com/klauspost/compress v1.17.9 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect @@ -279,11 +259,10 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mgechev/revive v1.3.9 // indirect - github.com/minio/highwayhash v1.0.2 // indirect + github.com/minio/highwayhash v1.0.3 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -295,12 +274,14 @@ require ( github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect + github.com/opencontainers/runc v1.1.14 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polyfloyd/go-errorlint v1.6.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 // indirect github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect @@ -318,13 +299,12 @@ require ( github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect github.com/securego/gosec/v2 v2.21.2 // indirect github.com/shamaton/msgpack/v2 v2.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/tenv v1.10.0 // indirect @@ -332,13 +312,10 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect - github.com/strangelove-ventures/cometbft-client v0.1.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/supranational/blst v0.3.11 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -346,12 +323,8 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect - github.com/tklauser/go-sysconf v0.3.12 // indirect - github.com/tklauser/numcpus v0.6.1 // indirect github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect - github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect @@ -375,16 +348,15 @@ require ( go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/term v0.26.0 // indirect - golang.org/x/text v0.20.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.25.0 // indirect google.golang.org/api v0.196.0 // indirect @@ -398,42 +370,37 @@ require ( mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v1.1.0 // indirect - rsc.io/tmplfunc v0.0.3 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) replace ( - // Use cosmos fork of keyring - github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + // TODO(https://github.com/cosmos/rosetta/issues/76): Rosetta requires cosmossdk.io/core v0.12.0 erroneously but + // should use v0.11.0. The Cosmos build fails with types/context.go:65:29: undefined: comet.BlockInfo otherwise. + cosmossdk.io/core => cosmossdk.io/core v0.11.0 - // Use latest iavl version to fix following issue: - // https://github.com/cosmos/iavl/pull/943 - github.com/cosmos/iavl => github.com/cosmos/iavl v1.1.4 + // Needs to be replaced due to iavlFastNodeModuleWhitelist feature + // Disabling fast nodes makes nodes sync faster. + // All nodes need to have the lockup fast nodes enabled though or else we process epoch slowly. + // Also, snapshot nodes need to have all fast nodes enabled in order to prune quickly. + cosmossdk.io/store => github.com/osmosis-labs/cosmos-sdk/store v0.1.0-alpha.1.0.20240509221435-b8feb2ffb728 - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + // Direct cometbft branch link: https://github.com/osmosis-labs/cometbft/tree/osmo-v27/0.38.15, current branch: osmo-v27/v0.38.15 + // Direct commit link: https://github.com/osmosis-labs/cometbft/commit/08ef650391304dae90486e906b59ded36cd16e49 + // Direct tag link: https://github.com/osmosis-labs/cometbft/releases/tag/v0.38.15-v27-osmo-1 + github.com/cometbft/cometbft => github.com/osmosis-labs/cometbft v0.38.15-v27-osmo-1 - // Downgraded to avoid bugs in following commits which caused simulations to fail. + // replace as directed by sdk upgrading.md https://github.com/cosmos/cosmos-sdk/blob/393de266c8675dc16cc037c1a15011b1e990975f/UPGRADING.md?plain=1#L713 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) -// Initia custom -replace ( - github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261 - github.com/cosmos/cosmos-sdk => github.com/initia-labs/cosmos-sdk v0.0.0-20240627065534-d2180fcfd501 - github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d - - // use custom version until this PR is merged - // - https://github.com/strangelove-ventures/cometbft-client/pull/10 - github.com/strangelove-ventures/cometbft-client => github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e - // cosmos/relayer seems having problem with the latest version of grpc; return nil in the below line - // - https://github.com/cosmos/relayer/blob/4e4e9530800d28fb2c984f1cfc7b03f05eec618c/relayer/chains/cosmos/grpc_query.go#L30 - google.golang.org/grpc => google.golang.org/grpc v1.65.0 -) - // MilkyWay custom -replace ( - github.com/Stride-Labs/ibc-rate-limiting => github.com/milkyway-labs/ibc-rate-limiting v0.0.0-20240529144041-70ebeac5863b - github.com/cosmos/relayer/v2 => github.com/milkyway-labs/relayer/v2 v2.0.0-20241011165100-8ff2d878e8fc +replace github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.50.10-v27-osmo-1 + +// Exclusions for non-used dependencies +exclude ( + github.com/coinbase/rosetta-sdk-go v0.7.9 + github.com/gogo/protobuf v1.3.3 ) -retract v1.0.0-rc5 // Have two different versions with the same tag +// We have two different versions with the same tag +retract v1.0.0-rc5 diff --git a/go.sum b/go.sum index 3aa5eab50..ddb564833 100644 --- a/go.sum +++ b/go.sum @@ -2,12 +2,11 @@ 4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= 4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= 4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= -cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -20,7 +19,6 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -32,119 +30,32 @@ cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+Y cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= -cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= -cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= -cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= -cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= -cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= -cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= -cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= -cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE= -cloud.google.com/go/accesscontextmanager v1.6.0/go.mod h1:8XCvZWfYw3K/ji0iVnp+6pu7huxoQTLmxAbVjbloTtM= -cloud.google.com/go/accesscontextmanager v1.7.0/go.mod h1:CEGLewx8dwa33aDAZQujl7Dx+uYhS0eay198wB/VumQ= -cloud.google.com/go/accesscontextmanager v1.8.0/go.mod h1:uI+AI/r1oyWK99NN8cQ3UK76AMelMzgZCvJfsi2c+ps= -cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= -cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9jQmorivIiWcKg= -cloud.google.com/go/aiplatform v1.35.0/go.mod h1:7MFT/vCaOyZT/4IIFfxH4ErVg/4ku6lKv3w0+tFTgXQ= -cloud.google.com/go/aiplatform v1.36.1/go.mod h1:WTm12vJRPARNvJ+v6P52RDHCNe4AhvjcIZ/9/RRHy/k= -cloud.google.com/go/aiplatform v1.37.0/go.mod h1:IU2Cv29Lv9oCn/9LkFiiuKfwrRTq+QQMbW+hPCxJGZw= -cloud.google.com/go/aiplatform v1.45.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= -cloud.google.com/go/aiplatform v1.48.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= -cloud.google.com/go/analytics v0.17.0/go.mod h1:WXFa3WSym4IZ+JiKmavYdJwGG/CvpqiqczmL59bTD9M= -cloud.google.com/go/analytics v0.18.0/go.mod h1:ZkeHGQlcIPkw0R/GW+boWHhCOR43xz9RN/jn7WcqfIE= -cloud.google.com/go/analytics v0.19.0/go.mod h1:k8liqf5/HCnOUkbawNtrWWc+UAzyDlW89doe8TtoDsE= -cloud.google.com/go/analytics v0.21.2/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/analytics v0.21.3/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= -cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc= -cloud.google.com/go/apigateway v1.5.0/go.mod h1:GpnZR3Q4rR7LVu5951qfXPJCHquZt02jf7xQx7kpqN8= -cloud.google.com/go/apigateway v1.6.1/go.mod h1:ufAS3wpbRjqfZrzpvLC2oh0MFlpRJm2E/ts25yyqmXA= -cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= -cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04= -cloud.google.com/go/apigeeconnect v1.5.0/go.mod h1:KFaCqvBRU6idyhSNyn3vlHXc8VMDJdRmwDF6JyFRqZ8= -cloud.google.com/go/apigeeconnect v1.6.1/go.mod h1:C4awq7x0JpLtrlQCr8AzVIzAaYgngRqWf9S5Uhg+wWs= -cloud.google.com/go/apigeeregistry v0.4.0/go.mod h1:EUG4PGcsZvxOXAdyEghIdXwAEi/4MEaoqLMLDMIwKXY= -cloud.google.com/go/apigeeregistry v0.5.0/go.mod h1:YR5+s0BVNZfVOUkMa5pAR2xGd0A473vA5M7j247o1wM= -cloud.google.com/go/apigeeregistry v0.6.0/go.mod h1:BFNzW7yQVLZ3yj0TKcwzb8n25CFBri51GVGOEUcgQsc= -cloud.google.com/go/apigeeregistry v0.7.1/go.mod h1:1XgyjZye4Mqtw7T9TsY4NW10U7BojBvG4RMD+vRDrIw= -cloud.google.com/go/apikeys v0.4.0/go.mod h1:XATS/yqZbaBK0HOssf+ALHp8jAlNHUgyfprvNcBIszU= -cloud.google.com/go/apikeys v0.5.0/go.mod h1:5aQfwY4D+ewMMWScd3hm2en3hCj+BROlyrt3ytS7KLI= -cloud.google.com/go/apikeys v0.6.0/go.mod h1:kbpXu5upyiAlGkKrJgQl8A0rKNNJ7dQ377pdroRSSi8= -cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno= -cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodCWatWI9Dmak= -cloud.google.com/go/appengine v1.6.0/go.mod h1:hg6i0J/BD2cKmDJbaFSYHFyZkgBEfQrDg/X0V5fJn84= -cloud.google.com/go/appengine v1.7.0/go.mod h1:eZqpbHFCqRGa2aCdope7eC0SWLV1j0neb/QnMJVWx6A= -cloud.google.com/go/appengine v1.7.1/go.mod h1:IHLToyb/3fKutRysUlFO0BPt5j7RiQ45nrzEJmKTo6E= -cloud.google.com/go/appengine v1.8.1/go.mod h1:6NJXGLVhZCN9aQ/AEDvmfzKEfoYBlfB80/BHiKVputY= cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= -cloud.google.com/go/area120 v0.7.0/go.mod h1:a3+8EUD1SX5RUcCs3MY5YasiO1z6yLiNLRiFrykbynY= -cloud.google.com/go/area120 v0.7.1/go.mod h1:j84i4E1RboTWjKtZVWXPqvK5VHQFJRF2c1Nm69pWm9k= -cloud.google.com/go/area120 v0.8.1/go.mod h1:BVfZpGpB7KFVNxPiQBuHkX6Ed0rS51xIgmGyjrAfzsg= cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= -cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= -cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3OXy26h3XW+3/Jh2uYc= -cloud.google.com/go/artifactregistry v1.11.1/go.mod h1:lLYghw+Itq9SONbCa1YWBoWs1nOucMH0pwXN1rOBZFI= -cloud.google.com/go/artifactregistry v1.11.2/go.mod h1:nLZns771ZGAwVLzTX/7Al6R9ehma4WUEhZGWV6CeQNQ= -cloud.google.com/go/artifactregistry v1.12.0/go.mod h1:o6P3MIvtzTOnmvGagO9v/rOjjA0HmhJ+/6KAXrmYDCI= -cloud.google.com/go/artifactregistry v1.13.0/go.mod h1:uy/LNfoOIivepGhooAUpL1i30Hgee3Cu0l4VTWHUC08= -cloud.google.com/go/artifactregistry v1.14.1/go.mod h1:nxVdG19jTaSTu7yA7+VbWL346r3rIdkZ142BSQqhn5E= cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= -cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= -cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAtZiIb0wY= -cloud.google.com/go/asset v1.11.1/go.mod h1:fSwLhbRvC9p9CXQHJ3BgFeQNM4c9x10lqlrdEUYXlJo= -cloud.google.com/go/asset v1.12.0/go.mod h1:h9/sFOa4eDIyKmH6QMpm4eUK3pDojWnUhTgJlk762Hg= -cloud.google.com/go/asset v1.13.0/go.mod h1:WQAMyYek/b7NBpYq/K4KJWcRqzoalEsxz/t/dTk4THw= -cloud.google.com/go/asset v1.14.1/go.mod h1:4bEJ3dnHCqWCDbWJ/6Vn7GVI9LerSi7Rfdi03hd+WTQ= cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= -cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= -cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= -cloud.google.com/go/assuredworkloads v1.11.1/go.mod h1:+F04I52Pgn5nmPG36CWFtxmav6+7Q+c5QyJoL18Lry0= cloud.google.com/go/auth v0.9.3 h1:VOEUIAADkkLtyfr3BLa3R8Ed/j6w1jTBmARx+wb5w5U= cloud.google.com/go/auth v0.9.3/go.mod h1:7z6VY+7h3KUdRov5F1i8NDP5ZzWKYmEPO842BgCsmTk= cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= -cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= -cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM= -cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfGLN6B0NuU= -cloud.google.com/go/automl v1.13.1/go.mod h1:1aowgAHWYZU27MybSCFiukPO7xnyawv7pt3zK4bheQE= -cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= -cloud.google.com/go/baremetalsolution v0.4.0/go.mod h1:BymplhAadOO/eBa7KewQ0Ppg4A4Wplbn+PsFKRLo0uI= -cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= -cloud.google.com/go/baremetalsolution v1.1.1/go.mod h1:D1AV6xwOksJMV4OSlWHtWuFNZZYujJknMAP4Qa27QIA= -cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE= -cloud.google.com/go/batch v0.4.0/go.mod h1:WZkHnP43R/QCGQsZ+0JyG4i79ranE2u8xvjq/9+STPE= -cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= -cloud.google.com/go/batch v1.3.1/go.mod h1:VguXeQKXIYaeeIYbuozUmBR13AfL4SJP7IltNPS+A4A= -cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4= -cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941Jz2vmksAxW8= -cloud.google.com/go/beyondcorp v0.4.0/go.mod h1:3ApA0mbhHx6YImmuubf5pyW8srKnCEPON32/5hj+RmM= -cloud.google.com/go/beyondcorp v0.5.0/go.mod h1:uFqj9X+dSfrheVp7ssLTaRHd2EHqSL4QZmH4e8WXGGU= -cloud.google.com/go/beyondcorp v0.6.1/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= -cloud.google.com/go/beyondcorp v1.0.0/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -152,55 +63,12 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw= -cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= -cloud.google.com/go/bigquery v1.47.0/go.mod h1:sA9XOgy0A8vQK9+MWhEQTY6Tix87M/ZurWFIxmF9I/E= -cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac= -cloud.google.com/go/bigquery v1.49.0/go.mod h1:Sv8hMmTFFYBlt/ftw2uN6dFdQPzBlREY9yBh7Oy7/4Q= -cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= -cloud.google.com/go/bigquery v1.52.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= -cloud.google.com/go/bigquery v1.53.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= -cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= -cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOArInEiD5Y= -cloud.google.com/go/billing v1.12.0/go.mod h1:yKrZio/eu+okO/2McZEbch17O5CB5NpZhhXG6Z766ss= -cloud.google.com/go/billing v1.13.0/go.mod h1:7kB2W9Xf98hP9Sr12KfECgfGclsH3CQR0R08tnRlRbc= -cloud.google.com/go/billing v1.16.0/go.mod h1:y8vx09JSSJG02k5QxbycNRrN7FGZB6F3CAcgum7jvGA= cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= -cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= -cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk= -cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= -cloud.google.com/go/binaryauthorization v1.6.1/go.mod h1:TKt4pa8xhowwffiBmbrbcxijJRZED4zrqnwZ1lKH51U= -cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= -cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590= -cloud.google.com/go/certificatemanager v1.6.0/go.mod h1:3Hh64rCKjRAX8dXgRAyOcY5vQ/fE1sh8o+Mdd6KPgY8= -cloud.google.com/go/certificatemanager v1.7.1/go.mod h1:iW8J3nG6SaRYImIa+wXQ0g8IgoofDFRp5UMzaNk1UqI= -cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= -cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL8yBMbKUk= -cloud.google.com/go/channel v1.11.0/go.mod h1:IdtI0uWGqhEeatSB62VOoJ8FSUhJ9/+iGkJVqp74CGE= -cloud.google.com/go/channel v1.12.0/go.mod h1:VkxCGKASi4Cq7TbXxlaBezonAYpp1GCnKMY6tnMQnLU= -cloud.google.com/go/channel v1.16.0/go.mod h1:eN/q1PFSl5gyu0dYdmxNXscY/4Fi7ABmeHCJNf/oHmc= -cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= -cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr7b53sySrTqA= -cloud.google.com/go/cloudbuild v1.6.0/go.mod h1:UIbc/w9QCbH12xX+ezUsgblrWv+Cv4Tw83GiSMHOn9M= -cloud.google.com/go/cloudbuild v1.7.0/go.mod h1:zb5tWh2XI6lR9zQmsm1VRA+7OCuve5d8S+zJUul8KTg= -cloud.google.com/go/cloudbuild v1.9.0/go.mod h1:qK1d7s4QlO0VwfYn5YuClDGg2hfmLZEb4wQGAbIgL1s= -cloud.google.com/go/cloudbuild v1.10.1/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.13.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= -cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk= -cloud.google.com/go/clouddms v1.5.0/go.mod h1:QSxQnhikCLUw13iAbffF2CZxAER3xDGNHjsTAkQJcQA= -cloud.google.com/go/clouddms v1.6.1/go.mod h1:Ygo1vL52Ov4TBZQquhz5fiw2CQ58gvu+PlS6PVXCpZI= cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= -cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= -cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI= -cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6uL9Nst1cI7Y= -cloud.google.com/go/cloudtasks v1.10.0/go.mod h1:NDSoTLkZ3+vExFEWu2UJV1arUyzVDAiZtdWcsUyNwBs= -cloud.google.com/go/cloudtasks v1.11.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= -cloud.google.com/go/cloudtasks v1.12.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= @@ -208,585 +76,140 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.12.0/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= -cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= -cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= -cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= -cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= -cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= -cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= -cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= -cloud.google.com/go/contactcenterinsights v1.9.1/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/contactcenterinsights v1.10.0/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= -cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3amoYfxVkLo= -cloud.google.com/go/container v1.13.1/go.mod h1:6wgbMPeQRw9rSnKBCAJXnds3Pzj03C4JHamr8asWKy4= -cloud.google.com/go/container v1.14.0/go.mod h1:3AoJMPhHfLDxLvrlVWaK57IXzaPnLaZq63WX59aQBfM= -cloud.google.com/go/container v1.15.0/go.mod h1:ft+9S0WGjAyjDggg5S06DXj+fHJICWg8L7isCQe9pQA= -cloud.google.com/go/container v1.22.1/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= -cloud.google.com/go/container v1.24.0/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= -cloud.google.com/go/containeranalysis v0.7.0/go.mod h1:9aUL+/vZ55P2CXfuZjS4UjQ9AgXoSw8Ts6lemfmxBxI= -cloud.google.com/go/containeranalysis v0.9.0/go.mod h1:orbOANbwk5Ejoom+s+DUCTTJ7IBdBQJDcSylAx/on9s= -cloud.google.com/go/containeranalysis v0.10.1/go.mod h1:Ya2jiILITMY68ZLPaogjmOMNkwsDrWBSTyBubGXO7j0= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= -cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= -cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOXxZoKYF5wdISM= -cloud.google.com/go/datacatalog v1.8.1/go.mod h1:RJ58z4rMp3gvETA465Vg+ag8BGgBdnRPEMMSTr5Uv+M= -cloud.google.com/go/datacatalog v1.12.0/go.mod h1:CWae8rFkfp6LzLumKOnmVh4+Zle4A3NXLzVJ1d1mRm0= -cloud.google.com/go/datacatalog v1.13.0/go.mod h1:E4Rj9a5ZtAxcQJlEBTLgMTphfP11/lNaAshpoBgemX8= -cloud.google.com/go/datacatalog v1.14.0/go.mod h1:h0PrGtlihoutNMp/uvwhawLQ9+c63Kz65UFqh49Yo+E= -cloud.google.com/go/datacatalog v1.14.1/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= -cloud.google.com/go/datacatalog v1.16.0/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= -cloud.google.com/go/dataflow v0.8.0/go.mod h1:Rcf5YgTKPtQyYz8bLYhFoIV/vP39eL7fWNcSOyFfLJE= -cloud.google.com/go/dataflow v0.9.1/go.mod h1:Wp7s32QjYuQDWqJPFFlnBKhkAtiFpMTdg00qGbnIHVw= cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= -cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0FrsauObOM3Ipr0= -cloud.google.com/go/dataform v0.6.0/go.mod h1:QPflImQy33e29VuapFdf19oPbE4aYTJxr31OAPV+ulA= -cloud.google.com/go/dataform v0.7.0/go.mod h1:7NulqnVozfHvWUBpMDfKMUESr+85aJsC/2O0o3jWPDE= -cloud.google.com/go/dataform v0.8.1/go.mod h1:3BhPSiw8xmppbgzeBbmDvmSWlwouuJkXsXsb8UBih9M= -cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= -cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w= -cloud.google.com/go/datafusion v1.6.0/go.mod h1:WBsMF8F1RhSXvVM8rCV3AeyWVxcC2xY6vith3iw3S+8= -cloud.google.com/go/datafusion v1.7.1/go.mod h1:KpoTBbFmoToDExJUso/fcCiguGDk7MEzOWXUsJo0wsI= cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= -cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxByuW2E+FU+wXcM= -cloud.google.com/go/datalabeling v0.8.1/go.mod h1:XS62LBSVPbYR54GfYQsPXZjTW8UxCK2fkDciSrpRFdY= -cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= -cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0kZCCKsU0A= -cloud.google.com/go/dataplex v1.5.2/go.mod h1:cVMgQHsmfRoI5KFYq4JtIBEUbYwc3c7tXmIDhRmNNVQ= -cloud.google.com/go/dataplex v1.6.0/go.mod h1:bMsomC/aEJOSpHXdFKFGQ1b0TDPIeL28nJObeO1ppRs= -cloud.google.com/go/dataplex v1.8.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.9.0/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= -cloud.google.com/go/dataproc v1.8.0/go.mod h1:5OW+zNAH0pMpw14JVrPONsxMQYMBqJuzORhIBfBn9uI= -cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= -cloud.google.com/go/dataproc/v2 v2.0.1/go.mod h1:7Ez3KRHdFGcfY7GcevBbvozX+zyWGcwLJvvAMwCaoZ4= cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= -cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= -cloud.google.com/go/dataqna v0.8.1/go.mod h1:zxZM0Bl6liMePWsHA8RMGAfmTG34vJMapbHAxQ5+WA8= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= -cloud.google.com/go/datastore v1.11.0/go.mod h1:TvGxBIHCS50u8jzG+AW/ppf87v1of8nwzFNgEZU1D3c= -cloud.google.com/go/datastore v1.12.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.12.1/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.13.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= -cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= -cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2/XoS5yi88q4= -cloud.google.com/go/datastream v1.6.0/go.mod h1:6LQSuswqLa7S4rPAOZFVjHIG3wJIjZcZrw8JDEDJuIs= -cloud.google.com/go/datastream v1.7.0/go.mod h1:uxVRMm2elUSPuh65IbZpzJNMbuzkcvu5CjMqVIUHrww= -cloud.google.com/go/datastream v1.9.1/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/datastream v1.10.0/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= -cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXHA0l4r+s= -cloud.google.com/go/deploy v1.6.0/go.mod h1:f9PTHehG/DjCom3QH0cntOVRm93uGBDt2vKzAPwpXQI= -cloud.google.com/go/deploy v1.8.0/go.mod h1:z3myEJnA/2wnB4sgjqdMfgxCA0EqC3RBTNcVPs93mtQ= -cloud.google.com/go/deploy v1.11.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= -cloud.google.com/go/deploy v1.13.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= -cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= -cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFMoosgy+6Gn0s0= -cloud.google.com/go/dialogflow v1.29.0/go.mod h1:b+2bzMe+k1s9V+F2jbJwpHPzrnIyHihAdRFMtn2WXuM= -cloud.google.com/go/dialogflow v1.31.0/go.mod h1:cuoUccuL1Z+HADhyIA7dci3N5zUssgpBJmCzI6fNRB4= -cloud.google.com/go/dialogflow v1.32.0/go.mod h1:jG9TRJl8CKrDhMEcvfcfFkkpp8ZhgPz3sBGmAUYJ2qE= -cloud.google.com/go/dialogflow v1.38.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dialogflow v1.40.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= -cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q= -cloud.google.com/go/dlp v1.9.0/go.mod h1:qdgmqgTyReTz5/YNSSuueR8pl7hO0o9bQ39ZhtgkWp4= -cloud.google.com/go/dlp v1.10.1/go.mod h1:IM8BWz1iJd8njcNcG0+Kyd9OPnqnRNkDV8j42VT5KOI= cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= -cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= -cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc0ZvxxfQY1bg4= -cloud.google.com/go/documentai v1.16.0/go.mod h1:o0o0DLTEZ+YnJZ+J4wNfTxmDVyrkzFvttBXXtYRMHkM= -cloud.google.com/go/documentai v1.18.0/go.mod h1:F6CK6iUH8J81FehpskRmhLq/3VlwQvb7TvwOceQ2tbs= -cloud.google.com/go/documentai v1.20.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= -cloud.google.com/go/documentai v1.22.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= -cloud.google.com/go/domains v0.8.0/go.mod h1:M9i3MMDzGFXsydri9/vW+EWz9sWb4I6WyHqdlAk0idE= -cloud.google.com/go/domains v0.9.1/go.mod h1:aOp1c0MbejQQ2Pjf1iJvnVyT+z6R6s8pX66KaCSDYfE= cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= -cloud.google.com/go/edgecontainer v0.3.0/go.mod h1:FLDpP4nykgwwIfcLt6zInhprzw0lEi2P1fjO6Ie0qbc= -cloud.google.com/go/edgecontainer v1.0.0/go.mod h1:cttArqZpBB2q58W/upSG++ooo6EsblxDIolxa3jSjbY= -cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXCzenBu0R8bz2rwk= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= -cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= -cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= -cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= -cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= -cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= -cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEup4kvF+4gw= -cloud.google.com/go/eventarc v1.10.0/go.mod h1:u3R35tmZ9HvswGRBnF48IlYgYeBcPUCjkr4BTdem2Kw= -cloud.google.com/go/eventarc v1.11.0/go.mod h1:PyUjsUKPWoRBCHeOxZd/lbOOjahV41icXyUY5kSTvVY= -cloud.google.com/go/eventarc v1.12.1/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= -cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLYoINEK8XQAI= -cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+mUDLupOWEDs= -cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= -cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= -cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= -cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= -cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5UwtlpzoyquQ08= -cloud.google.com/go/functions v1.10.0/go.mod h1:0D3hEOe3DbEvCXtYOZHQZmD+SzYsi1YbI7dGvHfldXw= -cloud.google.com/go/functions v1.12.0/go.mod h1:AXWGrF3e2C/5ehvwYo/GH6O5s09tOPksiKhz+hH8WkA= -cloud.google.com/go/functions v1.13.0/go.mod h1:EU4O007sQm6Ef/PwRsI8N2umygGqPBS/IZQKBQBcJ3c= -cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= -cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= -cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM= -cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= -cloud.google.com/go/gaming v1.10.1/go.mod h1:XQQvtfP8Rb9Rxnxm5wFVpAp9zCQkJi2bLIb7iHGwB3s= -cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= -cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo= -cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg= -cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= -cloud.google.com/go/gkeconnect v0.7.0/go.mod h1:SNfmVqPkaEi3bF/B3CNZOAYPYdg7sU+obZ+QTky2Myw= -cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= -cloud.google.com/go/gkehub v0.11.0/go.mod h1:JOWHlmN+GHyIbuWQPl47/C2RFhnFKH38jH9Ascu3n0E= -cloud.google.com/go/gkehub v0.12.0/go.mod h1:djiIwwzTTBrF5NaXCGv3mf7klpEMcST17VBTVVDcuaw= -cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY= -cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= -cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI= -cloud.google.com/go/gkemulticloud v0.5.0/go.mod h1:W0JDkiyi3Tqh0TJr//y19wyb1yf8llHVto2Htf2Ja3Y= -cloud.google.com/go/gkemulticloud v0.6.1/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= -cloud.google.com/go/gkemulticloud v1.0.0/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= -cloud.google.com/go/grafeas v0.3.0/go.mod h1:P7hgN24EyONOTMyeJH6DxG4zD7fwiYa5Q6GUgyFSOU8= -cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= -cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= -cloud.google.com/go/gsuiteaddons v1.5.0/go.mod h1:TFCClYLd64Eaa12sFVmUyG62tk4mdIsI7pAnSXRkcFo= -cloud.google.com/go/gsuiteaddons v1.6.1/go.mod h1:CodrdOqRZcLp5WOwejHWYBjZvfY0kOphkAKpF/3qdZY= -cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= -cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= -cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= -cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= -cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/iam v1.0.1/go.mod h1:yR3tmSL8BcZB4bxByRv2jkSIahVmCtfKZwLYGBalRE8= -cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/iam v1.2.0 h1:kZKMKVNk/IsSSc/udOb83K0hL/Yh/Gcqpz+oAkoIFN8= cloud.google.com/go/iam v1.2.0/go.mod h1:zITGuWgsLZxd8OwAlX+eMFgZDXzBm7icj1PVTYG766Q= -cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= -cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= -cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= -cloud.google.com/go/iap v1.7.0/go.mod h1:beqQx56T9O1G1yNPph+spKpNibDlYIiIixiqsQXxLIo= -cloud.google.com/go/iap v1.7.1/go.mod h1:WapEwPc7ZxGt2jFGB/C/bm+hP0Y6NXzOYGjpPnmMS74= -cloud.google.com/go/iap v1.8.1/go.mod h1:sJCbeqg3mvWLqjZNsI6dfAtbbV1DL2Rl7e1mTyXYREQ= -cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= -cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= -cloud.google.com/go/ids v1.3.0/go.mod h1:JBdTYwANikFKaDP6LtW5JAi4gubs57SVNQjemdt6xV4= -cloud.google.com/go/ids v1.4.1/go.mod h1:np41ed8YMU8zOgv53MMMoCntLTn2lF+SUzlM+O3u/jw= -cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= -cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g= -cloud.google.com/go/iot v1.5.0/go.mod h1:mpz5259PDl3XJthEmh9+ap0affn/MqNSP4My77Qql9o= -cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= -cloud.google.com/go/iot v1.7.1/go.mod h1:46Mgw7ev1k9KqK1ao0ayW9h0lI+3hxeanz+L1zmbbbk= -cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= -cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= -cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= -cloud.google.com/go/kms v1.8.0/go.mod h1:4xFEhYFqvW+4VMELtZyxomGSYtSQKzM178ylFW4jMAg= -cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w= -cloud.google.com/go/kms v1.10.0/go.mod h1:ng3KTUtQQU9bPX3+QGLsflZIHlkbn8amFAMY63m8d24= -cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= -cloud.google.com/go/kms v1.11.0/go.mod h1:hwdiYC0xjnWsKQQCQQmIQnS9asjYVSK6jtXm+zFqXLM= -cloud.google.com/go/kms v1.12.1/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= -cloud.google.com/go/kms v1.15.0/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= -cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= -cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= -cloud.google.com/go/language v1.9.0/go.mod h1:Ns15WooPM5Ad/5no/0n81yUetis74g3zrbeJBE+ptUY= -cloud.google.com/go/language v1.10.1/go.mod h1:CPp94nsdVNiQEt1CNjF5WkTcisLiHPyIbMhvR8H2AW0= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/lifesciences v0.8.0/go.mod h1:lFxiEOMqII6XggGbOnKiyZ7IBwoIqA84ClvoezaA/bo= -cloud.google.com/go/lifesciences v0.9.1/go.mod h1:hACAOd1fFbCGLr/+weUKRAJas82Y4vrL3O5326N//Wc= -cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= -cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M= -cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= -cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= -cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= -cloud.google.com/go/longrunning v0.4.2/go.mod h1:OHrnaYyLUV6oqwh0xiS7e5sLQhP1m0QU9R+WhGDMgIQ= -cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= -cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= cloud.google.com/go/longrunning v0.6.0 h1:mM1ZmaNsQsnb+5n1DNPeL0KwQd9jQRqSqSDEkBZr+aI= cloud.google.com/go/longrunning v0.6.0/go.mod h1:uHzSZqW89h7/pasCWNYdUpwGz3PcVWhrWupreVPYLts= -cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= -cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= -cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= -cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak= -cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= -cloud.google.com/go/maps v0.6.0/go.mod h1:o6DAMMfb+aINHz/p/jbcY+mYeXBoZoxTfdSQ8VAJaCw= -cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY= -cloud.google.com/go/maps v1.3.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= -cloud.google.com/go/maps v1.4.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= -cloud.google.com/go/mediatranslation v0.7.0/go.mod h1:LCnB/gZr90ONOIQLgSXagp8XUW1ODs2UmUMvcgMfI2I= -cloud.google.com/go/mediatranslation v0.8.1/go.mod h1:L/7hBdEYbYHQJhX2sldtTO5SZZ1C1vkapubj0T2aGig= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= -cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= -cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY= -cloud.google.com/go/memcache v1.9.0/go.mod h1:8oEyzXCu+zo9RzlEaEjHl4KkgjlNDaXbCQeQWlzNFJM= -cloud.google.com/go/memcache v1.10.1/go.mod h1:47YRQIarv4I3QS5+hoETgKO40InqzLP6kpNLvyXuyaA= cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= -cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= -cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI= -cloud.google.com/go/metastore v1.10.0/go.mod h1:fPEnH3g4JJAk+gMRnrAnoqyv2lpUCqJPWOodSaf45Eo= -cloud.google.com/go/metastore v1.11.1/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/metastore v1.12.0/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= -cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuulFdYYtlcvT4= -cloud.google.com/go/monitoring v1.12.0/go.mod h1:yx8Jj2fZNEkL/GYZyTLS4ZtZEZN8WtDEiEqG4kLK50w= -cloud.google.com/go/monitoring v1.13.0/go.mod h1:k2yMBAB1H9JT/QETjNkgdCGD9bPF712XiLTVr+cBrpw= -cloud.google.com/go/monitoring v1.15.1/go.mod h1:lADlSAlFdbqQuwwpaImhsJXu1QSdd3ojypXrFSMr2rM= cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= -cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= -cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5MpTBnNm39iAVpC3TmsExt8= -cloud.google.com/go/networkconnectivity v1.10.0/go.mod h1:UP4O4sWXJG13AqrTdQCD9TnLGEbtNRqjuaaA7bNjF5E= -cloud.google.com/go/networkconnectivity v1.11.0/go.mod h1:iWmDD4QF16VCDLXUqvyspJjIEtBR/4zq5hwnY2X3scM= -cloud.google.com/go/networkconnectivity v1.12.1/go.mod h1:PelxSWYM7Sh9/guf8CFhi6vIqf19Ir/sbfZRUwXh92E= -cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= -cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4= -cloud.google.com/go/networkmanagement v1.6.0/go.mod h1:5pKPqyXjB/sgtvB5xqOemumoQNB7y95Q7S+4rjSOPYY= -cloud.google.com/go/networkmanagement v1.8.0/go.mod h1:Ho/BUGmtyEqrttTgWEe7m+8vDdK74ibQc+Be0q7Fof0= cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= -cloud.google.com/go/networksecurity v0.7.0/go.mod h1:mAnzoxx/8TBSyXEeESMy9OOYwo1v+gZ5eMRnsT5bC8k= -cloud.google.com/go/networksecurity v0.8.0/go.mod h1:B78DkqsxFG5zRSVuwYFRZ9Xz8IcQ5iECsNrPn74hKHU= -cloud.google.com/go/networksecurity v0.9.1/go.mod h1:MCMdxOKQ30wsBI1eI659f9kEp4wuuAueoC9AJKSPWZQ= cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= -cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= -cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vuYs+kBJ/gu0= -cloud.google.com/go/notebooks v1.7.0/go.mod h1:PVlaDGfJgj1fl1S3dUwhFMXFgfYGhYQt2164xOMONmE= -cloud.google.com/go/notebooks v1.8.0/go.mod h1:Lq6dYKOYOWUCTvw5t2q1gp1lAp0zxAxRycayS0iJcqQ= -cloud.google.com/go/notebooks v1.9.1/go.mod h1:zqG9/gk05JrzgBt4ghLzEepPHNwE5jgPcHZRKhlC1A8= -cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= -cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs= -cloud.google.com/go/optimization v1.3.1/go.mod h1:IvUSefKiwd1a5p0RgHDbWCIbDFgKuEdB+fPPuP0IDLI= -cloud.google.com/go/optimization v1.4.1/go.mod h1:j64vZQP7h9bO49m2rVaTVoNM0vEBEN5eKPUPbZyXOrk= -cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= -cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk= -cloud.google.com/go/orchestration v1.6.0/go.mod h1:M62Bevp7pkxStDfFfTuCOaXgaaqRAga1yKyoMtEoWPQ= -cloud.google.com/go/orchestration v1.8.1/go.mod h1:4sluRF3wgbYVRqz7zJ1/EUNc90TTprliq9477fGobD8= -cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= -cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc= -cloud.google.com/go/orgpolicy v1.10.0/go.mod h1:w1fo8b7rRqlXlIJbVhOMPrwVljyuW5mqssvBtU18ONc= -cloud.google.com/go/orgpolicy v1.11.0/go.mod h1:2RK748+FtVvnfuynxBzdnyu7sygtoZa1za/0ZfpOs1M= -cloud.google.com/go/orgpolicy v1.11.1/go.mod h1:8+E3jQcpZJQliP+zaFfayC2Pg5bmhuLK755wKhIIUCE= cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= -cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= -cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw= -cloud.google.com/go/osconfig v1.11.0/go.mod h1:aDICxrur2ogRd9zY5ytBLV89KEgT2MKB2L/n6x1ooPw= -cloud.google.com/go/osconfig v1.12.0/go.mod h1:8f/PaYzoS3JMVfdfTubkowZYGmAhUCjjwnjqWI7NVBc= -cloud.google.com/go/osconfig v1.12.1/go.mod h1:4CjBxND0gswz2gfYRCUoUzCm9zCABp91EeTtWXyz0tE= cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= -cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= -cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo= -cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJtBnQtKFs= -cloud.google.com/go/oslogin v1.10.1/go.mod h1:x692z7yAue5nE7CsSnoG0aaMbNoRJRXO4sn73R+ZqAs= cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= -cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= -cloud.google.com/go/phishingprotection v0.8.1/go.mod h1:AxonW7GovcA8qdEk13NfHq9hNx5KPtfxXNeUxTDxB6I= -cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= -cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LKtPa8lKeCByYeKTIf/vxdE= -cloud.google.com/go/policytroubleshooter v1.5.0/go.mod h1:Rz1WfV+1oIpPdN2VvvuboLVRsB1Hclg3CKQ53j9l8vw= -cloud.google.com/go/policytroubleshooter v1.6.0/go.mod h1:zYqaPTsmfvpjm5ULxAyD/lINQxJ0DDsnWOP/GZ7xzBc= -cloud.google.com/go/policytroubleshooter v1.7.1/go.mod h1:0NaT5v3Ag1M7U5r0GfDCpUFkWd9YqpubBWsQlhanRv0= -cloud.google.com/go/policytroubleshooter v1.8.0/go.mod h1:tmn5Ir5EToWe384EuboTcVQT7nTag2+DuH3uHmKd1HU= cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= -cloud.google.com/go/privatecatalog v0.7.0/go.mod h1:2s5ssIFO69F5csTXcwBP7NPFTZvps26xGzvQ2PQaBYg= -cloud.google.com/go/privatecatalog v0.8.0/go.mod h1:nQ6pfaegeDAq/Q5lrfCQzQLhubPiZhSaNhIgfJlnIXs= -cloud.google.com/go/privatecatalog v0.9.1/go.mod h1:0XlDXW2unJXdf9zFz968Hp35gl/bhF4twwpXZAW50JA= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcdcPRnFIRI= -cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= -cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= -cloud.google.com/go/pubsub v1.32.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= -cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= -cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= -cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= -cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE= -cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91jrwI3R+1ZSZEWrfL7XHgNo9U= -cloud.google.com/go/recaptchaenterprise/v2 v2.6.0/go.mod h1:RPauz9jeLtB3JVzg6nCbe12qNoaa8pXc4d/YukAmcnA= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.0/go.mod h1:19wVj/fs5RtYtynAPJdDTb69oW0vNHYDBTbB4NvMD9c= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.2/go.mod h1:kR0KjsJS7Jt1YSyWFkseQ756D45kaYNTlDPPaRAvDBU= cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= -cloud.google.com/go/recommendationengine v0.7.0/go.mod h1:1reUcE3GIu6MeBz/h5xZJqNLuuVjNg1lmWMPyjatzac= -cloud.google.com/go/recommendationengine v0.8.1/go.mod h1:MrZihWwtFYWDzE6Hz5nKcNz3gLizXVIDI/o3G1DLcrE= cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= -cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= -cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70= -cloud.google.com/go/recommender v1.9.0/go.mod h1:PnSsnZY7q+VL1uax2JWkt/UegHssxjUVVCrX52CuEmQ= -cloud.google.com/go/recommender v1.10.1/go.mod h1:XFvrE4Suqn5Cq0Lf+mCP6oBHD/yRMA8XxP5sb7Q7gpA= cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= -cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= -cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM= -cloud.google.com/go/redis v1.11.0/go.mod h1:/X6eicana+BWcUda5PpwZC48o37SiFVTFSs0fWAJ7uQ= -cloud.google.com/go/redis v1.13.1/go.mod h1:VP7DGLpE91M6bcsDdMuyCm2hIpB6Vp2hI090Mfd1tcg= -cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= -cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7LIXwrShilPh3P1tR0= -cloud.google.com/go/resourcemanager v1.5.0/go.mod h1:eQoXNAiAvCf5PXxWxXjhKQoTMaUSNrEfg+6qdf/wots= -cloud.google.com/go/resourcemanager v1.6.0/go.mod h1:YcpXGRs8fDzcUl1Xw8uOVmI8JEadvhRIkoXXUNVYcVo= -cloud.google.com/go/resourcemanager v1.7.0/go.mod h1:HlD3m6+bwhzj9XCouqmeiGuni95NTrExfhoSrkC/3EI= -cloud.google.com/go/resourcemanager v1.9.1/go.mod h1:dVCuosgrh1tINZ/RwBufr8lULmWGOkPS8gL5gqyjdT8= -cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= -cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg= -cloud.google.com/go/resourcesettings v1.5.0/go.mod h1:+xJF7QSG6undsQDfsCJyqWXyBwUoJLhetkRMDRnIoXA= -cloud.google.com/go/resourcesettings v1.6.1/go.mod h1:M7mk9PIZrC5Fgsu1kZJci6mpgN8o0IUzVx3eJU3y4Jw= cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= -cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= -cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y= -cloud.google.com/go/retail v1.12.0/go.mod h1:UMkelN/0Z8XvKymXFbD4EhFJlYKRx1FGhQkVPU5kF14= -cloud.google.com/go/retail v1.14.1/go.mod h1:y3Wv3Vr2k54dLNIrCzenyKG8g8dhvhncT2NcNjb/6gE= -cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= -cloud.google.com/go/run v0.3.0/go.mod h1:TuyY1+taHxTjrD0ZFk2iAR+xyOXEA0ztb7U3UNA0zBo= -cloud.google.com/go/run v0.8.0/go.mod h1:VniEnuBwqjigv0A7ONfQUaEItaiCRVujlMqerPPiktM= -cloud.google.com/go/run v0.9.0/go.mod h1:Wwu+/vvg8Y+JUApMwEDfVfhetv30hCG4ZwDR/IXl2Qg= -cloud.google.com/go/run v1.2.0/go.mod h1:36V1IlDzQ0XxbQjUx6IYbw8H3TJnWvhii963WW3B/bo= cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= -cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk= -cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJegEWKxRsn44= -cloud.google.com/go/scheduler v1.8.0/go.mod h1:TCET+Y5Gp1YgHT8py4nlg2Sew8nUHMqcpousDgXJVQc= -cloud.google.com/go/scheduler v1.9.0/go.mod h1:yexg5t+KSmqu+njTIh3b7oYPheFtBWGcbVUYF1GGMIc= -cloud.google.com/go/scheduler v1.10.1/go.mod h1:R63Ldltd47Bs4gnhQkmNDse5w8gBRrhObZ54PxgR2Oo= cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= -cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= -cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4= -cloud.google.com/go/secretmanager v1.10.0/go.mod h1:MfnrdvKMPNra9aZtQFvBcvRU54hbPD8/HayQdlUgJpU= -cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= -cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= -cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH8T5GUSb9IA= -cloud.google.com/go/security v1.12.0/go.mod h1:rV6EhrpbNHrrxqlvW0BWAIawFWq3X90SduMJdFwtLB8= -cloud.google.com/go/security v1.13.0/go.mod h1:Q1Nvxl1PAgmeW0y3HTt54JYIvUdtcpYKVfIB8AOMZ+0= -cloud.google.com/go/security v1.15.1/go.mod h1:MvTnnbsWnehoizHi09zoiZob0iCHVcL4AUBj76h9fXA= cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= -cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= -cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZIZF7SAR0wWECrjdk= -cloud.google.com/go/securitycenter v1.18.1/go.mod h1:0/25gAzCM/9OL9vVx4ChPeM/+DlfGQJDwBy/UC8AKK0= -cloud.google.com/go/securitycenter v1.19.0/go.mod h1:LVLmSg8ZkkyaNy4u7HCIshAngSQ8EcIRREP3xBnyfag= -cloud.google.com/go/securitycenter v1.23.0/go.mod h1:8pwQ4n+Y9WCWM278R8W3nF65QtY172h4S8aXyI9/hsQ= -cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= -cloud.google.com/go/servicecontrol v1.5.0/go.mod h1:qM0CnXHhyqKVuiZnGKrIurvVImCs8gmqWsDoqe9sU1s= -cloud.google.com/go/servicecontrol v1.10.0/go.mod h1:pQvyvSRh7YzUF2efw7H87V92mxU8FnFDawMClGCNuAA= -cloud.google.com/go/servicecontrol v1.11.0/go.mod h1:kFmTzYzTUIuZs0ycVqRHNaNhgR+UMUpw9n02l/pY+mc= -cloud.google.com/go/servicecontrol v1.11.1/go.mod h1:aSnNNlwEFBY+PWGQ2DoM0JJ/QUXqV5/ZD9DOLB7SnUk= cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= -cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4= -cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UVXjkuw7q5XcG10wx1U= -cloud.google.com/go/servicedirectory v1.8.0/go.mod h1:srXodfhY1GFIPvltunswqXpVxFPpZjf8nkKQT7XcXaY= -cloud.google.com/go/servicedirectory v1.9.0/go.mod h1:29je5JjiygNYlmsGz8k6o+OZ8vd4f//bQLtvzkPPT/s= -cloud.google.com/go/servicedirectory v1.10.1/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/servicedirectory v1.11.0/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= -cloud.google.com/go/servicemanagement v1.5.0/go.mod h1:XGaCRe57kfqu4+lRxaFEAuqmjzF0r+gWHjWqKqBvKFo= -cloud.google.com/go/servicemanagement v1.6.0/go.mod h1:aWns7EeeCOtGEX4OvZUWCCJONRZeFKiptqKf1D0l/Jc= -cloud.google.com/go/servicemanagement v1.8.0/go.mod h1:MSS2TDlIEQD/fzsSGfCdJItQveu9NXnUniTrq/L8LK4= -cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E= -cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU= -cloud.google.com/go/serviceusage v1.5.0/go.mod h1:w8U1JvqUqwJNPEOTQjrMHkw3IaIFLoLsPLvsE3xueec= -cloud.google.com/go/serviceusage v1.6.0/go.mod h1:R5wwQcbOWsyuOfbP9tGdAnCAc6B9DRwPG1xtWMDeuPA= -cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= -cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= -cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= -cloud.google.com/go/shell v1.7.1/go.mod h1:u1RaM+huXFaTojTbW4g9P5emOrrmLE69KrxqQahKn4g= -cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= -cloud.google.com/go/spanner v1.44.0/go.mod h1:G8XIgYdOK+Fbcpbs7p2fiprDw4CaZX63whnSMLVBxjk= -cloud.google.com/go/spanner v1.45.0/go.mod h1:FIws5LowYz8YAE1J8fOS7DJup8ff7xJeetWEo5REA2M= -cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= -cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= -cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSyoooSpco= -cloud.google.com/go/speech v1.14.1/go.mod h1:gEosVRPJ9waG7zqqnsHpYTOoAS4KouMRLDFMekpJ0J0= -cloud.google.com/go/speech v1.15.0/go.mod h1:y6oH7GhqCaZANH7+Oe0BhgIogsNInLlz542tg3VqeYI= -cloud.google.com/go/speech v1.17.1/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= -cloud.google.com/go/speech v1.19.0/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= -cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= -cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= -cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= -cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= -cloud.google.com/go/storagetransfer v1.8.0/go.mod h1:JpegsHHU1eXg7lMHkvf+KE5XDJ7EQu0GwNJbbVGanEw= -cloud.google.com/go/storagetransfer v1.10.0/go.mod h1:DM4sTlSmGiNczmV6iZyceIh2dbs+7z2Ayg6YAiQlYfA= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= -cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= -cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA= -cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= -cloud.google.com/go/talent v1.6.2/go.mod h1:CbGvmKCG61mkdjcqTcLOkb2ZN1SrQI8MDyma2l7VD24= -cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= -cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4= -cloud.google.com/go/texttospeech v1.6.0/go.mod h1:YmwmFT8pj1aBblQOI3TfKmwibnsfvhIBzPXcW4EBovc= -cloud.google.com/go/texttospeech v1.7.1/go.mod h1:m7QfG5IXxeneGqTapXNxv2ItxP/FS0hCZBwXYqucgSk= -cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= -cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg= -cloud.google.com/go/tpu v1.5.0/go.mod h1:8zVo1rYDFuW2l4yZVY0R0fb/v44xLh3llq7RuV61fPM= -cloud.google.com/go/tpu v1.6.1/go.mod h1:sOdcHVIgDEEOKuqUoi6Fq53MKHJAtOwtz0GuKsWSH3E= -cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= -cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1rshXG+Y= -cloud.google.com/go/trace v1.8.0/go.mod h1:zH7vcsbAhklH8hWFig58HvxcxyQbaIqMarMg9hn5ECA= -cloud.google.com/go/trace v1.9.0/go.mod h1:lOQqpE5IaWY0Ixg7/r2SjixMuc6lfTFeO4QGM4dQWOk= -cloud.google.com/go/trace v1.10.1/go.mod h1:gbtL94KE5AJLH3y+WVpfWILmqgc6dXcqgNXdOPAQTYk= -cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= -cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fpMRLPvXT5Wg= -cloud.google.com/go/translate v1.5.0/go.mod h1:29YDSYveqqpA1CQFD7NQuP49xymq17RXNaUDdc0mNu0= -cloud.google.com/go/translate v1.6.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.7.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.8.1/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.8.2/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= -cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvLZYnJSw= -cloud.google.com/go/video v1.12.0/go.mod h1:MLQew95eTuaNDEGriQdcYn0dTwf9oWiA4uYebxM5kdg= -cloud.google.com/go/video v1.13.0/go.mod h1:ulzkYlYgCp15N2AokzKjy7MQ9ejuynOJdf1tR5lGthk= -cloud.google.com/go/video v1.14.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.15.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.17.1/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= -cloud.google.com/go/video v1.19.0/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= -cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= -cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU= -cloud.google.com/go/videointelligence v1.10.0/go.mod h1:LHZngX1liVtUhZvi2uNS0VQuOzNi2TkY1OakiuoUOjU= -cloud.google.com/go/videointelligence v1.11.1/go.mod h1:76xn/8InyQHarjTWsBR058SmlPCwQjgcvoW0aZykOvo= cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= -cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY= -cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E= -cloud.google.com/go/vision/v2 v2.6.0/go.mod h1:158Hes0MvOS9Z/bDMSFpjwsUrZ5fPrdwuyyvKSGAGMY= -cloud.google.com/go/vision/v2 v2.7.0/go.mod h1:H89VysHy21avemp6xcf9b9JvZHVehWbET0uT/bcuY/0= -cloud.google.com/go/vision/v2 v2.7.2/go.mod h1:jKa8oSYBWhYiXarHPvP4USxYANYUEdEsQrloLjrSwJU= -cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= -cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g= -cloud.google.com/go/vmmigration v1.5.0/go.mod h1:E4YQ8q7/4W9gobHjQg4JJSgXXSgY21nA5r8swQV+Xxc= -cloud.google.com/go/vmmigration v1.6.0/go.mod h1:bopQ/g4z+8qXzichC7GW1w2MjbErL54rk3/C843CjfY= -cloud.google.com/go/vmmigration v1.7.1/go.mod h1:WD+5z7a/IpZ5bKK//YmT9E047AD+rjycCAvyMxGJbro= -cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= -cloud.google.com/go/vmwareengine v0.2.2/go.mod h1:sKdctNJxb3KLZkE/6Oui94iw/xs9PRNC2wnNLXsHvH8= -cloud.google.com/go/vmwareengine v0.3.0/go.mod h1:wvoyMvNWdIzxMYSpH/R7y2h5h3WFkx6d+1TIsP39WGY= -cloud.google.com/go/vmwareengine v0.4.1/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vmwareengine v1.0.0/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= -cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= -cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27RV31lnmZes= -cloud.google.com/go/vpcaccess v1.7.1/go.mod h1:FogoD46/ZU+JUBX9D606X21EnxiszYi2tArQwLY4SXs= cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= -cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= -cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A= -cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= -cloud.google.com/go/webrisk v1.9.1/go.mod h1:4GCmXKcOa2BZcZPn6DCEvE7HypmEJcJkr4mtM+sqYPc= -cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= -cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ= -cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= -cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv5/rGpFCsBOvPbYgszpg= 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= -cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= -cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= -cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= cosmossdk.io/api v0.7.6 h1:PC20PcXy1xYKH2KU4RMurVoFjjKkCgYRbVAD4PdqUuY= cosmossdk.io/api v0.7.6/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= cosmossdk.io/client/v2 v2.0.0-beta.5 h1:0LVv3nEByn//hFDIrYLs2WvsEU3HodOelh4SDHnA/1I= cosmossdk.io/client/v2 v2.0.0-beta.5/go.mod h1:4p0P6o0ro+FizakJUYS9SeM94RNbv0thLmkHRw5o5as= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= -cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g= -cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/simapp v0.0.0-20231211060251-d8fb76d4c267 h1:fLJ+ng4SiuEK7NhKPIAn7QlWNGPpFCzfdtEODUXDvEs= cosmossdk.io/simapp v0.0.0-20231211060251-d8fb76d4c267/go.mod h1:ril3K+x7sdvOTVZsBv0PGDePO54m64HLDq1AmVEREl8= -cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= -cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= cosmossdk.io/tools/confix v0.1.2/go.mod h1:7XfcbK9sC/KNgVGxgLM0BrFbVcR/+6Dg7MFfpx7duYo= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= @@ -804,12 +227,12 @@ cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHm dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= -git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= github.com/4meepo/tagalign v1.3.4 h1:P51VcvBnf04YkHzjfclN6BbsopfJR5rxs1n+5zHt+w8= github.com/4meepo/tagalign v1.3.4/go.mod h1:M+pnkHH2vG8+qhE5bVc/zeP7HS/j910Fwa9TUSyZVI0= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= +github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= github.com/Abirdcfly/dupword v0.1.1 h1:Bsxe0fIw6OwBtXMIncaTxCLHYO5BB+3mcsR5E8VXloY= github.com/Abirdcfly/dupword v0.1.1/go.mod h1:B49AcJdTYYkpd4HjgAcutNGG9HZ2JWwKunH9Y2BA6sM= github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= @@ -824,8 +247,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CosmWasm/wasmd v0.52.0 h1:VRylqes1AMXqIgz/jUH9EzhjBZKsRXrrjCTAni0ILRM= -github.com/CosmWasm/wasmd v0.52.0/go.mod h1:hyy1wt7c589Cs4kOK2cYdtphzCd2Xo20q/t7tfby7oI= +github.com/CosmWasm/wasmd v0.53.0 h1:kdaoAi20bIb4VCsxw9pRaT2g5PpIp82Wqrr9DRVN9ao= +github.com/CosmWasm/wasmd v0.53.0/go.mod h1:FJl/aWjdpGof3usAMFQpDe07Rkx77PUzp0cygFMOvtw= github.com/CosmWasm/wasmvm/v2 v2.1.3 h1:CSJTauZqkHyb9yic6JVYCjiGUgxI2MJV2QzfSu8m49c= github.com/CosmWasm/wasmvm/v2 v2.1.3/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg= github.com/Crocmagnon/fatcontext v0.5.2 h1:vhSEg8Gqng8awhPju2w7MKHqMlg4/NI+gSDHtR3xgwA= @@ -840,7 +263,6 @@ github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= github.com/IGLOU-EU/go-wildcard v1.0.3 h1:r8T46+8/9V1STciXJomTWRpPEv4nGJATDbJkdU0Nou0= github.com/IGLOU-EU/go-wildcard v1.0.3/go.mod h1:/qeV4QLmydCbwH0UMQJmXDryrFKJknWi/jjO8IiuQfY= -github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= @@ -848,24 +270,20 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= -github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= -github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= +github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= -github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= @@ -883,18 +301,9 @@ github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pO github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk= -github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= -github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI= -github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= github.com/aptos-labs/serde-reflection/serde-generate/runtime/golang v0.0.0-20231213012317-73b6bbf74833 h1:/OtHsUoaVegyyGQ9/Ycm5vrC3xTTyj4+N/HsJ0wwAGA= github.com/aptos-labs/serde-reflection/serde-generate/runtime/golang v0.0.0-20231213012317-73b6bbf74833/go.mod h1:zUz5maIUAS+tl1lC+lJR7HUf0vVnHk6W7bCvN+DzjME= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -905,8 +314,6 @@ github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8ger github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= -github.com/avast/retry-go/v4 v4.5.1 h1:AxIx0HGi4VZ3I02jr78j5lZ3M6x1E0Ivxa6b0pUUh7o= -github.com/avast/retry-go/v4 v4.5.1/go.mod h1:/sipNsvNB3RRuT5iNcb6h73nw3IBmXJ/H3XrCQYSOpc= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= @@ -931,67 +338,34 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLdw= github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= -github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= 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.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= -github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= -github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= -github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= -github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= 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.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= -github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= -github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= -github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0= github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= github.com/butuzov/mirror v1.2.0 h1:9YVK1qIjNspaqWutSv8gsge2e/Xpq1eqEkslEUHy5cs= github.com/butuzov/mirror v1.2.0/go.mod h1:DqZZDtzm42wIAIyHXeN8W/qb1EPlb9Qn/if9icBOpdQ= -github.com/bytedance/sonic v1.12.3 h1:W2MGa7RCU1QTeYRTPE3+88mVC0yXmsRQRChiyVocVjU= -github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= -github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/catenacyber/perfsprint v0.7.1 h1:PGW5G/Kxn+YrN04cRAZKC+ZuvlVwolYMrIyyTJ/rMmc= github.com/catenacyber/perfsprint v0.7.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= -github.com/celestiaorg/go-square/v2 v2.0.0 h1:U5QV8/de5lc7glosfgyHhcxbFwNuwU4+6aYZ2RgjM04= -github.com/celestiaorg/go-square/v2 v2.0.0/go.mod h1:y0BolG0tRM7UN1sAQyDDUkT+aMJPwFIjviVvnCB62C0= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= @@ -1013,20 +387,16 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp github.com/ckaznocha/intrange v0.2.0 h1:FykcZuJ8BD7oX93YbO1UY9oZtkRbp+1/kJcDjkefYLs= github.com/ckaznocha/intrange v0.2.0/go.mod h1:r5I7nUlAAG56xmkOpw4XVr16BXhwYTUdcuRFeevn1oE= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= -github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -1045,14 +415,12 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= -github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= -github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= -github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= +github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= +github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz3DlerQ= +github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -1070,8 +438,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= -github.com/cosmos/iavl v1.1.4 h1:Z0cVVjeQqOUp78/nWt/uhQy83vYluWlAMGQ4zbH9G34= -github.com/cosmos/iavl v1.1.4/go.mod h1:vCYmRQUJU1wwj0oRD3wMEtOM9sJNDP+GFMaXmIxZ/rU= +github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= +github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 h1:dyLNlDElY6+5zW/BT/dO/3Ad9FpQblfh+9dQpYQodbA= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2/go.mod h1:82hPO/tRawbuFad2gPwChvpZ0JEIoNi91LwVneAYCeM= github.com/cosmos/ibc-apps/modules/rate-limiting/v8 v8.0.0 h1:AQO9NIAP3RFqvBCj7IqM/V1LCxmuvcvGUdu0RIEz/c0= @@ -1080,24 +448,26 @@ github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0 github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd/go.mod h1:JWfpWVKJKiKtd53/KbRoKfxWl8FsT2GPcNezTOk0o5Q= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= +github.com/cosmos/ibc-go/v8 v8.5.1 h1:3JleEMKBjRKa3FeTKt4fjg22za/qygLBo7mDkoYTNBs= +github.com/cosmos/ibc-go/v8 v8.5.1/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= -github.com/cosmos/interchain-security/v6 v6.0.0 h1:BieZEefykqrD2Vvt3onsYjEAa5O+aWoRWSF8nN5aidE= -github.com/cosmos/interchain-security/v6 v6.0.0/go.mod h1:+5zIZEzkL4yNHB/UWXCu75t6GeEgEmWHbz5OnBWiL0o= -github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= -github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= +github.com/cosmos/interchain-security/v6 v6.3.0 h1:AIsfxLUDtUGVfaqJ1WPwnYIOT5AxoSO58469iw9vNH4= +github.com/cosmos/interchain-security/v6 v6.3.0/go.mod h1:6DSiV2w+DuPkxP1KGFtaxpiwf8Xt2iusj8O53KCx96Q= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cosmos/rosetta v0.50.10 h1:JML9H+TYnpiUn1TucVmV5XVH9YF/Nd/GJqesaIpXq0c= +github.com/cosmos/rosetta v0.50.10/go.mod h1:x7LfYPXzDkS3/8idE+ASifOokJacOiJGdrlj6/r8Bz0= +github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= +github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= -github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= -github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= -github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= -github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= -github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= -github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= -github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= +github.com/creachadair/atomicfile v0.3.3 h1:yJlDq8qk9QmD/6ol+jq1X4bcoLNVdYq95+owOnauziE= +github.com/creachadair/atomicfile v0.3.3/go.mod h1:X1r9P4wigJlGkYJO1HXZREdkVn+b1yHrsBBMLSj7tak= +github.com/creachadair/mtest v0.0.0-20231015022703-31f2ea539dce h1:BFjvg2Oq88/2DOcUFu1ScIwKUn7KJYYvLr6AeuCJD54= +github.com/creachadair/mtest v0.0.0-20231015022703-31f2ea539dce/go.mod h1:okn1ft6DY+qjPmnvYynyq7ufIQKJ2x2qwOCJZecei1k= +github.com/creachadair/tomledit v0.0.26 h1:MoDdgHIHZ5PctBVsAZDjxdxreWUEa9ObPKTRkk5PPwA= +github.com/creachadair/tomledit v0.0.26/go.mod h1:SJi1OxKpMyR141tq1lzsbPtIg3j8TeVPM/ZftfieD7o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= @@ -1106,18 +476,14 @@ github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c= github.com/daixiang0/gci v0.13.5/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8= github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= @@ -1132,39 +498,33 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= -github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.7.0 h1:bnQc8+GMnidJZA8zc6lLEAb4xNrIqHwO+9TzqvtQZPo= +github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= -github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= +github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= -github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= -github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= -github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= -github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= -github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.9 h1:J7iwXDrtUyE9FUjUYbd4c9tyzwMh6dTJsKzo9i6SrwA= -github.com/ethereum/go-ethereum v1.14.9/go.mod h1:QeW+MtTpRdBEm2pUFoonByee8zfHv7kGp0wK0odvU1I= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= -github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -1177,8 +537,6 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA= github.com/firefart/nonamedreturns v1.0.5/go.mod h1:gHJjDqhGM4WyPt639SOZs+G89Ko7QKH5R5BhnO6xJhw= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -1207,11 +565,6 @@ github.com/go-critic/go-critic v0.11.4 h1:O7kGOCx0NDIni4czrkRIXTnit0mkyKOCePh3My github.com/go-critic/go-critic v0.11.4/go.mod h1:2QAdo4iuLik5S9YG0rT4wcZ8QxwHYkrr6/2MWAiv/vc= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= -github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= -github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -1223,8 +576,6 @@ github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4F github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= -github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= @@ -1235,11 +586,6 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 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-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= -github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= 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= @@ -1290,7 +636,6 @@ github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA= github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= @@ -1298,14 +643,17 @@ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -1314,6 +662,7 @@ github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= @@ -1341,7 +690,6 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -1367,8 +715,8 @@ github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed h1:IURFTjxeTfNF github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed/go.mod h1:XLXN8bNw4CGRPaqgl3bv/lhz7bsGPh4/xSaMTbo2vkQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -1388,10 +736,6 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v43 v43.0.0 h1:y+GL7LIsAIF2NZlJ46ZoC/D1W1ivZasT0lnWHMYPZ+U= -github.com/google/go-github/v43 v43.0.0/go.mod h1:ZkTvvmCXBvsfPpTHXnH/d2hP9Y0cTbvN9kr5xqyXOIc= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -1401,7 +745,6 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= @@ -1415,7 +758,6 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -1424,12 +766,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.0/go.mod h1:OJpEgntRZo8ugHpF9hkoLJbS5dSI20XZeXJ9JVywLlM= -github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= -github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -1438,8 +776,6 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -1451,15 +787,9 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s= github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= @@ -1472,7 +802,6 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -1487,6 +816,8 @@ github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= +github.com/goware/urlx v0.3.2 h1:gdoo4kBHlkqZNaf6XlQ12LGtQOmpKJrR04Rc3RnpJEo= +github.com/goware/urlx v0.3.2/go.mod h1:h8uwbJy68o+tQXCGZNa9D73WN8n0r9OBae5bUnLcgjw= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -1495,9 +826,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= @@ -1554,10 +882,6 @@ github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7H github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= -github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= -github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= @@ -1566,7 +890,6 @@ github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXM github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc= github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -1581,30 +904,10 @@ github.com/initia-labs/OPinit v0.5.1 h1:TzpjkuSjbbaYF6hc/8E94E/m3zkGE3oOXRdrdARX github.com/initia-labs/OPinit v0.5.1/go.mod h1:lx1amLMszculwPu8ln+btJno38UV28fd2nP7XC88ZeE= github.com/initia-labs/OPinit/api v0.5.1 h1:zwyJf7HtKJCKvLJ1R9PjVfJO1L+d/jKoeFyT7WTLHFI= github.com/initia-labs/OPinit/api v0.5.1/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU= -github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261 h1:V62KOhe6Em3wAvJsDVP+3is98I3mk/29OKNVs4IxeFQ= -github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261/go.mod h1:KsQ7Wm/dw9N0l7Ypn3QKGwgUX5XinTlcHGIF0DSjsw4= -github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e h1:k+pg63SFozCAK4LZFSiZtof6z69Tlu0O/Zftj1aAwes= -github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e/go.mod h1:aVposiPW9FOUeAeJ7JjJRdE3g+L6i8YDxFn6Cv6+Az4= -github.com/initia-labs/cosmos-sdk v0.0.0-20240627065534-d2180fcfd501 h1:OcLFeu3V9T156H4n6WzPNfKWjIUKdkC0P0EBA8zEWFE= -github.com/initia-labs/cosmos-sdk v0.0.0-20240627065534-d2180fcfd501/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s= -github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d h1:TLq8lB1PtQ0pjGf+bN8YgGVeLMuytZ26SBGMOs1seKY= -github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d/go.mod h1:zh6x1osR0hNvEcFrC/lhGD08sMfQmr9wHVvZ/mRWMCs= 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/initia-labs/kvindexer v0.1.8 h1:PZ7FPYZO2zFXBdnvVlwMFVv6O59fpgCObELxVYB0hBo= -github.com/initia-labs/kvindexer v0.1.8/go.mod h1:OV85HaQ9KVrg+zGPUlxT9RF9nAaM3Yq4/3MoHqGqhWk= -github.com/initia-labs/kvindexer/submodules/block v0.1.0 h1:y+EXnksd/I2F96mzIoQA64nZUZON2P+99YrSzeLCLoY= -github.com/initia-labs/kvindexer/submodules/block v0.1.0/go.mod h1:4c+c59wVAnjuaJv/pcDYaUkeVmOqVV+orqEjya/RIjo= -github.com/initia-labs/kvindexer/submodules/tx v0.1.0 h1:6kbf6wmzXPN0XCQLasiFgq1AlZHkt5K3/ZG+IWw1nNs= -github.com/initia-labs/kvindexer/submodules/tx v0.1.0/go.mod h1:i0XeLbLa6xdgTR01WF8kaAO50vMmwxbeq0fKexwpFHU= -github.com/initia-labs/kvindexer/submodules/wasm-nft v0.1.5 h1:zDba67t/hh61x+syugOG3a/A+cJFKwMr4yfk+Qf3nxQ= -github.com/initia-labs/kvindexer/submodules/wasm-nft v0.1.5/go.mod h1:1HD0/oH6kErv8F0J5ayGfLqerWSCPveGHSCbcfiBELw= -github.com/initia-labs/kvindexer/submodules/wasm-pair v0.1.0 h1:Ns7bxZkwdby67aIq3VXFAzlpoLdGONJbDaMiqu6k408= -github.com/initia-labs/kvindexer/submodules/wasm-pair v0.1.0/go.mod h1:SEotHE6mJ3VKr9g4j0AoXHgEYz6qhL3i1bX1QRnVT6g= github.com/initia-labs/movevm v0.4.12 h1:P30q4U2jUN/al3bX391ZkXr3t59owNTwr9qmC4d1S0Q= github.com/initia-labs/movevm v0.4.12/go.mod h1:aUWdvFZPdULjJ2McQTE+mLnfnG3CLAz0TWJRFzFFUwg= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= 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= @@ -1624,7 +927,6 @@ github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -1634,42 +936,30 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.3.0 h1:z1n1AOHVVydOOVuyphbOKyR4NICDQFiJMn1IK5hVQ5Y= -github.com/jsternberg/zap-logfmt v1.3.0/go.mod h1:N3DENp9WNmCZxvkBD/eReWwz1149BK6jEN9cQ4fNwZE= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.5 h1:CdnJh63tcDe53vG+RebdpdXJTc9atMgGqdx8LXxiilg= github.com/kkHAIKE/contextcheck v1.1.5/go.mod h1:O930cpht4xb1YQpK+1+AgoM3mFsvxr7uyFptcnWTYUA= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -1690,8 +980,6 @@ github.com/ldez/gomoddirectives v0.2.4 h1:j3YjBIjEBbqZ0NKtBNzr8rtMHTOrLPeiwTkfUJ github.com/ldez/gomoddirectives v0.2.4/go.mod h1:oWu9i62VcQDYp9EQ0ONTfqLNh+mDLWWDO+SO0qSQw5g= 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/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= 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= @@ -1705,10 +993,7 @@ github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5Of github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o= -github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= github.com/macabu/inamedparam v0.1.3/go.mod h1:93FLICAIk/quk7eaPPQvbzihUdn/QkGDwIZEoLtpH6I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -1733,7 +1018,6 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -1742,20 +1026,12 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/milkyway-labs/ibc-rate-limiting v0.0.0-20240529144041-70ebeac5863b h1:5OjDS9hKDyXPPd9XJwFcxrpFDUcaEZf9L14zj0fzbwo= -github.com/milkyway-labs/ibc-rate-limiting v0.0.0-20240529144041-70ebeac5863b/go.mod h1:YAf80eEQ4bdg5qXP4EI8eCxzhhWfqwiy9DoP8JXXg60= -github.com/milkyway-labs/relayer/v2 v2.0.0-20241011165100-8ff2d878e8fc h1:dxyCsdy6z7+PYI8hVTCvBinUa9G8In7d5y+hivfZbsw= -github.com/milkyway-labs/relayer/v2 v2.0.0-20241011165100-8ff2d878e8fc/go.mod h1:h4Ng2QsVpxExIq5S+WvLr8slDb9MSBh82gQS4DeMwDo= -github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= -github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -1769,9 +1045,6 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= -github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= -github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -1827,7 +1100,6 @@ github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= -github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -1836,10 +1108,10 @@ github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= +github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -1850,6 +1122,12 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/osmosis-labs/cometbft v0.38.15-v27-osmo-1 h1:hO9DL2RDaOtob4smOEC/YIQg2KPV3VMPs+ETNfd5GHM= +github.com/osmosis-labs/cometbft v0.38.15-v27-osmo-1/go.mod h1:+wh6ap6xctVG+JOHwbl8pPKZ0GeqdPYqISu7F4b43cQ= +github.com/osmosis-labs/cosmos-sdk v0.50.10-v27-osmo-1 h1:h15nNpKcnNOpijSJLBsieD2P5NUmlMDk9ovDeGCW2t0= +github.com/osmosis-labs/cosmos-sdk v0.50.10-v27-osmo-1/go.mod h1:sYSfC78jZEx6m0WOprklQJG4PMGSmNJ0Y8lYrsv/MfU= +github.com/osmosis-labs/cosmos-sdk/store v0.1.0-alpha.1.0.20240509221435-b8feb2ffb728 h1:AMz4HWC+WA/MwBQdsb11yIF9ForIvSLYYVy/jyhJ3/I= +github.com/osmosis-labs/cosmos-sdk/store v0.1.0-alpha.1.0.20240509221435-b8feb2ffb728/go.mod h1:gjE3DZe4t/+VeIk6CmrouyqiuDbZ7QOVDDq3nLqBTpg= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= @@ -1857,6 +1135,8 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/oxyno-zeta/gomock-extra-matcher v1.2.0 h1:WPEclU0y0PMwUzdDcaKZvld4aXpa3fkzjiUMQdcBEHg= +github.com/oxyno-zeta/gomock-extra-matcher v1.2.0/go.mod h1:S0r7HmKeCGsHmvIVFMjKWwswb4+30nCNWbXRMBVPkaU= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -1865,15 +1145,10 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= -github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -1882,8 +1157,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1906,8 +1179,6 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -1916,8 +1187,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= +github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1941,16 +1212,11 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= @@ -1962,8 +1228,6 @@ github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= -github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/ryancurrah/gomodguard v1.3.5 h1:cShyguSwUEeC0jS7ylOiG/idnd1TpJ1LfHGpV3oJmPU= github.com/ryancurrah/gomodguard v1.3.5/go.mod h1:MXlEPQRxgfPQa62O8wzK3Ozbkv9Rkqr+wKjSxTdsNJE= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= @@ -1978,8 +1242,8 @@ github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/ github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= @@ -1991,8 +1255,6 @@ github.com/shamaton/msgpack/v2 v2.2.0 h1:IP1m01pHwCrMa6ZccP9B3bqxEMKMSmMVAVKk54g github.com/shamaton/msgpack/v2 v2.2.0/go.mod h1:6khjYnkx73f7VQU7wjcFS9DFjs+59naVWJv1TB7qdOI= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -2012,6 +1274,8 @@ github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610 h1:4JlsiRVt github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610/go.mod h1:kB8gFZX07CyJnw8q9iEZijI3qJTIe1K/Y++P5VGkrcg= github.com/skip-mev/connect/v2 v2.0.1 h1:HEPdUio+uDtoSCKfCzKgQqs2jSQWgFQRYF+zyuhnGqs= github.com/skip-mev/connect/v2 v2.0.1/go.mod h1:EaPc1lnDHt0WzEisfctMIeJ3EXkpCO/4wUZrzdROr7s= +github.com/skip-mev/feemarket v1.1.1 h1:L34K7N2J6o635kzNYRAvQ93+hAFtSiJ2t03jmaNx0zw= +github.com/skip-mev/feemarket v1.1.1/go.mod h1:DUa6djUsTeMOrbrcIZqWSVxU9IZNCXp96ruaojyBNpc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -2022,10 +1286,7 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= @@ -2061,14 +1322,11 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= @@ -2087,20 +1345,12 @@ github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+n github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+9hijLQ4= github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= @@ -2133,8 +1383,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -2175,9 +1423,6 @@ go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8 go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -2200,44 +1445,23 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= @@ -2245,26 +1469,15 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -2287,21 +1500,16 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2341,16 +1549,13 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -2361,26 +1566,13 @@ golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -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.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -2404,16 +1596,10 @@ golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7Lm golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -2427,22 +1613,18 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2454,7 +1636,6 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2490,14 +1671,11 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w 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= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2506,12 +1684,10 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2535,46 +1711,24 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= -golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2584,31 +1738,22 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -2624,7 +1769,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -2663,12 +1807,10 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= @@ -2684,10 +1826,6 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2698,14 +1836,6 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= -gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= -gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -2754,23 +1884,10 @@ google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaE google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= -google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= -google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= -google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/api v0.118.0/go.mod h1:76TtD3vkgmZ66zZzp72bUUklpmQmKlhh6sYtIjYK+5E= -google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= -google.golang.org/api v0.124.0/go.mod h1:xu2HQurE5gi/3t1aFCvhPD781p0a3p11sdunTJ2BlP4= -google.golang.org/api v0.125.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/api v0.196.0 h1:k/RafYqebaIJBO3+SMnfEGtFVlvp5vSgqTUF54UN/zg= google.golang.org/api v0.196.0/go.mod h1:g9IL21uGkYgvQ5BZg6BAtoGJQIm8r6EgaAbpNey5wBE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2800,7 +1917,6 @@ google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -2817,10 +1933,8 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -2854,7 +1968,6 @@ google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220329172620-7be39ac1afc7/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= @@ -2887,76 +2000,56 @@ google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53B google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= -google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614GARnxrLsqKREzmNYJACSWWpAWdNMwnD7c2BE= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230112194545-e10362b5ecf9/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230113154510-dbe35b8444a5/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230124163310-31e0e69b6fc2/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= -google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230323212658-478b75c54725/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/genproto v0.0.0-20230525234025-438c736192d0/go.mod h1:9ExIQyXL5hZrHzQceCwuSYwZZ5QZBazOcprJ5rgs3lY= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto v0.0.0-20230629202037-9506855d4529/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= -google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:0ggbjUrZYpy1q+ANUS30SEoGZ53cdfwtbuG7Ptgy108= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:hL97c3SYopEHblzpxRL4lSs523++l8DYxGM1FQiYmb4= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2973,12 +2066,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -3015,6 +2102,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -3022,75 +2110,19 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.3/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= -modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= -modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc= -modernc.org/ccgo/v3 v3.0.0-20220430103911-bc99d88307be/go.mod h1:bwdAnOoaIt8Ax9YdWGjxWsdkPcZyRPHqrOvJxaKAKGw= -modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI= -modernc.org/ccgo/v3 v3.16.4/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.6/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws= -modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= -modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g= -modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= -modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= -modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v0.0.0-20220428101251-2d5f3daf273b/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.16.0/go.mod h1:N4LD6DBE9cf+Dzf9buBlzVJndKr/iJHG97vGLHYnb5A= -modernc.org/libc v1.16.1/go.mod h1:JjJE0eu4yeK7tab2n4S1w8tlWd9MxXLRzheaRnAKymU= -modernc.org/libc v1.16.17/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU= -modernc.org/libc v1.16.19/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= -modernc.org/libc v1.17.1/go.mod h1:FZ23b+8LjxZs7XtFMbSzL/EhPxNbfZbErxEHc7cbD9s= -modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA= -modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0= -modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= -modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= -modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.1.1/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.1/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4= -modernc.org/sqlite v1.18.2/go.mod h1:kvrTLEWgxUcHa2GfHBQtanR1H9ht3hTJNtKpzH9k1u0= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.13.1/go.mod h1:XOLfOwzhkljL4itZkK6T72ckMgvj0BDsnKNdZVUOecw= -modernc.org/tcl v1.13.2/go.mod h1:7CLiGIPo1M8Rv1Mitpv5akc2+8fxUd2y2UzC/MfMzy0= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/pkg/address/address.go b/pkg/address/address.go new file mode 100644 index 000000000..90d7bce78 --- /dev/null +++ b/pkg/address/address.go @@ -0,0 +1,22 @@ +package address + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/types/bech32" +) + +// ConvertBech32Prefix convert bech32 address to specified prefix. +func ConvertBech32Prefix(address, prefix string) (string, error) { + _, bz, err := bech32.DecodeAndConvert(address) + if err != nil { + return "", fmt.Errorf("cannot decode %s address: %s", address, err) + } + + convertedAddress, err := bech32.ConvertAndEncode(prefix, bz) + if err != nil { + return "", fmt.Errorf("cannot convert %s address: %s", address, err) + } + + return convertedAddress, nil +} diff --git a/pkg/address/address_test.go b/pkg/address/address_test.go new file mode 100644 index 000000000..b9f541225 --- /dev/null +++ b/pkg/address/address_test.go @@ -0,0 +1,43 @@ +package address + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestConvertBech32Prefix(t *testing.T) { + cases := []struct { + name string + address string + prefix string + converted string + err error + }{ + { + name: "Convert valid bech 32 address", + address: "akash1a6zlyvpnksx8wr6wz8wemur2xe8zyh0ytz6d88", + converted: "milk1a6zlyvpnksx8wr6wz8wemur2xe8zyh0yg235k0", + prefix: "milk", + }, + { + name: "Convert invalid address", + address: "invalidaddress", + prefix: "milk", + err: errors.New("cannot decode invalidaddress address: decoding bech32 failed: invalid separator index -1"), + }, + } + + for _, tt := range cases { + t.Run(tt.name, func(t *testing.T) { + convertedAddress, err := ConvertBech32Prefix(tt.address, tt.prefix) + if tt.err != nil { + require.ErrorContains(t, err, tt.err.Error()) + } else { + require.NoError(t, err) + } + require.Equal(t, tt.converted, convertedAddress) + }) + } +} diff --git a/sims.mk b/sims.mk new file mode 100644 index 000000000..c17cd9560 --- /dev/null +++ b/sims.mk @@ -0,0 +1,70 @@ +#!/usr/bin/make -f + +######################################## +### Simulations + +BINDIR ?= $(GOPATH)/bin +SIMAPP = ./app +test-sim-nondeterminism: + @echo "Running non-determinism test..." + @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ + -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h + +test-sim-custom-genesis-fast: + @echo "Running custom genesis simulation..." + @echo "By default, ${HOME}/.gaia/config/genesis.json will be used." + @go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.gaia/config/genesis.json \ + -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h + +test-sim-import-export: runsim + @echo "Running application import/export simulation. This may take several minutes..." + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport + +test-sim-after-import: runsim + @echo "Running application simulation-after-import. This may take several minutes..." + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport + +test-sim-custom-genesis-multi-seed: runsim + @echo "Running multi-seed custom genesis simulation..." + @echo "By default, ${HOME}/.gaia/config/genesis.json will be used." + @$(BINDIR)/runsim -Genesis=${HOME}/.gaia/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation + +test-sim-multi-seed-long: runsim + @echo "Running long multi-seed application simulation. This may take awhile!" + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestFullAppSimulation + +test-sim-multi-seed-short: runsim + @echo "Running short multi-seed application simulation. This may take awhile!" + @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation + +test-sim-benchmark-invariants: + @echo "Running simulation invariant benchmarks..." + @go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \ + -Enabled=true -NumBlocks=1000 -BlockSize=200 \ + -Period=1 -Commit=true -Seed=57 -v -timeout 24h + +.PHONY: \ +test-sim-nondeterminism \ +test-sim-custom-genesis-fast \ +test-sim-import-export \ +test-sim-after-import \ +test-sim-custom-genesis-multi-seed \ +test-sim-multi-seed-short \ +test-sim-multi-seed-long \ +test-sim-benchmark-invariants + +SIM_NUM_BLOCKS ?= 500 +SIM_BLOCK_SIZE ?= 200 +SIM_COMMIT ?= true + +test-sim-benchmark: + @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" + @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullAppSimulation$$ \ + -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h + +test-sim-profile: + @echo "Running application benchmark for numBlocks=$(SIM_NUM_BLOCKS), blockSize=$(SIM_BLOCK_SIZE). This may take awhile!" + @go test -mod=readonly -benchmem -run=^$$ $(SIMAPP) -bench ^BenchmarkFullAppSimulation$$ \ + -Enabled=true -NumBlocks=$(SIM_NUM_BLOCKS) -BlockSize=$(SIM_BLOCK_SIZE) -Commit=$(SIM_COMMIT) -timeout 24h -cpuprofile cpu.out -memprofile mem.out + +.PHONY: test-sim-profile test-sim-benchmark \ No newline at end of file diff --git a/testutils/storetesting/keeper.go b/testutils/storetesting/keeper.go index 3a729c789..cd8dde0e2 100644 --- a/testutils/storetesting/keeper.go +++ b/testutils/storetesting/keeper.go @@ -1,6 +1,7 @@ package storetesting import ( + "slices" "testing" "cosmossdk.io/log" @@ -14,7 +15,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" + milkyway "github.com/milkyway-labs/milkyway/app" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" ) @@ -35,16 +36,25 @@ type BaseKeeperTestData struct { func NewBaseKeeperTestData(t *testing.T, keys []string) BaseKeeperTestData { t.Helper() + // Set the Cosmos SDK configuration to use another Bech32 prefix + config := sdk.GetConfig() + config.SetBech32PrefixForAccount("cosmos", "cosmospub") + config.SetBech32PrefixForValidator("cosmosvaloper", "cosmosvaloperpub") + config.SetBech32PrefixForConsensusNode("cosmosvalcons", "cosmosvalconspub") + var data BaseKeeperTestData // Define store keys + keys = append(keys, []string{authtypes.StoreKey, banktypes.StoreKey}...) + slices.Sort(keys) + keys = slices.Compact(keys) data.Keys = storetypes.NewKVStoreKeys(keys...) // Setup the context data.Context = BuildContext(data.Keys, nil, nil) // Setup the codecs - data.Cdc, data.LegacyAmino = app.MakeCodecs() + data.Cdc, data.LegacyAmino = milkyway.MakeCodecs() // Authority address data.AuthorityAddress = authtypes.NewModuleAddress(govtypes.ModuleName).String() @@ -54,7 +64,7 @@ func NewBaseKeeperTestData(t *testing.T, keys []string) BaseKeeperTestData { data.Cdc, runtime.NewKVStoreService(data.Keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, - app.GetMaccPerms(), + milkyway.MaccPerms, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.GetConfig().GetBech32AccountAddrPrefix(), data.AuthorityAddress, @@ -63,7 +73,7 @@ func NewBaseKeeperTestData(t *testing.T, keys []string) BaseKeeperTestData { data.Cdc, runtime.NewKVStoreService(data.Keys[banktypes.StoreKey]), data.AccountKeeper, - app.BlacklistedModuleAccountAddrs(), + milkyway.BlockedModuleAccountAddrs(milkyway.ModuleAccountAddrs()), data.AuthorityAddress, log.NewNopLogger(), ) diff --git a/types/errors.go b/types/errors.go deleted file mode 100644 index 14133b3db..000000000 --- a/types/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import ( - "fmt" - - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" -) - -// NewEmitErrorAcknowledgement creates a new error acknowledgement after having emitted an event with the -// details of the error. -func NewEmitErrorAcknowledgement(err error) channeltypes.Acknowledgement { - return channeltypes.Acknowledgement{ - Response: &channeltypes.Acknowledgement_Error{ - Error: fmt.Sprintf("ibc hook error: %s", err.Error()), - }, - } -} diff --git a/types/errors/errors.go b/types/errors/errors.go new file mode 100644 index 000000000..20d8d86e4 --- /dev/null +++ b/types/errors/errors.go @@ -0,0 +1,40 @@ +package errors + +import ( + errorsmod "cosmossdk.io/errors" +) + +const codespace = "milkyway" + +var ( + // ErrTxDecode is returned if we cannot parse a transaction + ErrTxDecode = errorsmod.Register(codespace, 1, "tx parse error") + // ErrUnauthorized is used whenever a request without sufficient + // authorization is handled. + ErrUnauthorized = errorsmod.Register(codespace, 2, "unauthorized") + + // ErrInsufficientFunds is used when the account cannot pay requested amount. + ErrInsufficientFunds = errorsmod.Register(codespace, 3, "insufficient funds") + + // ErrInsufficientFunds is used when the account cannot pay requested amount. + ErrInsufficientFee = errorsmod.Register(codespace, 4, "insufficient fee") + + // ErrInvalidCoins is used when sdk.Coins are invalid. + ErrInvalidCoins = errorsmod.Register(codespace, 5, "invalid coins") + + // ErrInvalidType defines an error an invalid type. + ErrInvalidType = errorsmod.Register(codespace, 6, "invalid type") + + // ErrLogic defines an internal logic error, e.g. an invariant or assertion + // that is violated. It is a programmer error, not a user-facing error. + ErrLogic = errorsmod.Register(codespace, 7, "internal logic error") + + // ErrNotFound defines an error when requested entity doesn't exist in the state. + ErrNotFound = errorsmod.Register(codespace, 8, "not found") + + // ErrInsufficientStake is used when the account has insufficient staked tokens. + ErrInsufficientStake = errorsmod.Register(codespace, 9, "insufficient stake") + + // ErrInvalidExpeditedProposal is used when an expedite proposal is submitted for an unsupported proposal type. + ErrInvalidExpeditedProposal = errorsmod.Register(codespace, 10, "unsupported expedited proposal type") +) diff --git a/utils/ibc.go b/utils/ibc.go index 7c6af2762..ae65965e6 100644 --- a/utils/ibc.go +++ b/utils/ibc.go @@ -7,13 +7,13 @@ import ( transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) -// IsIcs20Packet checks if the data is a ICS20 packet. -func IsIcs20Packet(packetData []byte) (isIcs20 bool, ics20data transfertypes.FungibleTokenPacketData) { +// DeserializeFungibleTokenPacketData deserializes the packet data and returns the FungibleTokenPacketData +func DeserializeFungibleTokenPacketData(packetData []byte) (ics20data transfertypes.FungibleTokenPacketData, isIcs20 bool) { var data transfertypes.FungibleTokenPacketData decoder := json.NewDecoder(strings.NewReader(string(packetData))) decoder.DisallowUnknownFields() if err := decoder.Decode(&data); err != nil { - return false, data + return data, false } - return true, data + return data, true } diff --git a/utils/ibc_test.go b/utils/ibc_test.go index 2210215e3..ac97e4bf4 100644 --- a/utils/ibc_test.go +++ b/utils/ibc_test.go @@ -8,22 +8,22 @@ import ( nfttransfertypes "github.com/initia-labs/initia/x/ibc/nft-transfer/types" "github.com/stretchr/testify/require" - utils "github.com/milkyway-labs/milkyway/utils" + "github.com/milkyway-labs/milkyway/utils" ) -func Test_isIcs20Packet(t *testing.T) { - transferMsg := transfertypes.NewFungibleTokenPacketData("denom", "1000000", "0x1", "0x2", "memo") - bz, err := json.Marshal(transferMsg) +func Test_DeserializeFungibleTokenPacketData(t *testing.T) { + expected := transfertypes.NewFungibleTokenPacketData("denom", "1000000", "0x1", "0x2", "memo") + bz, err := json.Marshal(expected) require.NoError(t, err) - ok, _transferMsg := utils.IsIcs20Packet(bz) + msg, ok := utils.DeserializeFungibleTokenPacketData(bz) require.True(t, ok) - require.Equal(t, transferMsg, _transferMsg) + 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.IsIcs20Packet(bz) + _, ok = utils.DeserializeFungibleTokenPacketData(bz) require.False(t, ok) } diff --git a/x/assets/keeper/assets_test.go b/x/assets/keeper/assets_test.go index 60f280896..5f6b363f9 100644 --- a/x/assets/keeper/assets_test.go +++ b/x/assets/keeper/assets_test.go @@ -43,7 +43,7 @@ func (suite *KeeperTestSuite) TestKeeper_SetAsset() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -91,7 +91,7 @@ func (suite *KeeperTestSuite) TestKeeper_GetAsset() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -139,7 +139,7 @@ func (suite *KeeperTestSuite) TestRemoveAsset() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } diff --git a/x/assets/keeper/genesis_test.go b/x/assets/keeper/genesis_test.go index ff92a3e94..f5218ba35 100644 --- a/x/assets/keeper/genesis_test.go +++ b/x/assets/keeper/genesis_test.go @@ -40,7 +40,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() err := suite.keeper.InitGenesis(ctx, tc.genesis) if tc.shouldErr { suite.Require().Error(err) diff --git a/x/assets/keeper/grpc_query_test.go b/x/assets/keeper/grpc_query_test.go index 486cc8ead..5482a036c 100644 --- a/x/assets/keeper/grpc_query_test.go +++ b/x/assets/keeper/grpc_query_test.go @@ -87,7 +87,7 @@ func (suite *KeeperTestSuite) TestQuerier_Assets() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -140,7 +140,7 @@ func (suite *KeeperTestSuite) TestQuerier_Asset() { suite.Run(tc.name, func() { suite.SetupTest() - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } diff --git a/x/assets/keeper/keeper_test.go b/x/assets/keeper/keeper_test.go index 0af758f4a..82833a548 100644 --- a/x/assets/keeper/keeper_test.go +++ b/x/assets/keeper/keeper_test.go @@ -3,21 +3,20 @@ package keeper_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" - "github.com/milkyway-labs/milkyway/app/testutil" "github.com/milkyway-labs/milkyway/x/assets/keeper" - "github.com/milkyway-labs/milkyway/x/assets/types" + "github.com/milkyway-labs/milkyway/x/assets/testutils" ) type KeeperTestSuite struct { - testutil.KeeperTestSuite + suite.Suite authority string - keeper *keeper.Keeper - msgServer types.MsgServer - queryServer types.QueryServer + ctx sdk.Context + keeper *keeper.Keeper } func TestKeeperTestSuite(t *testing.T) { @@ -25,10 +24,10 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) SetupTest() { - suite.KeeperTestSuite.SetupTest() - suite.authority = suite.App.AssetsKeeper.GetAuthority() + data := testutils.NewKeeperTestData(suite.T()) - suite.keeper = suite.App.AssetsKeeper - suite.msgServer = keeper.NewMsgServer(suite.App.AssetsKeeper) - suite.queryServer = keeper.NewQueryServer(suite.App.AssetsKeeper) + suite.authority = data.AuthorityAddress + suite.ctx = data.Context + + suite.keeper = data.Keeper } diff --git a/x/assets/keeper/msg_server_test.go b/x/assets/keeper/msg_server_test.go index 5a7966600..6f2b5681c 100644 --- a/x/assets/keeper/msg_server_test.go +++ b/x/assets/keeper/msg_server_test.go @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) TestMsgServer_RegisterAsset() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() } @@ -103,8 +103,8 @@ func (suite *KeeperTestSuite) TestMsgServer_DeregisterAsset() { }, { name: "valid asset is deregistered properly", - setup: func() { - err := suite.keeper.SetAsset(suite.Ctx, types.NewAsset("umilk", "MILK", 6)) + store: func(ctx sdk.Context) { + err := suite.keeper.SetAsset(ctx, types.NewAsset("umilk", "MILK", 6)) suite.Require().NoError(err) }, msg: types.NewMsgDeregisterAsset(suite.authority, "umilk"), @@ -125,7 +125,7 @@ func (suite *KeeperTestSuite) TestMsgServer_DeregisterAsset() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() } diff --git a/x/assets/testutils/keeper.go b/x/assets/testutils/keeper.go new file mode 100644 index 000000000..ea2e67ef3 --- /dev/null +++ b/x/assets/testutils/keeper.go @@ -0,0 +1,46 @@ +package testutils + +import ( + "testing" + + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/milkyway-labs/milkyway/testutils/storetesting" + "github.com/milkyway-labs/milkyway/x/assets/keeper" + "github.com/milkyway-labs/milkyway/x/assets/types" +) + +type KeeperTestData struct { + storetesting.BaseKeeperTestData + + AuthorityAddress string + + StoreKey *storetypes.KVStoreKey + + Keeper *keeper.Keeper +} + +func NewKeeperTestData(t *testing.T) KeeperTestData { + var data = KeeperTestData{ + BaseKeeperTestData: storetesting.NewBaseKeeperTestData(t, []string{ + types.StoreKey, + }), + } + + data.StoreKey = data.Keys[types.StoreKey] + + // Setup the addresses + data.AuthorityAddress = authtypes.NewModuleAddress(govtypes.ModuleName).String() + + // Build the keepers + data.Keeper = keeper.NewKeeper( + data.Cdc, + runtime.NewKVStoreService(data.StoreKey), + data.AuthorityAddress, + ) + + return data +} diff --git a/cmd/milkywayd/init.go b/x/genutil/client/cli/init.go similarity index 68% rename from cmd/milkywayd/init.go rename to x/genutil/client/cli/init.go index fa5065f51..3d572a732 100644 --- a/cmd/milkywayd/init.go +++ b/x/genutil/client/cli/init.go @@ -1,44 +1,31 @@ -package main +package cli import ( "bufio" "encoding/json" + "errors" "fmt" "os" "path/filepath" - cfg "github.com/cometbft/cometbft/config" - "github.com/cometbft/cometbft/libs/cli" - cometos "github.com/cometbft/cometbft/libs/os" - cometrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/go-bip39" - "github.com/pkg/errors" - "github.com/spf13/cobra" - errorsmod "cosmossdk.io/errors" - + "cosmossdk.io/math/unsafe" + cfg "github.com/cometbft/cometbft/config" + cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/input" "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/genutil" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/go-bip39" + "github.com/spf13/cobra" milkywayapp "github.com/milkyway-labs/milkyway/app" - milkywaytypes "github.com/milkyway-labs/milkyway/types" -) - -const ( - // FlagOverwrite defines a flag to overwrite an existing genesis JSON file. - FlagOverwrite = "overwrite" - - // FlagRecover defines a flag to initialize the private validator key from a specific seed. - FlagRecover = "recover" - - // FlagDenom defines a flag to set default denom a chain operator want to use. - FlagDenom = "denom" ) type printInfo struct { @@ -86,23 +73,18 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { config := serverCtx.Config config.SetRoot(clientCtx.HomeDir) - // Configure the server to open RPC port to everyone and allow every origins - config.RPC.ListenAddress = "tcp://0.0.0.0:26657" - config.RPC.CORSAllowedOrigins = []string{"*"} - chainID, _ := cmd.Flags().GetString(flags.FlagChainID) - if chainID == "" { - chainID = fmt.Sprintf("test-chain-%v", cometrand.Str(6)) - } - - denom, err := cmd.Flags().GetString(FlagDenom) - if err != nil { - return err + switch { + case chainID != "": + case clientCtx.ChainID != "": + chainID = clientCtx.ChainID + default: + chainID = fmt.Sprintf("test-chain-%v", unsafe.Str(6)) } // Get bip39 mnemonic var mnemonic string - recover, _ := cmd.Flags().GetBool(FlagRecover) + recover, _ := cmd.Flags().GetBool(genutilcli.FlagRecover) if recover { inBuf := bufio.NewReader(cmd.InOrStdin()) value, err := input.GetString("Enter your bip39 mnemonic", inBuf) @@ -130,17 +112,24 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { config.Moniker = args[0] genFile := config.GenesisFile() - overwrite, _ := cmd.Flags().GetBool(FlagOverwrite) + overwrite, _ := cmd.Flags().GetBool(genutilcli.FlagOverwrite) + defaultDenom, _ := cmd.Flags().GetString(genutilcli.FlagDefaultBondDenom) - if !overwrite && cometos.FileExists(genFile) { + // use os.Stat to check if the file exists + _, err = os.Stat(genFile) + if !overwrite && !os.IsNotExist(err) { return fmt.Errorf("genesis.json file already exists: %v", genFile) } - appState, err := json.MarshalIndent( - milkywayapp.NewDefaultGenesisState(cdc, mbm, denom), "", " ", - ) + // Overwrites the SDK default denom for side-effects + if defaultDenom != "" { + sdk.DefaultBondDenom = defaultDenom + } + appGenState := milkywayapp.NewDefaultGenesisState(cdc, mbm) + + appState, err := json.MarshalIndent(appGenState, "", " ") if err != nil { - return errors.Wrap(err, "Failed to marshall default genesis state") + return errorsmod.Wrap(err, "Failed to marshal default genesis state") } appGenesis := &types.AppGenesis{} @@ -155,6 +144,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { } } + // Set default params appGenesis.AppName = version.AppName appGenesis.AppVersion = version.Version appGenesis.ChainID = chainID @@ -164,6 +154,14 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { Validators: nil, } + // Set the vote extensions enable height + consensusParams := cmttypes.DefaultConsensusParams() + consensusParams.ABCI.VoteExtensionsEnableHeight = 1 + appGenesis.Consensus = &types.ConsensusGenesis{ + Validators: nil, + Params: consensusParams, + } + if err = genutil.ExportGenesisFile(appGenesis, genFile); err != nil { return errorsmod.Wrap(err, "Failed to export genesis file") } @@ -175,11 +173,12 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { }, } - cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") - cmd.Flags().BoolP(FlagOverwrite, "o", false, "overwrite the genesis.json file") - cmd.Flags().Bool(FlagRecover, false, "provide seed phrase to recover existing key instead of creating") + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "node's home directory") + cmd.Flags().BoolP(genutilcli.FlagOverwrite, "o", false, "overwrite the genesis.json file") + cmd.Flags().Bool(genutilcli.FlagRecover, false, "provide seed phrase to recover existing key instead of creating") cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") - cmd.Flags().String(FlagDenom, milkywaytypes.BaseDenom, "genesis file default denom") + cmd.Flags().String(genutilcli.FlagDefaultBondDenom, "", "genesis file default denomination, if left blank default value is 'stake'") + cmd.Flags().Int64(flags.FlagInitHeight, 1, "specify the initial block height at genesis") return cmd } diff --git a/x/liquidvesting/hooks/common_test.go b/x/liquidvesting/hooks/common_test.go deleted file mode 100644 index 6a55d2837..000000000 --- a/x/liquidvesting/hooks/common_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package hooks_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - "github.com/stretchr/testify/suite" - - "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" - "github.com/milkyway-labs/milkyway/x/liquidvesting/testutils" -) - -func TestIBCHooksTestSuite(t *testing.T) { - suite.Run(t, new(IBCHooksTestSuite)) -} - -type IBCHooksTestSuite struct { - suite.Suite - - ctx sdk.Context - - ak authkeeper.AccountKeeper - ibcm ibchooks.IBCMiddleware - - k *keeper.Keeper -} - -func (suite *IBCHooksTestSuite) SetupTest() { - data := testutils.NewKeeperTestData(suite.T()) - - // Context and codecs - suite.ctx = data.Context - - // Keepers - suite.ak = data.AccountKeeper - suite.k = data.Keeper - suite.ibcm = data.IBCMiddleware -} diff --git a/x/liquidvesting/hooks/ibc_hooks.go b/x/liquidvesting/hooks/ibc_hooks.go deleted file mode 100644 index e22fc30c8..000000000 --- a/x/liquidvesting/hooks/ibc_hooks.go +++ /dev/null @@ -1,124 +0,0 @@ -package hooks - -import ( - "encoding/json" - "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - chan4types "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - - milkywaytypes "github.com/milkyway-labs/milkyway/types" - "github.com/milkyway-labs/milkyway/utils" - "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" - "github.com/milkyway-labs/milkyway/x/liquidvesting/types" -) - -var _ ibchooks.OnRecvPacketOverrideHooks = IBCHooks{} - -// IBCHooks represents the structure that implements the -// ibc_hooks.OnRecvPacketOverrideHooks interface to execute -// custom logic when an IBC token transfer packet is received. -type IBCHooks struct { - *keeper.Keeper -} - -func NewIBCHooks(k *keeper.Keeper) IBCHooks { - return IBCHooks{k} -} - -func (h IBCHooks) onRecvIcs20Packet( - ctx sdk.Context, - im ibchooks.IBCMiddleware, - packet chan4types.Packet, - relayer sdk.AccAddress, - ics20Packet transfertypes.FungibleTokenPacketData, -) exported.Acknowledgement { - objFound, object := utils.JSONStringHasKey(ics20Packet.GetMemo(), types.ModuleName) - if !objFound { - // Module payload not found, pass the packet to next middleware - return im.App.OnRecvPacket(ctx, packet, relayer) - } - - // Ensure the receiver is the x/liquidvesting module account - if ics20Packet.Receiver != h.ModuleAddress { - return milkywaytypes.NewEmitErrorAcknowledgement( - fmt.Errorf("the receiver should be the module address, got: %s, expected: %s", ics20Packet.Receiver, h.ModuleAddress), - ) - } - - // Parse the message from the memo - bytes, err := json.Marshal(object[types.ModuleName]) - if err != nil { - return milkywaytypes.NewEmitErrorAcknowledgement(err) - } - var depositMsg types.MsgDepositInsurance - if err := json.Unmarshal(bytes, &depositMsg); err != nil { - return milkywaytypes.NewEmitErrorAcknowledgement(err) - } - - // Ensure that the message is valid - if err := depositMsg.ValidateBasic(); err != nil { - return milkywaytypes.NewEmitErrorAcknowledgement(err) - } - - // Get the total deposit amount from the message - totalDeposit, err := depositMsg.GetTotalDepositAmount() - if err != nil { - return milkywaytypes.NewEmitErrorAcknowledgement(err) - } - - // Parse the amount from the ics20Packet - amount, ok := math.NewIntFromString(ics20Packet.GetAmount()) - if !ok { - return milkywaytypes.NewEmitErrorAcknowledgement(fmt.Errorf("invalid ics20 amount")) - } - receivedAmount := sdk.NewCoin(ics20Packet.Denom, amount) - - // Ensure that we have received the same amount of tokens - // as the ones that needs to be added to the users' insurance fund - if !receivedAmount.Equal(totalDeposit) { - return milkywaytypes.NewEmitErrorAcknowledgement( - fmt.Errorf("amount received is not equal to the amounts to deposit in the users' insurance fund"), - ) - } - - // Deposit the amounts into the users' insurance fund - for _, deposit := range depositMsg.Amounts { - accountAddress, err := sdk.AccAddressFromBech32(deposit.Depositor) - if err != nil { - return milkywaytypes.NewEmitErrorAcknowledgement(err) - } - err = h.AddToUserInsuranceFund(ctx, accountAddress, sdk.NewCoins(deposit.Amount)) - if err != nil { - return milkywaytypes.NewEmitErrorAcknowledgement(err) - } - - // Dispatch the deposit event. - ctx.EventManager().EmitEvent( - sdk.NewEvent(types.EventTypeDepositToUserInsuranceFund, - sdk.NewAttribute(types.AttributeKeyUser, deposit.Depositor), - sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), - ), - ) - } - - return im.App.OnRecvPacket(ctx, packet, relayer) -} - -// OnRecvPacketOverride implements ibc_hooks.OnRecvPacketOverrideHooks. -func (h IBCHooks) OnRecvPacketOverride( - im ibchooks.IBCMiddleware, - ctx sdk.Context, - packet chan4types.Packet, - relayer sdk.AccAddress, -) exported.Acknowledgement { - if isIcs20, ics20Packet := utils.IsIcs20Packet(packet.GetData()); isIcs20 { - return h.onRecvIcs20Packet(ctx, im, packet, relayer, ics20Packet) - } - - return im.App.OnRecvPacket(ctx, packet, relayer) -} diff --git a/x/liquidvesting/hooks/ibc_hooks_test.go b/x/liquidvesting/hooks/ibc_hooks_test.go deleted file mode 100644 index d71ff5ae2..000000000 --- a/x/liquidvesting/hooks/ibc_hooks_test.go +++ /dev/null @@ -1,193 +0,0 @@ -package hooks_test - -import ( - "encoding/json" - "fmt" - - "github.com/milkyway-labs/milkyway/x/liquidvesting/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" -) - -func (suite *IBCHooksTestSuite) TestKeeper_IBCHooks() { - user1 := authtypes.NewModuleAddress("user1") - user2 := authtypes.NewModuleAddress("user2") - moduleAddress := authtypes.NewModuleAddress(types.ModuleName).String() - - testCases := []struct { - name string - transferAmount sdk.Coin - sender string - receiver string - memo string - shouldErr bool - errorMessage string - check func(sdk.Context) - }{ - { - name: "empty memo", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: user2.String(), - memo: "", - shouldErr: false, - }, - { - name: "trigger by sending to a normal account", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: user2.String(), - memo: fmt.Sprintf(`{ - "liquidvesting": { - "amounts": [{ - "depositor": "%s", - "amount": { "amount": "1000", "denom": "foo" } - }] - }}`, user1.String()), - shouldErr: true, - errorMessage: fmt.Sprintf( - "ibc hook error: the receiver should be the module address, got: %s, expected: %s", - user2.String(), moduleAddress), - }, - { - name: "transfer not received denom", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: moduleAddress, - memo: fmt.Sprintf(`{"liquidvesting": { - "amounts": [ - { - "depositor": "%s", - "amount": { "amount": "600", "denom": "bar" } - }, - { - "depositor": "%s", - "amount": { "amount": "400", "denom": "bar" } - } - ]}}`, user1.String(), user2.String()), - shouldErr: true, - errorMessage: "ibc hook error: amount received is not equal to the amounts to deposit in the users' insurance fund", - }, - { - name: "multiple denoms in amount to deposit", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: moduleAddress, - memo: fmt.Sprintf(`{ - "liquidvesting": { - "amounts": [{ - "depositor": "%s", - "amount": { "amount": "1000", "denom": "foo" } - }, - { - "depositor": "%s", - "amount": { "amount": "1000", "denom": "bar" } - }] - }}`, user1.String(), user2.String()), - shouldErr: true, - errorMessage: "ibc hook error: can't deposit multiple denoms", - }, - { - name: "deposit more coins then received", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: moduleAddress, - memo: fmt.Sprintf(`{ - "liquidvesting": { - "amounts": [{ - "depositor": "%s", - "amount": { "amount": "400", "denom": "foo" } - }, - { - "depositor": "%s", - "amount": { "amount": "601", "denom": "foo" } - }] - }}`, user1.String(), user2.String()), - shouldErr: true, - errorMessage: "ibc hook error: amount received is not equal to the amounts to deposit in the users' insurance fund", - }, - { - name: "deposit less coins then received", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: moduleAddress, - memo: fmt.Sprintf(`{ - "liquidvesting": { - "amounts": [{ - "depositor": "%s", - "amount": { "amount": "300", "denom": "foo" } - }, - { - "depositor": "%s", - "amount": { "amount": "600", "denom": "foo" } - }] - }}`, user1.String(), user2.String()), - shouldErr: true, - errorMessage: "ibc hook error: amount received is not equal to the amounts to deposit in the users' insurance fund", - }, - { - name: "correct deposit", - transferAmount: sdk.NewInt64Coin("foo", 1000), - sender: user1.String(), - receiver: moduleAddress, - memo: fmt.Sprintf(`{ - "liquidvesting": { - "amounts": [{ - "depositor": "%s", - "amount": { "amount": "600", "denom": "foo" } - }, - { - "depositor": "%s", - "amount": { "amount": "400", "denom": "foo" } - }] - }}`, user1.String(), user2.String()), - shouldErr: false, - check: func(ctx sdk.Context) { - addrInsuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, user1) - suite.Assert().NoError(err) - suite.Assert().Equal("600foo", addrInsuranceFund.String()) - addr2InsuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, user2) - suite.Assert().NoError(err) - suite.Assert().Equal("400foo", addr2InsuranceFund.String()) - }, - }, - } - - for _, tc := range testCases { - suite.Run(tc.name, func() { - suite.SetupTest() - data := transfertypes.FungibleTokenPacketData{ - Denom: tc.transferAmount.Denom, - Amount: tc.transferAmount.Amount.String(), - Sender: tc.sender, - Receiver: tc.receiver, - Memo: tc.memo, - } - - dataBz, err := json.Marshal(&data) - suite.Assert().NoError(err) - - relayer := suite.ak.GetModuleAddress("relayer") - ack := suite.ibcm.OnRecvPacket(suite.ctx, channeltypes.Packet{ - Data: dataBz, - }, relayer) - ack.Acknowledgement() - - if tc.shouldErr { - suite.Assert().False(ack.Success()) - castedAck := ack.(channeltypes.Acknowledgement) - errorResponse := castedAck.Response.(*channeltypes.Acknowledgement_Error) - suite.Assert().Equal(tc.errorMessage, errorResponse.Error) - - if tc.check != nil { - tc.check(suite.ctx) - } - } else { - suite.Assert().True(ack.Success()) - } - }) - } -} diff --git a/x/liquidvesting/ibc_module.go b/x/liquidvesting/ibc_module.go new file mode 100644 index 000000000..4426fe2d9 --- /dev/null +++ b/x/liquidvesting/ibc_module.go @@ -0,0 +1,201 @@ +package liquidvesting + +import ( + "encoding/json" + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + + "github.com/milkyway-labs/milkyway/utils" + "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" + "github.com/milkyway-labs/milkyway/x/liquidvesting/types" +) + +type IBCModule struct { + keeper *keeper.Keeper + app porttypes.IBCModule +} + +// NewIBCMiddleware creates a new IBCModule given the keeper +func NewIBCMiddleware(app porttypes.IBCModule, k *keeper.Keeper) IBCModule { + return IBCModule{ + keeper: k, + app: app, + } +} + +// OnChanOpenInit implements the IBCModule interface +func (im IBCModule) OnChanOpenInit( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID string, + channelID string, + channelCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + version string, +) (string, error) { + return im.app.OnChanOpenInit( + ctx, + order, + connectionHops, + portID, + channelID, + channelCap, + counterparty, + version, + ) +} + +// OnChanOpenTry implements the IBCModule interface. +func (im IBCModule) OnChanOpenTry( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + counterpartyVersion string, +) (string, error) { + return im.app.OnChanOpenTry( + ctx, + order, + connectionHops, + portID, + channelID, + chanCap, + counterparty, + counterpartyVersion, + ) +} + +// OnChanOpenAck implements the IBCModule interface +func (im IBCModule) OnChanOpenAck( + ctx sdk.Context, + portID, + channelID string, + counterpartyChannelID string, + counterpartyVersion string, +) error { + // core/04-channel/types contains a helper function to split middleware and underlying app version + // _, _ := channeltypes.SplitChannelVersion(counterpartyVersion) + // doCustomLogic() + // call the underlying applications OnChanOpenTry callback + return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) +} + +// OnChanOpenConfirm implements the IBCModule interface +func (im IBCModule) OnChanOpenConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + // doCustomLogic() + return im.app.OnChanOpenConfirm(ctx, portID, channelID) +} + +// OnChanCloseInit implements the IBCModule interface +func (im IBCModule) OnChanCloseInit( + ctx sdk.Context, + portID, + channelID string, +) error { + // doCustomLogic() + return im.app.OnChanCloseInit(ctx, portID, channelID) +} + +// OnChanCloseConfirm implements the IBCModule interface +func (im IBCModule) OnChanCloseConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + // doCustomLogic() + return im.app.OnChanCloseConfirm(ctx, portID, channelID) +} + +// OnRecvPacket implements the IBCModule interface. A successful acknowledgement +// is returned if the packet data is successfully decoded and the receive application +// logic returns without error. +func (im IBCModule) OnRecvPacket( + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, +) ibcexported.Acknowledgement { + // Decode the packet data + data, ok := utils.DeserializeFungibleTokenPacketData(packet.GetData()) + if !ok { + return channeltypes.NewErrorAcknowledgement(errors.New("invalid packet data")) + } + + // Check if the packet contains a MsgDepositInsurance + msgDepositInsurance, found, err := im.containsMsgDepositInsurance(data) + if !found { + // If the packet does not contain a MsgDepositInsurance, just pass it to the application + return im.app.OnRecvPacket(ctx, packet, relayer) + } + + if err != nil { + return channeltypes.NewErrorAcknowledgement(err) + } + + // Handle the MsgDepositInsurance + if err := im.keeper.OnRecvPacket(ctx, data, msgDepositInsurance); err != nil { + return channeltypes.NewErrorAcknowledgement(err) + } + + return im.app.OnRecvPacket(ctx, packet, relayer) +} + +// containsMsgDepositInsurance checks if the packet data contains a MsgDepositInsurance. +// If the packet data contains a MsgDepositInsurance, it returns the message and true. +// Otherwise, it returns an empty MsgDepositInsurance and false. +func (im IBCModule) containsMsgDepositInsurance(data ibctransfertypes.FungibleTokenPacketData) (types.MsgDepositInsurance, bool, error) { + objFound, object := utils.JSONStringHasKey(data.GetMemo(), types.ModuleName) + if !objFound { + return types.MsgDepositInsurance{}, false, nil + } + + // Parse the message from the memo + bytes, err := json.Marshal(object[types.ModuleName]) + if err != nil { + return types.MsgDepositInsurance{}, true, err + } + + var depositMsg types.MsgDepositInsurance + if err = json.Unmarshal(bytes, &depositMsg); err != nil { + return types.MsgDepositInsurance{}, true, err + } + + return depositMsg, true, nil +} + +// OnAcknowledgementPacket implements the IBCModule interface +func (im IBCModule) OnAcknowledgementPacket( + ctx sdk.Context, + packet channeltypes.Packet, + acknowledgement []byte, + relayer sdk.AccAddress, +) error { + return im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) +} + +// OnTimeoutPacket implements the IBCModule interface +func (im IBCModule) OnTimeoutPacket( + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, +) error { + return im.app.OnTimeoutPacket(ctx, packet, relayer) +} + +// GetAppVersion implements the IBCModule interface +func (im IBCModule) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { + return ibctransfertypes.Version, true +} diff --git a/x/liquidvesting/keeper/burn_test.go b/x/liquidvesting/keeper/burn_test.go index 025fc3972..958cfd35f 100644 --- a/x/liquidvesting/keeper/burn_test.go +++ b/x/liquidvesting/keeper/burn_test.go @@ -8,13 +8,12 @@ import ( ) func (suite *KeeperTestSuite) TestKeeper_TestBurn() { - testAccount := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - vestedStake, err := types.GetVestedRepresentationDenom("stake") + vestedStakeDenom, err := types.GetVestedRepresentationDenom("stake") suite.Assert().NoError(err) testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) account string amount sdk.Coins shouldErr bool @@ -22,108 +21,168 @@ func (suite *KeeperTestSuite) TestKeeper_TestBurn() { }{ { name: "burn non vested representation fails", - setup: func(ctx sdk.Context) { - suite.fundAccount(ctx, testAccount, sdk.NewCoins( - sdk.NewInt64Coin("stake", 1000), sdk.NewInt64Coin("stake2", 200))) + store: func(ctx sdk.Context) { + suite.fundAccount(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins( + sdk.NewInt64Coin("stake", 1000), + sdk.NewInt64Coin("stake2", 200), + ), + ) }, - account: testAccount, + account: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", amount: sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)), shouldErr: true, }, { name: "burn with no funds fails", - setup: func(ctx sdk.Context) { - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin("test", 1000))) + store: func(ctx sdk.Context) { + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("test", 1000)), + ) }, - account: testAccount, - amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 1000)), + account: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 1000)), shouldErr: true, }, { name: "burn from user balance", - setup: func(ctx sdk.Context) { - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 1000))) - suite.fundAccount(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake2", 200))) + store: func(ctx sdk.Context) { + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)), + ) + suite.fundAccount(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), + ) }, - account: testAccount, - amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 1000)), + account: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 1000)), shouldErr: false, check: func(ctx sdk.Context) { - coins := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) - // we should have only the non vested coins + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().NoError(err) + + // Make sure the user only has non vested coins + coins := suite.bk.GetAllBalances(ctx, userAddr) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), coins) }, }, { name: "burn from delegations", - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { // Add some tokens to the user's insurance fund so they can restake // the vested representation - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 100))) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 100)), + ) + // Fund the account - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 1000))) - suite.fundAccount(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake2", 200))) + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)), + ) + suite.fundAccount(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), + ) // Delegate some vested representation to pool, service and operator - suite.createPool(1, vestedStake) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedStake, 200), testAccount) + suite.createPool(ctx, 1, vestedStakeDenom) + _, err = suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedStakeDenom, 200), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createService(1) - _, err = suite.rk.DelegateToService(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createService(ctx, 1) + _, err = suite.rk.DelegateToService(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createOperator(1) - _, err = suite.rk.DelegateToOperator(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createOperator(ctx, 1) + _, err = suite.rk.DelegateToOperator(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) }, - account: testAccount, - amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 1000)), + account: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 1000)), shouldErr: false, check: func(ctx sdk.Context) { - coins := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().NoError(err) + + coins := suite.bk.GetAllBalances(ctx, userAddr) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), coins) // Compute when the unbond will end unbondingTime := suite.rk.UnbondingTime(ctx) - unbodnEnd := ctx.BlockHeader().Time.Add(unbondingTime) + unbondEnd := ctx.BlockHeader().Time.Add(unbondingTime) + // Deque the values - values := suite.k.GetUnbondedCoinsFromQueue(ctx, unbodnEnd) + values := suite.k.GetUnbondedCoinsFromQueue(ctx, unbondEnd) suite.Assert().Len(values, 1) + // Check that we are burning the coins that have been delegated toBurnCoins := values[0].Amount - suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 800)), toBurnCoins) + suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 800)), toBurnCoins) }, }, { name: "burn more coins then owned delegations", - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { // Add some tokens to the user's insurance fund so they can restake // the vested representation - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 100))) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 100)), + ) + // Fund the account - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 1000))) - suite.fundAccount(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake2", 200))) + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)), + ) + suite.fundAccount(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), + ) // Delegate some vested representation to pool, service and operator - suite.createPool(1, vestedStake) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedStake, 200), testAccount) + suite.createPool(ctx, 1, vestedStakeDenom) + _, err = suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedStakeDenom, 200), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createService(1) - _, err = suite.rk.DelegateToService(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createService(ctx, 1) + _, err = suite.rk.DelegateToService(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createOperator(1) - _, err = suite.rk.DelegateToOperator(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createOperator(ctx, 1) + _, err = suite.rk.DelegateToOperator(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) }, - account: testAccount, - amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 2000)), + account: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + amount: sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 2000)), shouldErr: true, }, } @@ -132,19 +191,19 @@ func (suite *KeeperTestSuite) TestKeeper_TestBurn() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } - err := suite.k.BurnVestedRepresentation(suite.ctx, - sdk.MustAccAddressFromBech32(tc.account), tc.amount) + err = suite.k.BurnVestedRepresentation(ctx, sdk.MustAccAddressFromBech32(tc.account), tc.amount) if tc.shouldErr { suite.Require().Error(err) } else { suite.Require().NoError(err) if tc.check != nil { - tc.check(suite.ctx) + tc.check(ctx) } } }) @@ -152,23 +211,31 @@ func (suite *KeeperTestSuite) TestKeeper_TestBurn() { } func (suite *KeeperTestSuite) TestKeeper_TestIsBurner() { - burnerAccount := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - testAccount := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - testCases := []struct { - name string - account string - isBurner bool + name string + store func(ctx sdk.Context) + account string + shouldErr bool + expIsBurner bool }{ { - name: "not burner should fail", - account: testAccount, - isBurner: false, + name: "not burner should fail", + account: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + shouldErr: false, + expIsBurner: false, }, { - name: "valid burner", - account: burnerAccount, - isBurner: true, + name: "valid burner", + store: func(ctx sdk.Context) { + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + nil, + )) + suite.Assert().NoError(err) + }, + account: "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + expIsBurner: true, }, } @@ -176,15 +243,18 @@ func (suite *KeeperTestSuite) TestKeeper_TestIsBurner() { suite.Run(tc.name, func() { suite.SetupTest() - suite.Assert().NoError( - suite.k.SetParams(suite.ctx, types.NewParams( - math.LegacyMustNewDecFromStr("2.0"), - []string{burnerAccount}, - nil))) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } - isBurner, err := suite.k.IsBurner(suite.ctx, sdk.MustAccAddressFromBech32(tc.account)) - suite.Assert().NoError(err) - suite.Assert().Equal(tc.isBurner, isBurner) + isBurner, err := suite.k.IsBurner(ctx, sdk.MustAccAddressFromBech32(tc.account)) + if tc.shouldErr { + suite.Assert().Error(err) + } else { + suite.Assert().NoError(err) + suite.Assert().Equal(tc.expIsBurner, isBurner) + } }) } } diff --git a/x/liquidvesting/keeper/common_test.go b/x/liquidvesting/keeper/common_test.go index 8992d22cd..4e7b05f7a 100644 --- a/x/liquidvesting/keeper/common_test.go +++ b/x/liquidvesting/keeper/common_test.go @@ -5,7 +5,15 @@ import ( "testing" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/stretchr/testify/suite" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" @@ -33,8 +41,12 @@ func TestKeeperTestSuite(t *testing.T) { type KeeperTestSuite struct { suite.Suite + cdc codec.Codec ctx sdk.Context + liquidVestingModuleAddress sdk.AccAddress + + ak authkeeper.AccountKeeper bk *bankkeeper.Keeper ok *operatorskeeper.Keeper pk *poolskeeper.Keeper @@ -42,21 +54,29 @@ type KeeperTestSuite struct { rk *restakingkeeper.Keeper k *keeper.Keeper + + ibcm porttypes.IBCModule } func (suite *KeeperTestSuite) SetupTest() { data := testutils.NewKeeperTestData(suite.T()) - - // Context and codecs suite.ctx = data.Context + suite.cdc = data.Cdc - // Keepers + suite.liquidVestingModuleAddress = authtypes.NewModuleAddress(types.ModuleName) + + suite.ak = data.AccountKeeper suite.bk = &data.BankKeeper + suite.ibcm = data.IBCMiddleware suite.pk = data.PoolsKeeper + suite.ok = data.OperatorsKeeper suite.sk = data.ServicesKeeper suite.rk = data.RestakingKeeper suite.k = data.Keeper + + // Setup IBC + suite.ibcm = data.IBCMiddleware } // -------------------------------------------------------------------------------------------------------------------- @@ -64,42 +84,40 @@ func (suite *KeeperTestSuite) SetupTest() { // fundAccount add the given amount of coins to the account's balance func (suite *KeeperTestSuite) fundAccount(ctx sdk.Context, address string, amount sdk.Coins) { // Mint the tokens in the insurance fund. - suite.Assert().NoError(suite.bk.MintCoins(ctx, types.ModuleName, amount)) + err := suite.bk.MintCoins(ctx, types.ModuleName, amount) + suite.Assert().NoError(err) - suite.Assert().NoError(suite.bk.SendCoinsFromModuleToAccount( - ctx, types.ModuleName, sdk.MustAccAddressFromBech32(address), amount)) + err = suite.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(address), amount) + suite.Assert().NoError(err) } // mintVestedRepresentation mints the vested representation of the provided amount to // the user balance -func (suite *KeeperTestSuite) mintVestedRepresentation(address string, amount sdk.Coins) { +func (suite *KeeperTestSuite) mintVestedRepresentation(ctx sdk.Context, address string, amount sdk.Coins) { accAddress, err := sdk.AccAddressFromBech32(address) suite.Assert().NoError(err) - _, err = suite.k.MintVestedRepresentation( - suite.ctx, accAddress, amount, - ) + _, err = suite.k.MintVestedRepresentation(ctx, accAddress, amount) suite.Assert().NoError(err) } // fundAccountInsuranceFund add the given amount of coins to the account's insurance fund func (suite *KeeperTestSuite) fundAccountInsuranceFund(ctx sdk.Context, address string, amount sdk.Coins) { // Mint the tokens in the insurance fund. - suite.Assert().NoError(suite.bk.MintCoins(suite.ctx, types.ModuleName, amount)) + err := suite.bk.MintCoins(ctx, types.ModuleName, amount) + suite.Assert().NoError(err) // Assign those tokens to the user insurance fund userAddress, err := sdk.AccAddressFromBech32(address) suite.Assert().NoError(err) - suite.Assert().NoError(suite.k.AddToUserInsuranceFund( - ctx, - userAddress, - amount, - )) + + err = suite.k.AddToUserInsuranceFund(ctx, userAddress, amount) + suite.Assert().NoError(err) } // createPool creates a test pool with the given id and denom -func (suite *KeeperTestSuite) createPool(id uint32, denom string) { - err := suite.pk.SavePool(suite.ctx, poolstypes.Pool{ +func (suite *KeeperTestSuite) createPool(ctx sdk.Context, id uint32, denom string) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ ID: id, Denom: denom, Address: poolstypes.GetPoolAddress(id).String(), @@ -110,8 +128,8 @@ func (suite *KeeperTestSuite) createPool(id uint32, denom string) { } // createService creates a test service with the provided id -func (suite *KeeperTestSuite) createService(id uint32) { - err := suite.sk.CreateService(suite.ctx, servicestypes.NewService( +func (suite *KeeperTestSuite) createService(ctx sdk.Context, id uint32) { + err := suite.sk.CreateService(ctx, servicestypes.NewService( id, servicestypes.SERVICE_STATUS_ACTIVE, fmt.Sprintf("test %d", id), @@ -124,12 +142,85 @@ func (suite *KeeperTestSuite) createService(id uint32) { suite.Assert().NoError(err) } -func (suite *KeeperTestSuite) createOperator(id uint32) { - suite.Assert().NoError(suite.ok.RegisterOperator(suite.ctx, operatorstypes.NewOperator( +func (suite *KeeperTestSuite) createOperator(ctx sdk.Context, id uint32) { + err := suite.ok.RegisterOperator(ctx, operatorstypes.NewOperator( id, operatorstypes.OPERATOR_STATUS_ACTIVE, fmt.Sprintf("operator-%d", id), "", "", - fmt.Sprintf("operator-%d-admin", id)))) + fmt.Sprintf("operator-%d-admin", id), + )) + suite.Assert().NoError(err) +} + +// --------------------------------------------- +// ------------ IBC Mocks ----------------------- +// --------------------------------------------- +// do nothing ibc middleware +var ( + _ porttypes.IBCModule = mockIBCMiddleware{} + _ porttypes.ICS4Wrapper = mockIBCMiddleware{} +) + +type mockIBCMiddleware struct{} + +// GetAppVersion implements types.ICS4Wrapper. +func (m mockIBCMiddleware) GetAppVersion(ctx sdk.Context, portID string, channelID string) (string, bool) { + return "", false +} + +// SendPacket implements types.ICS4Wrapper. +func (m mockIBCMiddleware) SendPacket(ctx sdk.Context, chanCap *capabilitytypes.Capability, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (sequence uint64, err error) { + return 0, nil +} + +// WriteAcknowledgement implements types.ICS4Wrapper. +func (m mockIBCMiddleware) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, ack ibcexported.Acknowledgement) error { + return nil +} + +// OnAcknowledgementPacket implements types.IBCModule. +func (m mockIBCMiddleware) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { + return nil +} + +// OnChanCloseConfirm implements types.IBCModule. +func (m mockIBCMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID string, channelID string) error { + return nil +} + +// OnChanCloseInit implements types.IBCModule. +func (m mockIBCMiddleware) OnChanCloseInit(ctx sdk.Context, portID string, channelID string) error { + return nil +} + +// OnChanOpenAck implements types.IBCModule. +func (m mockIBCMiddleware) OnChanOpenAck(ctx sdk.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error { + return nil +} + +// OnChanOpenConfirm implements types.IBCModule. +func (m mockIBCMiddleware) OnChanOpenConfirm(ctx sdk.Context, portID string, channelID string) error { + return nil +} + +// OnChanOpenInit implements types.IBCModule. +func (m mockIBCMiddleware) OnChanOpenInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string) (string, error) { + return "", nil +} + +// OnChanOpenTry implements types.IBCModule. +func (m mockIBCMiddleware) OnChanOpenTry(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string) (version string, err error) { + return "", nil +} + +// OnRecvPacket implements types.IBCModule. +func (m mockIBCMiddleware) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) ibcexported.Acknowledgement { + return channeltypes.NewResultAcknowledgement([]byte{byte(1)}) +} + +// OnTimeoutPacket implements types.IBCModule. +func (m mockIBCMiddleware) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error { + return nil } diff --git a/x/liquidvesting/keeper/end_blocker_test.go b/x/liquidvesting/keeper/end_blocker_test.go index 8693c4e1c..3e560d030 100644 --- a/x/liquidvesting/keeper/end_blocker_test.go +++ b/x/liquidvesting/keeper/end_blocker_test.go @@ -10,8 +10,7 @@ import ( ) func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { - testAccount := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - vestedStake, err := types.GetVestedRepresentationDenom("stake") + vestedStakeDenom, err := types.GetVestedRepresentationDenom("stake") suite.Assert().NoError(err) testCases := []struct { @@ -37,32 +36,51 @@ func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { // Set the unbonding delegation time to 7 days suite.rk.SetParams(ctx, restakingtypes.NewParams(7*24*time.Hour, nil)) - // Add some tokens to the user's insurance fund so they can restake - // the vested representation - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 100))) + // Add some tokens to the user's insurance fund so they can restake the vested representation + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 100)), + ) + // Fund the account - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 1000))) - suite.fundAccount(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake2", 200))) + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)), + ) + suite.fundAccount(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), + ) // Delegate some vested representation to pool, service and operator - suite.createPool(1, vestedStake) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedStake, 200), testAccount) + suite.createPool(ctx, 1, vestedStakeDenom) + _, err = suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedStakeDenom, 200), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createService(1) - _, err = suite.rk.DelegateToService(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createService(ctx, 1) + _, err = suite.rk.DelegateToService(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createOperator(1) - _, err = suite.rk.DelegateToOperator(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createOperator(ctx, 1) + _, err = suite.rk.DelegateToOperator(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) // Burn all the coins err = suite.k.BurnVestedRepresentation(ctx, - sdk.MustAccAddressFromBech32(testAccount), - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 1000))) + sdk.MustAccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"), + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 1000)), + ) suite.Assert().NoError(err) }, updateCtx: func(ctx sdk.Context) sdk.Context { @@ -71,21 +89,19 @@ func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { shouldErr: false, check: func(ctx sdk.Context) { // The user shouldn't have the vested representation - userBalance := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) + userBalance := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4")) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), userBalance) // The burn queue should contain our record toBurnCoins := suite.k.GetUnbondedCoinsFromQueue(ctx, ctx.BlockTime().Add(4*24*time.Hour)) suite.Assert().Len(toBurnCoins, 1) - suite.Assert().Equal(testAccount, toBurnCoins[0].DelegatorAddress) - suite.Assert().Equal( - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 800)), - toBurnCoins[0].Amount) + suite.Assert().Equal("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", toBurnCoins[0].DelegatorAddress) + suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 800)), toBurnCoins[0].Amount) // The user insurance fund signal that there are still 20 coins used // to cover the restaking position - userInsuranceFund, err := suite.k.GetUserInsuranceFund(ctx, sdk.MustAccAddressFromBech32(testAccount)) + userInsuranceFund, err := suite.k.GetUserInsuranceFund(ctx, sdk.MustAccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4")) suite.Assert().NoError(err) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin("stake", 16)), userInsuranceFund.Used) }, @@ -103,30 +119,47 @@ func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { // Add some tokens to the user's insurance fund so they can restake // the vested representation - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 100))) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 100)), + ) + // Fund the account - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake", 1000))) - suite.fundAccount(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin("stake2", 200))) + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)), + ) + suite.fundAccount(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), + ) // Delegate some vested representation to pool, service and operator - suite.createPool(1, vestedStake) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedStake, 200), testAccount) + suite.createPool(ctx, 1, vestedStakeDenom) + _, err = suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedStakeDenom, 200), "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") suite.Assert().NoError(err) - suite.createService(1) - _, err = suite.rk.DelegateToService(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createService(ctx, 1) + _, err = suite.rk.DelegateToService(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) - suite.createOperator(1) - _, err = suite.rk.DelegateToOperator(ctx, 1, - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 300)), testAccount) + suite.createOperator(ctx, 1) + _, err = suite.rk.DelegateToOperator(ctx, + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 300)), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) // Burn all the coins err = suite.k.BurnVestedRepresentation(ctx, - sdk.MustAccAddressFromBech32(testAccount), - sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 700))) + sdk.MustAccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"), + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 700)), + ) suite.Assert().NoError(err) }, updateCtx: func(ctx sdk.Context) sdk.Context { @@ -135,14 +168,14 @@ func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { shouldErr: false, check: func(ctx sdk.Context) { // The user shouldn't have the vested representation - userBalance := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) + userBalance := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4")) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin("stake2", 200)), userBalance) // The burn queue should be empty suite.Assert().Len(suite.k.GetUnbondedCoinsFromQueue(ctx, ctx.BlockTime()), 0) // The user insurance fund should update properly - userInsuranceFund, err := suite.k.GetUserInsuranceFund(ctx, sdk.MustAccAddressFromBech32(testAccount)) + userInsuranceFund, err := suite.k.GetUserInsuranceFund(ctx, sdk.MustAccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4")) suite.Assert().NoError(err) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin("stake", 6)), userInsuranceFund.Used) }, @@ -152,8 +185,8 @@ func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { for _, tc := range testCases { suite.Run(tc.name, func() { suite.SetupTest() - ctx := suite.ctx + ctx, _ := suite.ctx.CacheContext() if tc.setupCtx != nil { ctx = tc.setupCtx(ctx) } @@ -167,11 +200,11 @@ func (suite *KeeperTestSuite) TestKeeper_EndBlocker() { } // run the restaking keep end block logic - suite.Assert().NoError(suite.rk.CompleteMatureUnbondingDelegations(ctx)) + err = suite.rk.CompleteMatureUnbondingDelegations(ctx) + suite.Assert().NoError(err) // run our end block logic - err := suite.k.CompleteBurnCoins(ctx) - + err = suite.k.CompleteBurnCoins(ctx) if tc.shouldErr { suite.Assert().Error(err) } else { diff --git a/x/liquidvesting/keeper/genesis_test.go b/x/liquidvesting/keeper/genesis_test.go index 247c94e88..e090c833f 100644 --- a/x/liquidvesting/keeper/genesis_test.go +++ b/x/liquidvesting/keeper/genesis_test.go @@ -12,11 +12,8 @@ import ( ) func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { - user1 := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - user2 := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - vestedStake, err := types.GetVestedRepresentationDenom("stake") + vestedStakeDenom, err := types.GetVestedRepresentationDenom("stake") suite.Assert().NoError(err) - blockTime := time.Date(2024, 1, 1, 12, 0, 0, 0, time.UTC) testCases := []struct { name string @@ -42,15 +39,15 @@ func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { name: "insurance funds are exported correctly", store: func(ctx sdk.Context) { // Fund the users' insurance fund - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2))) - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins(sdk.NewInt64Coin("stake", 2))) + suite.fundAccountInsuranceFund(ctx, "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2))) + suite.fundAccountInsuranceFund(ctx, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", sdk.NewCoins(sdk.NewInt64Coin("stake", 2))) }, expGenesis: &types.GenesisState{ Params: types.DefaultParams(), BurnCoins: nil, UserInsuranceFunds: []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), nil)), - types.NewUserInsuranceFundState(user2, types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin("stake", 2)), nil)), + types.NewUserInsuranceFundState("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), nil)), + types.NewUserInsuranceFundState("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin("stake", 2)), nil)), }, }, }, @@ -59,47 +56,88 @@ func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { setupCtx: func(ctx sdk.Context) sdk.Context { return ctx. WithBlockHeight(10). - WithBlockTime(blockTime) + WithBlockTime(time.Date(2024, 1, 1, 12, 0, 0, 0, time.UTC)) }, store: func(ctx sdk.Context) { // Set the unbonding delegation time to 7 days suite.rk.SetParams(ctx, restakingtypes.NewParams(7*24*time.Hour, nil)) // Fund the users' insurance fund - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2))) - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins(sdk.NewInt64Coin("stake", 2))) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), + ) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 2)), + ) // Mint the staked representations - suite.mintVestedRepresentation(user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100))) - suite.mintVestedRepresentation(user2, sdk.NewCoins(sdk.NewInt64Coin("stake", 100))) + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), + ) + suite.mintVestedRepresentation(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin("stake", 100)), + ) // Delegate the tokens so that they will be scheduled for burn after the // unbonding period - suite.createPool(1, vestedIBCDenom) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedIBCDenom, 100), user1) + suite.createPool(ctx, 1, vestedIBCDenom) + _, err = suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedIBCDenom, 100), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + ) suite.Assert().NoError(err) - suite.createPool(2, vestedStake) - _, err = suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedStake, 100), user2) + suite.createPool(ctx, 2, vestedStakeDenom) + _, err = suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedStakeDenom, 100), + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + ) suite.Assert().NoError(err) // Burn the coins - suite.Assert().NoError(suite.k.BurnVestedRepresentation(ctx, sdk.MustAccAddressFromBech32(user1), sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 100)))) - suite.Assert().NoError(suite.k.BurnVestedRepresentation(ctx, sdk.MustAccAddressFromBech32(user2), sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 100)))) + userAddr, err := sdk.AccAddressFromBech32("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre") + suite.Assert().NoError(err) + err = suite.k.BurnVestedRepresentation(ctx, userAddr, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 100))) + suite.Assert().NoError(err) + + userAddr, err = sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + err = suite.k.BurnVestedRepresentation(ctx, userAddr, sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 100))) + suite.Assert().NoError(err) }, expGenesis: &types.GenesisState{ Params: types.DefaultParams(), BurnCoins: []types.BurnCoins{ - types.NewBurnCoins(user1, blockTime.Add(7*24*time.Hour), sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 100))), - types.NewBurnCoins(user2, blockTime.Add(7*24*time.Hour), sdk.NewCoins(sdk.NewInt64Coin(vestedStake, 100))), + types.NewBurnCoins( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + time.Date(2024, 1, 1, 12, 0, 0, 0, time.UTC).Add(7*24*time.Hour), + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 100)), + ), + types.NewBurnCoins( + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + time.Date(2024, 1, 1, 12, 0, 0, 0, time.UTC).Add(7*24*time.Hour), + sdk.NewCoins(sdk.NewInt64Coin(vestedStakeDenom, 100)), + ), }, UserInsuranceFunds: []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)))), - types.NewUserInsuranceFundState(user2, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin("stake", 2)), - sdk.NewCoins(sdk.NewInt64Coin("stake", 2)))), + types.NewUserInsuranceFundState( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), + ), + ), + types.NewUserInsuranceFundState( + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin("stake", 2)), + sdk.NewCoins(sdk.NewInt64Coin("stake", 2)), + ), + ), }, }, }, @@ -109,7 +147,7 @@ func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { suite.Run(tc.name, func() { suite.SetupTest() - ctx := suite.ctx + ctx, _ := suite.ctx.CacheContext() if tc.setupCtx != nil { ctx = tc.setupCtx(ctx) } @@ -130,10 +168,9 @@ func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { } func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { - user1 := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) genesis *types.GenesisState shouldErr bool check func(ctx sdk.Context) @@ -155,7 +192,8 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { name: "should block negative insurance fund percentage", genesis: types.NewGenesisState( types.NewParams(math.LegacyNewDec(-1), nil, nil), - nil, nil, + nil, + nil, ), shouldErr: true, }, @@ -163,7 +201,8 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { name: "should block 0 insurance fund percentage", genesis: types.NewGenesisState( types.NewParams(math.LegacyNewDec(0), nil, nil), - nil, nil, + nil, + nil, ), shouldErr: true, }, @@ -171,7 +210,8 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { name: "should allow 100 insurance fund percentage", genesis: types.NewGenesisState( types.NewParams(math.LegacyNewDec(100), nil, nil), - nil, nil, + nil, + nil, ), shouldErr: false, check: func(ctx sdk.Context) { @@ -183,7 +223,8 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { name: "should block > 100 insurance fund percentage", genesis: types.NewGenesisState( types.NewParams(math.LegacyNewDec(101), nil, nil), - nil, nil, + nil, + nil, ), shouldErr: true, }, @@ -191,7 +232,8 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { name: "should block invalid minter address", genesis: types.NewGenesisState( types.NewParams(math.LegacyNewDec(2), nil, []string{"cosmos1fdsfd"}), - nil, nil, + nil, + nil, ), shouldErr: true, }, @@ -199,7 +241,8 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { name: "should block invalid burners address", genesis: types.NewGenesisState( types.NewParams(math.LegacyNewDec(2), []string{"cosmos1fdsfd"}, nil), - nil, nil, + nil, + nil, ), shouldErr: true, }, @@ -209,7 +252,10 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { types.DefaultParams(), nil, []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), sdk.NewCoins())), + types.NewUserInsuranceFundState( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), sdk.NewCoins()), + ), }, ), shouldErr: true, @@ -220,28 +266,23 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { types.DefaultParams(), nil, []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)))), + types.NewUserInsuranceFundState( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), + ), + ), }, ), shouldErr: true, }, { name: "should block insurance fund initialization if insurance fund don't cover delegations and undelegations", - genesis: types.NewGenesisState( - types.DefaultParams(), - nil, - []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)))), - }, - ), - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { // Send tokens to the liquid vesting module - suite.Assert().NoError( - suite.bk.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)))) + err := suite.bk.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2))) + suite.Assert().NoError(err) // Init the pools module testPool := poolstypes.NewPool(1, vestedIBCDenom) @@ -259,7 +300,7 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { Params: restakingtypes.DefaultParams(), UnbondingDelegations: []restakingtypes.UnbondingDelegation{ restakingtypes.NewPoolUnbondingDelegation( - user1, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", 1, 10, time.Date(2024, 1, 8, 12, 0, 0, 0, time.UTC), @@ -268,50 +309,65 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { ), }, Delegations: []restakingtypes.Delegation{ - restakingtypes.NewPoolDelegation(1, user1, - sdk.NewDecCoins(sdk.NewInt64DecCoin(testPool.GetSharesDenom(vestedIBCDenom), 50))), + restakingtypes.NewPoolDelegation( + 1, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewDecCoins(sdk.NewInt64DecCoin(testPool.GetSharesDenom(vestedIBCDenom), 50)), + ), }, } suite.rk.InitGenesis(ctx, restakingKeeperGenesis) }, + genesis: types.NewGenesisState( + types.DefaultParams(), + nil, + []types.UserInsuranceFundState{ + types.NewUserInsuranceFundState( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 2)), + ), + ), + }, + ), shouldErr: true, }, { name: "should initialize insurance fund properly", + store: func(ctx sdk.Context) { + err := suite.bk.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100))) + suite.Assert().NoError(err) + }, genesis: types.NewGenesisState( types.DefaultParams(), nil, []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), sdk.NewCoins())), + types.NewUserInsuranceFundState( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), + sdk.NewCoins(), + ), + ), }, ), - setup: func(ctx sdk.Context) { - err := suite.bk.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100))) - suite.Assert().NoError(err) - }, shouldErr: false, check: func(ctx sdk.Context) { - balance, err := suite.k.GetUserInsuranceFundBalance(ctx, sdk.MustAccAddressFromBech32(user1)) + userAddr, err := sdk.AccAddressFromBech32("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre") + suite.Assert().NoError(err) + + balance, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) suite.Assert().NoError(err) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), balance) }, }, { name: "should initialize insurance with delegations and undelegations", - genesis: types.NewGenesisState( - types.DefaultParams(), - nil, - []types.UserInsuranceFundState{ - types.NewUserInsuranceFundState(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), - // Set 3 as used to cover the delegation and the undelegation - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 3)))), - }, - ), - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { // Send tokens to the liquid vesting module - suite.Assert().NoError( - suite.bk.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)))) + err := suite.bk.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))) + suite.Assert().NoError(err) // Init the pools module testPool := poolstypes.NewPool(1, vestedIBCDenom) @@ -329,7 +385,7 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { Params: restakingtypes.DefaultParams(), UnbondingDelegations: []restakingtypes.UnbondingDelegation{ restakingtypes.NewPoolUnbondingDelegation( - user1, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", 1, 10, time.Date(2024, 1, 8, 12, 0, 0, 0, time.UTC), @@ -338,12 +394,29 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { ), }, Delegations: []restakingtypes.Delegation{ - restakingtypes.NewPoolDelegation(1, user1, - sdk.NewDecCoins(sdk.NewInt64DecCoin(testPool.GetSharesDenom(vestedIBCDenom), 50))), + restakingtypes.NewPoolDelegation( + 1, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewDecCoins(sdk.NewInt64DecCoin(testPool.GetSharesDenom(vestedIBCDenom), 50)), + ), }, } suite.rk.InitGenesis(ctx, restakingKeeperGenesis) }, + genesis: types.NewGenesisState( + types.DefaultParams(), + nil, + []types.UserInsuranceFundState{ + types.NewUserInsuranceFundState( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), + // Set 3 as used to cover the delegation and the undelegation + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 3)), + ), + ), + }, + ), shouldErr: false, }, { @@ -351,7 +424,11 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { genesis: types.NewGenesisState( types.DefaultParams(), []types.BurnCoins{ - types.NewBurnCoins(user1, time.Now(), sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 2))), + types.NewBurnCoins( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + time.Now(), + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 2)), + ), }, nil, ), @@ -359,12 +436,12 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { }, { name: "should initialize burn coins properly", - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { restakingKeeperGenesis := &restakingtypes.GenesisState{ Params: restakingtypes.DefaultParams(), UnbondingDelegations: []restakingtypes.UnbondingDelegation{ restakingtypes.NewPoolUnbondingDelegation( - user1, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", 1, 10, time.Date(2024, 1, 8, 12, 0, 0, 0, time.UTC), @@ -378,7 +455,11 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { genesis: types.NewGenesisState( types.DefaultParams(), []types.BurnCoins{ - types.NewBurnCoins(user1, time.Now(), sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 2))), + types.NewBurnCoins( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + time.Now(), + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 2)), + ), }, nil, ), @@ -386,8 +467,7 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { check: func(ctx sdk.Context) { burnCoins := suite.k.GetAllBurnCoins(ctx) suite.Assert().Len(burnCoins, 1) - suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 2)), - burnCoins[0].Amount) + suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 2)), burnCoins[0].Amount) }, }, } @@ -396,10 +476,12 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } - err := suite.k.InitGenesis(suite.ctx, tc.genesis) + + err := suite.k.InitGenesis(ctx, tc.genesis) if tc.shouldErr { suite.Require().Error(err) } else { @@ -407,7 +489,7 @@ func (suite *KeeperTestSuite) TestKeepr_InitGenesis() { } if tc.check != nil { - tc.check(suite.ctx) + tc.check(ctx) } }) } diff --git a/x/liquidvesting/keeper/grpc_query_test.go b/x/liquidvesting/keeper/grpc_query_test.go index 7421ec02c..6ac4a3de6 100644 --- a/x/liquidvesting/keeper/grpc_query_test.go +++ b/x/liquidvesting/keeper/grpc_query_test.go @@ -10,12 +10,9 @@ import ( ) func (suite *KeeperTestSuite) TestQuerier_InsuranceFund() { - user1 := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - user2 := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) expBalance sdk.Coins }{ { @@ -24,17 +21,25 @@ func (suite *KeeperTestSuite) TestQuerier_InsuranceFund() { }, { name: "single deposit", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) }, expBalance: sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), }, { name: "multiple deposits", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins( - sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000)), + ) }, expBalance: sdk.NewCoins( sdk.NewInt64Coin(IBCDenom, 2000), @@ -47,12 +52,13 @@ func (suite *KeeperTestSuite) TestQuerier_InsuranceFund() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } querier := keeper.NewQuerier(suite.k) - resp, err := querier.InsuranceFund(suite.ctx, types.NewQueryInsuranceFundRequest()) + resp, err := querier.InsuranceFund(ctx, types.NewQueryInsuranceFundRequest()) suite.Assert().NoError(err) suite.Assert().Equal(tc.expBalance, resp.Amount) }) @@ -60,12 +66,9 @@ func (suite *KeeperTestSuite) TestQuerier_InsuranceFund() { } func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFund() { - user1 := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - user2 := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) shouldErr bool request *types.QueryUserInsuranceFundRequest expBalance sdk.Coins @@ -83,21 +86,29 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFund() { }, { name: "single deposit", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) }, - request: types.NewQueryUserInsuranceFundRequest(user1), + request: types.NewQueryUserInsuranceFundRequest("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"), shouldErr: false, expBalance: sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), }, { name: "multiple deposits", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins( - sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000)), + ) }, - request: types.NewQueryUserInsuranceFundRequest(user2), + request: types.NewQueryUserInsuranceFundRequest("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"), shouldErr: false, expBalance: sdk.NewCoins( sdk.NewInt64Coin(IBCDenom, 1000), @@ -106,20 +117,34 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFund() { }, { name: "with used amount", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.mintVestedRepresentation(user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) // Add other tokens - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins( - sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000))) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins( + sdk.NewInt64Coin(IBCDenom, 1000), + sdk.NewInt64Coin("stake", 1000), + ), + ) // Delegate to the pool - suite.createPool(1, vestedIBCDenom) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedIBCDenom, 1000), user1) + suite.createPool(ctx, 1, vestedIBCDenom) + _, err := suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedIBCDenom, 1000), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + ) suite.Require().NoError(err) }, - request: types.NewQueryUserInsuranceFundRequest(user1), + request: types.NewQueryUserInsuranceFundRequest("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"), shouldErr: false, expBalance: sdk.NewCoins( sdk.NewInt64Coin(IBCDenom, 1000), @@ -134,12 +159,13 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFund() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } querier := keeper.NewQuerier(suite.k) - resp, err := querier.UserInsuranceFund(suite.ctx, tc.request) + resp, err := querier.UserInsuranceFund(ctx, tc.request) if tc.shouldErr { suite.Assert().Error(err) } else { @@ -152,12 +178,9 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFund() { } func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFunds() { - user1 := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - user2 := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) shouldErr bool request *types.QueryUserInsuranceFundsRequest expInsuranceFunds []types.UserInsuranceFundData @@ -169,26 +192,49 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFunds() { }, { name: "no pagination", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins( - sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000)), + ) }, request: types.NewQueryUserInsuranceFundsRequest(nil), shouldErr: false, expInsuranceFunds: []types.UserInsuranceFundData{ - types.NewUserInsuranceFundData(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), nil)), - types.NewUserInsuranceFundData(user2, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000)), nil)), + types.NewUserInsuranceFundData( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + nil, + ), + ), + types.NewUserInsuranceFundData( + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + types.NewInsuranceFund( + sdk.NewCoins( + sdk.NewInt64Coin(IBCDenom, 1000), + sdk.NewInt64Coin("stake", 1000), + ), + nil, + ), + ), }, }, { name: "respects handle pagination", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.fundAccountInsuranceFund(ctx, user2, sdk.NewCoins( - sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.fundAccountInsuranceFund(ctx, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000), sdk.NewInt64Coin("stake", 1000)), + ) }, request: types.NewQueryUserInsuranceFundsRequest(&query.PageRequest{ Offset: 0, @@ -196,19 +242,33 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFunds() { }), shouldErr: false, expInsuranceFunds: []types.UserInsuranceFundData{ - types.NewUserInsuranceFundData(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), nil)), + types.NewUserInsuranceFundData( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + nil, + ), + ), }, }, { name: "with utilization", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.mintVestedRepresentation(user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) // Delegate to the pool - suite.createPool(1, vestedIBCDenom) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedIBCDenom, 1000), user1) + suite.createPool(ctx, 1, vestedIBCDenom) + _, err := suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedIBCDenom, 1000), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + ) suite.Require().NoError(err) }, request: types.NewQueryUserInsuranceFundsRequest(&query.PageRequest{ @@ -217,22 +277,29 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFunds() { }), shouldErr: false, expInsuranceFunds: []types.UserInsuranceFundData{ - types.NewUserInsuranceFundData(user1, types.NewInsuranceFund( - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 20)))), + types.NewUserInsuranceFundData( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + types.NewInsuranceFund( + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 20)), + ), + ), }, }, } for _, tc := range testCases { + tc := tc suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } querier := keeper.NewQuerier(suite.k) - resp, err := querier.UserInsuranceFunds(suite.ctx, tc.request) + resp, err := querier.UserInsuranceFunds(ctx, tc.request) if tc.shouldErr { suite.Assert().Error(err) } else { @@ -244,11 +311,9 @@ func (suite *KeeperTestSuite) TestQuerier_UserInsuranceFunds() { } func (suite *KeeperTestSuite) TestQuerier_UserRestakableAssets() { - user1 := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) shouldErr bool request *types.QueryUserRestakableAssetsRequest expBalance sdk.Coins @@ -265,25 +330,31 @@ func (suite *KeeperTestSuite) TestQuerier_UserRestakableAssets() { }, { name: "1% insurance fund", - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { suite.Assert().NoError(suite.k.SetParams(ctx, types.NewParams( math.LegacyMustNewDecFromStr("1"), nil, nil, ))) - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1))) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)), + ) }, - request: types.NewQueryUserRestakableAssetsRequest(user1), + request: types.NewQueryUserRestakableAssetsRequest("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"), shouldErr: false, expBalance: sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 100)), }, { name: "5% insurance fund", - setup: func(ctx sdk.Context) { + store: func(ctx sdk.Context) { suite.Assert().NoError(suite.k.SetParams(ctx, types.NewParams( math.LegacyMustNewDecFromStr("5"), nil, nil, ))) - suite.fundAccountInsuranceFund(ctx, user1, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1))) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)), + ) }, - request: types.NewQueryUserRestakableAssetsRequest(user1), + request: types.NewQueryUserRestakableAssetsRequest("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"), shouldErr: false, expBalance: sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 20)), }, @@ -293,12 +364,13 @@ func (suite *KeeperTestSuite) TestQuerier_UserRestakableAssets() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } querier := keeper.NewQuerier(suite.k) - resp, err := querier.UserRestakableAssets(suite.ctx, tc.request) + resp, err := querier.UserRestakableAssets(ctx, tc.request) if tc.shouldErr { suite.Assert().Error(err) } else { diff --git a/x/liquidvesting/keeper/ibc.go b/x/liquidvesting/keeper/ibc.go new file mode 100644 index 000000000..27de73f8d --- /dev/null +++ b/x/liquidvesting/keeper/ibc.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + + "github.com/milkyway-labs/milkyway/x/liquidvesting/types" +) + +// OnRecvPacket processes the packet received from the IBC handler +func (k *Keeper) OnRecvPacket( + ctx sdk.Context, + data transfertypes.FungibleTokenPacketData, + msgDepositInsurance types.MsgDepositInsurance, +) error { + + // Ensure the receiver is the x/liquidvesting module account + if data.Receiver != k.ModuleAddress { + return fmt.Errorf("the receiver should be the module address, got: %s, expected: %s", data.Receiver, k.ModuleAddress) + } + + // Ensure that the message is valid + if err := msgDepositInsurance.ValidateBasic(); err != nil { + return err + } + + // Get the total deposit amount from the message + totalDeposit, err := msgDepositInsurance.GetTotalDepositAmount() + if err != nil { + return err + } + + // Parse the amount from the ics20Packet + amount, ok := math.NewIntFromString(data.GetAmount()) + if !ok { + return fmt.Errorf("invalid ics20 amount") + } + receivedAmount := sdk.NewCoin(data.Denom, amount) + + // Ensure that we have received the same amount of tokens + // as the ones that needs to be added to the users' insurance fund + if !receivedAmount.Equal(totalDeposit) { + return fmt.Errorf("amount received is not equal to the amounts to deposit in the users' insurance fund") + } + + // Deposit the amounts into the users' insurance fund + for _, deposit := range msgDepositInsurance.Amounts { + accountAddress, err := sdk.AccAddressFromBech32(deposit.Depositor) + if err != nil { + return err + } + err = k.AddToUserInsuranceFund(ctx, accountAddress, sdk.NewCoins(deposit.Amount)) + if err != nil { + return err + } + + // Dispatch the deposit event. + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.EventTypeDepositToUserInsuranceFund, + sdk.NewAttribute(types.AttributeKeyUser, deposit.Depositor), + sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), + ), + ) + } + + return nil +} diff --git a/x/liquidvesting/keeper/ibc_test.go b/x/liquidvesting/keeper/ibc_test.go new file mode 100644 index 000000000..f5397a61f --- /dev/null +++ b/x/liquidvesting/keeper/ibc_test.go @@ -0,0 +1,253 @@ +package keeper_test + +import ( + "encoding/json" + "fmt" + + "github.com/milkyway-labs/milkyway/x/liquidvesting/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" +) + +func (suite *KeeperTestSuite) TestKeeper_IBCHooks() { + testCases := []struct { + name string + transferAmount sdk.Coin + sender string + receiver string + memo string + shouldErr bool + check func(sdk.Context) + }{ + { + name: "empty memo", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + memo: "", + }, + { + name: "trigger by sending to a normal account", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + memo: fmt.Sprintf(`{ + "liquidvesting": { + "amounts": [{ + "depositor": "%s", + "amount": { "amount": "1000", "denom": "foo" } + }] + }}`, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"), + shouldErr: true, + check: func(ctx sdk.Context) { + // Make sure the user's insurance fund is not updated + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Empty(insuranceFund) + }, + }, + { + name: "transfer not received denom", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: authtypes.NewModuleAddress(types.ModuleName).String(), + memo: fmt.Sprintf(`{"liquidvesting": { + "amounts": [ + { + "depositor": "%s", + "amount": { "amount": "600", "denom": "bar" } + }, + { + "depositor": "%s", + "amount": { "amount": "400", "denom": "bar" } + } + ]}}`, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + check: func(ctx sdk.Context) { + // Make sure the user's insurance fund is not updated + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Empty(insuranceFund) + }, + }, + { + name: "multiple denoms in amount to deposit", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: authtypes.NewModuleAddress(types.ModuleName).String(), + memo: fmt.Sprintf(`{ + "liquidvesting": { + "amounts": [{ + "depositor": "%s", + "amount": { "amount": "1000", "denom": "foo" } + }, + { + "depositor": "%s", + "amount": { "amount": "1000", "denom": "bar" } + }] + }}`, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + check: func(ctx sdk.Context) { + // Make sure the user's insurance fund is not updated + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Empty(insuranceFund) + }, + }, + { + name: "deposit more coins then received", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: authtypes.NewModuleAddress(types.ModuleName).String(), + memo: fmt.Sprintf(`{ + "liquidvesting": { + "amounts": [{ + "depositor": "%s", + "amount": { "amount": "400", "denom": "foo" } + }, + { + "depositor": "%s", + "amount": { "amount": "601", "denom": "foo" } + }] + }}`, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + check: func(ctx sdk.Context) { + // Make sure the user's insurance fund is not updated + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Empty(insuranceFund) + }, + }, + { + name: "deposit less coins then received", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: authtypes.NewModuleAddress(types.ModuleName).String(), + memo: fmt.Sprintf(`{ + "liquidvesting": { + "amounts": [{ + "depositor": "%s", + "amount": { "amount": "300", "denom": "foo" } + }, + { + "depositor": "%s", + "amount": { "amount": "600", "denom": "foo" } + }] + }}`, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + check: func(ctx sdk.Context) { + // Make sure the user's insurance fund is not updated + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Empty(insuranceFund) + }, + }, + { + name: "correct deposit", + transferAmount: sdk.NewInt64Coin("foo", 1000), + sender: "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + receiver: authtypes.NewModuleAddress(types.ModuleName).String(), + memo: fmt.Sprintf(`{ + "liquidvesting": { + "amounts": [{ + "depositor": "%s", + "amount": { "amount": "600", "denom": "foo" } + }, + { + "depositor": "%s", + "amount": { "amount": "400", "denom": "foo" } + }] + }}`, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + check: func(ctx sdk.Context) { + // Make sure the first insurance fund is updated + userAddr, err := sdk.AccAddressFromBech32("cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Equal("600foo", insuranceFund.String()) + + // Make sure the second insurance fund is updated + userAddr, err = sdk.AccAddressFromBech32("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd") + suite.Assert().NoError(err) + + insuranceFund, err = suite.k.GetUserInsuranceFundBalance(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Equal("400foo", insuranceFund.String()) + }, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + suite.SetupTest() + + // Cache the context + ctx, _ := suite.ctx.CacheContext() + + // Build the data to be put inside the packet + dataBz, err := json.Marshal(&transfertypes.FungibleTokenPacketData{ + Denom: tc.transferAmount.Denom, + Amount: tc.transferAmount.Amount.String(), + Sender: tc.sender, + Receiver: tc.receiver, + Memo: tc.memo, + }) + suite.Assert().NoError(err) + + // Build the packet + packet := channeltypes.Packet{Data: dataBz} + + // Receive the packet + ack := suite.ibcm.OnRecvPacket(ctx, packet, suite.ak.GetModuleAddress("relayer")) + ack.Acknowledgement() + + if tc.shouldErr { + suite.Assert().False(ack.Success()) + + castedAck := ack.(channeltypes.Acknowledgement) + errorResponse := castedAck.Response.(*channeltypes.Acknowledgement_Error) + suite.Require().NotEmpty(errorResponse.Error) + } else { + suite.Assert().True(ack.Success()) + } + + if tc.check != nil { + tc.check(ctx) + } + }) + } +} diff --git a/x/liquidvesting/keeper/insurance_fund_test.go b/x/liquidvesting/keeper/insurance_fund_test.go index 6f8425c26..ad624759f 100644 --- a/x/liquidvesting/keeper/insurance_fund_test.go +++ b/x/liquidvesting/keeper/insurance_fund_test.go @@ -24,23 +24,32 @@ func (suite *KeeperTestSuite) TestKeeper_AddToInsuranceFund() { for _, tc := range testCases { suite.Run(tc.name, func() { + suite.SetupTest() + + // Cache the context + ctx, _ := suite.ctx.CacheContext() + for address, amount := range tc.deposits { // Mint the coins that should be in the module - suite.Assert().NoError( - suite.bk.MintCoins(suite.ctx, types.ModuleName, amount)) - accAddress := sdk.MustAccAddressFromBech32(address) - suite.Assert().NoError( - suite.k.AddToUserInsuranceFund(suite.ctx, accAddress, amount)) + err := suite.bk.MintCoins(ctx, types.ModuleName, amount) + suite.Assert().NoError(err) + + accAddress, err := sdk.AccAddressFromBech32(address) + suite.Require().NoError(err) + err = suite.k.AddToUserInsuranceFund(ctx, accAddress, amount) + suite.Assert().NoError(err) } for address, expectedAmount := range tc.deposits { - accAddress := sdk.MustAccAddressFromBech32(address) - amount, err := suite.k.GetUserInsuranceFundBalance(suite.ctx, accAddress) + accAddress, err := sdk.AccAddressFromBech32(address) + suite.Require().NoError(err) + + amount, err := suite.k.GetUserInsuranceFundBalance(ctx, accAddress) suite.Assert().NoError(err) suite.Assert().Equal(expectedAmount, amount) } - balance, err := suite.k.GetInsuranceFundBalance(suite.ctx) + balance, err := suite.k.GetInsuranceFundBalance(ctx) suite.Assert().NoError(err) suite.Assert().Equal(tc.expectedTotalAmount, balance) }) @@ -52,7 +61,7 @@ func (suite *KeeperTestSuite) TestKeeper_WithdrawFromInsuranceFund() { name string from string amount sdk.Coins - setup func() + store func(ctx sdk.Context) shouldErr bool }{ { @@ -62,8 +71,8 @@ func (suite *KeeperTestSuite) TestKeeper_WithdrawFromInsuranceFund() { sdk.NewInt64Coin("stake", 100), sdk.NewInt64Coin("stake2", 50), ), - setup: func() { - suite.fundAccountInsuranceFund(suite.ctx, + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", sdk.NewCoins( sdk.NewInt64Coin("stake", 50), @@ -79,13 +88,14 @@ func (suite *KeeperTestSuite) TestKeeper_WithdrawFromInsuranceFund() { sdk.NewInt64Coin("stake", 200), sdk.NewInt64Coin("stake2", 100), ), - setup: func() { - suite.fundAccountInsuranceFund(suite.ctx, + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", sdk.NewCoins( sdk.NewInt64Coin("stake", 200), sdk.NewInt64Coin("stake2", 100), - )) + ), + ) }, shouldErr: false, }, @@ -94,9 +104,16 @@ func (suite *KeeperTestSuite) TestKeeper_WithdrawFromInsuranceFund() { for _, tc := range testCases { suite.Run(tc.name, func() { suite.SetupTest() - tc.setup() - accAddr := sdk.MustAccAddressFromBech32(tc.from) - err := suite.k.WithdrawFromUserInsuranceFund(suite.ctx, accAddr, tc.amount) + + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + userAddr, err := sdk.AccAddressFromBech32(tc.from) + suite.Require().NoError(err) + + err = suite.k.WithdrawFromUserInsuranceFund(ctx, userAddr, tc.amount) if tc.shouldErr { suite.Assert().Error(err) } else { diff --git a/x/liquidvesting/keeper/mint_test.go b/x/liquidvesting/keeper/mint_test.go index 748199902..cb6af69c9 100644 --- a/x/liquidvesting/keeper/mint_test.go +++ b/x/liquidvesting/keeper/mint_test.go @@ -9,7 +9,7 @@ import ( func (suite *KeeperTestSuite) TestKeepr_MintVestedRepresentation() { testCases := []struct { name string - setup func() + store func(ctx sdk.Context) to string amount sdk.Coins shouldErr bool @@ -40,17 +40,20 @@ func (suite *KeeperTestSuite) TestKeepr_MintVestedRepresentation() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup() + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } - accAddr := sdk.MustAccAddressFromBech32(tc.to) - _, err := suite.k.MintVestedRepresentation(suite.ctx, accAddr, tc.amount) + userAddr, err := sdk.AccAddressFromBech32(tc.to) + suite.Require().NoError(err) + + _, err = suite.k.MintVestedRepresentation(ctx, userAddr, tc.amount) if tc.shouldErr { suite.Require().Error(err) } else { suite.Require().NoError(err) - tc.check(suite.ctx) + tc.check(ctx) } }) } diff --git a/x/liquidvesting/keeper/msg_server_test.go b/x/liquidvesting/keeper/msg_server_test.go index 63a88dac6..514ccddb2 100644 --- a/x/liquidvesting/keeper/msg_server_test.go +++ b/x/liquidvesting/keeper/msg_server_test.go @@ -10,12 +10,9 @@ import ( ) func (suite *KeeperTestSuite) TestMsgServer_MintVestedRepresentation() { - burnerAccount := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - minterAccount := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - testAccount := "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn" - testCases := []struct { name string + store func(ctx sdk.Context) msg *types.MsgMintVestedRepresentation shouldErr bool expEvents sdk.Events @@ -23,31 +20,67 @@ func (suite *KeeperTestSuite) TestMsgServer_MintVestedRepresentation() { }{ { name: "burner can't mint", - msg: types.NewMsgMintVestedRepresentation(burnerAccount, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))), + store: func(ctx sdk.Context) { + // Store the params + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + []string{"cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"}, + )) + suite.Assert().NoError(err) + }, + msg: types.NewMsgMintVestedRepresentation( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ), shouldErr: true, }, { name: "can't mint vested representation of vested representation coin", - msg: types.NewMsgMintVestedRepresentation(minterAccount, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000))), + store: func(ctx sdk.Context) { + // Store the params + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + []string{"cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"}, + )) + suite.Assert().NoError(err) + }, + msg: types.NewMsgMintVestedRepresentation( + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000)), + ), shouldErr: true, }, { name: "mint properly", - msg: types.NewMsgMintVestedRepresentation(minterAccount, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))), + store: func(ctx sdk.Context) { + // Store the params + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + []string{"cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"}, + )) + suite.Assert().NoError(err) + }, + msg: types.NewMsgMintVestedRepresentation( + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ), shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( types.EventTypeMintVestedRepresentation, - sdk.NewAttribute(sdk.AttributeKeySender, minterAccount), + sdk.NewAttribute(sdk.AttributeKeySender, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"), sdk.NewAttribute(sdk.AttributeKeyAmount, "1000"+vestedIBCDenom), - sdk.NewAttribute(types.AttributeKeyReceiver, testAccount), + sdk.NewAttribute(types.AttributeKeyReceiver, "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn"), ), }, check: func(ctx sdk.Context) { - balances := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) + balances := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32("cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn")) suite.Assert().Equal( sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000)), balances, @@ -60,24 +93,24 @@ func (suite *KeeperTestSuite) TestMsgServer_MintVestedRepresentation() { suite.Run(tc.name, func() { suite.SetupTest() - suite.Assert().NoError(suite.k.SetParams(suite.ctx, types.NewParams( - math.LegacyMustNewDecFromStr("2.0"), - []string{burnerAccount}, - []string{minterAccount}, - ))) + // Cache the context + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } msgServer := keeper.NewMsgServer(suite.k) - _, err := msgServer.MintVestedRepresentation(suite.ctx, tc.msg) + _, err := msgServer.MintVestedRepresentation(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) for _, event := range tc.expEvents { - suite.Require().Contains(suite.ctx.EventManager().Events(), event) + suite.Require().Contains(ctx.EventManager().Events(), event) } if tc.check != nil { - tc.check(suite.ctx) + tc.check(ctx) } } }) @@ -85,13 +118,9 @@ func (suite *KeeperTestSuite) TestMsgServer_MintVestedRepresentation() { } func (suite *KeeperTestSuite) TestMsgServer_BurnVestedRepresentation() { - burnerAccount := "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - minterAccount := "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4" - testAccount := "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn" - testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) msg *types.MsgBurnVestedRepresentation shouldErr bool expEvents sdk.Events @@ -99,79 +128,114 @@ func (suite *KeeperTestSuite) TestMsgServer_BurnVestedRepresentation() { }{ { name: "minter can't burn", - msg: types.NewMsgBurnVestedRepresentation(minterAccount, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000))), - setup: func(ctx sdk.Context) { - suite.mintVestedRepresentation(testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + []string{"cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"}, + )) + suite.Assert().NoError(err) + + suite.mintVestedRepresentation(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) }, + msg: types.NewMsgBurnVestedRepresentation( + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000)), + ), + shouldErr: true, }, { name: "can't burn normal coins", - msg: types.NewMsgBurnVestedRepresentation(burnerAccount, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))), - setup: func(ctx sdk.Context) { - suite.fundAccount(ctx, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.mintVestedRepresentation(testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + []string{"cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"}, + )) + suite.Assert().NoError(err) + + suite.fundAccount(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + suite.mintVestedRepresentation(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) }, + msg: types.NewMsgBurnVestedRepresentation( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ), shouldErr: true, }, { name: "burn properly", - msg: types.NewMsgBurnVestedRepresentation(burnerAccount, testAccount, - sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000))), - shouldErr: false, - setup: func(ctx sdk.Context) { - suite.mintVestedRepresentation(testAccount, - sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) + store: func(ctx sdk.Context) { + err := suite.k.SetParams(ctx, types.NewParams( + math.LegacyMustNewDecFromStr("2.0"), + []string{"cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"}, + []string{"cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4"}, + )) + suite.Assert().NoError(err) + + suite.mintVestedRepresentation(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) }, + msg: types.NewMsgBurnVestedRepresentation( + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 1000)), + ), + shouldErr: false, expEvents: sdk.Events{ sdk.NewEvent( types.EventTypeBurnVestedRepresentation, - sdk.NewAttribute(sdk.AttributeKeySender, burnerAccount), + sdk.NewAttribute(sdk.AttributeKeySender, "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre"), sdk.NewAttribute(sdk.AttributeKeyAmount, "1000"+vestedIBCDenom), - sdk.NewAttribute(types.AttributeKeyUser, testAccount), + sdk.NewAttribute(types.AttributeKeyUser, "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn"), ), }, check: func(ctx sdk.Context) { - balances := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) - suite.Assert().Equal( - sdk.NewCoins(), - balances, - ) + userAddr, err := sdk.AccAddressFromBech32("cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn") + suite.Require().NoError(err) + + userBalance := suite.bk.GetAllBalances(ctx, userAddr) + suite.Assert().Empty(userBalance) }, }, } for _, tc := range testCases { + tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.Assert().NoError(suite.k.SetParams(suite.ctx, types.NewParams( - math.LegacyMustNewDecFromStr("2.0"), - []string{burnerAccount}, - []string{minterAccount}, - ))) - - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } msgServer := keeper.NewMsgServer(suite.k) - _, err := msgServer.BurnVestedRepresentation(suite.ctx, tc.msg) + _, err := msgServer.BurnVestedRepresentation(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) for _, event := range tc.expEvents { - suite.Require().Contains(suite.ctx.EventManager().Events(), event) + suite.Require().Contains(ctx.EventManager().Events(), event) } if tc.check != nil { - tc.check(suite.ctx) + tc.check(ctx) } } }) @@ -179,57 +243,82 @@ func (suite *KeeperTestSuite) TestMsgServer_BurnVestedRepresentation() { } func (suite *KeeperTestSuite) TestMsgServer_WithdrawInsuranceFund() { - testAccount := "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn" - testCases := []struct { name string - setup func(ctx sdk.Context) + store func(ctx sdk.Context) msg *types.MsgWithdrawInsuranceFund shouldErr bool check func(ctx sdk.Context) expEvents sdk.Events }{ { - name: "can't withdraw without deposits", - msg: types.NewMsgWithdrawInsuranceFund(testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100))), + name: "can't withdraw without deposits", + msg: types.NewMsgWithdrawInsuranceFund( + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100)), + ), shouldErr: true, }, { name: "can't withdraw more then deposited", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))) }, - msg: types.NewMsgWithdrawInsuranceFund(testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100))), + msg: types.NewMsgWithdrawInsuranceFund("cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 100))), shouldErr: true, }, { name: "can't withdraw more then available", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), + ) + // Delegate to pool to simulate insurance fund utilization - suite.mintVestedRepresentation(testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000))) - suite.createPool(1, vestedIBCDenom) - _, err := suite.rk.DelegateToPool(ctx, sdk.NewInt64Coin(vestedIBCDenom, 500), testAccount) + suite.mintVestedRepresentation(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1000)), + ) + + suite.createPool(ctx, 1, vestedIBCDenom) + + _, err := suite.rk.DelegateToPool(ctx, + sdk.NewInt64Coin(vestedIBCDenom, 500), + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + ) suite.Assert().NoError(err) }, - msg: types.NewMsgWithdrawInsuranceFund(testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))), + msg: types.NewMsgWithdrawInsuranceFund( + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), + ), shouldErr: true, }, { name: "withdraw correctly", - setup: func(ctx sdk.Context) { - suite.fundAccountInsuranceFund(ctx, testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))) + store: func(ctx sdk.Context) { + suite.fundAccountInsuranceFund(ctx, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), + ) }, - msg: types.NewMsgWithdrawInsuranceFund(testAccount, sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10))), + msg: types.NewMsgWithdrawInsuranceFund( + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), + ), shouldErr: false, check: func(ctx sdk.Context) { - balances := suite.bk.GetAllBalances(ctx, sdk.MustAccAddressFromBech32(testAccount)) + userAddr, err := sdk.AccAddressFromBech32("cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn") + suite.Require().NoError(err) + + balances := suite.bk.GetAllBalances(ctx, userAddr) suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10)), balances) }, expEvents: sdk.Events{ sdk.NewEvent( types.EventTypeWithdrawInsuranceFund, - sdk.NewAttribute(sdk.AttributeKeySender, testAccount), + sdk.NewAttribute(sdk.AttributeKeySender, "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn"), sdk.NewAttribute(sdk.AttributeKeyAmount, "10"+IBCDenom), ), }, @@ -240,22 +329,26 @@ func (suite *KeeperTestSuite) TestMsgServer_WithdrawInsuranceFund() { suite.Run(tc.name, func() { suite.SetupTest() - if tc.setup != nil { - tc.setup(suite.ctx) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) } msgServer := keeper.NewMsgServer(suite.k) - _, err := msgServer.WithdrawInsuranceFund(suite.ctx, tc.msg) + _, err := msgServer.WithdrawInsuranceFund(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) - tc.check(suite.ctx) for _, event := range tc.expEvents { - suite.Require().Contains(suite.ctx.EventManager().Events(), event) + suite.Require().Contains(ctx.EventManager().Events(), event) } } + + if tc.check != nil { + tc.check(ctx) + } }) } } @@ -297,22 +390,23 @@ func (suite *KeeperTestSuite) TestMsgServer_UpdateParams() { suite.Run(tc.name, func() { suite.SetupTest() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { - tc.setup(suite.ctx) + tc.setup(ctx) } msgServer := keeper.NewMsgServer(suite.k) - _, err := msgServer.UpdateParams(suite.ctx, tc.msg) + _, err := msgServer.UpdateParams(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) for _, event := range tc.expEvents { - suite.Require().Contains(suite.ctx.EventManager().Events(), event) + suite.Require().Contains(ctx.EventManager().Events(), event) } if tc.check != nil { - tc.check(suite.ctx) + tc.check(ctx) } } }) diff --git a/x/liquidvesting/keeper/send_restriction_test.go b/x/liquidvesting/keeper/send_restriction_test.go index 69f2879ee..47ddde403 100644 --- a/x/liquidvesting/keeper/send_restriction_test.go +++ b/x/liquidvesting/keeper/send_restriction_test.go @@ -7,106 +7,125 @@ import ( restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" ) -const ( - restaker = "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre" - testServiceId = 1 - testPoolId = 1 - testOperatorId = 1 -) - func (suite *KeeperTestSuite) TestBankHooks_TestPoolRestaking() { testCases := []struct { - name string - setup func() - msg *restakingtypes.MsgDelegatePool - expectedUsage sdk.Coins - shouldErr bool + name string + store func(ctx sdk.Context) + msg *restakingtypes.MsgDelegatePool + shouldErr bool + check func(ctx sdk.Context) }{ { name: "no insurance fund", - setup: func() { + store: func(ctx sdk.Context) { + suite.createPool(ctx, 1, vestedIBCDenom) + // Simulate the minting of the staking representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegatePool( sdk.NewInt64Coin(vestedIBCDenom, 300), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "insufficient insurance fund", - setup: func() { + store: func(ctx sdk.Context) { + suite.createPool(ctx, 1, vestedIBCDenom) + // Fund the user's insurance fund - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)), + ) // Simulate the minting of the staking representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegatePool( sdk.NewInt64Coin(vestedIBCDenom, 300), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "covered funds already restaked", - setup: func() { + store: func(ctx sdk.Context) { + suite.createPool(ctx, 1, vestedIBCDenom) + // Create a test service and operator - suite.createService(testServiceId) - suite.createOperator(testOperatorId) + suite.createService(ctx, 1) + suite.createOperator(ctx, 1) + + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), + ) - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) // Mint the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) // Delegates the funds covered by the insurance fund to the service and the operator msgSrv := restakingkeeper.NewMsgServer(suite.rk) - _, err := msgSrv.DelegateService(suite.ctx, restakingtypes.NewMsgDelegateService( - testServiceId, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), restaker), - ) + _, err := msgSrv.DelegateService(ctx, restakingtypes.NewMsgDelegateService( + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + )) suite.Assert().NoError(err) - _, err = msgSrv.DelegateOperator(suite.ctx, restakingtypes.NewMsgDelegateOperator( - testOperatorId, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), restaker), - ) + _, err = msgSrv.DelegateOperator(ctx, restakingtypes.NewMsgDelegateOperator( + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + )) suite.Assert().NoError(err) }, msg: restakingtypes.NewMsgDelegatePool( sdk.NewInt64Coin(vestedIBCDenom, 150), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "restake correctly", - setup: func() { + store: func(ctx sdk.Context) { + suite.createPool(ctx, 1, vestedIBCDenom) + // Add the 2% to the insurance fund - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), + ) // Simulate the minting of the staking representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegatePool( sdk.NewInt64Coin(vestedIBCDenom, 300), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), - expectedUsage: sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), - shouldErr: false, + shouldErr: false, + check: func(ctx sdk.Context) { + userAddr, err := sdk.AccAddressFromBech32("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFund(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), insuranceFund.Used) + }, }, } @@ -114,19 +133,22 @@ func (suite *KeeperTestSuite) TestBankHooks_TestPoolRestaking() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.createPool(testPoolId, vestedIBCDenom) - tc.setup() - msgServer := restakingkeeper.NewMsgServer(suite.rk) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } - _, err := msgServer.DelegatePool(suite.ctx, tc.msg) + msgServer := restakingkeeper.NewMsgServer(suite.rk) + _, err := msgServer.DelegatePool(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) - insuranceFund, err := suite.k.GetUserInsuranceFund(suite.ctx, sdk.MustAccAddressFromBech32(restaker)) - suite.Assert().NoError(err) - suite.Assert().Equal(tc.expectedUsage, insuranceFund.Used) + } + + if tc.check != nil { + tc.check(ctx) } }) } @@ -134,98 +156,126 @@ func (suite *KeeperTestSuite) TestBankHooks_TestPoolRestaking() { func (suite *KeeperTestSuite) TestBankHooks_TestServiceRestaking() { testCases := []struct { - name string - setup func() - msg *restakingtypes.MsgDelegateService - expectedUsage sdk.Coins - shouldErr bool + name string + store func(ctx sdk.Context) + msg *restakingtypes.MsgDelegateService + shouldErr bool + check func(ctx sdk.Context) }{ { name: "no insurance fund", - setup: func() { + store: func(ctx sdk.Context) { + suite.createService(ctx, 1) + // Simulate the minting of the staking representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegateService( - testServiceId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 300)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "insufficient insurance fund", - setup: func() { + store: func(ctx sdk.Context) { + suite.createService(ctx, 1) + // Fund the user's insurance fund - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)), + ) // Simulate the minting of the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegateService( - testServiceId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 300)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "covered funds already restaked", - setup: func() { + store: func(ctx sdk.Context) { + suite.createService(ctx, 1) + // Create a test pool and operator - suite.createPool(testPoolId, vestedIBCDenom) - suite.createOperator(testOperatorId) + suite.createPool(ctx, 1, vestedIBCDenom) + suite.createOperator(ctx, 1) + + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), + ) - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) // Mint the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) // Delegates the funds covered by the insurance fund to a pool and an operator msgSrv := restakingkeeper.NewMsgServer(suite.rk) - _, err := msgSrv.DelegatePool(suite.ctx, restakingtypes.NewMsgDelegatePool( - sdk.NewInt64Coin(vestedIBCDenom, 150), restaker)) + _, err := msgSrv.DelegatePool(ctx, restakingtypes.NewMsgDelegatePool( + sdk.NewInt64Coin(vestedIBCDenom, 150), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + )) suite.Assert().NoError(err) - _, err = msgSrv.DelegateOperator(suite.ctx, restakingtypes.NewMsgDelegateOperator( - testOperatorId, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), restaker), - ) + + _, err = msgSrv.DelegateOperator(ctx, restakingtypes.NewMsgDelegateOperator( + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + )) suite.Assert().NoError(err) }, msg: restakingtypes.NewMsgDelegateService( - testServiceId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "restake correctly", - setup: func() { - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) + store: func(ctx sdk.Context) { + suite.createService(ctx, 1) + + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), + ) + // Mint the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegateService( - testServiceId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 300)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), - expectedUsage: sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), - shouldErr: false, + shouldErr: false, + check: func(ctx sdk.Context) { + userAddr, err := sdk.AccAddressFromBech32("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFund(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), insuranceFund.Used) + }, }, } @@ -233,19 +283,22 @@ func (suite *KeeperTestSuite) TestBankHooks_TestServiceRestaking() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.createService(testServiceId) - tc.setup() - msgServer := restakingkeeper.NewMsgServer(suite.rk) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } - _, err := msgServer.DelegateService(suite.ctx, tc.msg) + msgServer := restakingkeeper.NewMsgServer(suite.rk) + _, err := msgServer.DelegateService(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) - insuranceFund, err := suite.k.GetUserInsuranceFund(suite.ctx, sdk.MustAccAddressFromBech32(restaker)) - suite.Assert().NoError(err) - suite.Assert().Equal(tc.expectedUsage, insuranceFund.Used) + } + + if tc.check != nil { + tc.check(ctx) } }) } @@ -253,116 +306,148 @@ func (suite *KeeperTestSuite) TestBankHooks_TestServiceRestaking() { func (suite *KeeperTestSuite) TestBankHooks_TestOperatorRestaking() { testCases := []struct { - name string - setup func() - msg *restakingtypes.MsgDelegateOperator - expectedUsage sdk.Coins - shouldErr bool + name string + store func(ctx sdk.Context) + msg *restakingtypes.MsgDelegateOperator + shouldErr bool + check func(ctx sdk.Context) }{ { name: "no insurance fund", - setup: func() { + store: func(ctx sdk.Context) { + suite.createOperator(ctx, 1) + // Simulate the minting of the staking representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegateOperator( - testOperatorId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 300)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "insufficient insurance fund", - setup: func() { + store: func(ctx sdk.Context) { + suite.createOperator(ctx, 1) + // Fund the user's insurance fund - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 1)), + ) // Simulate the minting of the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegateOperator( - testOperatorId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 300)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "covered funds already restaked", - setup: func() { - suite.createPool(testPoolId, vestedIBCDenom) - suite.createService(testServiceId) + store: func(ctx sdk.Context) { + suite.createOperator(ctx, 1) + + suite.createPool(ctx, 1, vestedIBCDenom) + suite.createService(ctx, 1) + + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), + ) - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) // Mint the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) // Delegates the funds covered by the insurance fund to a pool and an operator msgSrv := restakingkeeper.NewMsgServer(suite.rk) - _, err := msgSrv.DelegatePool(suite.ctx, restakingtypes.NewMsgDelegatePool( - sdk.NewInt64Coin(vestedIBCDenom, 150), restaker)) + _, err := msgSrv.DelegatePool(ctx, restakingtypes.NewMsgDelegatePool( + sdk.NewInt64Coin(vestedIBCDenom, 150), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + )) suite.Assert().NoError(err) - _, err = msgSrv.DelegateService(suite.ctx, restakingtypes.NewMsgDelegateService( - testServiceId, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), restaker), - ) + + _, err = msgSrv.DelegateService(ctx, restakingtypes.NewMsgDelegateService( + 1, + sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + )) suite.Assert().NoError(err) }, msg: restakingtypes.NewMsgDelegateOperator( - testOperatorId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 150)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), shouldErr: true, }, { name: "restake correctly", - setup: func() { - insuranceFundCoins := sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)) - suite.fundAccountInsuranceFund(suite.ctx, restaker, insuranceFundCoins) + store: func(ctx sdk.Context) { + suite.createOperator(ctx, 1) + + suite.fundAccountInsuranceFund(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", + sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), + ) + // Mint the staked representation - suite.mintVestedRepresentation( - restaker, + suite.mintVestedRepresentation(ctx, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 10000)), ) }, msg: restakingtypes.NewMsgDelegateOperator( - testOperatorId, + 1, sdk.NewCoins(sdk.NewInt64Coin(vestedIBCDenom, 300)), - restaker, + "cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre", ), - expectedUsage: sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), - shouldErr: false, + shouldErr: false, + check: func(ctx sdk.Context) { + userAddr, err := sdk.AccAddressFromBech32("cosmos1pgzph9rze2j2xxavx4n7pdhxlkgsq7raqh8hre") + suite.Assert().NoError(err) + + insuranceFund, err := suite.k.GetUserInsuranceFund(ctx, userAddr) + suite.Assert().NoError(err) + suite.Assert().Equal(sdk.NewCoins(sdk.NewInt64Coin(IBCDenom, 6)), insuranceFund.Used) + }, }, } for _, tc := range testCases { + tc := tc suite.Run(tc.name, func() { suite.SetupTest() - suite.createOperator(testOperatorId) - tc.setup() - msgServer := restakingkeeper.NewMsgServer(suite.rk) + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } - _, err := msgServer.DelegateOperator(suite.ctx, tc.msg) + msgServer := restakingkeeper.NewMsgServer(suite.rk) + _, err := msgServer.DelegateOperator(ctx, tc.msg) if tc.shouldErr { suite.Assert().Error(err) } else { suite.Assert().NoError(err) - insuranceFund, err := suite.k.GetUserInsuranceFund(suite.ctx, sdk.MustAccAddressFromBech32(restaker)) - suite.Assert().NoError(err) - suite.Assert().Equal(tc.expectedUsage, insuranceFund.Used) + } + + if tc.check != nil { + tc.check(ctx) } }) } diff --git a/x/liquidvesting/testutils/keeper.go b/x/liquidvesting/testutils/keeper.go index 5f052b048..92f1a1273 100644 --- a/x/liquidvesting/testutils/keeper.go +++ b/x/liquidvesting/testutils/keeper.go @@ -6,13 +6,10 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ibchooks "github.com/initia-labs/initia/x/ibc-hooks" - ibchookskeeper "github.com/initia-labs/initia/x/ibc-hooks/keeper" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibchookstypes "github.com/initia-labs/initia/x/ibc-hooks/types" "github.com/stretchr/testify/require" @@ -20,7 +17,7 @@ import ( appkeepers "github.com/milkyway-labs/milkyway/app/keepers" "github.com/milkyway-labs/milkyway/testutils/storetesting" - "github.com/milkyway-labs/milkyway/x/liquidvesting/hooks" + "github.com/milkyway-labs/milkyway/x/liquidvesting" "github.com/milkyway-labs/milkyway/x/liquidvesting/keeper" "github.com/milkyway-labs/milkyway/x/liquidvesting/types" operatorskeeper "github.com/milkyway-labs/milkyway/x/operators/keeper" @@ -41,8 +38,7 @@ type KeeperTestData struct { LiquidVestingModuleAddress sdk.AccAddress Keeper *keeper.Keeper - IBCHooksKeeper *ibchookskeeper.Keeper - IBCMiddleware ibchooks.IBCMiddleware + IBCMiddleware porttypes.IBCModule OperatorsKeeper *operatorskeeper.Keeper PoolsKeeper *poolskeeper.Keeper ServicesKeeper *serviceskeeper.Keeper @@ -62,23 +58,10 @@ func NewKeeperTestData(t *testing.T) KeeperTestData { }), } - ac := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) - // Module addresses data.LiquidVestingModuleAddress = authtypes.NewModuleAddress(types.ModuleName) // Build keepers - - data.IBCHooksKeeper = ibchookskeeper.NewKeeper( - data.Cdc, - runtime.NewKVStoreService(data.Keys[ibchookstypes.StoreKey]), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ac, - ) - if err := data.IBCHooksKeeper.Params.Set(data.Context, ibchookstypes.DefaultParams()); err != nil { - panic(err) - } - data.PoolsKeeper = poolskeeper.NewKeeper( data.Cdc, data.Keys[poolstypes.StoreKey], @@ -129,13 +112,13 @@ func NewKeeperTestData(t *testing.T) KeeperTestData { data.LiquidVestingModuleAddress.String(), data.AuthorityAddress, ) + // Set bank hooks data.BankKeeper.AppendSendRestriction(data.Keeper.SendRestrictionFn) // Set ibc hooks - mockIBCMiddleware := mockIBCMiddleware{} - middleware := ibchooks.NewICS4Middleware(mockIBCMiddleware, hooks.NewIBCHooks(data.Keeper)) - data.IBCMiddleware = ibchooks.NewIBCMiddleware(mockIBCMiddleware, middleware, data.IBCHooksKeeper) + var ibcStack porttypes.IBCModule = mockIBCMiddleware{} + data.IBCMiddleware = liquidvesting.NewIBCMiddleware(ibcStack, data.Keeper) account := data.AccountKeeper.GetModuleAccount(data.Context, types.ModuleName) require.NotNil(t, account) diff --git a/x/operators/abci_test.go b/x/operators/abci_test.go index 9b045270f..9f0ce9cc1 100644 --- a/x/operators/abci_test.go +++ b/x/operators/abci_test.go @@ -4,20 +4,41 @@ import ( "testing" "time" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + db "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + milkyway "github.com/milkyway-labs/milkyway/app" "github.com/milkyway-labs/milkyway/x/operators" - "github.com/milkyway-labs/milkyway/x/operators/testutils" + "github.com/milkyway-labs/milkyway/x/operators/keeper" "github.com/milkyway-labs/milkyway/x/operators/types" ) func TestBeginBlocker(t *testing.T) { - // Create the test data - data := testutils.NewKeeperTestData(t) + // Define store keys + keys := storetypes.NewKVStoreKeys(types.StoreKey) - ctx := data.Context - operatorsKeeper := data.Keeper + // Create an in-memory db + memDB := db.NewMemDB() + ms := store.NewCommitMultiStore(memDB, log.NewNopLogger(), metrics.NewNoOpMetrics()) + for _, key := range keys { + ms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, memDB) + } + + err := ms.LoadLatestVersion() + require.NoError(t, err) + + ctx := sdk.NewContext(ms, tmproto.Header{ChainID: "test-chain"}, false, log.NewNopLogger()) + cdc, _ := milkyway.MakeCodecs() + + operatorsKeeper := keeper.NewKeeper(cdc, keys[types.StoreKey], + runtime.NewKVStoreService(keys[types.StoreKey]), nil, nil, "") testCases := []struct { name string @@ -33,7 +54,7 @@ func TestBeginBlocker(t *testing.T) { }, store: func(ctx sdk.Context) { operatorsKeeper.SetParams(ctx, types.NewParams(nil, 6*time.Hour)) - err := operatorsKeeper.StartOperatorInactivation(ctx, types.NewOperator( + operatorsKeeper.StartOperatorInactivation(ctx, types.NewOperator( 1, types.OPERATOR_STATUS_ACTIVE, "MilkyWay Operator", @@ -41,13 +62,12 @@ func TestBeginBlocker(t *testing.T) { "https://milkyway.com/picture", "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", )) - require.NoError(t, err) }, updateCtx: func(ctx sdk.Context) sdk.Context { return ctx.WithBlockTime(time.Date(2024, 1, 1, 17, 59, 59, 999, time.UTC)) }, check: func(ctx sdk.Context) { - kvStore := ctx.KVStore(data.Keys[types.StoreKey]) + kvStore := ctx.KVStore(keys[types.StoreKey]) endTime := time.Date(2024, 1, 1, 18, 0, 0, 0, time.UTC) require.True(t, kvStore.Has(types.InactivatingOperatorQueueKey(1, endTime))) }, @@ -59,7 +79,7 @@ func TestBeginBlocker(t *testing.T) { }, store: func(ctx sdk.Context) { operatorsKeeper.SetParams(ctx, types.NewParams(nil, 6*time.Hour)) - err := operatorsKeeper.StartOperatorInactivation(ctx, types.NewOperator( + operatorsKeeper.StartOperatorInactivation(ctx, types.NewOperator( 1, types.OPERATOR_STATUS_ACTIVE, "MilkyWay Operator", @@ -67,7 +87,6 @@ func TestBeginBlocker(t *testing.T) { "https://milkyway.com/picture", "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", )) - require.NoError(t, err) }, updateCtx: func(ctx sdk.Context) sdk.Context { return ctx.WithBlockTime(time.Date(2020, 1, 1, 18, 0, 0, 0, time.UTC)) @@ -79,7 +98,7 @@ func TestBeginBlocker(t *testing.T) { require.Equal(t, types.OPERATOR_STATUS_INACTIVATING, operator.Status) // Make sure the operator is still in the inactivating queue - kvStore := ctx.KVStore(data.Keys[types.StoreKey]) + kvStore := ctx.KVStore(keys[types.StoreKey]) endTime := time.Date(2020, 1, 1, 18, 0, 0, 0, time.UTC) require.False(t, kvStore.Has(types.InactivatingOperatorQueueKey(1, endTime))) }, @@ -91,7 +110,7 @@ func TestBeginBlocker(t *testing.T) { }, store: func(ctx sdk.Context) { operatorsKeeper.SetParams(ctx, types.NewParams(nil, 6*time.Hour)) - err := operatorsKeeper.StartOperatorInactivation(ctx, types.NewOperator( + operatorsKeeper.StartOperatorInactivation(ctx, types.NewOperator( 1, types.OPERATOR_STATUS_ACTIVE, "MilkyWay Operator", @@ -99,7 +118,6 @@ func TestBeginBlocker(t *testing.T) { "https://milkyway.com/picture", "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", )) - require.NoError(t, err) }, updateCtx: func(ctx sdk.Context) sdk.Context { return ctx.WithBlockTime(time.Date(2020, 1, 1, 20, 0, 0, 0, time.UTC)) @@ -111,7 +129,7 @@ func TestBeginBlocker(t *testing.T) { require.Equal(t, types.OPERATOR_STATUS_INACTIVE, operator.Status) // Make sure the operator is not in the inactivating queue - kvStore := ctx.KVStore(data.Keys[types.StoreKey]) + kvStore := ctx.KVStore(keys[types.StoreKey]) endTime := time.Date(2020, 1, 1, 18, 0, 0, 0, time.UTC) require.False(t, kvStore.Has(types.InactivatingOperatorQueueKey(1, endTime))) }, @@ -133,8 +151,7 @@ func TestBeginBlocker(t *testing.T) { ctx = tc.updateCtx(ctx) } - err := operators.BeginBlocker(ctx, operatorsKeeper) - require.NoError(t, err) + operators.BeginBlocker(ctx, operatorsKeeper) if tc.check != nil { tc.check(ctx) diff --git a/x/operators/keeper/common_test.go b/x/operators/keeper/common_test.go index 964547d62..a8a8e0ed8 100644 --- a/x/operators/keeper/common_test.go +++ b/x/operators/keeper/common_test.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/stretchr/testify/suite" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" @@ -34,15 +34,10 @@ type KeeperTestSuite struct { } func (suite *KeeperTestSuite) SetupTest() { - // Build the testing data data := testutils.NewKeeperTestData(suite.T()) - - // Define the codec and context - suite.cdc = data.Cdc - suite.ctx = data.Context - - // Define store keys suite.storeKey = data.StoreKey + suite.ctx = data.Context + suite.cdc = data.Cdc // Build keepers suite.ak = data.AccountKeeper @@ -51,15 +46,16 @@ func (suite *KeeperTestSuite) SetupTest() { // Set hooks suite.hooks = data.Hooks + suite.k = data.Keeper } // -------------------------------------------------------------------------------------------------------------------- // fundAccount adds the given amount of coins to the account with the given address func (suite *KeeperTestSuite) fundAccount(ctx sdk.Context, address string, amount sdk.Coins) { - // Mint the coins - moduleAcc := suite.ak.GetModuleAccount(ctx, authtypes.Minter) + moduleAcc := suite.ak.GetModuleAccount(ctx, minttypes.ModuleName) + // Mint the coins err := suite.bk.MintCoins(ctx, moduleAcc.GetName(), amount) suite.Require().NoError(err) diff --git a/x/pools/keeper/common_test.go b/x/pools/keeper/common_test.go index a2dd6e42b..cdb2f52c3 100644 --- a/x/pools/keeper/common_test.go +++ b/x/pools/keeper/common_test.go @@ -13,7 +13,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" + milkyway "github.com/milkyway-labs/milkyway/app" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" "github.com/milkyway-labs/milkyway/x/pools/keeper" "github.com/milkyway-labs/milkyway/x/pools/types" @@ -65,7 +65,7 @@ func (suite *KeeperTestSuite) SetupTest() { } suite.ctx = sdk.NewContext(ms, tmproto.Header{ChainID: "test-chain"}, false, log.NewNopLogger()) - suite.cdc, suite.legacyAminoCdc = app.MakeCodecs() + suite.cdc, suite.legacyAminoCdc = milkyway.MakeCodecs() // Authority address authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() @@ -75,7 +75,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.cdc, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, - app.GetMaccPerms(), + milkyway.MaccPerms, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.GetConfig().GetBech32AccountAddrPrefix(), authorityAddr, diff --git a/x/restaking/keeper/common_test.go b/x/restaking/keeper/common_test.go index 86f58e3d2..bab5a5adb 100644 --- a/x/restaking/keeper/common_test.go +++ b/x/restaking/keeper/common_test.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/stretchr/testify/suite" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" @@ -39,15 +39,10 @@ type KeeperTestSuite struct { } func (suite *KeeperTestSuite) SetupTest() { - // Build the base data data := testutils.NewKeeperTestData(suite.T()) - - // Define store keys - suite.storeKey = data.StoreKey - - // Define the codec and context suite.ctx = data.Context suite.cdc = data.Cdc + suite.storeKey = data.StoreKey // Build keepers suite.ak = data.AccountKeeper @@ -62,9 +57,9 @@ func (suite *KeeperTestSuite) SetupTest() { // fundAccount adds the given amount of coins to the account with the given address func (suite *KeeperTestSuite) fundAccount(ctx sdk.Context, address string, amount sdk.Coins) { - // Mint the coins - moduleAcc := suite.ak.GetModuleAccount(ctx, authtypes.Minter) + moduleAcc := suite.ak.GetModuleAccount(ctx, minttypes.ModuleName) + // Mint the coins err := suite.bk.MintCoins(ctx, moduleAcc.GetName(), amount) suite.Require().NoError(err) @@ -74,5 +69,3 @@ func (suite *KeeperTestSuite) fundAccount(ctx sdk.Context, address string, amoun err = suite.bk.SendCoinsFromModuleToAccount(ctx, moduleAcc.GetName(), userAddress, amount) suite.Require().NoError(err) } - -// -------------------------------------------------------------------------------------------------------------------- diff --git a/x/restaking/keeper/migrations.go b/x/restaking/keeper/migrations.go index 5c10507a7..58ae68677 100644 --- a/x/restaking/keeper/migrations.go +++ b/x/restaking/keeper/migrations.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v2 "github.com/milkyway-labs/milkyway/x/restaking/migrations/v2" + v2 "github.com/milkyway-labs/milkyway/x/restaking/legacy/v2" ) type Migrator struct { diff --git a/x/restaking/migrations/v2/expected_keepers.go b/x/restaking/legacy/v2/expected_keepers.go similarity index 100% rename from x/restaking/migrations/v2/expected_keepers.go rename to x/restaking/legacy/v2/expected_keepers.go diff --git a/x/restaking/legacy/types/keys.go b/x/restaking/legacy/v2/keys.go similarity index 99% rename from x/restaking/legacy/types/keys.go rename to x/restaking/legacy/v2/keys.go index 1a738dcd4..55199ba38 100644 --- a/x/restaking/legacy/types/keys.go +++ b/x/restaking/legacy/v2/keys.go @@ -1,4 +1,4 @@ -package types +package v2 import ( "bytes" diff --git a/x/restaking/legacy/types/models.go b/x/restaking/legacy/v2/models.go similarity index 99% rename from x/restaking/legacy/types/models.go rename to x/restaking/legacy/v2/models.go index 6d53717fa..6220e8104 100644 --- a/x/restaking/legacy/types/models.go +++ b/x/restaking/legacy/v2/models.go @@ -1,4 +1,4 @@ -package types +package v2 import ( "fmt" diff --git a/x/restaking/legacy/types/models.pb.go b/x/restaking/legacy/v2/models.pb.go similarity index 99% rename from x/restaking/legacy/types/models.pb.go rename to x/restaking/legacy/v2/models.pb.go index ffafd6d1b..633c0c184 100644 --- a/x/restaking/legacy/types/models.pb.go +++ b/x/restaking/legacy/v2/models.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: milkyway/restaking/legacy/models.proto -package types +package v2 import ( cosmossdk_io_math "cosmossdk.io/math" diff --git a/x/restaking/legacy/v2/store.go b/x/restaking/legacy/v2/store.go new file mode 100644 index 000000000..9700487f5 --- /dev/null +++ b/x/restaking/legacy/v2/store.go @@ -0,0 +1,130 @@ +package v2 + +import ( + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + operatortypes "github.com/milkyway-labs/milkyway/x/operators/types" +) + +func Migrate1To2( + ctx sdk.Context, + storeKey storetypes.StoreKey, + cdc codec.Codec, + restakingKeeper RestakingKeeper, + operatorsKeeper OperatorsKeeper, + servicesKeeper ServicesKeeper, +) error { + err := migrateOperatorParams(ctx, storeKey, cdc, restakingKeeper, operatorsKeeper) + if err != nil { + return err + } + + err = migrateServiceParams(ctx, storeKey, cdc, restakingKeeper, servicesKeeper) + if err != nil { + return err + } + + return nil +} + +// migrateOperatorParams migrates all the operators commissions rates from the +// restaking module to the operators module +func migrateOperatorParams( + ctx sdk.Context, + storeKey storetypes.StoreKey, + cdc codec.Codec, + restakingKeeper RestakingKeeper, + operatorsKeeper OperatorsKeeper, +) error { + store := ctx.KVStore(storeKey) + iterator := storetypes.KVStorePrefixIterator(store, OperatorParamsPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + // Get the operators params from the store + var params LegacyOperatorParams + cdc.MustUnmarshal(iterator.Value(), ¶ms) + + // Parse the operator id from the iterator key + operatorID, err := ParseOperatorParamsKey(iterator.Key()) + if err != nil { + return err + } + + // Get the operator from the operators keeper + _, found := operatorsKeeper.GetOperator(ctx, operatorID) + if found { + // Update the operator params with the params retrieved from the + // restaking module + err = operatorsKeeper.SaveOperatorParams(ctx, operatorID, operatortypes.NewOperatorParams(params.CommissionRate)) + if err != nil { + return err + } + + // Get the operator's joined services. + // Update the operator joined services with the ones retrieved from + // the old params structure. + for _, serviceID := range params.JoinedServicesIDs { + err = restakingKeeper.AddServiceToOperatorJoinedServices(ctx, operatorID, serviceID) + if err != nil { + return err + } + } + } + + // Delete the params from the store + store.Delete(iterator.Key()) + } + return nil +} + +// migrateServiceParams migrates the LegacyServiceParams to the new ServiceParams +// moving the data contained inside the LegacyServiceParams to the restaking module +func migrateServiceParams( + ctx sdk.Context, + storeKey storetypes.StoreKey, + cdc codec.Codec, + restakingKeeper RestakingKeeper, + servicesKeeper ServicesKeeper, +) error { + store := ctx.KVStore(storeKey) + iterator := storetypes.KVStorePrefixIterator(store, ServiceParamsPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var legacyParams LegacyServiceParams + cdc.MustUnmarshal(iterator.Value(), &legacyParams) + + serviceID, err := ParseServiceParamsKey(iterator.Key()) + if err != nil { + return err + } + + _, found := servicesKeeper.GetService(ctx, serviceID) + if found { + // Store the service's whitelisted operators in the restaking module + for _, operatorID := range legacyParams.WhitelistedOperatorsIDs { + err = restakingKeeper.AddOperatorToServiceAllowList(ctx, serviceID, operatorID) + if err != nil { + return err + } + } + + // Store the service's whitelisted pools in the restaking module + for _, poolID := range legacyParams.WhitelistedPoolsIDs { + err = restakingKeeper.AddPoolToServiceSecuringPools(ctx, serviceID, poolID) + if err != nil { + return err + } + } + } + + // Delete the data after migration + store.Delete(iterator.Key()) + } + + return nil +} diff --git a/x/restaking/migrations/v2/migrations_test.go b/x/restaking/legacy/v2/store_test.go similarity index 85% rename from x/restaking/migrations/v2/migrations_test.go rename to x/restaking/legacy/v2/store_test.go index 6db71cfd4..d92f10941 100644 --- a/x/restaking/migrations/v2/migrations_test.go +++ b/x/restaking/legacy/v2/store_test.go @@ -12,8 +12,7 @@ import ( operatorskeeper "github.com/milkyway-labs/milkyway/x/operators/keeper" operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper" - legacytypes "github.com/milkyway-labs/milkyway/x/restaking/legacy/types" - v2 "github.com/milkyway-labs/milkyway/x/restaking/migrations/v2" + v2 "github.com/milkyway-labs/milkyway/x/restaking/legacy/v2" "github.com/milkyway-labs/milkyway/x/restaking/testutils" restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper" @@ -37,17 +36,14 @@ type MigrationsTestSuite struct { } func (suite *MigrationsTestSuite) SetupTest() { - // Build the base data data := testutils.NewKeeperTestData(suite.T()) - - // Set the properties - suite.ctx = data.Context suite.storeKey = data.StoreKey + suite.ctx = data.Context suite.cdc = data.Cdc - suite.restakingKeeper = data.Keeper suite.operatorsKeeper = data.OperatorsKeeper suite.servicesKeeper = data.ServicesKeeper + suite.restakingKeeper = data.Keeper } // -------------------------------------------------------------------------------------------------------------------- @@ -65,19 +61,19 @@ func (suite *MigrationsTestSuite) TestMigrateV1To2() { sdkStore := ctx.KVStore(suite.storeKey) // Set the operator params - paramsBz, err := suite.cdc.Marshal(&legacytypes.LegacyOperatorParams{ + paramsBz, err := suite.cdc.Marshal(&v2.LegacyOperatorParams{ CommissionRate: sdkmath.LegacyNewDec(100), JoinedServicesIDs: []uint32{1, 2, 3}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.OperatorParamsStoreKey(1), paramsBz) + sdkStore.Set(v2.OperatorParamsStoreKey(1), paramsBz) - paramsBz, err = suite.cdc.Marshal(&legacytypes.LegacyOperatorParams{ + paramsBz, err = suite.cdc.Marshal(&v2.LegacyOperatorParams{ CommissionRate: sdkmath.LegacyNewDec(200), JoinedServicesIDs: []uint32{4, 5, 6}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.OperatorParamsStoreKey(2), paramsBz) + sdkStore.Set(v2.OperatorParamsStoreKey(2), paramsBz) }, check: func(ctx sdk.Context) { // Make sure the params are deleted @@ -116,19 +112,19 @@ func (suite *MigrationsTestSuite) TestMigrateV1To2() { suite.Require().NoError(err) // Set the operator params - paramsBz, err := suite.cdc.Marshal(&legacytypes.LegacyOperatorParams{ + paramsBz, err := suite.cdc.Marshal(&v2.LegacyOperatorParams{ CommissionRate: sdkmath.LegacyNewDec(100), JoinedServicesIDs: []uint32{1, 2, 3}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.OperatorParamsStoreKey(1), paramsBz) + sdkStore.Set(v2.OperatorParamsStoreKey(1), paramsBz) - paramsBz, err = suite.cdc.Marshal(&legacytypes.LegacyOperatorParams{ + paramsBz, err = suite.cdc.Marshal(&v2.LegacyOperatorParams{ CommissionRate: sdkmath.LegacyNewDec(200), JoinedServicesIDs: []uint32{4, 5, 6}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.OperatorParamsStoreKey(2), paramsBz) + sdkStore.Set(v2.OperatorParamsStoreKey(2), paramsBz) }, check: func(ctx sdk.Context) { // Make sure the params are upgraded properly @@ -159,19 +155,19 @@ func (suite *MigrationsTestSuite) TestMigrateV1To2() { sdkStore := ctx.KVStore(suite.storeKey) // Set the service params - paramsBz, err := suite.cdc.Marshal(&legacytypes.LegacyServiceParams{ + paramsBz, err := suite.cdc.Marshal(&v2.LegacyServiceParams{ WhitelistedOperatorsIDs: []uint32{1, 2, 3}, WhitelistedPoolsIDs: []uint32{4, 5, 6}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.ServiceParamsStoreKey(1), paramsBz) + sdkStore.Set(v2.ServiceParamsStoreKey(1), paramsBz) - paramsBz, err = suite.cdc.Marshal(&legacytypes.LegacyServiceParams{ + paramsBz, err = suite.cdc.Marshal(&v2.LegacyServiceParams{ WhitelistedOperatorsIDs: []uint32{7, 8, 9}, WhitelistedPoolsIDs: []uint32{10, 11, 12}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.ServiceParamsStoreKey(2), paramsBz) + sdkStore.Set(v2.ServiceParamsStoreKey(2), paramsBz) }, check: func(ctx sdk.Context) { // Make sure the list of whitelisted operators and pools has been moved to the restaking keeper @@ -215,19 +211,19 @@ func (suite *MigrationsTestSuite) TestMigrateV1To2() { suite.Require().NoError(err) // Set the service params - paramsBz, err := suite.cdc.Marshal(&legacytypes.LegacyServiceParams{ + paramsBz, err := suite.cdc.Marshal(&v2.LegacyServiceParams{ WhitelistedOperatorsIDs: []uint32{1, 2, 3}, WhitelistedPoolsIDs: []uint32{4, 5, 6}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.ServiceParamsStoreKey(1), paramsBz) + sdkStore.Set(v2.ServiceParamsStoreKey(1), paramsBz) - paramsBz, err = suite.cdc.Marshal(&legacytypes.LegacyServiceParams{ + paramsBz, err = suite.cdc.Marshal(&v2.LegacyServiceParams{ WhitelistedOperatorsIDs: []uint32{7, 8, 9}, WhitelistedPoolsIDs: []uint32{10, 11, 12}, }) suite.Require().NoError(err) - sdkStore.Set(legacytypes.ServiceParamsStoreKey(2), paramsBz) + sdkStore.Set(v2.ServiceParamsStoreKey(2), paramsBz) }, check: func(ctx sdk.Context) { // Make sure the params are upgraded properly diff --git a/x/restaking/migrations/v2/migrations.go b/x/restaking/migrations/v2/migrations.go deleted file mode 100644 index dde653de0..000000000 --- a/x/restaking/migrations/v2/migrations.go +++ /dev/null @@ -1,29 +0,0 @@ -package v2 - -import ( - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func Migrate1To2( - ctx sdk.Context, - storeKey storetypes.StoreKey, - cdc codec.Codec, - restakingKeeper RestakingKeeper, - operatorsKeeper OperatorsKeeper, - servicesKeeper ServicesKeeper, -) error { - err := migateOperatorParams(ctx, storeKey, cdc, restakingKeeper, operatorsKeeper) - if err != nil { - return err - } - - err = migrateServiceParams(ctx, storeKey, cdc, restakingKeeper, servicesKeeper) - if err != nil { - return err - } - - return nil -} diff --git a/x/restaking/migrations/v2/operator_params.go b/x/restaking/migrations/v2/operator_params.go deleted file mode 100644 index 91c786127..000000000 --- a/x/restaking/migrations/v2/operator_params.go +++ /dev/null @@ -1,62 +0,0 @@ -package v2 - -import ( - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - operatortypes "github.com/milkyway-labs/milkyway/x/operators/types" - legacytypes "github.com/milkyway-labs/milkyway/x/restaking/legacy/types" -) - -// migrateOperatorParams migrates all the operators commissions rates from the -// restaking module to the operators module -func migateOperatorParams( - ctx sdk.Context, - storeKey storetypes.StoreKey, - cdc codec.Codec, - restakingKeeper RestakingKeeper, - operatorsKeeper OperatorsKeeper, -) error { - store := ctx.KVStore(storeKey) - iterator := storetypes.KVStorePrefixIterator(store, legacytypes.OperatorParamsPrefix) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - // Get the operators params from the store - var params legacytypes.LegacyOperatorParams - cdc.MustUnmarshal(iterator.Value(), ¶ms) - - // Parse the operator id from the iterator key - operatorID, err := legacytypes.ParseOperatorParamsKey(iterator.Key()) - if err != nil { - return err - } - - // Get the operator from the operators keeper - _, found := operatorsKeeper.GetOperator(ctx, operatorID) - if found { - // Update the operator params with the params retrieved from the - // restaking module - err = operatorsKeeper.SaveOperatorParams(ctx, operatorID, operatortypes.NewOperatorParams(params.CommissionRate)) - if err != nil { - return err - } - - // Get the operator's joined services. - // Update the operator joined services with the ones retrieved from - // the old params structure. - for _, serviceID := range params.JoinedServicesIDs { - err = restakingKeeper.AddServiceToOperatorJoinedServices(ctx, operatorID, serviceID) - if err != nil { - return err - } - } - } - - // Delete the params from the store - store.Delete(iterator.Key()) - } - return nil -} diff --git a/x/restaking/migrations/v2/service_params.go b/x/restaking/migrations/v2/service_params.go deleted file mode 100644 index 4f8c4d43f..000000000 --- a/x/restaking/migrations/v2/service_params.go +++ /dev/null @@ -1,58 +0,0 @@ -package v2 - -import ( - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - legacytypes "github.com/milkyway-labs/milkyway/x/restaking/legacy/types" -) - -// migrateServiceParams migrates the LegacyServiceParams to the new ServiceParams -// moving the data contained inside the LegacyServiceParams to the restaking module -func migrateServiceParams( - ctx sdk.Context, - storeKey storetypes.StoreKey, - cdc codec.Codec, - restakingKeeper RestakingKeeper, - servicesKeeper ServicesKeeper, -) error { - store := ctx.KVStore(storeKey) - iterator := storetypes.KVStorePrefixIterator(store, legacytypes.ServiceParamsPrefix) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var legacyParams legacytypes.LegacyServiceParams - cdc.MustUnmarshal(iterator.Value(), &legacyParams) - - serviceID, err := legacytypes.ParseServiceParamsKey(iterator.Key()) - if err != nil { - return err - } - - _, found := servicesKeeper.GetService(ctx, serviceID) - if found { - // Store the service's whitelisted operators in the restaking module - for _, operatorID := range legacyParams.WhitelistedOperatorsIDs { - err = restakingKeeper.AddOperatorToServiceAllowList(ctx, serviceID, operatorID) - if err != nil { - return err - } - } - - // Store the service's whitelisted pools in the restaking module - for _, poolID := range legacyParams.WhitelistedPoolsIDs { - err = restakingKeeper.AddPoolToServiceSecuringPools(ctx, serviceID, poolID) - if err != nil { - return err - } - } - } - - // Delete the data after migration - store.Delete(iterator.Key()) - } - - return nil -} diff --git a/x/rewards/client/cli/utils_test.go b/x/rewards/client/cli/utils_test.go index 786f7469e..9bfa90266 100644 --- a/x/rewards/client/cli/utils_test.go +++ b/x/rewards/client/cli/utils_test.go @@ -10,17 +10,17 @@ import ( "github.com/milkyway-labs/milkyway/x/rewards/types" - testutil "github.com/cosmos/cosmos-sdk/testutil" + "github.com/cosmos/cosmos-sdk/testutil" "github.com/stretchr/testify/require" - "github.com/milkyway-labs/milkyway/app" + milkyway "github.com/milkyway-labs/milkyway/app" "github.com/milkyway-labs/milkyway/x/rewards/client/cli" ) func TestCliUtils_parseRewardsPlan(t *testing.T) { - encodingConfig := app.MakeEncodingConfig() - codec := encodingConfig.Codec + encodingConfig := milkyway.MakeEncodingConfig() + codec := encodingConfig.Marshaler testCases := []struct { name string diff --git a/x/rewards/keeper/allocation_test.go b/x/rewards/keeper/allocation_test.go index 5c9b11147..3f3d3dc28 100644 --- a/x/rewards/keeper/allocation_test.go +++ b/x/rewards/keeper/allocation_test.go @@ -11,7 +11,7 @@ import ( func (suite *KeeperTestSuite) TestAllocateRewards_InactivePlan() { // Cache the context to avoid test conflicts - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() // Inactive plans(current block time is out of their date range) don't allocate rewards. @@ -44,7 +44,7 @@ func (suite *KeeperTestSuite) TestAllocateRewards_InactivePlan() { func (suite *KeeperTestSuite) TestAllocateRewards_BasicScenario() { // Cache the context to avoid test conflicts - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() // - x/pools whitelists Service1, Service2 // - Service3 whitelists Operator2, Operator3 @@ -70,9 +70,9 @@ func (suite *KeeperTestSuite) TestAllocateRewards_BasicScenario() { service3 := suite.CreateService(ctx, "Service3", serviceAdmin3.String()) // Add only Service1 and Service2 to the pools module's allowed list. - poolsParams := suite.App.PoolsKeeper.GetParams(ctx) + poolsParams := suite.poolsKeeper.GetParams(ctx) poolsParams.AllowedServicesIDs = []uint32{service1.ID, service2.ID} - suite.App.PoolsKeeper.SetParams(ctx, poolsParams) + suite.poolsKeeper.SetParams(ctx, poolsParams) // Create operators. operatorAdmin1 := testutil.TestAddress(10004) @@ -256,7 +256,7 @@ func (suite *KeeperTestSuite) TestAllocateRewards_BasicScenario() { func (suite *KeeperTestSuite) TestAllocateRewards_MovingPrice() { // Cache the context to avoid test conflicts - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() // $MILK is $2 and $INIT is $3. service, _ := suite.setupSampleServiceAndOperator(ctx) @@ -312,7 +312,7 @@ func (suite *KeeperTestSuite) TestAllocateRewards_MovingPrice() { func (suite *KeeperTestSuite) TestAllocateRewards_ZeroDelegations() { // Cache the context to avoid test conflicts - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() // Test if AllocateRewards handles pool/operator/service distribution // correctly when the distribution info has weight specified but there's @@ -325,9 +325,9 @@ func (suite *KeeperTestSuite) TestAllocateRewards_ZeroDelegations() { service := suite.CreateService(ctx, "Service", serviceAdmin.String()) // Add the created service ID to the pools module's allowed list. - poolsParams := suite.App.PoolsKeeper.GetParams(ctx) + poolsParams := suite.poolsKeeper.GetParams(ctx) poolsParams.AllowedServicesIDs = []uint32{service.ID} - suite.App.PoolsKeeper.SetParams(ctx, poolsParams) + suite.poolsKeeper.SetParams(ctx, poolsParams) // Create an active rewards plan. planStartTime := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) @@ -399,7 +399,7 @@ func (suite *KeeperTestSuite) TestAllocateRewards_ZeroDelegations() { func (suite *KeeperTestSuite) TestAllocateRewards_WeightedDistributions() { // Cache the context to avoid test conflicts - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() // Register $MILK and $INIT. For simple calculation, set both currencies' // price $1. @@ -411,9 +411,9 @@ func (suite *KeeperTestSuite) TestAllocateRewards_WeightedDistributions() { service := suite.CreateService(ctx, "Service", serviceAdmin.String()) // Add the created service ID to the pools module's allowed list. - poolsParams := suite.App.PoolsKeeper.GetParams(ctx) + poolsParams := suite.poolsKeeper.GetParams(ctx) poolsParams.AllowedServicesIDs = []uint32{service.ID} - suite.App.PoolsKeeper.SetParams(ctx, poolsParams) + suite.poolsKeeper.SetParams(ctx, poolsParams) // Create operators. operatorAdmin1 := testutil.TestAddress(10001) @@ -516,7 +516,7 @@ func (suite *KeeperTestSuite) TestAllocateRewards_WeightedDistributions() { func (suite *KeeperTestSuite) TestAllocateRewards_EgalitarianDistributions() { // Cache the context to avoid test conflicts - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() // Register $MILK and $INIT. For simple calculation, set both currencies' // price $1. @@ -528,9 +528,9 @@ func (suite *KeeperTestSuite) TestAllocateRewards_EgalitarianDistributions() { service := suite.CreateService(ctx, "Service", serviceAdmin.String()) // Add the created service ID to the pools module's allowed list. - poolsParams := suite.App.PoolsKeeper.GetParams(ctx) + poolsParams := suite.poolsKeeper.GetParams(ctx) poolsParams.AllowedServicesIDs = []uint32{service.ID} - suite.App.PoolsKeeper.SetParams(ctx, poolsParams) + suite.poolsKeeper.SetParams(ctx, poolsParams) // Create operators. operatorAdmin1 := testutil.TestAddress(10001) diff --git a/app/testutil/test_suite.go b/x/rewards/keeper/common_test.go similarity index 61% rename from app/testutil/test_suite.go rename to x/rewards/keeper/common_test.go index faef66aa7..063228e37 100644 --- a/app/testutil/test_suite.go +++ b/x/rewards/keeper/common_test.go @@ -1,61 +1,97 @@ -package testutil +package keeper_test import ( "fmt" + "testing" "time" - "github.com/stretchr/testify/suite" - "cosmossdk.io/math" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" connecttypes "github.com/skip-mev/connect/v2/pkg/types" + marketmapkeeper "github.com/skip-mev/connect/v2/x/marketmap/keeper" marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper" oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" + "github.com/stretchr/testify/suite" - milkywayapp "github.com/milkyway-labs/milkyway/app" + "github.com/milkyway-labs/milkyway/app/testutil" + "github.com/milkyway-labs/milkyway/utils" + assetskeeper "github.com/milkyway-labs/milkyway/x/assets/keeper" assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" + bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" operatorskeeper "github.com/milkyway-labs/milkyway/x/operators/keeper" operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + poolskeeper "github.com/milkyway-labs/milkyway/x/pools/keeper" restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper" restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" - rewardskeeper "github.com/milkyway-labs/milkyway/x/rewards/keeper" + "github.com/milkyway-labs/milkyway/x/rewards/keeper" + "github.com/milkyway-labs/milkyway/x/rewards/testutils" rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper" servicestypes "github.com/milkyway-labs/milkyway/x/services/types" ) -// KeeperTestSuite is a base test suite for the keeper tests. type KeeperTestSuite struct { suite.Suite - App *milkywayapp.MilkyWayApp - Ctx sdk.Context + authority string + + ctx sdk.Context + cdc codec.Codec + + accountKeeper authkeeper.AccountKeeper + bankKeeper bankkeeper.Keeper + marketMapKeeper *marketmapkeeper.Keeper + oracleKeeper oraclekeeper.Keeper + assetsKeeper *assetskeeper.Keeper + poolsKeeper *poolskeeper.Keeper + servicesKeeper *serviceskeeper.Keeper + operatorsKeeper *operatorskeeper.Keeper + restakingKeeper *restakingkeeper.Keeper + + keeper *keeper.Keeper +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) } -// SetupTest creates a new MilkyWayApp and context for the test. func (suite *KeeperTestSuite) SetupTest() { - suite.App = milkywayapp.Setup(suite.T(), false) - suite.Ctx = suite.App.NewContextLegacy(false, cmtproto.Header{ - Height: 1, - Time: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC), - }) + data := testutils.NewKeeperTestData(suite.T()) + + suite.authority = data.AuthorityAddress + + suite.cdc = data.Cdc + suite.ctx = data.Context + + suite.accountKeeper = data.AccountKeeper + suite.bankKeeper = data.BankKeeper + suite.marketMapKeeper = data.MarketMapKeeper + suite.oracleKeeper = data.OracleKeeper + suite.assetsKeeper = data.AssetsKeeper + suite.poolsKeeper = data.PoolsKeeper + suite.servicesKeeper = data.ServicesKeeper + suite.operatorsKeeper = data.OperatorsKeeper + suite.restakingKeeper = data.RestakingKeeper + suite.keeper = data.Keeper } // FundAccount adds the given amount of coins to the account with the given address func (suite *KeeperTestSuite) FundAccount(ctx sdk.Context, addr string, amt sdk.Coins) { - // Mint the coins - moduleAcc := suite.App.AccountKeeper.GetModuleAccount(ctx, authtypes.Minter) + moduleAcc := suite.accountKeeper.GetModuleAccount(ctx, minttypes.ModuleName) - err := suite.App.BankKeeper.MintCoins(ctx, moduleAcc.GetName(), amt) + // Mint the coins + err := suite.bankKeeper.MintCoins(ctx, moduleAcc.GetName(), amt) suite.Require().NoError(err) // Send the amount to the user accAddr, err := sdk.AccAddressFromBech32(addr) suite.Require().NoError(err) - err = suite.App.BankKeeper.SendCoinsFromModuleToAccount(ctx, moduleAcc.GetName(), accAddr, amt) + err = suite.bankKeeper.SendCoinsFromModuleToAccount(ctx, moduleAcc.GetName(), accAddr, amt) suite.Require().NoError(err) } @@ -64,16 +100,16 @@ func (suite *KeeperTestSuite) FundAccount(ctx sdk.Context, addr string, amt sdk. func (suite *KeeperTestSuite) RegisterCurrency(ctx sdk.Context, denom string, ticker string, exponent uint32, price math.LegacyDec) { // Create the market only if it doesn't exist. mmTicker := marketmaptypes.NewTicker(ticker, rewardstypes.USDTicker, math.LegacyPrecision, 0, true) - hasMarket, err := suite.App.MarketMapKeeper.HasMarket(ctx, mmTicker.String()) + hasMarket, err := suite.marketMapKeeper.HasMarket(ctx, mmTicker.String()) suite.Require().NoError(err) if !hasMarket { - err = suite.App.MarketMapKeeper.CreateMarket(ctx, marketmaptypes.Market{Ticker: mmTicker}) + err = suite.marketMapKeeper.CreateMarket(ctx, marketmaptypes.Market{Ticker: mmTicker}) suite.Require().NoError(err) } // Set the price for the currency pair. - err = suite.App.OracleKeeper.SetPriceForCurrencyPair( + err = suite.oracleKeeper.SetPriceForCurrencyPair( ctx, connecttypes.NewCurrencyPair(ticker, rewardstypes.USDTicker), oracletypes.QuotePrice{ @@ -85,7 +121,7 @@ func (suite *KeeperTestSuite) RegisterCurrency(ctx sdk.Context, denom string, ti suite.Require().NoError(err) // Register the currency. - err = suite.App.AssetsKeeper.SetAsset(ctx, assetstypes.NewAsset(denom, ticker, exponent)) + err = suite.assetsKeeper.SetAsset(ctx, assetstypes.NewAsset(denom, ticker, exponent)) suite.Require().NoError(err) } @@ -93,7 +129,8 @@ func (suite *KeeperTestSuite) RegisterCurrency(ctx sdk.Context, denom string, ti // admin address. The service description and URLs related to the service are // randomly chosen. The service is also activated. func (suite *KeeperTestSuite) CreateService(ctx sdk.Context, name string, admin string) servicestypes.Service { - servicesMsgServer := serviceskeeper.NewMsgServer(suite.App.ServicesKeeper) + // Register the service + servicesMsgServer := serviceskeeper.NewMsgServer(suite.servicesKeeper) resp, err := servicesMsgServer.CreateService(ctx, servicestypes.NewMsgCreateService( name, fmt.Sprintf("%s AVS", name), @@ -107,7 +144,7 @@ func (suite *KeeperTestSuite) CreateService(ctx sdk.Context, name string, admin _, err = servicesMsgServer.ActivateService(ctx, servicestypes.NewMsgActivateService(resp.NewServiceID, admin)) suite.Require().NoError(err) - service, found := suite.App.ServicesKeeper.GetService(ctx, resp.NewServiceID) + service, found := suite.servicesKeeper.GetService(ctx, resp.NewServiceID) suite.Require().True(found, "service must be found") return service } @@ -117,7 +154,7 @@ func (suite *KeeperTestSuite) CreateService(ctx sdk.Context, name string, admin // randomly chosen. func (suite *KeeperTestSuite) CreateOperator(ctx sdk.Context, name string, admin string) operatorstypes.Operator { // Register the operator - operatorsMsgServer := operatorskeeper.NewMsgServer(suite.App.OperatorsKeeper) + operatorsMsgServer := operatorskeeper.NewMsgServer(suite.operatorsKeeper) resp, err := operatorsMsgServer.RegisterOperator(ctx, operatorstypes.NewMsgRegisterOperator( name, "https://example.com", @@ -127,7 +164,7 @@ func (suite *KeeperTestSuite) CreateOperator(ctx sdk.Context, name string, admin suite.Require().NoError(err) // Make sure the operator is found - operator, found := suite.App.OperatorsKeeper.GetOperator(ctx, resp.NewOperatorID) + operator, found := suite.operatorsKeeper.GetOperator(ctx, resp.NewOperatorID) suite.Require().True(found, "operator must be found") return operator } @@ -140,17 +177,17 @@ func (suite *KeeperTestSuite) UpdateOperatorParams( joinedServicesIDs []uint32, ) { // Make sure the operator is found - _, found := suite.App.OperatorsKeeper.GetOperator(ctx, operatorID) + _, found := suite.operatorsKeeper.GetOperator(ctx, operatorID) suite.Require().True(found, "operator must be found") // Sets the operator commission rate - err := suite.App.OperatorsKeeper.SaveOperatorParams(ctx, operatorID, + err := suite.operatorsKeeper.SaveOperatorParams(ctx, operatorID, operatorstypes.NewOperatorParams(commissionRate)) suite.Require().NoError(err) // Make the operator join the service. for _, serviceID := range joinedServicesIDs { - err = suite.App.RestakingKeeper.AddServiceToOperatorJoinedServices(ctx, operatorID, serviceID) + err = suite.restakingKeeper.AddServiceToOperatorJoinedServices(ctx, operatorID, serviceID) suite.Require().NoError(err) } } @@ -163,11 +200,11 @@ func (suite *KeeperTestSuite) AddPoolsToServiceSecuringPools( whitelistedPoolsIDs []uint32, ) { // Make sure the service is found - _, found := suite.App.ServicesKeeper.GetService(ctx, serviceID) + _, found := suite.servicesKeeper.GetService(ctx, serviceID) suite.Require().True(found, "service must be found") for _, poolID := range whitelistedPoolsIDs { - err := suite.App.RestakingKeeper.AddPoolToServiceSecuringPools(ctx, serviceID, poolID) + err := suite.restakingKeeper.AddPoolToServiceSecuringPools(ctx, serviceID, poolID) suite.Require().NoError(err) } } @@ -180,11 +217,11 @@ func (suite *KeeperTestSuite) AddOperatorsToServiceAllowList( allowedOperatorsID []uint32, ) { // Make sure the service is found - _, found := suite.App.ServicesKeeper.GetService(ctx, serviceID) + _, found := suite.servicesKeeper.GetService(ctx, serviceID) suite.Require().True(found, "service must be found") for _, operatorID := range allowedOperatorsID { - err := suite.App.RestakingKeeper.AddOperatorToServiceAllowList(ctx, serviceID, operatorID) + err := suite.restakingKeeper.AddOperatorToServiceAllowList(ctx, serviceID, operatorID) suite.Require().NoError(err) } } @@ -203,10 +240,10 @@ func (suite *KeeperTestSuite) CreateRewardsPlan( usersDistr rewardstypes.UsersDistribution, initialRewards sdk.Coins, ) rewardstypes.RewardsPlan { - service, found := suite.App.ServicesKeeper.GetService(ctx, serviceID) + service, found := suite.servicesKeeper.GetService(ctx, serviceID) suite.Require().True(found, "service must be found") - rewardsMsgServer := rewardskeeper.NewMsgServer(suite.App.RewardsKeeper) + rewardsMsgServer := keeper.NewMsgServer(suite.keeper) resp, err := rewardsMsgServer.CreateRewardsPlan(ctx, rewardstypes.NewMsgCreateRewardsPlan( serviceID, "Rewards Plan", @@ -221,7 +258,7 @@ func (suite *KeeperTestSuite) CreateRewardsPlan( suite.Require().NoError(err) // Return the newly created plan. - plan, err := suite.App.RewardsKeeper.GetRewardsPlan(ctx, resp.NewRewardsPlanID) + plan, err := suite.keeper.GetRewardsPlan(ctx, resp.NewRewardsPlanID) suite.Require().NoError(err) if initialRewards.IsAllPositive() { @@ -271,7 +308,7 @@ func (suite *KeeperTestSuite) DelegateOperator( } // Delegate the coins to the operator. - restakingMsgServer := restakingkeeper.NewMsgServer(suite.App.RestakingKeeper) + restakingMsgServer := restakingkeeper.NewMsgServer(suite.restakingKeeper) _, err := restakingMsgServer.DelegateOperator(ctx, restakingtypes.NewMsgDelegateOperator( operatorID, amt, @@ -289,7 +326,7 @@ func (suite *KeeperTestSuite) DelegateService(ctx sdk.Context, serviceID uint32, } // Delegate the coins to the service. - restakingMsgServer := restakingkeeper.NewMsgServer(suite.App.RestakingKeeper) + restakingMsgServer := restakingkeeper.NewMsgServer(suite.restakingKeeper) _, err := restakingMsgServer.DelegateService(ctx, restakingtypes.NewMsgDelegateService( serviceID, amt, @@ -307,7 +344,51 @@ func (suite *KeeperTestSuite) DelegatePool(ctx sdk.Context, amt sdk.Coin, delega } // Delegate the coins to the pool. - restakingMsgServer := restakingkeeper.NewMsgServer(suite.App.RestakingKeeper) + restakingMsgServer := restakingkeeper.NewMsgServer(suite.restakingKeeper) _, err := restakingMsgServer.DelegatePool(ctx, restakingtypes.NewMsgDelegatePool(amt, delegator)) suite.Require().NoError(err) } + +func (suite *KeeperTestSuite) allocateRewards(ctx sdk.Context, duration time.Duration) sdk.Context { + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(duration)).WithBlockHeight(ctx.BlockHeight() + 1) + err := suite.keeper.AllocateRewards(ctx) + suite.Require().NoError(err) + return ctx +} + +func (suite *KeeperTestSuite) setupSampleServiceAndOperator(ctx sdk.Context) (servicestypes.Service, operatorstypes.Operator) { + // This helper method: + // - registers $MILK, $INIT + // - creates a service named "MilkyWay" + // - creates a rewards plan with basic distribution types + // - it distributes 100 $MILK every day + // - creates an operator named "MilkyWay Operator" + // - it has 10% commission rate + // - it joins the newly created service + + // Register $MILK and $INIT. + suite.RegisterCurrency(ctx, "umilk", "MILK", 6, utils.MustParseDec("2")) + suite.RegisterCurrency(ctx, "uinit", "INIT", 6, utils.MustParseDec("3")) + + // Create a service. + serviceAdmin := testutil.TestAddress(10000) + service := suite.CreateService(ctx, "Service", serviceAdmin.String()) + + // Add the created service ID to the pools module's allowed list. + poolsParams := suite.poolsKeeper.GetParams(ctx) + poolsParams.AllowedServicesIDs = []uint32{service.ID} + suite.poolsKeeper.SetParams(ctx, poolsParams) + + // Create an operator. + operatorAdmin := testutil.TestAddress(10001) + operator := suite.CreateOperator(ctx, "Operator", operatorAdmin.String()) + + // Make the operator join the service and set its commission rate to 10%. + suite.UpdateOperatorParams(ctx, operator.ID, utils.MustParseDec("0.1"), []uint32{service.ID}) + + // Call AllocateRewards to set last rewards allocation time. + err := suite.keeper.AllocateRewards(ctx) + suite.Require().NoError(err) + + return service, operator +} diff --git a/x/rewards/keeper/grpc_query_test.go b/x/rewards/keeper/grpc_query_test.go index 8f1252c29..3ac3648a0 100644 --- a/x/rewards/keeper/grpc_query_test.go +++ b/x/rewards/keeper/grpc_query_test.go @@ -9,6 +9,7 @@ import ( "github.com/milkyway-labs/milkyway/app/testutil" "github.com/milkyway-labs/milkyway/utils" restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" + "github.com/milkyway-labs/milkyway/x/rewards/keeper" "github.com/milkyway-labs/milkyway/x/rewards/types" ) @@ -128,12 +129,13 @@ func (suite *KeeperTestSuite) TestQuerier_RewardsPlans() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } - res, err := suite.queryServer.RewardsPlans(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.RewardsPlans(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -198,12 +200,13 @@ func (suite *KeeperTestSuite) TestQuerier_RewardsPlan() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } - res, err := suite.queryServer.RewardsPlan(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.RewardsPlan(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -270,7 +273,7 @@ func (suite *KeeperTestSuite) TestQuerier_PoolOutstandingRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -278,7 +281,8 @@ func (suite *KeeperTestSuite) TestQuerier_PoolOutstandingRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.PoolOutstandingRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.PoolOutstandingRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -345,7 +349,7 @@ func (suite *KeeperTestSuite) TestQuerier_OperatorOutstandingRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -353,7 +357,8 @@ func (suite *KeeperTestSuite) TestQuerier_OperatorOutstandingRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.OperatorOutstandingRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.OperatorOutstandingRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -420,7 +425,7 @@ func (suite *KeeperTestSuite) TestQuerier_ServiceOutstandingRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -428,7 +433,8 @@ func (suite *KeeperTestSuite) TestQuerier_ServiceOutstandingRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.ServiceOutstandingRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.ServiceOutstandingRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -496,7 +502,7 @@ func (suite *KeeperTestSuite) TestQuerier_OperatorCommission() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -504,7 +510,8 @@ func (suite *KeeperTestSuite) TestQuerier_OperatorCommission() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.OperatorCommission(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.OperatorCommission(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -576,7 +583,7 @@ func (suite *KeeperTestSuite) TestQuerier_PoolDelegationRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -584,7 +591,8 @@ func (suite *KeeperTestSuite) TestQuerier_PoolDelegationRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.PoolDelegationRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.PoolDelegationRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -654,7 +662,7 @@ func (suite *KeeperTestSuite) TestQuerier_OperatorDelegationRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -662,7 +670,8 @@ func (suite *KeeperTestSuite) TestQuerier_OperatorDelegationRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.OperatorDelegationRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.OperatorDelegationRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -732,7 +741,7 @@ func (suite *KeeperTestSuite) TestQuerier_ServiceDelegationRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -740,7 +749,8 @@ func (suite *KeeperTestSuite) TestQuerier_ServiceDelegationRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.ServiceDelegationRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.ServiceDelegationRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -842,7 +852,7 @@ func (suite *KeeperTestSuite) TestQuerier_DelegatorTotalRewards() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } @@ -850,7 +860,8 @@ func (suite *KeeperTestSuite) TestQuerier_DelegatorTotalRewards() { ctx = tc.updateCtx(ctx) } - res, err := suite.queryServer.DelegatorTotalRewards(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.DelegatorTotalRewards(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { @@ -885,7 +896,8 @@ func (suite *KeeperTestSuite) TestQuerier_DelegatorWithdrawAddress() { { name: "delegator with different withdraw address set returns proper value", store: func(ctx sdk.Context) { - _, err := suite.msgServer.SetWithdrawAddress(ctx, types.NewMsgSetWithdrawAddress( + msgServer := keeper.NewMsgServer(suite.keeper) + _, err := msgServer.SetWithdrawAddress(ctx, types.NewMsgSetWithdrawAddress( "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", )) @@ -901,12 +913,13 @@ func (suite *KeeperTestSuite) TestQuerier_DelegatorWithdrawAddress() { for _, tc := range testCases { suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.store != nil { tc.store(ctx) } - res, err := suite.queryServer.DelegatorWithdrawAddress(ctx, tc.req) + queryServer := keeper.NewQueryServer(suite.keeper) + res, err := queryServer.DelegatorWithdrawAddress(ctx, tc.req) if tc.shouldErr { suite.Require().Error(err) } else { diff --git a/x/rewards/keeper/keeper.go b/x/rewards/keeper/keeper.go index 12cc820a3..a409250bc 100644 --- a/x/rewards/keeper/keeper.go +++ b/x/rewards/keeper/keeper.go @@ -83,63 +83,128 @@ func NewKeeper( restakingKeeper: restakingKeeper, assetsKeeper: assetsKeeper, - Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + Params: collections.NewItem(sb, + types.ParamsKey, + "params", + codec.CollValue[types.Params](cdc), + ), NextRewardsPlanID: collections.NewItem( - sb, types.NextRewardsPlanIDKey, "next_rewards_plan_id", collections.Uint64Value), + sb, + types.NextRewardsPlanIDKey, + "next_rewards_plan_id", + collections.Uint64Value, + ), RewardsPlans: collections.NewMap( - sb, types.RewardsPlanKeyPrefix, "rewards_plans", - collections.Uint64Key, codec.CollValue[types.RewardsPlan](cdc)), - LastRewardsAllocationTime: collections.NewItem(sb, types.LastRewardsAllocationTimeKey, "last_rewards_allocation_time", - codec.CollValue[gogotypes.Timestamp](cdc)), + sb, + types.RewardsPlanKeyPrefix, + "rewards_plans", + collections.Uint64Key, + codec.CollValue[types.RewardsPlan](cdc), + ), + LastRewardsAllocationTime: collections.NewItem( + sb, + types.LastRewardsAllocationTimeKey, + "last_rewards_allocation_time", + codec.CollValue[gogotypes.Timestamp](cdc), + ), DelegatorWithdrawAddrs: collections.NewMap( - sb, types.DelegatorWithdrawAddrKeyPrefix, "delegator_withdraw_addrs", + sb, + types.DelegatorWithdrawAddrKeyPrefix, + "delegator_withdraw_addrs", sdk.AccAddressKey, - collcodec.KeyToValueCodec(sdk.AccAddressKey)), + collcodec.KeyToValueCodec(sdk.AccAddressKey), + ), PoolDelegatorStartingInfos: collections.NewMap( - sb, types.PoolDelegatorStartingInfoKeyPrefix, "pool_delegator_starting_infos", + sb, + types.PoolDelegatorStartingInfoKeyPrefix, + "pool_delegator_starting_infos", collections.PairKeyCodec(collections.Uint32Key, sdk.AccAddressKey), - codec.CollValue[types.DelegatorStartingInfo](cdc)), + codec.CollValue[types.DelegatorStartingInfo](cdc), + ), PoolHistoricalRewards: collections.NewMap( - sb, types.PoolHistoricalRewardsKeyPrefix, "pool_historical_rewards", + sb, + types.PoolHistoricalRewardsKeyPrefix, + "pool_historical_rewards", collections.PairKeyCodec(collections.Uint32Key, collections.Uint64Key), - codec.CollValue[types.HistoricalRewards](cdc)), + codec.CollValue[types.HistoricalRewards](cdc), + ), PoolCurrentRewards: collections.NewMap( - sb, types.PoolCurrentRewardsKeyPrefix, "pool_current_rewards", - collections.Uint32Key, codec.CollValue[types.CurrentRewards](cdc)), + sb, + types.PoolCurrentRewardsKeyPrefix, + "pool_current_rewards", + collections.Uint32Key, + codec.CollValue[types.CurrentRewards](cdc), + ), PoolOutstandingRewards: collections.NewMap( - sb, types.PoolOutstandingRewardsKeyPrefix, "pool_outstanding_rewards", - collections.Uint32Key, codec.CollValue[types.OutstandingRewards](cdc)), + sb, + types.PoolOutstandingRewardsKeyPrefix, + "pool_outstanding_rewards", + collections.Uint32Key, + codec.CollValue[types.OutstandingRewards](cdc), + ), OperatorAccumulatedCommissions: collections.NewMap( - sb, types.OperatorAccumulatedCommissionKeyPrefix, "operator_accumulated_commissions", - collections.Uint32Key, codec.CollValue[types.AccumulatedCommission](cdc)), + sb, + types.OperatorAccumulatedCommissionKeyPrefix, + "operator_accumulated_commissions", + collections.Uint32Key, + codec.CollValue[types.AccumulatedCommission](cdc), + ), OperatorDelegatorStartingInfos: collections.NewMap( - sb, types.OperatorDelegatorStartingInfoKeyPrefix, "operator_delegator_starting_infos", + sb, + types.OperatorDelegatorStartingInfoKeyPrefix, + "operator_delegator_starting_infos", collections.PairKeyCodec(collections.Uint32Key, sdk.AccAddressKey), - codec.CollValue[types.DelegatorStartingInfo](cdc)), + codec.CollValue[types.DelegatorStartingInfo](cdc), + ), OperatorHistoricalRewards: collections.NewMap( - sb, types.OperatorHistoricalRewardsKeyPrefix, "operator_historical_rewards", + sb, + types.OperatorHistoricalRewardsKeyPrefix, + "operator_historical_rewards", collections.PairKeyCodec(collections.Uint32Key, collections.Uint64Key), - codec.CollValue[types.HistoricalRewards](cdc)), + codec.CollValue[types.HistoricalRewards](cdc), + ), OperatorCurrentRewards: collections.NewMap( - sb, types.OperatorCurrentRewardsKeyPrefix, "operator_current_rewards", - collections.Uint32Key, codec.CollValue[types.CurrentRewards](cdc)), + sb, + types.OperatorCurrentRewardsKeyPrefix, + "operator_current_rewards", + collections.Uint32Key, + codec.CollValue[types.CurrentRewards](cdc), + ), OperatorOutstandingRewards: collections.NewMap( - sb, types.OperatorOutstandingRewardsKeyPrefix, "operator_outstanding_rewards", - collections.Uint32Key, codec.CollValue[types.OutstandingRewards](cdc)), + sb, + types.OperatorOutstandingRewardsKeyPrefix, + "operator_outstanding_rewards", + collections.Uint32Key, + codec.CollValue[types.OutstandingRewards](cdc), + ), ServiceDelegatorStartingInfos: collections.NewMap( - sb, types.ServiceDelegatorStartingInfoKeyPrefix, "service_delegator_starting_infos", + sb, + types.ServiceDelegatorStartingInfoKeyPrefix, + "service_delegator_starting_infos", collections.PairKeyCodec(collections.Uint32Key, sdk.AccAddressKey), - codec.CollValue[types.DelegatorStartingInfo](cdc)), + codec.CollValue[types.DelegatorStartingInfo](cdc), + ), ServiceHistoricalRewards: collections.NewMap( - sb, types.ServiceHistoricalRewardsKeyPrefix, "service_historical_rewards", + sb, + types.ServiceHistoricalRewardsKeyPrefix, + "service_historical_rewards", collections.PairKeyCodec(collections.Uint32Key, collections.Uint64Key), - codec.CollValue[types.HistoricalRewards](cdc)), + codec.CollValue[types.HistoricalRewards](cdc), + ), ServiceCurrentRewards: collections.NewMap( - sb, types.ServiceCurrentRewardsKeyPrefix, "service_current_rewards", - collections.Uint32Key, codec.CollValue[types.CurrentRewards](cdc)), + sb, + types.ServiceCurrentRewardsKeyPrefix, + "service_current_rewards", + collections.Uint32Key, + codec.CollValue[types.CurrentRewards](cdc), + ), ServiceOutstandingRewards: collections.NewMap( - sb, types.ServiceOutstandingRewardsKeyPrefix, "service_outstanding_rewards", - collections.Uint32Key, codec.CollValue[types.OutstandingRewards](cdc)), + sb, + types.ServiceOutstandingRewardsKeyPrefix, + "service_outstanding_rewards", + collections.Uint32Key, + codec.CollValue[types.OutstandingRewards](cdc), + ), authority: authority, } diff --git a/x/rewards/keeper/keeper_test.go b/x/rewards/keeper/keeper_test.go deleted file mode 100644 index 8071003b7..000000000 --- a/x/rewards/keeper/keeper_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - "github.com/milkyway-labs/milkyway/app/testutil" - "github.com/milkyway-labs/milkyway/utils" - operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" - "github.com/milkyway-labs/milkyway/x/rewards/keeper" - "github.com/milkyway-labs/milkyway/x/rewards/types" - servicestypes "github.com/milkyway-labs/milkyway/x/services/types" -) - -type KeeperTestSuite struct { - testutil.KeeperTestSuite - - authority string - keeper *keeper.Keeper - msgServer types.MsgServer - queryServer types.QueryServer -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.KeeperTestSuite.SetupTest() - suite.authority = suite.App.RewardsKeeper.GetAuthority() - suite.keeper = suite.App.RewardsKeeper - suite.msgServer = keeper.NewMsgServer(suite.keeper) - suite.queryServer = keeper.NewQueryServer(suite.keeper) -} - -func (suite *KeeperTestSuite) allocateRewards(ctx sdk.Context, duration time.Duration) sdk.Context { - ctx = ctx.WithBlockTime(ctx.BlockTime().Add(duration)).WithBlockHeight(ctx.BlockHeight() + 1) - err := suite.keeper.AllocateRewards(ctx) - suite.Require().NoError(err) - return ctx -} - -func (suite *KeeperTestSuite) setupSampleServiceAndOperator(ctx sdk.Context) (servicestypes.Service, operatorstypes.Operator) { - // This helper method: - // - registers $MILK, $INIT - // - creates a service named "MilkyWay" - // - creates a rewards plan with basic distribution types - // - it distributes 100 $MILK every day - // - creates an operator named "MilkyWay Operator" - // - it has 10% commission rate - // - it joins the newly created service - - // Register $MILK and $INIT. - suite.RegisterCurrency(ctx, "umilk", "MILK", 6, utils.MustParseDec("2")) - suite.RegisterCurrency(ctx, "uinit", "INIT", 6, utils.MustParseDec("3")) - - // Create a service. - serviceAdmin := testutil.TestAddress(10000) - service := suite.CreateService(ctx, "Service", serviceAdmin.String()) - - // Add the created service ID to the pools module's allowed list. - poolsParams := suite.App.PoolsKeeper.GetParams(ctx) - poolsParams.AllowedServicesIDs = []uint32{service.ID} - suite.App.PoolsKeeper.SetParams(ctx, poolsParams) - - // Create an operator. - operatorAdmin := testutil.TestAddress(10001) - operator := suite.CreateOperator(ctx, "Operator", operatorAdmin.String()) - - // Make the operator join the service and set its commission rate to 10%. - suite.UpdateOperatorParams(ctx, operator.ID, utils.MustParseDec("0.1"), []uint32{service.ID}) - - // Call AllocateRewards to set last rewards allocation time. - err := suite.keeper.AllocateRewards(ctx) - suite.Require().NoError(err) - - return service, operator -} diff --git a/x/rewards/keeper/msg_server_test.go b/x/rewards/keeper/msg_server_test.go index 04bb87ff4..ec7dccdf9 100644 --- a/x/rewards/keeper/msg_server_test.go +++ b/x/rewards/keeper/msg_server_test.go @@ -136,7 +136,7 @@ func (suite *KeeperTestSuite) TestMsgCreateRewardsPlan() { senderAddr, err := sdk.AccAddressFromBech32(testutil.TestAddress(10000).String()) suite.Require().NoError(err) - balances := suite.App.BankKeeper.GetAllBalances(ctx, senderAddr) + balances := suite.bankKeeper.GetAllBalances(ctx, senderAddr) suite.Require().Equal("400000000umilk", balances.String()) }, }, @@ -145,7 +145,7 @@ func (suite *KeeperTestSuite) TestMsgCreateRewardsPlan() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() } @@ -380,14 +380,12 @@ func (suite *KeeperTestSuite) TestMsgEditRewardsPlan() { plan.EndTime, ) // Check pools distribution - poolsDistributionType, err := types.GetDistributionType( - suite.App.AppCodec(), plan.PoolsDistribution) + poolsDistributionType, err := types.GetDistributionType(suite.cdc, plan.PoolsDistribution) suite.Require().IsType(&types.DistributionTypeBasic{}, poolsDistributionType) suite.Require().Equal(uint32(1), plan.PoolsDistribution.Weight) // Check operators distribution - operatorsDistributionType, err := types.GetDistributionType( - suite.App.AppCodec(), plan.OperatorsDistribution) + operatorsDistributionType, err := types.GetDistributionType(suite.cdc, plan.OperatorsDistribution) suite.Require().IsType(&types.DistributionTypeBasic{}, operatorsDistributionType) suite.Require().Equal(uint32(2), plan.OperatorsDistribution.Weight) @@ -401,7 +399,7 @@ func (suite *KeeperTestSuite) TestMsgEditRewardsPlan() { tc := tc suite.Run(tc.name, func() { suite.SetupTest() - ctx := suite.Ctx + ctx := suite.ctx if tc.setup != nil { tc.setup() } @@ -489,7 +487,7 @@ func (suite *KeeperTestSuite) TestMsgSetWithdrawAddress() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() } @@ -627,7 +625,7 @@ func (suite *KeeperTestSuite) TestMsgWithdrawDelegatorReward() { delegatorAddress, err := sdk.AccAddressFromBech32("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd") suite.Require().NoError(err) - balances := suite.App.BankKeeper.GetAllBalances(ctx, delegatorAddress) + balances := suite.bankKeeper.GetAllBalances(ctx, delegatorAddress) suite.Require().Equal("11574service", balances.String()) }, }, @@ -636,7 +634,7 @@ func (suite *KeeperTestSuite) TestMsgWithdrawDelegatorReward() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() } @@ -768,7 +766,7 @@ func (suite *KeeperTestSuite) TestMsgWithdrawOperatorCommission() { check: func(ctx sdk.Context) { // Make sure the funds have been sent to the admin adminAddress := testutil.TestAddress(10001) - balances := suite.App.BankKeeper.GetAllBalances(ctx, adminAddress) + balances := suite.bankKeeper.GetAllBalances(ctx, adminAddress) suite.Require().Equal("1157service", balances.String()) }, shouldErr: false, @@ -778,7 +776,7 @@ func (suite *KeeperTestSuite) TestMsgWithdrawOperatorCommission() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() } diff --git a/x/rewards/keeper/oracle_test.go b/x/rewards/keeper/oracle_test.go index d9b912253..5de51fc02 100644 --- a/x/rewards/keeper/oracle_test.go +++ b/x/rewards/keeper/oracle_test.go @@ -6,7 +6,7 @@ import ( func (suite *KeeperTestSuite) TestGetAssetAndPrice() { // Cache the context to avoid issues - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() suite.RegisterCurrency(ctx, "umilk", "MILK", 6, utils.MustParseDec("2")) @@ -21,7 +21,7 @@ func (suite *KeeperTestSuite) TestGetAssetAndPrice() { func (suite *KeeperTestSuite) TestGetCoinValue() { // Cache the context to avoid issues - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() suite.RegisterCurrency(ctx, "umilk", "MILK", 6, utils.MustParseDec("2")) suite.RegisterCurrency(ctx, "afoo", "FOO", 18, utils.MustParseDec("0.53")) @@ -41,7 +41,7 @@ func (suite *KeeperTestSuite) TestGetCoinValue() { func (suite *KeeperTestSuite) TestGetCoinsValue() { // Cache the context to avoid issues - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() suite.RegisterCurrency(ctx, "umilk", "MILK", 6, utils.MustParseDec("2")) suite.RegisterCurrency(ctx, "uinit", "INIT", 6, utils.MustParseDec("3")) diff --git a/x/rewards/keeper/rewards_plan_test.go b/x/rewards/keeper/rewards_plan_test.go index 428aae8d6..ae5b5cdf3 100644 --- a/x/rewards/keeper/rewards_plan_test.go +++ b/x/rewards/keeper/rewards_plan_test.go @@ -13,7 +13,7 @@ import ( func (suite *KeeperTestSuite) TestCreateRewardsPlan_PoolOrOperatorNotFound() { // Cache the context to avoid errors - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() service, _ := suite.setupSampleServiceAndOperator(ctx) @@ -22,7 +22,7 @@ func (suite *KeeperTestSuite) TestCreateRewardsPlan_PoolOrOperatorNotFound() { planStartTime := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) planEndTime := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) - rewardsMsgServer := rewardskeeper.NewMsgServer(suite.App.RewardsKeeper) + rewardsMsgServer := rewardskeeper.NewMsgServer(suite.keeper) // There's no pool 1 yet. _, err := rewardsMsgServer.CreateRewardsPlan(ctx, types.NewMsgCreateRewardsPlan( @@ -71,7 +71,7 @@ func (suite *KeeperTestSuite) TestCreateRewardsPlan_PoolOrOperatorNotFound() { func (suite *KeeperTestSuite) TestTerminateEndedRewardsPlans() { // Cache the context to avoid errors - ctx, _ := suite.Ctx.CacheContext() + ctx, _ := suite.ctx.CacheContext() service, _ := suite.setupSampleServiceAndOperator(ctx) @@ -85,8 +85,8 @@ func (suite *KeeperTestSuite) TestTerminateEndedRewardsPlans() { utils.MustParseCoins("10000_000000service"), ) - rewardsPoolAddr := plan.MustGetRewardsPoolAddress(suite.App.AccountKeeper.AddressCodec()) - remaining := suite.App.BankKeeper.GetAllBalances(ctx, rewardsPoolAddr) + rewardsPoolAddr := plan.MustGetRewardsPoolAddress(suite.accountKeeper.AddressCodec()) + remaining := suite.bankKeeper.GetAllBalances(ctx, rewardsPoolAddr) suite.Require().Equal("10000000000service", remaining.String()) // Change the block time so that the plan becomes no more active. @@ -101,12 +101,12 @@ func (suite *KeeperTestSuite) TestTerminateEndedRewardsPlans() { suite.Require().ErrorIs(err, collections.ErrNotFound) // All remaining rewards are transferred to the service's address. - remaining = suite.App.BankKeeper.GetAllBalances(ctx, rewardsPoolAddr) + remaining = suite.bankKeeper.GetAllBalances(ctx, rewardsPoolAddr) suite.Require().True(remaining.IsZero()) // Check the service's address balances. - serviceAddr, err := suite.App.AccountKeeper.AddressCodec().StringToBytes(service.Address) + serviceAddr, err := suite.accountKeeper.AddressCodec().StringToBytes(service.Address) suite.Require().NoError(err) - serviceBalances := suite.App.BankKeeper.GetAllBalances(ctx, serviceAddr) + serviceBalances := suite.bankKeeper.GetAllBalances(ctx, serviceAddr) suite.Require().Equal("10000000000service", serviceBalances.String()) } diff --git a/x/rewards/testutils/keeper.go b/x/rewards/testutils/keeper.go new file mode 100644 index 000000000..20003a4bf --- /dev/null +++ b/x/rewards/testutils/keeper.go @@ -0,0 +1,152 @@ +package testutils + +import ( + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/runtime" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + marketmapkeeper "github.com/skip-mev/connect/v2/x/marketmap/keeper" + marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types" + oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper" + oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" + "github.com/stretchr/testify/require" + + "github.com/milkyway-labs/milkyway/app/keepers" + "github.com/milkyway-labs/milkyway/testutils/storetesting" + assetskeeper "github.com/milkyway-labs/milkyway/x/assets/keeper" + assetstypes "github.com/milkyway-labs/milkyway/x/assets/types" + operatorskeeper "github.com/milkyway-labs/milkyway/x/operators/keeper" + operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + poolskeeper "github.com/milkyway-labs/milkyway/x/pools/keeper" + poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" + restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper" + restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" + rewardskeeper "github.com/milkyway-labs/milkyway/x/rewards/keeper" + rewardstypes "github.com/milkyway-labs/milkyway/x/rewards/types" + serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper" + servicestypes "github.com/milkyway-labs/milkyway/x/services/types" +) + +type KeeperTestData struct { + storetesting.BaseKeeperTestData + + MarketMapKeeper *marketmapkeeper.Keeper + OracleKeeper oraclekeeper.Keeper + PoolsKeeper *poolskeeper.Keeper + OperatorsKeeper *operatorskeeper.Keeper + ServicesKeeper *serviceskeeper.Keeper + RestakingKeeper *restakingkeeper.Keeper + AssetsKeeper *assetskeeper.Keeper + + Keeper *rewardskeeper.Keeper +} + +func NewKeeperTestData(t *testing.T) KeeperTestData { + var data = KeeperTestData{ + BaseKeeperTestData: storetesting.NewBaseKeeperTestData(t, []string{ + marketmaptypes.StoreKey, + oracletypes.StoreKey, + poolstypes.StoreKey, + operatorstypes.StoreKey, + servicestypes.StoreKey, + restakingtypes.StoreKey, + assetstypes.StoreKey, + rewardstypes.StoreKey, + }), + } + + data.Context = data.Context. + WithBlockHeight(1). + WithBlockTime(time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC)) + + communityPoolKeeper := keepers.NewCommunityPoolKeeper(data.BankKeeper, authtypes.FeeCollectorName) + + data.MarketMapKeeper = marketmapkeeper.NewKeeper( + runtime.NewKVStoreService(data.Keys[marketmaptypes.StoreKey]), + data.Cdc, + authtypes.NewModuleAddress(govtypes.ModuleName), + ) + + data.OracleKeeper = oraclekeeper.NewKeeper( + runtime.NewKVStoreService(data.Keys[oracletypes.StoreKey]), + data.Cdc, + data.MarketMapKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName), + ) + + data.PoolsKeeper = poolskeeper.NewKeeper( + data.Cdc, + data.Keys[poolstypes.StoreKey], + runtime.NewKVStoreService(data.Keys[poolstypes.StoreKey]), + data.AccountKeeper, + ) + data.OperatorsKeeper = operatorskeeper.NewKeeper( + data.Cdc, + data.Keys[operatorstypes.StoreKey], + runtime.NewKVStoreService(data.Keys[operatorstypes.StoreKey]), + data.AccountKeeper, + communityPoolKeeper, + data.AuthorityAddress, + ) + data.ServicesKeeper = serviceskeeper.NewKeeper( + data.Cdc, + data.Keys[servicestypes.StoreKey], + runtime.NewKVStoreService(data.Keys[servicestypes.StoreKey]), + data.AccountKeeper, + communityPoolKeeper, + data.AuthorityAddress, + ) + data.RestakingKeeper = restakingkeeper.NewKeeper( + data.Cdc, + data.Keys[restakingtypes.StoreKey], + runtime.NewKVStoreService(data.Keys[restakingtypes.StoreKey]), + data.AccountKeeper, + data.BankKeeper, + data.PoolsKeeper, + data.OperatorsKeeper, + data.ServicesKeeper, + data.AuthorityAddress, + ) + data.AssetsKeeper = assetskeeper.NewKeeper( + data.Cdc, + runtime.NewKVStoreService(data.Keys[assetstypes.StoreKey]), + data.AuthorityAddress, + ) + + data.Keeper = rewardskeeper.NewKeeper( + data.Cdc, + runtime.NewKVStoreService(data.Keys[rewardstypes.StoreKey]), + data.AccountKeeper, + data.BankKeeper, + communityPoolKeeper, + &data.OracleKeeper, + data.PoolsKeeper, + data.OperatorsKeeper, + data.ServicesKeeper, + data.RestakingKeeper, + data.AssetsKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Set the hooks + data.OperatorsKeeper.SetHooks(data.RestakingKeeper.OperatorsHooks()) + data.ServicesKeeper.SetHooks(data.RestakingKeeper.ServicesHooks()) + data.RestakingKeeper.SetHooks(data.Keeper.Hooks()) + + // Set the base params + data.PoolsKeeper.SetNextPoolID(data.Context, 1) + data.PoolsKeeper.SetParams(data.Context, poolstypes.DefaultParams()) + + data.ServicesKeeper.SetNextServiceID(data.Context, 1) + data.ServicesKeeper.SetParams(data.Context, servicestypes.DefaultParams()) + + data.OperatorsKeeper.SetNextOperatorID(data.Context, 1) + data.OperatorsKeeper.SetParams(data.Context, operatorstypes.DefaultParams()) + + require.NoError(t, data.Keeper.NextRewardsPlanID.Set(data.Context, 1)) + require.NoError(t, data.Keeper.Params.Set(data.Context, rewardstypes.DefaultParams())) + + return data +} diff --git a/x/rewards/types/genesis_test.go b/x/rewards/types/genesis_test.go index 81dc61f95..f015697c4 100644 --- a/x/rewards/types/genesis_test.go +++ b/x/rewards/types/genesis_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/milkyway-labs/milkyway/app" + milkyway "github.com/milkyway-labs/milkyway/app" "github.com/milkyway-labs/milkyway/utils" "github.com/milkyway-labs/milkyway/x/rewards/types" ) @@ -49,7 +49,7 @@ func TestGenesisState_Validate(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - cdc, _ := app.MakeCodecs() + cdc, _ := milkyway.MakeCodecs() err := tc.genesis.Validate(cdc) if tc.shouldErr { require.Error(t, err) diff --git a/x/rewards/types/models_test.go b/x/rewards/types/models_test.go index 07595f1f8..fc32c6b60 100644 --- a/x/rewards/types/models_test.go +++ b/x/rewards/types/models_test.go @@ -10,7 +10,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/milkyway-labs/milkyway/app" + milkyway "github.com/milkyway-labs/milkyway/app" "github.com/milkyway-labs/milkyway/utils" "github.com/milkyway-labs/milkyway/x/rewards/types" ) @@ -131,7 +131,7 @@ func TestRewardsPlan_Validate(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - cdc, _ := app.MakeCodecs() + cdc, _ := milkyway.MakeCodecs() err := tc.plan.Validate(cdc) if tc.shouldErr { require.Error(t, err) diff --git a/x/services/keeper/common_test.go b/x/services/keeper/common_test.go index b7e411c6a..119abd6d6 100644 --- a/x/services/keeper/common_test.go +++ b/x/services/keeper/common_test.go @@ -3,13 +3,10 @@ package keeper_test import ( "testing" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "go.uber.org/mock/gomock" - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/stretchr/testify/suite" bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" @@ -24,9 +21,7 @@ func TestKeeperTestSuite(t *testing.T) { type KeeperTestSuite struct { suite.Suite - cdc codec.Codec - legacyAminoCdc *codec.LegacyAmino - ctx sdk.Context + ctx sdk.Context storeKey storetypes.StoreKey @@ -34,42 +29,29 @@ type KeeperTestSuite struct { bk bankkeeper.Keeper k *keeper.Keeper hooks *testutils.MockHooks - - ctrl *gomock.Controller - poolKeeper *testutils.MockCommunityPoolKeeper } func (suite *KeeperTestSuite) SetupTest() { data := testutils.NewKeeperTestData(suite.T()) - - suite.storeKey = data.StoreKey - suite.ctx = data.Context - suite.cdc, suite.legacyAminoCdc = data.Cdc, data.LegacyAmino - - suite.ctrl = data.MockCtrl + suite.storeKey = data.StoreKey // Build keepers suite.ak = data.AccountKeeper suite.bk = data.BankKeeper suite.k = data.Keeper - suite.poolKeeper = data.PoolKeeper // Set hooks suite.hooks = data.Hooks } -func (suite *KeeperTestSuite) TearDownTest() { - suite.ctrl.Finish() -} - // -------------------------------------------------------------------------------------------------------------------- // fundAccount adds the given amount of coins to the account with the given address func (suite *KeeperTestSuite) fundAccount(ctx sdk.Context, address string, amount sdk.Coins) { - // Mint the coins - moduleAcc := suite.ak.GetModuleAccount(ctx, authtypes.Minter) + moduleAcc := suite.ak.GetModuleAccount(ctx, minttypes.ModuleName) + // Mint the coins err := suite.bk.MintCoins(ctx, moduleAcc.GetName(), amount) suite.Require().NoError(err) diff --git a/x/services/keeper/genesis_test.go b/x/services/keeper/genesis_test.go index 11c612fbb..7f6c1410a 100644 --- a/x/services/keeper/genesis_test.go +++ b/x/services/keeper/genesis_test.go @@ -124,6 +124,8 @@ func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { + suite.SetupTest() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() @@ -268,6 +270,8 @@ func (suite *KeeperTestSuite) TestKeeper_InitGenesis() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { + suite.SetupTest() + ctx, _ := suite.ctx.CacheContext() err := suite.k.InitGenesis(ctx, tc.genesis) diff --git a/x/services/keeper/invariants_test.go b/x/services/keeper/invariants_test.go index 1a1d52931..e468fb6ad 100644 --- a/x/services/keeper/invariants_test.go +++ b/x/services/keeper/invariants_test.go @@ -108,6 +108,8 @@ func (suite *KeeperTestSuite) TestValidServicesInvariant() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { + suite.SetupTest() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() diff --git a/x/services/keeper/msg_server_test.go b/x/services/keeper/msg_server_test.go index c4617ecbd..2c613c47f 100644 --- a/x/services/keeper/msg_server_test.go +++ b/x/services/keeper/msg_server_test.go @@ -137,6 +137,8 @@ func (suite *KeeperTestSuite) TestMsgServer_CreateService() { for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { + suite.SetupTest() + ctx, _ := suite.ctx.CacheContext() if tc.setup != nil { tc.setup() diff --git a/x/services/testutils/keeper.go b/x/services/testutils/keeper.go index ec50a83f2..d5bda10a5 100644 --- a/x/services/testutils/keeper.go +++ b/x/services/testutils/keeper.go @@ -3,14 +3,21 @@ package testutils import ( "testing" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "go.uber.org/mock/gomock" + milkyway "github.com/milkyway-labs/milkyway/app" "github.com/milkyway-labs/milkyway/app/keepers" "github.com/milkyway-labs/milkyway/testutils/storetesting" + bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper" poolskeeper "github.com/milkyway-labs/milkyway/x/pools/keeper" poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" "github.com/milkyway-labs/milkyway/x/services/keeper" @@ -21,7 +28,6 @@ type KeeperTestData struct { storetesting.BaseKeeperTestData StoreKey storetypes.StoreKey - MockCtrl *gomock.Controller PoolKeeper *MockCommunityPoolKeeper @@ -31,25 +37,48 @@ type KeeperTestData struct { Hooks *MockHooks } -// NewKeeperTestData returns a new KeeperTestData func NewKeeperTestData(t *testing.T) KeeperTestData { - t.Helper() - - // Initialize the base test data var data = KeeperTestData{ BaseKeeperTestData: storetesting.NewBaseKeeperTestData(t, []string{ - authtypes.StoreKey, banktypes.StoreKey, servicestypes.StoreKey, poolstypes.StoreKey, + authtypes.StoreKey, + banktypes.StoreKey, + servicestypes.StoreKey, + poolstypes.StoreKey, }), } // Define store keys data.StoreKey = data.Keys[servicestypes.StoreKey] + // Setup the codecs + encodingConfig := milkyway.MakeEncodingConfig() + data.Cdc, data.LegacyAmino = encodingConfig.Marshaler, encodingConfig.Amino + // Mocks initializations data.MockCtrl = gomock.NewController(t) data.PoolKeeper = NewMockCommunityPoolKeeper(data.MockCtrl) + // Authority address + authorityAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + // Build keepers + data.AccountKeeper = authkeeper.NewAccountKeeper( + data.Cdc, + runtime.NewKVStoreService(data.Keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, + milkyway.MaccPerms, + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + sdk.GetConfig().GetBech32AccountAddrPrefix(), + authorityAddr, + ) + data.BankKeeper = bankkeeper.NewKeeper( + data.Cdc, + runtime.NewKVStoreService(data.Keys[banktypes.StoreKey]), + data.AccountKeeper, + nil, + authorityAddr, + log.NewNopLogger(), + ) data.PoolsKeeper = poolskeeper.NewKeeper( data.Cdc, data.Keys[poolstypes.StoreKey], @@ -62,7 +91,7 @@ func NewKeeperTestData(t *testing.T) KeeperTestData { runtime.NewKVStoreService(data.Keys[servicestypes.StoreKey]), data.AccountKeeper, keepers.NewCommunityPoolKeeper(data.BankKeeper, authtypes.FeeCollectorName), - data.AuthorityAddress, + authorityAddr, ) // Set hooks diff --git a/x/stakeibc/keeper/hooks.go b/x/stakeibc/keeper/hooks.go index 7dd7e21a6..c9a577cfc 100644 --- a/x/stakeibc/keeper/hooks.go +++ b/x/stakeibc/keeper/hooks.go @@ -2,13 +2,10 @@ package keeper import ( "fmt" - "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/gogoproto/proto" epochstypes "github.com/milkyway-labs/milkyway/x/epochs/types" - "github.com/milkyway-labs/milkyway/x/stakeibc/types" ) const StrideEpochsPerDayEpoch = uint64(4) @@ -105,7 +102,6 @@ func (k Keeper) Hooks() Hooks { return Hooks{k} } -// epochs hooks func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { h.k.BeforeEpochStart(ctx, epochInfo) } @@ -114,7 +110,7 @@ func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { h.k.AfterEpochEnd(ctx, epochInfo) } -// Set the withdrawal account address for each host zone +// SetWithdrawalAddress sets the withdrawal account address for each host zone func (k Keeper) SetWithdrawalAddress(ctx sdk.Context) { k.Logger(ctx).Info("Setting Withdrawal Addresses...") @@ -126,7 +122,7 @@ func (k Keeper) SetWithdrawalAddress(ctx sdk.Context) { } } -// Claim staking rewards for each host zone +// ClaimAccruedStakingRewards allows to claim staking rewards for each host zone func (k Keeper) ClaimAccruedStakingRewards(ctx sdk.Context) { k.Logger(ctx).Info("Claiming Accrued Staking Rewards...") @@ -137,30 +133,3 @@ func (k Keeper) ClaimAccruedStakingRewards(ctx sdk.Context) { } } } - -// TODO [cleanup]: Remove after v17 upgrade -func (k Keeper) DisableHubTokenization(ctx sdk.Context) { - k.Logger(ctx).Info("Disabling the ability to tokenize Gaia delegations") - - chainId := "cosmoshub-4" - hostZone, found := k.GetHostZone(ctx, chainId) - if !found { - k.Logger(ctx).Error("Gaia host zone not found, unable to disable tokenization") - return - } - - // Build the msg for the disable tokenization ICA tx - var msgs []proto.Message - msgs = append(msgs, &types.MsgDisableTokenizeShares{ - DelegatorAddress: hostZone.DelegationIcaAddress, - }) - - // Send the ICA tx to disable tokenization - timeoutTimestamp := uint64(ctx.BlockTime().Add(24 * time.Hour).UnixNano()) - delegationOwner := types.FormatHostZoneICAOwner(hostZone.ChainId, types.ICAAccountType_DELEGATION) - err := k.SubmitICATxWithoutCallback(ctx, hostZone.ConnectionId, delegationOwner, msgs, timeoutTimestamp) - if err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Failed to submit ICA tx to disable tokenization for gaia: %s", err.Error())) - return - } -} diff --git a/x/stakeibc/keeper/ibc.go b/x/stakeibc/keeper/ibc.go index 64a570314..85a27c713 100644 --- a/x/stakeibc/keeper/ibc.go +++ b/x/stakeibc/keeper/ibc.go @@ -11,7 +11,7 @@ import ( ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/spf13/cast" - ratelimittypes "github.com/Stride-Labs/ibc-rate-limiting/ratelimit/types" + ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types" "github.com/milkyway-labs/milkyway/x/stakeibc/types" ) diff --git a/x/stakeibc/keeper/keeper.go b/x/stakeibc/keeper/keeper.go index 22175ec83..336d7cde8 100644 --- a/x/stakeibc/keeper/keeper.go +++ b/x/stakeibc/keeper/keeper.go @@ -38,7 +38,6 @@ type ( icaCallbacksKeeper icacallbackskeeper.Keeper hooks types.StakeIBCHooks rateLimitKeeper types.RatelimitKeeper - opChildKeeper types.OPChildKeeper params collections.Item[types.Params] } ) @@ -57,7 +56,6 @@ func NewKeeper( RecordsKeeper recordsmodulekeeper.Keeper, icaCallbacksKeeper icacallbackskeeper.Keeper, rateLimitKeeper types.RatelimitKeeper, - opChildKeeper types.OPChildKeeper, ) Keeper { sb := collections.NewSchemaBuilder(storeService) return Keeper{ @@ -73,7 +71,6 @@ func NewKeeper( recordsKeeper: RecordsKeeper, icaCallbacksKeeper: icaCallbacksKeeper, rateLimitKeeper: rateLimitKeeper, - opChildKeeper: opChildKeeper, params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), } } @@ -105,16 +102,6 @@ func (k Keeper) ValidateAdminAddress(ctx sdk.Context, address string) error { return nil } - // The OpChild admin can always perform admin operations - opChildParams, err := k.opChildKeeper.GetParams(ctx) - if err != nil { - return err - } - - if opChildParams.Admin == address { - return nil - } - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "address (%s) is not an admin", address) } diff --git a/x/stakeibc/testutil/expected_keepers_mocks.go b/x/stakeibc/testutil/expected_keepers_mocks.go deleted file mode 100644 index f901cd6e8..000000000 --- a/x/stakeibc/testutil/expected_keepers_mocks.go +++ /dev/null @@ -1,349 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: ./x/stakeibc/types/expected_keepers.go -// -// Generated by this command: -// -// mockgen -source ./x/stakeibc/types/expected_keepers.go -package testutil -destination ./x/stakeibc/testutil/expected_keepers_mocks.go -// - -// Package testutil is a generated GoMock package. -package testutil - -import ( - context "context" - reflect "reflect" - - types "github.com/Stride-Labs/ibc-rate-limiting/ratelimit/types" - types0 "github.com/cosmos/cosmos-sdk/types" - gomock "go.uber.org/mock/gomock" -) - -// MockAccountKeeper is a mock of AccountKeeper interface. -type MockAccountKeeper struct { - ctrl *gomock.Controller - recorder *MockAccountKeeperMockRecorder -} - -// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. -type MockAccountKeeperMockRecorder struct { - mock *MockAccountKeeper -} - -// NewMockAccountKeeper creates a new mock instance. -func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { - mock := &MockAccountKeeper{ctrl: ctrl} - mock.recorder = &MockAccountKeeperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { - return m.recorder -} - -// GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types0.AccountI) - return ret0 -} - -// GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) -} - -// GetAllAccounts mocks base method. -func (m *MockAccountKeeper) GetAllAccounts(ctx context.Context) []types0.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllAccounts", ctx) - ret0, _ := ret[0].([]types0.AccountI) - return ret0 -} - -// GetAllAccounts indicates an expected call of GetAllAccounts. -func (mr *MockAccountKeeperMockRecorder) GetAllAccounts(ctx any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).GetAllAccounts), ctx) -} - -// GetModuleAccount mocks base method. -func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName string) types0.ModuleAccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetModuleAccount", ctx, moduleName) - ret0, _ := ret[0].(types0.ModuleAccountI) - return ret0 -} - -// GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) -} - -// NewAccount mocks base method. -func (m *MockAccountKeeper) NewAccount(arg0 context.Context, arg1 types0.AccountI) types0.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewAccount", arg0, arg1) - ret0, _ := ret[0].(types0.AccountI) - return ret0 -} - -// NewAccount indicates an expected call of NewAccount. -func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccount", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccount), arg0, arg1) -} - -// RemoveAccount mocks base method. -func (m *MockAccountKeeper) RemoveAccount(ctx context.Context, acc types0.AccountI) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RemoveAccount", ctx, acc) -} - -// RemoveAccount indicates an expected call of RemoveAccount. -func (mr *MockAccountKeeperMockRecorder) RemoveAccount(ctx, acc any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAccount", reflect.TypeOf((*MockAccountKeeper)(nil).RemoveAccount), ctx, acc) -} - -// SetAccount mocks base method. -func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types0.AccountI) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetAccount", ctx, acc) -} - -// SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) -} - -// MockBankKeeper is a mock of BankKeeper interface. -type MockBankKeeper struct { - ctrl *gomock.Controller - recorder *MockBankKeeperMockRecorder -} - -// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. -type MockBankKeeperMockRecorder struct { - mock *MockBankKeeper -} - -// NewMockBankKeeper creates a new mock instance. -func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { - mock := &MockBankKeeper{ctrl: ctrl} - mock.recorder = &MockBankKeeperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { - return m.recorder -} - -// GetAllBalances mocks base method. -func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types0.AccAddress) types0.Coins { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllBalances", ctx, addr) - ret0, _ := ret[0].(types0.Coins) - return ret0 -} - -// GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) -} - -// GetBalance mocks base method. -func (m *MockBankKeeper) GetBalance(ctx context.Context, addr types0.AccAddress, denom string) types0.Coin { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBalance", ctx, addr, denom) - ret0, _ := ret[0].(types0.Coin) - return ret0 -} - -// GetBalance indicates an expected call of GetBalance. -func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom) -} - -// MintCoins mocks base method. -func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt types0.Coins) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt) - ret0, _ := ret[0].(error) - return ret0 -} - -// MintCoins indicates an expected call of MintCoins. -func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) -} - -// SendCoinsFromAccountToModule mocks base method. -func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types0.AccAddress, recipientModule string, amt types0.Coins) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) -} - -// SendCoinsFromModuleToAccount mocks base method. -func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types0.AccAddress, amt types0.Coins) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) -} - -// SendCoinsFromModuleToModule mocks base method. -func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt types0.Coins) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendCoinsFromModuleToModule", ctx, senderModule, recipientModule, amt) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) -} - -// SpendableCoins mocks base method. -func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types0.AccAddress) types0.Coins { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) - ret0, _ := ret[0].(types0.Coins) - return ret0 -} - -// SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) -} - -// MockStakeIBCHooks is a mock of StakeIBCHooks interface. -type MockStakeIBCHooks struct { - ctrl *gomock.Controller - recorder *MockStakeIBCHooksMockRecorder -} - -// MockStakeIBCHooksMockRecorder is the mock recorder for MockStakeIBCHooks. -type MockStakeIBCHooksMockRecorder struct { - mock *MockStakeIBCHooks -} - -// NewMockStakeIBCHooks creates a new mock instance. -func NewMockStakeIBCHooks(ctrl *gomock.Controller) *MockStakeIBCHooks { - mock := &MockStakeIBCHooks{ctrl: ctrl} - mock.recorder = &MockStakeIBCHooksMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockStakeIBCHooks) EXPECT() *MockStakeIBCHooksMockRecorder { - return m.recorder -} - -// AfterLiquidStake mocks base method. -func (m *MockStakeIBCHooks) AfterLiquidStake(ctx types0.Context, addr types0.AccAddress) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "AfterLiquidStake", ctx, addr) -} - -// AfterLiquidStake indicates an expected call of AfterLiquidStake. -func (mr *MockStakeIBCHooksMockRecorder) AfterLiquidStake(ctx, addr any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterLiquidStake", reflect.TypeOf((*MockStakeIBCHooks)(nil).AfterLiquidStake), ctx, addr) -} - -// MockRatelimitKeeper is a mock of RatelimitKeeper interface. -type MockRatelimitKeeper struct { - ctrl *gomock.Controller - recorder *MockRatelimitKeeperMockRecorder -} - -// MockRatelimitKeeperMockRecorder is the mock recorder for MockRatelimitKeeper. -type MockRatelimitKeeperMockRecorder struct { - mock *MockRatelimitKeeper -} - -// NewMockRatelimitKeeper creates a new mock instance. -func NewMockRatelimitKeeper(ctrl *gomock.Controller) *MockRatelimitKeeper { - mock := &MockRatelimitKeeper{ctrl: ctrl} - mock.recorder = &MockRatelimitKeeperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockRatelimitKeeper) EXPECT() *MockRatelimitKeeperMockRecorder { - return m.recorder -} - -// AddDenomToBlacklist mocks base method. -func (m *MockRatelimitKeeper) AddDenomToBlacklist(ctx types0.Context, denom string) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "AddDenomToBlacklist", ctx, denom) -} - -// AddDenomToBlacklist indicates an expected call of AddDenomToBlacklist. -func (mr *MockRatelimitKeeperMockRecorder) AddDenomToBlacklist(ctx, denom any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDenomToBlacklist", reflect.TypeOf((*MockRatelimitKeeper)(nil).AddDenomToBlacklist), ctx, denom) -} - -// RemoveDenomFromBlacklist mocks base method. -func (m *MockRatelimitKeeper) RemoveDenomFromBlacklist(ctx types0.Context, denom string) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RemoveDenomFromBlacklist", ctx, denom) -} - -// RemoveDenomFromBlacklist indicates an expected call of RemoveDenomFromBlacklist. -func (mr *MockRatelimitKeeperMockRecorder) RemoveDenomFromBlacklist(ctx, denom any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveDenomFromBlacklist", reflect.TypeOf((*MockRatelimitKeeper)(nil).RemoveDenomFromBlacklist), ctx, denom) -} - -// RemoveWhitelistedAddressPair mocks base method. -func (m *MockRatelimitKeeper) RemoveWhitelistedAddressPair(ctx types0.Context, sender, receiver string) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RemoveWhitelistedAddressPair", ctx, sender, receiver) -} - -// RemoveWhitelistedAddressPair indicates an expected call of RemoveWhitelistedAddressPair. -func (mr *MockRatelimitKeeperMockRecorder) RemoveWhitelistedAddressPair(ctx, sender, receiver any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveWhitelistedAddressPair", reflect.TypeOf((*MockRatelimitKeeper)(nil).RemoveWhitelistedAddressPair), ctx, sender, receiver) -} - -// SetWhitelistedAddressPair mocks base method. -func (m *MockRatelimitKeeper) SetWhitelistedAddressPair(ctx types0.Context, whitelist types.WhitelistedAddressPair) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetWhitelistedAddressPair", ctx, whitelist) -} - -// SetWhitelistedAddressPair indicates an expected call of SetWhitelistedAddressPair. -func (mr *MockRatelimitKeeperMockRecorder) SetWhitelistedAddressPair(ctx, whitelist any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWhitelistedAddressPair", reflect.TypeOf((*MockRatelimitKeeper)(nil).SetWhitelistedAddressPair), ctx, whitelist) -} diff --git a/x/stakeibc/types/expected_keepers.go b/x/stakeibc/types/expected_keepers.go index f92acdc98..92b0db19f 100644 --- a/x/stakeibc/types/expected_keepers.go +++ b/x/stakeibc/types/expected_keepers.go @@ -3,9 +3,8 @@ package types import ( "context" - ratelimittypes "github.com/Stride-Labs/ibc-rate-limiting/ratelimit/types" sdk "github.com/cosmos/cosmos-sdk/types" - opchildtypes "github.com/initia-labs/OPinit/x/opchild/types" + ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types" ) // AccountKeeper defines the expected account keeper used for simulations (noalias) @@ -47,7 +46,3 @@ type RatelimitKeeper interface { SetWhitelistedAddressPair(ctx sdk.Context, whitelist ratelimittypes.WhitelistedAddressPair) RemoveWhitelistedAddressPair(ctx sdk.Context, sender, receiver string) } - -type OPChildKeeper interface { - GetParams(ctx context.Context) (opchildtypes.Params, error) -}