-
Notifications
You must be signed in to change notification settings - Fork 170
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
EIP-37 implementation and activation #1845
Conversation
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.
Looking good! Please check my comments.
Also, I did not find any tests for the new code.
src/main/scala/org/ergoplatform/mining/difficulty/DifficultyAdjustment.scala
Outdated
Show resolved
Hide resolved
...in/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala
Outdated
Show resolved
Hide resolved
...in/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala
Show resolved
Hide resolved
src/main/scala/org/ergoplatform/mining/difficulty/DifficultyAdjustment.scala
Outdated
Show resolved
Hide resolved
src/main/scala/org/ergoplatform/mining/difficulty/DifficultyAdjustment.scala
Outdated
Show resolved
Hide resolved
...in/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala
Outdated
Show resolved
Hide resolved
...in/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala
Outdated
Show resolved
Hide resolved
...in/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala
Show resolved
Hide resolved
Co-authored-by: Alexander Slesarenko <aslesarenko@users.noreply.github.com>
…justment.scala Co-authored-by: Alexander Slesarenko <aslesarenko@users.noreply.github.com>
See above on testing. Unfortunately, automated tests would be tricky to do with our testing framework, will take a look how to do them. |
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.
One question for diff lower bound.
Regarding the tests for new code, maybe just test eip37Calculate
?
val limitedPredictiveDiff = if (predictiveDiff > lastDiff) { | ||
predictiveDiff.min(lastDiff * 3 / 2) | ||
} else { | ||
predictiveDiff.max(lastDiff * 2) |
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.
Should it be lastDiff / 2
? The same goes for uncompressedDiff
.
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.
Sorry, my bad, fixed.
For tests, thinking to add some test vectors. Anything better we can do?
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.
PBT might be a good fit here.
This PR contains implementation and activation of EIP-37 described in ergoplatform/eips#79.
Activation: it is possible to activate EIP-37 after block #843,776 and before block #851,969 . For activation, 232 or more votes for activation required in last 256 blocks, with voting checked every 128 blocks (for blocks which height % 128 == 1), and immediate activation once threshold is met.
Also, in this PR:
offlineGeneration
is nowtrue
by default for the mainnet (which is what is needed by the pools all the time)