re-add minimal constant checking; organize presets by spec version (#1203)
* re-add minimal preset constant checking; organize presets to better support multiple spec versions * bump spec ref * increase Azure timeout to 90 minutes to accomodate Nim compiler building
This commit is contained in:
parent
089b365c37
commit
7b4e129316
|
@ -1,7 +1,7 @@
|
||||||
jobs:
|
jobs:
|
||||||
- job: Windows
|
- job: Windows
|
||||||
|
|
||||||
timeoutInMinutes: 80
|
timeoutInMinutes: 90
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: windows-latest
|
vmImage: windows-latest
|
||||||
|
|
|
@ -58,6 +58,10 @@ task test, "Run all tests":
|
||||||
# pieces of code get tested regularly. Increased test output verbosity is the
|
# pieces of code get tested regularly. Increased test output verbosity is the
|
||||||
# price we pay for that.
|
# price we pay for that.
|
||||||
|
|
||||||
|
# Just the part of minimal config which explicitly differs from mainnet
|
||||||
|
buildAndRunBinary "test_fixture_const_sanity_check", "tests/official/", "-d:const_preset=minimal -d:ETH2_SPEC=\"v0.11.3\""
|
||||||
|
buildAndRunBinary "test_fixture_const_sanity_check", "tests/official/", "-d:const_preset=minimal -d:ETH2_SPEC=\"v0.12.1\" -d:BLS_ETH2_SPEC=\"v0.12.x\""
|
||||||
|
|
||||||
# Mainnet config
|
# Mainnet config
|
||||||
buildAndRunBinary "proto_array", "beacon_chain/fork_choice/", "-d:const_preset=mainnet -d:ETH2_SPEC=\"v0.12.1\" -d:BLS_ETH2_SPEC=\"v0.12.x\""
|
buildAndRunBinary "proto_array", "beacon_chain/fork_choice/", "-d:const_preset=mainnet -d:ETH2_SPEC=\"v0.12.1\" -d:BLS_ETH2_SPEC=\"v0.12.x\""
|
||||||
buildAndRunBinary "fork_choice", "beacon_chain/fork_choice/", "-d:const_preset=mainnet -d:ETH2_SPEC=\"v0.12.1\" -d:BLS_ETH2_SPEC=\"v0.12.x\""
|
buildAndRunBinary "fork_choice", "beacon_chain/fork_choice/", "-d:const_preset=mainnet -d:ETH2_SPEC=\"v0.12.1\" -d:BLS_ETH2_SPEC=\"v0.12.x\""
|
||||||
|
|
|
@ -55,18 +55,16 @@ const const_preset* {.strdefine.} = "mainnet"
|
||||||
|
|
||||||
when const_preset == "mainnet":
|
when const_preset == "mainnet":
|
||||||
when ETH2_SPEC == "v0.12.1":
|
when ETH2_SPEC == "v0.12.1":
|
||||||
import ./presets/mainnet
|
import ./presets/v0_12_1/mainnet
|
||||||
export mainnet
|
|
||||||
else:
|
else:
|
||||||
import ./presets/mainnet_v0_11_3
|
import ./presets/v0_11_3/mainnet
|
||||||
export mainnet_v0_11_3
|
export mainnet
|
||||||
elif const_preset == "minimal":
|
elif const_preset == "minimal":
|
||||||
when ETH2_SPEC == "v0.12.1":
|
when ETH2_SPEC == "v0.12.1":
|
||||||
import ./presets/minimal
|
import ./presets/v0_12_1/minimal
|
||||||
export minimal
|
|
||||||
else:
|
else:
|
||||||
import ./presets/minimal_v0_11_3
|
import ./presets/v0_11_3/minimal
|
||||||
export minimal_v0_11_3
|
export minimal
|
||||||
else:
|
else:
|
||||||
type
|
type
|
||||||
Slot* = distinct uint64
|
Slot* = distinct uint64
|
||||||
|
|
|
@ -166,7 +166,7 @@ func compute_domain*(
|
||||||
result[0..3] = int_to_bytes4(domain_type.uint64)
|
result[0..3] = int_to_bytes4(domain_type.uint64)
|
||||||
result[4..31] = fork_data_root.data[0..27]
|
result[4..31] = fork_data_root.data[0..27]
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#get_domain
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#get_domain
|
||||||
func get_domain*(
|
func get_domain*(
|
||||||
fork: Fork, domain_type: DomainType, epoch: Epoch, genesis_validators_root: Eth2Digest): Domain =
|
fork: Fork, domain_type: DomainType, epoch: Epoch, genesis_validators_root: Eth2Digest): Domain =
|
||||||
## Return the signature domain (fork version concatenated with domain type)
|
## Return the signature domain (fork version concatenated with domain type)
|
||||||
|
|
|
@ -80,12 +80,14 @@ macro parseNumConsts(file: static string): untyped =
|
||||||
|
|
||||||
result = quote do: `constsToCheck`
|
result = quote do: `constsToCheck`
|
||||||
|
|
||||||
const datatypesConsts = @(parseNumConsts(SpecDir/"datatypes.nim"))
|
const
|
||||||
|
datatypesConsts = @(parseNumConsts(SpecDir/"datatypes.nim"))
|
||||||
|
specVersionPresetDir = SpecDir/"presets"/("v"&replace(SPEC_VERSION, ".", "_"))
|
||||||
|
|
||||||
when const_preset == "minimal":
|
when const_preset == "minimal":
|
||||||
const minimalConsts = @(parseNumConsts(SpecDir/"presets"/"minimal.nim"))
|
const minimalConsts = @(parseNumConsts(specVersionPresetDir/"minimal.nim"))
|
||||||
else:
|
else:
|
||||||
const mainnetConsts = @(parseNumConsts(SpecDir/"presets"/"mainnet.nim"))
|
const mainnetConsts = @(parseNumConsts(specVersionPresetDir/"mainnet.nim"))
|
||||||
|
|
||||||
const IgnoreKeys = [
|
const IgnoreKeys = [
|
||||||
# Ignore all non-numeric types
|
# Ignore all non-numeric types
|
||||||
|
|
Loading…
Reference in New Issue