diff --git a/builder/backend.go b/builder/backend.go index 917222d197..09c145c08d 100644 --- a/builder/backend.go +++ b/builder/backend.go @@ -41,6 +41,7 @@ type Backend struct { builderSecretKey *bls.SecretKey builderPublicKey boostTypes.PublicKey serializedBuilderPoolPubkey hexutil.Bytes + fd ForkData builderSigningDomain boostTypes.Domain proposerSigningDomain boostTypes.Domain enableBeaconChecks bool @@ -56,7 +57,13 @@ type Backend struct { indexTemplate *template.Template } -func NewBackend(sk *bls.SecretKey, bc IBeaconClient, builderSigningDomain boostTypes.Domain, proposerSigningDomain boostTypes.Domain, enableBeaconChecks bool) *Backend { +type ForkData struct { + GenesisForkVersion string + BellatrixForkVersion string + GenesisValidatorsRoot string +} + +func NewBackend(sk *bls.SecretKey, bc IBeaconClient, fd ForkData, builderSigningDomain boostTypes.Domain, proposerSigningDomain boostTypes.Domain, enableBeaconChecks bool) *Backend { pkBytes := bls.PublicKeyFromSecretKey(sk).Compress() pk := boostTypes.PublicKey{} pk.FromSlice(pkBytes) @@ -77,6 +84,7 @@ func NewBackend(sk *bls.SecretKey, bc IBeaconClient, builderSigningDomain boostT builderPublicKey: pk, serializedBuilderPoolPubkey: pkBytes, + fd: fd, builderSigningDomain: builderSigningDomain, proposerSigningDomain: proposerSigningDomain, enableBeaconChecks: enableBeaconChecks, @@ -107,10 +115,16 @@ func (b *Backend) handleIndex(w http.ResponseWriter, req *http.Request) { } statusData := struct { - NoValidators int - Header string - Blocks string - }{noValidators, string(headerData), string(payloadData)} + Pubkey string + NoValidators int + GenesisForkVersion string + BellatrixForkVersion string + GenesisValidatorsRoot string + BuilderSigningDomain string + ProposerSigningDomain string + Header string + Blocks string + }{hexutil.Encode(b.serializedBuilderPoolPubkey), noValidators, b.fd.GenesisForkVersion, b.fd.BellatrixForkVersion, b.fd.GenesisValidatorsRoot, hexutil.Encode(b.builderSigningDomain[:]), hexutil.Encode(b.proposerSigningDomain[:]), string(headerData), string(payloadData)} if err := b.indexTemplate.Execute(w, statusData); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/builder/backend_test.go b/builder/backend_test.go index cd6a508000..9880f5cb8e 100644 --- a/builder/backend_test.go +++ b/builder/backend_test.go @@ -26,7 +26,7 @@ func newTestBackend(t *testing.T) (*Backend, *ValidatorPrivateData) { bDomain := boostTypes.ComputeDomain(boostTypes.DomainTypeAppBuilder, [4]byte{0x02, 0x0, 0x0, 0x0}, boostTypes.Hash{}) genesisValidatorsRoot := boostTypes.Hash(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000")) cDomain := boostTypes.ComputeDomain(boostTypes.DomainTypeBeaconProposer, [4]byte{0x02, 0x0, 0x0, 0x0}, genesisValidatorsRoot) - backend := NewBackend(sk, &testBeaconClient{validator}, bDomain, cDomain, true) + backend := NewBackend(sk, &testBeaconClient{validator}, ForkData{}, bDomain, cDomain, true) // service := NewService("127.0.0.1:31545", backend) return backend, validator @@ -231,3 +231,8 @@ func TestGetPayload(t *testing.T) { require.NoError(t, err) require.Equal(t, bid.Data.Message.Header.BlockHash, getPayloadResponse.Data.BlockHash) } + +func TestXxx(t *testing.T) { + sk, _ := bls.GenerateRandomSecretKey() + fmt.Println(hexutil.Encode(sk.Serialize())) +} diff --git a/builder/index.go b/builder/index.go index 6e1e02e4db..c65d248353 100644 --- a/builder/index.go +++ b/builder/index.go @@ -46,6 +46,22 @@ func parseIndexTemplate() (*template.Template, error) {
+
+