-
Notifications
You must be signed in to change notification settings - Fork 3
🎨 Split verification types #130
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package common | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/vultisig/mobile-tss-lib/tss" | ||
| rtypes "github.com/vultisig/recipes/types" | ||
| "github.com/vultisig/verifier/types" | ||
| ) | ||
|
|
||
| type Plugin interface { | ||
| GetRecipeSpecification() *rtypes.RecipeSchema | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we should even consider upstreaming it (but maybe at a later date) |
||
| ValidatePluginPolicy(policyDoc types.PluginPolicy) error // Used for validating a document that already exists when signing a transaction. Mostly checks on typing and constraints. | ||
| ValidateUpdatePluginPolicy(policyDoc types.PluginPolicy) error // Additional validations for updating a policy. | ||
| ValidateCreatePluginPolicy(policyDoc types.PluginPolicy) error // Additional validations for creating a policy. e.g. can't create more than one fee policy | ||
| ValidateDeletePluginPolicy(policyDoc types.PluginPolicy) error // Additional validations for deleting a policy. e.g. can't delete fee policy if there are fees still pending collection or other active plugins | ||
|
|
||
| ProposeTransactions(policy types.PluginPolicy) ([]types.PluginKeysignRequest, error) | ||
| ValidateProposedTransactions(policy types.PluginPolicy, txs []types.PluginKeysignRequest) error | ||
| SigningComplete(ctx context.Context, signature tss.KeysignResponse, signRequest types.PluginKeysignRequest, policy types.PluginPolicy) error | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,14 +21,14 @@ import ( | |||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/mobile-tss-lib/tss" | ||||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/verifier/address" | ||||||||||||||||||||||||||||||||||||||
| vcommon "github.com/vultisig/verifier/common" | ||||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/verifier/plugin" | ||||||||||||||||||||||||||||||||||||||
| vtypes "github.com/vultisig/verifier/types" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| rtypes "github.com/vultisig/recipes/types" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/plugin/common" | ||||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/plugin/internal/sigutil" | ||||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/plugin/pkg/uniswap" | ||||||||||||||||||||||||||||||||||||||
| plugincommon "github.com/vultisig/plugin/plugin/common" | ||||||||||||||||||||||||||||||||||||||
| "github.com/vultisig/plugin/storage" | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -47,7 +47,7 @@ var ( | |||||||||||||||||||||||||||||||||||||
| ErrCompletedPolicy = errors.New("policy completed all swaps") | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| var _ plugin.Plugin = (*DCAPlugin)(nil) | ||||||||||||||||||||||||||||||||||||||
| var _ plugincommon.Plugin = (*DCAPlugin)(nil) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| type DCAPlugin struct { | ||||||||||||||||||||||||||||||||||||||
| uniswapClient *uniswap.Client | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -231,6 +231,16 @@ func (p *DCAPlugin) ValidatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | |||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| func (p *DCAPlugin) ValidateCreatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | ||||||||||||||||||||||||||||||||||||||
| return p.ValidatePluginPolicy(policyDoc) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| func (p *DCAPlugin) ValidateUpdatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | ||||||||||||||||||||||||||||||||||||||
| return p.ValidatePluginPolicy(policyDoc) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+236
to
+239
|
||||||||||||||||||||||||||||||||||||||
| } | |
| func (p *DCAPlugin) ValidateUpdatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | |
| return p.ValidatePluginPolicy(policyDoc) | |
| } | |
| } | |
| func (p *DCAPlugin) ValidateUpdatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | |
| return p.ValidatePluginPolicy(policyDoc) | |
| } |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing spacing between function definitions. Consider adding a blank line after the previous function to improve readability and maintain consistency with the codebase formatting.
| } | |
| func (p *DCAPlugin) ValidateUpdatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | |
| return p.ValidatePluginPolicy(policyDoc) | |
| } | |
| } | |
| func (p *DCAPlugin) ValidateUpdatePluginPolicy(policyDoc vtypes.PluginPolicy) error { | |
| return p.ValidatePluginPolicy(policyDoc) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I don't think this works best
The goal of having a verifier/plugin interface is to ensure that we, at a minimum, implement the core functionality that a plugin needs to be functional - separating it out is possible, but I don't think we should do it just yet
If anything, this interface should have the verifier plugin interface embedded in it, not duplicate the functions