-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add Support for Multisig Wallets #120
Closed
Closed
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3ede08f
add gnosis js examples
pavelkrolevets df2b860
add multisig support
pavelkrolevets 4723ca2
update on-chain gnosis example
pavelkrolevets 5ac76cb
add off-chain multisig gnosis example
pavelkrolevets 896508c
add support to multisig wallets by seperating the stage of submitting…
alan-ssvlabs 63e8b53
update reshare bulk marshaling
pavelkrolevets 538db76
update operator handlers
alan-ssvlabs 5312d79
update integration test
alan-ssvlabs 9cf8c88
update Reshare and Resign hash from hash of tree root to hash of mars…
alan-ssvlabs 5bf3667
working json bulk resign/reshare decoding
pavelkrolevets f06eea0
Merge remote-tracking branch 'origin/multisig' into gnosis_multisig
pavelkrolevets e0be332
Merge pull request #121 from ssvlabs/gnosis_multisig
alan-ssvlabs b73a2bf
fix bugs in hashing messages and initiating operator resign/reshare m…
alan-ssvlabs d5da809
fix operators marshalling
pavelkrolevets f83dfcf
Update test
alan-ssvlabs f0cb6e9
simplify code
alan-ssvlabs cd0759c
add error handling
alan-ssvlabs d80df54
revert changes on operator side to process resign/reshare message and…
alan-ssvlabs b64eb84
udpate initiator inputs to start resign/reshare to pass in signatures…
alan-ssvlabs f566ab1
update test
alan-ssvlabs fa7aa71
update variable naming in multisig tests
alan-ssvlabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -72,8 +72,7 @@ var ( | |||||
var ( | ||||||
ProofsFilePath string | ||||||
NewOperatorIDs []string | ||||||
KeystorePath string | ||||||
KeystorePass string | ||||||
Signatures string | ||||||
) | ||||||
|
||||||
// SetViperConfig reads a yaml config file if provided | ||||||
|
@@ -200,6 +199,35 @@ func SetVerifyFlags(cmd *cobra.Command) { | |||||
flags.AddPersistentStringFlag(cmd, "owner", "", "Owner address", true) | ||||||
} | ||||||
|
||||||
func SetGenerateResignMsgFlags(cmd *cobra.Command) { | ||||||
SetBaseFlags(cmd) | ||||||
flags.OperatorsInfoFlag(cmd) | ||||||
flags.OperatorsInfoPathFlag(cmd) | ||||||
flags.OperatorIDsFlag(cmd) | ||||||
flags.OwnerAddressFlag(cmd) | ||||||
flags.NonceFlag(cmd) | ||||||
flags.NetworkFlag(cmd) | ||||||
flags.WithdrawAddressFlag(cmd) | ||||||
flags.ProofsFilePath(cmd) | ||||||
flags.ClientCACertPathFlag(cmd) | ||||||
flags.EthEndpointURL(cmd) | ||||||
} | ||||||
|
||||||
func SetGenerateReshareMsgFlags(cmd *cobra.Command) { | ||||||
SetBaseFlags(cmd) | ||||||
flags.OperatorsInfoFlag(cmd) | ||||||
flags.OperatorsInfoPathFlag(cmd) | ||||||
flags.OperatorIDsFlag(cmd) | ||||||
flags.NewOperatorIDsFlag(cmd) | ||||||
flags.WithdrawAddressFlag(cmd) | ||||||
flags.OwnerAddressFlag(cmd) | ||||||
flags.NonceFlag(cmd) | ||||||
flags.NetworkFlag(cmd) | ||||||
flags.ProofsFilePath(cmd) | ||||||
flags.ClientCACertPathFlag(cmd) | ||||||
flags.EthEndpointURL(cmd) | ||||||
} | ||||||
|
||||||
func SetResigningFlags(cmd *cobra.Command) { | ||||||
SetBaseFlags(cmd) | ||||||
flags.OperatorsInfoFlag(cmd) | ||||||
|
@@ -211,8 +239,7 @@ func SetResigningFlags(cmd *cobra.Command) { | |||||
flags.WithdrawAddressFlag(cmd) | ||||||
flags.ProofsFilePath(cmd) | ||||||
flags.ClientCACertPathFlag(cmd) | ||||||
flags.KeystoreFilePath(cmd) | ||||||
flags.KeystoreFilePass(cmd) | ||||||
flags.SignaturesFlag(cmd) | ||||||
flags.EthEndpointURL(cmd) | ||||||
} | ||||||
|
||||||
|
@@ -228,8 +255,7 @@ func SetReshareFlags(cmd *cobra.Command) { | |||||
flags.NetworkFlag(cmd) | ||||||
flags.ProofsFilePath(cmd) | ||||||
flags.ClientCACertPathFlag(cmd) | ||||||
flags.KeystoreFilePath(cmd) | ||||||
flags.KeystoreFilePass(cmd) | ||||||
flags.SignaturesFlag(cmd) | ||||||
flags.EthEndpointURL(cmd) | ||||||
} | ||||||
|
||||||
|
@@ -397,10 +423,7 @@ func BindResigningFlags(cmd *cobra.Command) error { | |||||
if err := viper.BindPFlag("network", cmd.Flags().Lookup("network")); err != nil { | ||||||
return err | ||||||
} | ||||||
if err := viper.BindPFlag("ethKeystorePath", cmd.PersistentFlags().Lookup("ethKeystorePath")); err != nil { | ||||||
return err | ||||||
} | ||||||
if err := viper.BindPFlag("ethKeystorePass", cmd.PersistentFlags().Lookup("ethKeystorePass")); err != nil { | ||||||
if err := viper.BindPFlag("signatures", cmd.PersistentFlags().Lookup("signatures")); err != nil { | ||||||
return err | ||||||
} | ||||||
OperatorIDs = viper.GetStringSlice("operatorIDs") | ||||||
|
@@ -453,13 +476,9 @@ func BindResigningFlags(cmd *cobra.Command) error { | |||||
if err != nil { | ||||||
return fmt.Errorf("😥 Failed to parse owner address: %s", err) | ||||||
} | ||||||
KeystorePath = viper.GetString("ethKeystorePath") | ||||||
if strings.Contains(KeystorePath, "../") { | ||||||
return fmt.Errorf("😥 ethKeystorePath should not contain traversal") | ||||||
} | ||||||
KeystorePass = viper.GetString("ethKeystorePass") | ||||||
if strings.Contains(KeystorePath, "../") { | ||||||
return fmt.Errorf("😥 ethKeystorePass should not contain traversal") | ||||||
Signatures = viper.GetString("signatures") | ||||||
if Signatures == "" { | ||||||
return fmt.Errorf("😥 Failed to get signature flag value") | ||||||
} | ||||||
return nil | ||||||
} | ||||||
|
@@ -499,10 +518,7 @@ func BindReshareFlags(cmd *cobra.Command) error { | |||||
if err := viper.BindPFlag("proofsFilePath", cmd.PersistentFlags().Lookup("proofsFilePath")); err != nil { | ||||||
return err | ||||||
} | ||||||
if err := viper.BindPFlag("ethKeystorePath", cmd.PersistentFlags().Lookup("ethKeystorePath")); err != nil { | ||||||
return err | ||||||
} | ||||||
if err := viper.BindPFlag("ethKeystorePass", cmd.PersistentFlags().Lookup("ethKeystorePass")); err != nil { | ||||||
if err := viper.BindPFlag("signatures", cmd.PersistentFlags().Lookup("signatures")); err != nil { | ||||||
return err | ||||||
} | ||||||
OperatorsInfoPath = viper.GetString("operatorsInfoPath") | ||||||
|
@@ -559,13 +575,9 @@ func BindReshareFlags(cmd *cobra.Command) error { | |||||
return fmt.Errorf("😥 clientCACertPath flag should not contain traversal") | ||||||
} | ||||||
} | ||||||
KeystorePath = viper.GetString("ethKeystorePath") | ||||||
if strings.Contains(KeystorePath, "../") { | ||||||
return fmt.Errorf("😥 ethKeystorePath should not contain traversal") | ||||||
} | ||||||
KeystorePass = viper.GetString("ethKeystorePass") | ||||||
if strings.Contains(KeystorePath, "../") { | ||||||
return fmt.Errorf("😥 ethKeystorePass should not contain traversal") | ||||||
Signatures = viper.GetString("signature") | ||||||
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.
Suggested change
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. updated in Bulk PR |
||||||
if Signatures == "" { | ||||||
return fmt.Errorf("😥 Failed to get signature flag value") | ||||||
MatusKysel marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
} | ||||||
return nil | ||||||
} | ||||||
|
@@ -678,8 +690,8 @@ func BindVerifyFlags(cmd *cobra.Command) error { | |||||
return nil | ||||||
} | ||||||
|
||||||
// StingSliceToUintArray converts the string slice to uint64 slice | ||||||
func StingSliceToUintArray(flagdata []string) ([]uint64, error) { | ||||||
// StringSliceToUintArray converts the string slice to uint64 slice | ||||||
func StringSliceToUintArray(flagdata []string) ([]uint64, error) { | ||||||
partsarr := make([]uint64, 0, len(flagdata)) | ||||||
for i := 0; i < len(flagdata); i++ { | ||||||
opid, err := strconv.ParseUint(flagdata[i], 10, strconv.IntSize) | ||||||
|
@@ -726,6 +738,14 @@ func LoadOperators(logger *zap.Logger) (wire.OperatorsCLI, error) { | |||||
return operators, nil | ||||||
} | ||||||
|
||||||
func SignaturesStringToBytes(signatures string) ([]byte, error) { | ||||||
sig, err := hex.DecodeString(signatures) | ||||||
if err != nil { | ||||||
return nil, fmt.Errorf("😥 Failed to parse signatures: %s", err) | ||||||
} | ||||||
return sig, nil | ||||||
} | ||||||
|
||||||
func WriteResults( | ||||||
logger *zap.Logger, | ||||||
depositDataArr []*wire.DepositDataCLI, | ||||||
|
@@ -937,6 +957,23 @@ func WriteProofs(proofs []*wire.SignedProof, dir string) error { | |||||
return nil | ||||||
} | ||||||
|
||||||
func WriteMessage(msg interface{}, outputPath string, msgType string) (err error) { | ||||||
switch msgType { | ||||||
case "resign": | ||||||
finalPath := fmt.Sprintf("%s/resign.json", outputPath) | ||||||
err = utils.WriteJSON(finalPath, msg) | ||||||
case "reshare": | ||||||
finalPath := fmt.Sprintf("%s/reshare.json", outputPath) | ||||||
err = utils.WriteJSON(finalPath, msg) | ||||||
default: | ||||||
return fmt.Errorf("unknown message type: %s", msgType) | ||||||
} | ||||||
if err != nil { | ||||||
return fmt.Errorf("failed writing data file: %w, %v", err, msg) | ||||||
} | ||||||
return nil | ||||||
} | ||||||
|
||||||
func createDirIfNotExist(path string) error { | ||||||
if _, err := os.Stat(path); err != nil { | ||||||
if os.IsNotExist(err) { | ||||||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In the issue I had the requirement:
But maybe you are doing this in bulk?
Anyhow, the current way is good enough for me and if @RaekwonIII wants to change this he can talk to @MatusKysel
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.
Indeed in this cli users pass the data for generating the reshare/resign messages instead of the messages themselves. Everything can be a string now including the
signedProofs
(updated in the bulk PR), so from the users perspective it would be pretty much the same. But of course we can update this if required.