Commit Graph

3545 Commits

Author SHA1 Message Date
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
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 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 9277326c98
fix misspelling in log message (#5069) 2023-06-13 17:08:41 +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
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
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
henridf eda631cd7a
Blob accounting fixes/tweaks (#5044)
- Replace asset by warning
- change inequality to lt
2023-06-09 10:52:03 +00:00
Tanguy 46a12639b8
Read messages before applying quota to avoid mplex backpressure issues (#4697)
* Apply global quota after reading messages

* Also wait quota for failed requests

* Better integration

* comments
2023-06-08 14:20:41 +00:00
Jacek Sieka 8db87a0cfc
bump chronos (#5039)
* separate futures import / Defect cleanups
* unittest2 fix to allow `stackTrace` as a symbol name generally
2023-06-08 13:42:19 +00:00
Eugene Kabanov effe8b7f90
VC: Remote BN received block monitoring. (#4856)
* Initial commit with both methods enabled: `poll` and `event`.

* Address review comments.

* Address review comments.
Fix copyright years.

* After bump fixes.
2023-06-08 10:44:32 +02:00
tersec e8c6af0636
add getNextWithdrawals Beacon API (#5021) 2023-06-07 21:27:15 +00:00
henridf 3bda24d4d1
Remove unused param from prepareForkedBlockReading (#5037) 2023-06-07 10:39:04 +00:00
tersec 30c859e8a4
update some consensus-spec URLs to v1.4.0-alpha.1 (#5035) 2023-06-06 17:09:48 +00:00
tersec 58e3de3bf2
add REST call signatures for getStateRandao and getNextWithdrawals (#5033) 2023-06-06 10:01:05 +00:00
Jacek Sieka fc833d40f6
bump chronos (#5032)
* ratelimiter crash fix
* implicit returns now available!
2023-06-05 18:52:16 +00:00
henridf c2aa8313c3
Sync: fix backfill blob iteration order (#4993)
* Sync: fix backfill blob iteration order

* Address review feedback

* Add comment clarifying reason for func top-level placement
2023-06-05 14:42:27 +00:00
jangko a24f3cde7e
more flexible compile time resource path 2023-06-05 12:52:25 +07:00
Etan Kissling d99caf1ad9
fix `Access-Control-Allow-Origin` response (#5028)
Since #3976, CORS functionality is broken. Fix it to work again:

- Use `--rest-allowed-origin` instead of `--keymanager-allowed-origin`
  to specify CORS `Access-Control-Allow-Origin` header for beacon-APIs.

- Actually pass CORS config to `nim-presto` once more.
2023-06-04 16:46:00 +00:00
Etan Kissling 336acbd39b
display `ExecutionAddress` as hex string (#5029)
When logging `ExecutionAddress`, serialize it as a hex string instead of
as a byte array.
2023-06-04 16:15:14 +00:00
Etan Kissling 12381d5f33
also pack attestations where LMD vote is orphaned (#5002)
* also pack attestations where LMD vote is orphaned

When `attestation.data.beacon_block_root` gets orphaned, attestations
with a good `attestation.data.target.root` may still be valuable.
The LMD GHOST vote is not relevant for attestation rewards.

Switch to use the FFG vote (`attestation.data.target.root`) instead,
gossip validation ensures it is an ancestor of `beacon_block_root`.

* lint
2023-06-04 10:39:12 +00:00
tersec f86febc111
update consensus spec URLs to v1.4.0-alpha.1 (#5027) 2023-06-04 10:32:50 +00:00
tersec b25ca0833b
use v1.4.0-alpha.1 consensus spec test vectors (#5026) 2023-06-03 21:55:08 +00:00
tersec e6a5f03717
add comment to state diffs explaining eth1 vote tracking (#5023) 2023-06-03 17:48:19 +00:00
tersec ee71b6cc36
update consensus spec URLs to v1.4.0-alpha.0 (#5022) 2023-06-02 12:59:38 +00:00
tersec e8e67ec771
allow payload builder client to be function of validator/proposer (#5015)
* allow payload builder client to be function of validator/proposer

* fileExists has side effects on Windows and only Windows

* another not-always-func
2023-06-02 11:06:33 +00:00
Etan Kissling 005a35597f
handle one of the `ProveField` warnings (#5013)
* handle one of the `ProveField` warnings

When assigning between `ForkyHashedBeaconState`, suppress `ProveField`
warning, as `tgt.kind == src.kind` was already checked, but compiler
doesn't understand that (as we only `case tgt.kind`).

* Update beacon_chain/spec/forks.nim

* Update beacon_chain/spec/forks.nim
2023-06-02 01:25:49 +00:00
tersec 7a7573d7d0
fix chronos done -> completed deprecation warnings (#5016) 2023-06-01 10:04:30 +02:00
Etan Kissling 1086909e0b
ensure `quit` on config error with `IOError` (#5011)
When there is an `IOError` while logging a configuration error,
we don't actually `quit` the program. Catch `IOError` to always `quit`.
2023-05-31 20:21:49 +00:00
Etan Kissling 6cd63a89d8
annotate `secondarySources` with `{.raises.}` (#5012)
`sources.addConfigFile` may raise `ConfigurationError`, annotate caller
to propagate that error explicitly.
2023-05-31 19:28:33 +00:00
Etan Kissling 73b3f40e8d
use correct exception in `parseCmdArg(enr.Record)` (#5009)
* use correct exception in `parseCmdArg(enr.Record)`

`parseCmdArg` is expected to raise `ValueError` but for `enr.Record` we
currently raise `ConfigurationError`. Change to `ValueError` instead.

* lint
2023-05-31 19:07:06 +00:00
tersec bc458921ec
don't require optional fields importing slashing protection information (#4997) 2023-05-31 18:51:00 +03:00
tersec c9f1bf21d6
refactor state diffs not to require two states in memory (#4986) 2023-05-30 11:55:32 +03:00
Eugene Kabanov 528d082fc0
VC: Logging changes (#4994)
* Refactor api.nim to provide more informative failure reasons.
Distinct between unexpected data and unexpected code.
Deprecate Option[T] usage.

* Fix generated reason to not include opt[t].

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

* Bump copyright years.
2023-05-30 11:38:34 +03:00
Etan Kissling 750722dd75
advance FC time if block/attestation is early (#4992)
When processing blocks/attestations that are slightly early, within the
spec allowed `MAXIMUM_GOSSIP_CLOCK_DISPARITY`, bump FC time accordingly.
2023-05-26 08:03:49 +00:00
tersec 1f535336da
automated v1.3.0 to v1.4.0-alpha.0 consensus spec URL updates (#4996)
* automated v1.3.0 to v1.4.0-alpha.0 consensus spec URL updates

* add copyright year headers
2023-05-26 00:14:28 +02:00
tersec d1941b670a
refactor payload builder REST client usage (#4973)
* refactor payload builder REST client usage

* change HTTP response code
2023-05-25 18:38:56 +03:00
Etan Kissling 00728e9bb7
use `executionValid` bit in `BlockRef` (#4956)
Update `beacon_node/rpc` usage for the new `executionValid` field.
2023-05-25 15:57:24 +02:00
tersec 10569ff2e9
use v1.4.0-alpha.0 consensus spec test vectors (#4990) 2023-05-25 07:55:00 +00:00
Etan Kissling f16c368f5c
allow `NeverTested` > `Working` transition for EL connection (#4991)
Since #4960, the EL connection status can no longer transition from
`NeverTested` to `Working`. Fix that, and also consider `NeverTested`
connections as online for the purpose of the `el_offline` REST response.
2023-05-25 10:39:47 +03:00
Jacek Sieka 74b670a4c9
reenable incbin on 64-bit platforms (#4988)
turns out we're still making releases for 32-bit platforms 😲
2023-05-24 23:43:41 +03:00
Jacek Sieka 8db65ef574
check flag before slower hash comparison 2023-05-23 09:09:22 +02:00
tersec 7577c625b3
implicitly backfill pre-finalized block execution validity from finalized block (#4984) 2023-05-23 08:26:31 +02:00
henridf 5ef748b19d
Clarify addOrphan error/logging (#4981)
* Clarify addOrphan error/logging

addOrphan returned a bool to indicate success. Change this to a Result
so that different errors can be distinguished.

* Update beacon_chain/consensus_object_pools/block_quarantine.nim

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

* Update beacon_chain/gossip_processing/gossip_validation.nim

---------

Co-authored-by: tersec <tersec@users.noreply.github.com>
2023-05-21 17:47:00 +00:00
tersec cd087b9a43
replace `optimisticRoots` table with field in `BlockRef` (#4969)
* replace optimisticRoots table with field in BlockRef

* copyright year

* mark finalized blocks as verified on load

* Update beacon_chain/consensus_object_pools/block_dag.nim

Co-authored-by: Etan Kissling <etan@status.im>

* expand non-optimistic block checking to all pre-merge blocks; refactor markBlockVerified to use BlockRef rather than block root and remove superfluous caller in newPayload path replaced by addResolvedHeadBlock BlockRef construction

* don't treat finalized block specially; VALID status is sticky

---------

Co-authored-by: Etan Kissling <etan@status.im>
2023-05-20 12:18:51 +00:00
henridf 0044c18c01
Add reqCount to BlobSidecar range request done log (#4982) 2023-05-19 20:14:41 +00:00
henridf 7fb9a51c76
Fix blobkey calculation (#4978) 2023-05-19 16:51:13 +00:00
henridf 1cf777c64b
Fix sync for blocks older than MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS (#4977)
When doing sync for blocks older than
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS, we skip the blobs by range
request, but we then pass en empty blob sequence to
validation, which then fails.

To fix this: Use an Option[Blobsidecars] to allow expressing the
distinction between "empty blob sequence" and "blobs unavailable". Use
the latter for "old" blocks, and don't attempt to run blob validation.
2023-05-19 16:25:11 +00:00
henridf 4b23c4292d
Remove unused proc getBlobSidecar (#4979) 2023-05-19 16:01:07 +00:00
Jacek Sieka c14d396718
harden req/resp peer scoring (#4966) 2023-05-19 15:01:27 +03:00
Zahary Karadjov a6b3e02ce0
Merge branch 'unstable' into dev/etan/rd-shufflingacc 2023-05-19 14:46:23 +03:00
Zahary Karadjov 4c3850f7df
Disable the use of incbin as it breaks the retail build on Linux/ARM 2023-05-19 04:08:02 +03:00
cheatfate a36cacda44
New stricter beacon-node URL parsing 2023-05-19 02:02:20 +03:00
Zahary Karadjov a167424fc0
Version 23.5.1 2023-05-18 20:10:12 +03:00
henridf 01549f6aa4
Wire in blob validation (#4864)
* Wire in blob validation

* Remove unused "is_data_available"

* Log blobs when blob validation fails
2023-05-17 13:55:50 +00:00
Etan Kissling c70fd8fe97
Merge branch 'unstable' into dev/etan/rd-shufflingacc 2023-05-17 14:06:31 +02:00
tersec 74511f61d1
Use withdrawal credentials as default fee recipient (#4968) 2023-05-17 07:56:37 +03:00
Etan Kissling 40e89937c5
segregate sync committee messages by period / fork (#4953)
`SyncCommitteeMsgPool` grouped messages by their `beacon_block_root`.
This is problematic around sync committee period boundaries and forks.
Around sync committee period boundaries, members from both the current
and next sync committee may sign the same `beacon_block_root`; mixing
the signatures from both committees together is a mistake. Likewise,
around fork transitions, the `signing_root` changes, so those messages
also need to be segregated.
2023-05-17 07:55:55 +03:00
zah e8572c0246
More relaxed parsing of RemoteKeystores to regain compatibility with version 1 (#4967) 2023-05-16 19:06:16 +03:00
tersec 5aeb5d9209
increase builder API getHeader timeout (#4964) 2023-05-16 16:41:55 +03:00
Jacek Sieka 83393cea8d
dependent slot helpers 2023-05-16 11:04:25 +02:00
Jacek Sieka 3acbb3ea6c
fix missing shuffling dependent slot computation 2023-05-16 10:05:35 +02:00
Etan Kissling adcabf9ad7
cleanup gossip message handler setup (#4961)
* cleanup gossip message handler setup

Reduce duplication and make gossip handler setup easier to read.

* explicit returns for async validators
2023-05-16 09:46:41 +02:00
Etan Kissling 3a92bf3914
use dependent root as `execution_optimistic` basis for duties (#4955)
The validator beacon APIs `getAttesterDuties`, `getProposerDuties`, and
`getSyncCommitteeDuties`, have reported the `execution_optimistic`
state for the current head block. This can lead to a race if duties are
requested around the slot start, if a new head block is currently being
processed by the EL, during which the BN head may be briefly optimistic.

`execution_optimistic` is documented in beacon APIs as:

> True if the response references an unverified execution payload.
> Optimistic information may be invalidated at a later time.
> If the field is not present, assume the False value.

As the duty endpoints reference the shuffling dependent root instead of
the currently selected head block, `execution_optimistic` is now fetched
based on that shuffling dependent block root. As this dependent block is
in the past it doesn't usually become optimistic when adding new blocks.

Note that the endpoints requested 4/8 seconds into the slot that perform
the actual duties instead of just querying for duty schedule, still
report `execution_optimistic` based on the BN head block.
2023-05-15 23:42:42 +03:00
zah 9b9c58c507
Don't report very brief EL connection interruptions on user-visible log levels (#4960) 2023-05-15 23:40:47 +03:00
Etan Kissling dbba003a38
Revert "Revert "accelerate `getShufflingRef` (#4911)" (#4958)"
This reverts commit 748be8b67b.
2023-05-15 17:41:40 +02:00
Etan Kissling 748be8b67b
Revert "accelerate `getShufflingRef` (#4911)" (#4958)
This reverts commit ea97e93e74.
2023-05-15 15:25:51 +00:00
henridf 573228ffa0
Rename eth1/ -> el/ and eth1_monitor.nim -> el_monitor.nim (#4944) 2023-05-15 05:05:12 +00:00
Etan Kissling 98c30f600b
fix `getSyncCommitteeDuties` for `ALTAIR_FORK_EPOCH`.period (#4954)
When fetching historical `getSyncCommitteeDuties` for the very first
sync committee period, the case must be handled where Altair may not
have been scheduled on a sync committee period boundary.
2023-05-14 23:56:50 +00:00
tersec 6024b3e508
rm unused function and unexport some others (#4941) 2023-05-14 22:56:14 +00:00
Etan Kissling deb5818587
use compile-time year in `--version` copyright (#4946)
Instead of using current runtime year, use compile-time year in notice.

```
nimbus_beacon_node --version
```
2023-05-13 04:30:49 +00:00
Etan Kissling 0701038f76
log `bls_to_execution_changes_len` in `shortLog` (#4949)
* log `bls_to_execution_changes_len` in `shortLog`

When logging blocks to console, include num BLS to Execution changes.

* fix

* lint
2023-05-13 04:29:46 +00:00
tersec a9f080d92d
small validator pool proc/func and unused symbol cleanup (#4945) 2023-05-12 19:21:43 +00:00
Etan Kissling ea97e93e74
accelerate `getShufflingRef` (#4911)
When an uncached `ShufflingRef` is requested, we currently replay state
which can take several seconds. Acceleration is possible by:

1. Start from any state with locked-in `get_active_validator_indices`.
   Any blocks / slots applied to such a state can only affect that
   result for future epochs, so are viable for querying target epoch.
   `compute_activation_exit_epoch(state.slot.epoch) > target.epoch`

2. Determine highest common ancestor among `state` and `target.blck`.
   At the ancestor slot, same rules re `get_active_validator_indices`.
   `compute_activation_exit_epoch(ancestorSlot.epoch) > target.epoch`

3. We now have a `state` that shares history with `target.blck` up
   through a common ancestor slot. Any blocks / slots that the `state`
   contains, which are not part of the `target.blck` history, affect
   `get_active_validator_indices` at epochs _after_ `target.epoch`.

4. Select `state.randao_mixes[N]` that is closest to common ancestor.
   Either direction is fine (above / below ancestor).

5. From that RANDAO mix, mix in / out all RANDAO reveals from blocks
   in-between. This is just an XOR operation, so fully reversible.
   `mix = mix xor SHA256(blck.message.body.randao_reveal)`

6. Compute the attester dependent slot from `target.epoch`.
   `if epoch >= 2: (target.epoch - 1).start_slot - 1 else: GENESIS_SLOT`

7. Trace back from `target.blck` to the attester dependent slot.
   We now have the destination for which we want to obtain RANDAO.

8. Mix in all RANDAO reveals from blocks up through the `dependentBlck`.
   Same method, no special handling necessary for epoch transitions.

9. Combine `get_active_validator_indices` from `state` at `target.epoch`
   with the recovered RANDAO value at `dependentBlck` to obtain the
   requested shuffling, and construct the `ShufflingRef` without replay.

* more tests and simplify logic

* test with different number of deposits per branch

* Update beacon_chain/consensus_object_pools/blockchain_dag.nim

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

* `commonAncestor` tests

* lint

---------

Co-authored-by: Jacek Sieka <jacek@status.im>
2023-05-12 19:36:59 +02:00
Etan Kissling d263f7f0cb
fix SSZ response for `produceBlindedBlock` (#4943)
* fix SSZ response for `produceBlindedBlock`

In `produceBlindedBlock`, we sent the `ForkedBlindedBeaconBlock` when
requested to reply in SSZ format. However, expected result is just the
inner `ForkyBlindedBeaconBlock` together with `eth-consensus-version`.

Note: We do not use SSZ format in our VC for this endpoint at this time,
which explains why we haven't noticed earlier.

* fix Altair/Phase0
2023-05-12 15:40:45 +00:00
Jacek Sieka 51418a7894
Incremental pruning (#4887)
* Incremental pruning

When turning on pruning the first time the current pruning algorithm
will prune the full database at startup. This delays restart
unnecessarily, since all of the pruned space is not needed at once.

This PR introduces incremental pruning such that we will never prune
more than 32 blocks or the sync speed, whichever is higher.

This mode is expected to become default in a follow-up release.
2023-05-12 13:37:15 +03:00
Jacek Sieka 938d21f1ed
fix linking / compile warnings on pie/etc (#4939)
* fix linking / compile warnings on pie/etc

* oops

* too much nim of late

* quotes
2023-05-12 07:57:49 +00:00
Jacek Sieka 09a69c7b07
better batch sig verification failure message 2023-05-12 08:18:13 +02:00
tersec cc341e0ab7
remove unused definitions (#4937) 2023-05-11 14:39:36 +00:00
Jacek Sieka b3c6320d56
embed genesis states using incbin (#4905) 2023-05-11 11:11:00 +00:00
tersec 2fcc01f516
modify newPayload failure logging (#4930) 2023-05-11 13:58:25 +03:00
Etan Kissling 18bc47fe83
add Capella constants to REST config endpoint (#4925)
Capella constants were missing; if we want to support BLS changes from
VC, we need the new domain constant to check compatibility.
2023-05-11 12:53:02 +02:00
Etan Kissling e0f024c0f3
capella preset for Gnosis (#4936)
```
MAX_WITHDRAWALS_PER_PAYLOAD* = 8
MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP* = 8192
```

https://github.com/gnosischain/configs/pull/11
2023-05-11 09:56:32 +00:00
Etan Kissling 22c298c07b
final portion of trivial v1.3.0 bumps (#4926)
* final portion of trivial v1.3.0 bumps

Updates unchanged logic to latest v1.3.0 consensus-specs refs.

```
https://github.com/ethereum/consensus-specs/(blob|tree)/(?!v1\.3\.0/)
```

* lint
2023-05-11 09:54:29 +00:00
henridf 5dfd814588
Load trusted setup (#4870)
* Kzg: Load trusted setup

* scripts/launch_local_testnet.sh: set FIELD_ELEMENTS_PER_BLOB

* Use right setup file for mainnet/minimal

* Force rebuild

* Add comment explaining why build with -f
2023-05-11 11:52:44 +03:00
Etan Kissling e44b51e955
fix `attachMerkleProofs` to support multiple deposits (#4932)
`attachMerkleProofs` is used by `mockUpdateStateForNewDeposit` to create
a single deposit. The function doesn't work correctly when trying with
with multiple deposits, though. Fix this to enable more complex tests,
and also return the `deposit_root` for forming matching `Eth1Data`.
2023-05-11 11:45:55 +03:00
Etan Kissling a09b05bc27
fix `findShufflingRef` slot compute around genesis (#4910)
`dependent_slot` for epoch 2 is epoch 1's start slot - 1, not 0.
2023-05-11 11:39:40 +03:00
tersec a35c2c15b0
remove unused getBlock function (#4931) 2023-05-11 11:23:09 +03:00
henridf be3f5b1eac
More blob tweaks/fixes from running in devnet (#4933)
* BeaconNode: don't call fetchMissingblobs with empty list

* More logging

* BlockProcessor.checkBloblessSignature: Add missing return value
2023-05-11 00:36:35 +00:00
Etan Kissling 322429b191
final portion of non-trivial v1.3.0 bumps (#4927)
* final portion of non-trivial v1.3.0 bumps

Updates unchanged logic to latest v1.3.0 consensus-specs refs,
and cleans up surrounding sections / syncs comments, and so on.

```
https://github.com/ethereum/consensus-specs/(blob|tree)/(?!v1\.3\.0/)
```

* lint

* linebreak
2023-05-10 16:04:48 +02:00
tersec d3929cbb45
update some beacon API spec URLs; fix some Name and DuplicateModuleImport hints (#4929) 2023-05-10 10:20:55 +00:00
Etan Kissling 4873f8bdc4
update weak subjectivity calculations (#4923)
Weak subjectivity logic (`--weak-subjectivity-checkpoint`) was outdated.
Updated to latest specs, also taking into account total active balance.

See https://github.com/ethereum/consensus-specs/pull/2190
2023-05-10 08:23:59 +00:00
tersec e503cb4f51
make invalid execution payloads more visible (#4906) 2023-05-10 07:17:15 +00:00
Etan Kissling f4c215c5e6
cleanup `state_transition_epoch` and bump to v1.3.0 (#4922)
* cleanup `state_transition_epoch` and bump to v1.3.0

More v1.3.0 consensus-specs bumps, focused on `state_transition_epoch`.
Also fixed `current_epoch` spurious style check warning, and cleanup.

* Update beacon_chain/spec/state_transition_epoch.nim
2023-05-10 04:31:23 +02:00
Etan Kissling 34e7181b0d
`KZG(Commitment(s)?|Proof)` > `Kzg$1` (#4917)
Fix style-check by using matching capitalization for `nim-kzg` types.
2023-05-09 19:51:36 +00:00
Etan Kissling 93899b2e2a
consensus-specs v1.3.0 bumps with cleanup (#4918)
Some more consensus-specs v1.3.0 bumps. No semantic logic changes,
but also contains cleanup, so separate PR to reduce noise.
2023-05-09 20:16:49 +02:00
Etan Kissling e9319a5947
`bls_to_execution_changes` check alternative (#4916)
Make intent clearer about when to expect `bls_to_execution_changes`,
and replace test-time errors with compile-time errors if the field
is renamed or goes away in the future.
2023-05-09 17:24:02 +00:00
Etan Kissling b04970189b
more v1.3.0 consensus-specs bumps (#4915)
More spec references for unchanged logic bumped to v1.3.0.
2023-05-09 17:20:37 +00:00
Etan Kissling 5c5fbc088f
simplify FC weight computation (#4892)
Optimizations from https://github.com/ethereum/consensus-specs/pull/3246
avoid a couple unnecessary divisions when calculating proposer boost.
2023-05-09 10:16:13 +00:00
Etan Kissling 5b3c211285
`checkedReject` > `errReject` for CI failure (#4909)
The `SignedContributionAndProof: invalid contribution signature` check
is sometimes hit around fork boundaries when running local testnet.
To avoid failing CI, revert this isntance to a plain `errReject` until
the underlying problem is addressed.
2023-05-09 09:44:24 +00:00
zah 40253a76dd
Version 23.5.0 (#4913) 2023-05-09 11:17:18 +03:00
zah 5bf9284e62
Initial public version of the Verifying Web3Signer functionality (#4912)
* Allow the list of proved properties for web3signer to be configured
* Document the Web3Signer setups (regular, distributed and verified)
2023-05-09 11:16:43 +03:00
tersec 8f9bb391a3
don't consider attempt to route duplicate block an error (#4904) 2023-05-08 14:59:13 +02:00
henridf 53436c2b9b
Add blob validation condition (#4902) 2023-05-06 20:09:17 +00:00
Etan Kissling a23252c297
reorder `get_initial_beacon_block` by fork (#4899)
Deneb was listed between Capella and Bellatrix. Swap with Capella.
2023-05-06 10:32:59 +00:00
henridf 23adf15e5a
Blob handling sync fixes (#4888)
* Fix groupBlobs

* Fix getShortMap

* Fix blob handling in sync

* lint

* Add some blob-related logging
2023-05-06 08:58:50 +00:00
zah ae46be7020
Sign the blinded blocks only if they provide better value than the EL block (#4894) 2023-05-06 10:32:30 +02:00
Etan Kissling 1ebcd8b473
`excess_data_gas` after `withdrawals` cleanup (#4900)
We already updated the field order in the actual `ExecutionPayload`,
but in init code and tests / logs etc we still used the old order.
Update those occurrences to also match the field order in the struct.
Furthermore, add `excess_data_gas` to last entry in `test_eth1_monitor`.
2023-05-05 23:15:47 +00:00
Etan Kissling 297881edb7
bump gossip validation refs to 1.3.0 spec (#4895)
Updates gossip validation spec references to v1.3.0 and fixes an
incorrect reference to "signed_aggregate_and_proof" in sync contribution
documentation.
2023-05-05 22:48:33 +02:00
Etan Kissling 508819633a
more consensus-specs v1.3.0 bumps (#4898)
Updates more consensus-specs references to v1.3.0.
This PR only includes updates for sections otherwise unmodified.
2023-05-05 20:38:51 +00:00
Etan Kissling e408c7573d
bump more consensus-specs refs to v1.3.0 (with comments) (#4901)
Bump some more consensus-specs links to v1.3.0, and also align comments
with latest specs where they differ, and fix typos.
2023-05-05 20:37:56 +00:00
Etan Kissling 28968c11ba
remove `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` (#4897)
The `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` constant is no longer used as the
bouncing attack fix was removed:
https://github.com/ethereum/consensus-specs/pull/3290

Note: Some test networks still define the constant, ignoring the config
constant for now until it is no longer used.
2023-05-05 18:11:38 +00:00
Etan Kissling 0ad9ab446d
cleanup FC spec refs and align closer (#4893)
Bump FC spec references to v1.3.0, and visually align closer with
specs where trivial to do so without structural changes.
2023-05-05 17:03:54 +00:00
Zahary Karadjov d784672c10
Always use fresh HTTP connections for EL communication 2023-05-05 02:27:26 +03:00
tersec 2bd9e5a54c
log/read error from correct failed future (#4890) 2023-05-04 19:53:25 +03:00
zah 1e7eec18ce
Bugfix: Invalid execution header HTR leads to invalid state root (#4889) 2023-05-04 19:52:43 +03:00
Etan Kissling 4a1b94bc2e
update Deneb ANSI art for readability 🐟 (#4885)
Make "L" characters wider to improve readability.

Thanks to http://beatscribe.com (beatscribe#1008 on Discord)
2023-05-03 22:25:01 +02:00
Etan Kissling b5b51de67c
align `BeaconState` docs with latest spec (#4884)
Only comment changes:

- Bump refs to final v1.3.0 spec
- Align documentation style in various `BeaconState` structures
- Add `justification_bits` / `historical_roots` comment from spec
- Remove `previous_justified_checkpoint` from non-phase0 (same as spec)
- Cleanup some `Modified` tags
2023-05-03 13:05:46 +02:00
Zahary Karadjov 18d1f62ff1
Add logging for EL request time outs 2023-05-02 16:52:26 +03:00
Eugene Kabanov 0c75f9c2df
VC: Fix issue when optimistically synced node could block sync committee service functions. (#4878)
* Fix issue when optimistically synced node could block sync committee service functions.

* Update copyright year.
2023-05-02 14:54:44 +03:00
Etan Kissling ecaf6c8e92
harden gossip `strictVerification` in local testnets (#4880)
Fail local testnets on any gossip REJECT, instead of just asserting some
of the attestation related checks. This now also ensures that blocks,
BLS to Execution changes, blob sidecars and LC messages are checked
when running in a local testnet environment (`--verify-finalization`).

https://github.com/status-im/nimbus-eth2/pull/2904#discussion_r719603935
2023-05-02 13:06:02 +02:00
tersec dc32add555
only trigger liveness failsafe for mainnet (#4882)
* only trigger liveness failsafe for mainnet

* more user-friendly log
2023-05-01 11:45:39 +02:00
Etan Kissling bb62fee7d5
fix gossip validation for duplicate blob sidecars (#4881)
`SignedBlobSidecar: already have blob with valid signature` is IGNORE
in spec, but was implemented as REJECT. Align with spec.
2023-05-01 08:08:39 +02:00
henridf 5ccb085b9b
block_quarantine.nim: remove unused import (#4877)
leftover from #4844
2023-04-28 22:41:55 +00:00
henridf a32054cdd1
BlobQuarantine.hasBlobs: fix for loop bound (#4876) 2023-04-28 19:27:28 +00:00
henridf cf202fb928
Update nim-web3 (#4875)
Update to new version of nim-web3 incorporating the execution API
change that merges getPayloadV3 and getBlobsBundleV1.
2023-04-28 19:20:25 +00:00
henridf ef0b95dfbc
RequestManager: add support for fetching Blobs (#4844)
* RequestManager: add support for fetching Blobs

* Review feedback

* Lint

* Change peekSortedBlobless -> peekBlobless
2023-04-28 12:57:35 +00:00
Zahary Karadjov 3b58711e6b
Merge branch 'stable' into unstable 2023-04-28 00:12:37 +03:00
Zahary Karadjov e6a6019ef9
Fix the cross-compilation for Windows 2023-04-27 16:28:10 +03:00
Etan Kissling dd1ffa5ded
add `el_offline` to `/eth/v1/node/syncing` (#4860)
Add compatibility with https://github.com/ethereum/beacon-APIs/pull/290
to the beacon node. Behaviour when configured with multiple ELs is not
specified; intention suggests to indicate whether all ELs are offline.
2023-04-27 10:47:38 +02:00
henridf ea8ef5799e
Fill in missing BlobSidecar gossip check (#4863) 2023-04-26 17:33:33 +00:00
Etan Kissling 107f733365
make `--trusted-block-root` option visible for CP sync (#4859)
Add `--trusted-block-root` to `--help` for `trustedNodeSync`.
2023-04-26 13:37:58 +02:00
Etan Kissling c4e258af2a
check signatures in CP sync backfill with LC (#4858)
When using trusted node sync with light client (`--trusted-block-root`),
the trust assumption on the server is reduced to solely be responsible
for data availability, but not data correctness. This means that we must
check block proposer signatures against the downloaded checkpoint, as
they are not covered by the block root.

Note that this lowers the backfill speed when using LC based CP sync
due to the extra checks, by about 60% for me.
2023-04-26 13:37:27 +02:00
tersec 1ccb36b272
include small dedup in block processor to handle blockByRoot blocks (#4850) 2023-04-26 07:00:03 +00:00
zah 55ae7d3b00
Version 23.4.0 (#4857)
* Draft release notes for version 23.4.0

* Drop the reference to the Builder API failsafe spec PR
2023-04-25 22:46:38 +03:00
henridf da6169bfe9
BlockProcessor.storeBlock: write blobs to DB (#4854) 2023-04-25 13:55:35 +03:00
zah 9b2c07c118
Allow exiting multiple validators at once (#4855) 2023-04-25 09:44:01 +03:00