ensure that rarely ran files are compiled on PR (#6379)
* ensure that rarely ran files are compiled on PR Add some missing files to `isMainModule` developer internal builds CI. * fix fork choice compilation * fix `rest_api_benchmark` compilation * skip linking * fix loop * fix `mock_genesis` * fix signedness
This commit is contained in:
parent
6d0c9d37fa
commit
e4efe9ed75
|
@ -226,9 +226,20 @@ jobs:
|
||||||
|
|
||||||
- name: Build files with isMainModule
|
- name: Build files with isMainModule
|
||||||
run: |
|
run: |
|
||||||
|
executables=(
|
||||||
|
"beacon_chain/el/deposit_contract"
|
||||||
|
"beacon_chain/fork_choice/fork_choice"
|
||||||
|
"beacon_chain/fork_choice/proto_array"
|
||||||
|
"beacon_chain/networking/network_metadata_downloads"
|
||||||
|
"beacon_chain/era_db"
|
||||||
|
"beacon_chain/trusted_node_sync"
|
||||||
|
"benchmarks/rest_api_benchmark"
|
||||||
|
"tests/mocking/mock_genesis"
|
||||||
|
)
|
||||||
source env.sh
|
source env.sh
|
||||||
nim c beacon_chain/era_db
|
for executable in "${executables[@]}"; do
|
||||||
nim c beacon_chain/trusted_node_sync
|
nim c --passC:-fsyntax-only --noLinking:on -d:chronicles_log_level=TRACE "${executable}"
|
||||||
|
done
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: "Lint"
|
name: "Lint"
|
||||||
|
|
|
@ -502,8 +502,8 @@ when isMainModule:
|
||||||
for i in 0 ..< validator_count:
|
for i in 0 ..< validator_count:
|
||||||
indices.add fakeHash(i), i
|
indices.add fakeHash(i), i
|
||||||
votes.add default(VoteTracker)
|
votes.add default(VoteTracker)
|
||||||
old_balances.add 0
|
old_balances.add 0.Gwei
|
||||||
new_balances.add 0
|
new_balances.add 0.Gwei
|
||||||
|
|
||||||
let err = deltas.compute_deltas(
|
let err = deltas.compute_deltas(
|
||||||
indices, indices_offset = 0, votes, old_balances, new_balances
|
indices, indices_offset = 0, votes, old_balances, new_balances
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# beacon_chain
|
||||||
|
# Copyright (c) 2022-2024 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
chronicles, chronicles/[topics_registry, timings],
|
chronicles, chronicles/[topics_registry, timings],
|
||||||
confutils, confutils/std/net,
|
confutils, confutils/std/net,
|
||||||
|
@ -6,11 +15,11 @@ import
|
||||||
type
|
type
|
||||||
Config = object
|
Config = object
|
||||||
serverIpAddress {.
|
serverIpAddress {.
|
||||||
defaultValue: ValidIpAddress.init("127.0.0.1")
|
defaultValue: static(parseIpAddress("127.0.0.1"))
|
||||||
defaultValueDesc: "127.0.0.1"
|
defaultValueDesc: "127.0.0.1"
|
||||||
desc: "IP address of the beacon node's REST server"
|
desc: "IP address of the beacon node's REST server"
|
||||||
abbr: "a"
|
abbr: "a"
|
||||||
name: "address" }: ValidIpAddress
|
name: "address" }: IpAddress
|
||||||
|
|
||||||
serverPort {.
|
serverPort {.
|
||||||
defaultValue: 5052
|
defaultValue: 5052
|
||||||
|
@ -29,7 +38,7 @@ type
|
||||||
abbr: "n"
|
abbr: "n"
|
||||||
name: "count" }: uint
|
name: "count" }: uint
|
||||||
|
|
||||||
proc main =
|
proc main() {.raises: [ConfigurationError, HttpError, OSError].} =
|
||||||
let config = Config.load
|
let config = Config.load
|
||||||
let serverAddress = initTAddress(config.serverIpAddress, config.serverPort)
|
let serverAddress = initTAddress(config.serverIpAddress, config.serverPort)
|
||||||
let client = RestClientRef.new(serverAddress)
|
let client = RestClientRef.new(serverAddress)
|
||||||
|
@ -43,10 +52,10 @@ proc main =
|
||||||
info.logTime(apiName):
|
info.logTime(apiName):
|
||||||
for slot in config.startSlot ..< (config.startSlot + config.requestsCount):
|
for slot in config.startSlot ..< (config.startSlot + config.requestsCount):
|
||||||
let ident = StateIdent(kind: StateQueryKind.Slot, slot: slot.Slot)
|
let ident = StateIdent(kind: StateQueryKind.Slot, slot: slot.Slot)
|
||||||
discard waitFor client.`apiNameIdent`(ident)
|
discard waitFor noCancel client.`apiNameIdent`(ident)
|
||||||
|
|
||||||
benchmark(getStateRoot)
|
benchmark(getStateRoot)
|
||||||
benchmark(getStateFork)
|
benchmark(getStateForkPlain)
|
||||||
benchmark(getStateFinalityCheckpoints)
|
benchmark(getStateFinalityCheckpoints)
|
||||||
benchmark(getStateValidatorBalances)
|
benchmark(getStateValidatorBalances)
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,4 @@ proc initGenesisState*(
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
# Smoke test
|
# Smoke test
|
||||||
let state = initGenesisState(num_validators = SLOTS_PER_EPOCH)
|
let state = initGenesisState(num_validators = SLOTS_PER_EPOCH)
|
||||||
doAssert state.validators.len == SLOTS_PER_EPOCH
|
doAssert getStateField(state[], validators).lenu64 == SLOTS_PER_EPOCH
|
||||||
|
|
Loading…
Reference in New Issue