feat: add support for Chiado (#5208)

This commit is contained in:
Philippe Schommers 2023-07-26 14:54:16 +02:00 committed by GitHub
parent e8379389e7
commit 74c993d616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View File

@ -221,6 +221,9 @@ when const_preset == "gnosis":
gnosisGenesis {.importc: "gnosis_mainnet_genesis".}: ptr UncheckedArray[byte] gnosisGenesis {.importc: "gnosis_mainnet_genesis".}: ptr UncheckedArray[byte]
gnosisGenesisSize {.importc: "gnosis_mainnet_genesis_size".}: int gnosisGenesisSize {.importc: "gnosis_mainnet_genesis_size".}: int
chiadoGenesis {.importc: "gnosis_chiado_genesis".}: ptr UncheckedArray[byte]
chiadoGenesisSize {.importc: "gnosis_chiado_genesis_size".}: int
# let `.incbin` in assembly file find the binary file through search path # let `.incbin` in assembly file find the binary file through search path
{.passc: "-I" & vendorDir.} {.passc: "-I" & vendorDir.}
{.compile: "network_metadata_gnosis.S".} {.compile: "network_metadata_gnosis.S".}
@ -229,10 +232,19 @@ when const_preset == "gnosis":
gnosisMetadata = loadCompileTimeNetworkMetadata( gnosisMetadata = loadCompileTimeNetworkMetadata(
vendorDir & "/gnosis-chain-configs/mainnet", vendorDir & "/gnosis-chain-configs/mainnet",
none(Eth1Network), not incbinEnabled) none(Eth1Network), not incbinEnabled)
chiadoMetadata = loadCompileTimeNetworkMetadata(
vendorDir & "/gnosis-chain-configs/chiado",
none(Eth1Network), not incbinEnabled)
static: static:
checkForkConsistency(gnosisMetadata.cfg) for network in [gnosisMetadata, chiadoMetadata]:
doAssert gnosisMetadata.cfg.DENEB_FORK_EPOCH == FAR_FUTURE_EPOCH checkForkConsistency(network.cfg)
for network in [gnosisMetadata, chiadoMetadata]:
doAssert network.cfg.ALTAIR_FORK_EPOCH < FAR_FUTURE_EPOCH
doAssert network.cfg.BELLATRIX_FORK_EPOCH < FAR_FUTURE_EPOCH
doAssert network.cfg.CAPELLA_FORK_EPOCH < FAR_FUTURE_EPOCH
doAssert network.cfg.DENEB_FORK_EPOCH == FAR_FUTURE_EPOCH
elif const_preset == "mainnet": elif const_preset == "mainnet":
import stew/assign2 import stew/assign2
@ -309,6 +321,8 @@ proc getMetadataForNetwork*(
warn "`--network:gnosis-chain` is deprecated, " & warn "`--network:gnosis-chain` is deprecated, " &
"use `--network:gnosis` instead" "use `--network:gnosis` instead"
withGenesis(gnosisMetadata, gnosisGenesis) withGenesis(gnosisMetadata, gnosisGenesis)
of "chiado":
withGenesis(chiadoMetadata, chiadoGenesis)
else: else:
loadRuntimeMetadata() loadRuntimeMetadata()

View File

@ -34,6 +34,13 @@ gnosis_mainnet_genesis_end:
cdecl(gnosis_mainnet_genesis_size): cdecl(gnosis_mainnet_genesis_size):
.quad gnosis_mainnet_genesis_end - gnosis_mainnet_genesis_data .quad gnosis_mainnet_genesis_end - gnosis_mainnet_genesis_data
gnosis_chiado_genesis_data:
.incbin "gnosis-chain-configs/chiado/genesis.ssz"
gnosis_chiado_genesis_end:
.global cdecl(gnosis_chiado_genesis_size)
cdecl(gnosis_chiado_genesis_size):
.quad gnosis_chiado_genesis_end - gnosis_chiado_genesis_data
#if defined(__linux__) && defined(__pie__) #if defined(__linux__) && defined(__pie__)
.section .data.rel.ro,"aw",@progbits .section .data.rel.ro,"aw",@progbits
#elif defined(__APPLE__) #elif defined(__APPLE__)
@ -44,3 +51,8 @@ cdecl(gnosis_mainnet_genesis_size):
.p2align 3 .p2align 3
cdecl(gnosis_mainnet_genesis): cdecl(gnosis_mainnet_genesis):
.quad gnosis_mainnet_genesis_data .quad gnosis_mainnet_genesis_data
.global cdecl(gnosis_chiado_genesis)
.p2align 3
cdecl(gnosis_chiado_genesis):
.quad gnosis_chiado_genesis_data