Skip to content

Commit

Permalink
Remove merge block processor as block rewards are already disabled fo…
Browse files Browse the repository at this point in the history
…r Paris and above in the protocol schedule (hyperledger#5357)

Signed-off-by: Jason Frame <jason.frame@consensys.net>
  • Loading branch information
jframe authored Apr 21, 2023
1 parent 0311016 commit b137432
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 85 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ public static ProtocolSchedule create(
MergeProtocolSchedule.applyMergeSpecificModifications(
specBuilder, config.getChainId()));
if (config.getShanghaiTime().isPresent()) {
postMergeModifications.put(
config.getShanghaiTime().getAsLong(),
MergeProtocolSchedule::unapplyMergeModificationsFromShanghaiOnwards);
// unapply merge modifications from Shanghai onwards
postMergeModifications.put(config.getShanghaiTime().getAsLong(), Function.identity());
}

return new ProtocolScheduleBuilder(
Expand All @@ -93,7 +92,6 @@ private static ProtocolSpecBuilder applyMergeSpecificModifications(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.paris(
gasCalculator, chainId.orElse(BigInteger.ZERO), EvmConfiguration.DEFAULT))
.blockProcessorBuilder(MergeBlockProcessor::new)
.blockHeaderValidatorBuilder(MergeProtocolSchedule::getBlockHeaderValidator)
.blockReward(Wei.ZERO)
.difficultyCalculator((a, b, c) -> BigInteger.ZERO)
Expand All @@ -102,15 +100,6 @@ private static ProtocolSpecBuilder applyMergeSpecificModifications(
.name("Paris");
}

private static ProtocolSpecBuilder unapplyMergeModificationsFromShanghaiOnwards(
final ProtocolSpecBuilder specBuilder) {
// TODO Withdrawals Get rid of MergeBlockProcessor
// inherits merge config from MainnetProtocolSpecs.parisDefinition
// This would be Function.identify() but MergeBlockProcessor can't be used in
// MainnetProtocolSpecs due to circular dependency
return specBuilder.blockProcessorBuilder(MergeBlockProcessor::new);
}

private static BlockHeaderValidator.Builder getBlockHeaderValidator(final FeeMarket feeMarket) {
return MergeValidationRulesetFactory.mergeBlockHeaderValidator(feeMarket);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.evm.operation.InvalidOperation;
Expand Down Expand Up @@ -97,7 +98,7 @@ private static void assertProofOfStakeConfigIsEnabled(final ProtocolSpec spec) {
.isEqualTo(BigInteger.ZERO);
assertThat(spec.getBlockReward()).isEqualTo(Wei.ZERO);
assertThat(spec.isSkipZeroBlockRewards()).isTrue();
assertThat(spec.getBlockProcessor()).isInstanceOf(MergeBlockProcessor.class);
assertThat(spec.getBlockProcessor()).isInstanceOf(MainnetBlockProcessor.class);
}

private BlockHeader blockHeader(final long number) {
Expand Down

0 comments on commit b137432

Please sign in to comment.