feat: admin_NodeInfo endpoint#312
Merged
Merged
Conversation
**Motivation** Our Kurtosis environment isn't working due to a bug introduced in my last PR. **Description** Declares the `BlockTotalDifficulties` table in `libmdbx::init_db()`. Closes none
mpaulucci
reviewed
Aug 29, 2024
| } | ||
|
|
||
| impl RpcRequest { | ||
| pub fn namespace(&self) -> Result<RpcNamespace, RpcErr> { |
mpaulucci
reviewed
Aug 29, 2024
| Eth(ChainConfig), | ||
| } | ||
|
|
||
| pub fn node_info(chain_config: ChainConfig, local_node: Node) -> Result<Value, RpcErr> { |
Collaborator
There was a problem hiding this comment.
instead of passing chain config as a param/context, you should be able to get it from storage
mpaulucci
approved these changes
Sep 2, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The RPC method
admin_nodeInfoof the admin namespace is a non standard endpoint that might be necessary for configuring the hive p2p tests, it provides information about the node's network and protocol configuration.Description
Introduces the RPC
admin_nodeInfoendpoint which is only accessible through the HTTP API. It returns the enode configuration and, for the eth protocol, the chain config that was set on genesis.To achieve this, a
ChainConfigstruct and aNodestruct representing the eth and p2p configurations respectively must be passed to the http request handler so that it can provide the correct response.This data is passed to the handler by adding it to the
RpcApiContextstruct .Introduces a small refactor to the net crate, extracting the types
EndpointNodeandNodeRecordto a publictypesmodule.Contains a small rewrite to the RPC routing of requests, separating them by namespace.
Example output:
Closes #248