|
| 1 | +# Copyright (c) 2020-2021 Status Research & Development GmbH |
| 2 | +# Licensed and distributed under either of |
| 3 | +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). |
| 4 | +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). |
| 5 | +# at your option. This file may not be copied, modified, or distributed except according to those terms. |
| 6 | + |
1 | 7 | import |
2 | 8 | tables, strutils, os, |
3 | 9 | stew/shims/macros, nimcrypto/hash, |
|
68 | 74 | incompatibilityDesc*: string |
69 | 75 |
|
70 | 76 | const |
71 | | - eth2testnetsDir = currentSourcePath.parentDir / ".." / "vendor" / "eth2-testnets" |
| 77 | + eth2testnetsDir = currentSourcePath.parentDir.replace('\\', '/') & "/../vendor/eth2-testnets" |
72 | 78 |
|
73 | 79 | const presetValueLoaders = genExpr(nnkBracket): |
74 | 80 | for constName in PresetValue: |
@@ -107,12 +113,12 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata |
107 | 113 | {.raises: [CatchableError, Defect].} = |
108 | 114 | try: |
109 | 115 | let |
110 | | - genesisPath = path / "genesis.ssz" |
111 | | - genesisDepositsSnapshotPath = path / "genesis_deposit_contract_snapshot.ssz" |
112 | | - configPath = path / "config.yaml" |
113 | | - depositContractPath = path / "deposit_contract.txt" |
114 | | - depositContractBlockPath = path / "deposit_contract_block.txt" |
115 | | - bootstrapNodesPath = path / "bootstrap_nodes.txt" |
| 116 | + genesisPath = path & "/genesis.ssz" |
| 117 | + genesisDepositsSnapshotPath = path & "/genesis_deposit_contract_snapshot.ssz" |
| 118 | + configPath = path & "/config.yaml" |
| 119 | + depositContractPath = path & "/deposit_contract.txt" |
| 120 | + depositContractBlockPath = path & "/deposit_contract_block.txt" |
| 121 | + bootstrapNodesPath = path & "/bootstrap_nodes.txt" |
116 | 122 |
|
117 | 123 | runtimePreset = if fileExists(configPath): |
118 | 124 | extractRuntimePreset(configPath, readPresetFile(configPath)) |
@@ -164,27 +170,27 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata |
164 | 170 | incompatibilityDesc: err.msg) |
165 | 171 |
|
166 | 172 | const |
167 | | - mainnetMetadataDir = eth2testnetsDir / "shared" / "mainnet" |
| 173 | + mainnetMetadataDir = eth2testnetsDir & "/shared/mainnet" |
168 | 174 |
|
169 | 175 | mainnetMetadata* = when const_preset == "mainnet": |
170 | 176 | Eth2NetworkMetadata( |
171 | 177 | incompatible: false, # TODO: This can be more accurate if we verify |
172 | 178 | # that there are no constant overrides |
173 | 179 | eth1Network: some mainnet, |
174 | 180 | runtimePreset: mainnetRuntimePreset, |
175 | | - bootstrapNodes: readFile(mainnetMetadataDir / "bootstrap_nodes.txt").splitLines, |
| 181 | + bootstrapNodes: readFile(mainnetMetadataDir & "/bootstrap_nodes.txt").splitLines, |
176 | 182 | depositContractAddress: Eth1Address.fromHex "0x00000000219ab540356cBB839Cbe05303d7705Fa", |
177 | 183 | depositContractDeployedAt: BlockHashOrNumber.init "11052984", |
178 | | - genesisData: readFile(mainnetMetadataDir / "genesis.ssz"), |
179 | | - genesisDepositsSnapshot: readFile(mainnetMetadataDir / "genesis_deposit_contract_snapshot.ssz")) |
| 184 | + genesisData: readFile(mainnetMetadataDir & "/genesis.ssz"), |
| 185 | + genesisDepositsSnapshot: readFile(mainnetMetadataDir & "/genesis_deposit_contract_snapshot.ssz")) |
180 | 186 | else: |
181 | 187 | Eth2NetworkMetadata( |
182 | 188 | incompatible: true, |
183 | 189 | incompatibilityDesc: "This build is compiled with the " & const_preset & " const preset. " & |
184 | 190 | "It's not compatible with mainnet") |
185 | 191 |
|
186 | 192 | template eth2testnet(path: string): Eth2NetworkMetadata = |
187 | | - loadEth2NetworkMetadata(eth2testnetsDir / path) |
| 193 | + loadEth2NetworkMetadata(eth2testnetsDir & "/" & path) |
188 | 194 |
|
189 | 195 | const |
190 | 196 | pyrmontMetadata* = eth2testnet "shared/pyrmont" |
|
0 commit comments