From d45d10d5f47806bf6eefc39555527833186ef4ac Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Thu, 25 Jan 2024 09:04:14 -0600 Subject: [PATCH] No longer disable dynamic dep generation during ACL dependency generation --- x/accesscontrol/keeper/keeper.go | 5 ----- x/accesscontrol/keeper/keeper_test.go | 7 ++++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/x/accesscontrol/keeper/keeper.go b/x/accesscontrol/keeper/keeper.go index 1ca93f602..2a2719f7e 100644 --- a/x/accesscontrol/keeper/keeper.go +++ b/x/accesscontrol/keeper/keeper.go @@ -578,11 +578,6 @@ func (k Keeper) GetMessageDependencies(ctx sdk.Context, msg sdk.Msg) []acltypes. ctx.Logger().Error(errorMessage) } } - if dependencyMapping.DynamicEnabled { - // there was an issue with dynamic generation, so lets disable it - // this will not error, the validation check was done in previous calls already - _ = k.SetDependencyMappingDynamicFlag(ctx, messageKey, false) - } return dependencyMapping.AccessOps } diff --git a/x/accesscontrol/keeper/keeper_test.go b/x/accesscontrol/keeper/keeper_test.go index f08cd1ade..52e714f5c 100644 --- a/x/accesscontrol/keeper/keeper_test.go +++ b/x/accesscontrol/keeper/keeper_test.go @@ -112,7 +112,8 @@ func TestInvalidGetMessageDependencies(t *testing.T) { delete(app.AccessControlKeeper.MessageDependencyGeneratorMapper, undelegateKey) accessOps := app.AccessControlKeeper.GetMessageDependencies(ctx, &stakingUndelegate) require.Equal(t, types.SynchronousMessageDependencyMapping("").AccessOps, accessOps) - require.False(t, app.AccessControlKeeper.GetResourceDependencyMapping(ctx, undelegateKey).DynamicEnabled) + // no longer gets disabled such that there arent writes in the dependency generation path + require.True(t, app.AccessControlKeeper.GetResourceDependencyMapping(ctx, undelegateKey).DynamicEnabled) } func TestWasmDependencyMapping(t *testing.T) { @@ -2464,14 +2465,14 @@ func (suite *KeeperTestSuite) TestMessageDependencies() { req.Equal(delegateStaticMapping.AccessOps, accessOps) // verify dynamic got disabled dependencyMapping = app.AccessControlKeeper.GetResourceDependencyMapping(ctx, delegateKey) - req.Equal(false, dependencyMapping.DynamicEnabled) + req.Equal(true, dependencyMapping.DynamicEnabled) // lets also try with undelegate, but this time there is no dynamic generator, so we disable it as well accessOps = app.AccessControlKeeper.GetMessageDependencies(ctx, &stakingUndelegate) req.Equal(undelegateStaticMapping.AccessOps, accessOps) // verify dynamic got disabled dependencyMapping = app.AccessControlKeeper.GetResourceDependencyMapping(ctx, undelegateKey) - req.Equal(false, dependencyMapping.DynamicEnabled) + req.Equal(true, dependencyMapping.DynamicEnabled) } func (suite *KeeperTestSuite) TestImportContractReferences() {