-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(spec): fix attestors slashing specs for electra fork #6758
Conversation
@@ -52,7 +52,7 @@ export function computeExitEpochAndUpdateChurn(state: CachedBeaconStateElectra, | |||
// Exit doesn't fit in the current earliest epoch. | |||
if (exitBalance > exitBalanceToConsume) { | |||
const balanceToProcess = Number(exitBalance) - exitBalanceToConsume; | |||
const additionalEpochs = Math.floor((balanceToProcess - 1) / (perEpochChurn + 1)); | |||
const additionalEpochs = Math.ceil((balanceToProcess - 1) / (perEpochChurn + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you detail this? Also, is it worth having some test for this, as apparently this change didn't require any associated test change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally my preferences is to have unit tests for every function, but unfortunatley we don't have it yet.
I updated with a code comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I misread the spec here.
We should do
const additionalEpochs = Math.floor((balanceToProcess - 1) / perEpochChurn) + 1
Let me know if the spec test's still passing after making this change
packages/state-transition/src/block/isValidIndexedAttestation.ts
Outdated
Show resolved
Hide resolved
packages/state-transition/src/block/isValidIndexedAttestation.ts
Outdated
Show resolved
Hide resolved
@@ -52,7 +52,7 @@ export function computeExitEpochAndUpdateChurn(state: CachedBeaconStateElectra, | |||
// Exit doesn't fit in the current earliest epoch. | |||
if (exitBalance > exitBalanceToConsume) { | |||
const balanceToProcess = Number(exitBalance) - exitBalanceToConsume; | |||
const additionalEpochs = Math.floor((balanceToProcess - 1) / (perEpochChurn + 1)); | |||
const additionalEpochs = Math.ceil((balanceToProcess - 1) / (perEpochChurn + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I misread the spec here.
We should do
const additionalEpochs = Math.floor((balanceToProcess - 1) / perEpochChurn) + 1
Let me know if the spec test's still passing after making this change
Yes both expressions have same impact. Either to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
…6758) * Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
* Fix attester slashing specs for electra * Remove unused import * Add code comment * Update the expression * Update the fork check
🎉 This PR is included in v1.22.0 🎉 |
Motivation
Improve the spec coverage for electra fork
Description
Fix attestor slashing for the elctra-fork.
Steps to test or reproduce