Skip to content

Commit

Permalink
Skip key generation when localstack is not running.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <cody@eigenlabs.org>
  • Loading branch information
cody-littley committed Jan 2, 2025
1 parent db018f0 commit d1ac4a8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inabox/deploy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,17 @@ func generateDisperserKeypair() (string, gethcommon.Address, error) {
BaseEndpoint: aws.String("http://localhost:4570"), // TODO don't hard code this
})

log.Printf("Generating disperser keypair")

createKeyOutput, err := keyManager.CreateKey(context.Background(), &kms.CreateKeyInput{
KeySpec: types.KeySpecEccSecgP256k1,
KeyUsage: types.KeyUsageTypeSignVerify,
})
if err != nil {
if strings.Contains(err.Error(), "connect: connection refused") {
log.Printf("Unable to reach local stack, skipping disperser keypair generation. Error: %v", err)
err = nil
}
return "", gethcommon.Address{}, err
}

Expand All @@ -603,6 +609,8 @@ func generateDisperserKeypair() (string, gethcommon.Address, error) {

publicAddress := crypto.PubkeyToAddress(*key)

log.Printf("Generated disperser keypair: key ID: %s, address: %s", keyID, publicAddress.Hex())

return keyID, publicAddress, nil
}

Expand Down

0 comments on commit d1ac4a8

Please sign in to comment.