From b37c377aef7ccd42c73c0fe317687a770b5c3746 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+shaspitz@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:42:49 -0700 Subject: [PATCH] fix: generate blspubkeys for providers --- p2p/integrationtest/provider/client.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/p2p/integrationtest/provider/client.go b/p2p/integrationtest/provider/client.go index 2069b0154..5ba20c8a8 100644 --- a/p2p/integrationtest/provider/client.go +++ b/p2p/integrationtest/provider/client.go @@ -2,12 +2,15 @@ package main import ( "context" + "crypto/rand" "crypto/tls" + "encoding/hex" "errors" "log/slog" "math/big" "time" + bls "github.com/ethereum/go-ethereum/crypto/bls12381" providerapiv1 "github.com/primev/mev-commit/p2p/gen/go/providerapi/v1" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -109,8 +112,15 @@ func (b *ProviderClient) CheckAndStake() error { return nil } + g1 := bls.NewG1() + privKey, _ := rand.Int(rand.Reader, g1.Q()) + blsPubkey := g1.One() + g1.MulScalar(blsPubkey, blsPubkey, privKey) + blsPubkeyBytes := g1.ToBytes(blsPubkey) + _, err = b.client.RegisterStake(context.Background(), &providerapiv1.StakeRequest{ - Amount: "10000000000000000000", + Amount: "10000000000000000000", + BlsPublicKey: hex.EncodeToString(blsPubkeyBytes), }) if err != nil { b.logger.Error("failed to register stake", "err", err)