2121/** The enum Network name. */
2222public enum NetworkDefinition {
2323 /** Mainnet network name. */
24- MAINNET ("/mainnet.json" , BigInteger .valueOf (1 ), true , true ),
24+ MAINNET (
25+ "/mainnet.json" ,
26+ 1 , // chain id
27+ 1 , // network id
28+ true , // can snap sync
29+ true , // native required
30+ 60_000_000L ), // target gas limit
2531 /** Sepolia network name. */
26- SEPOLIA ("/sepolia.json" , BigInteger .valueOf (11155111 ), true , true ),
32+ SEPOLIA (
33+ "/sepolia.json" ,
34+ 11155111 , // chain id
35+ 11155111 , // network id
36+ true , // can snap sync
37+ true , // native required
38+ 60_000_000L ), // target gas limit
2739 /** Holešky network name. */
28- HOLESKY ("/holesky.json" , BigInteger .valueOf (17000 ), true , true ),
40+ HOLESKY (
41+ "/holesky.json" ,
42+ 17000 , // chain id
43+ 17000 , // network id
44+ true , // can snap sync
45+ true , // native required
46+ 60_000_000L , // target gas limit
47+ "November 2025" ),
2948 /** Hoodi network name. */
30- HOODI ("/hoodi.json" , BigInteger .valueOf (560048 ), true , true ),
49+ HOODI (
50+ "/hoodi.json" ,
51+ 560048 , // chain id
52+ 560048 , // network id
53+ true , // can snap sync
54+ true , // native required
55+ 60_000_000L ), // target gas limit
3156 /**
3257 * EPHEMERY network name. The actual networkId used is calculated based on this default value and
3358 * the current time. <a href="https://ephemery.dev/">Ephemery developer info</a>
3459 */
35- EPHEMERY ("/ephemery.json" , BigInteger .valueOf (39438135 ), true , true ),
60+ EPHEMERY (
61+ "/ephemery.json" ,
62+ 39438135 , // chain id
63+ 39438135 , // network id
64+ true , // can snap sync
65+ true , // native required
66+ 60_000_000L ), // target gas limit
3667 /**
3768 * Linea mainnet network name <a
3869 * href="https://docs.linea.build/get-started/how-to/run-a-node/besu">Linea Besu developer
3970 * info</a>
4071 */
41- LINEA_MAINNET ("/linea-mainnet.json" , BigInteger .valueOf (59144 ), true , true ),
72+ LINEA_MAINNET (
73+ "/linea-mainnet.json" ,
74+ 59144 , // chain id
75+ 59144 , // network id
76+ true , // can snap sync
77+ true , // native required
78+ 60_000_000L ), // target gas limit
4279 /** Linea sepolia network name */
43- LINEA_SEPOLIA ("/linea-sepolia.json" , BigInteger .valueOf (59141 ), true , true ),
80+ LINEA_SEPOLIA (
81+ "/linea-sepolia.json" ,
82+ 59141 , // chain id
83+ 59141 , // network id
84+ true , // can snap sync
85+ true , // native required
86+ 60_000_000L ), // target gas limit
4487 /** LUKSO mainnet network name. */
45- LUKSO ("/lukso.json" , BigInteger .valueOf (42 )),
88+ LUKSO (
89+ "/lukso.json" ,
90+ 42 , // chain id
91+ 42 , // network id
92+ true , // can snap sync
93+ false , // native required
94+ 60_000_000L ), // target gas limit
4695 /** Dev network name. */
47- DEV ("/dev.json" , BigInteger .valueOf (2018 ), false ),
96+ DEV (
97+ "/dev.json" ,
98+ 1337 , // chain id
99+ 2018 , // network id
100+ false , // can snap sync
101+ false , // native required
102+ 60_000_000L ), // target gas limit
48103 /** Future EIPs network name. */
49- FUTURE_EIPS ("/future.json" , BigInteger .valueOf (2022 ), false ),
104+ FUTURE_EIPS (
105+ "/future.json" ,
106+ 2022 , // chain id
107+ 2022 , // network id
108+ false , // can snap sync
109+ false , // native required
110+ 60_000_000L ), // target gas limit
50111 /** Experimental EIPs network name. */
51- EXPERIMENTAL_EIPS ("/experimental.json" , BigInteger .valueOf (2023 ), false ),
112+ EXPERIMENTAL_EIPS (
113+ "/experimental.json" ,
114+ 2023 , // chain id
115+ 2023 , // network id
116+ false , // can snap sync
117+ false , // native required
118+ 60_000_000L ), // target gas limit
52119 /** Classic network name. */
53- CLASSIC ("/classic.json" , BigInteger .valueOf (1 )),
120+ CLASSIC (
121+ "/classic.json" ,
122+ 61 , // chain id
123+ 1 , // network id
124+ true , // can snap sync
125+ false , // native required
126+ 60_000_000L , // target gas limit
127+ "November 2025" ),
54128 /** Mordor network name. */
55- MORDOR ("/mordor.json" , BigInteger .valueOf (7 ));
129+ MORDOR (
130+ "/mordor.json" ,
131+ 63 , // chain id
132+ 7 , // network id
133+ true , // can snap sync
134+ false , // native required
135+ 60_000_000L , // target gas limit
136+ "November 2025" );
56137
57138 private final String genesisFile ;
58- private final BigInteger networkId ;
139+ private final long chainId ;
140+ private final long networkId ;
59141 private final boolean canSnapSync ;
60- private String deprecationDate ;
142+ private final String deprecationDate ;
61143 private final boolean nativeRequired ;
62-
63- static {
64- HOLESKY .deprecationDate = "November 2025" ;
65- CLASSIC .deprecationDate = "November 2025" ;
66- MORDOR .deprecationDate = "November 2025" ;
67- }
68-
69- NetworkDefinition (final String genesisFile , final BigInteger networkId ) {
70- this (genesisFile , networkId , true );
71- }
144+ private final long targetGasLimit ;
72145
73146 NetworkDefinition (
74- final String genesisFile , final BigInteger networkId , final boolean canSnapSync ) {
75- this (genesisFile , networkId , canSnapSync , false );
147+ final String genesisFile ,
148+ final long chainId ,
149+ final long networkId ,
150+ final boolean canSnapSync ,
151+ final boolean nativeRequired ,
152+ final long targetGasLimit ) {
153+ this (genesisFile , chainId , networkId , canSnapSync , nativeRequired , targetGasLimit , null );
76154 }
77155
78156 NetworkDefinition (
79157 final String genesisFile ,
80- final BigInteger networkId ,
158+ final long chainId ,
159+ final long networkId ,
81160 final boolean canSnapSync ,
82- final boolean nativeRequired ) {
161+ final boolean nativeRequired ,
162+ final long targetGasLimit ,
163+ final String deprecationDate ) {
83164 this .genesisFile = genesisFile ;
165+ this .chainId = chainId ;
84166 this .networkId = networkId ;
85167 this .canSnapSync = canSnapSync ;
86- // no deprecations planned
87- this .deprecationDate = null ;
88168 this .nativeRequired = nativeRequired ;
169+ this .targetGasLimit = targetGasLimit ;
170+ this .deprecationDate = deprecationDate ;
89171 }
90172
91173 /**
@@ -97,13 +179,22 @@ public String getGenesisFile() {
97179 return genesisFile ;
98180 }
99181
182+ /**
183+ * Gets chain id.
184+ *
185+ * @return the chain id
186+ */
187+ public BigInteger getChainId () {
188+ return BigInteger .valueOf (chainId );
189+ }
190+
100191 /**
101192 * Gets network id.
102193 *
103194 * @return the network id
104195 */
105196 public BigInteger getNetworkId () {
106- return networkId ;
197+ return BigInteger . valueOf ( networkId ) ;
107198 }
108199
109200 /**
@@ -156,4 +247,28 @@ public Optional<String> getDeprecationDate() {
156247 public boolean hasNativeRequirements () {
157248 return nativeRequired ;
158249 }
250+
251+ /**
252+ * Gets target gas limit.
253+ *
254+ * @return the target gas limit
255+ */
256+ public long getTargetGasLimit () {
257+ return targetGasLimit ;
258+ }
259+
260+ /**
261+ * From chain id.
262+ *
263+ * @param chainId the chain id
264+ * @return the optional
265+ */
266+ public static Optional <NetworkDefinition > fromChainId (final BigInteger chainId ) {
267+ for (final NetworkDefinition network : NetworkDefinition .values ()) {
268+ if (network .getChainId ().equals (chainId )) {
269+ return Optional .of (network );
270+ }
271+ }
272+ return Optional .empty ();
273+ }
159274}
0 commit comments