diff --git a/fluffy/fluffy.nim b/fluffy/fluffy.nim index 025badac3..1558bc3ae 100644 --- a/fluffy/fluffy.nim +++ b/fluffy/fluffy.nim @@ -28,7 +28,7 @@ import ./rpc/[ rpc_eth_api, rpc_debug_api, rpc_discovery_api, rpc_portal_common_api, rpc_portal_history_api, rpc_portal_beacon_api, rpc_portal_state_api, - rpc_portal_debug_history_api, + rpc_portal_nimbus_beacon_api, rpc_portal_debug_history_api, ], ./database/content_db, ./portal_node, @@ -273,6 +273,7 @@ proc run( rpcServer.installPortalBeaconApiHandlers( node.beaconNetwork.value.portalProtocol ) + rpcServer.installPortalNimbusBeaconApiHandlers(node.beaconNetwork.value) if node.stateNetwork.isSome(): rpcServer.installPortalCommonApiHandlers( node.stateNetwork.value.portalProtocol, PortalSubnetwork.state diff --git a/fluffy/network/beacon/beacon_network.nim b/fluffy/network/beacon/beacon_network.nim index 9e8c289d6..3806fd4f9 100644 --- a/fluffy/network/beacon/beacon_network.nim +++ b/fluffy/network/beacon/beacon_network.nim @@ -357,7 +357,7 @@ proc validateContent( debug "Received offered content validated successfully", contentKey else: - error "Received offered content failed validation", + debug "Received offered content failed validation", contentKey, error = validation.error return false diff --git a/fluffy/rpc/rpc_portal_nimbus_beacon_api.nim b/fluffy/rpc/rpc_portal_nimbus_beacon_api.nim new file mode 100644 index 000000000..c0caa19a3 --- /dev/null +++ b/fluffy/rpc/rpc_portal_nimbus_beacon_api.nim @@ -0,0 +1,19 @@ +# nimbus +# Copyright (c) 2024 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. + +{.push raises: [].} + +import json_rpc/rpcserver, ../network/beacon/beacon_network + +export rpcserver + +# Nimbus/fluffy specific RPC methods for the Portal beacon network. +proc installPortalNimbusBeaconApiHandlers*(rpcServer: RpcServer, n: BeaconNetwork) = + rpcServer.rpc("portal_nimbus_beaconSetTrustedBlockRoot") do(blockRoot: string) -> bool: + let root = Digest.fromHex(blockRoot) + n.trustedBlockRoot = Opt.some(root) + true