Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ type ServerConfig struct {
Host string `mapstructure:"host" json:"host,omitempty"`
Port int64 `mapstructure:"port" json:"port,omitempty"`
EncryptionSecret string `mapstructure:"encryption_secret" json:"encryption_secret,omitempty"`
VerifierUrl string `mapstructure:"verifier_url" json:"verifier_url,omitempty"` //The url of the verifier (i.e. the counter party to sign transactions).
VaultsFilePath string `mapstructure:"vaults_file_path" json:"vaults_file_path,omitempty"` //This is just for testing locally
}
9 changes: 8 additions & 1 deletion cmd/fees/worker/config.go → cmd/fees/config/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package config

import (
"fmt"
Expand All @@ -11,8 +11,15 @@ import (
"github.com/vultisig/plugin/storage"
)

type verifier struct {
URL string `mapstructure:"url"`
Token string `mapstructure:"token"`
PartyPrefix string `mapstructure:"party_prefix"`
}
Comment on lines +14 to +18

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.

I feel like this overlaps with another verifier config - non-blocking, largely up to you on how you want to handle this, but maybe worth checking later


type CoreConfig struct {
Server api.ServerConfig `mapstructure:"server" json:"server"`
Verifier verifier
Database struct {
DSN string `mapstructure:"dsn" json:"dsn,omitempty"`
} `mapstructure:"database" json:"database,omitempty"`
Expand Down
53 changes: 0 additions & 53 deletions cmd/fees/server/config.go

This file was deleted.

6 changes: 4 additions & 2 deletions cmd/fees/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/vultisig/verifier/vault"

"github.com/vultisig/plugin/api"
feeconfig "github.com/vultisig/plugin/cmd/fees/config"
"github.com/vultisig/plugin/plugin/fees"
"github.com/vultisig/plugin/storage"
"github.com/vultisig/plugin/storage/postgres"
Expand All @@ -21,7 +22,7 @@ import (
func main() {
ctx := context.Background()

cfg, err := GetConfigure()
cfg, err := feeconfig.GetConfigure()
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -80,6 +81,7 @@ func main() {

feePlugin, err := fees.NewFeePlugin(
db,
nil,
logger,
cfg.BaseConfigPath,
vaultStorage,
Expand All @@ -88,7 +90,7 @@ func main() {
client,
feePluginConfig,
cfg.Server.EncryptionSecret,
cfg.Server.VerifierUrl,
cfg.Verifier.URL,
)
if err != nil {
logger.Fatalf("failed to create fee plugin,err: %s", err)
Expand Down
21 changes: 19 additions & 2 deletions cmd/fees/worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import (
"github.com/DataDog/datadog-go/statsd"
"github.com/hibiken/asynq"
"github.com/sirupsen/logrus"
"github.com/vultisig/plugin/internal/keysign"
"github.com/vultisig/verifier/tx_indexer"
"github.com/vultisig/verifier/tx_indexer/pkg/storage"
"github.com/vultisig/verifier/vault"
"github.com/vultisig/vultiserver/relay"

feeconfig "github.com/vultisig/plugin/cmd/fees/config"
"github.com/vultisig/plugin/internal/tasks"
"github.com/vultisig/plugin/plugin/fees"
"github.com/vultisig/plugin/storage/postgres"
Expand All @@ -20,7 +23,7 @@ import (
func main() {
ctx := context.Background()

cfg, err := GetConfigure()
cfg, err := feeconfig.GetConfigure()
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -92,8 +95,22 @@ func main() {
logger.Fatalf("failed to create fees config,err: %s", err)
}

signer := keysign.NewSigner(
logger.WithField("pkg", "keysign.Signer").Logger,
relay.NewRelayClient(cfg.VaultServiceConfig.Relay.Server),
[]keysign.Emitter{
keysign.NewVerifierEmitter(cfg.Verifier.URL, cfg.Verifier.Token),
keysign.NewPluginEmitter(asynqClient, tasks.TypeKeySignDKLS, tasks.QUEUE_NAME),
},
[]string{
cfg.Verifier.PartyPrefix,
cfg.VaultServiceConfig.LocalPartyPrefix,
},
)

feePlugin, err := fees.NewFeePlugin(
postgressDB,
signer,
logger,
cfg.BaseConfigPath,
vaultStorage,
Expand All @@ -102,7 +119,7 @@ func main() {
asynqClient,
feePluginConfig,
cfg.VaultServiceConfig.EncryptionSecret,
cfg.Server.VerifierUrl,
cfg.Verifier.URL,
)
if err != nil {
logger.Fatalf("failed to create fee plugin,err: %s", err)
Expand Down
2 changes: 2 additions & 0 deletions etc/vultisig/fee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ collector_whitelist_addresses:
- 0x7d760c17d798a7A9a4c4AcAf311A02dC95972503
- 0x5BB06B9C5e4f7624Df7100Badb2F5AA1C86d8498
collector_address: 0x7d760c17d798a7A9a4c4AcAf311A02dC95972503
usdc_address: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Comment thread
garry-sharp marked this conversation as resolved.
verifier_token: localhost-fee-key
8 changes: 5 additions & 3 deletions fee.server.example.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"verifier": {
"url": "verifier:8080"
},
Comment on lines +2 to +4

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.

🛠️ Refactor suggestion

Verifier configuration restructured consistently.

The new verifier configuration section aligns with the code changes in cmd/fees/config/config.go. However, the configuration is missing the token and party_prefix fields that are defined in the verifier struct.

Apply this diff to complete the verifier configuration:

     "verifier": {
-        "url": "verifier:8080"
+        "url": "verifier:8080",
+        "token": "example-token",
+        "party_prefix": "server"
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"verifier": {
"url": "verifier:8080"
},
"verifier": {
"url": "verifier:8080",
"token": "example-token",
"party_prefix": "server"
},
🤖 Prompt for AI Agents
In fee.server.example.json around lines 2 to 4, the verifier configuration is
missing the token and party_prefix fields required by the verifier struct in
cmd/fees/config/config.go. Add the token and party_prefix fields with
appropriate example values to the verifier section to align the configuration
with the updated struct definition.

"server": {
"host": "localhost",
"port": 8080,
"encryption_secret": "test123",
"verifier_url": "http://host.docker.internal:8080"
"encryption_secret": "test123"
},
"database": {
"dsn": "postgres://myuser:mypassword@plugin-db:5432/vultisig-fee?sslmode=disable"
Expand All @@ -15,7 +17,7 @@
"password": "password"
},
"block_storage": {
"host": "http://localhost:9100",
"host": "http://minio-plugin:9000",
"region": "us-east-1",
"access_key": "minioadmin",
"secret": "minioadmin",
Expand Down
6 changes: 4 additions & 2 deletions fee.worker.example.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"server": {
"verifier_url": "http://host.docker.internal:8080"
"verifier": {
"url": "http://verifier:8080",
"token": "localhost-apikey",
"party_prefix": "verifier"
},
"vault_service": {
"relay": {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/vultisig/commondata v0.0.0-20250430024109-a2492623ef05
github.com/vultisig/mobile-tss-lib v0.0.0-20250316003201-2e7e570a4a74
github.com/vultisig/recipes v0.0.0-20250719180414-00d6b1584122
github.com/vultisig/verifier v0.0.0-20250719183957-66bbb5d90164
github.com/vultisig/verifier v0.0.0-20250719200941-de5b88138d5c
github.com/vultisig/vultiserver v0.0.0-20250715212748-4b23f9849e4b
golang.org/x/sync v0.12.0
google.golang.org/protobuf v1.36.6
Expand Down
60 changes: 2 additions & 58 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -745,66 +745,10 @@ github.com/vultisig/go-wrappers v0.0.0-20250403041248-86911e8aa33f h1:124Xlloih1
github.com/vultisig/go-wrappers v0.0.0-20250403041248-86911e8aa33f/go.mod h1:UfGCxUQW08kiwxyNBiHwXe+ePPuBmHVVS+BS51aU/Jg=
github.com/vultisig/mobile-tss-lib v0.0.0-20250316003201-2e7e570a4a74 h1:goqwk4nQ/NEVIb3OPP9SUx7/u9ZfsUIcd5fIN/e4DVU=
github.com/vultisig/mobile-tss-lib v0.0.0-20250316003201-2e7e570a4a74/go.mod h1:nOykk4nOy1L3yXtLSlYvVsgizBnCQ3tR2N5uwGPdvaM=
github.com/vultisig/recipes v0.0.0-20250710152947-d15b238437ae h1:Per1QtZamO2PiQLxzTJP5SNjg6INtn83IG0c0585/s8=
github.com/vultisig/recipes v0.0.0-20250710152947-d15b238437ae/go.mod h1:Ci29kT+x5vPxLCRvIrbVNzM+JIMjDbVvvaLTzli5kYQ=
github.com/vultisig/recipes v0.0.0-20250719170828-98457020ba89 h1:fl2mXU+iEjwzVnEXIh3LuTV4QuY/nE3AhhvqabDVkV4=
github.com/vultisig/recipes v0.0.0-20250719170828-98457020ba89/go.mod h1:Ci29kT+x5vPxLCRvIrbVNzM+JIMjDbVvvaLTzli5kYQ=
github.com/vultisig/recipes v0.0.0-20250719172653-42606aebb7ce h1:JOZsnMz2VeF41uH0ZRHiGsUwA2pDaXPR6CCOxKaBRJc=
github.com/vultisig/recipes v0.0.0-20250719172653-42606aebb7ce/go.mod h1:Ci29kT+x5vPxLCRvIrbVNzM+JIMjDbVvvaLTzli5kYQ=
github.com/vultisig/recipes v0.0.0-20250719173546-d9e9db26d802 h1:5ElUP9U8qLicd2uS8FfjSWuKvo7aopAnKW34IM6DJfo=
github.com/vultisig/recipes v0.0.0-20250719173546-d9e9db26d802/go.mod h1:Ci29kT+x5vPxLCRvIrbVNzM+JIMjDbVvvaLTzli5kYQ=
github.com/vultisig/recipes v0.0.0-20250719180414-00d6b1584122 h1:pt1wftezaJRC1x1BSBQeVXj4kjLwbz8dw102vX79R3I=
github.com/vultisig/recipes v0.0.0-20250719180414-00d6b1584122/go.mod h1:Ci29kT+x5vPxLCRvIrbVNzM+JIMjDbVvvaLTzli5kYQ=
github.com/vultisig/verifier v0.0.0-20250717202157-c35288fbeca7 h1:zLhxfMkNhYcs9npkD2EU7gdT6Iw/2pkxBwyJfTvmhd4=
github.com/vultisig/verifier v0.0.0-20250717202157-c35288fbeca7/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718124644-379bc749509c h1:ge8pQJwre4WhdiC6T3DqdGF+Dt41pRL/HYRgq1XO0rA=
github.com/vultisig/verifier v0.0.0-20250718124644-379bc749509c/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718162147-4f0c328849fd h1:u9NHj7VbhVV/ZmxvN/jyjigM8afKUjptv6IpTGqqsKE=
github.com/vultisig/verifier v0.0.0-20250718162147-4f0c328849fd/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718162726-9ef0a99df956 h1:KwrMs2LqXrK7PsaB0xdVbDRYw2zJviM8ahZOqXm8g04=
github.com/vultisig/verifier v0.0.0-20250718162726-9ef0a99df956/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718163156-76f64393d1a3 h1:aesdVawwixShx6zGY/74f1IV6fKxpqwvjm2ZpSyo/f8=
github.com/vultisig/verifier v0.0.0-20250718163156-76f64393d1a3/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718164759-2117b150abd3 h1:j9kgD0Rs6uJenyygc5+c5zb0HIIsZd7T0CWTBd4HLDE=
github.com/vultisig/verifier v0.0.0-20250718164759-2117b150abd3/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718171906-a95b9be1fd7b h1:82HZZKd/WvDliHlCfMcG9MQwiItNgZq9reZ9FRLyJqA=
github.com/vultisig/verifier v0.0.0-20250718171906-a95b9be1fd7b/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718173959-1ede91390259 h1:6emVhqmvX7qvBj8o2XWjZ+OpuWt+pGu9QZKGJQxYxnw=
github.com/vultisig/verifier v0.0.0-20250718173959-1ede91390259/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718175404-5214d042f14f h1:yeqYKLJqKAkVGK0F+t+PZCAAmxCpo5/BgW0lRNJu4tk=
github.com/vultisig/verifier v0.0.0-20250718175404-5214d042f14f/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718175739-eaca1f75ff1d h1:IZuD0mhZiy1NxyiBp4PPWguwnTZ3EHErUeHJG1sGOt4=
github.com/vultisig/verifier v0.0.0-20250718175739-eaca1f75ff1d/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718181015-882f4e8670bd h1:k+4oQcz9Tk10VKqCS5ZCW+vN8yrQhoOZUaud0uslPQE=
github.com/vultisig/verifier v0.0.0-20250718181015-882f4e8670bd/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718203532-9489403ecf6e h1:eq7iLm8siD17UiwLWfPK3dq3MsG6TkY4jSF96WzKEYQ=
github.com/vultisig/verifier v0.0.0-20250718203532-9489403ecf6e/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718203943-d2547dddc48c h1:TGvDwed4LuqUExEJF7fVo/MBxhRaNt65JH6Vukmi23o=
github.com/vultisig/verifier v0.0.0-20250718203943-d2547dddc48c/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718204848-36ac00c5d197 h1:AX6iyuRvcaZXlFOzvTSDS1XA67pxhsU0em+nOtW6lvQ=
github.com/vultisig/verifier v0.0.0-20250718204848-36ac00c5d197/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718205327-16f1dc8864d3 h1:4zQsGj+hdUNnFb/0J6FUmoTtSBGau7e0lfobj16cXIM=
github.com/vultisig/verifier v0.0.0-20250718205327-16f1dc8864d3/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718205929-74fe22a4f0be h1:QbB+PToXGjbZJAsn/LJz7ETRGPdAP8YPXDWLUeBNHeE=
github.com/vultisig/verifier v0.0.0-20250718205929-74fe22a4f0be/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718210420-2769ddbe964d h1:PXljtGD/MMrDv59jQyPaHRK8VREvPK1rM2R8aG8lZ2c=
github.com/vultisig/verifier v0.0.0-20250718210420-2769ddbe964d/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718211252-60d4356f5430 h1:x8VDQfXTE5Y49gbF9UJv2ADL0gSJTNStgOlauLEQyI0=
github.com/vultisig/verifier v0.0.0-20250718211252-60d4356f5430/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250718212050-f155e61b03e1 h1:nPAWgWzFRcV0FWWy07HSidxIvFdkB2NzvHU6Pw08iPg=
github.com/vultisig/verifier v0.0.0-20250718212050-f155e61b03e1/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250719115605-424195a79403 h1:Zo9T0AdsbrUPcVj6YMD4qrAzGyOfWMo8nBVBDIyxR+U=
github.com/vultisig/verifier v0.0.0-20250719115605-424195a79403/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250719164136-8f30676bad91 h1:9a8yuTmtiPjf0ieah/36vZRjFQ85+gcTJXAG07+0xYQ=
github.com/vultisig/verifier v0.0.0-20250719164136-8f30676bad91/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250719165606-1da8cb862647 h1:MSkEXaEx5JoTpTVFAOrSiYPWkQ84GyW+ZoqZb4CkJS8=
github.com/vultisig/verifier v0.0.0-20250719165606-1da8cb862647/go.mod h1:erFFbF94mKpX0Jq1azlmpaGMKiRbrfmnTZaPDG3zUe8=
github.com/vultisig/verifier v0.0.0-20250719182115-a7edc7e932fd h1:x1VY7DiARNWdoeCDn5e4kCjqvGJf8inDaLg34Bqccss=
github.com/vultisig/verifier v0.0.0-20250719182115-a7edc7e932fd/go.mod h1:9f3yGSZWKZeXn30mU+/brufkbkLoGlFmNLKOpRbQgeI=
github.com/vultisig/verifier v0.0.0-20250719183158-c3bd2be013e2 h1:23TaWlwn9z1W5C5+UliF+1falgw3eZrydNU0DXqmFFk=
github.com/vultisig/verifier v0.0.0-20250719183158-c3bd2be013e2/go.mod h1:9f3yGSZWKZeXn30mU+/brufkbkLoGlFmNLKOpRbQgeI=
github.com/vultisig/verifier v0.0.0-20250719183957-66bbb5d90164 h1:RD2boHHVoaSyHAz8Wo+Nx4uOlaQ1uaCnFhBSDflv2lo=
github.com/vultisig/verifier v0.0.0-20250719183957-66bbb5d90164/go.mod h1:9f3yGSZWKZeXn30mU+/brufkbkLoGlFmNLKOpRbQgeI=
github.com/vultisig/verifier v0.0.0-20250719200941-de5b88138d5c h1:kPH5+uxReDp7OAOUaG6WZxqj0Ujacs2ho5mRmr/qqzY=
github.com/vultisig/verifier v0.0.0-20250719200941-de5b88138d5c/go.mod h1:9f3yGSZWKZeXn30mU+/brufkbkLoGlFmNLKOpRbQgeI=
github.com/vultisig/vultiserver v0.0.0-20250715212748-4b23f9849e4b h1:Ed2DOWo8fA0KG6e36rzUmGpxcOQjmWTbxWyvUbI5by8=
github.com/vultisig/vultiserver v0.0.0-20250715212748-4b23f9849e4b/go.mod h1:HwP2IgW6Mcu/gX8paFuKvfibrGE9UmPgkOFTub6dskM=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
Expand Down
13 changes: 13 additions & 0 deletions internal/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ func (s *SchedulerService) CreateTimeTrigger(ctx context.Context, policy vtypes.
return s.db.CreateTimeTriggerTx(ctx, dbTx, *trigger)
}

func (s *SchedulerService) GetScheduleFromPolicy(policy vtypes.PluginPolicy) (*rtypes.Schedule, error) {
recipe, err := base64.StdEncoding.DecodeString(policy.Recipe)
if err != nil {
return nil, fmt.Errorf("base64.StdEncoding.DecodeString: %w", err)
}

var p rtypes.Policy
if err := proto.Unmarshal(recipe, &p); err != nil {
return nil, fmt.Errorf("failed to parse policy schedule: %w", err)
}
return p.Schedule, nil
}

func (s *SchedulerService) GetTriggerFromPolicy(policy vtypes.PluginPolicy) (*types.TimeTrigger, error) {
recipe, err := base64.StdEncoding.DecodeString(policy.Recipe)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion payroll.worker.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"password": "password"
},
"block_storage": {
"host": "http://localhost:9100",
"host": "http://minio-plugin:9000",
"region": "us-east-1",
"access_key": "minioadmin",
"secret": "minioadmin",
Expand Down
2 changes: 2 additions & 0 deletions plugin/fees/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type FeeConfig struct {
CollectorWhitelistAddresses []string `mapstructure:"collector_whitelist_addresses"` // A list of whitelisted addresses for which fee transactions are collected against. These can include previous addresses. Fee plugins with a recipient address that is not in this list will not be processed.
CollectorAddress string `mapstructure:"collector_address"` // This address is what is used for new policies. Fee policies created with a different address will be rejected.
MaxFeeAmount uint64 `mapstructure:"max_fee_amount"` // Policies that are created/submitted which do not have this amount will be rejected.
UsdcAddress string `mapstructure:"usdc_address"` // The address of the USDC token on the Ethereum blockchain.
VerifierToken string `mapstructure:"verifier_token"` // The token to use for the verifier API.
}

type ConfigOption func(*FeeConfig) error
Expand Down
5 changes: 5 additions & 0 deletions plugin/fees/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hibiken/asynq"
"github.com/sirupsen/logrus"
"github.com/vultisig/plugin/internal/keysign"
vcommon "github.com/vultisig/verifier/common"
"github.com/vultisig/verifier/plugin"
"github.com/vultisig/verifier/tx_indexer"
Expand All @@ -34,6 +35,7 @@ var _ plugin.Plugin = (*FeePlugin)(nil)
type FeePlugin struct {
vaultService *vault.ManagementService
vaultStorage *vault.BlockStorageImp
signer *keysign.Signer
db storage.DatabaseStorage
eth *evm.SDK
logger logrus.FieldLogger
Expand All @@ -46,6 +48,7 @@ type FeePlugin struct {
}

func NewFeePlugin(db storage.DatabaseStorage,
signer *keysign.Signer,

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.

🛠️ Refactor suggestion

Add nil validation for the signer parameter.

Consider adding validation to ensure the signer parameter is not nil, similar to the existing validation for db, vaultStorage, and other critical dependencies.

+	if signer == nil {
+		return nil, fmt.Errorf("signer cannot be nil")
+	}
+
 	if db == nil {
 		return nil, fmt.Errorf("database storage cannot be nil")
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
signer *keysign.Signer,
if signer == nil {
return nil, fmt.Errorf("signer cannot be nil")
}
if db == nil {
return nil, fmt.Errorf("database storage cannot be nil")
}
🤖 Prompt for AI Agents
In plugin/fees/fees.go at line 51, add a nil check for the signer parameter
similar to the existing validations for db and vaultStorage. If signer is nil,
return an appropriate error early to prevent potential nil pointer dereferences
later in the code.

logger logrus.FieldLogger,
baseConfigPath string,
vaultStorage *vault.BlockStorageImp,
Expand All @@ -55,6 +58,7 @@ func NewFeePlugin(db storage.DatabaseStorage,
feeConfig *FeeConfig,
encryptionSecret string,
verifierUrl string) (*FeePlugin, error) {

if db == nil {
return nil, fmt.Errorf("database storage cannot be nil")
}
Expand Down Expand Up @@ -93,6 +97,7 @@ func NewFeePlugin(db storage.DatabaseStorage,
return &FeePlugin{
db: db,
eth: evm.NewSDK(ethEvmChainID, rpcClient, rpcClient.Client()),
signer: signer,
logger: logger.WithField("plugin", "fees"),
config: feeConfig,
verifierApi: verifierApi,
Expand Down
Loading