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

Switch to compounding when consolidating with source==target #8646

Merged
merged 11 commits into from
Oct 7, 2024

Conversation

lucassaldanha
Copy link
Member

@lucassaldanha lucassaldanha commented Sep 26, 2024

PR Description

Fixed Issue(s)

fixes #8617

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.

@@ -379,6 +379,23 @@ private void processConsolidationRequest(
final UInt64 slot = state.getSlot();
final UInt64 currentEpoch = miscHelpers.computeEpochAtSlot(slot);

if (isValidSwitchToCompoundingRequest(state, consolidationRequest)) {
LOG.debug("process_consolidation_request: valid switching validator to compounding address");
Copy link
Contributor

Choose a reason for hiding this comment

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

this would probably be more valuable with context, so that we can see the validator id or abbreviated key?


// Verify that source != target, so a consolidation cannot be used as an exit
if (consolidationRequest.getSourcePubkey().equals(consolidationRequest.getTargetPubkey())) {
LOG.debug("process_consolidation_request: source_pubkey and target_pubkey must be different");
Copy link
Contributor

Choose a reason for hiding this comment

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

probably would add the abbreviated pubkey here too...

@lucassaldanha
Copy link
Member Author

Need to wait for #8618 to rebase.

@lucassaldanha lucassaldanha marked this pull request as ready for review October 7, 2024 20:58
@lucassaldanha lucassaldanha enabled auto-merge (squash) October 7, 2024 21:02
Comment on lines +187 to 197
final byte[] withdrawalCredentialsUpdated =
state.getValidators().get(index).getWithdrawalCredentials().toArray();
withdrawalCredentialsUpdated[0] = COMPOUNDING_WITHDRAWAL_BYTE;
state
.getValidators()
.update(
index,
validator ->
validator.withWithdrawalCredentials(Bytes32.wrap(withdrawalCredentialsUpdated)));
queueExcessActiveBalance(state, index);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: probably not super important but this is super unsafe if the index doesn't exist, i wonder if we should put a comment in the description
PRE: validator must exist
It's checked up in the process, but this is also public, and we probably want to be super careful where we attempt this...

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.

LGTM overall

@lucassaldanha lucassaldanha merged commit 8a9fa11 into Consensys:master Oct 7, 2024
17 checks passed
@lucassaldanha lucassaldanha deleted the teku-8617 branch October 7, 2024 21:51
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.

[EIP-7251] Switch to compounding when consolidating with source==target
2 participants