diff --git a/client/x/evmengine/keeper/abci_internal_test.go b/client/x/evmengine/keeper/abci_internal_test.go index 44935211..23b25fa1 100644 --- a/client/x/evmengine/keeper/abci_internal_test.go +++ b/client/x/evmengine/keeper/abci_internal_test.go @@ -221,7 +221,6 @@ func TestKeeper_PrepareProposal(t *testing.T) { ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) if tt.setupMocks != nil { @@ -232,7 +231,7 @@ func TestKeeper_PrepareProposal(t *testing.T) { tt.mockEngine.EngineClient, err = ethclient.NewEngineMock(storeKey) require.NoError(t, err) - k, err := NewKeeper(cdc, storeService, &tt.mockEngine, &tt.mockClient, txConfig, ak, esk, uk, mk, dk) + k, err := NewKeeper(cdc, storeService, &tt.mockEngine, &tt.mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) k.SetValidatorAddress(common.BytesToAddress([]byte("test"))) populateGenesisHead(ctx, t, k) @@ -263,12 +262,11 @@ func TestKeeper_PrepareProposal(t *testing.T) { ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) // Expected call for PeekEligibleWithdrawals esk.EXPECT().PeekEligibleWithdrawals(gomock.Any()).Return(nil, nil).AnyTimes() - keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, mk, dk) + keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) keeper.SetValidatorAddress(common.BytesToAddress([]byte("test"))) populateGenesisHead(ctx, t, keeper) @@ -452,7 +450,6 @@ func TestKeeper_PostFinalize(t *testing.T) { ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) if tt.setupMocks != nil { @@ -472,7 +469,7 @@ func TestKeeper_PostFinalize(t *testing.T) { tt.mockEngine.EngineClient, err = ethclient.NewEngineMock(storeKey) require.NoError(t, err) - k, err := NewKeeper(cdc, storeService, &tt.mockEngine, &tt.mockClient, txConfig, ak, esk, uk, mk, dk) + k, err := NewKeeper(cdc, storeService, &tt.mockEngine, &tt.mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) k.SetCometAPI(cmtAPI) k.SetValidatorAddress(nxtAddr) diff --git a/client/x/evmengine/keeper/keeper.go b/client/x/evmengine/keeper/keeper.go index 95d49513..9a3545cf 100644 --- a/client/x/evmengine/keeper/keeper.go +++ b/client/x/evmengine/keeper/keeper.go @@ -41,7 +41,6 @@ type Keeper struct { accountKeeper types.AccountKeeper evmstakingKeeper types.EvmStakingKeeper upgradeKeeper types.UpgradeKeeper - mintKeeper types.MintKeeper distrKeeper types.DistrKeeper upgradeContract *bindings.UpgradeEntrypoint @@ -67,7 +66,6 @@ func NewKeeper( ak types.AccountKeeper, esk types.EvmStakingKeeper, uk types.UpgradeKeeper, - mk types.MintKeeper, dk types.DistrKeeper, ) (*Keeper, error) { schema := &ormv1alpha1.ModuleSchemaDescriptor{SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{ @@ -105,7 +103,6 @@ func NewKeeper( upgradeKeeper: uk, upgradeContract: upgradeContract, ubiContract: ubiContract, - mintKeeper: mk, distrKeeper: dk, }, nil } diff --git a/client/x/evmengine/keeper/keeper_internal_test.go b/client/x/evmengine/keeper/keeper_internal_test.go index 897322e4..594c47af 100644 --- a/client/x/evmengine/keeper/keeper_internal_test.go +++ b/client/x/evmengine/keeper/keeper_internal_test.go @@ -49,14 +49,13 @@ func createTestKeeper(t *testing.T) (context.Context, *Keeper) { ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) ctx, storeKey, storeService := setupCtxStore(t, &header) mockEngine, err := newMockEngineAPI(storeKey, 0) require.NoError(t, err) - keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, mk, dk) + keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) keeper.SetCometAPI(cmtAPI) @@ -80,13 +79,12 @@ func createKeeper(t *testing.T, args args) (sdk.Context, *mockCometAPI, *Keeper) ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) ctx, storeKey, storeService := setupCtxStore(t, &header) mockEngine, err := newMockEngineAPI(storeKey, 0) require.NoError(t, err) - keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, mk, dk) + keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) keeper.SetCometAPI(cmtAPI) keeper.SetValidatorAddress(nxtAddr) diff --git a/client/x/evmengine/keeper/msg_server.go b/client/x/evmengine/keeper/msg_server.go index f8f53d18..9584004b 100644 --- a/client/x/evmengine/keeper/msg_server.go +++ b/client/x/evmengine/keeper/msg_server.go @@ -115,9 +115,6 @@ func (s msgServer) ExecutionPayload(ctx context.Context, msg *types.MsgExecution if err := s.ProcessUpgradeEvents(ctx, payload.Number-1, msg.PrevPayloadEvents); err != nil { return nil, errors.Wrap(err, "deliver upgrade-related event logs") } - if err := s.mintKeeper.ProcessInflationEvents(ctx, payload.Number-1, msg.PrevPayloadEvents); err != nil { - return nil, errors.Wrap(err, "deliver inflation-related event logs") - } if err := s.ProcessUbiEvents(ctx, payload.Number-1, msg.PrevPayloadEvents); err != nil { return nil, errors.Wrap(err, "deliver ubi-related event logs") } diff --git a/client/x/evmengine/keeper/msg_server_internal_test.go b/client/x/evmengine/keeper/msg_server_internal_test.go index c0632243..a761f317 100644 --- a/client/x/evmengine/keeper/msg_server_internal_test.go +++ b/client/x/evmengine/keeper/msg_server_internal_test.go @@ -40,7 +40,6 @@ func Test_msgServer_ExecutionPayload(t *testing.T) { ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) cmtAPI := newMockCometAPI(t, nil) @@ -55,7 +54,7 @@ func Test_msgServer_ExecutionPayload(t *testing.T) { evmLogProc := mockLogProvider{deliverErr: errors.New("test error")} mockEngine, err := newMockEngineAPI(storeKey, 2) require.NoError(t, err) - keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, mk, dk) + keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) keeper.SetCometAPI(cmtAPI) keeper.SetValidatorAddress(nxtAddr) @@ -101,7 +100,6 @@ func Test_msgServer_ExecutionPayload(t *testing.T) { setup: func(c context.Context) sdk.Context { esk.EXPECT().DequeueEligibleWithdrawals(c).Return(nil, nil) esk.EXPECT().ProcessStakingEvents(c, gomock.Any(), gomock.Any()).Return(nil) - mk.EXPECT().ProcessInflationEvents(c, gomock.Any(), gomock.Any()).Return(nil) return sdk.UnwrapSDKContext(c) }, diff --git a/client/x/evmengine/keeper/proposal_server_internal_test.go b/client/x/evmengine/keeper/proposal_server_internal_test.go index 040bec3c..b7a5e0bf 100644 --- a/client/x/evmengine/keeper/proposal_server_internal_test.go +++ b/client/x/evmengine/keeper/proposal_server_internal_test.go @@ -34,7 +34,6 @@ func Test_proposalServer_ExecutionPayload(t *testing.T) { ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) esk.EXPECT().PeekEligibleWithdrawals(gomock.Any()).Return(nil, nil).AnyTimes() @@ -42,7 +41,7 @@ func Test_proposalServer_ExecutionPayload(t *testing.T) { sdkCtx = sdkCtx.WithExecMode(sdk.ExecModeFinalize) mockEngine, err := newMockEngineAPI(storeKey, 0) require.NoError(t, err) - keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, mk, dk) + keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) populateGenesisHead(sdkCtx, t, keeper) propSrv := NewProposalServer(keeper) diff --git a/client/x/evmengine/keeper/upgrades_internal_test.go b/client/x/evmengine/keeper/upgrades_internal_test.go index e8c15c78..be3aa634 100644 --- a/client/x/evmengine/keeper/upgrades_internal_test.go +++ b/client/x/evmengine/keeper/upgrades_internal_test.go @@ -262,14 +262,13 @@ func setupTestEnvironment(t *testing.T) (*Keeper, sdk.Context, *gomock.Controlle ak := moduletestutil.NewMockAccountKeeper(ctrl) esk := moduletestutil.NewMockEvmStakingKeeper(ctrl) uk := moduletestutil.NewMockUpgradeKeeper(ctrl) - mk := moduletestutil.NewMockMintKeeper(ctrl) dk := moduletestutil.NewMockDistrKeeper(ctrl) ctx, storeKey, storeService := setupCtxStore(t, &header) mockEngine, err := newMockEngineAPI(storeKey, 0) require.NoError(t, err) - keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, mk, dk) + keeper, err := NewKeeper(cdc, storeService, &mockEngine, mockClient, txConfig, ak, esk, uk, dk) require.NoError(t, err) keeper.SetCometAPI(cmtAPI) nxtAddr, err := k1util.PubKeyToAddress(cmtAPI.validatorSet.Validators[1].PubKey) diff --git a/client/x/evmengine/module/depinject.go b/client/x/evmengine/module/depinject.go index 7d97ea8f..ca94060d 100644 --- a/client/x/evmengine/module/depinject.go +++ b/client/x/evmengine/module/depinject.go @@ -36,7 +36,6 @@ type ModuleInputs struct { AccountKeeper types.AccountKeeper EvmStakingKeeper types.EvmStakingKeeper UpgradeKeeper types.UpgradeKeeper - MintKeeper types.MintKeeper DistrKeeper types.DistrKeeper } @@ -58,7 +57,6 @@ func ProvideModule(in ModuleInputs) (ModuleOutputs, error) { in.AccountKeeper, in.EvmStakingKeeper, in.UpgradeKeeper, - in.MintKeeper, in.DistrKeeper, ) if err != nil { diff --git a/client/x/evmengine/testutil/expected_keepers_mocks.go b/client/x/evmengine/testutil/expected_keepers_mocks.go index e61c25a0..0bdd00eb 100644 --- a/client/x/evmengine/testutil/expected_keepers_mocks.go +++ b/client/x/evmengine/testutil/expected_keepers_mocks.go @@ -26,6 +26,7 @@ import ( type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -63,6 +64,7 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName any) *gomoc type MockEvmStakingKeeper struct { ctrl *gomock.Controller recorder *MockEvmStakingKeeperMockRecorder + isgomock struct{} } // MockEvmStakingKeeperMockRecorder is the mock recorder for MockEvmStakingKeeper. @@ -188,6 +190,7 @@ func (mr *MockEvmStakingKeeperMockRecorder) ProcessWithdraw(ctx, ev any) *gomock type MockUpgradeKeeper struct { ctrl *gomock.Controller recorder *MockUpgradeKeeperMockRecorder + isgomock struct{} } // MockUpgradeKeeperMockRecorder is the mock recorder for MockUpgradeKeeper. @@ -221,47 +224,11 @@ func (mr *MockUpgradeKeeperMockRecorder) ScheduleUpgrade(ctx, plan any) *gomock. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScheduleUpgrade", reflect.TypeOf((*MockUpgradeKeeper)(nil).ScheduleUpgrade), ctx, plan) } -// MockMintKeeper is a mock of MintKeeper interface. -type MockMintKeeper struct { - ctrl *gomock.Controller - recorder *MockMintKeeperMockRecorder -} - -// MockMintKeeperMockRecorder is the mock recorder for MockMintKeeper. -type MockMintKeeperMockRecorder struct { - mock *MockMintKeeper -} - -// NewMockMintKeeper creates a new mock instance. -func NewMockMintKeeper(ctrl *gomock.Controller) *MockMintKeeper { - mock := &MockMintKeeper{ctrl: ctrl} - mock.recorder = &MockMintKeeperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockMintKeeper) EXPECT() *MockMintKeeperMockRecorder { - return m.recorder -} - -// ProcessInflationEvents mocks base method. -func (m *MockMintKeeper) ProcessInflationEvents(ctx context.Context, height uint64, logs []*types2.EVMEvent) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProcessInflationEvents", ctx, height, logs) - ret0, _ := ret[0].(error) - return ret0 -} - -// ProcessInflationEvents indicates an expected call of ProcessInflationEvents. -func (mr *MockMintKeeperMockRecorder) ProcessInflationEvents(ctx, height, logs any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessInflationEvents", reflect.TypeOf((*MockMintKeeper)(nil).ProcessInflationEvents), ctx, height, logs) -} - // MockDistrKeeper is a mock of DistrKeeper interface. type MockDistrKeeper struct { ctrl *gomock.Controller recorder *MockDistrKeeperMockRecorder + isgomock struct{} } // MockDistrKeeperMockRecorder is the mock recorder for MockDistrKeeper. diff --git a/client/x/evmengine/types/expected_keepers.go b/client/x/evmengine/types/expected_keepers.go index 28f8fc45..93e05489 100644 --- a/client/x/evmengine/types/expected_keepers.go +++ b/client/x/evmengine/types/expected_keepers.go @@ -30,10 +30,6 @@ type UpgradeKeeper interface { ScheduleUpgrade(ctx context.Context, plan upgradetypes.Plan) error } -type MintKeeper interface { - ProcessInflationEvents(ctx context.Context, height uint64, logs []*EVMEvent) error -} - type DistrKeeper interface { SetUbi(ctx context.Context, newUbi math.LegacyDec) error } diff --git a/client/x/evmstaking/keeper/keeper.go b/client/x/evmstaking/keeper/keeper.go index 19cb1e44..19d636d9 100644 --- a/client/x/evmstaking/keeper/keeper.go +++ b/client/x/evmstaking/keeper/keeper.go @@ -126,7 +126,7 @@ func (k Keeper) ProcessStakingEvents(ctx context.Context, height uint64, logs [] // Convert the amount from wei to gwei (Eth2 spec withdrawal is specified in gwei) by dividing by 10^9. // TODO: consider rounding and decimal precision when dividing bigint. - switch ethlog.Topics[0] { // TODO(rayden): update validator commission + switch ethlog.Topics[0] { case types.UpdateValidatorCommission.ID: ev, err := k.ipTokenStakingContract.ParseUpdateValidatorCommssion(ethlog) if err != nil { diff --git a/client/x/evmstaking/keeper/validator.go b/client/x/evmstaking/keeper/validator.go index 38682a6e..6524b758 100644 --- a/client/x/evmstaking/keeper/validator.go +++ b/client/x/evmstaking/keeper/validator.go @@ -104,7 +104,6 @@ func (k Keeper) ProcessCreateValidator(ctx context.Context, ev *bindings.IPToken skeeperMsgServer := skeeper.NewMsgServerImpl(evmstakingSKeeper) if _, err = k.stakingKeeper.GetValidator(ctx, validatorAddr); err == nil { - // TODO(rayden): refund return errors.New("validator already exists") } else if !errors.Is(err, stypes.ErrNoValidatorFound) { // Either the validator does not exist, or unknown error. diff --git a/client/x/evmstaking/testutil/expected_keepers_mocks.go b/client/x/evmstaking/testutil/expected_keepers_mocks.go index 4fbbeea2..e9cd2c8f 100644 --- a/client/x/evmstaking/testutil/expected_keepers_mocks.go +++ b/client/x/evmstaking/testutil/expected_keepers_mocks.go @@ -28,6 +28,7 @@ import ( type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -171,6 +172,7 @@ func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(ctx, modAcc any) *gomo type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -376,6 +378,7 @@ func (mr *MockBankKeeperMockRecorder) UndelegateCoinsFromModuleToAccount(ctx, se type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -668,6 +671,7 @@ func (mr *MockStakingKeeperMockRecorder) ValidatorAddressCodec() *gomock.Call { type MockSlashingKeeper struct { ctrl *gomock.Controller recorder *MockSlashingKeeperMockRecorder + isgomock struct{} } // MockSlashingKeeperMockRecorder is the mock recorder for MockSlashingKeeper. @@ -705,6 +709,7 @@ func (mr *MockSlashingKeeperMockRecorder) Unjail(ctx, validatorAddr any) *gomock type MockDistributionKeeper struct { ctrl *gomock.Controller recorder *MockDistributionKeeperMockRecorder + isgomock struct{} } // MockDistributionKeeperMockRecorder is the mock recorder for MockDistributionKeeper. diff --git a/client/x/mint/keeper/genesis_test.go b/client/x/mint/keeper/genesis_test.go index 13dc5a93..ae662b24 100644 --- a/client/x/mint/keeper/genesis_test.go +++ b/client/x/mint/keeper/genesis_test.go @@ -13,13 +13,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/piplabs/story/client/x/mint/keeper" mintmodule "github.com/piplabs/story/client/x/mint/module" minttestutil "github.com/piplabs/story/client/x/mint/testutil" "github.com/piplabs/story/client/x/mint/types" + + "go.uber.org/mock/gomock" ) var minterAcc = authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Minter) diff --git a/client/x/mint/keeper/grpc_query_test.go b/client/x/mint/keeper/grpc_query_test.go index 63b433d6..0f7ce6da 100644 --- a/client/x/mint/keeper/grpc_query_test.go +++ b/client/x/mint/keeper/grpc_query_test.go @@ -13,13 +13,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/piplabs/story/client/x/mint/keeper" mintmodule "github.com/piplabs/story/client/x/mint/module" minttestutil "github.com/piplabs/story/client/x/mint/testutil" "github.com/piplabs/story/client/x/mint/types" + + "go.uber.org/mock/gomock" ) type MintTestSuite struct { diff --git a/client/x/mint/keeper/keeper.go b/client/x/mint/keeper/keeper.go index 0f1d9394..8e8f18ff 100644 --- a/client/x/mint/keeper/keeper.go +++ b/client/x/mint/keeper/keeper.go @@ -13,10 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - evmenginetypes "github.com/piplabs/story/client/x/evmengine/types" "github.com/piplabs/story/client/x/mint/types" - "github.com/piplabs/story/contracts/bindings" - clog "github.com/piplabs/story/lib/log" ) // Keeper of the mint store. @@ -27,8 +24,6 @@ type Keeper struct { bankKeeper types.BankKeeper feeCollectorName string - inflationUpdateContract *bindings.IPTokenStaking // (rayden) TODO - Schema collections.Schema Params collections.Item[types.Params] } @@ -49,13 +44,12 @@ func NewKeeper( sb := collections.NewSchemaBuilder(storeService) k := Keeper{ - cdc: cdc, - storeService: storeService, - stakingKeeper: sk, - bankKeeper: bk, - feeCollectorName: feeCollectorName, - inflationUpdateContract: nil, - Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + cdc: cdc, + storeService: storeService, + stakingKeeper: sk, + bankKeeper: bk, + feeCollectorName: feeCollectorName, + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), } schema, err := sb.Build() @@ -101,10 +95,3 @@ func (k Keeper) MintCoins(ctx context.Context, newCoins sdk.Coins) error { func (k Keeper) AddCollectedFees(ctx context.Context, fees sdk.Coins) error { return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, k.feeCollectorName, fees) } - -func (k Keeper) ProcessInflationEvents(ctx context.Context, height uint64, logs []*evmenginetypes.EVMEvent) error { - // (rayden) TODO - clog.Debug(ctx, "Processed inflation events", "height", height, "count", len(logs)) - - return nil -} diff --git a/client/x/mint/keeper/keeper_test.go b/client/x/mint/keeper/keeper_test.go index c22fa287..ace6bf97 100644 --- a/client/x/mint/keeper/keeper_test.go +++ b/client/x/mint/keeper/keeper_test.go @@ -12,13 +12,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/piplabs/story/client/x/mint/keeper" mintmodule "github.com/piplabs/story/client/x/mint/module" minttestutil "github.com/piplabs/story/client/x/mint/testutil" "github.com/piplabs/story/client/x/mint/types" + + "go.uber.org/mock/gomock" ) type IntegrationTestSuite struct { diff --git a/client/x/mint/keeper/set_inflation_parameters.go b/client/x/mint/keeper/set_inflation_parameters.go deleted file mode 100644 index 70de29cb..00000000 --- a/client/x/mint/keeper/set_inflation_parameters.go +++ /dev/null @@ -1,14 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/piplabs/story/contracts/bindings" -) - -//nolint:revive // (rayden) TODO -func (k Keeper) ProcessSetInflationParameters(ctx context.Context, ev *bindings.IPTokenStakingDeposit) error { - // (rayden) TODO - - return nil -} diff --git a/client/x/mint/testutil/expected_keepers_mocks.go b/client/x/mint/testutil/expected_keepers_mocks.go index 26be50dd..4ac87ead 100644 --- a/client/x/mint/testutil/expected_keepers_mocks.go +++ b/client/x/mint/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: x/mint/types/expected_keepers.go +// Source: ../client/x/mint/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=../client/x/mint/types/expected_keepers.go -package testutil -destination ../client/x/mint/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -10,13 +15,14 @@ import ( math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockStakingKeeper is a mock of StakingKeeper interface. type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -46,7 +52,7 @@ func (m *MockStakingKeeper) BondedRatio(ctx context.Context) (math.LegacyDec, er } // BondedRatio indicates an expected call of BondedRatio. -func (mr *MockStakingKeeperMockRecorder) BondedRatio(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) BondedRatio(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondedRatio", reflect.TypeOf((*MockStakingKeeper)(nil).BondedRatio), ctx) } @@ -61,7 +67,7 @@ func (m *MockStakingKeeper) StakingTokenSupply(ctx context.Context) (math.Int, e } // StakingTokenSupply indicates an expected call of StakingTokenSupply. -func (mr *MockStakingKeeperMockRecorder) StakingTokenSupply(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) StakingTokenSupply(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StakingTokenSupply", reflect.TypeOf((*MockStakingKeeper)(nil).StakingTokenSupply), ctx) } @@ -70,6 +76,7 @@ func (mr *MockStakingKeeperMockRecorder) StakingTokenSupply(ctx interface{}) *go type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -98,7 +105,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName str } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { +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) } @@ -112,27 +119,28 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } // SetModuleAccount mocks base method. -func (m *MockAccountKeeper) SetModuleAccount(arg0 context.Context, arg1 types.ModuleAccountI) { +func (m *MockAccountKeeper) SetModuleAccount(ctx context.Context, moduleAccount types.ModuleAccountI) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetModuleAccount", arg0, arg1) + m.ctrl.Call(m, "SetModuleAccount", ctx, moduleAccount) } // SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(ctx, moduleAccount any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), ctx, moduleAccount) } // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -161,7 +169,7 @@ func (m *MockBankKeeper) MintCoins(ctx context.Context, name string, amt types.C } // MintCoins indicates an expected call of MintCoins. -func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, name, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, name, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, name, amt) } @@ -175,7 +183,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, sende } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +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) } @@ -189,7 +197,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, sender } // SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { +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) } diff --git a/client/x/mint/types/inflation_contract.go b/client/x/mint/types/inflation_contract.go deleted file mode 100644 index 113232c3..00000000 --- a/client/x/mint/types/inflation_contract.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - - "github.com/piplabs/story/contracts/bindings" -) - -// (rayden) TODO. -var ( - inflationUpdateABI = mustGetABI(bindings.IPTokenStakingMetaData) - SetInflationParameters = mustGetEvent(inflationUpdateABI, "Deposit") -) - -// mustGetABI returns the metadata's ABI as an abi.ABI type. -// It panics on error. -func mustGetABI(metadata *bind.MetaData) *abi.ABI { - abi, err := metadata.GetAbi() - if err != nil { - panic(err) - } - - return abi -} - -// mustGetEvent returns the event with the given name from the ABI. -// It panics if the event is not found. -func mustGetEvent(abi *abi.ABI, name string) abi.Event { - event, ok := abi.Events[name] - if !ok { - panic("event not found") - } - - return event -} diff --git a/go.mod b/go.mod index 83f437b4..150acb01 100644 --- a/go.mod +++ b/go.mod @@ -129,7 +129,7 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect - github.com/golang/mock v1.6.0 + github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect