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

Fix validator can specify gas limit #14723

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- Fix segmentation fault in E2E when light-client feature flag is enabled. [PR](https://github.com/prysmaticlabs/prysm/pull/14699)
- Fix `searchForPeers` infinite loop in small networks.
- Fix slashing pool behavior to enforce MaxAttesterSlashings limit in Electra version.
- Fix validator gas limit usage through flag and file.

### Security

Expand Down
1 change: 1 addition & 0 deletions config/proposer/loader/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ go_test(
"//config/proposer:go_default_library",
"//consensus-types/validator:go_default_library",
"//encoding/bytesutil:go_default_library",
"//proto/prysm/v1alpha1/validator-client:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
"//validator/db/iface:go_default_library",
Expand Down
3 changes: 3 additions & 0 deletions config/proposer/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v
// process any overrides for proposer config
for _, option := range newSettings.ProposerConfig {
if option != nil {
if loadedSettings != nil && option.Builder != nil {
gasLimitOnly = &option.Builder.GasLimit
}
option.Builder = processBuilderConfig(option.Builder, builderConfig, gasLimitOnly)
}
}
Expand Down
27 changes: 26 additions & 1 deletion config/proposer/loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/prysmaticlabs/prysm/v5/config/proposer"
"github.com/prysmaticlabs/prysm/v5/consensus-types/validator"
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
validatorpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/v5/testing/assert"
"github.com/prysmaticlabs/prysm/v5/testing/require"
"github.com/prysmaticlabs/prysm/v5/validator/db/iface"
Expand Down Expand Up @@ -499,7 +500,7 @@ func TestProposerSettingsLoader(t *testing.T) {
},
BuilderConfig: &proposer.BuilderConfig{
Enabled: true,
GasLimit: 50000000,
GasLimit: 40000000,
},
},
},
Expand Down Expand Up @@ -1003,3 +1004,27 @@ func Test_ProposerSettingsLoaderWithOnlyBuilder_DoesNotSaveInDB(t *testing.T) {
})
}
}

func Test_settingsLoader_processProposerSettings(t *testing.T) {
limit := validator.Uint64(30_000_000)
psl := &settingsLoader{
options: &flagOptions{
gasLimit: &limit,
},
}
loaded := &validatorpb.ProposerSettingsPayload{
ProposerConfig: map[string]*validatorpb.ProposerOptionPayload{
"bob": {
Builder: &validatorpb.BuilderConfig{
GasLimit: 40_000_000,
},
},
},
}
var db *validatorpb.ProposerSettingsPayload
got := psl.processProposerSettings(loaded, db)
require.NotNil(t, got)
for _, payload := range got.ProposerConfig {
require.Equal(t, validator.Uint64(40_000_000), payload.Builder.GasLimit)
}
}
Loading