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 Aug 1, 2022
1 parent 81304d2 commit 861d8f6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 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
}
2 changes: 1 addition & 1 deletion miner/stress/beacon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (n *ethNode) assembleBlock(parentHash common.Hash, parentTimestamp uint64)
return nil, nil, err
}
data, err := n.api.GetPayloadV1(*payload.PayloadID)
return data, nil, nil
return data, nil, err
}

func (n *ethNode) insertBlock(eb beacon.ExecutableDataV1) error {
Expand Down

0 comments on commit 861d8f6

Please sign in to comment.