Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

[acl] Add dependency switch to support dynamic deps#35

Merged
udpatil merged 6 commits intomainfrom
get-dependencies
Oct 9, 2022
Merged

[acl] Add dependency switch to support dynamic deps#35
udpatil merged 6 commits intomainfrom
get-dependencies

Conversation

@udpatil
Copy link
Contributor

@udpatil udpatil commented Oct 5, 2022

Describe your changes and provide context

This introduces the GetMessageDependencies function that returns the access operations for the message. It either returns the static access ops from the keeper store, or if we've implemented a specific case for that message type, it will generate the dynamic message typing if applicable.

Testing performed to validate your change

Need to refactor sei-chain with this function and verify the default behavior is as expected.

@udpatil udpatil requested review from BrandonWeng and codchen October 5, 2022 20:35
Comment on lines +153 to +167
dependencyMapping := k.GetResourceDependencyMapping(ctx, messageKey)
if dependencyGenerator, ok := k.MessageDependencyGeneratorMapper[types.GenerateMessageKey(msg)]; dependencyMapping.DynamicEnabled && ok {
// if we have a dependency generator AND dynamic is enabled, use it
if dependencies, err := dependencyGenerator(k, ctx, msg); err == nil {
// validate the access ops before using them
validateErr := types.ValidateAccessOps(dependencies)
if validateErr == nil {
return dependencies
} else {
ctx.Logger().Error(validateErr.Error())
}
} else {
ctx.Logger().Error("Error generating message dependencies: ", err)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to add unit tests for this?

@udpatil udpatil merged commit 060d535 into main Oct 9, 2022
@udpatil udpatil deleted the get-dependencies branch October 9, 2022 00:43
BrandonWeng pushed a commit that referenced this pull request Oct 12, 2022
## Describe your changes and provide context
This introduces the `GetMessageDependencies` function that returns the
access operations for the message. It either returns the static access
ops from the keeper store, or if we've implemented a specific case for
that message type, it will generate the dynamic message typing if
applicable.

## Testing performed to validate your change
Need to refactor sei-chain with this function and verify the default
behavior is as expected.
philipsu522 pushed a commit that referenced this pull request Oct 12, 2022
## Describe your changes and provide context
This introduces the `GetMessageDependencies` function that returns the
access operations for the message. It either returns the static access
ops from the keeper store, or if we've implemented a specific case for
that message type, it will generate the dynamic message typing if
applicable.

## Testing performed to validate your change
Need to refactor sei-chain with this function and verify the default
behavior is as expected.
BrandonWeng pushed a commit that referenced this pull request Oct 14, 2022
## Describe your changes and provide context
This introduces the `GetMessageDependencies` function that returns the
access operations for the message. It either returns the static access
ops from the keeper store, or if we've implemented a specific case for
that message type, it will generate the dynamic message typing if
applicable.

## Testing performed to validate your change
Need to refactor sei-chain with this function and verify the default
behavior is as expected.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants