Skip to content
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

Revert: mainnet blockheder validation merge check #4210

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,7 +37,9 @@ public CalculatedDifficultyValidationRule(final DifficultyCalculator difficultyC
@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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;
Expand Down Expand Up @@ -69,6 +70,12 @@ public boolean validate(final BlockHeader header, final BlockHeader parent) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

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;

Expand All @@ -35,6 +36,9 @@ public TimestampMoreRecentThanParent(final long minimumSecondsSinceParent) {

@Override
public boolean validate(final BlockHeader header, final BlockHeader parent) {
if (MergeConfigOptions.isMergeEnabled()) {
return true;
}
return validateTimestamp(header.getTimestamp(), parent.getTimestamp());
}

Expand Down