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:
Etan Kissling 2024-06-24 01:35:56 +02:00 committed by GitHub
parent 6d0c9d37fa
commit e4efe9ed75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 10 deletions

View File

@ -226,9 +226,20 @@ jobs:
- name: Build files with isMainModule
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
nim c beacon_chain/era_db
nim c beacon_chain/trusted_node_sync
for executable in "${executables[@]}"; do
nim c --passC:-fsyntax-only --noLinking:on -d:chronicles_log_level=TRACE "${executable}"
done
lint:
name: "Lint"

View File

@ -502,8 +502,8 @@ when isMainModule:
for i in 0 ..< validator_count:
indices.add fakeHash(i), i
votes.add default(VoteTracker)
old_balances.add 0
new_balances.add 0
old_balances.add 0.Gwei
new_balances.add 0.Gwei
let err = deltas.compute_deltas(
indices, indices_offset = 0, votes, old_balances, new_balances

View File

@ -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
chronicles, chronicles/[topics_registry, timings],
confutils, confutils/std/net,
@ -6,11 +15,11 @@ import
type
Config = object
serverIpAddress {.
defaultValue: ValidIpAddress.init("127.0.0.1")
defaultValue: static(parseIpAddress("127.0.0.1"))
defaultValueDesc: "127.0.0.1"
desc: "IP address of the beacon node's REST server"
abbr: "a"
name: "address" }: ValidIpAddress
name: "address" }: IpAddress
serverPort {.
defaultValue: 5052
@ -29,7 +38,7 @@ type
abbr: "n"
name: "count" }: uint
proc main =
proc main() {.raises: [ConfigurationError, HttpError, OSError].} =
let config = Config.load
let serverAddress = initTAddress(config.serverIpAddress, config.serverPort)
let client = RestClientRef.new(serverAddress)
@ -43,10 +52,10 @@ proc main =
info.logTime(apiName):
for slot in config.startSlot ..< (config.startSlot + config.requestsCount):
let ident = StateIdent(kind: StateQueryKind.Slot, slot: slot.Slot)
discard waitFor client.`apiNameIdent`(ident)
discard waitFor noCancel client.`apiNameIdent`(ident)
benchmark(getStateRoot)
benchmark(getStateFork)
benchmark(getStateForkPlain)
benchmark(getStateFinalityCheckpoints)
benchmark(getStateValidatorBalances)

View File

@ -39,4 +39,4 @@ proc initGenesisState*(
when isMainModule:
# Smoke test
let state = initGenesisState(num_validators = SLOTS_PER_EPOCH)
doAssert state.validators.len == SLOTS_PER_EPOCH
doAssert getStateField(state[], validators).lenu64 == SLOTS_PER_EPOCH