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

Eip6110 queue deposit requests #14430

Merged
merged 64 commits into from
Oct 14, 2024
Merged

Eip6110 queue deposit requests #14430

merged 64 commits into from
Oct 14, 2024

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Sep 6, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

implements ethereum/consensus-specs#3818

  • updates spectests to v1.5.0-alpha.8

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have made an appropriate entry to CHANGELOG.md.
  • I have added a description to this PR with sufficient context for reviewers to understand this PR.

defer span.End()
index, ok := st.ValidatorIndexByPubkey(bytesutil.ToBytes48(deposit.PublicKey))
if !ok {
valid, err := blocks.IsValidDepositSignature(&ethpb.Deposit_Data{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if i should be doing any batch verification before hand ...

@@ -290,7 +290,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-BoXckDxXnDcEmAjg/dQgf/tLiJsb6CT0aZvmWHFijrY=",
integrity = "sha256-D/HPAW61lKqjoWwl7N0XvhdX+67dCEFAy8JxVzqBGtU=",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

can someone double check this one for me

@@ -115,13 +115,13 @@ func ProcessDeposit(beaconState state.BeaconState, deposit *ethpb.Deposit, verif
// # Increase balance by deposit amount
// index = ValidatorIndex(validator_pubkeys.index(pubkey))
// increase_balance(state, index, amount)
func ApplyDeposit(beaconState state.BeaconState, data *ethpb.Deposit_Data, verifySignature bool) (state.BeaconState, error) {
func ApplyDeposit(beaconState state.BeaconState, data *ethpb.Deposit_Data, verified bool) (state.BeaconState, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to change verifySignature to verified in the same PR? It seems to me it would be better to do it in another PR, and maybe open it beforehand to eliminate potential sources of errors and avoid doing too much in one PR. It's up to you.

if err := verifyDepositDataWithDomain(ctx, deposits, domain); err != nil {
log.WithError(err).Debug("Failed to batch verify deposits signatures, will try individual verify")
verified = true
Copy link
Member

Choose a reason for hiding this comment

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

I see why this was confusing before, and what you've done here is a welcome improvement. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#14526 now as part of this pr

@@ -159,3 +173,44 @@ func verifyDepositDataWithDomain(ctx context.Context, deps []*ethpb.Deposit, dom
}
return nil
}

func verifyPendingDepositDataWithDomain(ctx context.Context, deps []*ethpb.PendingDeposit, domain []byte) error {
Copy link
Member

Choose a reason for hiding this comment

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

In general, all of these may benefit from unit tests, but I’ll leave that decision to you:

  • verifyPendingDepositDataWithDomain
  • BatchVerifyPendingDepositsSignatures
  • batchProcessNewPendingDeposits

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 one for batch ProcessNewPendingDeposits, can add more

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 more tests

beacon-chain/core/electra/validator.go Outdated Show resolved Hide resolved
@@ -82,7 +82,7 @@ func ProcessDeposits(
// amount=deposit.data.amount,
// signature=deposit.data.signature,
// )
func ProcessDeposit(beaconState state.BeaconState, deposit *ethpb.Deposit, verifySignature bool) (state.BeaconState, error) {
func ProcessDeposit(beaconState state.BeaconState, deposit *ethpb.Deposit, verified bool) (state.BeaconState, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR but I don't see why we need to repeat ProcessDeposits -> ProcessDeposit, the majority of the difference comes from ApplyDeposit. Even then, I think ApplyDeposit could be reused across different forks by using conditional logic.

Copy link
Contributor Author

@james-prysm james-prysm Oct 10, 2024

Choose a reason for hiding this comment

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

it creates circular dependencies if i put it in the blocks package

beacon-chain/core/electra/deposits.go Outdated Show resolved Hide resolved
beacon-chain/core/electra/deposits.go Outdated Show resolved Hide resolved
beacon-chain/core/electra/deposits.go Outdated Show resolved Hide resolved
beacon-chain/core/electra/deposits.go Outdated Show resolved Hide resolved
beacon-chain/core/electra/deposits.go Outdated Show resolved Hide resolved
@@ -180,6 +180,7 @@ func TestModifiedE2E(t *testing.T) {

func TestLoadConfigFile(t *testing.T) {
t.Run("mainnet", func(t *testing.T) {
t.Skip("TODO: add back in after all spec test features are in.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if #14509 solves this one

@terencechain terencechain added this pull request to the merge queue Oct 14, 2024
Merged via the queue into develop with commit 8a0545c Oct 14, 2024
17 of 18 checks passed
@terencechain terencechain deleted the eip6110-queue branch October 14, 2024 01:28
@james-prysm james-prysm mentioned this pull request Oct 15, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electra electra hardfork Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants