Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer disable dynamic dep generation during ACL dependency generation #404

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading