Skip to content

Commit 199d511

Browse files
tac0turtletac0turtle
authored andcommitted
fix test
1 parent 56eeb50 commit 199d511

4 files changed

Lines changed: 27 additions & 30 deletions

File tree

cmd/rollkit/commands/init.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ var InitCmd = &cobra.Command{
6767
}
6868

6969
// If using local file signer, initialize the key
70-
if config.RemoteSigner.SignerType == "file" && config.Node.Aggregator {
70+
if config.Signer.SignerType == "file" && config.Node.Aggregator {
7171
// Get passphrase if local signing is enabled
72-
passphrase, err := cmd.Flags().GetString(rollconf.FlagRemoteSignerPassphrase)
72+
passphrase, err := cmd.Flags().GetString(rollconf.FlagSignerPassphrase)
7373
if err != nil {
7474
return fmt.Errorf("error reading passphrase flag: %w", err)
7575
}
@@ -85,10 +85,10 @@ var InitCmd = &cobra.Command{
8585
}
8686

8787
// Set signer path
88-
config.RemoteSigner.SignerPath = filepath.Join(signerDir, "key.json")
88+
config.Signer.SignerPath = filepath.Join(signerDir, "key.json")
8989

9090
// Initialize the signer
91-
_, err = file.NewFileSystemSigner(config.RemoteSigner.SignerPath, []byte(passphrase))
91+
_, err = file.NewFileSystemSigner(config.Signer.SignerPath, []byte(passphrase))
9292
if err != nil {
9393
return fmt.Errorf("failed to initialize signer: %w", err)
9494
}
@@ -106,5 +106,5 @@ var InitCmd = &cobra.Command{
106106

107107
func init() {
108108
// Add passphrase flag
109-
InitCmd.Flags().String(rollconf.FlagRemoteSignerPassphrase, "", "Passphrase for encrypting the local signer key (required when using local file signer)")
109+
InitCmd.Flags().String(rollconf.FlagSignerPassphrase, "", "Passphrase for encrypting the local signer key (required when using local file signer)")
110110
}

cmd/rollkit/commands/run_node.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func NewRunNodeCmd() *cobra.Command {
5757
defer cancel() // Ensure context is cancelled when command exits
5858

5959
// Check if passphrase is required and provided
60-
if nodeConfig.Node.Aggregator && nodeConfig.RemoteSigner.SignerType == "file" {
61-
passphrase, err := cmd.Flags().GetString(rollconf.FlagRemoteSignerPassphrase)
60+
if nodeConfig.Node.Aggregator && nodeConfig.Signer.SignerType == "file" {
61+
passphrase, err := cmd.Flags().GetString(rollconf.FlagSignerPassphrase)
6262
if err != nil {
6363
return err
6464
}
@@ -76,20 +76,20 @@ func NewRunNodeCmd() *cobra.Command {
7676

7777
//create a new remote signer
7878
var signer signer.Signer
79-
if nodeConfig.RemoteSigner.SignerType == "file" {
80-
passphrase, err := cmd.Flags().GetString(rollconf.FlagRemoteSignerPassphrase)
79+
if nodeConfig.Signer.SignerType == "file" {
80+
passphrase, err := cmd.Flags().GetString(rollconf.FlagSignerPassphrase)
8181
if err != nil {
8282
return err
8383
}
8484

85-
signer, err = file.NewFileSystemSigner(nodeConfig.RemoteSigner.SignerPath, []byte(passphrase))
85+
signer, err = file.NewFileSystemSigner(nodeConfig.Signer.SignerPath, []byte(passphrase))
8686
if err != nil {
8787
return err
8888
}
89-
} else if nodeConfig.RemoteSigner.SignerType == "grpc" {
89+
} else if nodeConfig.Signer.SignerType == "grpc" {
9090
panic("grpc remote signer not implemented")
9191
} else {
92-
return fmt.Errorf("unknown remote signer type: %s", nodeConfig.RemoteSigner.SignerType)
92+
return fmt.Errorf("unknown remote signer type: %s", nodeConfig.Signer.SignerType)
9393
}
9494

9595
dummySequencer := coresequencer.NewDummySequencer()
@@ -232,9 +232,6 @@ func addNodeFlags(cmd *cobra.Command) {
232232
// This is for testing only
233233
cmd.Flags().String("kv-executor-http", ":40042", "address for the KV executor HTTP server (empty to disable)")
234234

235-
// Add passphrase flag
236-
cmd.Flags().String(rollconf.FlagRemoteSignerPassphrase, "", "Passphrase for decrypting the local signer key (required for aggregator nodes using local file signer)")
237-
238235
// Add Rollkit flags
239236
rollconf.AddFlags(cmd)
240237
}

pkg/config/config.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,16 @@ const (
101101
// FlagLogTrace is a flag for enabling stack traces in error logs
102102
FlagLogTrace = "log.trace"
103103

104-
// Remote signer configuration flags
104+
// Signer configuration flags
105105

106-
// FlagRemoteSignerType is a flag for specifying the remote signer type
107-
FlagRemoteSignerType = "remote_signer.type"
108-
// FlagRemoteSignerPath is a flag for specifying the remote signer path
109-
FlagRemoteSignerPath = "remote_signer.path"
106+
// FlagSignerType is a flag for specifying the signer type
107+
FlagSignerType = "signer.type"
108+
// FlagSignerPath is a flag for specifying the signer path
109+
FlagSignerPath = "signer.path"
110110

111-
// FlagRemoteSignerPassphrase is a flag for specifying the remote signer passphrase
111+
// FlagSignerPassphrase is a flag for specifying the signer passphrase
112112
//nolint:gosec
113-
FlagRemoteSignerPassphrase = "remote_signer.passphrase"
113+
FlagSignerPassphrase = "signer.passphrase"
114114

115115
// RPC configuration flags
116116

@@ -165,7 +165,7 @@ type Config struct {
165165
Log LogConfig `mapstructure:"log" yaml:"log"`
166166

167167
// Remote signer configuration
168-
RemoteSigner RemoteSignerConfig `mapstructure:"remote_signer" yaml:"remote_signer"`
168+
Signer SignerConfig `mapstructure:"signer" yaml:"signer"`
169169
}
170170

171171
// DAConfig contains all Data Availability configuration parameters
@@ -217,8 +217,8 @@ type P2PConfig struct {
217217
AllowedPeers string `mapstructure:"allowed_peers" yaml:"allowed_peers" comment:"Comma separated list of peer IDs to allow connections from"`
218218
}
219219

220-
// RemoteSignerConfig contains all remote signer configuration parameters
221-
type RemoteSignerConfig struct {
220+
// SignerConfig contains all signer configuration parameters
221+
type SignerConfig struct {
222222
SignerType string `mapstructure:"signer_type" yaml:"signer_type" comment:"Type of remote signer to use (file, grpc)"`
223223
SignerPath string `mapstructure:"signer_path" yaml:"signer_path" comment:"Path to the signer file or address"`
224224
}
@@ -286,10 +286,10 @@ func AddFlags(cmd *cobra.Command) {
286286
cmd.Flags().String(FlagLogFormat, "", "log format (text, json)")
287287
cmd.Flags().Bool(FlagLogTrace, false, "enable stack traces in error logs")
288288

289-
// Remote signer configuration flags
290-
cmd.Flags().String(FlagRemoteSignerType, def.RemoteSigner.SignerType, "type of remote signer to use (file, grpc)")
291-
cmd.Flags().String(FlagRemoteSignerPath, def.RemoteSigner.SignerPath, "path to the signer file or address")
292-
cmd.Flags().String(FlagRemoteSignerPassphrase, "", "passphrase for the remote signer")
289+
// Signer configuration flags
290+
cmd.Flags().String(FlagSignerType, def.Signer.SignerType, "type of signer to use (file, grpc)")
291+
cmd.Flags().String(FlagSignerPath, def.Signer.SignerPath, "path to the signer file or address")
292+
cmd.Flags().String(FlagSignerPassphrase, "", "passphrase for the signer")
293293
}
294294

295295
// LoadNodeConfig loads the node configuration in the following order of precedence:

pkg/config/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var DefaultNodeConfig = Config{
7575
Format: "",
7676
Trace: false,
7777
},
78-
RemoteSigner: RemoteSignerConfig{
78+
Signer: SignerConfig{
7979
SignerType: "file",
8080
SignerPath: "",
8181
},

0 commit comments

Comments
 (0)