Skip to content

Commit

Permalink
No longer disable dynamic dep generation during ACL dependency genera…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
udpatil committed Jan 25, 2024
1 parent f01454c commit d45d10d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 0 additions & 5 deletions x/accesscontrol/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 4 additions & 3 deletions x/accesscontrol/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit d45d10d

Please sign in to comment.