Skip to content

Commit

Permalink
Fix lint issues (ethereum#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruteri authored and avalonche committed Mar 8, 2023
1 parent 4ff39e1 commit e09567d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions builder/beacon_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ func TestOnForkchoiceUpdate(t *testing.T) {
require.NoError(t, err)
require.Equal(t, PubkeyHex("0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74b"), pubkeyHex)

pubkeyHex, err = bc.getProposerForNextSlot(31)
_, err = bc.getProposerForNextSlot(31)
require.EqualError(t, err, "slot out of sync")

pubkeyHex, err = bc.getProposerForNextSlot(33)
_, err = bc.getProposerForNextSlot(33)
require.EqualError(t, err, "slot out of sync")

mbn.headersCode = 404
Expand Down Expand Up @@ -263,6 +263,6 @@ func TestOnForkchoiceUpdate(t *testing.T) {

// Check proposers map error is routed out
mbn.headersResp = []byte(`{ "data": [ { "header": { "message": { "slot": "65", "proposer_index": "1" } } } ] }`)
slot, err = bc.onForkchoiceUpdate()
_, err = bc.onForkchoiceUpdate()
require.EqualError(t, err, "inconsistent proposer mapping")
}
9 changes: 9 additions & 0 deletions builder/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package builder

import (
"errors"
"fmt"
"net/http"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -97,12 +98,20 @@ func Register(stack *node.Node, backend *eth.Ethereum, cfg *BuilderConfig) error
}

genesisForkVersionBytes, err := hexutil.Decode(cfg.GenesisForkVersion)
if err != nil {
return fmt.Errorf("invalid genesisForkVersion: %w", err)
}

var genesisForkVersion [4]byte
copy(genesisForkVersion[:], genesisForkVersionBytes[:4])
builderSigningDomain := boostTypes.ComputeDomain(boostTypes.DomainTypeAppBuilder, genesisForkVersion, boostTypes.Root{})

genesisValidatorsRoot := boostTypes.Root(common.HexToHash(cfg.GenesisValidatorsRoot))
bellatrixForkVersionBytes, err := hexutil.Decode(cfg.BellatrixForkVersion)
if err != nil {
return fmt.Errorf("invalid bellatrixForkVersion: %w", err)
}

var bellatrixForkVersion [4]byte
copy(bellatrixForkVersion[:], bellatrixForkVersionBytes[:4])
proposerSigningDomain := boostTypes.ComputeDomain(boostTypes.DomainTypeBeaconProposer, bellatrixForkVersion, genesisValidatorsRoot)
Expand Down
2 changes: 1 addition & 1 deletion builder/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ func (v *ValidatorPrivateData) PrepareRegistrationMessage(feeRecipientHex string
if err != nil {
return boostTypes.SignedValidatorRegistration{}, err
}
return boostTypes.SignedValidatorRegistration{msg, signature}, nil
return boostTypes.SignedValidatorRegistration{Message: msg, Signature: signature}, nil
}

0 comments on commit e09567d

Please sign in to comment.