Skip to content

Comments

feat: Make get_state_dir the overall directory containing all states#468

Merged
hansl merged 3 commits intomasterfrom
paulliu/add-crypto-artifact-pool-config
Mar 20, 2020
Merged

feat: Make get_state_dir the overall directory containing all states#468
hansl merged 3 commits intomasterfrom
paulliu/add-crypto-artifact-pool-config

Conversation

@ninegua
Copy link
Member

@ninegua ninegua commented Mar 19, 2020

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.

…execution state, consensus pool, and crypto.
@eftychis
Copy link
Contributor

looking.

@ninegua I am adding feat: on the title.

@eftychis eftychis changed the title Make get_state_dir the overall directory containing all states feat: Make get_state_dir the overall directory containing all states Mar 19, 2020

impl ReplicaConfig {
pub fn new(state_root: &Path) -> Self {
pub fn new(state_root: &PathBuf) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Why would you take a reference to an owned object? Just do as_ref() when passing to ReplicaConfig::new()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just passing PathBuf?

Copy link
Contributor

@eftychis eftychis Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is actually a bit simpler with PathBuf than with Path, mostly due to other functions are using PathBuf too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

},
state_manager: StateManagerConfig {
state_root: state_root.to_path_buf(),
state_root: state_root.join("ic_state"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

@ninegua ninegua force-pushed the paulliu/add-crypto-artifact-pool-config branch from d2eebbb to e2f063e Compare March 19, 2020 01:06
Copy link
Contributor

@eftychis eftychis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninegua Are you going to open the PR?? 😹

@eftychis
Copy link
Contributor

oh wait! This is not supported right now right?

Copy link
Contributor

@eftychis eftychis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update dfinity to test this.

@ninegua ninegua marked this pull request as ready for review March 19, 2020 19:42
@ninegua ninegua requested a review from a team as a code owner March 19, 2020 19:42
@ninegua
Copy link
Member Author

ninegua commented Mar 19, 2020

I've tested it with latest replica version, and it works correctly. dfx start --clean also works.

@eftychis
Copy link
Contributor

The thing is we need to bring in the latest replica version. We should cut a replica release though perhaps. cc @p-shahi

@ninegua
Copy link
Member Author

ninegua commented Mar 19, 2020

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)

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works because the new fields in the TOML are going to be ignored. I'm fine with this PR as is. LGTM.

@hansl hansl merged commit 4f98a0a into master Mar 20, 2020
@hansl hansl deleted the paulliu/add-crypto-artifact-pool-config branch March 20, 2020 02:42
dfinity-bot added a commit that referenced this pull request Nov 2, 2020
## 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))
mergify bot pushed a commit that referenced this pull request Nov 2, 2020
## 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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants