Skip to content

Downtime slashing when epoch changes#2436

Merged
celo-ci-bot-user merged 8 commits intocelo-org:masterfrom
mrsmkl:downtime-slashing-epoch-change-fix
Jan 24, 2020
Merged

Downtime slashing when epoch changes#2436
celo-ci-bot-user merged 8 commits intocelo-org:masterfrom
mrsmkl:downtime-slashing-epoch-change-fix

Conversation

@mrsmkl
Copy link
Copy Markdown
Contributor

@mrsmkl mrsmkl commented Jan 14, 2020

Description

Looks like there is some error when checking downtime when validator index changes. This PR should fix it.

Tested

Added a unit test.

Other changes

Related issues

Backwards compatibility

@mrsmkl mrsmkl requested review from asaj and m-chrzan as code owners January 14, 2020 18:12
@mrsmkl mrsmkl changed the title Downtime slashing when epoch changes [wip] Downtime slashing when epoch changes Jan 14, 2020
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 15, 2020

Codecov Report

Merging #2436 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2436   +/-   ##
======================================
  Coverage    73.6%   73.6%           
======================================
  Files         554     554           
  Lines       13667   13667           
  Branches     1641    1641           
======================================
  Hits        10059   10059           
  Misses       3330    3330           
  Partials      278     278
Flag Coverage Δ
#mobile 74.79% <0%> (ø) ⬆️
#web 71.95% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b0dca8...0b2b621. Read the comment docs.

@mrsmkl mrsmkl changed the title [wip] Downtime slashing when epoch changes Downtime slashing when epoch changes Jan 15, 2020
? startSignerIndex
: endSignerIndex;
if (uint256(getParentSealBitmap(n)) & (1 << signerIndex) != 0) return false;
if (uint256(getParentSealBitmap(n + 1)) & (1 << signerIndex) != 0) return false;
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.

So, not sure of the semantics of getParentSealBitmap.
From your change it seems that getParentSeal(x) will get the parentSeal that's on block X header. which is a seal of all signers for block X-1.

In that case, this is correct.. and great catch by the way!
Can you confirm? The other case is that getParentSealBitmap(x) get's the parent seal that have signer for block X and that lives on block X+1 header..

In any case, a comment would be nice :D

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.

I think I'll check from geth, but I tried to check from baklava, the current version didn't seem to work.

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.

It gets the header from the block given as argument https://github.com/celo-org/celo-blockchain/blob/master/core/vm/contracts.go#L797

So it should be correct now.

@mrsmkl mrsmkl self-assigned this Jan 17, 2020
@asaj asaj self-assigned this Jan 17, 2020
@mrsmkl mrsmkl removed their assignment Jan 22, 2020
if (uint256(getParentSealBitmap(n)) & (1 << signerIndex) != 0) return false;
// We want to check signers for block n,
// so we get the parent seal bitmap for the next block
if (uint256(getParentSealBitmap(n + 1)) & (1 << signerIndex) != 0) return false;
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.

Do we need to change require(endBlock < block.number - 1, "end block must be smaller than current block");?

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.

No, I think it's correct now.

@asaj asaj assigned mrsmkl and unassigned asaj Jan 24, 2020
@celo-ci-bot-user celo-ci-bot-user merged commit 09010b8 into celo-org:master Jan 24, 2020
lucasege pushed a commit that referenced this pull request Jan 27, 2020
aaronmgdr added a commit that referenced this pull request Jan 28, 2020
* master:
  🧹Web cleanup (readme + static dir) (#2562)
  Add readable proposals to governance:view command (#2545)
  Add explicit gas to exchange transactions to prevent errors (#2552)
  Fix off-by-one error in attributing signatures to blocks in CLI (#2559)
  ✅ add test for phone Input component (#2554)
  Add Youtube to Footer +  (#2556)
  Fix rounding error in Election.sol (#2540)
  [Wallet] Bump @celo/client to 0.0.266 (#2551)
  [Wallet] E2E test improvements (#2542)
  Deployed integration (#2550)
  do not fetch affiliates (#2508)
  Added more CLI checks for registering validators and groups (#2491)
  Micro Improvement to web tests (#2527)
  [Wallet] Prompt users with connectivity issues to switch to forno (#2526)
  cli: Fix voter rewards presentation (#2543)
  [Wallet] Fix missing spanish translation  (#2539)
  Downtime slashing when epoch changes (#2436)
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