* `PruneProposalsAtEpoch`: Test return value in case of nothing to prune.
* `TestStore_PruneAttestations_OK`: Create unique validator indexes.
Before this commit, `attester2` for `j = n` was the same than
`attester1` for `j = n + 1`, resulting in erasure of a lot of attesters.
I guess it was not the initial intent.
* Slasher pruning: Check if the number of pruned items corresponds to the expectation.
Before this commit, if the pruning function did remove a superset
of the expected pruned items (including all the items), then the test would pass.
* Prune items that should be pruned and stop pruning items that should not be pruned.
The first 8 bytes of the key of `attestation-data-roots` and
`proposal-records` bytes correspond respectively to an encoded epoch and
and encoded slot.
The important word in this sentence is "encoded".
Before this commit, these slot/epoch are SSZ encoded, which means that
they are little-endian encoded.
However:
- `uint64PrefixGreaterThan` uses `bytes.Compare` which expects
big-endian encoded values.
- `for k, _ := c.First(); k != nil; k, _ = c.Next()` iters over the
keys in big-endian order.
The consequence is:
- Some items that should be pruned are not pruned, provoking a disk
usage leak.
- Some items that should not be pruned are pruned, provoking errors like
in https://github.com/prysmaticlabs/prysm/issues/13658.
This commit encodes the slot/epoch as big-endian before storing them in
the database keys.
Why this bug has not been detected in unit test before?
The values used in unit tests before this commit in
`TestStore_PruneProposalsAtEpoch` and `TestStore_PruneAttestations_OK`
are `10` and `20`.
Unfortunately, checking if `littleEndian(20) > littlenEndien(10)`
with the `>` operator considering operands as big-endian encoded returns
the expected result...
Just replacing `20` by `30` trigs the bug.
* Make deepsource happy.
* Slasher: Migrate database from little-endian to big-endian.
* Update beacon-chain/slasher/service.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* Update beacon-chain/db/slasherkv/migrate.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* `TestMigrate`: Fix documentation.
---------
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* Bump go version up
* Update to go 1.22 compatible version
* Fix NoSec declarations
* Skip Gosec in GolangCi
* Avoid Bug In Analyzer
* Add in Gohashtree and Update to 1.22.4
* Fix Go Sum
* validator/client: process Sync Committee roles separately
In a DV context, to be compatible with the proposed selection endpoint, the VC must push all partial selections to it instead of just one.
Process sync committee role separately within the RolesAt method, so that partial selections can be pushed to the DV client appropriately, if configured.
* testing/util: re-add erroneously deleted state_test.go
* validator/client: fix tests
* validator/client: always process sync committee validator
Process sync committee duty at slot boundary as well.
* don't fail if validator is marked as sync committee but it is not in the list
ignore the duty and continue
* address code review comments
* fix build
---------
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
* eip-7251: registry_updates
* Fix spectest violation
* More unit tests for process_registry_updates
* Update tests for ProcessRegistryUpdates
* Minor refactorings and benchmark
* Update beacon-chain/core/electra/registry_updates.go
Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com>
* Wrap errors from process_registry_updates for easier debugging
* Rewrite process_registry_updates not to use st.Validators()
---------
Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com>
* 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>
* `IndexedAtt` wrapper for the slasher feed
* test fixes
* fix simulator
* fix e2e
* Revert "Auxiliary commit to revert individual files from 191bbf77accfc2523fa9f909837a2e9dca132afa"
This reverts commit 2b0441a23a0e5f66e50cf36c3bbfbb39d587b17b.
* extract interface from channel
* adding logic for saving validator indicies in new cache
* updating index cache for eip6110
* Update setters_misc.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* linting
---------
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>