Skip to content

Commit

Permalink
Merge branch 'develop' into eip6110-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
james-prysm committed Sep 20, 2024
2 parents 9abebd7 + 98d8b50 commit 41f1406
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 71 deletions.
2 changes: 0 additions & 2 deletions .policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ approval_rules:
only_changed_files:
paths:
- "*pb.go"
- "*pb.gw.go"
- "*.bazel"
options:
ignore_commits_by:
Expand Down Expand Up @@ -69,7 +68,6 @@ approval_rules:
changed_files:
ignore:
- "*pb.go"
- "*pb.gw.go"
- "*.bazel"
options:
ignore_commits_by:
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- validator registration log changed to debug, and the frequency of validator registration calls are reduced
- Core: Fix process effective balance update to safe copy validator for Electra.
- `== nil` checks before calling `IsNil()` on interfaces to prevent panics.
- Core: Fixed slash processing causing extra hashing
- Core: Fixed extra allocations when processing slashings
- Core: Fixed slash processing causing extra hashing.
- Core: Fixed extra allocations when processing slashings.
- remove unneeded container in blob sidecar ssz response
- Testing: added custom matcher for better push settings testing.

### Security

Expand Down
4 changes: 2 additions & 2 deletions hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ This subproject contains useful bash scripts for working with our repository. We

## update-go-pbs.sh

This script generates the *.pb.go and *.pb.gw.go files from the *.proto files.
After running `update-go-pbs.sh` keep only the *.pb.go and *pb.gw.go for the protos that have changed before checking in.
This script generates the *.pb.go files from the *.proto files.
After running `update-go-pbs.sh` keep only the *.pb.go for the protos that have changed before checking in.
*Note*: the generated files may not have imports correctly linted and will need to be fixed to remote associated errors.
2 changes: 1 addition & 1 deletion hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cygwin*) system="windows" ;;
esac
readonly system

# Get locations of pb.go and pb.gw.go files.
# Get locations of pb.go files.
findutil="find"
# On OSX `find` is not GNU find compatible, so require "findutils" package.
if [ "$system" == "darwin" ]; then
Expand Down
2 changes: 1 addition & 1 deletion hack/update-go-pbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bazel query 'attr(testonly, 0, //proto/...)' | xargs bazel build $@
file_list=()
while IFS= read -d $'\0' -r file; do
file_list=("${file_list[@]}" "$file")
done < <($findutil -L "$(bazel info bazel-bin)"/proto -type f -regextype sed -regex ".*pb\.\(gw\.\)\?go$" -print0)
done < <($findutil -L "$(bazel info bazel-bin)"/proto -type f -regextype sed -regex ".*pb\.go$" -print0)

