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

policy: use policy structure from verifier#18

Merged
johnnyluo merged 3 commits into
mainfrom
chore/14
May 5, 2025
Merged

policy: use policy structure from verifier#18
johnnyluo merged 3 commits into
mainfrom
chore/14

Conversation

@RaghavSood

@RaghavSood RaghavSood commented May 4, 2025

Copy link
Copy Markdown
Contributor

This is a stacked PR over #17.

Resolves #14

This starts the process of pulling in upstream dependencies that we want to come from the verifier repo into plugins.

To begin with, we're simply pulling in the verifier/types.PluginPolicy.

This requires vultisig/verifier#14 to be merged, and will need a go mod tidy after that is done

Summary by CodeRabbit

  • Refactor

    • Unified plugin policy handling by adopting a common policy type from an external package across all components.
    • Removed internal plugin policy data structures to streamline policy management.
    • Updated method and interface signatures system-wide to support the new policy type.
  • Chores

    • Upgraded multiple dependencies to newer versions for enhanced stability and compatibility.

Copilot AI review requested due to automatic review settings May 4, 2025 19:28
@coderabbitai

coderabbitai Bot commented May 4, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This change migrates all references to the PluginPolicy type from the project's internal types package to the external vtypes.PluginPolicy provided by github.com/vultisig/verifier/types. The update affects function and method signatures, interface definitions, and variable declarations across the codebase, including API handlers, plugins, service layers, storage interfaces, and scripts. The internal PluginPolicy struct is removed entirely. No business logic, error handling, or control flow is altered; all modifications are strictly type substitutions to standardize on the external definition.

Changes

File(s) / Group Change Summary
api/plugin.go All usages of types.PluginPolicy replaced with vtypes.PluginPolicy; function signatures updated accordingly; added import alias.
go.mod Upgraded multiple dependencies, added vultisig/verifier as direct dependency, updated indirect dependencies, removed unused ones.
internal/scheduler/scheduler.go Method signatures for CreateTimeTrigger and GetTriggerFromPolicy now use vtypes.PluginPolicy instead of internal type.
internal/syncer/sync.go PolicySyncer interface and Syncer struct methods updated to use vtypes.PluginPolicy.
internal/types/policy.go Removed PluginPolicy and PublicKey structs; file now only contains unrelated types.
plugin/dca/dca.go All public methods on DCAPlugin now take vtypes.PluginPolicy as parameter.
plugin/payroll/policy.go ValidatePluginPolicy and ValidateProposedTransactions methods updated to use vtypes.PluginPolicy as parameter.
plugin/payroll/transaction.go Methods on PayrollPlugin updated to use vtypes.PluginPolicy for policy parameter.
plugin/plugin.go Plugin interface methods updated to use vtypes.PluginPolicy instead of internal type.
scripts/dev/create_dca_policy/main.go Switched import and usage from internal to vtypes.PluginPolicy for policy creation script.
scripts/dev/create_payroll_policy/main.go Switched import and usage from internal to vtypes.PluginPolicy for payroll policy creation script.
service/policy.go Policy interface and PolicyService methods updated to use vtypes.PluginPolicy for all relevant signatures and returns.
storage/db.go DatabaseStorage interface methods updated to use vtypes.PluginPolicy for parameters and return types.
storage/postgres/policy.go All database policy methods updated to use vtypes.PluginPolicy for parameters and return types.

Sequence Diagram(s)

sequenceDiagram
    participant API
    participant Service
    participant Storage
    participant Plugin
    participant VerifierTypes

    API->>Service: CreatePolicyWithSync(policy: vtypes.PluginPolicy)
    Service->>Storage: InsertPluginPolicyTx(policy: vtypes.PluginPolicy)
    Storage->>VerifierTypes: (policy is vtypes.PluginPolicy)
    Service->>Plugin: ValidatePluginPolicy(policy: vtypes.PluginPolicy)
    Plugin->>VerifierTypes: (policy is vtypes.PluginPolicy)
    Service-->>API: (*vtypes.PluginPolicy, error)
