Skip to content

Commit

Permalink
PR comments resolved #2
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelkrolevets committed Aug 21, 2024
1 parent a805153 commit 66aa776
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions pkgs/dkg/drand.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,10 @@ func (o *LocalOwner) PostDKG(res *kyber_dkg.OptionResult) error {
}
// Sign.
depositPartialSignature := secretKeyBLS.SignByte(signingRoot[:])
if depositPartialSignature == nil {
return fmt.Errorf("failed to sign deposit data with partial signature %w", err)
}
// Validate partial signature
if val := depositPartialSignature.VerifyByte(secretKeyBLS.GetPublicKey(), signingRoot[:]); !val {
err = fmt.Errorf("partial deposit root signature is not valid %x", depositPartialSignature.Serialize())
return err
}
// Sign SSV owner + nonce
data := []byte(fmt.Sprintf("%s:%d", eth_common.Address(o.data.init.Owner).String(), o.data.init.Nonce))
hash := eth_crypto.Keccak256([]byte(data))
sigOwnerNonce := secretKeyBLS.SignByte(hash)
// Verify partial SSV owner + nonce signature
val := sigOwnerNonce.VerifyByte(secretKeyBLS.GetPublicKey(), hash)
if !val {
return fmt.Errorf("partial owner + nonce signature isnt valid %x", sigOwnerNonce.Serialize())
}
// Generate and sign proof
proof := &spec.Proof{
ValidatorPubKey: validatorPubKey.Serialize(),
Expand Down Expand Up @@ -501,7 +488,6 @@ func (o *LocalOwner) Resign(reqID [24]byte, r *wire.ResignMessage) (*wire.Transp
return nil, err
}
// Resigning
// Sign root
network, err := spec_crypto.GetNetworkByFork(r.Resign.Fork)
if err != nil {
return nil, fmt.Errorf("failed to get network by fork: %w", err)
Expand All @@ -516,18 +502,10 @@ func (o *LocalOwner) Resign(reqID [24]byte, r *wire.ResignMessage) (*wire.Transp
}
// Sign.
depositPartialSignature := secretKeyBLS.SignByte(signingRoot[:])
if depositPartialSignature == nil {
return nil, fmt.Errorf("failed to sign deposit data with partial signature %w", err)
}
// Sign SSV owner + nonce
data := []byte(fmt.Sprintf("%s:%d", eth_common.Address(r.Resign.Owner).String(), r.Resign.Nonce))
hash := eth_crypto.Keccak256([]byte(data))
sigOwnerNonce := secretKeyBLS.SignByte(hash)
// Verify partial SSV owner + nonce signature
val := sigOwnerNonce.VerifyByte(secretKeyBLS.GetPublicKey(), hash)
if !val {
return nil, fmt.Errorf("partial owner + nonce signature isnt valid %x", sigOwnerNonce.Serialize())
}
// Generate and sign proof
proof := &spec.Proof{
ValidatorPubKey: r.Proofs[position].Proof.ValidatorPubKey,
Expand Down

0 comments on commit 66aa776

Please sign in to comment.