From 30688b02bd52da8ed75cfb97ea458fe7dd5a6a1b Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 5 Sep 2024 11:41:58 +0200 Subject: [PATCH] refactor: simplify epoch hooks (#21552) --- x/epochs/types/hooks.go | 7 ------- x/epochs/types/hooks_test.go | 5 ----- x/mint/epoch_hooks.go | 5 ----- x/mint/go.mod | 1 + x/mint/go.sum | 2 -- 5 files changed, 1 insertion(+), 19 deletions(-) diff --git a/x/epochs/types/hooks.go b/x/epochs/types/hooks.go index 28ec99409d45..f8609a39058a 100644 --- a/x/epochs/types/hooks.go +++ b/x/epochs/types/hooks.go @@ -10,8 +10,6 @@ type EpochHooks interface { AfterEpochEnd(ctx context.Context, epochIdentifier string, epochNumber int64) error // new epoch is next block of epoch end block BeforeEpochStart(ctx context.Context, epochIdentifier string, epochNumber int64) error - // Returns the name of the module implementing epoch hook. - GetModuleName() string } var _ EpochHooks = MultiEpochHooks{} @@ -19,11 +17,6 @@ var _ EpochHooks = MultiEpochHooks{} // combine multiple gamm hooks, all hook functions are run in array sequence. type MultiEpochHooks []EpochHooks -// GetModuleName implements EpochHooks. -func (MultiEpochHooks) GetModuleName() string { - return ModuleName -} - func NewMultiEpochHooks(hooks ...EpochHooks) MultiEpochHooks { return hooks } diff --git a/x/epochs/types/hooks_test.go b/x/epochs/types/hooks_test.go index 8134c55562bb..01f443163d37 100644 --- a/x/epochs/types/hooks_test.go +++ b/x/epochs/types/hooks_test.go @@ -37,11 +37,6 @@ type dummyEpochHook struct { shouldError bool } -// GetModuleName implements types.EpochHooks. -func (*dummyEpochHook) GetModuleName() string { - return "dummy" -} - func (hook *dummyEpochHook) AfterEpochEnd(ctx context.Context, epochIdentifier string, epochNumber int64) error { if hook.shouldError { return dummyErr diff --git a/x/mint/epoch_hooks.go b/x/mint/epoch_hooks.go index 9c1ae6ff1c04..f2a3daf0d8db 100644 --- a/x/mint/epoch_hooks.go +++ b/x/mint/epoch_hooks.go @@ -8,11 +8,6 @@ import ( var _ epochstypes.EpochHooks = AppModule{} -// GetModuleName implements types.EpochHooks. -func (am AppModule) GetModuleName() string { - return am.Name() -} - // BeforeEpochStart calls the mint function. func (am AppModule) BeforeEpochStart(ctx context.Context, epochIdentifier string, epochNumber int64) error { minter, err := am.keeper.Minter.Get(ctx) diff --git a/x/mint/go.mod b/x/mint/go.mod index e3ffb73bf5b7..53b3140da4c7 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -185,6 +185,7 @@ replace ( cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus + cosmossdk.io/x/epochs => ../epochs cosmossdk.io/x/staking => ../staking cosmossdk.io/x/tx => ../tx ) diff --git a/x/mint/go.sum b/x/mint/go.sum index fc8d66053506..95e8920cbdb5 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -16,8 +16,6 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 h1:GuBrfHsK3RD5vlD4DuBz3DXslR6VlnzrYmHOC3L679Q= -cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337/go.mod h1:PhLn1pMBilyRC4GfRkoYhm+XVAYhF4adVrzut8AdpJI= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=