Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

[ethash] chainspec validate ecip1017EraRounds non-zero #11123

Merged
merged 4 commits into from Oct 17, 2019

Conversation

niklasad1
Copy link
Collaborator

See #11119 for background information.

This PR does the following:

  1. Modifies chain spec validation to require ecip1017EraRounds to be non-zero. For a more human-friendly error message. (Could maybe be bigger than 1 instead, however, it is technically a breaking change but it makes parity useless)
  2. Document fn ecip1017_eras_block_reward and add explicit panic for hidden panics that may occur by divide by zero

We could maybe just return zero era rounds when ecip1017EraRounds < 2

Thoughts?

When `ecip1017EraRounds` ethash will divide by zero.

This commit ensures that the chainspec deserialization fails and
gives a better error message.
@niklasad1 niklasad1 added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Oct 4, 2019
@ordian ordian added this to the 2.7 milestone Oct 4, 2019
@ordian ordian requested a review from sorpaas October 4, 2019 13:59
ethcore/engines/ethash/src/lib.rs Outdated Show resolved Hide resolved
@ordian ordian added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 17, 2019
@niklasad1 niklasad1 merged commit 9c8b7c2 into master Oct 17, 2019
@niklasad1 niklasad1 deleted the na-ethc-chainspec-validation branch October 17, 2019 12:02
dvdplm added a commit that referenced this pull request Oct 24, 2019
* master:
  Type annotation for next_key() matching of json filter options (#11192)
  Crypto primitives removed from ethkey (#11174)
  Made ecrecover implementation trait public (#11188)
  Remove unused macro_use. (#11191)
  [dependencies]: jsonrpc `14.0.1` (#11183)
  [receipt]: add `sender` & `receiver` to `RichReceipts` (#11179)
  [dependencies] bump rand 0.7 (#11022)
  [ethcore/builtin]: do not panic in blake2pricer on short input (#11180)
  TxPermissions ver 3: gas price & data (#11170)
  [ethash] chainspec validate `ecip1017EraRounds` non-zero (#11123)
  util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175)
  ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172)
  Aura: Report malice on sibling blocks from the same validator (#11160)
dvdplm added a commit that referenced this pull request Oct 24, 2019
* master:
  Pause pruning while snapshotting (#11178)
  Type annotation for next_key() matching of json filter options (#11192)
  Crypto primitives removed from ethkey (#11174)
  Made ecrecover implementation trait public (#11188)
  Remove unused macro_use. (#11191)
  [dependencies]: jsonrpc `14.0.1` (#11183)
  [receipt]: add `sender` & `receiver` to `RichReceipts` (#11179)
  [dependencies] bump rand 0.7 (#11022)
  [ethcore/builtin]: do not panic in blake2pricer on short input (#11180)
  TxPermissions ver 3: gas price & data (#11170)
  [ethash] chainspec validate `ecip1017EraRounds` non-zero (#11123)
  util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175)
  ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172)
  Aura: Report malice on sibling blocks from the same validator (#11160)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants