Skip to content

test(spec): fix attestors slashing specs for electra fork - #6758

Merged
ensi321 merged 5 commits into
electra-forkfrom
nh/attestors-slashing-specs
May 10, 2024
Merged

test(spec): fix attestors slashing specs for electra fork#6758
ensi321 merged 5 commits into
electra-forkfrom
nh/attestors-slashing-specs

Conversation

@nazarhussain

Copy link
Copy Markdown
Contributor

Motivation

Improve the spec coverage for electra fork

Description

Fix attestor slashing for the elctra-fork.

Steps to test or reproduce

  • Run all tests

@nazarhussain
nazarhussain requested a review from a team as a code owner May 10, 2024 12:24
@nazarhussain nazarhussain self-assigned this May 10, 2024
if (exitBalance > exitBalanceToConsume) {
const balanceToProcess = Number(exitBalance) - exitBalanceToConsume;
const additionalEpochs = Math.floor((balanceToProcess - 1) / (perEpochChurn + 1));
const additionalEpochs = Math.ceil((balanceToProcess - 1) / (perEpochChurn + 1));

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Member

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

Comment thread packages/state-transition/src/block/isValidIndexedAttestation.ts Outdated
@nazarhussain
nazarhussain requested a review from jeluard May 10, 2024 12:40
Comment thread packages/state-transition/src/block/isValidIndexedAttestation.ts Outdated
if (exitBalance > exitBalanceToConsume) {
const balanceToProcess = Number(exitBalance) - exitBalanceToConsume;
const additionalEpochs = Math.floor((balanceToProcess - 1) / (perEpochChurn + 1));
const additionalEpochs = Math.ceil((balanceToProcess - 1) / (perEpochChurn + 1));

Copy link
Copy Markdown
Member

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

@nazarhussain

Copy link
Copy Markdown
Contributor Author

Let me know if the spec test's still passing after making this change

Yes both expressions have same impact. Either to use Math.ceil or use Math.floor ... + 1. I updated the coe.

@nazarhussain
nazarhussain requested a review from ensi321 May 10, 2024 18:02

@ensi321 ensi321 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks

@ensi321
ensi321 merged commit 9c1a4ca into electra-fork May 10, 2024
@ensi321
ensi321 deleted the nh/attestors-slashing-specs branch May 10, 2024 22:01
g11tech pushed a commit that referenced this pull request May 24, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit to g11tech/lodestar that referenced this pull request Jun 19, 2024
…6758)

* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Jun 25, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Jun 25, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Jul 1, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Jul 30, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Jul 31, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Aug 2, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Aug 9, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Aug 9, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Aug 23, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
g11tech pushed a commit that referenced this pull request Aug 27, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
philknows pushed a commit that referenced this pull request Sep 3, 2024
* Fix attester slashing specs for electra

* Remove unused import

* Add code comment

* Update the expression

* Update the fork check
@wemeetagain

Copy link
Copy Markdown
Member

🎉 This PR is included in v1.22.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants