-
Notifications
You must be signed in to change notification settings - Fork 75
[ETCM-746] Add support for PoW with Keccak-256 (ECIP-1049) #960
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
Conversation
9ec6b5e
to
128377c
Compare
src/main/scala/io/iohk/ethereum/consensus/pow/blocks/RestrictedPoWBlockGeneratorImpl.scala
Show resolved
Hide resolved
src/ets/scala/io/iohk/ethereum/ets/blockchain/ScenarioSetup.scala
Outdated
Show resolved
Hide resolved
128377c
to
487a22f
Compare
So we don't use it for now, just for test purposes? in ECIP-1049 I see there is an activation block |
Where did you see that? I have the idea that that it is still not decided, on which block to do the switch, for mainnet. Or even if there's a final decision to really go forward with this I don't understand what do you mean with "is this just for testing purposes?". Everything has to be tested before going to live (there's a test network called Astor that only mines with keccak, we will add support for that on ETCM-749) |
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.
Looks good to me. Just minor comments about the code that was (probably) already there, but since we are touching these files - might as well improve it a bit
|
||
def calculateDagSize(blockNumber: Long, epoch: Long): (Array[Array[Int]], Long) = { | ||
(currentEpoch, currentEpochDag, currentEpochDagSize) match { | ||
case (Some(`epoch`), Some(dag), Some(dagSize)) => (dag, dagSize) |
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.
case (Some(`epoch`), Some(dag), Some(dagSize)) => (dag, dagSize) | |
case (Some(_), Some(dag), Some(dagSize)) => (dag, dagSize) |
I saw isKeccak is always false based on the configuration |
Yes, at the moment yes. It will only be tested in Astor for now |
src/main/scala/io/iohk/ethereum/consensus/pow/KeccakCalculation.scala
Outdated
Show resolved
Hide resolved
e95c459
to
d511ed5
Compare
I realized that the tests for the EthashMiner never run by default. I forced then to run locally and all passed |
Renamed several classes from Ethash to PoW because they will be used in both Ethash Pow and Keccak PoW
d511ed5
to
9b71140
Compare
Added support for PoW with Keccak-256 (ECIP-1049)
Renamed several classes from Ethash to PoW because they will be used in both Ethash Pow and Keccak PoW
Description
Add support for PoW with Keccak-256 (ECIP-1049)
Renamed several classes from Ethash to PoW because they will be used in both Ethash Pow and Keccak PoW
Proposed Solution
Added
KeccakCalculation
object that computes the newmixHash
and validates it against the block difficulty.In order to control if a block should be mined using the new Keccak-Pow or current Ethash-Pow a simple if clause was added to the
EthashMiner
class. In ETCM-759 this will be refactored.Added
KeccakBlockHeaderValidator
object that validates a block header for a block mined with the Keccak-Pow.Added
PoWBlockHeaderValidator
class to controls whether (new)KeccakBlockHeaderValidator
or (current)EthashBlockHeaderValidator
should be used for the validationNOTE:
Class
EthashDAGManager
is not new code it was extracted fromEthashMiner
.Because I renamed the package,
EthashMiner
is marked as a new file, but only the code related withif (isKeccak(blockNumber))
The total number of files modified is big because of renaming
Testing
The branch was tested against
etc
network with both FastSync and RegularSync synchronization.