Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2373] admin_nodeInfo rpc-api #1012

Merged
merged 5 commits into from
Mar 1, 2019
Merged

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Feb 28, 2019

PR description

Implement admin_nodeInfo RPC call. This involved bringing data from the
ethNetworkConfig and genesis json into the rpc call, so it had a lot of
testing side effects.

Fixed Issue(s)

PAN-2373

Implement admin_nodeInfo RPC call.  This involved bringing data from the
ethNetworkConfig and genesis json into the rpc call, so it had a lot of
testing side effects.
@@ -139,6 +146,8 @@

public Map<String, JsonRpcMethod> methods(
final String clientVersion,
final int networkId,
final JsonNode genesisConfigConfig,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genesisConfigConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config element of the genesisConfig.

"eth",
ImmutableMap.of(
"config",
genesisConfigConfig,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure what the right answer is here but I don't particularly like passing the "raw" json around so would be nice to use either the parsed GenesisConfigFile or GenesisConfigOptions here. That would then also ensure we return Pantheon's understanding of the genesis config, not just the raw text which avoids confusion when some setting isn't taking effect because it's misspelt as it wouldn't appear here at all.

I'm not sure if that justifies the extra complexity of having to reserialize the JSON or if there would be some reason to want to have unsupported options funnelled through to here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main question is do we want the literal config elements in the json text or do we want Pantheon's understanding of the options? Since we are doing live nodeInfo I think we want the understanding. Wiring up json de/serialization for the relevant interfaces should do the trick.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to ask JsonGenesisConfigOptions for its configRoot, which is already the type we need. But that is the unparsed and uninterpreted values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was wondering that. The big downside is that it's not quite the raw values (we normalise all keys to lower case) and not just what pantheon understands either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger. I think I can add an interface method to PantheonController to return the GenesisConfigOptions.

new ObjectMapper().readTree(ethNetworkConfig.getGenesisConfig()).get("config");
} catch (final IOException ioe) {
genesisConfigConfig = null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not keen on having to parse the JSON a second time here (as opposed to just in GenesisConfigFile.fromConfig).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The json de/serialization will address this.

shemnon and others added 2 commits February 28, 2019 08:42
I fudged on eip150Hash since we don't use it anywhere but every config
has it I go into the source and retrieve it.
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

}
if (cliqueConfigRoot.containsKey("blockperiodseconds")) {
builder.put("blockPeriodSeconds", getBlockPeriodSeconds());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting pedantic now but I wonder if we should always include this with the default value if none is set? Would make this a really useful API for what values are actually in effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of our existing json files have them, and a default is not called out in the spec. Consensus specs are a bad place for "this default that we have all agreed to by convention" values, so I'll always report them. Also, it makes the code cleaner. :)

@shemnon shemnon merged commit 8ee3328 into PegaSysEng:master Mar 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants