fix: report absolute expected deposit index in ErrDepositIndexOutOfOrder#3091
fix: report absolute expected deposit index in ErrDepositIndexOutOfOrder#3091rachit77 wants to merge 2 commits intoberachain:mainfrom
ErrDepositIndexOutOfOrder#3091Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the ErrDepositIndexOutOfOrder diagnostic message in ValidateNonGenesisDeposits to report the absolute expected deposit index derived from the state (depositIndex + i) rather than the zero-based loop counter.
Changes:
- Update
ValidateNonGenesisDepositsto formatexpected indexasdepositIndex+uint64(i). - Add a regression test to assert the error message contains the absolute expected index.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
state-transition/core/validation_deposits.go |
Fixes the wrapped error message to report the correct absolute expected deposit index. |
state-transition/core/validation_deposits_test.go |
Adds a regression test ensuring the error message includes the state-based expected index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "github.com/berachain/beacon-kit/primitives/constants" | ||
| core "github.com/berachain/beacon-kit/state-transition/core" | ||
| statetransition "github.com/berachain/beacon-kit/testing/state-transition" |
There was a problem hiding this comment.
Redundant import alias: the imported package path ends in /state-transition/core and the package name is already core, so core ".../core" adds an unnecessary alias. This also deviates from existing usage in this repo (e.g., state-transition/core/core_test.go:38 imports it without an alias) and may be flagged by the importas linter in .golangci.yaml. Consider importing without the alias and keeping usages as core.<...> (they will continue to compile).
Summary
ValidateNonGenesisDepositswas logging i (the zero-based loop counter) as the expected deposit index in theErrDepositIndexOutOfOrdererror message instead ofdepositIndex+uint64(i)(the absolute eth1 deposit index from state)"expected index: 0"instead of"expected index: 100"Test
TestDepositIndexOutOfOrderErrorMessage: seeds the deposit store with 6 entries, sets depositIndex=5 on the state directly, submits a deposit with index 0 (wrong), and asserts the error contains "expected index: 5" not "expected index: 0"