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

EIP-6110: Supply validator deposits on chain #13944

Open
wants to merge 48 commits into
base: develop
Choose a base branch
from
Open

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented May 1, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

implements eip6110 as defined in https://eips.ethereum.org/EIPS/eip-6110

  • process deposits was refactored to be aligned with specs
  • packing deposits on validator client was updated
  • saveValidatorIndices was added on parts of the code where state is finalized
  • adds spec tests

Note:

Which issues(s) does this PR fix?

part of PSM-371

Other notes for review

related PR: #13943

if uint64(len(body.Deposits())) != maxDeposits {
return nil, fmt.Errorf("incorrect outstanding deposits in block body, wanted: %d, got: %d",
maxDeposits, len(body.Deposits()))
if len(body.Deposits()) != 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

double check as this is changing existing logic or if I need to handle it in a fork specific way

@james-prysm
Copy link
Contributor Author

don't forget about this,

For the read usage side, nothing needs to be done. For the write usage side, we need to call SaveValidatorIndices() when a new finalized state is emitted and when the node starts up. This part is TBD

Amount: receipt.Amount,
WithdrawalCredentials: bytesutil.SafeCopyBytes(receipt.WithdrawalCredentials),
Signature: bytesutil.SafeCopyBytes(receipt.Signature),
}, true) // individually verify signatures instead of batch verify
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should I be batch verifying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

might need to change blocks.BatchVerifyDepositsSignatures or process depositsReceipt to handle batch verification...

if err != nil {
return nil, errors.Wrap(err, "could not retrieve receipts start index")
}
eth1DepositIndexLimit := math.Min(canonicalEth1Data.DepositCount, receiptsStartIndex)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

make sure this is safe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added unit test

@james-prysm
Copy link
Contributor Author

james-prysm commented May 13, 2024

need to add some spec tests to this
missing tests/minimal/electra/transition/core
missing tests/mainnet/electra/transition/core
missing tests/minimal/electra/epoch_processing/effective_balance_updates
missing tests/minimal/electra/epoch_processing/pending_balance_deposits
missing tests/minimal/electra/operations/deposit_receipt
missing tests/minimal/electra/operations/deposit
missing tests/mainnet/electra/epoch_processing/effective_balance_updates
missing tests/mainnet/electra/epoch_processing/pending_balance_deposits
missing tests/mainnet/electra/operations/deposit_receipt
missing tests/mainnet/electra/operations/deposit

@james-prysm james-prysm added the Electra electra hardfork label May 15, 2024
@james-prysm james-prysm marked this pull request as ready for review May 15, 2024 07:10
@james-prysm james-prysm requested a review from a team as a code owner May 15, 2024 07:10
@james-prysm
Copy link
Contributor Author

reverting changes for beacon-chain/core/transition/transition_no_verify_sig.go

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Partial review, will review more later

Comment on lines +146 to +148
pbd, err := preState.PendingBalanceDeposits()
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

A genesis state would not have pending balance deposits. Why do you need this change?

Comment on lines 255 to 264
case version.Phase0:
if beaconBlock.Version() == version.Phase0 {
state, err = phase0Operations(ctx, state, beaconBlock)
if err != nil {
return nil, err
}
case version.Altair, version.Bellatrix, version.Capella, version.Deneb, version.Electra:
} else {
state, err = altairOperations(ctx, state, beaconBlock)
if err != nil {
return nil, err
}
default:
return nil, errors.New("block does not have correct version")
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this will change in an upcoming PR when we add electraOperations.

// if has_eth1_withdrawal_credential(validator):
// validator.withdrawal_credentials = COMPOUNDING_WITHDRAWAL_PREFIX + validator.withdrawal_credentials[1:]
// queue_excess_active_balance(state, index)
func SwitchToCompoundingValidator(s state.BeaconState, idx primitives.ValidatorIndex) error {
Copy link
Member

Choose a reason for hiding this comment

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

This already exists in develop. Please delete this and use github.com/prysmaticlabs/prysm/v5/beacon-chain/core/electra.SwitchToCompoundingValidator

@james-prysm james-prysm added the Blocked Blocked by research or external factors label May 15, 2024
@james-prysm
Copy link
Contributor Author

james-prysm commented May 15, 2024

design changing as part of ethereum/consensus-specs#3689, waiting for action items from @m.kalinin

awaiting new tasks that come out of PR 3689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Blocked by research or external factors Electra electra hardfork
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants