|
|
|
@ -12,21 +12,19 @@ |
|
|
|
|
* |
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 |
|
|
|
|
*/ |
|
|
|
|
package org.hyperledger.besu.ethereum.eth.manager; |
|
|
|
|
package org.hyperledger.besu.ethereum.forkid; |
|
|
|
|
|
|
|
|
|
import static com.google.common.primitives.Longs.asList; |
|
|
|
|
import static java.util.Collections.emptyList; |
|
|
|
|
import static java.util.Optional.empty; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.hyperledger.besu.ethereum.eth.ForkIdTestUtil.mockBlockchain; |
|
|
|
|
import static org.hyperledger.besu.ethereum.eth.ForkIdTestUtil.wantPeerCheck; |
|
|
|
|
import static org.hyperledger.besu.ethereum.forkid.ForkIdTestUtil.mockBlockchain; |
|
|
|
|
import static org.hyperledger.besu.ethereum.forkid.ForkIdTestUtil.wantPeerCheck; |
|
|
|
|
|
|
|
|
|
import org.hyperledger.besu.ethereum.eth.ForkIdTestUtil; |
|
|
|
|
import org.hyperledger.besu.ethereum.eth.ForkIdTestUtil.ForkIds; |
|
|
|
|
import org.hyperledger.besu.ethereum.eth.ForkIdTestUtil.GenesisHash; |
|
|
|
|
import org.hyperledger.besu.ethereum.eth.ForkIdTestUtil.Network; |
|
|
|
|
import org.hyperledger.besu.ethereum.eth.ForkIdTestUtil.PeerCheckCase; |
|
|
|
|
import org.hyperledger.besu.ethereum.forkid.ForkId; |
|
|
|
|
import org.hyperledger.besu.ethereum.forkid.ForkIdManager; |
|
|
|
|
import org.hyperledger.besu.ethereum.forkid.ForkIdTestUtil.ForkIds; |
|
|
|
|
import org.hyperledger.besu.ethereum.forkid.ForkIdTestUtil.GenesisHash; |
|
|
|
|
import org.hyperledger.besu.ethereum.forkid.ForkIdTestUtil.Network; |
|
|
|
|
import org.hyperledger.besu.ethereum.forkid.ForkIdTestUtil.PeerCheckCase; |
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Collection; |
|
|
|
@ -42,8 +40,8 @@ import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
@RunWith(Parameterized.class) |
|
|
|
|
public class EIP2124Test { |
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(EIP2124Test.class); |
|
|
|
|
public class ForkIdTest { |
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(ForkIdTest.class); |
|
|
|
|
|
|
|
|
|
@Parameters(name = "{index}: {0}") |
|
|
|
|
public static Collection<Object[]> data() { |
|
|
|
@ -54,6 +52,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Unsynced", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xfc64ec04", 1150000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -62,6 +61,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Homestead block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
1150000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x97c2c34c", 1920000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -70,6 +70,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Homestead block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
1919999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x97c2c34c", 1920000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -78,6 +79,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First DAO block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
1920000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x91d1f948", 2463000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -86,6 +88,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last DAO block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
2462999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x91d1f948", 2463000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -94,6 +97,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Tangerine block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
2463000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x7a64da13", 2675000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -102,6 +106,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Tangerine block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
2674999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x7a64da13", 2675000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -110,6 +115,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Spurious block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
2675000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x3edd5b10", 4370000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -118,6 +124,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Spurious block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
4369999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x3edd5b10", 4370000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -126,6 +133,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Byzantium block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
4370000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xa00bc324", 7280000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -134,6 +142,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Byzantium block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7279999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xa00bc324", 7280000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -142,6 +151,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First and last Constantinople, first Petersburg block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7280000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x668db0af", 9069000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -150,6 +160,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Petersburg block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
9068999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x668db0af", 9069000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -158,6 +169,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Istanbul block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
9069000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x879d6e30", 9200000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -166,6 +178,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Istanbul block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
9199999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x879d6e30", 9200000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -174,6 +187,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Muir Glacier block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
9200000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xe029e991", 12244000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -182,6 +196,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Muir Glacier block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
12243999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xe029e991", 12244000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -190,6 +205,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Berlin block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
12244000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x0eb440f6", 12965000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -198,6 +214,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last Berlin block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
12964999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x0eb440f6", 12965000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -206,6 +223,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First London block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
12965000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xb715077d", 13773000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -214,6 +232,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Last London block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
13772999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xb715077d", 13773000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -222,6 +241,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Arrow Glacier block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
13773000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x20c327fc", 15050000L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -230,6 +250,7 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // First Gray Glacier block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
15050000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xf0afd0e3", 0L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
@ -238,15 +259,55 @@ public class EIP2124Test { |
|
|
|
|
"Mainnet // Future Gray Glacier block", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
20000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xf0afd0e3", 0L), |
|
|
|
|
Optional.of(ForkIds.MAINNET), |
|
|
|
|
empty() |
|
|
|
|
}, |
|
|
|
|
// Fork ID test cases with block number and timestamp based forks
|
|
|
|
|
// Withdrawals test cases
|
|
|
|
|
{ |
|
|
|
|
"Mainnet Withdrawals // First Merge Start block", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
18000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x4fb8a872", 1668000000L), |
|
|
|
|
Optional.of(ForkIdTestUtil.ForkIds.WITHDRAWALS), |
|
|
|
|
empty() |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"Mainnet Withdrawals // Last Merge Start block", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x4fb8a872", 1668000000L), |
|
|
|
|
Optional.of(ForkIdTestUtil.ForkIds.WITHDRAWALS), |
|
|
|
|
empty() |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"Mainnet Withdrawals // First Shanghai block", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000000L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc1fdf181", 0L), |
|
|
|
|
Optional.of(ForkIdTestUtil.ForkIds.WITHDRAWALS), |
|
|
|
|
empty() |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"Mainnet Withdrawals // Last Shanghai block", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20100000L, |
|
|
|
|
2669000000L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc1fdf181", 0L), |
|
|
|
|
Optional.of(ForkIdTestUtil.ForkIds.WITHDRAWALS), |
|
|
|
|
empty() |
|
|
|
|
}, |
|
|
|
|
// Ropsten test cases
|
|
|
|
|
{ |
|
|
|
|
"Ropsten // Unsynced, last Frontier, Homestead and first Tangerine block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x30c7ddbc", 10L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -255,6 +316,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // Last Tangerine block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
9L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x30c7ddbc", 10L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -263,6 +325,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Spurious block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
10L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x63760190", 1700000L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -271,6 +334,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // Last Spurious block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
1699999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x63760190", 1700000L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -279,6 +343,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Byzantium block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
1700000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x3ea159c7", 4230000L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -287,6 +352,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Byzantium block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
4229999L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x3ea159c7", 4230000L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -295,6 +361,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Constantinople block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
4230000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x97b544f3", 4939394L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -303,6 +370,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // Last Constantinople block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
4939393L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x97b544f3", 4939394L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -311,6 +379,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Petersburg block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
4939394L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xd6e2149b", 6485846L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -319,6 +388,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // Last Petersburg block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
6485845L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xd6e2149b", 6485846L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -327,6 +397,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Istanbul block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
6485846L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x4bc66396", 7117117L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -335,6 +406,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // Last Istanbul block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
7117116L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x4bc66396", 7117117L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -343,6 +415,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // First Muir Glacier block", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
7117117L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x6727ef90", 0L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -351,6 +424,7 @@ public class EIP2124Test { |
|
|
|
|
"Ropsten // Future", |
|
|
|
|
Network.ROPSTEN, |
|
|
|
|
7500000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x6727ef90", 0L), |
|
|
|
|
Optional.of(ForkIds.ROPSTEN), |
|
|
|
|
empty() |
|
|
|
@ -360,6 +434,7 @@ public class EIP2124Test { |
|
|
|
|
"Sepolia // mergenetsplit block", |
|
|
|
|
Network.SEPOLIA, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xfe3366e7", 1735371L), |
|
|
|
|
Optional.of(ForkIds.SEPOLIA), |
|
|
|
|
empty() |
|
|
|
@ -368,6 +443,7 @@ public class EIP2124Test { |
|
|
|
|
"Sepolia // Future", |
|
|
|
|
Network.SEPOLIA, |
|
|
|
|
1735371L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xb96cbd13", 0L), |
|
|
|
|
Optional.of(ForkIds.SEPOLIA), |
|
|
|
|
empty() |
|
|
|
@ -377,6 +453,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // Unsynced, last Frontier block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x3b8e0691", 1L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -385,6 +462,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First and last Homestead block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
1L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x60949295", 2L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -393,6 +471,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First and last Tangerine block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
2L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x8bde40dd", 3L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -401,6 +480,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First Spurious block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
3L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xcb3a64bb", 1035301L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -409,6 +489,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // Last Spurious block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
1035300L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xcb3a64bb", 1035301L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -417,6 +498,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First Byzantium block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
1035301L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x8d748b57", 3660663L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -425,6 +507,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // Last Byzantium block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
3660662L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x8d748b57", 3660663L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -433,6 +516,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First Constantinople block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
3660663L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xe49cab14", 4321234L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -441,6 +525,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // Last Constantinople block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
4321233L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xe49cab14", 4321234L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -449,6 +534,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First Petersburg block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
4321234L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xafec6b27", 5435345L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -457,6 +543,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // Last Petersburg block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
5435344L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xafec6b27", 5435345L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -465,6 +552,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // First Istanbul block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
5435345L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xcbdb8838", 0L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -473,6 +561,7 @@ public class EIP2124Test { |
|
|
|
|
"Rinkeby // Future Istanbul block", |
|
|
|
|
Network.RINKEBY, |
|
|
|
|
6000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xcbdb8838", 0L), |
|
|
|
|
Optional.of(ForkIds.RINKEBY), |
|
|
|
|
empty() |
|
|
|
@ -482,6 +571,7 @@ public class EIP2124Test { |
|
|
|
|
"Goerli // Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople and first Petersburg block", |
|
|
|
|
Network.GOERLI, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xa3f5ab08", 1561651L), |
|
|
|
|
Optional.of(ForkIds.GOERLI), |
|
|
|
|
empty() |
|
|
|
@ -490,6 +580,7 @@ public class EIP2124Test { |
|
|
|
|
"Goerli // Last Petersburg block", |
|
|
|
|
Network.GOERLI, |
|
|
|
|
1561650L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xa3f5ab08", 1561651L), |
|
|
|
|
Optional.of(ForkIds.GOERLI), |
|
|
|
|
empty() |
|
|
|
@ -498,6 +589,7 @@ public class EIP2124Test { |
|
|
|
|
"Goerli // First Istanbul block", |
|
|
|
|
Network.GOERLI, |
|
|
|
|
1561651L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc25efa5c", 0L), |
|
|
|
|
Optional.of(ForkIds.GOERLI), |
|
|
|
|
empty() |
|
|
|
@ -506,6 +598,7 @@ public class EIP2124Test { |
|
|
|
|
"Goerli // Future Istanbul block", |
|
|
|
|
Network.GOERLI, |
|
|
|
|
2000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc25efa5c", 0L), |
|
|
|
|
Optional.of(ForkIds.GOERLI), |
|
|
|
|
empty() |
|
|
|
@ -515,6 +608,7 @@ public class EIP2124Test { |
|
|
|
|
"Shandong // Unsynced", |
|
|
|
|
Network.SHANDONG, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc42480d3", 0L), |
|
|
|
|
empty(), |
|
|
|
|
empty() |
|
|
|
@ -523,6 +617,7 @@ public class EIP2124Test { |
|
|
|
|
"Shandong // First block", |
|
|
|
|
Network.SHANDONG, |
|
|
|
|
1L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc42480d3", 0L), |
|
|
|
|
empty(), |
|
|
|
|
empty() |
|
|
|
@ -531,6 +626,7 @@ public class EIP2124Test { |
|
|
|
|
"Shandong // Future block", |
|
|
|
|
Network.SHANDONG, |
|
|
|
|
1000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0xc42480d3", 0L), |
|
|
|
|
empty(), |
|
|
|
|
empty() |
|
|
|
@ -540,6 +636,7 @@ public class EIP2124Test { |
|
|
|
|
"Private // Unsynced", |
|
|
|
|
Network.PRIVATE, |
|
|
|
|
0L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x190a55ad", 0L), |
|
|
|
|
empty(), |
|
|
|
|
empty() |
|
|
|
@ -548,6 +645,7 @@ public class EIP2124Test { |
|
|
|
|
"Private // First block", |
|
|
|
|
Network.PRIVATE, |
|
|
|
|
1L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x190a55ad", 0L), |
|
|
|
|
empty(), |
|
|
|
|
empty() |
|
|
|
@ -556,6 +654,7 @@ public class EIP2124Test { |
|
|
|
|
"Private // Future block", |
|
|
|
|
Network.PRIVATE, |
|
|
|
|
1000000L, |
|
|
|
|
0L, |
|
|
|
|
ForkIdTestUtil.wantForkId("0x190a55ad", 0L), |
|
|
|
|
empty(), |
|
|
|
|
empty() |
|
|
|
@ -565,6 +664,7 @@ public class EIP2124Test { |
|
|
|
|
"check1PetersburgWithRemoteAnnouncingTheSame", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x668db0af", 0L, true) |
|
|
|
@ -573,6 +673,7 @@ public class EIP2124Test { |
|
|
|
|
"check2PetersburgWithRemoteAnnouncingTheSameAndNextFork", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x668db0af", Long.MAX_VALUE, true) |
|
|
|
@ -581,6 +682,7 @@ public class EIP2124Test { |
|
|
|
|
"check3ByzantiumAwareOfPetersburgRemoteUnawareOfPetersburg", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7279999L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 0L, true) |
|
|
|
@ -589,6 +691,7 @@ public class EIP2124Test { |
|
|
|
|
"check4ByzantiumAwareOfPetersburgRemoteAwareOfPetersburg", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 7280000L, true) |
|
|
|
@ -597,6 +700,7 @@ public class EIP2124Test { |
|
|
|
|
"check5ByzantiumAwareOfPetersburgRemoteAnnouncingUnknownFork", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7279999L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", Long.MAX_VALUE, true) |
|
|
|
@ -605,6 +709,7 @@ public class EIP2124Test { |
|
|
|
|
"check6PetersburgWithRemoteAnnouncingByzantiumAwareOfPetersburg", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x668db0af", 7280000L, true) |
|
|
|
@ -613,6 +718,7 @@ public class EIP2124Test { |
|
|
|
|
"check7PetersburgWithRemoteAnnouncingSpuriousAwareOfByzantiumRemoteMayNeedUpdate", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x3edd5b10", 4370000L, true) |
|
|
|
@ -621,6 +727,7 @@ public class EIP2124Test { |
|
|
|
|
"check8ByzantiumWithRemoteAnnouncingPetersburgLocalOutOfSync", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
727999L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x668db0af", 0L, true) |
|
|
|
@ -629,6 +736,7 @@ public class EIP2124Test { |
|
|
|
|
"check9SpuriousWithRemoteAnnouncingByzantiumRemoteUnawareOfPetersburg", |
|
|
|
|
Network.MAINNET, |
|
|
|
|
4369999L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 0L, true) |
|
|
|
@ -637,8 +745,10 @@ public class EIP2124Test { |
|
|
|
|
"check10PetersburgWithRemoteAnnouncingByzantiumRemoteUnawareOfAdditionalForks", |
|
|
|
|
Network.network( |
|
|
|
|
GenesisHash.MAINNET, |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L)), |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L), |
|
|
|
|
emptyList()), |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 0L, false) |
|
|
|
@ -647,8 +757,10 @@ public class EIP2124Test { |
|
|
|
|
"check11PetersburgWithRemoteAnnouncingPetersburgAndFutureForkLocalNeedsUpdate", |
|
|
|
|
Network.network( |
|
|
|
|
GenesisHash.MAINNET, |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L)), |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L), |
|
|
|
|
emptyList()), |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x5cddc0e1", 0L, false) |
|
|
|
@ -657,8 +769,10 @@ public class EIP2124Test { |
|
|
|
|
"check12ByzantiumWithRemoteAnnouncingPetersburgAndFutureForkLocalNeedsUpdate", |
|
|
|
|
ForkIdTestUtil.Network.network( |
|
|
|
|
GenesisHash.MAINNET, |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L)), |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L), |
|
|
|
|
emptyList()), |
|
|
|
|
7279999L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x5cddc0e1", 0L, false) |
|
|
|
@ -667,11 +781,149 @@ public class EIP2124Test { |
|
|
|
|
"check13ByzantiumWithRemoteAnnouncingRinkebyPetersburg", |
|
|
|
|
Network.network( |
|
|
|
|
GenesisHash.MAINNET, |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L)), |
|
|
|
|
asList(1150000L, 1920000L, 2463000L, 2675000L, 4370000L, 7280000L), |
|
|
|
|
emptyList()), |
|
|
|
|
7987396L, |
|
|
|
|
0L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xafec6b27", 0L, false) |
|
|
|
|
}, |
|
|
|
|
// Timestamp based peer check cases adapted from EIP-6122 test cases
|
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck1ShanghaiWithRemoteAnnouncingTheSame", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xc1fdf181", 0L, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck2ShanghaiWithRemoteAnnouncingSameAndNextFork", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xc1fdf181", Long.MAX_VALUE, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck3ByzantiumWithRemoteAnnouncingByzantiumNotAwareOfPetersburg", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
7279999L, |
|
|
|
|
1667999999L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 0L, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck4ByzantiumWithRemoteAnnouncingByzantiumAwareOfPetersburg", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
7279999L, |
|
|
|
|
1667999999L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 7280000L, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck5ByzantiumWithRemoteAnnouncingByzantiumAwareOfUnknownFork", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
7279999L, |
|
|
|
|
1667999999L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", Long.MAX_VALUE, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck6ExactlyShanghaiWithRemoteAnnouncingByzantiumAwareOfPetersburgRemoteOutOfSync", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000000L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 7280000L, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck7ShanghaiWithRemoteAnnouncingByzantiumAwareOfPetersburgRemoteOutOfSync", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 7280000L, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck8ShanghaiWithRemoteAnnouncingSpuriousAwareOfByzantium", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x3edd5b10", 4370000, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck9ByzantiumWithRemoteAnnouncingPetersburgLocalOutOfSync", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
7279999L, |
|
|
|
|
1667999999L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x668db0af", 4370000, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck10SpuriousWithRemoteAnnouncingByzantiumNotAwareOfPetersburgLocalOutOfSync", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
4369999L, |
|
|
|
|
1667999999L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 0L, true) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck11ShanghaiWithRemoteAnnouncingByzantiumUnawareOfAdditionalForksRemoteNeedsUpdate", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 0L, false) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck12ShanghaiAndNotAwareOfAdditionalForksWithRemoteAnnouncingPetersburgAndUnknownFork", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0x5cddc0e1", 0L, false) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck13ShanghaiWithRemoteAnnouncingRinkebyPetersburg", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
20000000L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xafec6b27", 0L, false) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck14ShanghaiWithRemoteAnnouncingUnknownFork", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
88888888L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xf0afd0e3", 88888888L, false) |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"withdrawalsCheck15ShanghaiWithRemoteInByzantiumAnnouncingUnknownFork", |
|
|
|
|
Network.MAINNET_WITH_SHANGHAI, |
|
|
|
|
88888888L, |
|
|
|
|
1668000001L, |
|
|
|
|
empty(), |
|
|
|
|
empty(), |
|
|
|
|
wantPeerCheck("0xa00bc324", 7279999L, false) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -679,6 +931,7 @@ public class EIP2124Test { |
|
|
|
|
private final String name; |
|
|
|
|
private final Network network; |
|
|
|
|
private final long head; |
|
|
|
|
private final long time; |
|
|
|
|
private final Optional<ForkId> wantForkId; |
|
|
|
|
private final Optional<List<ForkId>> wantForkIds; |
|
|
|
|
private final Optional<PeerCheckCase> wantPeerCheckCase; |
|
|
|
@ -687,11 +940,15 @@ public class EIP2124Test { |
|
|
|
|
public void test() { |
|
|
|
|
LOG.info("Running test case {}", name); |
|
|
|
|
final ForkIdManager forkIdManager = |
|
|
|
|
new ForkIdManager(mockBlockchain(network.hash, head), network.forks, false); |
|
|
|
|
new ForkIdManager( |
|
|
|
|
mockBlockchain(network.hash, head, time), |
|
|
|
|
network.blockForks, |
|
|
|
|
network.timestampForks, |
|
|
|
|
false); |
|
|
|
|
wantForkId.ifPresent( |
|
|
|
|
forkId -> assertThat(forkIdManager.getForkIdForChainHead()).isEqualTo(forkId)); |
|
|
|
|
wantForkIds.ifPresent( |
|
|
|
|
forkIds -> assertThat(forkIdManager.getForkIds()).containsExactlyElementsOf(forkIds)); |
|
|
|
|
forkIds -> assertThat(forkIdManager.getAllForkIds()).containsExactlyElementsOf(forkIds)); |
|
|
|
|
wantPeerCheckCase.ifPresent( |
|
|
|
|
peerCheckCase -> |
|
|
|
|
assertThat( |
|
|
|
@ -702,16 +959,18 @@ public class EIP2124Test { |
|
|
|
|
.isEqualTo(peerCheckCase.want)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public EIP2124Test( |
|
|
|
|
public ForkIdTest( |
|
|
|
|
final String name, |
|
|
|
|
final ForkIdTestUtil.Network network, |
|
|
|
|
final long head, |
|
|
|
|
final long time, |
|
|
|
|
final Optional<ForkId> wantForkId, |
|
|
|
|
final Optional<List<ForkId>> wantForkIds, |
|
|
|
|
final Optional<PeerCheckCase> wantPeerCheckCase) { |
|
|
|
|
this.name = name; |
|
|
|
|
this.network = network; |
|
|
|
|
this.head = head; |
|
|
|
|
this.time = time; |
|
|
|
|
this.wantForkId = wantForkId; |
|
|
|
|
this.wantForkIds = wantForkIds; |
|
|
|
|
this.wantPeerCheckCase = wantPeerCheckCase; |