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

#730 x/act rename rule to template #827

Merged

Conversation

backsapc
Copy link
Contributor

@backsapc backsapc commented Sep 12, 2024

#730

Summary by CodeRabbit

  • New Features

    • Introduced Votes and Approve/Reject expressions for Actions.
    • Enhanced MsgAddAction with expected expressions.
  • Terminology Updates

    • Renamed "Rule" to "Template" throughout the application for improved clarity.

These changes aim to enhance the expressiveness and functionality of actions within the system, making it easier for users to understand and interact with the features.

mn13 and others added 11 commits September 9, 2024 16:11
- Set expressions within MsgNewAction handling.
- Update registry initialization in space module, add missing rule ids
- UpdateSpace
- UpdateKey
…o-template-1

# Conflicts:
#	CHANGELOG.md
#	api/warden/act/v1beta1/events.pulsar.go
#	api/warden/act/v1beta1/query.pulsar.go
#	api/warden/act/v1beta1/tx.pulsar.go
#	api/warden/warden/v1beta3/events.pulsar.go
#	api/warden/warden/v1beta3/key.pulsar.go
#	api/warden/warden/v1beta3/space.pulsar.go
#	api/warden/warden/v1beta3/tx.pulsar.go
#	proto/warden/warden/v1beta3/events.proto
#	proto/warden/warden/v1beta3/key.proto
#	proto/warden/warden/v1beta3/space.proto
#	proto/warden/warden/v1beta3/tx.proto
#	tests/cases/approve_any_3_action.go
#	tests/cases/owner_approve_action.go
#	warden/x/act/keeper/actions.go
#	warden/x/act/keeper/msg_server_new_action.go
#	warden/x/act/keeper/query_rules.go
#	warden/x/act/types/v1beta1/errors.go
#	warden/x/act/types/v1beta1/events.pb.go
#	warden/x/act/types/v1beta1/query.pb.go
#	warden/x/act/types/v1beta1/registry.go
#	warden/x/act/types/v1beta1/tx.pb.go
#	warden/x/warden/keeper/msg_server_update_key.go
#	warden/x/warden/keeper/rules.go
#	warden/x/warden/types/v1beta3/events.pb.go
#	warden/x/warden/types/v1beta3/key.pb.go
#	warden/x/warden/types/v1beta3/space.go
#	warden/x/warden/types/v1beta3/space.pb.go
#	warden/x/warden/types/v1beta3/tx.pb.go
Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

Walkthrough

The recent update involves a comprehensive renaming within the action module, changing the term Rule to Template. This adjustment aims to clarify the purpose of associated expressions and structures. Additionally, the update introduces Votes and Approve/Reject expressions for Actions, modifies the MsgNewAction to include these expressions, and updates the rules registry accordingly. Overall, these changes enhance the expressiveness and functionality of actions within the system.

Changes

Files Change Summary
x/act Renamed Rule to Template.
cmd/wardend/cmd/gen-spaces.go Renamed AdminRuleId and SignRuleId to AdminTemplateId and SignTemplateId.
docs/help-center/.spelling Renamed MsgNewRule and MsgUpdateRule to MsgNewTemplate and MsgUpdateTemplate.
proto/warden/act/v1beta1/action.proto Modified message fields and comments to replace rule with template.
proto/warden/act/v1beta1/genesis.proto Renamed repeated Rule rules to repeated Template templates.
proto/warden/act/v1beta1/query.proto Renamed various messages and RPCs from Rule to Template.
proto/warden/act/v1beta1/tx.proto Renamed messages and RPCs from MsgNewRule and MsgUpdateRule to MsgNewTemplate and MsgUpdateTemplate.
proto/warden/warden/v1beta3/key.proto Renamed rule_id fields to template_id and modified related fields.
proto/warden/warden/v1beta3/space.proto Renamed admin_rule_id and sign_rule_id fields to admin_template_id and sign_template_id.
tests/cases/approve_any_3_action.go Renamed various instances of Rule to Template in test cases.
warden/app/wasm-interop/custom_msg.go Renamed RuleId in NewKeyRequest struct to TemplateId.
warden/testutil/keeper/act.go Renamed rulesRegistry to templatesRegistry.
warden/x/act/keeper/actions.go Updated function to use act.Template instead of act.Rule.

Possibly related PRs

  • [x/act V2]: Add MsgVote handling #794: This PR introduces new types and methods for handling votes on actions, which aligns with the main PR's focus on enhancing the expressiveness and functionality of actions, particularly regarding approval and rejection processes.
  • 779 handle approve reject expressions #812: This PR focuses on handling approval and rejection expressions, which directly relates to the main PR's changes that involve the introduction of Votes and Approve/Reject expressions for Actions.
  • Test fixes #824: This PR modifies the logic of action execution to utilize ApproveExpression and RejectExpression, reflecting a shift towards an expression-driven evaluation mechanism, which is consistent with the main PR's updates to action handling.

Suggested labels

x-act


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@artur-abliazimov
Copy link
Contributor

artur-abliazimov commented Sep 12, 2024

Check the /warden/x/act/types/v1beta1/expression.go + /warden/x/act/types/v1beta1/registry.go.

@artur-abliazimov
Copy link
Contributor

artur-abliazimov commented Sep 12, 2024

query_rules.go and other related to rule files must be renamed + I see some Rule mentions there.
image

if err = k.actKeeper.IsValidTemplate(ctx, msg.RejectTemplateId); err != nil {
return nil, err
}
key.RejectTemplateId = msg.RejectTemplateId
}

if key.ApproveRuleId != msg.ApproveRuleId {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rule is still here.

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
warden-help-center ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 1:26pm

@@ -103,6 +104,7 @@ func (k Keeper) TryRejectVotedAction(ctx context.Context, act *types.Action) err
// result in the database.
func (k Keeper) TryExecuteAction(ctx context.Context, act *types.Action) error {
ready, err := k.checkActionReady(ctx, *act)
log.Printf("\nready %v\n", ready)
Copy link
Contributor

Choose a reason for hiding this comment

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

It must be removed

@github-actions github-actions bot removed the wardenjs label Sep 12, 2024
@artur-abliazimov
Copy link
Contributor

Do we also need to fix rule in the following files?

  • /tests/testdata/snapshot-many-users/config/genesis.json
  • /tests/testdata/snapshot-keychain/config/genesis.json
  • /wardenprotocol/tests/testdata/snapshot-base/config/genesis.json

@backsapc
Copy link
Contributor Author

@artur-abliazimov great catch! It's not critical, but yes

@backsapc backsapc enabled auto-merge (squash) September 12, 2024 13:26
@backsapc backsapc merged commit f609b2e into main Sep 12, 2024
13 of 14 checks passed
@backsapc backsapc deleted the feature/x-act-v2/730-3-xact-v2-rename-rule-to-template-1 branch September 12, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants