Rename lc_proxy to nimbus_verified_proxy (#1321)

* Change Light client proxy naming to verified proxy naming in code

* Rename the lc_proxy files to the verified proxy naming

* Update to the verified proxy name in the docs
This commit is contained in:
Kim De Mey 2022-11-23 17:11:38 +01:00 committed by GitHub
parent 7381ee8ff9
commit 99769cc0e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 112 additions and 104 deletions

View File

@ -1,8 +1,10 @@
name: CI
name: Nimbus CI
on:
push:
paths-ignore: ['doc/**', 'docs/**', '**/*.md', 'hive_integration/**',
'fluffy/**', '.github/workflows/fluffy.yml']
'fluffy/**', '.github/workflows/fluffy.yml',
'nimbus_verified_proxy/**', '.github/workflows/nimbus_verified_proxy.yml',
]
# Disable `pull_request`. Experimenting with using only `push` for PRs.
#pull_request:
# paths-ignore: ['doc/**', 'docs/**', '**/*.md', 'hive_integration/**']

View File

@ -1,19 +1,21 @@
name: Light client proxy CI
name: Nimbus verified proxy CI
on:
push:
paths:
- '.github/workflows/lc_proxy.yml'
- 'lc_proxy/**'
- '!lc_proxy/**.md'
- '.github/workflows/nimbus_verified_proxy.yml'
- 'nimbus_verified_proxy/**'
- '!nimbus_verified_proxy/**.md'
- '!nimbus_verified_proxy/docs/**'
- 'vendor/**'
- 'Makefile'
- 'nimbus.nimble'
pull_request:
paths:
- '.github/workflows/lc_proxy.yml'
- 'lc_proxy/**'
- '!lc_proxy/**.md'
- '.github/workflows/nimbus_verified_proxy.yml'
- 'nimbus_verified_proxy/**'
- '!nimbus_verified_proxy/**.md'
- '!nimbus_verified_proxy/docs/**'
- 'vendor/**'
- 'Makefile'
- 'nimbus.nimble'
@ -141,7 +143,7 @@ jobs:
uses: actions/cache@v2
with:
path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}-lc-proxy'
key: 'dlls-${{ matrix.target.cpu }}-verified-proxy'
- name: Install DLLs dependencies (Windows)
if: >
@ -173,36 +175,36 @@ jobs:
uses: actions/cache@v2
with:
path: NimBinaries
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}-lc-proxy'
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}-verified-proxy'
- name: Build Nim and Nimbus-eth1 dependencies
run: |
make -j${ncpu} ARCH_OVERRIDE=${PLATFORM} CI_CACHE=NimBinaries update
- name: Run lc proxy tests (Windows)
- name: Run verified proxy tests (Windows)
if: runner.os == 'Windows'
run: |
gcc --version
DEFAULT_MAKE_FLAGS="-j${ncpu}"
mingw32-make ${DEFAULT_MAKE_FLAGS} lc-proxy
build/lc_proxy.exe --help
mingw32-make ${DEFAULT_MAKE_FLAGS} lc-proxy-test
mingw32-make ${DEFAULT_MAKE_FLAGS} nimbus_verified_proxy
build/nimbus_verified_proxy.exe --help
mingw32-make ${DEFAULT_MAKE_FLAGS} nimbus-verified-proxy-test
- name: Run lc proxy tests (Linux)
- name: Run verified proxy tests (Linux)
if: runner.os == 'Linux'
run: |
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
DEFAULT_MAKE_FLAGS="-j${ncpu}"
env CC=gcc make ${DEFAULT_MAKE_FLAGS} lc-proxy
build/lc_proxy --help
env CC=gcc make ${DEFAULT_MAKE_FLAGS} nimbus_verified_proxy
build/nimbus_verified_proxy --help
# CC is needed to select correct compiler 32/64 bit
env CC=gcc CXX=g++ make ${DEFAULT_MAKE_FLAGS} lc-proxy-test
env CC=gcc CXX=g++ make ${DEFAULT_MAKE_FLAGS} nimbus-verified-proxy-test
- name: Run lc proxy tests (Macos)
- name: Run verified proxy tests (Macos)
if: runner.os == 'Macos'
run: |
DEFAULT_MAKE_FLAGS="-j${ncpu}"
make ${DEFAULT_MAKE_FLAGS} lc-proxy
build/lc_proxy --help
make ${DEFAULT_MAKE_FLAGS} nimbus_verified_proxy
build/nimbus_verified_proxy --help
# "-static" option will not work for osx unless static system libraries are provided
make ${DEFAULT_MAKE_FLAGS} lc-proxy-test
make ${DEFAULT_MAKE_FLAGS} nimbus-verified-proxy-test

View File

@ -69,7 +69,7 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
update \
nimbus \
fluffy \
lc_proxy \
nimbus_verified_proxy \
test \
test-reproducibility \
clean \
@ -230,16 +230,16 @@ utp-test: | build deps
fluffy-test-portal-testnet: | build deps
$(ENV_SCRIPT) nim fluffy_test_portal_testnet $(NIM_PARAMS) nimbus.nims
# Light Client Proxy related targets
# Nimbus Verified Proxy related targets
# Builds the lc proxy client
lc-proxy: | build deps
# Builds the nimbus_verified_proxy
nimbus_verified_proxy: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim lc_proxy $(NIM_PARAMS) nimbus.nims
$(ENV_SCRIPT) nim nimbus_verified_proxy $(NIM_PARAMS) nimbus.nims
# builds and runs the lc proxy test suite
lc-proxy-test: | build deps
$(ENV_SCRIPT) nim lc_proxy_test $(NIM_PARAMS) nimbus.nims
# builds and runs the nimbus_verified_proxy test suite
nimbus-verified-proxy-test: | build deps
$(ENV_SCRIPT) nim nimbus_verified_proxy_test $(NIM_PARAMS) nimbus.nims
# builds transition tool
t8n: | build deps
@ -259,7 +259,7 @@ evmstate_test: | build deps evmstate
# usual cleaning
clean: | clean-common
rm -rf build/{nimbus,fluffy,lc_proxy,$(TOOLS_CSV),all_tests,test_kvstore_rocksdb,test_rpc,all_fluffy_tests,all_fluffy_portal_spec_tests,test_portal_testnet,portalcli,blockwalk,eth_data_exporter,utp_test_app,utp_test,*.dSYM}
rm -rf build/{nimbus,fluffy,nimbus_verified_proxy,$(TOOLS_CSV),all_tests,test_kvstore_rocksdb,test_rpc,all_fluffy_tests,all_fluffy_portal_spec_tests,test_portal_testnet,portalcli,blockwalk,eth_data_exporter,utp_test_app,utp_test,*.dSYM}
rm -rf tools/t8n/{t8n,t8n_test}
rm -rf tools/evmstate/{evmstate,evmstate_test}
ifneq ($(USE_LIBBACKTRACE), 0)

View File

@ -97,10 +97,10 @@ task utp_test, "Run uTP integration tests":
task fluffy_test_portal_testnet, "Build test_portal_testnet":
buildBinary "test_portal_testnet", "fluffy/scripts/", "-d:chronicles_log_level=DEBUG -d:chronosStrictException -d:unittest2DisableParamFiltering -d:PREFER_BLST_SHA256=false"
## Light Client Proxy tasks
## Nimbus Verified Proxy tasks
task lc_proxy, "Build light client proxy":
buildBinary "lc_proxy", "lc_proxy/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false -d:libp2p_pki_schemes=secp256k1"
task nimbus_verified_proxy, "Build Nimbus verified proxy":
buildBinary "nimbus_verified_proxy", "nimbus_verified_proxy/", "-d:chronicles_log_level=TRACE -d:chronosStrictException -d:PREFER_BLST_SHA256=false -d:libp2p_pki_schemes=secp256k1"
task lc_proxy_test, "Run light proxy tests":
test "lc_proxy/tests", "test_proof_validation", "-d:chronicles_log_level=ERROR -d:chronosStrictException -d:nimbus_db_backend=sqlite -d:PREFER_BLST_SHA256=false"
task nimbus_verified_proxy_test, "Run Nimbus verified proxy tests":
test "nimbus_verified_proxy/tests", "test_proof_validation", "-d:chronicles_log_level=ERROR -d:chronosStrictException -d:nimbus_db_backend=sqlite -d:PREFER_BLST_SHA256=false"

View File

@ -1,6 +1,6 @@
# Nimbus Light Client Proxy
# Nimbus Verified Proxy
[![Nimbus Light Client Proxy CI](https://github.com/status-im/nimbus-eth1/actions/workflows/lc_proxy.yml/badge.svg)](https://github.com/status-im/nimbus-eth1/actions/workflows/lc_proxy.yml)
[![Nimbus Verified Proxy CI](https://github.com/status-im/nimbus-eth1/actions/workflows/nimbus_verified_proxy.yml/badge.svg)](https://github.com/status-im/nimbus-eth1/actions/workflows/nimbus_verified_proxy.yml)
![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)
[![License: Apache](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
@ -8,7 +8,7 @@
[![Discord: Nimbus](https://img.shields.io/badge/Discord-Nimbus-blue.svg)](https://discord.gg/XRxWahP)
[![Status: #nimbus-general](https://img.shields.io/badge/Status-nimbus--general-blue.svg)](https://join.status.im/nimbus-general)
The Nimbus Light Client Proxy is a very efficient light client for the Ethereum
The Nimbus Verified Proxy is a very efficient light client for the Ethereum
PoS network.
It exposes the standard [Ethereum JSON RPC Execution API](https://github.com/ethereum/execution-apis)
@ -20,30 +20,30 @@ The [consensus p2p light client](https://github.com/ethereum/consensus-specs/tre
is used to efficiently follow the tip of the consensus chain and
have access to the latest state hash.
As such the Nimbus Light Client Proxy turns the untrusted web3 data provider
As such the Nimbus Verified Proxy turns the untrusted web3 data provider
into a verified data source, and it can be directly used by any wallet that
relies on the Ethereum JSON RPC Execution API.
### Build the Nimbus Light Client Proxy from source
### Build the Nimbus Verified Proxy from source
```bash
# Clone the nimbus-eth1 repository
git clone git@github.com:status-im/nimbus-eth1.git
cd nimbus-eth1
# Run the build process
make lc-proxy
make nimbus_verified_proxy
# See available command line options
./build/lc_proxy --help
./build/nimbus_verified_proxy --help
```
### Run the Nimbus Light Client Proxy
### Run the Nimbus Verified Proxy
Two options need to be explicitly configured by the user:
* `--trusted-block-root`: The consensus light client starts syncing from a trusted block. This trusted block should be somewhat recent ([~1-2 weeks](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/weak-subjectivity.md)) and needs to be configured each time when starting the Nimbus Light Client Proxy.
* `--trusted-block-root`: The consensus light client starts syncing from a trusted block. This trusted block should be somewhat recent ([~1-2 weeks](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/weak-subjectivity.md)) and needs to be configured each time when starting the Nimbus Verified Proxy.
* `--web3-url` - As the proxy does not use any storage, it needs access to an Ethereum JSON RPC endpoint to provide the requested data. This can be a regular full node, or an external web3 data provider like
[Alchemy](https://www.alchemy.com/).
@ -52,10 +52,9 @@ Two options need to be explicitly configured by the user:
The latter is necessary to validate the provided data against the light client.
A second requirement is that data served from provider needs to match with
the ```--network``` option configured for the Nimbus Light Client Proxy. By default the light client proxy is configured to work on mainnet. Thus, the configured provider needs to serve mainnet data.
the ```--network``` option configured for the Nimbus Verified Proxy. By default the proxy is configured to work on mainnet. Thus, the configured provider needs to serve mainnet data.
This is verified on start-up by querying the provider its `eth_chainId` endpoint, and comparing the
received chain id with the one configured locally. If this validation fails, the Nimbus Light
Client Proxy will quit.
received chain id with the one configured locally. If this validation fails, the Nimbus Verified Proxy will quit.
> Note: Infura currently does not support the `eth_getProof` call.
@ -82,42 +81,42 @@ To start the proxy for the Goerli network, run the following command (inserting
```bash
# From the nimbus-eth1 repository
TRUSTED_BLOCK_ROOT=0x1234567890123456789012345678901234567890123456789012345678901234 # Replace this
./build/lc_proxy \
./build/nimbus_verified_proxy \
--network=goerli \
--trusted-block-root=${TRUSTED_BLOCK_ROOT} \
--web3-url="wss://eth-goerli.g.alchemy.com/v2/<ApiKey>"
```
### Using the Nimbus Light Client Proxy with existing Wallets
The Nimbus Light Client Proxy exposes the standard Ethereum JSON RPC Execution API and can thus be used
### Using the Nimbus Verified Proxy with existing Wallets
The Nimbus Verified Proxy exposes the standard Ethereum JSON RPC Execution API and can thus be used
as drop-in replacement for any Wallet that relies on this API.
By doing so, it turns an untrusted web3 data provider into a verified data source.
The Nimbus Light Client Proxy has been tested in combination with MetaMask.
The Nimbus Verified Proxy has been tested in combination with MetaMask.
The [MetaMask configuration page](./docs/metamask_configuration.md) explains how to configure the proxy, and how to configure MetaMask to make use of the proxy.
### Update and rebuild the Nimbus Light Client Proxy
### Update and rebuild the Nimbus Verified Proxy
```bash
# From the nimbus-eth1 repository
git pull
# To bring the git submodules up to date
make update
make lc-proxy
make nimbus_verified_proxy
```
### Run the Nimbus Light Client Proxy test suite
### Run the Nimbus Verified Proxy test suite
```bash
# From the nimbus-eth1 repository
make lc-proxy-test
make nimbus-verified-proxy-test
```
### Windows support
Follow the steps outlined [here](../README.md#windows) to build light client proxy on Windows.
Follow the steps outlined [here](../README.md#windows) to build Nimbus Verified Proxy on Windows.
## For Developers

View File

@ -1,4 +1,4 @@
# light client proxy
# nimbus_verified_proxy
# Copyright (c) 2022 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).
@ -13,9 +13,10 @@ import
stew/[results, keyed_queue]
## payloads received through block gossip (and validated by light client).
## Payloads are stored in order of arrival. When cache is full the oldest
## payload is deleted first.
## Cache for payloads received through block gossip and validated by the
## consensus light client.
## The payloads are stored in order of arrival. When the cache is full, the
## oldest payload is deleted first.
type BlockCache* = ref object
max: int
blocks: KeyedQueue[BlockHash, ExecutionPayloadV1]

View File

@ -3,11 +3,11 @@
This document explains how to configure the proxy, and how to configure MetaMask
to make use of the proxy.
### 1. Building the Nimbus Light Client Proxy
### 1. Building the Nimbus Verified Proxy
First build the Nimbus Light Client Proxy as explained [here](../README.md#Build-light-client-proxy).
First build the Nimbus Verified Proxy as explained [here](../README.md#Build-light-client-proxy).
### 2. Configuring and running the Nimbus Light Client Proxy
### 2. Configuring and running the Nimbus Verified Proxy
To start the proxy for the Goerli network, run the following command (inserting your own `TRUSTED_BLOCK_ROOT` and Alchemy `API_KEY`):
@ -16,14 +16,14 @@ To start the proxy for the Goerli network, run the following command (inserting
# From the nimbus-eth1 repository
TRUSTED_BLOCK_ROOT=0x1234567890123456789012345678901234567890123456789012345678901234 # Replace this
API_KEY=abcd # Replace this
./build/lc_proxy \
./build/nimbus_verified_proxy \
--network=goerli \
--trusted-block-root=${TRUSTED_BLOCK_ROOT} \
--web3-url="wss://eth-goerli.g.alchemy.com/v2/${API_KEY}"
```
After startup, the Nimbus Light Client Proxy will start looking for suitable peers in the network,
After startup, the Nimbus Verified Proxy will start looking for suitable peers in the network,
i.e peers which serve consensus light client data, and will then start syncing.
During syncing most of the RPC endpoints will be inactive
and will fail to respond to queries. This happens because the proxy cannot verify responses

View File

@ -1,13 +1,10 @@
# light client proxy
# nimbus_verified_proxy
# Copyright (c) 2022 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.
# This implements the pre-release proposal of the libp2p based light client sync
# protocol. See https://github.com/ethereum/consensus-specs/pull/2802
{.push raises: [Defect].}
import
@ -22,8 +19,8 @@ import
beacon_chain/spec/datatypes/[phase0, altair, bellatrix],
beacon_chain/[light_client, nimbus_binary_common, version],
../nimbus/rpc/cors,
./rpc/rpc_eth_lc_api,
./lc_proxy_conf,
./rpc/rpc_eth_api,
./nimbus_verified_proxy_conf,
./block_cache
from beacon_chain/gossip_processing/block_processor import newExecutionPayload
@ -47,7 +44,7 @@ func getConfiguredChainId(networkMetadata: Eth2NetworkMetadata): Quantity =
proc run() {.raises: [Exception, Defect].} =
{.pop.}
var config = makeBannerAndConfig(
"Nimbus light client " & fullVersionStr, LcProxyConf)
"Nimbus verified proxy " & fullVersionStr, VerifiedProxyConf)
{.push raises: [Defect].}
# Required as both Eth2Node and LightClient requires correct config type
@ -55,7 +52,7 @@ proc run() {.raises: [Exception, Defect].} =
setupLogging(config.logLevel, config.logStdout, config.logFile)
notice "Launching light client proxy",
notice "Launching Nimbus verified proxy",
version = fullVersionStr, cmdParams = commandLineParams(), config
let
@ -108,7 +105,7 @@ proc run() {.raises: [Exception, Defect].} =
authHooks
)
lcProxy = LightClientRpcProxy.new(rpcProxy, blockCache, chainId)
verifiedProxy = VerifiedRpcProxy.new(rpcProxy, blockCache, chainId)
optimisticHandler = proc(signedBlock: ForkedMsgTrustedSignedBeaconBlock):
Future[void] {.async.} =
@ -130,7 +127,7 @@ proc run() {.raises: [Exception, Defect].} =
network, rng, lcConfig, cfg, forkDigests, getBeaconTime,
genesis_validators_root, LightClientFinalizationMode.Optimistic)
lcProxy.installEthApiHandlers()
verifiedProxy.installEthApiHandlers()
info "Listening to incoming network requests"
network.initBeaconSync(cfg, forkDigests, genesisBlockRoot, getBeaconTime)
@ -154,7 +151,7 @@ proc run() {.raises: [Exception, Defect].} =
waitFor network.startListening()
waitFor network.start()
waitFor rpcProxy.start()
waitFor lcProxy.verifyChaindId()
waitFor verifiedProxy.verifyChaindId()
proc onFinalizedHeader(
lightClient: LightClient, finalizedHeader: BeaconBlockHeader) =

View File

@ -1,4 +1,4 @@
# beacon_chain
# nimbus_verified_proxy
# Copyright (c) 2022 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).
@ -21,11 +21,11 @@ export net, conf
proc defaultLCPDataDir*(): string =
let dataDir = when defined(windows):
"AppData" / "Roaming" / "LightClientProxy"
"AppData" / "Roaming" / "NimbusVerifiedProxy"
elif defined(macosx):
"Library" / "Application Support" / "LightClientProxy"
"Library" / "Application Support" / "NimbusVerifiedProxy"
else:
".cache" / "lightclientproxy"
".cache" / "nimbus-verified-proxy"
getHomeDir() / dataDir
@ -40,7 +40,7 @@ type
kind*: Web3UrlKind
web3Url*: string
type LcProxyConf* = object
type VerifiedProxyConf* = object
# Config
configFile* {.
desc: "Loads the configuration from a TOML file"
@ -147,11 +147,6 @@ type LcProxyConf* = object
"Peering agreements are established out of band and must be reciprocal."
name: "direct-peer" .}: seq[string]
# Light client
trustedBlockRoot* {.
desc: "Recent trusted finalized block root to initialize light client from"
name: "trusted-block-root" .}: Eth2Digest
rpcPort* {.
desc: "HTTP port for the JSON-RPC server"
defaultValue: 8545
@ -163,7 +158,12 @@ type LcProxyConf* = object
defaultValueDesc: $defaultAdminListenAddressDesc
name: "rpc-address" .}: ValidIpAddress
# There is no default as its need to be provided by the user
# No default - Needs to be provided by the user
trustedBlockRoot* {.
desc: "Recent trusted finalized block root to initialize the consensus light client from"
name: "trusted-block-root" .}: Eth2Digest
# No default - Needs to be provided by the user
web3url* {.
desc: "url of web3 data provider"
name: "web3-url" .}: ValidatedWeb3Url
@ -184,7 +184,7 @@ proc parseCmdArg*(T: type ValidatedWeb3Url, p: TaintedString): T
proc completeCmdArg*(T: type ValidatedWeb3Url, val: TaintedString): seq[string] =
return @[]
func asLightClientConf*(pc: LcProxyConf): LightClientConf =
func asLightClientConf*(pc: VerifiedProxyConf): LightClientConf =
return LightClientConf(
configFile: pc.configFile,
logLevel: pc.logLevel,
@ -210,7 +210,7 @@ func asLightClientConf*(pc: LcProxyConf): LightClientConf =
stopAtEpoch: 0
)
# TODO: Cannot use ClientConfig in LcProxyConf due to the fact that
# TODO: Cannot use ClientConfig in VerifiedProxyConf due to the fact that
# it contain `set[TLSFlags]` which does not have proper toml serialization
func asClientConfig*(url: ValidatedWeb3Url): ClientConfig =
case url.kind

View File

@ -1,4 +1,4 @@
# ligh client proxy
# nimbus_verified_proxy
# Copyright (c) 2022 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).
@ -26,7 +26,7 @@ import
export forks
logScope:
topics = "light_proxy"
topics = "verified_proxy"
proc `==`(x, y: Quantity): bool {.borrow, noSideEffect.}
@ -43,7 +43,7 @@ template encodeQuantity(value: Quantity): HexQuantityStr =
hexQuantityStr(encodeQuantity(value.uint64))
type
LightClientRpcProxy* = ref object
VerifiedRpcProxy* = ref object
proxy: RpcProxy
blockCache: BlockCache
chainId: Quantity
@ -81,14 +81,14 @@ func parseQuantityTag(blockTag: string): Result[QuantityTag, string] =
let quantity = ? parseHexQuantity(tag)
return ok(QuantityTag(kind: BlockNumber, blockNumber: quantity))
template checkPreconditions(proxy: LightClientRpcProxy) =
template checkPreconditions(proxy: VerifiedRpcProxy) =
if proxy.blockCache.isEmpty():
raise newException(ValueError, "Syncing")
template rpcClient(lcProxy: LightClientRpcProxy): RpcClient = lcProxy.proxy.getClient()
template rpcClient(lcProxy: VerifiedRpcProxy): RpcClient = lcProxy.proxy.getClient()
proc getPayloadByTag(
proxy: LightClientRpcProxy,
proxy: VerifiedRpcProxy,
quantityTag: string): results.Opt[ExecutionPayloadV1] {.raises: [ValueError, Defect].} =
checkPreconditions(proxy)
@ -107,7 +107,7 @@ proc getPayloadByTag(
return proxy.blockCache.getByNumber(tag.blockNumber)
proc getPayloadByTagOrThrow(
proxy: LightClientRpcProxy,
proxy: VerifiedRpcProxy,
quantityTag: string): ExecutionPayloadV1 {.raises: [ValueError, Defect].} =
let tagResult = getPayloadByTag(proxy, quantityTag)
@ -117,7 +117,7 @@ proc getPayloadByTagOrThrow(
return tagResult.get()
proc installEthApiHandlers*(lcProxy: LightClientRpcProxy) =
proc installEthApiHandlers*(lcProxy: VerifiedRpcProxy) =
lcProxy.proxy.rpc("eth_chainId") do() -> HexQuantityStr:
return encodeQuantity(lcProxy.chainId)
@ -259,18 +259,18 @@ proc installEthApiHandlers*(lcProxy: LightClientRpcProxy) =
return some(asBlockObject(executionPayload.get()))
proc new*(
T: type LightClientRpcProxy,
T: type VerifiedRpcProxy,
proxy: RpcProxy,
blockCache: BlockCache,
chainId: Quantity): T =
return LightClientRpcProxy(
return VerifiedRpcProxy(
proxy: proxy,
blockCache: blockCache,
chainId: chainId
)
proc verifyChaindId*(p: LightClientRpcProxy): Future[void] {.async.} =
proc verifyChaindId*(p: VerifiedRpcProxy): Future[void] {.async.} =
let localId = p.chainId
# retry 2 times, if the data provider will fail despite re-tries, propagate

View File

@ -1,3 +1,10 @@
# nimbus_verified_proxy
# Copyright (c) 2022 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.
import
std/typetraits,
eth/common/eth_types as etypes,

View File

@ -1,4 +1,4 @@
# light client proxy
# nimbus_verified_proxy
# Copyright (c) 2022 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).

View File

@ -1,4 +1,4 @@
# light client proxy
# nimbus_verified_proxy
# Copyright (c) 2022 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).