diff --git a/chainio/avsregistry/reader.go b/chainio/avsregistry/reader.go index 413a1a7b..36880558 100644 --- a/chainio/avsregistry/reader.go +++ b/chainio/avsregistry/reader.go @@ -96,7 +96,13 @@ func (r *AvsRegistryChainReader) GetOperatorsStakeInQuorumsOfOperatorAtBlock( operatorId, blockNumber) if err != nil { - r.logger.Error("Failed to get operators state", "err", err, "fn", "AvsRegistryChainReader.GetOperatorsStakeInQuorumsOfOperatorAtBlock") + r.logger.Error( + "Failed to get operators state", + "err", + err, + "fn", + "AvsRegistryChainReader.GetOperatorsStakeInQuorumsOfOperatorAtBlock", + ) return nil, nil, err } @@ -133,7 +139,11 @@ func (r *AvsRegistryChainReader) GetOperatorStakeInQuorumsOfOperatorAtCurrentBlo } quorumStakes := make(map[types.QuorumNum]types.StakeAmount) for _, quorum := range quorums { - stake, err := r.avsRegistryContractsClient.GetCurrentOperatorStakeForQuorum(&bind.CallOpts{}, operatorId, quorum) + stake, err := r.avsRegistryContractsClient.GetCurrentOperatorStakeForQuorum( + &bind.CallOpts{}, + operatorId, + quorum, + ) if err != nil { r.logger.Error("Failed to get operator stake", "err", err) return nil, err diff --git a/chainio/elcontracts/writer.go b/chainio/elcontracts/writer.go index 1c877287..9e376cd7 100644 --- a/chainio/elcontracts/writer.go +++ b/chainio/elcontracts/writer.go @@ -183,7 +183,11 @@ func (w *ELChainWriter) RegisterBLSPublicKey( if err != nil { return nil, err } - signedMsgHash := blsKeyPair.MakePubkeyRegistrationData(gethcommon.HexToAddress(operator.Address), w.elContractsClient.GetBLSPublicKeyCompendiumContractAddress(), chainID) + signedMsgHash := blsKeyPair.MakePubkeyRegistrationData( + gethcommon.HexToAddress(operator.Address), + w.elContractsClient.GetBLSPublicKeyCompendiumContractAddress(), + chainID, + ) signedMsgHashBN254 := blspubkeycompendium.BN254G1Point(utils.ConvertToBN254G1Point(signedMsgHash)) G1pubkeyBN254 := blspubkeycompendium.BN254G1Point(utils.ConvertToBN254G1Point(blsKeyPair.GetPubKeyG1())) G2pubkeyBN254 := blspubkeycompendium.BN254G2Point(utils.ConvertToBN254G2Point(blsKeyPair.GetPubKeyG2())) diff --git a/crypto/bls/attestation.go b/crypto/bls/attestation.go index 22ef3ca5..ecd93899 100644 --- a/crypto/bls/attestation.go +++ b/crypto/bls/attestation.go @@ -273,6 +273,12 @@ func (k *KeyPair) GetPubKeyG1() *G1Point { // public key, and prevents the operator // from attacking the signature protocol by registering a public key that is derived from other public keys. // (e.g., see https://medium.com/@coolcottontail/rogue-key-attack-in-bls-signature-and-harmony-security-eac1ea2370ee) -func (k *KeyPair) MakePubkeyRegistrationData(operatorAddress common.Address, blsPubkeyCompendiumAddress common.Address, chainId *big.Int) *G1Point { - return &G1Point{bn254utils.MakePubkeyRegistrationData(k.PrivKey, operatorAddress, blsPubkeyCompendiumAddress, chainId)} +func (k *KeyPair) MakePubkeyRegistrationData( + operatorAddress common.Address, + blsPubkeyCompendiumAddress common.Address, + chainId *big.Int, +) *G1Point { + return &G1Point{ + bn254utils.MakePubkeyRegistrationData(k.PrivKey, operatorAddress, blsPubkeyCompendiumAddress, chainId), + } } diff --git a/crypto/bn254/utils.go b/crypto/bn254/utils.go index 779ec0ec..fe762a63 100644 --- a/crypto/bn254/utils.go +++ b/crypto/bn254/utils.go @@ -146,7 +146,12 @@ func DeserializeG2(b []byte) *bn254.G2Affine { return p } -func MakePubkeyRegistrationData(privKey *fr.Element, operatorAddress common.Address, blsPubkeyCompendiumAddress common.Address, chainId *big.Int) *bn254.G1Affine { +func MakePubkeyRegistrationData( + privKey *fr.Element, + operatorAddress common.Address, + blsPubkeyCompendiumAddress common.Address, + chainId *big.Int, +) *bn254.G1Affine { toHash := make([]byte, 0) toHash = append(toHash, operatorAddress.Bytes()...) // we also sign on the bls pubkey compendium contract's address, to prevent replay attacks diff --git a/utils/utils.go b/utils/utils.go index 198789a8..e14247d7 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -25,7 +25,7 @@ func ReadFile(path string) ([]byte, error) { func ReadYamlConfig(path string, o interface{}) error { if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) { - log.Fatal("Path", path, "does not exist") + log.Fatal("Path ", path, " does not exist") } b, err := ReadFile(path) if err != nil {