Skip to content

Commit 4ffbcef

Browse files
committed
fix: get appropriate logger from cCtx
1 parent 88fde9b commit 4ffbcef

File tree

21 files changed

+80
-80
lines changed

21 files changed

+80
-80
lines changed

pkg/commands/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var BuildCommand = &cli.Command{
2424
},
2525
}, common.GlobalFlags...),
2626
Action: func(cCtx *cli.Context) error {
27-
logger := common.LoggerFromContext(cCtx.Context)
27+
logger := common.LoggerFromContext(cCtx)
2828

2929
// Migrate config
3030
configsMigratedCount, err := configs.MigrateConfig(logger)

pkg/commands/call.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var CallCommand = &cli.Command{
2424
}, common.GlobalFlags...),
2525
Action: func(cCtx *cli.Context) error {
2626
// Get logger
27-
logger := common.LoggerFromContext(cCtx.Context)
27+
logger := common.LoggerFromContext(cCtx)
2828

2929
// Check for flagged contextName
3030
contextName := cCtx.String("context")

pkg/commands/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var Command = &cli.Command{
2929
},
3030
}, common.GlobalFlags...),
3131
Action: func(cCtx *cli.Context) error {
32-
logger := common.LoggerFromContext(cCtx.Context)
32+
logger := common.LoggerFromContext(cCtx)
3333

3434
// Identify the top level config .yaml
3535
cfgPath := filepath.Join("config", common.BaseConfig)

pkg/commands/config/config_edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var DefaultConfigPath = filepath.Join("config")
4242

4343
// editConfig is the main entry point for the edit config functionality
4444
func EditConfig(cCtx *cli.Context, configPath string, editTarget EditTarget, context string) error {
45-
logger := common.LoggerFromContext(cCtx.Context)
45+
logger := common.LoggerFromContext(cCtx)
4646

4747
// Find an available editor
4848
editor, err := findEditor()

pkg/commands/context/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var Command = &cli.Command{
3838
},
3939
}, common.GlobalFlags...),
4040
Action: func(cCtx *cli.Context) error {
41-
logger := common.LoggerFromContext(cCtx.Context)
41+
logger := common.LoggerFromContext(cCtx)
4242

4343
// Identify the context we are working against
4444
context := cCtx.String("context")

pkg/commands/context/context_create.go

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,27 @@ var CreateContextCommand = &cli.Command{
7575
Action: contextCreateAction,
7676
}
7777

78-
func contextCreateAction(c *cli.Context) error {
79-
logger := common.LoggerFromContext(c.Context)
78+
func contextCreateAction(cCtx *cli.Context) error {
79+
logger := common.LoggerFromContext(cCtx)
8080

8181
// Use flag provided name
82-
name := c.String("context")
82+
name := cCtx.String("context")
8383

8484
// Get context name from arg
8585
if name == "" {
86-
name = c.Args().Get(0)
86+
name = cCtx.Args().Get(0)
8787
}
8888

8989
// If no context is provided show help
9090
if name == "" {
91-
return cli.ShowSubcommandHelp(c)
91+
return cli.ShowSubcommandHelp(cCtx)
9292
}
9393

9494
// Locate the context directory
9595
cntxDir := filepath.Join("config", "contexts")
9696

9797
// Guard existence early
98-
if err := ensureContextCreatable(cntxDir, name, c.Bool("overwrite")); err != nil {
98+
if err := ensureContextCreatable(cntxDir, name, cCtx.Bool("overwrite")); err != nil {
9999
return err
100100
}
101101

@@ -117,7 +117,7 @@ func contextCreateAction(c *cli.Context) error {
117117
}
118118

119119
// Set the current context in config
120-
if c.Bool("use") {
120+
if cCtx.Bool("use") {
121121
err := setCurrentContext(name)
122122
if err != nil {
123123
return fmt.Errorf("failed to set current context %s: %w", entryName, err)
@@ -135,13 +135,13 @@ func contextCreateAction(c *cli.Context) error {
135135
}
136136

137137
// Log creation
138-
logContextCreated(logger, cntxDir, name, &ctxDoc, c.Bool("use"))
138+
logContextCreated(logger, cntxDir, name, &ctxDoc, cCtx.Bool("use"))
139139

140140
return nil
141141
}
142142

143143
// L1
144-
l1RPCURL, err := getL1RPCURL(c)
144+
l1RPCURL, err := getL1RPCURL(cCtx)
145145
if err != nil {
146146
return err
147147
}
@@ -151,7 +151,7 @@ func contextCreateAction(c *cli.Context) error {
151151
}
152152

153153
// L2
154-
l2RPCURL, err := getL2RPCURL(c)
154+
l2RPCURL, err := getL2RPCURL(cCtx)
155155
if err != nil {
156156
return err
157157
}
@@ -161,15 +161,15 @@ func contextCreateAction(c *cli.Context) error {
161161
}
162162

163163
// Keys and AVS basics
164-
deployerKey, err := getDeployerKey(c)
164+
deployerKey, err := getDeployerKey(cCtx)
165165
if err != nil {
166166
return err
167167
}
168-
appKey, err := getAppKey(c)
168+
appKey, err := getAppKey(cCtx)
169169
if err != nil {
170170
return err
171171
}
172-
avsCfg, err := getAVSSetup(c)
172+
avsCfg, err := getAVSSetup(cCtx)
173173
if err != nil {
174174
return err
175175
}
@@ -183,7 +183,7 @@ func contextCreateAction(c *cli.Context) error {
183183
)
184184

185185
// Persist and optionally make current
186-
if err := saveContext(cntxDir, name, ctxDoc, c.Bool("use"), logger); err != nil {
186+
if err := saveContext(cntxDir, name, ctxDoc, cCtx.Bool("use"), logger); err != nil {
187187
return err
188188
}
189189

@@ -192,7 +192,7 @@ func contextCreateAction(c *cli.Context) error {
192192
if err != nil {
193193
logger.Title("Could not load context YAML for Zeus update: %v", err)
194194
} else {
195-
if err := common.UpdateContextWithZeusAddresses(c.Context, logger, contextNode, contextName); err != nil {
195+
if err := common.UpdateContextWithZeusAddresses(cCtx.Context, logger, contextNode, contextName); err != nil {
196196
logger.Info("Failed to fetch addresses from Zeus: %v", err)
197197
logger.Info("Continuing with addresses from config...")
198198
} else {
@@ -203,7 +203,7 @@ func contextCreateAction(c *cli.Context) error {
203203
}
204204
}
205205

206-
logContextCreated(logger, cntxDir, name, ctxDoc, c.Bool("use"))
206+
logContextCreated(logger, cntxDir, name, ctxDoc, cCtx.Bool("use"))
207207
return nil
208208
}
209209

@@ -218,8 +218,8 @@ func ensureContextCreatable(cntxDir, ctxName string, overwrite bool) error {
218218
return nil
219219
}
220220

221-
func getL1RPCURL(c *cli.Context) (string, error) {
222-
l1RPCURL := c.String("l1-rpc-url")
221+
func getL1RPCURL(cCtx *cli.Context) (string, error) {
222+
l1RPCURL := cCtx.String("l1-rpc-url")
223223
if l1RPCURL == "" {
224224
url, err := output.InputString(
225225
"Enter L1 RPC URL",
@@ -255,8 +255,8 @@ func getChainIDFromRPC(rpcURL string, logger iface.Logger) (*big.Int, error) {
255255
return chainID, nil
256256
}
257257

258-
func getL2RPCURL(c *cli.Context) (string, error) {
259-
l2RPCURL := c.String("l2-rpc-url")
258+
func getL2RPCURL(cCtx *cli.Context) (string, error) {
259+
l2RPCURL := cCtx.String("l2-rpc-url")
260260
if l2RPCURL == "" {
261261
url, err := output.InputString(
262262
"Enter L2 RPC URL",
@@ -275,8 +275,8 @@ func getL2RPCURL(c *cli.Context) (string, error) {
275275
return l2RPCURL, nil
276276
}
277277

278-
func getDeployerKey(c *cli.Context) (string, error) {
279-
deployerPrivateKey := c.String("deployer-private-key")
278+
func getDeployerKey(cCtx *cli.Context) (string, error) {
279+
deployerPrivateKey := cCtx.String("deployer-private-key")
280280
if deployerPrivateKey == "" {
281281
val, err := output.InputString(
282282
"Enter a funded Deployer Private Key",
@@ -295,8 +295,8 @@ func getDeployerKey(c *cli.Context) (string, error) {
295295
return "0x" + strip0x(deployerPrivateKey), nil
296296
}
297297

298-
func getAppKey(c *cli.Context) (string, error) {
299-
appPrivateKey := c.String("app-private-key")
298+
func getAppKey(cCtx *cli.Context) (string, error) {
299+
appPrivateKey := cCtx.String("app-private-key")
300300
if appPrivateKey == "" {
301301
val, err := output.InputString(
302302
"Enter a funded App private key",
@@ -315,20 +315,20 @@ func getAppKey(c *cli.Context) (string, error) {
315315
return "0x" + strip0x(appPrivateKey), nil
316316
}
317317

318-
func getAVSSetup(c *cli.Context) (*common.AvsConfig, error) {
319-
privateKey, err := getAVSPrivateKey(c)
318+
func getAVSSetup(cCtx *cli.Context) (*common.AvsConfig, error) {
319+
privateKey, err := getAVSPrivateKey(cCtx)
320320
if err != nil {
321321
return nil, err
322322
}
323323
address, err := derivePublicKey(privateKey)
324324
if err != nil {
325325
return nil, err
326326
}
327-
metadataURL, err := getAVSMetadataURL(c)
327+
metadataURL, err := getAVSMetadataURL(cCtx)
328328
if err != nil {
329329
return nil, err
330330
}
331-
registrar, err := getRegistrarAddress(c)
331+
registrar, err := getRegistrarAddress(cCtx)
332332
if err != nil {
333333
return nil, err
334334
}
@@ -343,8 +343,8 @@ func getAVSSetup(c *cli.Context) (*common.AvsConfig, error) {
343343
return cfg, nil
344344
}
345345

346-
func getAVSPrivateKey(c *cli.Context) (string, error) {
347-
pk := c.String("avs-private-key")
346+
func getAVSPrivateKey(cCtx *cli.Context) (string, error) {
347+
pk := cCtx.String("avs-private-key")
348348
if pk == "" {
349349
val, err := output.InputString(
350350
"Enter a funded AVS private key",
@@ -374,8 +374,8 @@ func derivePublicKey(pkHex string) (string, error) {
374374
return strings.ToLower(addr.Hex()), nil
375375
}
376376

377-
func getAVSMetadataURL(c *cli.Context) (string, error) {
378-
u := c.String("avs-metadata-url")
377+
func getAVSMetadataURL(cCtx *cli.Context) (string, error) {
378+
u := cCtx.String("avs-metadata-url")
379379
if u == "" {
380380
val, err := output.InputString(
381381
"Enter AVS metadata URL",
@@ -394,8 +394,8 @@ func getAVSMetadataURL(c *cli.Context) (string, error) {
394394
return u, nil
395395
}
396396

397-
func getRegistrarAddress(c *cli.Context) (string, error) {
398-
addr := c.String("registrar-address")
397+
func getRegistrarAddress(cCtx *cli.Context) (string, error) {
398+
addr := cCtx.String("registrar-address")
399399
if addr == "" {
400400
val, err := output.InputString(
401401
"Enter Registrar contract address",

pkg/commands/deploy_actions.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type ChainInfo struct {
4747

4848
func StartDeployL1Action(cCtx *cli.Context) error {
4949
// Get logger
50-
logger := common.LoggerFromContext(cCtx.Context)
50+
logger := common.LoggerFromContext(cCtx)
5151
caser := cases.Title(language.English)
5252

5353
// Extract vars
@@ -178,7 +178,7 @@ func StartDeployL1Action(cCtx *cli.Context) error {
178178

179179
func StartDeployL2Action(cCtx *cli.Context) error {
180180
// Get logger
181-
logger := common.LoggerFromContext(cCtx.Context)
181+
logger := common.LoggerFromContext(cCtx)
182182
caser := cases.Title(language.English)
183183

184184
// Load config for selected context
@@ -282,7 +282,7 @@ func StartDeployL2Action(cCtx *cli.Context) error {
282282

283283
func DeployL1ContractsAction(cCtx *cli.Context) error {
284284
// Get logger
285-
logger := common.LoggerFromContext(cCtx.Context)
285+
logger := common.LoggerFromContext(cCtx)
286286
caser := cases.Title(language.English)
287287

288288
// Check if docker is running, else try to start it
@@ -407,7 +407,7 @@ func DeployL1ContractsAction(cCtx *cli.Context) error {
407407

408408
func DeployL2ContractsAction(cCtx *cli.Context) error {
409409
// Get logger
410-
logger := common.LoggerFromContext(cCtx.Context)
410+
logger := common.LoggerFromContext(cCtx)
411411
caser := cases.Title(language.English)
412412

413413
// Check if docker is running, else try to start it
@@ -791,7 +791,7 @@ func RegisterOperatorsToAvsFromConfigAction(cCtx *cli.Context, logger iface.Logg
791791
}
792792

793793
func FetchZeusAddressesAction(cCtx *cli.Context) error {
794-
logger := common.LoggerFromContext(cCtx.Context)
794+
logger := common.LoggerFromContext(cCtx)
795795

796796
// Extract vars
797797
contextName := cCtx.String("context")
@@ -825,7 +825,7 @@ func FetchZeusAddressesAction(cCtx *cli.Context) error {
825825
}
826826

827827
func extractContractOutputs(cCtx *cli.Context, context string, contractsList []DeployContractTransport, chainId string) error {
828-
logger := common.LoggerFromContext(cCtx.Context)
828+
logger := common.LoggerFromContext(cCtx)
829829

830830
// Push contract artefacts to ./contracts/outputs
831831
outDir := filepath.Join("contracts", "outputs", context)

pkg/commands/devnet_actions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func StartDevnetAction(cCtx *cli.Context) error {
4242
}
4343

4444
// Get logger
45-
logger := common.LoggerFromContext(cCtx.Context)
45+
logger := common.LoggerFromContext(cCtx)
4646

4747
// Extract vars
4848
contextName := cCtx.String("context")
@@ -451,7 +451,7 @@ func StartDevnetAction(cCtx *cli.Context) error {
451451

452452
func StopDevnetAction(cCtx *cli.Context) error {
453453
// Get logger
454-
log := common.LoggerFromContext(cCtx.Context)
454+
log := common.LoggerFromContext(cCtx)
455455

456456
// Read flags
457457
stopAllContainers := cCtx.Bool("all")

pkg/commands/keystore/create_keystore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var CreateCommand = &cli.Command{
4444
},
4545
}, common.GlobalFlags...),
4646
Action: func(cCtx *cli.Context) error {
47-
logger := common.LoggerFromContext(cCtx.Context)
47+
logger := common.LoggerFromContext(cCtx)
4848

4949
privateKey := cCtx.String("key")
5050
path := cCtx.String("path")

pkg/commands/release_actions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
func publishReleaseAction(cCtx *cli.Context) error {
27-
logger := common.LoggerFromContext(cCtx.Context)
27+
logger := common.LoggerFromContext(cCtx)
2828

2929
// Get values from flags
3030
upgradeByTime := cCtx.Int64("upgrade-by-time")
@@ -399,7 +399,7 @@ func publishReleaseToReleaseManagerAction(
399399

400400
// setReleaseMetadataURIAction handles the "release uri" subcommand
401401
func setReleaseMetadataURIAction(cCtx *cli.Context) error {
402-
logger := common.LoggerFromContext(cCtx.Context)
402+
logger := common.LoggerFromContext(cCtx)
403403

404404
// Get values from flags
405405
metadataURI := cCtx.String("metadata-uri")

0 commit comments

Comments
 (0)