Open abi87 opened 1 week ago
The changes in this pull request introduce new methods and fields related to hysteresis parameters in the Spec
interface and SpecData
struct. Specifically, three methods are added to the Spec
interface, and corresponding fields are added to the SpecData
struct. Additionally, modifications are made to the BaseSpec
function to initialize these new fields. The state processing logic is refined, particularly concerning validator updates and effective balances, alongside various improvements in error handling and testing.
File Path | Change Summary |
---|---|
mod/chain-spec/pkg/chain/chain_spec.go |
Added methods: HysteresisQuotient() , HysteresisDownwardMultiplier() , HysteresisUpwardMultiplier() to Spec interface and chainSpec struct. |
mod/chain-spec/pkg/chain/data.go |
Added fields: HysteresisQuotient , HysteresisDownwardMultiplier , HysteresisUpwardMultiplier to SpecData struct. |
mod/config/pkg/spec/testnet.go |
Updated BaseSpec function to include new hysteresis fields initialized with specific values. |
mod/state-transition/pkg/core/state_processor.go |
Refactored ProcessSlots , updated processEpoch , and modified processBlockHeader for improved validator and error handling. Added processEffectiveBalanceUpdates method. |
mod/state-transition/pkg/core/state_processor_committee.go |
Updated processSyncCommitteeUpdates to filter validators based on effective balance using a new slice activeVals . |
mod/state-transition/pkg/core/state_processor_genesis.go |
Enhanced InitializePreminedBeaconStateFromEth1 to process validator activations and compute effective balances. |
mod/state-transition/pkg/core/state_processor_genesis_test.go |
Renamed deposits to genDeposits , added new variables for deposit calculations, and updated test assertions. |
mod/state-transition/pkg/core/state_processor_staking.go |
Simplified deposit processing logic, removed processDeposits , and updated applyDeposit and createValidator methods. |
mod/state-transition/pkg/core/state_processor_staking_test.go |
Added TestTransitionUpdateValidator to verify state processor behavior on validator balance updates and introduced a new test function TestTransitionCreateValidator . |
mod/state-transition/pkg/core/errors.go |
Added new error variable ErrProposerMismatch for handling proposer-related discrepancies. |
mod/state-transition/pkg/core/README.md |
Introduced a new section detailing validator management based on effective balance thresholds. |
mod/config/pkg/spec/special_cases.go |
Renamed constant BArtioValRoot to BartioValRoot for standardization. |
BaseSpec
function, which includes adding new fields related to hysteresis parameters. This is relevant as the main PR also introduces new methods related to hysteresis in the Spec
interface.transition.ValidatorUpdates
instead of slices of transition.ValidatorUpdate
. The main PR's changes to the Spec
interface and chainSpec
struct may relate to how data is structured and accessed, which could impact how validator updates are processed.Spec
interface and related structures may influence how validator balances are calculated and updated.Spec
interface and related methods could be relevant to how deposits and validator states are initialized and managed.Spec
interface and related methods may also involve similar considerations for different chain specifications.Merge me daddy
🐇 In the code, I hop and play,
New methods added, hip-hip-hooray!
Hysteresis now has its say,
With balances that sway and sway.
Let’s test and check, come what may,
In the rabbit hole, we code all day! 🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 61.29032%
with 48 lines
in your changes missing coverage. Please review.
Project coverage is 26.51%. Comparing base (
8a04173
) to head (e72fe31
).
This PR fixes validators' balances and effective balances to make it closer to Eth 2.0 specs. In more details:
processEffectiveBalanceUpdates
to update balances at each epoch turnNote: the PR is somewhat large, but most of the code (> 300LOC) comes from added unit tests.
Left for upcoming PRs:
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation
Tests