-
Notifications
You must be signed in to change notification settings - Fork 210
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow downloading guardian config #4415
Conversation
5a15875
to
20e45ff
Compare
Yikes! bytes embedded in a JSON file. Not exactly how I'd serve a binary file but I don't see why this can't work in the UI. I assume it was easy to integrate with the existing websockets API instead of spinning up and entire web server? |
Yes, exactly that 馃槄 馃槶 And since this will be called once in a blue moon efficiency wasn't really a concern at all. It actually gets worse: in the hex-encoded tar archive there is the |
0d90ea0
to
4255c63
Compare
@@ -183,6 +189,7 @@ tests_to_run_in_parallel=( | |||
"devimint_cli_test_single" | |||
"load_test_tool_test" | |||
"recoverytool_tests" | |||
"guardian_backup" |
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.
@bradleystachurski /@dpc am I holding it correctly?
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.
Yep, this is perfect. Do you know if this test takes a while? If so, we might want to move it higher up so parallel
starts it sooner.
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.
Nah, running it locally was under 30s I'd say
ea0aba6
to
2f0db52
Compare
@@ -89,6 +89,12 @@ function latency_test_restore() { | |||
} | |||
export -f latency_test_restore | |||
|
|||
function guardian_backup() { | |||
# guardian-backup-test runs a degraded federation, so we need to override FM_OFFLINE_NODES |
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.
馃憤
@elsirion: bump API version!!! |
This allows restoring single, completely lost guardians (DB and config gone). If fewer or equal to f guardians are lost restoring can happen fairly automatic as shown in the devimint test. For more than f guardians we'd need to implement a special procedure that lets the restoring ones trust the remaining ones for the correctness of consensus items from the ongoing session.
19d5d98
to
92cbc1c
Compare
@@ -1812,6 +1813,142 @@ pub async fn recoverytool_test(dev_fed: DevFed) -> Result<()> { | |||
Ok(()) | |||
} | |||
|
|||
pub async fn guardian_backup_test(dev_fed: DevFed, process_mgr: &ProcessManager) -> Result<()> { |
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.
Great test
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.
ack devimint changes
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.
Looks good!
if VersionReq::parse("<0.3.0-alpha")?.matches(&fedimint_cli_version) | ||
|| VersionReq::parse("<0.3.0-alpha")?.matches(&fedimintd_version) |
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.
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.
Will do a follow-up for your nits :)
}; | ||
|
||
write_file("backup.tar", &backup_tar); | ||
write_file("password.private", "pass".as_bytes()); |
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.
[nit] It might be more obvious how this filename is special using the pub const
write_file(
fedimint_server::config::io::PLAINTEXT_PASSWORD,
"pass".as_bytes(),
);
@@ -357,6 +357,12 @@ rec { | |||
buildPhaseCargoCommand = "patchShebangs ./scripts ; ./scripts/tests/latency-test.sh"; | |||
}; | |||
|
|||
guardianBackupTest = craneLibTests.mkCargoDerivation { |
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.
For devimint tests should we continue adding these? I believe we're only using ciTestAllBase
which will handle calling each individual test.
cc: @dpc
@@ -208,7 +208,7 @@ impl ServerConfig { | |||
pub fn supported_api_versions() -> SupportedCoreApiVersions { | |||
SupportedCoreApiVersions { | |||
core_consensus: CORE_CONSENSUS_VERSION, | |||
api: MultiApiVersion::try_from_iter([ApiVersion { major: 0, minor: 1 }]) | |||
api: MultiApiVersion::try_from_iter([ApiVersion { major: 0, minor: 2 }]) |
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.
Do we also need to bump the client core api version?
https://github.com/fedimint/fedimint/blob/427f09b/fedimint-client/src/lib.rs#L659
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.
I don't think so, we'd do that once we drop support for 0.0 afaik. @dpc
chore: address comments from #4415
Fixes #4039 on the
fedimintd
side, also needs a UI feature.@EthnTuttle, @Kodylow how hard would that be to integrate on the frontend side? It seems possible to download a file "from memory", although in the typical web tech hacky way 馃檲
For manual testing you can run
it decodes the returned hex and writes it to
backup.tar
. Comparing the files they look reasonably similar (some differences due to non-pretty encoding):TODO here: testing. I'm thinking of deleting the config of a guardian, replacing it with the tar archive versions and restarting it to see if it can start. I hope devimint supports such shenanigans.