Loading

Suggested reviewers

  • johnnyluo

Poem

Oh, what a hop from type to type,
The PluginPolicy takes a leap,
From local fields to verifier’s keep,
No logic lost, no reason slight,
Just cleaner code and types so right!
🐇✨
— A rabbit with a penchant for imports


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb2c699 and 011b979.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • go.mod (2 hunks)
  • internal/types/policy.go (0 hunks)
  • plugin/payroll/policy.go (3 hunks)
  • scripts/dev/create_dca_policy/main.go (3 hunks)
  • scripts/dev/create_payroll_policy/main.go (3 hunks)
💤 Files with no reviewable changes (1)
  • internal/types/policy.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • scripts/dev/create_payroll_policy/main.go
  • scripts/dev/create_dca_policy/main.go
  • plugin/payroll/policy.go
  • go.mod
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@RaghavSood RaghavSood changed the title Chore/14 policy: use policy structure from verifier May 4, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the codebase to pull in the upstream PluginPolicy type from the verifier repository, replacing the internal types.PluginPolicy usage throughout the code. Key changes include:

  • Replacing types.PluginPolicy with vtypes.PluginPolicy in function signatures, variable declarations, and error messages.
  • Removing the internal PluginPolicy type definition from the internal types package.
  • Updating the Go version in the GitHub workflow to 1.24.

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
storage/postgres/policy.go Updated PluginPolicy types and error messages in Postgres queries.
storage/db.go Updated function signatures to use vtypes.PluginPolicy.
service/policy.go Updated service methods to reflect the new PluginPolicy type.
scripts/dev/create_payroll_policy/main.go Updated PluginPolicy instantiation with vtypes.PluginPolicy.
scripts/dev/create_dca_policy/main.go Updated PluginPolicy instantiation with vtypes.PluginPolicy.
plugin/plugin.go Updated Plugin interface to use vtypes.PluginPolicy.
plugin/payroll/transaction.go & policy.go Updated PluginPolicy references in transactions and validations.
plugin/dca/dca.go Updated PluginPolicy references in validation, transaction proposals.
internal/types/policy.go Removed the internal PluginPolicy type in favor of upstream type.
internal/syncer/sync.go Updated the syncer interface to use vtypes.PluginPolicy.
internal/scheduler/scheduler.go Updated scheduler functions to use vtypes.PluginPolicy.
api/plugin.go Updated API endpoint to use the new PluginPolicy type.
.github/workflows/go.yml Updated the Go version from 1.22 to 1.24.
Files not reviewed (1)
  • go.mod: Language not supported

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
storage/postgres/policy.go (2)

50-66: Updated GetAllPluginPolicies for external type
All references now use []vtypes.PluginPolicy. Consider unifying the JSON scanning approach with GetPluginPolicy—either scan into a temporary []byte then assign to json.RawMessage, or scan directly into the Policy field for consistency across methods.


92-105: Migrated InsertPluginPolicyTx to external type
The insertion logic correctly marshals and returns vtypes.PluginPolicy. You might rename policyJSON to policyBytes for clearer intent since it's used both for binding and scanning back.

plugin/dca/dca.go (2)

384-388: Updated ValidateProposedTransactions to use external policy
Signature change is consistent. For better cancellation support, consider propagating the incoming ctx instead of using context.Background() in nested calls (e.g., getCompletedSwapTransactionsCount).


786-792: Switched completePolicy to external PluginPolicy and retained TODO
The signature updates are correct. The TODO for syncing a COMPLETED state with the verifier database remains; if you'd like assistance implementing that sync, let me know.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 666a3e9 and 79b28a8.

