-
Notifications
You must be signed in to change notification settings - Fork 1k
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
adding builder boost factor to get block v3 #13409
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5509187
adding builder boost factor to functions
james-prysm a510a79
gaz
james-prysm 66b1351
Merge branch 'develop' into builder-boost-factor
james-prysm 55aa6bb
fixing linting
james-prysm 130d9fd
fixing unit tests
james-prysm 299ab1e
gaz
james-prysm c4e4606
addressing review comments
james-prysm ef0218e
fixing tests
james-prysm b01ade2
Merge branch 'develop' into builder-boost-factor
james-prysm 35f2aff
Merge branch 'develop' into builder-boost-factor
james-prysm 7bbe222
addressing review feedback
james-prysm b542ca8
gaz
james-prysm 36609ea
Merge branch 'develop' into builder-boost-factor
james-prysm 2cfe4bb
changing log based on review
james-prysm 43f1b24
Merge branch 'develop' into builder-boost-factor
james-prysm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package shared | ||
|
||
import ( | ||
"math" | ||
"net/http/httptest" | ||
"testing" | ||
) | ||
|
||
func TestUintFromQuery_BuilderBoostFactor(t *testing.T) { | ||
type args struct { | ||
raw string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
wantRaw string | ||
wantValue uint64 | ||
wantOK bool | ||
}{ | ||
{ | ||
name: "builder boost factor of 0 returns 0", | ||
args: args{ | ||
raw: "0", | ||
}, | ||
wantRaw: "0", | ||
wantValue: 0, | ||
wantOK: true, | ||
}, | ||
{ | ||
name: "builder boost factor of the default, 100 returns 100", | ||
args: args{raw: "100"}, | ||
wantRaw: "100", | ||
wantValue: 100, | ||
wantOK: true, | ||
}, | ||
{ | ||
name: "builder boost factor max uint64 returns max uint64", | ||
args: args{raw: "18446744073709551615"}, | ||
wantRaw: "18446744073709551615", | ||
wantValue: math.MaxUint64, | ||
wantOK: true, | ||
}, | ||
{ | ||
name: "builder boost factor as a percentage returns error", | ||
args: args{raw: "0.30"}, | ||
wantRaw: "", | ||
wantValue: 0, | ||
wantOK: false, | ||
}, | ||
{ | ||
name: "builder boost factor negative int returns error", | ||
args: args{raw: "-100"}, | ||
wantRaw: "", | ||
wantValue: 0, | ||
wantOK: false, | ||
}, | ||
{ | ||
name: "builder boost factor max uint64 +1 returns error", | ||
args: args{raw: "18446744073709551616"}, | ||
wantRaw: "", | ||
wantValue: 0, | ||
wantOK: false, | ||
}, | ||
{ | ||
name: "builder boost factor of invalid string returns error", | ||
args: args{raw: "asdf"}, | ||
wantRaw: "", | ||
wantValue: 0, | ||
wantOK: false, | ||
}, | ||
{ | ||
name: "builder boost factor of number bigger than uint64 string returns error", | ||
args: args{raw: "9871398721983721908372190837219837129803721983719283798217390821739081273918273918273918273981273982139812739821"}, | ||
wantRaw: "", | ||
wantValue: 0, | ||
wantOK: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
query := "builder_boost_factor" | ||
bbreq := httptest.NewRequest("GET", "/eth/v3/validator/blocks/{slot}?builder_boost_factor="+tt.args.raw, nil) | ||
w := httptest.NewRecorder() | ||
got, got1, got2 := UintFromQuery(w, bbreq, query, false) | ||
if got != tt.wantRaw { | ||
t.Errorf("UintFromQuery() got = %v, wantRaw %v", got, tt.wantRaw) | ||
} | ||
if got1 != tt.wantValue { | ||
t.Errorf("UintFromQuery() got1 = %v, wantRaw %v", got1, tt.wantValue) | ||
} | ||
if got2 != tt.wantOK { | ||
t.Errorf("UintFromQuery() got2 = %v, wantRaw %v", got2, tt.wantOK) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I don't like this. The point of
builderBoostFactor
is that it replaces our current parameterlocal-block-value-boost
not to use both... I'm not sure what the right approach is here but at the very least we should log if there's a request and the local boost is set to non-zero and the boost factor to non defaultThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a log for now we'll see if others have an opinion