arraylength=${#file_list[@]}
searchstring="prysmaticlabs/prysm/v5/"
Expand Down
4 changes: 0 additions & 4 deletions proto/eth/v1/attestation.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v1/beacon_block.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v1/beacon_chain.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v1/events.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v1/node.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v1/validator.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/beacon_block.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/beacon_chain.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/beacon_lightclient.pb.gw.go

This file was deleted.

3 changes: 2 additions & 1 deletion proto/eth/v2/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package eth
import (
"bytes"
"fmt"
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
"math/bits"

enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"

v1 "github.com/prysmaticlabs/prysm/v5/proto/eth/v1"
)

Expand Down
4 changes: 0 additions & 4 deletions proto/eth/v2/ssz.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/sync_committee.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/validator.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/version.pb.gw.go

This file was deleted.

4 changes: 0 additions & 4 deletions proto/eth/v2/withdrawals.pb.gw.go

This file was deleted.

47 changes: 41 additions & 6 deletions validator/client/validator_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package client

import (
"bytes"
"context"
"errors"
"flag"
Expand Down Expand Up @@ -1456,6 +1457,40 @@ func TestValidator_WaitForKeymanagerInitialization_Interop(t *testing.T) {
}
}

type PrepareBeaconProposerRequestMatcher struct {
expectedRecipients []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer
}

func (m *PrepareBeaconProposerRequestMatcher) Matches(x interface{}) bool {
req, ok := x.(*ethpb.PrepareBeaconProposerRequest)
if !ok {
return false
}

if len(req.Recipients) != len(m.expectedRecipients) {
return false
}

// Build maps for efficient comparison
expectedMap := make(map[primitives.ValidatorIndex][]byte)
for _, recipient := range m.expectedRecipients {
expectedMap[recipient.ValidatorIndex] = recipient.FeeRecipient
}

// Compare the maps
for _, fc := range req.Recipients {
expectedFeeRecipient, exists := expectedMap[fc.ValidatorIndex]
if !exists || !bytes.Equal(expectedFeeRecipient, fc.FeeRecipient) {
return false
}
}
return true
}

func (m *PrepareBeaconProposerRequestMatcher) String() string {
return fmt.Sprintf("matches PrepareBeaconProposerRequest with Recipients: %v", m.expectedRecipients)
}

func TestValidator_PushSettings(t *testing.T) {
for _, isSlashingProtectionMinimal := range [...]bool{false, true} {
ctrl := gomock.NewController(t)
Expand Down Expand Up @@ -1525,8 +1560,8 @@ func TestValidator_PushSettings(t *testing.T) {
PublicKeys: [][]byte{keys[0][:], keys[1][:]},
Indices: []primitives.ValidatorIndex{1, 2},
}, nil)
client.EXPECT().PrepareBeaconProposer(gomock.Any(), &ethpb.PrepareBeaconProposerRequest{
Recipients: []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer{
client.EXPECT().PrepareBeaconProposer(gomock.Any(), &PrepareBeaconProposerRequestMatcher{
expectedRecipients: []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer{
{FeeRecipient: common.HexToAddress("0x055Fb65722E7b2455043BFEBf6177F1D2e9738D9").Bytes(), ValidatorIndex: 1},
{FeeRecipient: common.HexToAddress(defaultFeeHex).Bytes(), ValidatorIndex: 2},
},
Expand Down Expand Up @@ -1616,8 +1651,8 @@ func TestValidator_PushSettings(t *testing.T) {
PublicKeys: [][]byte{keys[0][:], keys[1][:]},
Indices: []primitives.ValidatorIndex{1, 2},
}, nil)
client.EXPECT().PrepareBeaconProposer(gomock.Any(), &ethpb.PrepareBeaconProposerRequest{
Recipients: []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer{
client.EXPECT().PrepareBeaconProposer(gomock.Any(), &PrepareBeaconProposerRequestMatcher{
expectedRecipients: []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer{
{FeeRecipient: common.HexToAddress("0x055Fb65722E7b2455043BFEBf6177F1D2e9738D9").Bytes(), ValidatorIndex: 1},
{FeeRecipient: common.HexToAddress(defaultFeeHex).Bytes(), ValidatorIndex: 2},
},
Expand Down Expand Up @@ -1702,8 +1737,8 @@ func TestValidator_PushSettings(t *testing.T) {
PublicKeys: [][]byte{keys[0][:], keys[1][:]},
Indices: []primitives.ValidatorIndex{1, 2},
}, nil)
client.EXPECT().PrepareBeaconProposer(gomock.Any(), &ethpb.PrepareBeaconProposerRequest{
Recipients: []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer{
client.EXPECT().PrepareBeaconProposer(gomock.Any(), &PrepareBeaconProposerRequestMatcher{
expectedRecipients: []*ethpb.PrepareBeaconProposerRequest_FeeRecipientContainer{
{FeeRecipient: common.HexToAddress("0x055Fb65722E7b2455043BFEBf6177F1D2e9738D9").Bytes(), ValidatorIndex: 1},
{FeeRecipient: common.HexToAddress(defaultFeeHex).Bytes(), ValidatorIndex: 2},
},
Expand Down

0 comments on commit 41f1406

Please sign in to comment.