Skip to content

Commit

Permalink
Only override private BLS key in test mode if TestPrivateBlsFlag is d…
Browse files Browse the repository at this point in the history
…efined (#1244)
  • Loading branch information
pschork authored Feb 7, 2025
1 parent 3db790b commit ecd8171
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ func NewConfig(ctx *cli.Context) (*Config, error) {
}

var blsSignerConfig blssignerTypes.SignerConfig
if !testMode {
if testMode && ctx.GlobalString(flags.TestPrivateBlsFlag.Name) != "" {
privateBls := ctx.GlobalString(flags.TestPrivateBlsFlag.Name)
blsSignerConfig = blssignerTypes.SignerConfig{
SignerType: blssignerTypes.PrivateKey,
PrivateKey: privateBls,
}
} else {
blsSignerCertFilePath := ctx.GlobalString(flags.BLSSignerCertFileFlag.Name)
enableTLS := len(blsSignerCertFilePath) > 0
signerType := blssignerTypes.Local
Expand Down Expand Up @@ -212,12 +218,6 @@ func NewConfig(ctx *cli.Context) (*Config, error) {
TLSCertFilePath: ctx.GlobalString(flags.BLSSignerCertFileFlag.Name),
CerberusAPIKey: blsSignerAPIKey,
}
} else {
privateBls := ctx.GlobalString(flags.TestPrivateBlsFlag.Name)
blsSignerConfig = blssignerTypes.SignerConfig{
SignerType: blssignerTypes.PrivateKey,
PrivateKey: privateBls,
}
}

internalDispersalFlag := ctx.GlobalString(flags.InternalDispersalPortFlag.Name)
Expand Down
2 changes: 2 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func NewNode(
var blockStaleMeasure, storeDurationBlocks uint32
if config.EnableTestMode && config.OverrideBlockStaleMeasure > 0 {
blockStaleMeasure = uint32(config.OverrideBlockStaleMeasure)
logger.Info("Test Mode Override!", "blockStaleMeasure", blockStaleMeasure)
} else {
staleMeasure, err := tx.GetBlockStaleMeasure(context.Background())
if err != nil {
Expand All @@ -167,6 +168,7 @@ func NewNode(
}
if config.EnableTestMode && config.OverrideStoreDurationBlocks > 0 {
storeDurationBlocks = uint32(config.OverrideStoreDurationBlocks)
logger.Info("Test Mode Override!", "storeDurationBlocks", storeDurationBlocks)
} else {
storeDuration, err := tx.GetStoreDurationBlocks(context.Background())
if err != nil {
Expand Down

0 comments on commit ecd8171

Please sign in to comment.