⛔ Files ignored due to path filters (2)
  • flake.lock is excluded by !**/*.lock
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (15)
  • .github/workflows/go.yml (1 hunks)
  • api/plugin.go (5 hunks)
  • go.mod (3 hunks)
  • internal/scheduler/scheduler.go (3 hunks)
  • internal/syncer/sync.go (4 hunks)
  • internal/types/policy.go (0 hunks)
  • plugin/dca/dca.go (6 hunks)
  • plugin/payroll/policy.go (2 hunks)
  • plugin/payroll/transaction.go (4 hunks)
  • plugin/plugin.go (1 hunks)
  • scripts/dev/create_dca_policy/main.go (2 hunks)
  • scripts/dev/create_payroll_policy/main.go (2 hunks)
  • service/policy.go (4 hunks)
  • storage/db.go (2 hunks)
  • storage/postgres/policy.go (7 hunks)
💤 Files with no reviewable changes (1)
  • internal/types/policy.go
🧰 Additional context used
🧬 Code Graph Analysis (7)
api/plugin.go (1)
api/server.go (1)
  • Server (40-56)
plugin/payroll/policy.go (2)
plugin/payroll/payroll.go (1)
  • PayrollPlugin (16-21)
internal/types/keysign.go (1)
  • PluginKeysignRequest (39-45)
internal/scheduler/scheduler.go (1)
internal/types/time_trigger.go (1)
  • TimeTrigger (12-21)
plugin/payroll/transaction.go (2)
plugin/payroll/payroll.go (1)
  • PayrollPlugin (16-21)
internal/types/keysign.go (1)
  • PluginKeysignRequest (39-45)
storage/postgres/policy.go (2)
storage/postgres/db.go (1)
  • PostgresBackend (21-23)
service/policy.go (1)
  • Policy (16-23)
plugin/dca/dca.go (1)
internal/types/keysign.go (1)
  • PluginKeysignRequest (39-45)
plugin/plugin.go (1)
internal/types/keysign.go (1)
  • PluginKeysignRequest (39-45)
🔇 Additional comments (43)
.github/workflows/go.yml (1)

22-22: Go version update looks good.

The workflow has been updated to use Go 1.24, which aligns with the Go version update to 1.24.2 in go.mod. This ensures consistency between the CI environment and the updated module requirements.

scripts/dev/create_payroll_policy/main.go (2)

17-17: Import of external types package added correctly.

The import of the verifier types package with the alias vtypes is properly configured.


107-107: Type replacement implemented correctly.

The code now correctly uses vtypes.PluginPolicy from the external verifier types package instead of the internal type, which aligns with the PR objective of importing the verifier/types.PluginPolicy component.

scripts/dev/create_dca_policy/main.go (2)

17-17: Import of external types package added correctly.

The import of the verifier types package with the alias vtypes is properly configured.


78-78: Type replacement implemented correctly.

The code now correctly uses vtypes.PluginPolicy from the external verifier types package instead of the internal type, which aligns with the PR objective of importing the verifier/types.PluginPolicy component.

go.mod (4)

3-3: Go version updated appropriately.

The Go version has been updated to 1.24.2, which is consistent with the GitHub workflow update.


7-26: Direct dependencies updated correctly.

All direct dependencies have been updated to newer versions, which is good practice for security and stability. This includes important dependencies like aws-sdk-go, go-ethereum, validator, and others.


28-63: Indirect dependencies updated correctly.

The indirect dependencies have been updated to align with the direct dependency updates. This is particularly important for compatibility with the new Go version and the external verifier types package.


60-60: Verifier dependency added as expected.

The dependency on github.com/vultisig/verifier has been added, which is necessary for importing the external PluginPolicy type as mentioned in the PR objectives.

api/plugin.go (5)

22-22: Import added for external PluginPolicy type.

The import for the verifier types package is added to support the migration from internal to external PluginPolicy type.


203-203: Type changed from internal to external PluginPolicy.

The policy variable is now using vtypes.PluginPolicy instead of the internal type, consistent with the PR objective of integrating types from the verifier repository.


268-268: Type changed from internal to external PluginPolicy.

The policy variable for UpdatePluginPolicyById method is now using vtypes.PluginPolicy instead of the internal type, consistent with the type migration.


469-469: Method signature updated to use external PluginPolicy type.

The verifyPolicySignature method now accepts the external vtypes.PluginPolicy type while maintaining the same functionality.


496-496: Method signature updated to use external PluginPolicy type.

The policyToMessageHex helper function now accepts the external vtypes.PluginPolicy type while maintaining the same functionality for serializing policies.

plugin/payroll/policy.go (3)

16-16: Import added for external PluginPolicy type.

The import for the verifier types package is added to support the migration from internal to external PluginPolicy type.


19-19: Method signature updated to use external PluginPolicy type.

The ValidateProposedTransactions method now accepts the external vtypes.PluginPolicy type while maintaining the same validation logic.


90-90: Method signature updated to use external PluginPolicy type.

The ValidatePluginPolicy method now accepts the external vtypes.PluginPolicy type while maintaining the same validation logic for payroll policies.

internal/scheduler/scheduler.go (3)

18-18: Import added for external PluginPolicy type.

The import for the verifier types package is added to support the migration from internal to external PluginPolicy type.


171-171: Method signature updated to use external PluginPolicy type.

The CreateTimeTrigger method now accepts the external vtypes.PluginPolicy type while maintaining the same functionality for creating time-based triggers.


184-184: Method signature updated to use external PluginPolicy type.

The GetTriggerFromPolicy helper method now accepts the external vtypes.PluginPolicy type while maintaining the same logic for extracting trigger information from policies.

internal/syncer/sync.go (4)

12-12: Import added for external PluginPolicy type.

The import for the verifier types package is added to support the migration from internal to external PluginPolicy type.


32-34: Interface methods updated to use external PluginPolicy type.

The PolicySyncer interface methods now use the external vtypes.PluginPolicy type, ensuring consistency across the codebase.


53-53: Method signature updated to use external PluginPolicy type.

The CreatePolicySync implementation now accepts the external vtypes.PluginPolicy type while maintaining the same functionality for synchronizing policy creation.


95-95: Method signature updated to use external PluginPolicy type.

The UpdatePolicySync implementation now accepts the external vtypes.PluginPolicy type while maintaining the same functionality for synchronizing policy updates.

Verify dependency requirements after this PR

Since this PR relies on changes from the verifier repository (PR #14), ensure you run go mod tidy after the dependent PR is merged to update all module dependencies correctly.

plugin/plugin.go (2)

9-9: Correct import alias for external type.

The import alias vtypes for the external verifier types package is appropriate and will help distinguish it from the internal types package.


14-17: LGTM: Interface methods properly updated to use external PluginPolicy type.

All method signatures in the Plugin interface have been correctly updated to use vtypes.PluginPolicy instead of the internal type, while maintaining the same parameter names and return types. This change is consistent with the PR objective of consolidating shared dependencies.

storage/db.go (2)

9-10: Import order is consistent with Go standards.

The addition of the new import for the external verifier types package is properly aliased as vtypes and placed appropriately in the import list.


19-23: Interface methods properly updated for PluginPolicy database operations.

All database interface methods dealing with the PluginPolicy type have been correctly updated to use the external vtypes.PluginPolicy type instead of the internal type. This maintains the interface contract while ensuring consistency with the type migration.

plugin/payroll/transaction.go (4)

24-24: Consistent import alias used across codebase.

The import alias vtypes for the external verifier types package matches the pattern used in other files, providing consistency.


33-33: Method signature updated correctly for ProposeTransactions.

The parameter type has been properly updated to use the external vtypes.PluginPolicy type.


210-210: Method signature updated correctly for SigningComplete.

The parameter type has been properly updated to use the external vtypes.PluginPolicy type while maintaining the same method signature and functionality.


253-253: Method signature updated correctly for convertData helper method.

The parameter type has been properly updated to use the external vtypes.PluginPolicy type while preserving the same method signature and return types.

service/policy.go (4)

13-13: Import alias consistent with other files.

The import alias vtypes for the external verifier types package follows the same pattern used across the codebase.


17-22: Interface methods correctly updated to use external PluginPolicy type.

All method signatures in the Policy interface have been properly updated to use vtypes.PluginPolicy instead of the internal type, maintaining consistent method contracts.


44-44: Implementation methods correctly updated to match interface changes.

All PolicyService implementation methods have been properly updated to use the external vtypes.PluginPolicy type, ensuring consistency with the interface definition.

Also applies to: 79-79, 143-143, 151-151


154-154: Empty struct initialization updated to use the external type.

The error case correctly returns an empty vtypes.PluginPolicy{} struct instead of the internal type, maintaining consistency with the return type change.

storage/postgres/policy.go (3)

11-11: Importing external plugin policy type
The alias vtypes for github.com/vultisig/verifier/types is clear and appropriate. It aligns imports with the upstream dependency.


14-19: Switched GetPluginPolicy to external PluginPolicy
The method signature and default error return correctly use vtypes.PluginPolicy. Error wrapping and JSON assignment remain consistent with the existing logic.


140-158: Review field updates in UpdatePluginPolicyTx
Only a subset of fields (public_key, plugin_type, signature, active, policy) are updated and the // TODO: update other fields remains. Please confirm whether fields like chain_code_hex, derive_path, or version fields should also be mutable. Remove or address the TODO once confirmed.

plugin/dca/dca.go (4)

31-31: Imported external PluginPolicy type
The addition of the vtypes import and removal of internal policy references aligns this plugin with the upstream verifier/types definitions.


98-103: Switched SigningComplete to external PluginPolicy
The method signature update is correct. Ensure all invocations of SigningComplete have been updated to pass the new type.


145-150: Updated ValidatePluginPolicy signature to use vtypes.PluginPolicy
Signature and validation logic remain intact. The checks for plugin type, version, and JSON unmarshalling continue to operate on the external policy type.


301-305: Migrated ProposeTransactions to external PluginPolicy
Signature and initial logging now adopt vtypes.PluginPolicy. The downstream JSON unmarshal and business logic are unaffected by the type swap.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
storage/db.go (1)

9-9: Consider reviewing internal types package

The static analysis hints that there might be unused imports in the internal types package, likely due to the removal of the internal PluginPolicy type.

After this PR is merged, consider reviewing the internal types package to clean up any unused imports.

🧰 Tools
🪛 golangci-lint (1.64.8)

9-9: could not import github.com/vultisig/vultiserver-plugin/internal/types (-: # github.com/vultisig/vultiserver-plugin/internal/types
internal/types/policy.go:3:8: "encoding/json" imported and not used)

(typecheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79b28a8 and fb2c699.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (14)
  • api/plugin.go (5 hunks)
  • go.mod (2 hunks)
  • internal/scheduler/scheduler.go (3 hunks)
  • internal/syncer/sync.go (4 hunks)
  • internal/types/policy.go (0 hunks)
  • plugin/dca/dca.go (6 hunks)
  • plugin/payroll/policy.go (2 hunks)
  • plugin/payroll/transaction.go (4 hunks)
  • plugin/plugin.go (1 hunks)
  • scripts/dev/create_dca_policy/main.go (2 hunks)
  • scripts/dev/create_payroll_policy/main.go (2 hunks)
  • service/policy.go (4 hunks)
  • storage/db.go (2 hunks)
  • storage/postgres/policy.go (7 hunks)
💤 Files with no reviewable changes (1)
  • internal/types/policy.go
✅ Files skipped from review due to trivial changes (1)
  • scripts/dev/create_payroll_policy/main.go
🚧 Files skipped from review as they are similar to previous changes (10)
  • scripts/dev/create_dca_policy/main.go
  • internal/scheduler/scheduler.go
  • api/plugin.go
  • plugin/payroll/policy.go
  • service/policy.go
  • plugin/dca/dca.go
  • storage/postgres/policy.go
  • plugin/payroll/transaction.go
  • plugin/plugin.go
  • go.mod
🧰 Additional context used
🪛 GitHub Check: build
internal/syncer/sync.go

[failure] 33-33:
undefined: vtypes.PluginPolicy


[failure] 32-32:
undefined: vtypes.PluginPolicy


[failure] 53-53:
undefined: vtypes.PluginPolicy


[failure] 95-95:
undefined: vtypes.PluginPolicy

🪛 golangci-lint (1.64.8)
storage/db.go

9-9: could not import github.com/vultisig/vultiserver-plugin/internal/types (-: # github.com/vultisig/vultiserver-plugin/internal/types
internal/types/policy.go:3:8: "encoding/json" imported and not used)

(typecheck)


19-19: undefined: vtypes.PluginPolicy

(typecheck)


20-20: undefined: vtypes.PluginPolicy

(typecheck)


22-22: undefined: vtypes.PluginPolicy

(typecheck)

🔇 Additional comments (5)
internal/syncer/sync.go (3)

12-12: Import of external vtypes package aligns with PR objectives

This addition correctly imports the PluginPolicy type from the verifier repository, which is the first step in consolidating the shared dependencies between repositories as described in the PR objectives.


32-34: Interface method signatures updated correctly

The PolicySyncer interface has been properly updated to use the external vtypes.PluginPolicy type instead of the internal implementation.

Note that the static analysis indicates undefined vtypes.PluginPolicy errors, which is expected since this PR depends on a merge in the verifier repository (PR #14). These errors will be resolved by running go mod tidy after that PR is merged.

🧰 Tools
🪛 GitHub Check: build

[failure] 33-33:
undefined: vtypes.PluginPolicy


[failure] 32-32:
undefined: vtypes.PluginPolicy


53-53: Implementation method signatures updated consistently

The implementation methods in the Syncer struct now correctly use the external vtypes.PluginPolicy type, maintaining consistency with the interface definition.

Also applies to: 95-95

🧰 Tools
🪛 GitHub Check: build

[failure] 53-53:
undefined: vtypes.PluginPolicy

storage/db.go (2)

9-10: Import statements correctly updated

Both the internal types package and the external verifier types package are properly imported. The internal package is still needed for other type definitions while the external package provides the PluginPolicy type.

🧰 Tools
🪛 golangci-lint (1.64.8)

9-9: could not import github.com/vultisig/vultiserver-plugin/internal/types (-: # github.com/vultisig/vultiserver-plugin/internal/types
internal/types/policy.go:3:8: "encoding/json" imported and not used)

(typecheck)


19-23:

Details

✅ Verification successful

Database interface methods correctly updated

All methods in the DatabaseStorage interface that interact with plugin policies now use the external vtypes.PluginPolicy type instead of the internal implementation.

The static analysis indicates undefined vtypes.PluginPolicy errors, which is expected since this PR depends on a merge in the verifier repository (PR #14). Ensure you run go mod tidy after that PR is merged to resolve these dependency issues.


🏁 Script executed:

#!/bin/bash
# This will check the current module requirements
go list -m all | grep vultisig/verifier

# After the verifier PR is merged, you'll need to run:
# go mod tidy

Length of output: 144


Dependencies updated — run go mod tidy

Confirmed that your project is now pulling in the merged verifier dependency:

github.com/vultisig/verifier v0.0.0-20250504225813-a24e50ad336b

After PR #14 in the verifier repo is merged, simply run:

go mod tidy

to resolve the previously undefined vtypes.PluginPolicy errors.

🧰 Tools
🪛 golangci-lint (1.64.8)

19-19: undefined: vtypes.PluginPolicy

(typecheck)


20-20: undefined: vtypes.PluginPolicy

(typecheck)


22-22: undefined: vtypes.PluginPolicy

(typecheck)

@johnnyluo johnnyluo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

Policy type should be pulled in from verifier

3 participants