2023-12-12 20:08:58 +00:00
|
|
|
# Fluffy
|
2024-01-12 21:06:19 +00:00
|
|
|
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
2023-12-12 20:08:58 +00:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
#
|
|
|
|
# The Portal bridge;s task is to inject content into the different Portal networks.
|
|
|
|
# The bridge acts as a middle man between a content provider (i.e. full node)
|
|
|
|
# through its exposed API (REST, JSON-RCP, ...), and a Portal node, through the
|
|
|
|
# Portal JSON-RPC API.
|
|
|
|
#
|
|
|
|
# Beacon Network:
|
|
|
|
#
|
2024-03-11 17:20:29 +00:00
|
|
|
# For the beacon network a consensus full node is required on one side,
|
2023-12-12 20:08:58 +00:00
|
|
|
# making use of the Beacon Node REST-API, and a Portal node on the other side,
|
|
|
|
# making use of the Portal JSON-RPC API.
|
|
|
|
#
|
|
|
|
# Portal Network <-> Portal Client (e.g. fluffy) <--JSON-RPC--> bridge <--REST--> consensus client (e.g. Nimbus-eth2)
|
|
|
|
#
|
|
|
|
# The Consensus client must support serving the Beacon LC data.
|
|
|
|
#
|
|
|
|
# Bootstraps and updates can be backfilled, however how to do this for multiple
|
|
|
|
# bootstraps is still unsolved.
|
|
|
|
#
|
|
|
|
# Updates, optimistic updates and finality updates are injected as they become
|
|
|
|
# available.
|
2024-03-11 17:20:29 +00:00
|
|
|
# Updating these as better updates come available is not yet implemented.
|
2023-12-12 20:08:58 +00:00
|
|
|
#
|
|
|
|
# History network:
|
|
|
|
#
|
2024-03-11 17:20:29 +00:00
|
|
|
# For the history network a execution client is required on one side, making use
|
|
|
|
# of the EL JSON-RPC API, and a Portal node on the other side, making use of the
|
|
|
|
# Portal JSON-RPC API.
|
|
|
|
#
|
|
|
|
# Portal Network <-> Portal Client (e.g. fluffy) <--Portal JSON-RPC--> bridge <--EL JSON-RPC--> execution client / web3 provider
|
|
|
|
#
|
|
|
|
# Backfilling is not yet implemented. Backfilling will make use of Era1 files.
|
2023-12-12 20:08:58 +00:00
|
|
|
#
|
|
|
|
# State network:
|
|
|
|
#
|
|
|
|
# To be implemented
|
|
|
|
#
|
|
|
|
|
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
import
|
|
|
|
chronos,
|
2024-02-28 17:31:45 +00:00
|
|
|
confutils,
|
|
|
|
confutils/std/net,
|
2023-12-12 20:08:58 +00:00
|
|
|
../../logging,
|
2024-03-22 18:01:22 +00:00
|
|
|
./[
|
|
|
|
portal_bridge_conf, portal_bridge_beacon, portal_bridge_history, portal_bridge_state
|
|
|
|
]
|
2023-12-12 20:08:58 +00:00
|
|
|
|
|
|
|
when isMainModule:
|
|
|
|
{.pop.}
|
|
|
|
let config = PortalBridgeConf.load()
|
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
setupLogging(config.logLevel, config.logStdout)
|
|
|
|
|
|
|
|
case config.cmd
|
|
|
|
of PortalBridgeCmd.beacon:
|
|
|
|
runBeacon(config)
|
|
|
|
of PortalBridgeCmd.history:
|
2024-03-11 17:20:29 +00:00
|
|
|
runHistory(config)
|
2023-12-12 20:08:58 +00:00
|
|
|
of PortalBridgeCmd.state:
|
2024-03-22 18:01:22 +00:00
|
|
|
runState(config)
|