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

Throwaway Withdrawals Testnet Branch (withdrawal-devnet-3) #4818

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
af166e6
Composition over inheritence
gezero Nov 16, 2022
72b418f
wip
gezero Nov 17, 2022
2f8f7b6
spotless
gezero Nov 29, 2022
7cfdd52
removing unnecessary code
gezero Nov 30, 2022
3cbfc1e
fixing npe
gezero Nov 30, 2022
2687f7e
using of shanghai schedule for Reference tests
gezero Nov 30, 2022
2d5db69
Using the shanghai Timestamp
gezero Nov 30, 2022
31e9329
spotless
siladu Dec 1, 2022
71417fc
Minor renaming
siladu Dec 1, 2022
eb7dbc6
More minor renaming
siladu Dec 1, 2022
870c84c
Add unit test for TimestampScheduleBuilder
siladu Dec 1, 2022
f9303bf
validate block using correct protocol spec
jframe Dec 1, 2022
d80952b
create block using correct protocol spec
jframe Dec 1, 2022
dc15325
validate fork timestamp order and more tests for TimestampScheduleBui…
siladu Dec 5, 2022
582a8ff
Add TransitionProtocolSchedule tests and fix make unnecessary eager e…
siladu Dec 6, 2022
cfc8ecf
Add test for ProtocolSchedule.getByBlockHeader
siladu Dec 6, 2022
5cb9bc1
Added tests for TimestampSchedule and minimised visibility
siladu Dec 6, 2022
44f4631
Tentatively add TimestampProtocolSpecAdapters so it can be discussed
siladu Dec 7, 2022
7aeaecb
Add pom checksum
siladu Dec 7, 2022
5ad6634
Remove TODOs
siladu Dec 7, 2022
0f251fd
Fixed tests - only attempt to apply modifications if we have anything…
siladu Dec 8, 2022
829e83c
When block not found, throw instead of defaulting to the potentially …
siladu Dec 8, 2022
3fb6777
Add comment
siladu Dec 8, 2022
2480436
Missed some test modifications
siladu Dec 8, 2022
5954d89
Add timestamp to toLogString for more info, not expecting it will be …
siladu Dec 8, 2022
56edfa7
Revert "When block not found, throw instead of defaulting to the pote…
siladu Dec 8, 2022
727325b
private and final
siladu Dec 12, 2022
698849e
Refactor TransitionUtils.getMergeContext, pull up PostMergeContext wi…
siladu Dec 12, 2022
f4483ca
Add PrivacySupportingProtocolSchedule interface and implement in Defa…
siladu Dec 12, 2022
bf6eb04
final
siladu Dec 13, 2022
e1522b1
Remove TimestampProtocolSpecAdapters
siladu Dec 13, 2022
06813e0
Refactor TimestampScheduleBuilder and ProtocolScheduleBuilder to use …
siladu Dec 13, 2022
34147d1
Add test and clarify names
siladu Dec 14, 2022
ac6db6b
shanghaiTimestamp -> shanghaiTime
siladu Dec 14, 2022
aae97a1
Withdrawals WIP
gezero Oct 21, 2022
9c7217a
Compiling tests
gezero Oct 23, 2022
83234b2
Reading of withdrawals is optional
gezero Oct 23, 2022
564e527
Adding validator index
gezero Nov 2, 2022
0001fe5
Add withdrawals to payloadAttributes in fcU and add to block proprosal
siladu Nov 2, 2022
4a05eec
New plugin-api hash following merge
siladu Nov 10, 2022
a9d7602
Fix withdrawal param parsing, fcU returns response now
siladu Nov 10, 2022
8c99677
Quantity param stuff, half finished
siladu Nov 10, 2022
bd95cb3
Separate apis and stuff
gezero Nov 10, 2022
9a7e44e
Fix withdrawal serialization
siladu Nov 10, 2022
09b5b3f
Support engine_newPayloadV2 and fix RLP bugs
siladu Nov 11, 2022
94f4101
Trying to get WithdrawalProcessor to work
siladu Nov 11, 2022
f88e51e
Fix test compile error from rebasing main
siladu Nov 11, 2022
50aec44
Hacky fix for unit test
siladu Nov 11, 2022
8be5622
Header now cares about withdrawals root being EMPTY
gezero Nov 11, 2022
2dd7fd3
Add toString to Withdrawal
jframe Nov 14, 2022
f0a8d65
Use UInt64 for Withdrawal index fields and fix hex serialization (toS…
siladu Nov 14, 2022
642be96
Adding shanghai fork as a block number
gezero Nov 14, 2022
0a74d39
withdrawals are now optional
gezero Nov 14, 2022
ec16f12
Not sure why this one works over the other
gezero Nov 15, 2022
0cf25c7
spotless
gezero Nov 15, 2022
2bf241a
Add pre-shanghai validation to V2 to support CLs sending V2 before Ca…
siladu Nov 21, 2022
11f3b45
Handle null withdrawals in newPayloadV2
siladu Nov 22, 2022
fa0a7db
Support pre/post-shanghai in ForkChoiceUpdatedV2
siladu Nov 23, 2022
f686447
Allow post-shanghai (AllowedWithdrawals) to work with V1 requests tha…
siladu Nov 24, 2022
cbbdaa1
validate payload attributes based on chainHead + 1 shanghai activatio…
siladu Nov 25, 2022
df82113
Disallow post-shanghai (AllowedWithdrawals) to work with V1 requests …
siladu Nov 25, 2022
731e4bb
Improve logging
siladu Nov 25, 2022
7086f2a
include withdrawalsRoot in eth_getBlock RPCs when it's not empty
jframe Nov 30, 2022
2e4cf76
Use empty trie hash in genesis for withdrawalsRoot if shanghai is ena…
jframe Nov 30, 2022
756dc01
Composition over inheritence
gezero Nov 16, 2022
c33bf34
wip
gezero Nov 17, 2022
6831a9d
spotless
gezero Nov 29, 2022
7949b90
Fix compile after merging in timestamp changes
jframe Dec 1, 2022
21955e1
Fix Besu controllers tests after genesis state change
jframe Dec 1, 2022
681da42
Change withdrawals genesis check to work off genesis timestamp
jframe Dec 1, 2022
8101200
validator fcu params using correct protocol spec
jframe Dec 1, 2022
ee8bc3c
Fix tests after merge
jframe Dec 1, 2022
6029c52
Less hacky way of using timestamp proto schedule in engine API
jframe Dec 2, 2022
8dfec0f
Minor renaming
siladu Dec 1, 2022
cc8b7f4
Add unit test for TimestampScheduleBuilder
siladu Dec 1, 2022
4bb978c
validate block using correct protocol spec
jframe Dec 1, 2022
4fe6015
create block using correct protocol spec
jframe Dec 1, 2022
c0b432b
ignore shanghai bootnode test until correct values are known
jframe Dec 2, 2022
060b317
add withdrawals back to shanghai definition after bad merge
jframe Dec 2, 2022
8bf6e46
Fix MainnetBlockBodyValidatorTest after change of MainnetBlockBodyVal…
jframe Dec 2, 2022
a76991b
ignore unknown properties on the engine fcu rpcs
jframe Dec 8, 2022
41a0c5c
revert accidental change to gradle.properties
jframe Dec 9, 2022
e9d074a
Fix test after merge
jframe Dec 9, 2022
bdc97f6
Fix compile error from git merge
siladu Dec 14, 2022
29fc15b
initial implemenation of fork id logic
gezero Dec 13, 2022
682fb7f
Wire up EIP-3651 - Warm Coinbase to shanghaiTime
siladu Dec 14, 2022
7759235
Fix compile error following cherry-pick
siladu Dec 14, 2022
a47cce6
Wire up EIP-3855 PUSH0 to shanghaiTime and disable EOF (maxEofVersion…
siladu Dec 14, 2022
36add07
Wire up EIP-3860 - Limit and Meter Initcode to shanghaiTime
siladu Dec 14, 2022
2a6a9e4
fix ForkIdsTest
jframe Dec 14, 2022
a4ba2f9
fix unit tests
jframe Dec 14, 2022
37b72d6
Fix more units related to ForkId fixes
siladu Dec 15, 2022
46f4390
Add blockValue to EngineGetPayloadResultV2
siladu Dec 20, 2022
161b70c
Add withdrawals to BlockResult for eth_getBlockByHash and eth_getBloc…
siladu Dec 20, 2022
27067a0
Attempt to fix withdrawals sync issue - write withdrawals to RLP in B…
siladu Dec 21, 2022
2a52a78
Revert "Wire up EIP-3860 - Limit and Meter Initcode to shanghaiTime"
siladu Dec 21, 2022
5543413
Revert "Wire up EIP-3855 PUSH0 to shanghaiTime and disable EOF (maxEo…
siladu Dec 21, 2022
a43135f
Revert "Wire up EIP-3651 - Warm Coinbase to shanghaiTime"
siladu Dec 21, 2022
5abf19f
Fix backwards sync issue - use getBlockByHeader to get timestamp sche…
siladu Dec 21, 2022
fdf4b1f
Revert "Revert "Wire up EIP-3651 - Warm Coinbase to shanghaiTime""
siladu Dec 21, 2022
42024ed
Revert "Revert "Wire up EIP-3855 PUSH0 to shanghaiTime and disable EO…
siladu Dec 22, 2022
8bec319
Revert "Revert "Wire up EIP-3860 - Limit and Meter Initcode to shangh…
siladu Dec 22, 2022
5dd8a34
Logging
siladu Dec 22, 2022
ddf785a
tweak paris def remove from mergespecific mods
garyschulte Dec 22, 2022
420ee05
Revert "tweak paris def remove from mergespecific mods"
siladu Dec 23, 2022
0455b22
For TimestampSchedule (Shanghai) remove evmBuilder override but leave…
siladu Dec 23, 2022
901573c
EIP-3860 Initcode Size Reference Test fixes (#4911)
shemnon Jan 13, 2023
fbf0e21
Fix invalid withdrawals root during backwards sync
siladu Jan 15, 2023
9b3f70a
Allow -Pdocker-platform during distDocker (#4828)
gezero Jan 4, 2023
d1fbcc5
Fix validation bug when V2 is called pre-shanghai
siladu Jan 16, 2023
53cb4ee
Update engine apis
wcgcyx Jan 17, 2023
da24270
Withdrawls - Change Amount type to GWei instead of Wei
usmansaleem Jan 16, 2023
60f3d25
Fix the invalid payload check order in the FCU and spotless
gfukushima Jan 17, 2023
9fe062c
Fixed forkChoiceUpdate error code and tests
gfukushima Jan 17, 2023
0cc7c2b
Fix compile error in test
siladu Jan 17, 2023
f5a3201
Fix/Disable tests
siladu Jan 17, 2023
a7c96ca
Fix withdrawals tests by changing encoding/encoding to use UInt64 sca…
jframe Jan 17, 2023
f97e694
Fix block replay to work with Shanghai blocks
siladu Jan 18, 2023
03c7f06
Add logging to help with bad block production
siladu Jan 19, 2023
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 @@ -53,6 +53,7 @@ public static BlockHeader createBlockHeader(
null,
mixHash,
new BigInteger(block.getNonceRaw().substring(2), 16).longValue(),
Hash.EMPTY,
blockHeaderFunctions);
}
}
3 changes: 2 additions & 1 deletion besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ public Runner build() {
.storageProvider(storageProvider)
.p2pTLSConfiguration(p2pTLSConfiguration)
.blockchain(context.getBlockchain())
.forks(besuController.getGenesisConfigOptions().getForks())
.blockNumberForks(besuController.getGenesisConfigOptions().getForkBlockNumbers())
.timestampForks(besuController.getGenesisConfigOptions().getForkTimestamps())
.build();

final NetworkRunner networkRunner =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public enum NetworkName {
ROPSTEN("/ropsten.json", BigInteger.valueOf(3)),
SEPOLIA("/sepolia.json", BigInteger.valueOf(11155111)),
GOERLI("/goerli.json", BigInteger.valueOf(5)),
SHANGHAI("/shanghai.json", BigInteger.valueOf(1337903)),
SHANDONG("/shandong.json", BigInteger.valueOf(1337903)),
KILN("/kiln.json", BigInteger.valueOf(1337802), false),
DEV("/dev.json", BigInteger.valueOf(2018), false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ protected EthProtocolManager createEthProtocolManager(
mergePeerFilter,
synchronizerConfiguration,
scheduler,
genesisConfig.getForks());
genesisConfig.getForkBlockNumbers(),
genesisConfig.getForkTimestamps());
}

protected ProtocolContext createProtocolContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.TimestampSchedule;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.plugin.services.MetricsSystem;

Expand Down Expand Up @@ -233,4 +234,9 @@ protected List<PeerValidator> createPeerValidators(final ProtocolSchedule protoc
}
return retval;
}

public TimestampSchedule createTimestampProtocolSchedule() {
return MergeProtocolSchedule.createTimestamp(
configOptionsSupplier.get(), privacyParameters, isRevertReasonEnabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
import org.hyperledger.besu.crypto.NodeKey;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.ConsensusContext;
import org.hyperledger.besu.ethereum.ConsensusContextFactory;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Synchronizer;
Expand Down Expand Up @@ -75,6 +77,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder {
private final MergeBesuControllerBuilder mergeBesuControllerBuilder;

private static final Logger LOG = LoggerFactory.getLogger(TransitionBesuControllerBuilder.class);
private TransitionProtocolSchedule transitionProtocolSchedule;

public TransitionBesuControllerBuilder(
final BesuControllerBuilder preMergeBesuControllerBuilder,
Expand Down Expand Up @@ -165,9 +168,26 @@ protected EthProtocolManager createEthProtocolManager(

@Override
protected ProtocolSchedule createProtocolSchedule() {
return new TransitionProtocolSchedule(
preMergeBesuControllerBuilder.createProtocolSchedule(),
mergeBesuControllerBuilder.createProtocolSchedule());
transitionProtocolSchedule =
new TransitionProtocolSchedule(
preMergeBesuControllerBuilder.createProtocolSchedule(),
mergeBesuControllerBuilder.createProtocolSchedule(),
PostMergeContext.get(),
mergeBesuControllerBuilder.createTimestampProtocolSchedule());
return transitionProtocolSchedule;
}

@Override
protected ProtocolContext createProtocolContext(
final MutableBlockchain blockchain,
final WorldStateArchive worldStateArchive,
final ProtocolSchedule protocolSchedule,
final ConsensusContextFactory consensusContextFactory) {
final ProtocolContext protocolContext =
super.createProtocolContext(
blockchain, worldStateArchive, protocolSchedule, consensusContextFactory);
transitionProtocolSchedule.setProtocolContext(protocolContext);
return protocolContext;
}

@Override
Expand Down
16 changes: 10 additions & 6 deletions besu/src/test/java/org/hyperledger/besu/ForkIdsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.forkid.ForkId;
import org.hyperledger.besu.ethereum.forkid.ForkIdManager;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.MutableProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.evm.internal.EvmConfiguration;

Expand Down Expand Up @@ -192,19 +192,23 @@ public void testForkId() {
MainnetProtocolSchedule.fromConfig(configOptions, EvmConfiguration.DEFAULT);
final GenesisState genesisState = GenesisState.fromConfig(genesisConfigFile, schedule);
final Blockchain mockBlockchain = mock(Blockchain.class);
final BlockHeader mockBlockHeader = mock(BlockHeader.class);

when(mockBlockchain.getGenesisBlock()).thenReturn(genesisState.getBlock());

final AtomicLong blockNumber = new AtomicLong();
when(mockBlockchain.getChainHeadBlockNumber()).thenAnswer(o -> blockNumber.get());
when(mockBlockchain.getChainHeadHeader()).thenReturn(mockBlockHeader);
when(mockBlockHeader.getNumber()).thenAnswer(o -> blockNumber.get());

final ForkIdManager forkIdManager =
new ForkIdManager(mockBlockchain, genesisConfigFile.getForks(), false);
new ForkIdManager(
mockBlockchain,
genesisConfigFile.getForkBlockNumbers(),
genesisConfigFile.getForkTimestamps(),
false);

final var actualForkIds =
Streams.concat(
((MutableProtocolSchedule) schedule).streamMilestoneBlocks(),
Stream.of(Long.MAX_VALUE))
Streams.concat(schedule.streamMilestoneBlocks(), Stream.of(Long.MAX_VALUE))
.map(
block -> {
blockNumber.set(block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public void setup() {
when(besuController.getMiningCoordinator()).thenReturn(mock(MiningCoordinator.class));
when(besuController.getMiningCoordinator()).thenReturn(mock(MergeMiningCoordinator.class));
final GenesisConfigOptions genesisConfigOptions = mock(GenesisConfigOptions.class);
when(genesisConfigOptions.getForks()).thenReturn(Collections.emptyList());
when(genesisConfigOptions.getForkBlockNumbers()).thenReturn(Collections.emptyList());
when(genesisConfigOptions.getForkTimestamps()).thenReturn(Collections.emptyList());
when(besuController.getGenesisConfigOptions()).thenReturn(genesisConfigOptions);
}

Expand Down
40 changes: 40 additions & 0 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import static org.hyperledger.besu.cli.config.NetworkName.ROPSTEN;
import static org.hyperledger.besu.cli.config.NetworkName.SEPOLIA;
import static org.hyperledger.besu.cli.config.NetworkName.SHANDONG;
import static org.hyperledger.besu.cli.config.NetworkName.SHANGHAI;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPENDENCY_WARNING_MSG;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATION_WARNING_MSG;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.ENGINE;
Expand Down Expand Up @@ -1044,6 +1045,23 @@ public void testGenesisPathRinkebyEthConfig() {
assertThat(config.getNetworkId()).isEqualTo(BigInteger.valueOf(4));
}

@Ignore
@Test
public void testGenesisPathShanghaiEthConfig() {
final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);

parseCommand("--network", "shanghai");

verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
verify(mockControllerBuilder).build();

final EthNetworkConfig config = networkArg.getValue();
assertThat(config.getBootNodes()).isEqualTo(SHANDONG_BOOTSTRAP_NODES);
assertThat(config.getDnsDiscoveryUrl()).isNull();
assertThat(config.getNetworkId()).isEqualTo(BigInteger.valueOf(1337903));
}

@Test
public void testGenesisPathShandongEthConfig() {
final ArgumentCaptor<EthNetworkConfig> networkArg =
Expand Down Expand Up @@ -4009,6 +4027,24 @@ public void sepoliaValuesAreUsed() {
verify(mockLogger, never()).warn(contains("Sepolia is deprecated and will be shutdown"));
}

@Test
public void shanghaiValuesAreUsed() {
parseCommand("--network", "shanghai");

final ArgumentCaptor<EthNetworkConfig> networkArg =
ArgumentCaptor.forClass(EthNetworkConfig.class);

verify(mockControllerBuilderFactory).fromEthNetworkConfig(networkArg.capture(), any());
verify(mockControllerBuilder).build();

assertThat(networkArg.getValue()).isEqualTo(EthNetworkConfig.getNetworkConfig(SHANGHAI));

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();

verify(mockLogger, never()).warn(contains("Shanghai is deprecated and will be shutdown"));
}

@Test
public void shandongValuesAreUsed() {
parseCommand("--network", "shandong");
Expand Down Expand Up @@ -4090,6 +4126,10 @@ public void ropstenValuesCanBeOverridden() throws Exception {
networkValuesCanBeOverridden("ropsten");
}

public void shanghaiValuesCanBeOverridden() throws Exception {
networkValuesCanBeOverridden("shanghai");
}

public void shandongValuesCanBeOverridden() throws Exception {
networkValuesCanBeOverridden("shandong");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void setup() {
when(genesisConfigFile.getMixHash()).thenReturn(Hash.ZERO.toHexString());
when(genesisConfigFile.getNonce()).thenReturn(Long.toHexString(1));
when(genesisConfigFile.getConfigOptions(any())).thenReturn(genesisConfigOptions);
when(genesisConfigFile.getConfigOptions()).thenReturn(genesisConfigOptions);
when(genesisConfigOptions.getThanosBlockNumber()).thenReturn(OptionalLong.empty());
when(genesisConfigOptions.getEthashConfigOptions()).thenReturn(ethashConfigOptions);
when(genesisConfigOptions.getCheckpointOptions()).thenReturn(checkpointConfigOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void setup() {
when(genesisConfigFile.getMixHash()).thenReturn(Hash.ZERO.toHexString());
when(genesisConfigFile.getNonce()).thenReturn(Long.toHexString(1));
when(genesisConfigFile.getConfigOptions(any())).thenReturn(genesisConfigOptions);
when(genesisConfigFile.getConfigOptions()).thenReturn(genesisConfigOptions);
when(genesisConfigOptions.getCheckpointOptions()).thenReturn(checkpointConfigOptions);
when(genesisConfigOptions.getTerminalTotalDifficulty())
.thenReturn((Optional.of(UInt256.valueOf(100L))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void setup() {
when(genesisConfigFile.getMixHash()).thenReturn(Hash.ZERO.toHexString());
when(genesisConfigFile.getNonce()).thenReturn(Long.toHexString(1));
when(genesisConfigFile.getConfigOptions(any())).thenReturn(genesisConfigOptions);
when(genesisConfigFile.getConfigOptions()).thenReturn(genesisConfigOptions);
when(genesisConfigOptions.getCheckpointOptions()).thenReturn(checkpointConfigOptions);
when(storageProvider.createBlockchainStorage(any()))
.thenReturn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderValidator;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.mainnet.TimestampSchedule;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
Expand All @@ -66,6 +67,7 @@ public class TransitionControllerBuilderTest {

@Mock ProtocolSchedule preMergeProtocolSchedule;
@Mock ProtocolSchedule postMergeProtocolSchedule;
@Mock TimestampSchedule timestampSchedule;
@Mock ProtocolContext protocolContext;
@Mock MutableBlockchain mockBlockchain;
@Mock TransactionPool transactionPool;
Expand All @@ -86,7 +88,11 @@ public void setup() {
transitionProtocolSchedule =
spy(
new TransitionProtocolSchedule(
preMergeProtocolSchedule, postMergeProtocolSchedule, mergeContext));
preMergeProtocolSchedule,
postMergeProtocolSchedule,
mergeContext,
timestampSchedule));
transitionProtocolSchedule.setProtocolContext(protocolContext);
cliqueBuilder.nodeKey(NodeKeyUtils.generate());
postMergeBuilder.storageProvider(storageProvider);
when(protocolContext.getBlockchain()).thenReturn(mockBlockchain);
Expand Down Expand Up @@ -126,7 +132,7 @@ public void assertPreMergeScheduleForNotPostMerge() {
when(mergeContext.isPostMerge()).thenReturn(Boolean.FALSE);
when(mergeContext.getFinalized()).thenReturn(Optional.empty());
when(preMergeProtocolSchedule.getByBlockNumber(anyLong())).thenReturn(preMergeProtocolSpec);
assertThat(transitionProtocolSchedule.getByBlockHeader(protocolContext, mockBlock))
assertThat(transitionProtocolSchedule.getByBlockHeader(mockBlock))
.isEqualTo(preMergeProtocolSpec);
}

Expand All @@ -136,7 +142,7 @@ public void assertPostMergeScheduleForAnyBlockWhenPostMergeAndFinalized() {
var postMergeProtocolSpec = mock(ProtocolSpec.class);
when(mergeContext.getFinalized()).thenReturn(Optional.of(mockBlock));
when(postMergeProtocolSchedule.getByBlockNumber(anyLong())).thenReturn(postMergeProtocolSpec);
assertThat(transitionProtocolSchedule.getByBlockHeader(protocolContext, mockBlock))
assertThat(transitionProtocolSchedule.getByBlockHeader(mockBlock))
.isEqualTo(postMergeProtocolSpec);
}

Expand All @@ -159,7 +165,7 @@ public void assertPreMergeScheduleForBelowTerminalBlockWhenPostMergeIfNotFinaliz
.thenReturn(Optional.of(Difficulty.of(1335L)));

when(preMergeProtocolSchedule.getByBlockNumber(anyLong())).thenReturn(preMergeProtocolSpec);
assertThat(transitionProtocolSchedule.getByBlockHeader(protocolContext, mockBlock))
assertThat(transitionProtocolSchedule.getByBlockHeader(mockBlock))
.isEqualTo(preMergeProtocolSpec);
}

Expand All @@ -182,7 +188,7 @@ public void assertPostMergeScheduleForPostMergeExactlyAtTerminalDifficultyIfNotF
.thenReturn(Optional.of(Difficulty.of(1337L)));

when(postMergeProtocolSchedule.getByBlockNumber(anyLong())).thenReturn(postMergeProtocolSpec);
assertThat(transitionProtocolSchedule.getByBlockHeader(protocolContext, mockBlock))
assertThat(transitionProtocolSchedule.getByBlockHeader(mockBlock))
.isEqualTo(postMergeProtocolSpec);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ private void setSyncTarget() {
syncState.setSyncTarget(
mock(EthPeer.class),
new org.hyperledger.besu.ethereum.core.BlockHeader(
null, null, null, null, null, null, null, null, 1, 1, 1, 1, null, null, null, 1, null));
null, null, null, null, null, null, null, null, 1, 1, 1, 1, null, null, null, 1, null,
null));
}

private void clearSyncTarget() {
Expand Down Expand Up @@ -484,7 +485,8 @@ public void logEventDoesNotFireAfterUnsubscribe() {
}

private Block generateBlock() {
final BlockBody body = new BlockBody(Collections.emptyList(), Collections.emptyList());
final BlockBody body =
new BlockBody(Collections.emptyList(), Collections.emptyList(), Optional.empty());
return new Block(new BlockHeaderTestFixture().buildHeader(), body);
}

Expand Down
Loading