feat: Make get_state_dir the overall directory containing all states#468
feat: Make get_state_dir the overall directory containing all states#468
Conversation
…execution state, consensus pool, and crypto.
|
looking. @ninegua I am adding feat: on the title. |
src/dfx/src/lib/replica_config.rs
Outdated
|
|
||
| impl ReplicaConfig { | ||
| pub fn new(state_root: &Path) -> Self { | ||
| pub fn new(state_root: &PathBuf) -> Self { |
There was a problem hiding this comment.
? Why would you take a reference to an owned object? Just do as_ref() when passing to ReplicaConfig::new()
There was a problem hiding this comment.
How about just passing PathBuf?
There was a problem hiding this comment.
Trying to recall where we use state_root. Generally https://doc.rust-lang.org/std/path/index.html gives an idea of how to think. I think we are using join, and we don't create our own pathbuf otherwise, so moving PathBuf in doesn't give us much, while we want state_root around. I think keeping &Path makes a bit more sense here.
There was a problem hiding this comment.
The code is actually a bit simpler with PathBuf than with Path, mostly due to other functions are using PathBuf too.
There was a problem hiding this comment.
I guess it is fine to move. I am not sure it is simpler. If there is an issue, we can change it again I guess.
src/dfx/src/lib/replica_config.rs
Outdated
| }, | ||
| state_manager: StateManagerConfig { | ||
| state_root: state_root.to_path_buf(), | ||
| state_root: state_root.join("ic_state"), |
There was a problem hiding this comment.
Ok, hm I think cleaning should still work, as we simply remove the directory with all its contents. Can you test it `dfx start --clean). I find ic_state, confusing then honestly. It should be something like execution_state? Or replicated_state (which is what replica uses.)
d2eebbb to
e2f063e
Compare
|
oh wait! This is not supported right now right? |
eftychis
left a comment
There was a problem hiding this comment.
We need to update dfinity to test this.
|
I've tested it with latest replica version, and it works correctly. |
|
The thing is we need to bring in the latest replica version. We should cut a replica release though perhaps. cc @p-shahi |
|
I assume that passing CI means it works with the current pinned version of replica too. So just sticking to sdk's normal release schedule is fine. (that is, take your time with updating replica version) |
hansl
left a comment
There was a problem hiding this comment.
It works because the new fields in the TOML are going to be ignored. I'm fine with this PR as is. LGTM.
## Changelog for advisory-db: Branch: master Commits: [rustsec/advisory-db@a0e59ff2...65b9aa70](rustsec/advisory-db@a0e59ff...65b9aa7) * [`0da539a2`](rustsec/advisory-db@0da539a) Add unmaintained crate advisory for `safe-nd` ([RustSec/advisory-db#467](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/467)) * [`51fd5e3c`](rustsec/advisory-db@51fd5e3) Assigned RUSTSEC-2020-0063 to safe-nd ([RustSec/advisory-db#469](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/469)) * [`3adba0fc`](rustsec/advisory-db@3adba0f) Add unmaintained crate advisory for `ffi_utils` ([RustSec/advisory-db#464](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/464)) * [`74c2e86f`](rustsec/advisory-db@74c2e86) Assigned RUSTSEC-2020-0064 to ffi_utils ([RustSec/advisory-db#470](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/470)) * [`a949bd46`](rustsec/advisory-db@a949bd4) Add unmaintained crate advisory for `fake_clock` ([RustSec/advisory-db#465](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/465)) * [`00a4c19a`](rustsec/advisory-db@00a4c19) Assigned RUSTSEC-2020-0065 to fake_clock ([RustSec/advisory-db#471](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/471)) * [`3761ab58`](rustsec/advisory-db@3761ab5) Add unmaintained crate advisory for `safe_bindgen` ([RustSec/advisory-db#466](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/466)) * [`d5cf9d76`](rustsec/advisory-db@d5cf9d7) Assigned RUSTSEC-2020-0066 to safe_bindgen ([RustSec/advisory-db#472](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/472)) * [`9757ff20`](rustsec/advisory-db@9757ff2) Add unmaintained crate advisory for `quic-p2p` ([RustSec/advisory-db#468](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/468)) * [`65b9aa70`](rustsec/advisory-db@65b9aa7) Assigned RUSTSEC-2020-0067 to quic-p2p ([RustSec/advisory-db#473](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/473))
## Changelog for advisory-db: Branch: master Commits: [rustsec/advisory-db@a0e59ff2...65b9aa70](rustsec/advisory-db@a0e59ff...65b9aa7) * [`0da539a2`](rustsec/advisory-db@0da539a) Add unmaintained crate advisory for `safe-nd` ([RustSec/advisory-db#467](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/467)) * [`51fd5e3c`](rustsec/advisory-db@51fd5e3) Assigned RUSTSEC-2020-0063 to safe-nd ([RustSec/advisory-db#469](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/469)) * [`3adba0fc`](rustsec/advisory-db@3adba0f) Add unmaintained crate advisory for `ffi_utils` ([RustSec/advisory-db#464](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/464)) * [`74c2e86f`](rustsec/advisory-db@74c2e86) Assigned RUSTSEC-2020-0064 to ffi_utils ([RustSec/advisory-db#470](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/470)) * [`a949bd46`](rustsec/advisory-db@a949bd4) Add unmaintained crate advisory for `fake_clock` ([RustSec/advisory-db#465](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/465)) * [`00a4c19a`](rustsec/advisory-db@00a4c19) Assigned RUSTSEC-2020-0065 to fake_clock ([RustSec/advisory-db#471](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/471)) * [`3761ab58`](rustsec/advisory-db@3761ab5) Add unmaintained crate advisory for `safe_bindgen` ([RustSec/advisory-db#466](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/466)) * [`d5cf9d76`](rustsec/advisory-db@d5cf9d7) Assigned RUSTSEC-2020-0066 to safe_bindgen ([RustSec/advisory-db#472](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/472)) * [`9757ff20`](rustsec/advisory-db@9757ff2) Add unmaintained crate advisory for `quic-p2p` ([RustSec/advisory-db#468](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/468)) * [`65b9aa70`](rustsec/advisory-db@65b9aa7) Assigned RUSTSEC-2020-0067 to quic-p2p ([RustSec/advisory-db#473](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/473))
## Changelog for common: Branch: master Commits: [dfinity-lab/common@36ace2b0...caa21e43](https://github.com/dfinity-lab/common/compare/36ace2b0fc6ad57391c76c09fe5508634f0b1e1d...caa21e43f85b077ed2f4c41feaa0af8ad7d94189) * [`caa21e43`](https://github.com/dfinity-lab/common/commit/caa21e43f85b077ed2f4c41feaa0af8ad7d94189) Removing dot ([dfinity-lab/common#468](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity-lab/common/issues/468))
## Changelog for common: Branch: master Commits: [dfinity-lab/common@36ace2b0...caa21e43](https://github.com/dfinity-lab/common/compare/36ace2b0fc6ad57391c76c09fe5508634f0b1e1d...caa21e43f85b077ed2f4c41feaa0af8ad7d94189) * [`caa21e43`](https://github.com/dfinity-lab/common/commit/caa21e43f85b077ed2f4c41feaa0af8ad7d94189) Removing dot ([dfinity-lab/common#468](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity-lab/common/issues/468))
The recent dfinity replica has gained support for persisting consensus artifacts (dfinity-lab/dfinity#2931). So it has to be configured too. Also there was a crypto_root that didn't get configured for dfx, so it always ended up in /tmp/ic_crypto.
This PR tries to put all three paths as sub-directories under the same
env.get_state_dir(). I'm actually not sure if this is correct. Please feel free to suggest otherwise.