NDRS-149: Read the validator's secret key from disk#95
NDRS-149: Read the validator's secret key from disk#95Fraser999 merged 2 commits intocasper-network:masterfrom
Conversation
| /// `section.key=value` | ||
| fn from_str(input: &str) -> Result<Self, Self::Err> { | ||
| let re = Regex::new(r"^([^.]+)\.([^=]+)=(.+)$").unwrap(); | ||
| if let Some(captures) = re.captures(input) { |
There was a problem hiding this comment.
You could return early here:
let captures = re.captures(input).ok_or("could not parse config_ext (see README.md)")?;| match Self::ed25519_from_bytes(pem.contents) { | ||
| Ok(secret_key) => Ok(Some(secret_key)), | ||
| Err(error) => Err(error), | ||
| } |
There was a problem hiding this comment.
Maybe more concise:
Self::ed25519_from_bytes(pem.contents).map(Some)
Fraser999
left a comment
There was a problem hiding this comment.
We should probably specify somewhere in the README that paths provided in the config file must either be absolute, or relative to the config file itself.
No blockers though, so optimistic approval assuming that invalid README examples are updated.
| cargo run --release -- validator -p=resources/local/chainspec.toml -c=config.toml | ||
| ``` | ||
|
|
||
| If using a config file as described above, it is also possible to override and extend the values in the config file |
There was a problem hiding this comment.
I think we changed that so it doesn't only apply when using a config file. We could update this to say something more like:
It is also possible to specify individual config file options from the command line using one or more args in the form
of `-C <section>.<key>=<value>`. These will override values set in a config file if provided, or will override the
default values otherwise.
|
|
||
| ``` | ||
| cargo run --release -- validator -p=resources/example/chainspec.toml | ||
| cargo run --release -- validator -p=resources/local/chainspec.toml |
There was a problem hiding this comment.
| cargo run --release -- validator -p=resources/local/chainspec.toml | |
| cargo run --release -- validator -c=resources/local/config.toml |
|
|
||
| As well as the [example chainspec](resources/example/chainspec.toml), there is a commented | ||
| [example config file](resources/example/config.toml) in the same folder. | ||
| As well as the [local chainspec](resources/local/chainspec.toml), there is a commented |
There was a problem hiding this comment.
We can probably remove these lines altogether now, since we refer to the config file in the first example block above?
|
|
||
| impl ConfigExt { | ||
| /// Updates toml table with updated or extended kvp. | ||
| fn update_toml_table(&self, toml_value: &mut toml::Value) -> Option<()> { |
There was a problem hiding this comment.
I suppose we should bring toml::value::Table into scope so we don't need to fully qualify it everywhere. And toml::Value is already in scope, so we don't need to fully qualify it everywhere in this file.
fizyk20
left a comment
There was a problem hiding this comment.
I thought that actually passing the secret key to the consensus component will fall onto me as a part of my task, but I'm happy to see that it's done here already 😄
SyncLeap checks, deploy buffer purge, cleanups
95: Restart current round after unpausing. r=afck a=afck This resets `self.current_timeout` after unpausing. The effect is both that the current round's proposer immediately creates another proposal (unless they've already proposed), and that the other validators restart their timeout, so there is a chance the proposal will get accepted. In nctl tests with block time 0 the pause mode is often activated and deactivated in quick succession, which caused a lot of proposals getting dropped. This change fixes that problem. Closes https://github.com/casper-network/Governance/issues/342. Co-authored-by: Andreas Fackler <andreas@casperlabs.io>
* split fuel-tx into parallel jobs * fix clippy errors
We often need to convert directly from a panic reason to an io error, such as when performing to/from bytes encoding - in that case, the VM will not be intermediary to the operation and the conversion will be performed directly. This commit introduces a transparent conversion between the error types.
This PR retrieves the signing key for a validator from disk for use by consensus. The consensus component did not have a config section with which to contain this value; it does now.
Additionally, to allow ease of use when running multiple nodes to test a network with, support for providing overrides for values in config files via command line is also contained in this PR. The README.md has been updated with an example of how to use this functionality.
The chainspec.toml path was being passed to the initializer as part of a tuple; the value is moved into the config file as part of this PR. Using the above mentioned configured value override functionality, the default configured value can be overridden via command line if desired.
https://casperlabs.atlassian.net/browse/NDRS-149
Note: some example pem files are included which correspond (in positional order) to example public keys contained in an example accounts.csv file; they should only be used for testing or demonstration purposes.