-
Notifications
You must be signed in to change notification settings - Fork 266
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
Introduce option to use local payload instead of builder #6878
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4f4092a
Introduce option to use local payload instead of builder if first is …
zilm13 9bd57ce
Merge branch 'master' into feature/payload-value-cutoff
zilm13 e50aa15
Add logging when we use local payload instead of builder bid
zilm13 f5b2e06
Add % sign
zilm13 851f5a5
Merge branch 'master' into feature/payload-value-cutoff
zilm13 5d49956
Add NEVER option to stay with Builder's bid when making block whateve…
zilm13 e248b16
Merge branch 'master' into feature/payload-value-cutoff
zilm13 68f918c
Minor winning value refactoring and descriptions cleaning
zilm13 966fe5d
Move feature to hidden
zilm13 9e775a4
Proof-reading cleanup
zilm13 fce617a
Merge branch 'master' into feature/payload-value-cutoff
zilm13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
public class ExecutionBuilderModule { | ||
|
||
private static final Logger LOG = LogManager.getLogger(); | ||
private static final int HUNDRED_PERCENTS = 100; | ||
|
||
private final Spec spec; | ||
private final AtomicBoolean latestBuilderAvailability; | ||
|
@@ -58,21 +59,24 @@ public class ExecutionBuilderModule { | |
private final BuilderCircuitBreaker builderCircuitBreaker; | ||
private final Optional<BuilderClient> builderClient; | ||
private final EventLogger eventLogger; | ||
private final int builderBidChallengePercentage; | ||
|
||
public ExecutionBuilderModule( | ||
final Spec spec, | ||
final ExecutionLayerManagerImpl executionLayerManager, | ||
final BuilderBidValidator builderBidValidator, | ||
final BuilderCircuitBreaker builderCircuitBreaker, | ||
final Optional<BuilderClient> builderClient, | ||
final EventLogger eventLogger) { | ||
final EventLogger eventLogger, | ||
final int builderBidChallengePercentage) { | ||
this.spec = spec; | ||
this.latestBuilderAvailability = new AtomicBoolean(builderClient.isPresent()); | ||
this.executionLayerManager = executionLayerManager; | ||
this.builderBidValidator = builderBidValidator; | ||
this.builderCircuitBreaker = builderCircuitBreaker; | ||
this.builderClient = builderClient; | ||
this.eventLogger = eventLogger; | ||
this.builderBidChallengePercentage = builderBidChallengePercentage; | ||
} | ||
|
||
private Optional<SafeFuture<HeaderWithFallbackData>> validateBuilderGetHeader( | ||
|
@@ -164,9 +168,20 @@ public SafeFuture<HeaderWithFallbackData> builderGetHeader( | |
.map(ExecutionPayloadWithValue::getValue) | ||
.orElse(UInt256.ZERO); | ||
logReceivedBuilderBid(signedBuilderBid.getMessage()); | ||
if (signedBuilderBid.getMessage().getValue().lessOrEqualThan(localPayloadValue)) { | ||
// 1 ETH is 10^18 wei, Uint256 max is more than 10^77 | ||
if (signedBuilderBid | ||
.getMessage() | ||
.getValue() | ||
.multiply(builderBidChallengePercentage) | ||
.lessOrEqualThan(localPayloadValue.multiply(HUNDRED_PERCENTS))) { | ||
LOG.info( | ||
"Using local Execution Payload instead of Builder Bid as it's challenged. " | ||
+ "Builder bid value: {}, local block value: {}, builderBidChallengePercentage: {}", | ||
signedBuilderBid.getMessage().getValue().toDecimalString(), | ||
localPayloadValue.toDecimalString(), | ||
builderBidChallengePercentage); | ||
return getResultFromLocalExecutionPayload( | ||
localExecutionPayload, slot, FallbackReason.LOCAL_BLOCK_VALUE_HIGHER); | ||
localExecutionPayload, slot, FallbackReason.LOCAL_BLOCK_VALUE_WIN); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was the first name. don't know why I reverted it |
||
} | ||
final Optional<ExecutionPayload> localPayload = | ||
maybeLocalExecutionPayload.map(ExecutionPayloadWithValue::getExecutionPayload); | ||
|
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
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.
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.
we shouldnt need to define 100%, but if we do, maybe just
HUNDRED_PERCENT
, as thes
is confusing :)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.
Oh, could you explain this, please, I know you are right, but I don't understand this. Is percent always plural?