* `EpochFromString`: Use already defined `Uint64FromString` function.
* `Test_uint64FromString` => `Test_FromString`
This test function tests more functions than `Uint64FromString`.
* Slashing protection history: Remove unreachable code.
The function `NewKVStore` creates, via `kv.UpdatePublicKeysBuckets`,
a new item in the `proposal-history-bucket-interchange`.
IMO there is no real reason to prefer `proposal` than `attestation`
as a prefix for this bucket, but this is the way it is done right now
and renaming the bucket will probably be backward incompatible.
An `attestedPublicKey` cannot exist without
the corresponding `proposedPublicKey`.
Thus, the `else` portion of code removed in this commit is not reachable.
We raise an error if we get there.
This is also probably the reason why the removed `else` portion was not
tested.
* `NewKVStore`: Switch items in `createBuckets`.
So the order corresponds to `schema.go`
* `slashableAttestationCheck`: Fix comments and logs.
* `ValidatorClient.db`: Use `iface.ValidatorDB`.
* BoltDB database: Implement `GraffitiFileHash`.
* Filesystem database: Creates `db.go`.
This file defines the following structs:
- `Store`
- `Graffiti`
- `Configuration`
- `ValidatorSlashingProtection`
This files implements the following public functions:
- `NewStore`
- `Close`
- `Backup`
- `DatabasePath`
- `ClearDB`
- `UpdatePublicKeysBuckets`
This files implements the following private functions:
- `slashingProtectionDirPath`
- `configurationFilePath`
- `configuration`
- `saveConfiguration`
- `validatorSlashingProtection`
- `saveValidatorSlashingProtection`
- `publicKeys`
* Filesystem database: Creates `genesis.go`.
This file defines the following public functions:
- `GenesisValidatorsRoot`
- `SaveGenesisValidatorsRoot`
* Filesystem database: Creates `graffiti.go`.
This file defines the following public functions:
- `SaveGraffitiOrderedIndex`
- `GraffitiOrderedIndex`
* Filesystem database: Creates `migration.go`.
This file defines the following public functions:
- `RunUpMigrations`
- `RunDownMigrations`
* Filesystem database: Creates proposer_settings.go.
This file defines the following public functions:
- `ProposerSettings`
- `ProposerSettingsExists`
- `SaveProposerSettings`
* Filesystem database: Creates `attester_protection.go`.
This file defines the following public functions:
- `EIPImportBlacklistedPublicKeys`
- `SaveEIPImportBlacklistedPublicKeys`
- `SigningRootAtTargetEpoch`
- `LowestSignedTargetEpoch`
- `LowestSignedSourceEpoch`
- `AttestedPublicKeys`
- `CheckSlashableAttestation`
- `SaveAttestationForPubKey`
- `SaveAttestationsForPubKey`
- `AttestationHistoryForPubKey`
* Filesystem database: Creates `proposer_protection.go`.
This file defines the following public functions:
- `HighestSignedProposal`
- `LowestSignedProposal`
- `ProposalHistoryForPubKey`
- `ProposalHistoryForSlot`
- `ProposedPublicKeys`
* Ensure that the filesystem store implements the `ValidatorDB` interface.
* `slashableAttestationCheck`: Check the database type.
* `slashableProposalCheck`: Check the database type.
* `slashableAttestationCheck`: Allow usage of minimal slashing protection.
* `slashableProposalCheck`: Allow usage of minimal slashing protection.
* `ImportStandardProtectionJSON`: Check the database type.
* `ImportStandardProtectionJSON`: Allow usage of min slashing protection.
* Implement `RecursiveDirFind`.
* Implement minimal<->complete DB conversion.
3 public functions are implemented:
- `IsCompleteDatabaseExisting`
- `IsMinimalDatabaseExisting`
- `ConvertDatabase`
* `setupDB`: Add `isSlashingProtectionMinimal` argument.
The feature addition is located in `validator/node/node_test.go`.
The rest of this commit consists in minimal slashing protection testing.
* `setupWithKey`: Add `isSlashingProtectionMinimal` argument.
The feature addition is located in `validator/client/propose_test.go`.
The rest of this commit consists in tests wrapping.
* `setup`: Add `isSlashingProtectionMinimal` argument.
The added feature is located in the `validator/client/propose_test.go`
file.
The rest of this commit consists in tests wrapping.
* `initializeFromCLI` and `initializeForWeb`: Factorize db init.
* Add `convert-complete-to-minimal` command.
* Creates `--enable-minimal-slashing-protection` flag.
* `importSlashingProtectionJSON`: Check database type.
* `exportSlashingProtectionJSON`: Check database type.
* `TestClearDB`: Test with minimal slashing protection.
* KeyManager: Test with minimal slashing protection.
* RPC: KeyManager: Test with minimal slashing protection.
* `convert-complete-to-minimal`: Change option names.
Options were:
- `--source` (for source data directory), and
- `--target` (for target data directory)
However, since this command deals with slashing protection, which has
source (epochs) and target (epochs), the initial option names may confuse
the user.
In this commit:
`--source` ==> `--source-data-dir`
`--target` ==> `--target-data-dir`
* Set `SlashableAttestationCheck` as an iface method.
And delete `CheckSlashableAttestation` from iface.
* Move helpers functions in a more general directory.
No functional change.
* Extract common structs out of `kv`.
==> `filesystem` does not depend anymore on `kv`.
==> `iface` does not depend anymore on `kv`.
==> `slashing-protection` does not depend anymore on `kv`.
* Move `ValidateMetadata` in `validator/helpers`.
* `ValidateMetadata`: Test with mock.
This way, we can:
- Avoid any circular import for tests.
- Implement once for all `iface.ValidatorDB` implementations
the `ValidateMetadata`function.
- Have tests (and coverage) of `ValidateMetadata`in
its own package.
The ideal solution would have been to implement `ValidateMetadata` as
a method with the `iface.ValidatorDB`receiver.
Unfortunately, golang does not allow that.
* `iface.ValidatorDB`: Implement ImportStandardProtectionJSON.
The whole purpose of this commit is to avoid the `switch validatorDB.(type)`
in `ImportStandardProtectionJSON`.
* `iface.ValidatorDB`: Implement `SlashableProposalCheck`.
* Remove now useless `slashableProposalCheck`.
* Delete useless `ImportStandardProtectionJSON`.
* `file.Exists`: Detect directories and return an error.
Before, `Exists` was only able to detect if a file exists.
Now, this function takes an extra `File` or `Directory` argument.
It detects either if a file or a directory exists.
Before, if an error was returned by `os.Stat`, the the file was
considered as non existing.
Now, it is treated as a real error.
* Replace `os.Stat` by `file.Exists`.
* Remove `Is{Complete,Minimal}DatabaseExisting`.
* `publicKeys`: Add log if unexpected file found.
* Move `{Source,Target}DataDirFlag`in `db.go`.
* `failedAttLocalProtectionErr`: `var`==> `const`
* `signingRoot`: `32`==> `fieldparams.RootLength`.
* `validatorClientData`==> `validator-client-data`.
To be consistent with `slashing-protection`.
* Add progress bars for `import` and `convert`.
* `parseBlocksForUniquePublicKeys`: Move in `db/kv`.
* helpers: Remove unused `initializeProgressBar` function.
* First take at updating everything to v5
* Patch gRPC gateway to use prysm v5
Fix patch
* Update go ssz
---------
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* Define `cli.App` without mutation.
No functional change.
* `usage.go`: Clean `appHelpTemplate`.
No functional change is added.
Modifications consist in adding prefix/suffix `-` to improve readability of
the template without adding new lines in template inference.
We now see some inconsistencies of the template:
- `if .App.Version` is around the `AUTHOR` section.
- `if .App.Copyright` is around both `COPYRIGHT` and `VERSION` sections.
- `if len .App.Authors` is around nothing.
* `usage.go`: Surround version and author correctly.
* `usage.go`: `AUTHOR` ==> `AUTHORS`
* `usage.go`: `GLOBAL` --> `global`.
* `--grpc-max-msg-size`: Remove double default.
* VC: Standardize help message.
- Flags help begin with a capital letter and end with a period.
- If a flag help begins with a verb, it is conjugated.
- Expermitemtal, danger etc... mentions are between parenthesis.
* VC help message: Wrap too long lines.
* in progress...
* in progress...
* remove log
* log root
* Revert "Auxiliary commit to revert individual files from f12a609ea2a2f1e87e97321f3a717cd324b5ae97"
This reverts commit 5ae35edb6477d8d0ea4e94b273efc6590484da85.
* cleanup
* remove log
* remove whitespace
* remove logs
* more stuff
* copy
* always rebuild trie
* revert
* add state
* init state
* fix all
* uintptr
* move slice to new package
* lock in `Detach`
* remove constraint
* reorder
* blockroots and stateroots
* fill roots in empty()
* fix hasher
* implement slice for balances and inactivity scores
* detach in setters
* Revert "implement slice for balances and inactivity scores"
This reverts commit 59eb9df8d766cb1c44a7eb5b3f5e3c042249943d.
# Conflicts:
# beacon-chain/state/state-native/setters_validator.go
* use counter to track states
* typos
* rename interface
* balances
* gauge
* some improvements
* first try with map
* fix
* inactivity scores in progress
* fix test
# Conflicts:
# beacon-chain/state/state-native/helpers_test.go
* test fixes
* ToProto fix
* copy roots
* validators
* build fixes
* fix bug in `ToProto`
* fix fuzz test
* fix bug in slice getters
* fix state equality checks
* make tests pass
* make tests pass
* more test updates
* Revert "Auxiliary commit to revert individual files from 34e7344bff08a589e6341bb1829e3cb74159e878"
This reverts commit ecd64efa8917f37ca41460e0356ff007fe55dd9d.
* Revert "make tests pass"
This reverts commit 0cf00f19eecf4678cd2b866dd107f3179d0426ef.
* Revert "make tests pass"
This reverts commit 521b65e1d2e13be3d720f333008b6838a8e78878.
* pass tests
* deepequal identifiable types
* Deflake `cloners_test.go`
* feature flag for block roots
* feature flag
* remove recursive locks
* reduce complexity of rootSelector
* fix randao mixes root
* some fixes
* revisit tests
* revert change to field trie helpers
* initialize field map for tests
* remove whitespace
* initialize roots with proper length
* more fixes
* out of bounds message fix
* optimize length calculation
* remove call to Len in PubkeyAtIndex
* don't log deposits
* unit tests
* unit tests
* fix
* comments
* test fixes
* id
* remove Enumerator interface
* review feedback
* simplify field trie
* bring back fieldtrie package
* fix bazel file
* use handle32ByteArrays for root computation
* fix locks
* metrics
* bzl
* simplify some things
* use htr in state test
* remove code from require package
* gzl
* more htr
* Fuzzing of the multi-value slice
* assert values
* getter optimizations
* use At when reading from validators
* Nishant's review
* restore safe copy
* remove empty line
* build fix
* restore how we get root at index for deafult mode
* more review comments
* optimize default behavior
* simplify Slice calls
* test fix
* remove unnecessary package
* remove unused setter
* make fieldMap unexported
* some improvements in state package
* call `Slice` instead of manually copying
* unlock in ReadFromEveryValidator
* Potuz's comments
* lock the state when reading from all validators
# Conflicts:
# beacon-chain/state/state-native/getters_validator.go
* add back preston's changes
* add index
---------
Co-authored-by: Potuz <potuz@prysmaticlabs.com>
Co-authored-by: nisdas <nishdas93@gmail.com>
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* WIP
* WIP
* adding in migration function
* updating mock validator and gaz
* adding descriptive logs
* fixing mocking
* fixing tests
* fixing mock
* adding changes to handle enable builder settings
* fixing tests and edge case
* reduce cognative complexity of function
* further reducing cognative complexity on function
* WIP
* fixing unit test on migration
* adding more tests
* gaz and fix unit test
* fixing deepsource issues
* fixing more deesource issues missed previously
* removing unused reciever name
* WIP fix to migration logic
* fixing loging info
* reverting migration logic, converting logic to address issues discussed on slack, adding unit tests
* adding test for builder setting only not saved to db
* addressing comment
* fixing flag
* removing accidently missed deprecated flags
* rolling back mock on pr
* fixing fmt linting
* updating comments based on feedback
* Update config/features/flags.go
Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com>
* fixing based on feedback on PR
* Update config/validator/service/proposer_settings.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* Update validator/client/runner.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* Update validator/db/kv/proposer_settings.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* adding additional logs to clear up some steps based on feedback
* fixing log
* deepsource
* adding comments based on review feedback
---------
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com>
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
* Proposer builds block in parallel. Cosensus vs Execution
* Update beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
* Use feature flag
---------
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
* Add prepare-all-payloads flag
* add unit tests
* do not use the nsc
---------
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>