Commit Graph

6817 Commits

Author SHA1 Message Date
Miran e1aa9e6de5
fix commit hash when publishing book (#6097)
Before, the commit hash was taken from the `gh-pages` branch,
instead from the branch used to publish the book.
2024-03-19 09:56:47 +01:00
Jacek Sieka ed1ef19bf4
use `assign` for forky state assignment (#6055) 2024-03-19 09:50:25 +01:00
Etan Kissling d4d27164f9
bump `nim-sqlite3-abi` to `1453b19b1a3cac24002dead15e02bd978cb52355` (#6096)
- bump `sqlite-amalgamation` to `3.45.2`
2024-03-18 00:17:29 +01:00
Etan Kissling d22dfaed41
bump `nim-ssz-serialization` to `0fc5e49093fa8d3c07476738e3257d0d8e7999a3` (#6095)
- more fixes for `distinct` integer types
- avoid double testing `--mm:refc`
2024-03-18 00:14:19 +01:00
Etan Kissling f40083f1e5
annotate `validator_db_aggregator` with `{.raises.}` (#6094)
Show proper error message when `validator_db_aggregator` raises errors.
2024-03-17 16:17:07 +01:00
Etan Kissling ef2411e1a0
use correct `INACTIVITY_SCORE_RECOVERY_RATE` if overridden from default (#6091)
When a config defines a different `INACTIVITY_SCORE_RECOVERY_RATE` than
the default, `process_inactivity_updates` uses an incorrect rate ever
since #2710 when `INACTIVITY_SCORE_RECOVERY_RATE` became configurable.
2024-03-17 13:32:30 +01:00
Etan Kissling 4aea780320
bump `nim-ssz-serialization` to `9bb15468c64851e9300ccab662f16a15be6d833e` (#6089)
- use `toSszType` for elements of `HashList|HashArray|List|array`
2024-03-17 02:46:49 +01:00
Etan Kissling 30460aad9c
bump `nim-chronos` to `47cc17719f4293bf80a22ebe28e3bfc54b2a59a1` (#6083)
- print warning when calling failed
2024-03-16 15:38:17 +01:00
Etan Kissling 74a238460b
bump `nim-json-rpc` to `ad8721e0f3c6925597b5a93b6c53e040f26b5fb3` (#6086)
- Export errors for json-rpc clients
2024-03-16 04:05:44 +00:00
Etan Kissling 448e610f8a
bump `nim-presto` to `a9687dda1c3e20d5b066d42b33c2a63f018af93f` (#6085)
- Add examples
2024-03-16 03:46:37 +00:00
Etan Kissling 78f3e03d53
bump `nim-libp2p` to `49a92e564167c0ffdcc86838c5e45cc985665d96` (#6084)
- default `MultiAddress` param for `newStandardSwitch` does not raise
- clean up triple lookup and avoid `KeyError` when adding muxer
- `{.async: (raises).}` for `relay/utils.nim`
- `{.async: (raises).}` annotations for `protocols/secure`
- avoid pointless exception raising in `dcutr/server`
2024-03-16 02:25:40 +00:00
Etan Kissling 82b8c96f72
bump `nim-results` to `e2adf66b8bc2f41606e8469a5f0a850d1e545b55` (#6082)
- Formatted with nph v0.5.1-0-gde5cd48
- Update CI
- ci: Combine c/c++
- extend `optValue` support for `Result[void, E]`
- Document a few fixes
2024-03-16 02:15:03 +00:00
Etan Kissling 7a7c024534
bump `nim-libbacktrace` to `027570111c161d8378bca9e84b5f75500a8c38a3` (#6081)
- bump `libbacktrace` to `7ead8c1ea2f4aeafe9c5b9ef8a9461a9ba781aa8`
2024-03-16 02:22:20 +01:00
Etan Kissling 2d52016e5c
bump `nim-stew` to `a0c085a51fe4f2d82aa96173ac49b3bfe6043858` (#6079)
- strformat: compile-time format string parser (backport Nim 2.2)
2024-03-16 02:08:54 +01:00
Etan Kissling b3bce7ce79
bump `nim-stint` to `3c238df6cd4b9c1f37a9f103383e7d2bbd420c13` (#6078)
- fix noInit to noinit; use evergreen GitHub Actions image versions
2024-03-16 01:53:35 +01:00
Etan Kissling 4a6ed0323e
bump `nim-libp2p` to `ae13a0d58301159e6b3bfc43fe23986c254c741a` (#6065)
- Send priority with queue fix
2024-03-15 22:49:01 +01:00
Etan Kissling 1bd5819dad
cache head block eligibility for fork choice (#6076)
When there are long periods of non-finality, `nodeIsViableForHead` has
been observed to consume significant time as it repeatedly walks the
non-finalized check graph as part of determining what heads are eligible
for fork choice. Caching the result resolves that.

Overall, it may still be better to prune fork choice more aggressively
when finality advances, to fully avoid the case specced out using the
linear scan. The current implementation is very close to spec, though,
so such a change should not be introduced without thorough testing.

The simple cache should allow significantly better performance on Goerli
while the network is still supported (Mid April).
2024-03-15 22:48:18 +01:00
tersec 0a6d189161
automated consensus spec URL updating to v1.4.0 (#6074) 2024-03-14 07:26:36 +01:00
Eugene Kabanov 72c844534f
Add Keymanager API graffiti endpoints. (#6054)
* Initial commit.

* Add more tests.

* Fix API mistypes.

* Fix mistypes in tests.

* Fix one more mistype.

* Fix affected tests because of error code 401.

* Add GetGraffitiResponse object.

* Add more tests.

* Fix compilation errors.

* Recover old behavior.

* Recover old behavior.

* Fix mistype.

* Test could not know default graffiti value.

* Make VC use adopted graffiti settings.

* Make BN use adopted graffiti settings.

* Update Alltests.

* Fix test.

* Revert "Fix test."

This reverts commit c735f855d3cb9c4a1c8e8af29d3f4438d068e31f.

* Workaround {.push raises.} requirement.

* Fix comment.

* Update Alltests.
2024-03-14 03:44:00 +00:00
tersec c3016a9bc5
use v1.4.0 consensus spec test vectors (#6072) 2024-03-13 21:42:40 +01:00
Etan Kissling 4e2ffca44a
use fixed max depth for `BlockRef` (#6070)
In `block_dag` there is a max depth of 100 years configured to detect
internal inconsistencies, e.g., circular references. As `BlockRef` was
changed long ago to only reflect the non-finalized chain segment, the
theoretically supported max depth can be reduced and simplified.
2024-03-13 13:01:51 +01:00
Etan Kissling efb1971d7e
pass `cfg` to `ETHBeaconClockCreateFromState` LC API (#6071)
We don't need the `cfg` right now, but it makes sense to have the object
passed to the clock so that the API doesn't break if we want to support
configurable `SECONDS_PER_SLOT`. As the `libnimbus_lc` library is not
yet widely used, better to add the argument now than later.
2024-03-13 13:01:39 +01:00
Etan Kissling 8bd8ffe2bb
align default `syncHorizon` computation logic across networks (#6066)
The `syncHorizon` describes the number of empty slots before the beacon
node considers itself to be out of sync. There are two places where we
currently set this to 50 slots, but it makes more sense to base it on
wall time, e.g., the 10 minutes that the default 50 are derived from.
2024-03-12 21:51:18 +01:00
kaiserd e56190c7aa
chore(vendor): update nim-libp2p path (#6069)
Signed-off-by: ksr <kaiserd@users.noreply.github.com>
Co-authored-by: ksr <kaiserd@users.noreply.github.com>
2024-03-12 20:57:21 +01:00
Etan Kissling 659be0b08e
bump `nim-kzg4844` to `057f7c653e1abe91cca9aac2f94832f39228ea98` (#6067)
- bump `c-kzg-4844` to `v1.0.0`
2024-03-12 18:32:04 +01:00
Etan Kissling 79b230828d
bump `nim-unittest2` to `e96f3215030cbfa13abc2f5827069b6f8ba87e38` (#6063)
- release `v0.2.2`
2024-03-12 03:35:37 +01:00
tersec 707409b8d3
make EL light client disk usage table consistent with hardware table (#6064) 2024-03-12 02:34:40 +00:00
Etan Kissling 1a9cafd3dd
bump `nim-libp2p` to `28609597d104a9be880ed5e1648e1ce18ca9dc38` (#6062)
- fix: allFuturesThrowing compilation issue on daily
- feat: Yamux timeout
- Fix empty path crash issue for MultiAddresses `unix`, `ip6zone`, `dns***`.
- fix: move transport interop tests to nim-libp2p repo
- use chronos 4.0.0
- fix typo in `ProtoMessage.toString()`
- increase tolerance of `simple heartbeat` test
- remove unused `MultiBase.encode(..., Cid)` function
- move `allFutureThrowing` helper to tests
- use new Chronos `trackCounter` APIs for leaks checks in tests
- remove unused `LPStreamError` types
- change `SecioError` and `NoiseError` to descendants of `LPStreamError`
- do not log yamux buffers without sanitization (trace log level)
- don't forget closing the stream when final `{Fin}` fails in yamux
- use `race` instead of `or` to avoid lockup
- in yamux, do not write `{Rst}` packet to stream that's in use
- avoid `KeyError` in edge case of yamux handler
- avoid triple lookup in `m.flushed` yamux table
- catch `WebSocketError` in `wstransport`
- define proper parent error type for `YamuxError`
- document known `--mm:orc` crash
- add `{.async: (raises).}` to `libp2p/stream` modules
2024-03-12 03:28:51 +01:00
tersec fd8429da74
rm Web3Signer Bellatrix block support (#6061) 2024-03-11 22:09:31 +00:00
Jacek Sieka 7d06edb7c9
Mention blob retention policy in docs (#6058) 2024-03-11 20:07:41 +00:00
Eugene Kabanov f088e5f57b
Consensus block value calculation for produceBlockV3 API call. (#5873)
* allow specifying get_proposer_reward block root at state.slot

* Add consensus_block_value calculation.

* Address review comments.

* Post-rebase adjustments.

* Use proper state to calculate consensus block value.

* Revert "allow specifying get_proposer_reward block root at state.slot"

This reverts commit 9fef9a8199f63056060527ac2531acc3b0ed8dcb.

* Fix post-revert problems.
Return back to Gwei.

* Adding test which is not working.

* Do not use test suite if it does not have post-state.

* Add debug logging.

* Increase logging to track sources of balance changes.

* Fix sync committee rewards/penalties calculation.

* Revert "Increase logging to track sources of balance changes."

This reverts commit 32feb20f2fdb66521401710866cd59ecc9951ef8.

* Adopt new vision to block rewards.

* Add block produce logging to VC.

* Remove rewards.nim.

* Eliminate toWei changes.

* Improve UInt256 shortLog.

* Fix conversion procedure.

* Address review comments.

* Fix test.

* Revert "Fix test."

This reverts commit 4948b2c1ec.

---------

Co-authored-by: tersec <tersec@users.noreply.github.com>
Co-authored-by: Etan Kissling <etan@status.im>
2024-03-11 14:18:50 +00:00
Jacek Sieka 2d519ac715
remove some unused rest serialization code (#6056) 2024-03-09 11:38:24 +01:00
Jacek Sieka 65c47c7769
Reapply "ssz: bump (#5996)" (#6037) (#6051)
* Reapply "ssz: bump (#5996)" (#6037)

This reverts commit a299d17fe7.

Fixed in https://github.com/status-im/nim-faststreams/pull/51

* bump
2024-03-09 10:25:39 +01:00
tersec 55ba43592b
req/resp status message requires zero hash for genesis finalized epoch (#6053) 2024-03-08 21:33:59 +01:00
Kim De Mey 513ccc1e0d
Bump eth2-networks for fixed LH bootstrap nodes on mainnet (#6052) 2024-03-08 20:02:28 +01:00
Etan Kissling 1cdd3c62fd
extend `syncEth1Chain tick` log (#6049)
Provide additional context in the `syncEth1Chain tick` debug log to aid
with understanding of flow when debugging on a more precise basis than
just having the metrics.
2024-03-08 19:27:45 +01:00
Etan Kissling 984d5e4631
fix regression when fetching genesis data in trustedNodeSync mode (#6047)
Corrects a regression from #5998 that led to crashes in #6046.
In `trustedNodeSync` mode, the config does not contain genesis keys,
so attempting to load from them is a `Defect`.
2024-03-08 14:52:54 +01:00
Etan Kissling a0bc3fff86
fix `/eth/v1/beacon/deposit_snapshot` for EIP-4881 (#6038)
Fix the `/eth/v1/beacon/deposit_snapshot` API to produce proper EIP-4881
compatible `DepositTreeSnapshot` responses. The endpoint used to expose
a Nimbus-specific database internal format.

Also fix trusted node sync to consume properly formatted EIP-4881 data
with `--with-deposit-snapshot`, and `--finalized-deposit-tree-snapshot`
beacon node launch option to use the EIP-4881 data. Further ensure that
`ncli_testnet` produces EIP-4881 formatted data for interoperability.
2024-03-08 14:22:03 +01:00
Etan Kissling f0f63c2c53
bump `nim-kzg4844` to `9d4b32e3fbadd77526e7faefa50ab6f507fe8583` (#6043)
- bump `c-kzg-4844` to `v0.4.3`
2024-03-08 12:17:47 +00:00
Etan Kissling 6f7138e7d0
bump `nim-libp2p` to `aa4ebb0b3c58ef26561741e355467d248ed7bf0d` (#6045)
- fix(hole-punching-interop): update nim to 1.6.16
- fix: compilation issue when `libp2p_expensive_metrics` is enabled.
- fix: more metrics issues when libp2p_expensive_metrics is enabled
- tests(flaky): Increase check timeouts
- docs: add comments and improve yamux readability
- test(flaky): Log checkExpiring failure
- fix: yamux metrics
- improvement: enhanced checkExpiring macro with custom timeout
- docs(general): Improve docs
2024-03-08 03:58:36 +00:00
Etan Kissling 8be52de557
bump `nim-libbacktrace` to `a6746c4df8dd8550ae5e75f4740f4470d5ed9aad` (#6044)
- bump `libbacktrace` to `f41cf1fecbc01966e0a3c32a1a54ff9cb0a19bb9`
2024-03-08 03:28:53 +00:00
Etan Kissling d1935376e3
bump `nim-json-rpc` to `a20ba207d25a9ab496518e84ec0c28b2d8d25ad7` (#6042)
- Introduce custom application error with optional data object
2024-03-08 01:53:09 +00:00
Etan Kissling 6d91305a7b
bump `nim-chronos` to `17b7a76c7e40c89f31351cd1a5faf76f177b30ac` (#6041)
- fix conversion error with `or` on futures with `{.async: (raises: []).}`
- Fix `or` deadlock issue.
- Ensure that `OwnCancelSchedule` flag will not be removed from `wait()` and `withTimeout()`.
- Add missing parts of defaults buffer size increase.
- Avoid `ValueError` effect in varargs `race`/`one`
- fix circular reference in timer
- Ensure `transp.reader` is reset to `nil` on error
2024-03-08 01:42:19 +00:00
Etan Kissling 96ebc32f26
bump `nim-bearssl` to `86f212c6a5d76b52e20fad2e318cc5436d04fc26` (#6040)
- release `v0.2.2`
2024-03-08 01:56:25 +01:00
Etan Kissling 5f641d09ff
bump `goerli` to `e3c0766b1cf5ddc22fe017e1389c6f60f0f9a468` (#6039)
- Delete `genesis_deposit_contract_snapshot.ssz` file
2024-03-08 01:33:28 +01:00
tersec 816361ed8c
Bloom filter acceleration for deposit processing (#5982) 2024-03-07 23:38:24 +00:00
Etan Kissling a299d17fe7
Revert "ssz: bump (#5996)" (#6037)
This reverts commit 21601f59e2.

Reason: `/eth/v1/beacon/light_client/updates?start_period=0&count=128`
provides malformed data. Reverting fixes it locally.

Download JSON and SSZ, then use this script to validate (Holesky).
Need to export some symbols for parsing.

```nim
import
  stew/io2,
  ./beacon_chain/spec/[digest, forks, helpers, presets],
  ./beacon_chain/spec/eth2_apis/[eth2_rest_serialization, rest_light_client_calls]

let jsonBytes = io2.readAllBytes("/Users/etan/Downloads/json_updates.json").get()

let
  (cfg, unknowns) = readRuntimeConfig("/Users/etan/Documents/Repos/nimbus-eth2/vendor/holesky/custom_config_data/config.yaml")
  genesis_validators_root = Eth2Digest.fromHex("0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1")
  forkDigests = newClone ForkDigests.init(cfg, genesis_validators_root)

let updates = seq[ForkedLightClientUpdate].decodeJsonLightClientObjects(jsonBytes, cfg, forkDigests)

var entries = newSeqOfCap[RestVersioned[ForkedLightClientUpdate]](updates.len)
for update in updates:
  let
    contextEpoch = withForkyUpdate(update):
      when lcDataFork > LightClientDataFork.None:
        forkyUpdate.contextEpoch
      else:
        continue
    contextFork = cfg.consensusForkAtEpoch(contextEpoch)
  entries.add RestVersioned[ForkedLightClientUpdate](
    data: update,
    jsonVersion: contextFork,
    sszContext: forkDigests[].atconsensusFork(contextFork))

let res =
  block:
    var default: seq[byte]
    try:
      var stream = memoryOutput()
      for e in entries:
        withForkyUpdate(e.data):
          when lcDataFork > LightClientDataFork.None:
            var cursor = stream.delayFixedSizeWrite(sizeof(uint64))
            let initPos = stream.pos
            stream.write e.sszContext.data
            var writer = SszWriter.init(stream)
            writer.writeValue forkyUpdate
            cursor.finalWrite (stream.pos - initPos).uint64.toBytesLE()
      stream.getOutput(seq[byte])
    except SerializationError:
      default
    except IOError:
      default

let sszBytes = io2.readAllBytes("/Users/etan/Downloads/ssz_updates.ssz").get()

let sszUpdates = seq[ForkedLightClientUpdate].decodeSszLightClientObjects(res, cfg, forkDigests)
doAssert updates.len == sszUpdates.len
for i in 0 ..< updates.len:
  doAssert updates[i].kind == sszUpdates[i].kind
  withForkyUpdate(updates[i]):
    when lcDataFork > LightClientDataFork.None:
      doAssert forkyUpdate == sszUpdates[i].forky(lcDataFork)

doAssert sszBytes == res
```
2024-03-07 22:37:03 +00:00
tersec 11d522dd86
use debug- prefix for Yamux experimental support (#6010) 2024-03-07 19:52:13 +01:00
Etan Kissling 50a43f397f
rename `DepositTreeSnapshot` -> `DepositContractSnapshot` (#6036)
EIP-4881 was never correctly implemented, the `DepositTreeSnapshot`
structure has nothing to do with its actual definition. Reflect that
by renaming the type to a Nimbus-specific `DepositContractSnapshot`,
so that an actual EIP-4881 implementation can use the correct names.

- https://eips.ethereum.org/EIPS/eip-4881#specification

Notably, `DepositTreeSnapshot` contains a compressed sequence in
`finalized`, only containing the minimally required intermediate roots.

That also explains the incorrect REST response reported in #5508.

The non-canonical representation was introduced in #4303 and is also
persisted in the database. We'll have to maintain it for a while.
2024-03-07 18:42:52 +01:00
Etan Kissling 3b4b1ccb89
metrics for proposer and sync duties (#6028)
To avoid restarting with scheduled proposals or sync duties, which are
rare but have high rewards, add metrics to simpify tracking them.
2024-03-07 15:08:48 +01:00