revert for now (#4210)

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/4213/head
garyschulte 2 years ago committed by GitHub
parent b1bff9ce1f
commit 721638dc04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/CalculatedDifficultyValidationRule.java
  2. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java
  3. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/TimestampMoreRecentThanParent.java

@ -14,6 +14,7 @@
*/
package org.hyperledger.besu.ethereum.mainnet.headervalidationrules;
import org.hyperledger.besu.config.MergeConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule;
@ -36,7 +37,9 @@ public class CalculatedDifficultyValidationRule implements AttachedBlockHeaderVa
@Override
public boolean validate(
final BlockHeader header, final BlockHeader parent, final ProtocolContext context) {
if (MergeConfigOptions.isMergeEnabled()) {
return true;
}
final BigInteger actualDifficulty = new BigInteger(1, header.getDifficulty().toArray());
final BigInteger expectedDifficulty =
difficultyCalculator.nextDifficulty(header.getTimestamp(), parent, context);

@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.mainnet.headervalidationrules;
import static java.lang.Boolean.FALSE;
import org.hyperledger.besu.config.MergeConfigOptions;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule;
@ -69,6 +70,12 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid
return false;
}
// TODO: remove this rule bypass, use post-merge headervalidation rules
// https://github.com/hyperledger/besu/issues/2898
if (MergeConfigOptions.isMergeEnabled()) {
return true;
}
final Hash headerHash = hashHeader(header);
PoWSolution solution =
hasher.hash(header.getNonce(), header.getNumber(), epochCalculator, headerHash);

@ -16,6 +16,7 @@ package org.hyperledger.besu.ethereum.mainnet.headervalidationrules;
import static com.google.common.base.Preconditions.checkArgument;
import org.hyperledger.besu.config.MergeConfigOptions;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule;
@ -35,6 +36,9 @@ public class TimestampMoreRecentThanParent implements DetachedBlockHeaderValidat
@Override
public boolean validate(final BlockHeader header, final BlockHeader parent) {
if (MergeConfigOptions.isMergeEnabled()) {
return true;
}
return validateTimestamp(header.getTimestamp(), parent.getTimestamp());
}

Loading…
Cancel
Save