Commit Graph

5587 Commits

Author SHA1 Message Date
Etan Kissling 2722778ce5
reduce `nim-eth` dependencies just for RNG (#5099)
We have several modules that import `nim-eth` for the sole purpose of
its `keys.newRng` function. This function is meanwhile a simple wrapper
around `nim-bearssl`'s `HmacDrbgContext.new()`, so the import doesn't
really serve a use anymore. Replace `keys.newRng` with the direct call
to reduce `nim-eth` imports.
2023-06-19 22:43:50 +00:00
Etan Kissling 3dd256b686
bump `nim-zlib` to `f34ca261efd90f118dc1647beefd2f7a69b05d93` (#5096)
* bump `nim-zlib` to `f34ca261efd90f118dc1647beefd2f7a69b05d93`

- ignore *.exe
- nim 1.6 adjustment
- update github action to v3
- use Nim 2.0 in CI
- test both refc and ORC in post-1.6 Nim versions
- remove Nim 1.2 and 1.4 support

* bump `nim-websock` for compatibility

`nim-websock` `fea05cde8b123b38d1a0a8524b77efbc84daa848` is needed

- reduce compiler warnings
2023-06-19 18:47:11 +00:00
Jacek Sieka 4ae1857898
fix missing era regeneration (#5098)
+1 is already done via a `defer`
2023-06-19 15:47:24 +00:00
Etan Kissling a92b249892
bump `nim-websock` to `4c5e225eeb342a3b9cfb2fbdddd92d00568b5553` (#5097)
- Remove newRng
- Fix closing hangs
- Remove recvMsg pre-allocation
2023-06-19 13:11:30 +00:00
henridf 0f8866d672
Add Deneb beacon API types (#5060)
* Add Deneb beacon API types

- Introduce the `ProduceBlockResponseV2` type for handling responses to `GET /eth/v2/validator/blocks/{slot}` (https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Validator/produceBlockV2)

- Introduce the `RestPublishedSignedBlockContents` type for handling the request body to `POST /eth/v1/beacon/blocks` (https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/ValidatorRequiredApi/publishBlock)

And a few other small changes towards Deneb block production support.

* Address review feedback

* Post-rebase fixes
2023-06-19 08:56:52 +00:00
Etan Kissling 4da9517f25
bump `nim-serialization` to `384eb2561ee755446cff512a8e057325848b86a7` (#5086)
- readFieldIMPL workaround when orc enabled
- remove nimble.lock
- remove nim 1.2 and nim 1.4 from ci
- remove Defect raises from makeFieldReadersTable
- another attempt to reduce compiler warnings
- More fix to exception tracking and generic_suite
- bump version to 0.2.0
- avoid implicit synthesis of `CaseTransition`
- make nimble file consistent with test matrix
- workaround for `NimYAML` issue
2023-06-17 08:41:01 +02:00
Etan Kissling 3a6b50cf21
require sync committee supermajority in CI (#5085)
* require sync committee supermajority in CI

To better catch problems with sync committee messages in CI, extend
local testnet simulation to also verify that each block is signed
by a supermajority of the sync committee.

Requires #5083 and #5084

* lint
2023-06-17 06:00:01 +00:00
Etan Kissling 8c6c8a0ffa
use correct slot when producing sync aggregate around forks (#5089)
`produceSyncAggregate` is called in new slot when block is produced,
while the other functions in `sync_committee_msg_pool` are called in
previous slot. So, need to subtract 1 slot when producing sync aggregate
to accept the signatures using the old digest during fork transition.
2023-06-16 21:30:36 +00:00
Etan Kissling aa54760391
avoid implicit `CaseTransition` in keystore Json parsing (#5061)
Override default Json parsing for keystore case objects to avoid
`CaseTransition` logic to be emitted. When parsing the discriminator,
reinitialize the entire object instead of implicitly changing it,
to avoid UB and also possible oversights when extending the object.
See https://github.com/status-im/nim-serialization/pull/59
2023-06-16 19:02:53 +02:00
tersec 591c2246d5
update consensus spec URLs to v1.4.0-alpha.3 (#5088) 2023-06-16 16:45:09 +00:00
henridf ae29babd9f
Implement blob sidecar signatures (#5072)
* Implement blob sidecar signatures

* Update allTests
2023-06-16 15:47:18 +00:00
Etan Kissling 8eec6ab221
avoid `ProveField` warning in `network_metadata` (#5066)
Before assigning to `genesisData` or returning `cfg`, have to check that
metadata is not `incompatible` to avoid `ProveField` warning.
The way how we use it was already correct (`incompatible` unreachable).
Use `case` syntax to silence the warning, and add comments referring to
the existing checks that make `incompatible` unreachable.
2023-06-16 12:15:42 +00:00
Etan Kissling e9262ab6a3
ensure sync duties for next epoch are registered in time (#5084)
* ensure sync duties for next epoch are registered in time

For attestations, VC queries duties for current and next epoch.
For sync messages, VC queries for current and next period (if soon).
This means that for sync messages we don't actually have the duties for
next epoch in all situations, leading to situation where VC may miss
sync duties in the final slot of an epoch when using. As duties remain
same within a sync committee period, simply copy them over to next epoch
to avoid this situation without adding network latency.

* Update beacon_chain/validator_client/duties_service.nim

Co-authored-by: Jacek Sieka <jacek@status.im>

---------

Co-authored-by: Jacek Sieka <jacek@status.im>
2023-06-16 08:42:57 +00:00
Etan Kissling 6f68c1a46e
query sync duties for correct slot (#5083)
VC currently misses sync committee duties for first slot of most epochs
because the 1 slot offset is not taken into account. Duties for the next
slot must be used during any given current slot. We use the correct slot
for processing the duty, but do not use the correct slot for fetching.
2023-06-16 06:33:13 +00:00
Etan Kissling a6f0a7a55d
broaden `SszError` catches to `SerializationError` (#5081)
`nim-serialization` is tagged with `{.raises:[SerializationError].}` so
it is no longer sufficient to catch `SszError` in some situations.
`SszError` inherits from `SerializationError`, so broadening the caught
exception types can be done now, to enable bumping `nim-serialization`.

https://github.com/status-im/nimbus-eth2/pull/5043#issuecomment-1584227993

#5061 is also needed to bump `nim-serialization`.
2023-06-15 16:29:13 +00:00
Tanguy 98ab0afcc3
Bump libp2p (#5079)
* Bump libp2p

* Switch to unstable
2023-06-15 12:59:35 +00:00
Etan Kissling 142a3e91e5
`ProveField` cleanups in `keystore` (#5050)
Cleanup for `ProveField` warnings in `keystore` module.
Note that `ProveField` is disabled by default in makefile, but sometimes
these pop up when doing a regular `nim c`, and cleaning these may allow
enabling the warning in some future.
2023-06-15 14:53:42 +02:00
tersec ce1503b51f
remove web3signer block signing V1 (phase0 only) support (#5014) 2023-06-15 14:52:19 +02:00
tersec 939b3002e4
remove removed getDebugChainHeadsV1; fix API links in documentations (#5058) 2023-06-15 09:58:38 +00:00
Etan Kissling 411d809c82
split file loading from parsing in helpers (#5054)
* split file loading from parsing in helpers

In `readSszForkedHashedBeaconState` and `readRuntimeConfig`, split the
part that loads the file from the part that parses the file. The parsing
portion can be reused with that, e.g., when loading from the network.

* add missing export marker
2023-06-14 19:48:50 +00:00
Etan Kissling 114453e67d
remove `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` (#5078)
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used in any
EF or Gnosis network metadata definitions. We can remove it.

Upstream changes:

- https://github.com/eth-clients/eth2-networks/pull/87
- https://github.com/gnosischain/configs/pull/10

Which we updated here:

- https://github.com/status-im/nimbus-eth2/pull/5071
- https://github.com/status-im/nimbus-eth2/pull/5077
2023-06-14 18:18:53 +00:00
Etan Kissling aab26379ff
bump `eth2-networks` to `e930d81f7c9db816c88d1a9336be8cef858f7f4d` (#5077)
- remove `SAFE_SLOTS_TO_UPDATE_JUSTIFIED`
2023-06-14 18:18:02 +00:00
Etan Kissling 088c7e953d
bump `gnosis-chain-configs` to `41ffb72f67215b2f0c844498071844f3286c7fbb` (#5071)
- remove `SAFE_SLOTS_TO_UPDATE_JUSTIFIED`
2023-06-14 14:47:29 +00:00
tersec c27a65129b
add ability to load KZG trusted setup via runtime flag (#5075) 2023-06-14 10:52:00 +02:00
Eugene Kabanov 927180f36f
VC+BN: Validator voluntary exits through the Keymanager API (#5020)
* Initial commit.

* Address review comments.
2023-06-14 08:46:01 +02:00
Eugene Kabanov c0e5c26da1
VC: Use SSZ encoding while processing blocks data (#4999)
* Refactor api.nim to provide more informative failure reasons.
Distinct between unexpected data and unexpected code.
Deprecate Option[T] usage.

* Fix 400 for produceBlindedBlock().
Get proper string conversion for strategy.

* Fix SSZ encoded versions of ProduceBlockResponseV2, ProduceBlockResponseV2 can be received and decoded.
Fix done() warnings.
Bump presto.

* Fix compilation error with new presto.
Use TcpNoDelay option for Web3Signer.

* Fix produceBlockV2() should provide SSZ responses too.

* Address block encoding issue.

* Fix signing test.

* Bump presto.

* Address review comments.
2023-06-14 08:04:15 +02:00
Etan Kissling 845bd3d570
ensure that submodule bumps are reachable (#5070)
It occurs sometimes that a submodule is bumped to a PR commit instead of
the corresponding canonical branch (as registered in `.gitmodules`).
Because we typically use `squash`, that PR commit can subsequently
become unreachable, randomly breaking the build of `nimbus-eth2`.
Prevent these accidents by only allowing submodule bumps to commits
on the branch registered in `.gitmodules`. On private branches, simply
update `.gitmodules` to match the personal dev branch.
2023-06-14 01:34:49 +00:00
Etan Kissling 6671965fd9
split SSZ and JSON parsing logic in LC handler (#5055)
Use separate functions per format when parsing LC data from REST.
This allows to process events from the eventstream more directly,
as they are always JSON not SSZ. And also makes the code cleaner.
2023-06-13 21:28:17 +00:00
tersec 54cc7bb7a1
update some consensus-spec URLs to v1.4.0-alpha.3 (#5074) 2023-06-13 21:07:39 +00:00
tersec b5a38b7a2a
bump nim-kzg4844 to f8b78edcc8296f412c2593e6d60f47c77aa421c5 (#5073) 2023-06-13 20:10:54 +00:00
tersec 9277326c98
fix misspelling in log message (#5069) 2023-06-13 17:08:41 +00:00
Etan Kissling 47fdfc2fce
bump `nim-web3` to `1f9fa11d0e63c16aa4ec30e1f7328ae61254d7d0` (#5068)
No changes, but this was pushed to a PR commit instead of `master`.
2023-06-13 16:51:43 +00:00
Etan Kissling 20d6b4751e
avoid `ProveField` warning in `keyGen` (#5067)
Assigning to fields of `var` case objects emits `ProveField` warnings.
We disable them in `make` based builds but they may pop up when building
manually with `nim c`. Suppress them for the `keyGen` function, as we
assign to `result.value` separately from `result.ok` to avoid copying.
2023-06-13 16:45:00 +00:00
tersec 788cdb7133
automated v1.4.0-alpha.2 to v1.4.0-alpha.3 consensus spec URL updates (#5065) 2023-06-13 14:03:49 +00:00
tersec d26058b929
use v1.4.0-alpha.3 consensus spec test vectors (#5063) 2023-06-13 10:37:10 +00:00
tersec d7b546fab5
fix UnusedImport warning (#5064) 2023-06-13 10:03:20 +00:00
Etan Kissling a3229a6b9b
extract helper for validating `UpdatesByRange` consistency (#5053)
Reduce code duplication when checking response of `UpdatesByRange`.
2023-06-12 14:22:32 +02:00
Etan Kissling 40415ab86c
`ProveField` cleanups in `forks` (#5049)
* `ProveField` cleanups in `forks`

Some more cleanup for `ProveField` warnings in `forks` module.
Note that `ProveField` is disabled by default in makefile, but sometimes
these pop up when doing a regular `nim c`, and cleaning these may allow
enabling the warning in some future.

* use syntax that works if passed to multiple args of call
2023-06-12 12:03:59 +00:00
tersec 22208836b1
automated v1.4.0-alpha.1 to v1.4.0-alpha.2 consensus spec URL updates (#5056) 2023-06-10 09:56:54 +00:00
tersec 1b77831758
Revert "remove removed Debug/getDebugChainHeads V1 (#4970)" (#5057)
This reverts commit 6ebcbbdf4e.
2023-06-10 08:08:01 +00:00
tersec 6ebcbbdf4e
remove removed Debug/getDebugChainHeads V1 (#4970)
* remove removed Debug/getDebugChainHeads V1

* REST API tests
2023-06-10 08:07:36 +00:00
tersec 9e14d904ac
https://github.com/ethereum/consensus-specs/pull/3359 (#5047) 2023-06-10 05:39:10 +00:00
Etan Kissling db48160ab3
bump `nim-testutils` to `53a9fb09923004455b7e6d750c8144f3c7ede201` (#5010)
- allow `programMain` to throw
2023-06-10 05:11:10 +00:00
Etan Kissling 40a6f1dd82
bump `nim-chronicles` to `74dc6e2e58bc0f63d22febed66726a815b8363db` (#5052)
- Generate lock file
- v0.10.3
- fix stylecheck to be compatible with Nim 1.2 and 1.6
- update to supported macOS GitHub CI image
- switch GitHub Actions CI images from deprecated Ubuntu 18.04 to 20.04
- Fix nim 2.0 bare except warnings
- fix nim 1.6 bare except warnings
- reduce compiler warnings
- Fix bare expect warning
- Remove appveyor and travis scripts
- upgrade github actions to v3
- remove nimble.lock, which is outdated and block Nim CI
2023-06-10 02:08:32 +00:00
tersec 6a9ed6ddd5
use v1.4.0-alpha.2 consensus spec test vectors (#5051) 2023-06-10 01:45:53 +00:00
tersec 54cb06ea06
fix chronos deprecation warning (#5048) 2023-06-09 23:43:28 +00:00
Miran 73fc1d5a2b
Update "Getting started" part of the book (#4938)
* refactor index.md

* move philosophy.md into index.md

* clean up the 'getting started' topic

move how-to's to the how-to section

* cleaner titles

* move prerequisites to the install.md page

* hardware.md: small refactor

* improve quick-start.md

* refactor eth1.md

* refactor validating guide

* reverse the order of BN and LC in the table

* pi-guide.md: minor edit

* Apply suggestions from code review

Co-authored-by: tersec <tersec@users.noreply.github.com>

* make link texts more concrete

* remove comparison to other clients

* add some more explanations to `build.md`

* change 'days' to 'hours'

---------

Co-authored-by: tersec <tersec@users.noreply.github.com>
2023-06-09 23:06:01 +00:00
Etan Kissling 6548651e42
bump `nim-confutils` to `6c3566850d5ec241d8cb687ae8461c972040311a` (#5046)
- remove support for Nim v1.2 and v1.4
- use --mm: instead of --gc: and remove stddefects import
- annotate `parseCmdArg` with `{.raises.}`
- ignore exceptions while writing to stdout/stderr
- handle `terminalWidth` exception
- catch exceptions in `appInvocation`
2023-06-09 21:45:52 +00:00
Etan Kissling 16adda2cd5
bump `nim-ssz-serialization` to `4c3e600da2051f81fe3074ae344f75f96a66de9d` (#5045)
- add support for generic union
- switch CI to the supported versions of ubuntu and macos
- install openssl on macos for Nim devel
- update github actions to v3
- improve union validation
- enable ssSize of union
- implement SSZ Optionals (EIP-6475)
- implement sszSize of Optionals
- use Nim 2.0 in CI
- test both refc and ORC in post-1.6 Nim versions
- stop testing Nim pre-1.6 in CI
- update for latest `Optional` spec
- avoid ptr_arith
- remove redundant when's because Nim 1.6+ is always true
- rm unused `SszMaxSizeExceeded`
- remove Defect raises
2023-06-09 21:35:18 +00:00
Etan Kissling a0d63c50ee
do not use untrusted `genesis.ssz` with `--trusted-block-root` (#5025)
When using trusted node sync with `--trusted-block-root`, the remote
server is only trusted for data availability, not for correctness.
As a downloaded genesis state cannot be validated for correctness,
require it to be passed via the network metadata `genesis.ssz` file
for `--trusted-block-root` mode. Network metadata is considered trusted
as it is provided by the user and not by the remote server.
Further adds a check for consistent `genesis_time` when using `StateId`
based trusted node sync. This is just a sanity check to avoid spreading
blatantly incorrect data, similar to existing `genesis_validators_root`
checks.
2023-06-09 22:11:14 +02:00