avalanche-network-runner
avalanche-network-runner copied to clipboard
Support supplying NodeConfig via AddNode RPC call
The AddNode
RPC API appears to accept NodeConfig (enabling the caller to specify any relevant configuration value for a new node), but actually converts the values supplied as NodeConfig to flags for the invocation of avalanchego that starts the node. This seems potentially problematic:
- a caller trying to supply NodeConfig values (e.g.
stakingKey
) will see node addition fail with ANR logging avalanchego's complaint that the flag name is unrecognized:-
[my-new-node-1] couldn't configure flags: unknown flag: --stakingKey
-
- a caller providing a NodeConfig value as a flag (e.g.
--staking-tls-key-contents
) will be able to set the value provided to the invocation of avalanchego but the internal addNode method won't use it. - In the specific case of
--staking-tls-key-contents
being specified in an RPC call to AddNode, the internal addNode method always generates a new value for stakingKey and uses it to derive the node ID such that a new node's ID could be one thing in the network and another in ANR. - However, it's non-trivial to correctly supply a key as a flag to AddNode via RPC, as that requires being able to reliably round-trip a key through proto to a commandline arg. If the current approach of only configuring node addition via flags were to continue, more documentation might be suggested. Following the example of supplying a stringified key (modulo escaping newlines) results in an error:
-
rpc error: code = Unknown desc = invalid character '-' after object key
-
Resolution of at least some of these concerns will aid in the migration of one of the Kurtosis tests (https://github.com/ava-labs/avalanchego/pull/1573).
Hi! Effectively the naming is misleading. AddNode RPC call receives node flags not node config.
- https://github.com/ava-labs/avalanche-network-runner/issues/586
But passing network config to start and node config to add node is a long delayed idea and this seems to be a good moment to work on it.
- https://github.com/ava-labs/avalanche-network-runner/issues/587
- https://github.com/ava-labs/avalanche-network-runner/issues/588
Point related to staking keys is valid. ANR in some cases expects one way to input information from the user, and other avago flags usage can cause inconsistencies.
- https://github.com/ava-labs/avalanche-network-runner/issues/589
Thanks!