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

Introduce option to use local payload instead of builder #6878

Merged
merged 11 commits into from
Mar 2, 2023

Conversation

zilm13
Copy link
Contributor

@zilm13 zilm13 commented Feb 28, 2023

PR Description

Introduces option to use local payload instead of builder if local matches X% of builder's value. X is configured:

  • I have some doubts I did it in appropriate options class
  • I'm not sure I should unhide it right from the beginning, plus if I do it, I will need to add docs and changelog entry
  • I don't like I couldn't pass default value to tests

Fixed Issue(s)

Fixes #6327

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@zilm13 zilm13 marked this pull request as draft March 1, 2023 14:13
@zilm13
Copy link
Contributor Author

zilm13 commented Mar 1, 2023

I decided to add feature to use builder's bid whenever is possible not comparing with local value to the same flag with keyword "NEVER". If it totally doesn't work for us, I made it with a single commit, so it could be easily reverted

@zilm13 zilm13 marked this pull request as ready for review March 1, 2023 15:18
paramLabel = "<STRING>",
showDefaultValue = Visibility.ALWAYS,
description =
"Fallback to local payload, when builder bid is available but its value could be beat by local payload. "
Copy link
Contributor

@tbenr tbenr Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can simply say "Fallback to local payload whenever its value beats the builder bid."

"Fallback to local payload, when builder bid is available but its value could be beat by local payload. "
+ "Value is whole, percent (e.g. 100, default value, means use local payload when it at least matches builder bid, "
+ "80 means use local payload when its value is at least 80% of builder bid).\n"
+ "NEVER: ignore local value, use builder's bid whenever it passed validation",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"passes"?

return getResultFromLocalExecutionPayload(
localExecutionPayload, slot, FallbackReason.LOCAL_BLOCK_VALUE_HIGHER);
localExecutionPayload, slot, FallbackReason.LOCAL_BLOCK_VALUE_WIN);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about LOCAL_BLOCK_VALUE_WON ? similarly to CIRCUIT_BREAKER_ENGAGED

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was the first name. don't know why I reverted it

Copy link
Contributor

@tbenr tbenr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some nits. And maybe an english native guy can review user-facing strings 😉

@@ -164,9 +168,21 @@ 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 (builderBidChallengePercentage.isPresent()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about moving this in a isLocalPayloadValueWinning function?

@zilm13
Copy link
Contributor Author

zilm13 commented Mar 1, 2023

@tbenr updated up to your feedback. Let's keep it till native speaker for final proof-reading

@zilm13
Copy link
Contributor Author

zilm13 commented Mar 1, 2023

I've remembered what was wrong when we posted about this feature last time. It will be enabled only since Capella, so we'd better keep it hidden to avoid misleading. Docs etc should be added with Capella release I think. What do you think? (but we may have a lot of debts for this release)

@tbenr
Copy link
Contributor

tbenr commented Mar 1, 2023

I've remembered what was wrong when we posted about this feature last time. It will be enabled only since Capella, so we'd better keep it hidden to avoid misleading. Docs etc should be added with Capella release I think. What do you think? (but we may have a lot of debts for this release)

OH yes. very good catch. I was about to fall under the same issue. Even if when we start using the new engine api system that Loucas is working on, we will detach from the Capella fork.

@@ -50,6 +50,7 @@
public class ExecutionBuilderModule {

private static final Logger LOG = LogManager.getLogger();
private static final int HUNDRED_PERCENTS = 100;
Copy link
Contributor

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 the s is confusing :)

Copy link
Contributor Author

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?

Comment on lines 174 to 175
"Using local Execution Payload instead of Builder Bid as it's challenged. "
+ "Builder bid value: {}, local block value: {}, builderBidChallengePercentage: {}%",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The local execution payload value ({}) was awarded the block over the builder payload ({}), {}% challenge configured.

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some tiny NIT's, but looks good :)

@zilm13 zilm13 merged commit 13feda8 into Consensys:master Mar 2, 2023
@zilm13 zilm13 deleted the feature/payload-value-cutoff branch March 2, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support block value in engineGetPayload
3 participants