-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EIP-6110: Supply validator deposits on chain (#13944)
* wip changes * wip changes refactoring deposit functions * wip on deposit functions * wip changes to fix deposit processing * more wip function logic * gaz * wip refactoring deposit changes * removing circlular dependency and other small fix * fixing circular dependencies * fixing validators file * fixing more tests * fixing unit tests * wip deposit packing * refactoring packing * changing packing code some more * fixing packing change * updating more tests * removing comment * fixing transition code for eip6110 * including inserts for validator index cache * adding tests and placeholder test * moving deposit related unit tests over * adding in test for electra proposer packing * spec test wip * moving cache saving to the correct spot * eip-6110: deposit spectests * adding deposit receipt spec tests * reverting altair operations in this pr and will be handled separately * fixing renames but need to refactor process deposits * gaz * fixing names * fixing linting * fixing unit test * fixing a test and updating test util * bal never used * fixing more tests * fixing one more test * addressing feedback * refactoring process deposits to be part of their own fork instead of in blocks package * adding new tests to cover functions and removing redundancies * removing comment based on feedback * resolving easy deepsource issue * refactoring for appropriate aliasing and readability * reverting some changes to simplify diff * small edit to comment * fixing linting * fixing merge changes and review comments * Update beacon-chain/rpc/prysm/v1alpha1/validator/proposer_deposits.go Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> * partial review comments * addressing slack feedback * moving function from deposits to validator.go * adding in batch verification and improving logs --------- Co-authored-by: Preston Van Loon <preston@pvl.dev> Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
- Loading branch information
1 parent
91c55c6
commit 028504a
Showing
27 changed files
with
1,118 additions
and
101 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package electra_test | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
fuzz "github.com/google/gofuzz" | ||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/electra" | ||
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native" | ||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" | ||
"github.com/prysmaticlabs/prysm/v5/testing/require" | ||
) | ||
|
||
func TestFuzzProcessDeposits_10000(t *testing.T) { | ||
fuzzer := fuzz.NewWithSeed(0) | ||
state := ðpb.BeaconStateElectra{} | ||
deposits := make([]*ethpb.Deposit, 100) | ||
ctx := context.Background() | ||
for i := 0; i < 10000; i++ { | ||
fuzzer.Fuzz(state) | ||
for i := range deposits { | ||
fuzzer.Fuzz(deposits[i]) | ||
} | ||
s, err := state_native.InitializeFromProtoUnsafeElectra(state) | ||
require.NoError(t, err) | ||
r, err := electra.ProcessDeposits(ctx, s, deposits) | ||
if err != nil && r != nil { | ||
t.Fatalf("return value should be nil on err. found: %v on error: %v for state: %v and block: %v", r, err, state, deposits) | ||
} | ||
} | ||
} | ||
|
||
func TestFuzzProcessDeposit_10000(t *testing.T) { | ||
fuzzer := fuzz.NewWithSeed(0) | ||
state := ðpb.BeaconStateElectra{} | ||
deposit := ðpb.Deposit{} | ||
|
||
for i := 0; i < 10000; i++ { | ||
fuzzer.Fuzz(state) | ||
fuzzer.Fuzz(deposit) | ||
s, err := state_native.InitializeFromProtoUnsafeElectra(state) | ||
require.NoError(t, err) | ||
r, err := electra.ProcessDeposit(s, deposit, true) | ||
if err != nil && r != nil { | ||
t.Fatalf("return value should be nil on err. found: %v on error: %v for state: %v and block: %v", r, err, state, deposit) | ||
} | ||
} | ||
} |
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.