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

Commit 6f000ec

Browse files
authored
Merge branch 'main' into fees-v2
2 parents 7cb72c3 + 60df06a commit 6f000ec

10 files changed

Lines changed: 79 additions & 186 deletions

File tree

api/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import (
1515
"github.com/labstack/gommon/log"
1616
"github.com/sirupsen/logrus"
1717
vcommon "github.com/vultisig/verifier/common"
18+
vv "github.com/vultisig/verifier/common/vultisig_validator"
1819
"github.com/vultisig/verifier/plugin"
1920
"github.com/vultisig/verifier/plugin/tasks"
2021
vtypes "github.com/vultisig/verifier/types"
2122
"github.com/vultisig/verifier/vault"
2223

2324
"github.com/vultisig/plugin/internal/scheduler"
24-
vv "github.com/vultisig/plugin/internal/vultisig_validator"
2525
"github.com/vultisig/plugin/service"
2626
"github.com/vultisig/plugin/storage"
2727
"github.com/vultisig/plugin/storage/postgres"

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ require (
1818
github.com/spf13/viper v1.20.1
1919
github.com/vultisig/commondata v0.0.0-20250710214228-61d9ed8f7778
2020
github.com/vultisig/mobile-tss-lib v0.0.0-20250316003201-2e7e570a4a74
21-
github.com/vultisig/recipes v0.0.0-20250729120802-9b1d07f8262a
22-
github.com/vultisig/verifier v0.0.0-20250731092019-00d44a4b02b9
21+
github.com/vultisig/recipes v0.0.0-20250805093243-2060ffd4754e
22+
github.com/vultisig/verifier v0.0.0-20250806110950-aaa4877b631a
2323
github.com/vultisig/vultiserver v0.0.0-20250715212748-4b23f9849e4b
2424
golang.org/x/sync v0.14.0
2525
google.golang.org/protobuf v1.36.6

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,12 @@ github.com/vultisig/go-wrappers v0.0.0-20250403041248-86911e8aa33f h1:124Xlloih1
757757
github.com/vultisig/go-wrappers v0.0.0-20250403041248-86911e8aa33f/go.mod h1:UfGCxUQW08kiwxyNBiHwXe+ePPuBmHVVS+BS51aU/Jg=
758758
github.com/vultisig/mobile-tss-lib v0.0.0-20250316003201-2e7e570a4a74 h1:goqwk4nQ/NEVIb3OPP9SUx7/u9ZfsUIcd5fIN/e4DVU=
759759
github.com/vultisig/mobile-tss-lib v0.0.0-20250316003201-2e7e570a4a74/go.mod h1:nOykk4nOy1L3yXtLSlYvVsgizBnCQ3tR2N5uwGPdvaM=
760-
github.com/vultisig/recipes v0.0.0-20250729120802-9b1d07f8262a h1:KoAwytLj092KNgWHh0a5tcupsSm5HtentT0yUbDGWFQ=
761-
github.com/vultisig/recipes v0.0.0-20250729120802-9b1d07f8262a/go.mod h1:Ot3lrUnnSw67Hep+MelclVPgNLDxJP01Ezixw/1RYRE=
762-
github.com/vultisig/verifier v0.0.0-20250731092019-00d44a4b02b9 h1:j4duFCHur0x8vtAh3YHcwmRZKqMwcEkl/u7wjOBrMbc=
763-
github.com/vultisig/verifier v0.0.0-20250731092019-00d44a4b02b9/go.mod h1:nFUize5jJAi5P7V0dloNUB+ykJZvgNe4S80h6uAA9SQ=
760+
github.com/vultisig/recipes v0.0.0-20250805093243-2060ffd4754e h1:RhIQVc28MzLWsE7Fn0KsltSr+00ESc1eKKNUHcLgFB4=
761+
github.com/vultisig/recipes v0.0.0-20250805093243-2060ffd4754e/go.mod h1:Ot3lrUnnSw67Hep+MelclVPgNLDxJP01Ezixw/1RYRE=
762+
github.com/vultisig/verifier v0.0.0-20250805144140-643ec1133008 h1:yiOifIrCG8/JpF9Iqlw01ylNLbsT5d27366EMXH9I4I=
763+
github.com/vultisig/verifier v0.0.0-20250805144140-643ec1133008/go.mod h1:fxehysyf+G7WwZstP3WvtswB+4VK2rt9/b5ccjKhYbY=
764+
github.com/vultisig/verifier v0.0.0-20250806110950-aaa4877b631a h1:MXEpOwpEX4M/lVENUIWCBEc5eJtzLfbD0MBdthb0Xkg=
765+
github.com/vultisig/verifier v0.0.0-20250806110950-aaa4877b631a/go.mod h1:fxehysyf+G7WwZstP3WvtswB+4VK2rt9/b5ccjKhYbY=
764766
github.com/vultisig/vultiserver v0.0.0-20250715212748-4b23f9849e4b h1:Ed2DOWo8fA0KG6e36rzUmGpxcOQjmWTbxWyvUbI5by8=
765767
github.com/vultisig/vultiserver v0.0.0-20250715212748-4b23f9849e4b/go.mod h1:HwP2IgW6Mcu/gX8paFuKvfibrGE9UmPgkOFTub6dskM=
766768
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=

internal/vultisig_validator/validator.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

plugin/dca/dca.go

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -772,53 +772,5 @@ func (p *DCAPlugin) completePolicy(ctx context.Context, policy vtypes.PluginPoli
772772
}
773773

774774
func (p *DCAPlugin) GetRecipeSpecification() (*rtypes.RecipeSchema, error) {
775-
return &rtypes.RecipeSchema{
776-
Version: 1, // Schema version
777-
ScheduleVersion: 1, // Schedule specification version
778-
PluginId: string(vtypes.PluginVultisigDCA_0000),
779-
PluginName: "Dollar-Cost Averaging",
780-
PluginVersion: 1, // Convert from "0.0.1" to int32
781-
SupportedResources: []*rtypes.ResourcePattern{
782-
{
783-
ResourcePath: &rtypes.ResourcePath{
784-
ChainId: "ethereum",
785-
ProtocolId: "uniswap",
786-
FunctionId: "swap",
787-
Full: "ethereum.uniswap.swap",
788-
},
789-
ParameterCapabilities: []*rtypes.ParameterConstraintCapability{
790-
{
791-
ParameterName: "source_token",
792-
SupportedTypes: []rtypes.ConstraintType{
793-
rtypes.ConstraintType_CONSTRAINT_TYPE_FIXED,
794-
rtypes.ConstraintType_CONSTRAINT_TYPE_WHITELIST,
795-
},
796-
Required: true,
797-
},
798-
{
799-
ParameterName: "destination_token",
800-
SupportedTypes: []rtypes.ConstraintType{
801-
rtypes.ConstraintType_CONSTRAINT_TYPE_FIXED,
802-
rtypes.ConstraintType_CONSTRAINT_TYPE_WHITELIST,
803-
},
804-
Required: true,
805-
},
806-
{
807-
ParameterName: "amount",
808-
SupportedTypes: []rtypes.ConstraintType{
809-
rtypes.ConstraintType_CONSTRAINT_TYPE_FIXED,
810-
rtypes.ConstraintType_CONSTRAINT_TYPE_MAX,
811-
rtypes.ConstraintType_CONSTRAINT_TYPE_RANGE,
812-
},
813-
Required: true,
814-
},
815-
},
816-
Required: true,
817-
},
818-
},
819-
Requirements: &rtypes.PluginRequirements{
820-
MinVultisigVersion: 1,
821-
SupportedChains: []string{"ethereum"},
822-
},
823-
}, nil
775+
return &rtypes.RecipeSchema{}, nil
824776
}

plugin/fees/policy.go

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ func (fp *FeePlugin) GetRecipeSpecification() (*rtypes.RecipeSchema, error) {
3333
}
3434

3535
return &rtypes.RecipeSchema{
36-
Version: 1, // Schema version
37-
ScheduleVersion: 1, // Schedule specification version
38-
PluginId: vtypes.PluginVultisigFees_feee.String(),
39-
PluginName: "Fee Plugin",
40-
PluginVersion: 1,
36+
Version: 1, // Schema version
37+
PluginId: vtypes.PluginVultisigFees_feee.String(),
38+
PluginName: "Fee Plugin",
39+
PluginVersion: 1,
4140
SupportedResources: []*rtypes.ResourcePattern{
4241
{
4342
ResourcePath: &rtypes.ResourcePath{
@@ -46,27 +45,17 @@ func (fp *FeePlugin) GetRecipeSpecification() (*rtypes.RecipeSchema, error) {
4645
FunctionId: "transfer",
4746
Full: "ethereum.erc20.transfer",
4847
},
48+
Target: rtypes.TargetType_TARGET_TYPE_ADDRESS,
4949
ParameterCapabilities: []*rtypes.ParameterConstraintCapability{
5050
{
51-
ParameterName: "recipient",
52-
SupportedTypes: []rtypes.ConstraintType{
53-
rtypes.ConstraintType_CONSTRAINT_TYPE_MAGIC_CONSTANT,
54-
},
55-
Required: true,
51+
ParameterName: "recipient",
52+
SupportedTypes: rtypes.ConstraintType_CONSTRAINT_TYPE_MAGIC_CONSTANT,
53+
Required: true,
5654
},
5755
{
58-
ParameterName: "amount",
59-
SupportedTypes: []rtypes.ConstraintType{
60-
rtypes.ConstraintType_CONSTRAINT_TYPE_MAX,
61-
},
62-
Required: true,
63-
},
64-
{
65-
ParameterName: "token",
66-
SupportedTypes: []rtypes.ConstraintType{
67-
rtypes.ConstraintType_CONSTRAINT_TYPE_FIXED,
68-
},
69-
Required: true,
56+
ParameterName: "amount",
57+
SupportedTypes: rtypes.ConstraintType_CONSTRAINT_TYPE_MAX,
58+
Required: true,
7059
},
7160
},
7261
Required: true,

plugin/fees/transaction.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ import (
88
"fmt"
99
"math/big"
1010
"strconv"
11-
"strings"
1211

1312
"github.com/google/uuid"
1413
"github.com/sirupsen/logrus"
1514
"github.com/vultisig/mobile-tss-lib/tss"
1615
"github.com/vultisig/plugin/common"
17-
"github.com/vultisig/recipes/chain"
16+
rcommon "github.com/vultisig/recipes/common"
1817
"github.com/vultisig/recipes/engine"
1918
reth "github.com/vultisig/recipes/ethereum"
2019
resolver "github.com/vultisig/recipes/resolver"
@@ -83,12 +82,6 @@ func (fp *FeePlugin) proposeTransactions(ctx context.Context, policy vtypes.Plug
8382
}
8483
magicConstantRecipientValue = rtypes.MagicConstant(iv)
8584
}
86-
if constraint.ParameterName == "token" {
87-
if constraint.Constraint.Type != rtypes.ConstraintType_CONSTRAINT_TYPE_FIXED {
88-
return nil, fmt.Errorf("token constraint is not a fixed value")
89-
}
90-
token = constraint.Constraint.GetFixedValue()
91-
}
9285
}
9386
default:
9487
return nil, fmt.Errorf("unsupported rule: %v", rule.Id)
@@ -248,27 +241,16 @@ func (fp *FeePlugin) ValidateProposedTransactions(policy vtypes.PluginPolicy, tx
248241
// Validate each proposed transaction
249242
for _, tx := range txs {
250243
for _, keysignMessage := range tx.Messages {
251-
// Get the chain for the transaction
252-
messageChain, err := chain.GetChain(strings.ToLower(keysignMessage.Chain.String()))
244+
txBytes, err := base64.StdEncoding.DecodeString(keysignMessage.Message)
253245
if err != nil {
254-
return fmt.Errorf("failed to get chain: %w", err)
255-
}
256-
257-
// Parse the transaction to validate its structure
258-
decodedTx, err := messageChain.ParseTransaction(keysignMessage.Message)
259-
if err != nil {
260-
return fmt.Errorf("failed to parse transaction: %w", err)
246+
return fmt.Errorf("failed to decode transaction: %w", err)
261247
}
262248

263249
// Evaluate if the transaction is allowed by the policy
264-
transactionAllowed, _, err := eng.Evaluate(recipe, messageChain, decodedTx)
250+
_, err = eng.Evaluate(recipe, rcommon.Chain(keysignMessage.Chain), txBytes)
265251
if err != nil {
266252
return fmt.Errorf("failed to evaluate transaction: %w", err)
267253
}
268-
269-
if !transactionAllowed {
270-
return fmt.Errorf("transaction %s on %s not allowed by policy", keysignMessage.Hash, keysignMessage.Chain)
271-
}
272254
}
273255
}
274256

plugin/payroll/policy.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package payroll
22

33
import (
4+
"encoding/base64"
45
"fmt"
5-
"strings"
66

7-
"github.com/vultisig/recipes/chain"
7+
rcommon "github.com/vultisig/recipes/common"
88
"github.com/vultisig/recipes/engine"
99
"github.com/vultisig/verifier/plugin"
1010
vtypes "github.com/vultisig/verifier/types"
@@ -25,24 +25,15 @@ func (p *Plugin) ValidateProposedTransactions(policy vtypes.PluginPolicy, txs []
2525

2626
for _, tx := range txs {
2727
for _, keysignMessage := range tx.Messages {
28-
messageChain, err := chain.GetChain(strings.ToLower(keysignMessage.Chain.String()))
28+
txBytes, err := base64.StdEncoding.DecodeString(keysignMessage.Message)
2929
if err != nil {
30-
return fmt.Errorf("failed to get chain: %w", err)
30+
return fmt.Errorf("failed to decode transaction: %w", err)
3131
}
3232

33-
decodedTx, err := messageChain.ParseTransaction(keysignMessage.Message)
34-
if err != nil {
35-
return fmt.Errorf("failed to parse transaction: %w", err)
36-
}
37-
38-
transactionAllowed, _, err := eng.Evaluate(recipe, messageChain, decodedTx)
33+
_, err = eng.Evaluate(recipe, rcommon.Chain(keysignMessage.Chain), txBytes)
3934
if err != nil {
4035
return fmt.Errorf("failed to evaluate transaction: %w", err)
4136
}
42-
43-
if !transactionAllowed {
44-
return fmt.Errorf("transaction %s on %s not allowed by policy", keysignMessage.Hash, keysignMessage.Chain)
45-
}
4637
}
4738
}
4839

0 commit comments

Comments
 (0)