Skip to content

Commit

Permalink
Merge branch 'develop' into proposer-compare-wd-roots
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain authored Feb 14, 2023
2 parents aa53f6b + 2d03c23 commit 1a9894d
Show file tree
Hide file tree
Showing 28 changed files with 1,834 additions and 291 deletions.
5 changes: 3 additions & 2 deletions beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
sBlk.SetDeposits([]*ethpb.Deposit{})
sBlk.SetAttestations([]*ethpb.Attestation{})
log.WithError(err).Error("Could not pack deposits and attestations")
} else {
sBlk.SetDeposits(deposits)
sBlk.SetAttestations(atts)
}
sBlk.SetDeposits(deposits)
sBlk.SetAttestations(atts)

// Set proposer index.
idx, err := helpers.BeaconProposerIndex(ctx, head)
Expand Down
6 changes: 6 additions & 0 deletions beacon-chain/sync/initial-sync/blocks_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ func timeToWait(wanted, rem, capacity int64, timeTillEmpty time.Duration) time.D
if rem >= wanted {
return 0
}
// Handle edge case where capacity is equal to the remaining amount
// of blocks. This also handles the impossible case in where remaining blocks
// exceed the limiter's capacity.
if capacity <= rem {
return 0
}
blocksNeeded := wanted - rem
currentNumBlks := capacity - rem
expectedTime := int64(timeTillEmpty) * blocksNeeded / currentNumBlks
Expand Down
8 changes: 8 additions & 0 deletions beacon-chain/sync/initial-sync/blocks_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,14 @@ func TestTimeToWait(t *testing.T) {
timeTillEmpty: 200 * time.Second,
want: 0 * time.Second,
},
{
name: "Limiter has full capacity remaining",
wanted: 350,
rem: 320,
capacity: 320,
timeTillEmpty: 0 * time.Second,
want: 0 * time.Second,
},
{
name: "Limiter has reached full capacity",
wanted: 64,
Expand Down
1 change: 1 addition & 0 deletions config/params/testnet_e2e_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func E2EMainnetTestConfig() *BeaconChainConfig {
e2eConfig.MinGenesisActiveValidatorCount = 256
e2eConfig.GenesisDelay = 25 // 25 seconds so E2E has enough time to process deposits and get started.
e2eConfig.ChurnLimitQuotient = 65536
e2eConfig.MaxValidatorsPerWithdrawalsSweep = 128

// Time parameters.
e2eConfig.SecondsPerSlot = 6
Expand Down
1 change: 0 additions & 1 deletion config/validator/service/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
],
)
17 changes: 6 additions & 11 deletions config/validator/service/proposer-settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/ethereum/go-ethereum/common"
fieldparams "github.com/prysmaticlabs/prysm/v3/config/fieldparams"
"github.com/prysmaticlabs/prysm/v3/config/params"
)

// ProposerSettingsPayload is the struct representation of the JSON or YAML payload set in the validator through the CLI.
Expand Down Expand Up @@ -69,16 +68,12 @@ type ProposerSettings struct {
DefaultConfig *ProposerOption
}

// ProposerOption is a Prysm internal representation of the ProposerOptionPayload on the validator client in bytes format instead of hex.
type ProposerOption struct {
FeeRecipient common.Address
BuilderConfig *BuilderConfig
type FeeRecipientConfig struct {
FeeRecipient common.Address
}

// DefaultProposerOption returns a Proposer Option with defaults filled
func DefaultProposerOption() ProposerOption {
return ProposerOption{
FeeRecipient: params.BeaconConfig().DefaultFeeRecipient,
BuilderConfig: nil,
}
// ProposerOption is a Prysm internal representation of the ProposerOptionPayload on the validator client in bytes format instead of hex.
type ProposerOption struct {
FeeRecipientConfig *FeeRecipientConfig
BuilderConfig *BuilderConfig
}
12 changes: 12 additions & 0 deletions crypto/bls/common/mock/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@prysm//tools/go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = ["interface_mock.go"],
importpath = "github.com/prysmaticlabs/prysm/v3/crypto/bls/common/mock",
visibility = ["//visibility:public"],
deps = [
"//crypto/bls/common:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
],
)
277 changes: 277 additions & 0 deletions crypto/bls/common/mock/interface_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions hack/update-mockgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,20 @@ done

goimports -w "$beacon_api_mock_path/."
gofmt -s -w "$beacon_api_mock_path/."

# github.com/prysmaticlabs/prysm/v3/crypto/bls
# --------------------------------------------
crypto_bls_common_mock_path="crypto/bls/common/mock"
crypto_bls_common_mocks=(
"$crypto_bls_common_mock_path/interface_mock.go interface.go"
)

for ((i = 0; i < ${#crypto_bls_common_mocks[@]}; i++)); do
file=${crypto_bls_common_mocks[i]% *};
source=${crypto_bls_common_mocks[i]#* };
echo "generating $file for file: $source";
GO11MODULE=on mockgen -package=mock -source="crypto/bls/common/$source" -destination="$file"
done

goimports -w "$crypto_bls_common_mock_path/."
gofmt -s -w "$crypto_bls_common_mock_path/."
Loading

0 comments on commit 1a9894d

Please sign in to comment.