-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make ecdsa optional for certain operations #522
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package main | |
|
||
import ( | ||
"context" | ||
|
||
"log" | ||
"os" | ||
"strings" | ||
|
@@ -15,6 +16,8 @@ import ( | |
"github.com/Layr-Labs/eigenda/node" | ||
"github.com/Layr-Labs/eigenda/node/plugin" | ||
"github.com/Layr-Labs/eigensdk-go/crypto/bls" | ||
|
||
"github.com/ethereum/go-ethereum/accounts/keystore" | ||
gethcommon "github.com/ethereum/go-ethereum/common" | ||
"github.com/urfave/cli" | ||
) | ||
|
@@ -69,12 +72,16 @@ func pluginOps(ctx *cli.Context) { | |
|
||
operatorID := keyPair.GetPubKeyG1().GetOperatorID() | ||
|
||
sk, privateKey, err := plugin.GetECDSAPrivateKey(config.EcdsaKeyFile, config.EcdsaKeyPassword) | ||
if err != nil { | ||
log.Printf("Error: failed to read or decrypt the ECDSA private key: %v", err) | ||
return | ||
var sk *keystore.Key | ||
var privateKey *string | ||
if config.Operation != plugin.OperationListQuorums { | ||
sk, privateKey, err = plugin.GetECDSAPrivateKey(config.EcdsaKeyFile, config.EcdsaKeyPassword) | ||
if err != nil { | ||
log.Printf("Error: failed to read or decrypt the ECDSA private key: %v", err) | ||
return | ||
} | ||
log.Printf("Info: ECDSA key read and decrypted from %s", config.EcdsaKeyFile) | ||
} | ||
log.Printf("Info: ECDSA key read and decrypted from %s", config.EcdsaKeyFile) | ||
|
||
loggerConfig := common.DefaultLoggerConfig() | ||
logger, err := common.NewLogger(loggerConfig) | ||
|
@@ -117,6 +124,21 @@ func pluginOps(ctx *cli.Context) { | |
} | ||
} | ||
|
||
if config.Operation == plugin.OperationListQuorums { | ||
shrimalmadhur marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why don't we put this block before declaring There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that but the reason is - this still require There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh but that won't work since |
||
operatorAddress, err := tx.OperatorIDToAddress(context.Background(), operatorID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we should just use this to get address for all cases and not rely on private key? |
||
if err != nil { | ||
log.Printf("Error: failed to get operator address for operatorID: %x, error: %v", operatorID, err) | ||
return | ||
} | ||
quorumIds, err := tx.GetRegisteredQuorumIdsForOperator(context.Background(), operatorID) | ||
if err != nil { | ||
log.Printf("Error: failed to get quorum(s) for operatorID: %x, operator address: %x, error: %v", operatorID, sk.Address, err) | ||
shrimalmadhur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return | ||
} | ||
log.Printf("Info: operator ID: %x, operator address: %x, current quorums: %v", operatorID, operatorAddress, quorumIds) | ||
shrimalmadhur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return | ||
} | ||
|
||
operator := &node.Operator{ | ||
Address: sk.Address.Hex(), | ||
Socket: socket, | ||
|
@@ -152,13 +174,6 @@ func pluginOps(ctx *cli.Context) { | |
return | ||
} | ||
log.Printf("Info: successfully updated socket, for operator ID: %x, operator address: %x, socket: %s", operatorID, sk.Address, config.Socket) | ||
} else if config.Operation == plugin.OperationListQuorums { | ||
quorumIds, err := tx.GetRegisteredQuorumIdsForOperator(context.Background(), operatorID) | ||
if err != nil { | ||
log.Printf("Error: failed to get quorum(s) for operatorID: %x, operator address: %x, error: %v", operatorID, sk.Address, err) | ||
return | ||
} | ||
log.Printf("Info: operator ID: %x, operator address: %x, current quorums: %v", operatorID, sk.Address, quorumIds) | ||
} else { | ||
log.Fatalf("Fatal: unsupported operation: %s", config.Operation) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putting this operation before
operator
is initialized since that require us to have private key. I am making minimal changes to make sure we make ecdsa optional here too.