* `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>
Prysm: An Ethereum Consensus Implementation Written in Go
This is the core repository for Prysm, a Golang implementation of the Ethereum Consensus specification, developed by Offchain Labs. See the Changelog for details of the latest releases and upcoming breaking changes.
Getting Started
A detailed set of installation and usage instructions as well as breakdowns of each individual component are available in the official documentation portal. If you still have questions, feel free to stop by our Discord.
Staking on Mainnet
To participate in staking, you can join the official eth2 launchpad. The launchpad is the only recommended way to become a validator on mainnet. You can explore validator rewards/penalties via Bitfly's block explorer: beaconcha.in, and follow the latest blocks added to the chain on beaconscan.
Contributing
Branches
Prysm maintains two permanent branches:
- master: This points to the latest stable release. It is ideal for most users.
- develop: This is used for development, it contains the latest PRs. Developers should base their PRs on this branch.
Guide
Want to get involved? Check out our Contribution Guide to learn more!
License
GNU General Public License v3.0
