Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth2wrap: fix synthetic block proposals #2693

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/eth2wrap/synthproposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"crypto/sha256"
"encoding/binary"
"fmt"
"net/http"
"sync"

eth2client "github.com/attestantio/go-eth2-client"
Expand Down Expand Up @@ -141,16 +142,20 @@
func (h *synthWrapper) syntheticProposal(ctx context.Context, slot eth2p0.Slot, vIdx eth2p0.ValidatorIndex) (*eth2api.VersionedProposal, error) {
var signedBlock *eth2spec.VersionedSignedBeaconBlock

// Work our way back from previous slot to find a proposal to base the synthetic proposal on.
// Work our way back from previous slot to find a block to base the synthetic proposal on.
for prev := slot - 1; prev > 0; prev-- {
opts := &eth2api.SignedBeaconBlockOpts{
Block: fmt.Sprint(prev),
}
signed, err := h.Client.SignedBeaconBlock(ctx, opts)
if err != nil {
if apiErr := new(eth2api.Error); errors.As(err, apiErr) { // Continue if block is not found in the given slot.
if apiErr.StatusCode == http.StatusNotFound {
continue

Check warning on line 154 in app/eth2wrap/synthproposer.go

View check run for this annotation

Codecov / codecov/patch

app/eth2wrap/synthproposer.go#L152-L154

Added lines #L152 - L154 were not covered by tests
}
}

return nil, err
} else if signed == nil { // go-eth2-client returns nil if proposal is not found.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true anymore, ie, go-eth2-client no longer returns nil, nil

continue
}

signedBlock = signed.Data
Expand Down
2 changes: 1 addition & 1 deletion testutil/compose/static/lighthouse/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ done
echo "Starting lighthouse validator client for ${NODE}"
exec lighthouse validator \
--testnet-dir "/tmp/testnet" \
--beacon-node "http://${NODE}:3600" \
--beacon-nodes "http://${NODE}:3600" \
--suggested-fee-recipient "0x0000000000000000000000000000000000000000"
Loading