-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New cli command to change federation parameters #167
Conversation
…ion through xfield Add tests to verify aggregated-public-key and max-block-size and the file dump
separate filename from the code by making it a separate constant
871fdc6
to
bb6d564
Compare
register and unregister commands write to one file now.
fix formatting in federation change command
Cargo.toml
Outdated
@@ -7,7 +7,7 @@ edition = "2018" | |||
|
|||
[dependencies] | |||
http = "0.1.17" | |||
tapyrus = { git = "https://github.com/chaintope/rust-tapyrus", tag = "v0.4.5", features = ["use-serde", "rand"] } | |||
tapyrus = { git = "https://github.com/chaintope/rust-tapyrus", tag = "v0.4.7", features = ["use-serde", "rand"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's published to crates.io, you don't need to set a repository url like other libraries.
} | ||
|
||
let xfield_public_key: XField = match matches.value_of("aggregated-public-key") { | ||
Some(key) => match tapyrus::PublicKey::from_str(key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to check whether it is a compressed public key or not.
src/cli/setup/federation_change.rs
Outdated
let xfield_public_key: XField = match matches.value_of("aggregated-public-key") { | ||
Some(key) => match tapyrus::PublicKey::from_str(key) { | ||
Ok(public_key) => XField::AggregatePublicKey(public_key), | ||
Err(_) => XField::None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If parsing fails, an error should be returned along with the cause.
src/cli/setup/federation_change.rs
Outdated
let xfield_max_block_size: XField = match matches.value_of("max-block-size") { | ||
Some(s) => match s.parse::<u32>() { | ||
Ok(x) => XField::MaxBlockSize(x), | ||
Err(_) => XField::None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If parsing fails, an error should be returned along with the cause.
); | ||
assert!(res.is_ok()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test for the result file in case of multiple registrations.
// -V, --version Prints version information | ||
// | ||
//OPTIONS: | ||
// --aggregated-public-key <aggregated-public-key> aggregated public key of the new federation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you update the aggregated public key with --aggregated-public-key
, don't you also need the threshold
and node-vss
described in federations.toml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh! this needs further discussion. I'll describe in the issue
remove git repo url from rust-tapyrus
closed as the implementation is different now and c new command is not needed |
New command with name federation is added to register or unregister changes in the federation.
Only register is implemented in the PR. Register creates a file named
federationchange.dat
with the given xfield parameters in the directory$HOME/.tapyrus_signer
.federationchange.dat
file contains all pending xfield changes encoded in hex and sorted by height<height><xfield>
tests use the file path ./target/federationchange_test.dat